mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 15:36:33 +00:00
Add explicit DXIL shader encoding
This commit is contained in:
@@ -1120,7 +1120,8 @@ void PipelineStateViewer::SetupShaderEditButton(QToolButton *button, ResourceId
|
||||
});
|
||||
});
|
||||
}
|
||||
else if(shaderDetails->encoding == ShaderEncoding::DXBC)
|
||||
else if(shaderDetails->encoding == ShaderEncoding::DXBC ||
|
||||
shaderDetails->encoding == ShaderEncoding::DXIL)
|
||||
{
|
||||
entry = lit("EditedShader%1S").arg(ToQStr(shaderDetails->stage, GraphicsAPI::D3D11)[0]);
|
||||
|
||||
@@ -1490,6 +1491,7 @@ bool PipelineStateViewer::SaveShaderFile(const ShaderReflection *shader)
|
||||
case ShaderEncoding::GLSL: filter = tr("GLSL files (*.glsl)"); break;
|
||||
case ShaderEncoding::SPIRV: filter = tr("SPIR-V files (*.spv)"); break;
|
||||
case ShaderEncoding::SPIRVAsm: filter = tr("SPIR-V assembly files (*.spvasm)"); break;
|
||||
case ShaderEncoding::DXIL: filter = tr("DXIL Shader files (*.dxbc)"); break;
|
||||
case ShaderEncoding::Unknown:
|
||||
case ShaderEncoding::Count: filter = tr("All files (*.*)"); break;
|
||||
}
|
||||
|
||||
@@ -1029,6 +1029,7 @@ rdcstr DoStringise(const ShaderEncoding &el)
|
||||
STRINGISE_ENUM_CLASS_NAMED(SPIRV, "SPIR-V");
|
||||
STRINGISE_ENUM_CLASS_NAMED(SPIRVAsm, "SPIR-V Asm");
|
||||
STRINGISE_ENUM_CLASS(HLSL);
|
||||
STRINGISE_ENUM_CLASS(DXIL);
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
@@ -1806,6 +1806,12 @@ DOCUMENT(R"(Identifies a shader encoding used to pass shader code to an API.
|
||||
.. data:: HLSL
|
||||
|
||||
HLSL in string format, used by D3D11, D3D12, and Vulkan/GL via compilation to SPIR-V.
|
||||
|
||||
.. data:: DXIL
|
||||
|
||||
DXIL binary shader, used by D3D12. Note that although the container is still DXBC format this is
|
||||
used to distinguish from :data:`DXBC` for compiler I/O matching.
|
||||
|
||||
)");
|
||||
enum class ShaderEncoding : uint32_t
|
||||
{
|
||||
@@ -1816,6 +1822,7 @@ enum class ShaderEncoding : uint32_t
|
||||
SPIRV,
|
||||
SPIRVAsm,
|
||||
HLSL,
|
||||
DXIL,
|
||||
Count,
|
||||
};
|
||||
|
||||
|
||||
@@ -189,12 +189,12 @@ public:
|
||||
|
||||
rdcarray<ShaderEncoding> GetCustomShaderEncodings()
|
||||
{
|
||||
return {ShaderEncoding::DXBC, ShaderEncoding::HLSL};
|
||||
return {ShaderEncoding::DXBC, ShaderEncoding::DXIL, ShaderEncoding::HLSL};
|
||||
}
|
||||
rdcarray<ShaderSourcePrefix> GetCustomShaderSourcePrefixes();
|
||||
rdcarray<ShaderEncoding> GetTargetShaderEncodings()
|
||||
{
|
||||
return {ShaderEncoding::DXBC, ShaderEncoding::HLSL};
|
||||
return {ShaderEncoding::DXBC, ShaderEncoding::DXIL, ShaderEncoding::HLSL};
|
||||
}
|
||||
void BuildTargetShader(ShaderEncoding sourceEncoding, const bytebuf &source, const rdcstr &entry,
|
||||
const ShaderCompileFlags &compileFlags, ShaderStage type, ResourceId &id,
|
||||
|
||||
@@ -97,7 +97,7 @@ static void GetEncodings(GraphicsAPI api, ShaderEncoding &primary, ShaderEncodin
|
||||
if(IsD3D(api))
|
||||
{
|
||||
primary = ShaderEncoding::DXBC;
|
||||
secondary = ShaderEncoding::DXBC;
|
||||
secondary = ShaderEncoding::DXIL;
|
||||
}
|
||||
else if(api == GraphicsAPI::OpenGL)
|
||||
{
|
||||
|
||||
@@ -342,6 +342,8 @@ void MakeShaderReflection(DXBC::DXBCContainer *dxbc, ShaderReflection *refl,
|
||||
}
|
||||
|
||||
refl->encoding = ShaderEncoding::DXBC;
|
||||
if(dxbc->GetDXILByteCode())
|
||||
refl->encoding = ShaderEncoding::DXIL;
|
||||
refl->rawBytes = dxbc->GetShaderBlob();
|
||||
|
||||
refl->dispatchThreadsDimension[0] = dxbc->GetReflection()->DispatchThreadsDimension[0];
|
||||
|
||||
Reference in New Issue
Block a user