mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-07 22:35:47 +00:00
Create separate pipeline & render pass for sRGB 8-bit remapping
* Normally we only need one remap per bitness and per type, but for 8-bit float/unorm we need to distinguish between plain unorm and sRGB unorm.
This commit is contained in:
@@ -3209,6 +3209,16 @@ void VulkanReplay::TextureRendering::Init(WrappedVulkan *driver, VkDescriptorPoo
|
||||
CREATE_OBJECT(RemapPipeline[f][i][0], texRemapInfo);
|
||||
|
||||
driver->vkDestroyRenderPass(driver->GetDev(), texRemapInfo.renderPass, NULL);
|
||||
|
||||
// reuse float 'green' as srgb
|
||||
if(f == 0 && i == 0)
|
||||
{
|
||||
CREATE_OBJECT(texRemapInfo.renderPass, VK_FORMAT_R8G8B8A8_SRGB);
|
||||
|
||||
CREATE_OBJECT(RemapPipeline[f][i][1], texRemapInfo);
|
||||
|
||||
driver->vkDestroyRenderPass(driver->GetDev(), texRemapInfo.renderPass, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3217,17 +3227,17 @@ void VulkanReplay::TextureRendering::Init(WrappedVulkan *driver, VkDescriptorPoo
|
||||
|
||||
for(int f = 0; f < 3; f++)
|
||||
{
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
texRemapInfo.fragment =
|
||||
shaderCache->GetBuiltinModule(BuiltinShader::TexRemap, BuiltinShaderBaseType(i));
|
||||
// only create this for uint, it's normally only needed there
|
||||
int i = 1;
|
||||
|
||||
CREATE_OBJECT(texRemapInfo.renderPass, GetViewCastedFormat(formats[f], cast[i]));
|
||||
texRemapInfo.fragment =
|
||||
shaderCache->GetBuiltinModule(BuiltinShader::TexRemap, BuiltinShaderBaseType(i));
|
||||
|
||||
CREATE_OBJECT(RemapPipeline[f][i][1], texRemapInfo);
|
||||
CREATE_OBJECT(texRemapInfo.renderPass, GetViewCastedFormat(formats[f], cast[i]));
|
||||
|
||||
driver->vkDestroyRenderPass(driver->GetDev(), texRemapInfo.renderPass, NULL);
|
||||
}
|
||||
CREATE_OBJECT(RemapPipeline[f][i][1], texRemapInfo);
|
||||
|
||||
driver->vkDestroyRenderPass(driver->GetDev(), texRemapInfo.renderPass, NULL);
|
||||
}
|
||||
|
||||
texDisplayInfo.renderPass = SRGBA8RP;
|
||||
|
||||
@@ -543,7 +543,9 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, const ImageState &i
|
||||
else
|
||||
f = 0;
|
||||
|
||||
pipe = m_TexRender.RemapPipeline[f][i][greenonly ? 1 : 0];
|
||||
bool srgb = (flags & eTexDisplay_RemapSRGB) != 0;
|
||||
|
||||
pipe = m_TexRender.RemapPipeline[f][i][(greenonly || srgb) ? 1 : 0];
|
||||
}
|
||||
else if(f16render)
|
||||
{
|
||||
|
||||
@@ -3314,8 +3314,15 @@ void VulkanReplay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
// force readback texture to RGBA8 unorm
|
||||
if(params.remap == RemapTexture::RGBA8)
|
||||
{
|
||||
imCreateInfo.format =
|
||||
IsSRGBFormat(imCreateInfo.format) ? VK_FORMAT_R8G8B8A8_SRGB : VK_FORMAT_R8G8B8A8_UNORM;
|
||||
if(IsSRGBFormat(imCreateInfo.format))
|
||||
{
|
||||
imCreateInfo.format = VK_FORMAT_R8G8B8A8_SRGB;
|
||||
renderFlags |= eTexDisplay_RemapSRGB;
|
||||
}
|
||||
else
|
||||
{
|
||||
imCreateInfo.format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
else if(params.remap == RemapTexture::RGBA16)
|
||||
{
|
||||
@@ -3551,10 +3558,13 @@ void VulkanReplay::GetTextureData(ResourceId tex, const Subresource &sub,
|
||||
CheckVkResult(vkr);
|
||||
rpbegin.framebuffer = tmpFB[i + numFBs];
|
||||
|
||||
int stencilFlags = renderFlags;
|
||||
stencilFlags &= ~eTexDisplay_RemapFloat;
|
||||
stencilFlags &= ~eTexDisplay_RemapSRGB;
|
||||
stencilFlags |= eTexDisplay_RemapUInt | eTexDisplay_GreenOnly;
|
||||
|
||||
texDisplay.red = texDisplay.blue = texDisplay.alpha = false;
|
||||
RenderTextureInternal(texDisplay, *srcImageState, rpbegin,
|
||||
(renderFlags & ~eTexDisplay_RemapFloat) | eTexDisplay_RemapUInt |
|
||||
eTexDisplay_GreenOnly);
|
||||
RenderTextureInternal(texDisplay, *srcImageState, rpbegin, stencilFlags);
|
||||
renderCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ enum TexDisplayFlags
|
||||
eTexDisplay_RemapFloat = 0x20,
|
||||
eTexDisplay_RemapUInt = 0x40,
|
||||
eTexDisplay_RemapSInt = 0x80,
|
||||
eTexDisplay_RemapSRGB = 0x100,
|
||||
};
|
||||
|
||||
struct ShaderDebugData
|
||||
|
||||
Reference in New Issue
Block a user