mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 16:36:31 +00:00
Fix fetching array outputs from vertex shaders
* This broke when fixing array outputs from tessellation/geometry shaders!
This commit is contained in:
@@ -94,6 +94,11 @@ struct SPIRVPatchData
|
||||
|
||||
// is this input/output part of a matrix
|
||||
bool isMatrix = false;
|
||||
|
||||
// this is an element of an array that's been exploded after [0].
|
||||
// i.e. this is false for non-arrays, and false for element [0] in an array, then true for
|
||||
// elements [1], [2], [3], etc..
|
||||
bool isArraySubsequentElement = false;
|
||||
};
|
||||
|
||||
// matches the input/output signature array, with details of where to fetch the output from in the
|
||||
|
||||
@@ -4104,7 +4104,10 @@ void AddSignatureParameter(bool isInput, ShaderStage stage, uint32_t id, uint32_
|
||||
|
||||
sig.regIndex += RDCMAX(1U, type->matrixSize);
|
||||
if(isArray)
|
||||
patch.ID = patch.structID = 0;
|
||||
{
|
||||
patch.accessChain.back()++;
|
||||
patch.isArraySubsequentElement = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1241,7 +1241,11 @@ static void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData
|
||||
|
||||
for(size_t i = 0; i < outsig.size(); i++)
|
||||
{
|
||||
if(outpatch[i].structID && !outpatch[i].accessChain.empty())
|
||||
if(outpatch[i].isArraySubsequentElement)
|
||||
{
|
||||
// do not patch anything as we only patch the base array, but reserve space in the stride
|
||||
}
|
||||
else if(outpatch[i].structID && !outpatch[i].accessChain.empty())
|
||||
{
|
||||
editor.AddDecoration(SPIRVOperation(
|
||||
spv::OpMemberDecorate,
|
||||
@@ -1265,7 +1269,8 @@ static void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData
|
||||
|
||||
for(size_t i = 0; i < outpatch.size(); i++)
|
||||
{
|
||||
if(outpatch[i].ID && vars.find(outpatch[i].ID) == vars.end())
|
||||
if(outpatch[i].ID && !outpatch[i].isArraySubsequentElement &&
|
||||
vars.find(outpatch[i].ID) == vars.end())
|
||||
{
|
||||
editor.AddDecoration(
|
||||
SPIRVOperation(spv::OpDecorate, {outpatch[i].ID, (uint32_t)spv::DecorationXfbBuffer, 0}));
|
||||
|
||||
Reference in New Issue
Block a user