Make linearized depth data available to translucent material shaders via the texture name SceneLinearDepth. Does it work? Who knows!

This commit is contained in:
Magnus Norddahl 2024-09-08 02:32:01 +02:00
commit 1b8effe1ea
17 changed files with 183 additions and 32 deletions

View file

@ -355,6 +355,12 @@ IHardwareTexture *VulkanRenderDevice::CreateHardwareTexture(int numchannels)
return new VkHardwareTexture(this, numchannels);
}
IHardwareTexture* VulkanRenderDevice::CreateSceneTexture(FSceneTexture* owner)
{
mSceneTextureOwners[owner->Type] = owner;
return new VkHardwareTexture(this, owner->Type);
}
FMaterial* VulkanRenderDevice::CreateMaterial(FGameTexture* tex, int scaleflags)
{
return new VkMaterial(this, tex, scaleflags);
@ -535,6 +541,7 @@ void VulkanRenderDevice::BeginFrame()
mTextureManager->BeginFrame();
mScreenBuffers->BeginFrame(screen->mScreenViewport.width, screen->mScreenViewport.height, screen->mSceneViewport.width, screen->mSceneViewport.height);
mSaveBuffers->BeginFrame(SAVEPICWIDTH, SAVEPICHEIGHT, SAVEPICWIDTH, SAVEPICHEIGHT);
UpdateSceneTextureSizes();
mRenderState->BeginFrame();
mDescriptorSetManager->BeginFrame();
mLightmapper->BeginFrame();
@ -622,6 +629,18 @@ void VulkanRenderDevice::SetSaveBuffers(bool yes)
{
if (yes) mActiveRenderBuffers = mSaveBuffers.get();
else mActiveRenderBuffers = mScreenBuffers.get();
UpdateSceneTextureSizes();
}
void VulkanRenderDevice::UpdateSceneTextureSizes()
{
for (auto& it : mSceneTextureOwners)
{
if (it.second)
{
it.second->SetSize(mActiveRenderBuffers->GetSceneWidth(), mActiveRenderBuffers->GetSceneHeight());
}
}
}
void VulkanRenderDevice::ImageTransitionScene(bool unknown)
@ -634,6 +653,11 @@ FRenderState* VulkanRenderDevice::RenderState()
return mRenderState.get();
}
void VulkanRenderDevice::UpdateLinearDepthTexture()
{
mPostprocess->UpdateLinearDepthTexture();
}
void VulkanRenderDevice::AmbientOccludeScene(float m5)
{
mPostprocess->AmbientOccludeScene(m5);