mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 17:36:36 +00:00
Outputs from pixel shaders are automatically colour output system values
This commit is contained in:
@@ -48,6 +48,7 @@ void ShutdownSPIRVCompiler();
|
||||
|
||||
struct SPVInstruction;
|
||||
|
||||
enum ShaderStageType;
|
||||
struct ShaderReflection;
|
||||
struct ShaderBindpointMapping;
|
||||
|
||||
@@ -86,7 +87,7 @@ struct SPVModule
|
||||
SPVInstruction *GetByID(uint32_t id);
|
||||
string Disassemble(const string &entryPoint);
|
||||
|
||||
void MakeReflection(const string &entryPoint, ShaderReflection *reflection,
|
||||
void MakeReflection(ShaderStageType stage, const string &entryPoint, ShaderReflection *reflection,
|
||||
ShaderBindpointMapping *mapping);
|
||||
};
|
||||
|
||||
|
||||
@@ -3696,8 +3696,9 @@ struct bindpair
|
||||
typedef bindpair<ConstantBlock> cblockpair;
|
||||
typedef bindpair<ShaderResource> shaderrespair;
|
||||
|
||||
void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTypeData *type,
|
||||
const vector<SPVDecoration> &decorations, vector<SigParameter> &sigarray)
|
||||
void AddSignatureParameter(ShaderStageType stage, uint32_t id, uint32_t childIdx, string varName,
|
||||
SPVTypeData *type, const vector<SPVDecoration> &decorations,
|
||||
vector<SigParameter> &sigarray)
|
||||
{
|
||||
SigParameter sig;
|
||||
|
||||
@@ -3724,6 +3725,10 @@ void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTy
|
||||
rowmajor = false;
|
||||
}
|
||||
|
||||
// fragment shader outputs are implicitly colour outputs
|
||||
if(stage == eShaderStage_Fragment && type->storage == spv::StorageClassOutput)
|
||||
sig.systemValue = eAttr_ColourOutput;
|
||||
|
||||
if(type->type == SPVTypeData::ePointer)
|
||||
type = type->baseType;
|
||||
|
||||
@@ -3785,7 +3790,7 @@ void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTy
|
||||
|
||||
string baseName = isArray ? StringFormat::Fmt("%s[%u]", varName.c_str(), a) : varName;
|
||||
|
||||
AddSignatureParameter(id, (uint32_t)c, baseName + "." + type->children[c].second,
|
||||
AddSignatureParameter(stage, id, (uint32_t)c, baseName + "." + type->children[c].second,
|
||||
type->children[c].first, type->childDecorations[c], sigarray);
|
||||
}
|
||||
}
|
||||
@@ -3844,8 +3849,8 @@ void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTy
|
||||
}
|
||||
}
|
||||
|
||||
void SPVModule::MakeReflection(const string &entryPoint, ShaderReflection *reflection,
|
||||
ShaderBindpointMapping *mapping)
|
||||
void SPVModule::MakeReflection(ShaderStageType stage, const string &entryPoint,
|
||||
ShaderReflection *reflection, ShaderBindpointMapping *mapping)
|
||||
{
|
||||
vector<SigParameter> inputs;
|
||||
vector<SigParameter> outputs;
|
||||
@@ -3883,7 +3888,7 @@ void SPVModule::MakeReflection(const string &entryPoint, ShaderReflection *refle
|
||||
else
|
||||
nm = StringFormat::Fmt("sig%u", inst->id);
|
||||
|
||||
AddSignatureParameter(inst->id, ~0U, nm, inst->var->type, inst->decorations, *sigarray);
|
||||
AddSignatureParameter(stage, inst->id, ~0U, nm, inst->var->type, inst->decorations, *sigarray);
|
||||
|
||||
// eliminate any members of gl_PerVertex that are actually unused and just came along
|
||||
// for the ride (usually with gl_Position, but maybe declared globally and still unused)
|
||||
|
||||
@@ -111,8 +111,8 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
{
|
||||
reflData.entryPoint = shad.entryPoint;
|
||||
reflData.stage = stageIndex;
|
||||
info.m_ShaderModule[id].spirv.MakeReflection(reflData.entryPoint, &reflData.refl,
|
||||
&reflData.mapping);
|
||||
info.m_ShaderModule[id].spirv.MakeReflection(
|
||||
ShaderStageType(reflData.stage), reflData.entryPoint, &reflData.refl, &reflData.mapping);
|
||||
}
|
||||
|
||||
if(pCreateInfo->pStages[i].pSpecializationInfo)
|
||||
@@ -325,8 +325,8 @@ void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *resourceMan, Vulk
|
||||
if(reflData.entryPoint.empty())
|
||||
{
|
||||
reflData.entryPoint = shad.entryPoint;
|
||||
info.m_ShaderModule[id].spirv.MakeReflection(reflData.entryPoint, &reflData.refl,
|
||||
&reflData.mapping);
|
||||
info.m_ShaderModule[id].spirv.MakeReflection(eShaderStage_Compute, reflData.entryPoint,
|
||||
&reflData.refl, &reflData.mapping);
|
||||
}
|
||||
|
||||
if(pCreateInfo->stage.pSpecializationInfo)
|
||||
|
||||
Reference in New Issue
Block a user