- more texture cleanup.

It is now in a state where FTexture really needs to be separated from FGameTexture.
This commit is contained in:
Christoph Oelckers 2020-04-15 18:59:14 +02:00
commit 83817080bb
21 changed files with 91 additions and 103 deletions

View file

@ -338,7 +338,7 @@ void VkRenderState::ApplyStreamData()
mStreamData.useVertexData = passManager->GetVertexFormat(static_cast<VKVertexBuffer*>(mVertexBuffer)->VertexFormat)->UseVertexData;
if (mMaterial.mMaterial && mMaterial.mMaterial->Source())
mStreamData.timer = static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mMaterial.mMaterial->Source()->shaderspeed / 1000.);
mStreamData.timer = static_cast<float>((double)(screen->FrameTime - firstFrame) * (double)mMaterial.mMaterial->Source()->GetShaderSpeed() / 1000.);
else
mStreamData.timer = 0.0f;
@ -386,7 +386,7 @@ void VkRenderState::ApplyPushConstants()
if (mMaterial.mMaterial)
{
auto source = mMaterial.mMaterial->Source();
mPushConstants.uSpecularMaterial = { source->Glossiness, source->SpecularLevel };
mPushConstants.uSpecularMaterial = { source->GetGlossiness(), source->GetSpecularLevel() };
}
mPushConstants.uLightIndex = mLightIndex;

View file

@ -516,7 +516,7 @@ sector_t *VulkanFrameBuffer::RenderViewpoint(FRenderViewpoint &mainvp, AActor *
void VulkanFrameBuffer::RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV)
{
// This doesn't need to clear the fake flat cache. It can be shared between camera textures and the main view of a scene.
FMaterial *mat = FMaterial::ValidateTexture(tex, false);
FMaterial *mat = FMaterial::ValidateTexture(reinterpret_cast<FGameTexture*>(tex), false);
auto BaseLayer = static_cast<VkHardwareTexture*>(mat->GetLayer(0, 0));
float ratio = (float)tex->GetDisplayWidthDouble() / (float)tex->GetDisplayHeightDouble();
@ -647,7 +647,7 @@ void VulkanFrameBuffer::CleanForRestart()
void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
{
if (mat->Source()->isSWCanvas()) return;
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
// Textures that are already scaled in the texture lump will not get replaced by hires textures.
int flags = mat->isExpanded() ? CTF_Expand : 0;

View file

@ -112,19 +112,15 @@ void VkHardwareTexture::ResetAllDescriptors()
VulkanDescriptorSet *VkHardwareTexture::GetDescriptorSet(const FMaterialState &state)
{
FMaterial *mat = state.mMaterial;
FTexture *base = state.mMaterial->Source();
auto base = state.mMaterial->Source();
int clampmode = state.mClampMode;
int translation = state.mTranslation;
if (base->UseType == ETextureType::SWCanvas) clampmode = CLAMP_NOFILTER;
if (base->isHardwareCanvas()) clampmode = CLAMP_CAMTEX;
else if ((base->isWarped() || base->shaderindex >= FIRST_USER_SHADER) && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE;
clampmode = base->GetClampMode(clampmode);
// Textures that are already scaled in the texture lump will not get replaced by hires textures.
int flags = state.mMaterial->isExpanded() ? CTF_Expand : 0;
if (base->isHardwareCanvas()) static_cast<FCanvasTexture*>(base)->NeedUpdate();
for (auto &set : mDescriptorSets)
{
if (set.descriptor && set.clampmode == clampmode && set.flags == flags) return set.descriptor.get();