r_rtColorFormat is now a UNORM format, fixed shader data for PIX debugging

This commit is contained in:
myT 2023-10-16 02:33:43 +02:00
parent e52133ea5d
commit e009dce47a
6 changed files with 15 additions and 10 deletions

View file

@ -260,7 +260,7 @@ void GRP::Init()
renderTargetFormat = TextureFormat::R10G10B10A2_UNorm;
break;
case RTCF_R16G16B16A16:
renderTargetFormat = TextureFormat::RGBA64_Float;
renderTargetFormat = TextureFormat::RGBA64_UNorm;
break;
case RTCF_R8G8B8A8:
default:

View file

@ -73,8 +73,7 @@ SamplerState sampler0 : register(s0);
float4 ps(VOut input) : SV_Target
{
float3 raw = texture0.Sample(sampler0, input.texCoords).rgb;
float3 base = saturate(raw); // can have negative values in the float render target
float3 base = texture0.Sample(sampler0, input.texCoords).rgb;
float3 gc = pow(base, invGamma) * brightness;
return MakeGreyscale(float4(gc.rgb, 1.0), greyscale);

View file

@ -62,8 +62,7 @@ SamplerState sampler0 : register(s0);
float4 ps(VOut input) : SV_Target
{
float3 raw = texture0.Sample(sampler0, input.texCoords).rgb;
float3 base = saturate(raw); // can have negative values in the float render target
float3 base = texture0.Sample(sampler0, input.texCoords).rgb;
float3 linearSpace = pow(base * invBrightness, gamma);
return float4(linearSpace, 1.0f);

View file

@ -1497,6 +1497,7 @@ namespace RHI
switch(format)
{
case TextureFormat::RGBA32_UNorm: return DXGI_FORMAT_R8G8B8A8_UNORM;
case TextureFormat::RGBA64_UNorm: return DXGI_FORMAT_R16G16B16A16_UNORM;
case TextureFormat::RGBA64_Float: return DXGI_FORMAT_R16G16B16A16_FLOAT;
case TextureFormat::Depth32_Float: return DXGI_FORMAT_D32_FLOAT;
case TextureFormat::Depth24_Stencil8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
@ -3809,14 +3810,17 @@ namespace RHI
PushArg(entryPointW);
PushArg(L"-T");
PushArg(targetW);
PushArg(DXC_ARG_WARNINGS_ARE_ERRORS);
PushArg(DXC_ARG_WARNINGS_ARE_ERRORS); // -WX
#if defined(D3D_DEBUG)
PushArg(DXC_ARG_DEBUG);
PushArg(DXC_ARG_SKIP_OPTIMIZATIONS);
PushArg(DXC_ARG_DEBUG); // -Zi embeds debug info
PushArg(DXC_ARG_SKIP_OPTIMIZATIONS); // -Od disables optimizations
PushArg(DXC_ARG_ENABLE_STRICTNESS); // -Ges enables strict mode
PushArg(DXC_ARG_IEEE_STRICTNESS); // -Gis forces IEEE strictness
PushArg(L"-Qembed_debug"); // -Qembed_debug embeds debug info in shader container
#else
PushArg(L"-Qstrip_debug");
PushArg(L"-Qstrip_reflect");
PushArg(DXC_ARG_OPTIMIZATION_LEVEL3);
PushArg(DXC_ARG_OPTIMIZATION_LEVEL3); // -O3
#endif
PushArg(L"-D");
PushArg(desc.stage == ShaderStage::Vertex ? L"VERTEX_SHADER=1" : L"VERTEX_SHADER=0");

View file

@ -158,6 +158,7 @@ namespace RHI
enum Id
{
RGBA32_UNorm,
RGBA64_UNorm,
RGBA64_Float,
Depth32_Float,
RG16_UNorm,

View file

@ -51,7 +51,9 @@ void CompileShader(const ShaderArgs& args, int extraCount = 0, const char** extr
// -Ges: Enable strict mode
// -Gis: Force IEEE strictness
strcpy(temp, va("dxc.exe -Fh %s -E %s -T %s -WX -Ges -Gis",
// -Zi: Embed debug info
// -Qembed_debug: Embed debug info in shader container
strcpy(temp, va("dxc.exe -Fh %s -E %s -T %s -WX -Ges -Gis -Zi -Qembed_debug",
args.headerPath, args.entryPoint, args.targetProfile));
for(int i = 0; i < extraCount; ++i)