mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 16:50:44 +00:00
Handle array outputs in SPIR-V, add array index to signature parameter
This commit is contained in:
@@ -119,7 +119,8 @@ struct SigParameter
|
||||
SigParameter()
|
||||
: semanticIndex(0), needSemanticIndex(false), regIndex(0),
|
||||
systemValue(eAttr_None), compType(eCompType_Float),
|
||||
regChannelMask(0), channelUsedMask(0), compCount(0), stream(0)
|
||||
regChannelMask(0), channelUsedMask(0), compCount(0),
|
||||
stream(0), arrayIndex(~0U)
|
||||
{ }
|
||||
|
||||
rdctype::str varName;
|
||||
@@ -138,6 +139,8 @@ struct SigParameter
|
||||
uint8_t channelUsedMask;
|
||||
uint32_t compCount;
|
||||
uint32_t stream;
|
||||
|
||||
uint32_t arrayIndex;
|
||||
};
|
||||
|
||||
struct ShaderConstant;
|
||||
|
||||
@@ -2379,7 +2379,6 @@ void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTy
|
||||
{
|
||||
SigParameter sig;
|
||||
|
||||
sig.varName = varName;
|
||||
sig.needSemanticIndex = false;
|
||||
|
||||
// this is super cheeky, but useful to pick up when doing output dumping and
|
||||
@@ -2417,6 +2416,15 @@ void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTy
|
||||
return;
|
||||
}
|
||||
|
||||
bool isArray = false;
|
||||
uint32_t arraySize = 1;
|
||||
if(type->type == SPVTypeData::eArray)
|
||||
{
|
||||
arraySize = type->arraySize;
|
||||
isArray = true;
|
||||
type = type->baseType;
|
||||
}
|
||||
|
||||
switch(type->baseType ? type->baseType->type : type->type)
|
||||
{
|
||||
case SPVTypeData::eBool:
|
||||
@@ -2439,22 +2447,37 @@ void AddSignatureParameter(uint32_t id, uint32_t childIdx, string varName, SPVTy
|
||||
|
||||
sig.regChannelMask = sig.channelUsedMask = (1<<type->vectorSize)-1;
|
||||
|
||||
if(type->matrixSize == 1)
|
||||
for(uint32_t a=0; a < arraySize; a++)
|
||||
{
|
||||
sigarray.push_back(sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uint32_t m=0; m < type->matrixSize; m++)
|
||||
string n = varName;
|
||||
|
||||
if(isArray)
|
||||
{
|
||||
SigParameter s = sig;
|
||||
s.varName = StringFormat::Fmt("%s:%s%u", varName.c_str(), rowmajor ? "row" : "col", m);
|
||||
s.regIndex += m;
|
||||
|
||||
RDCASSERT(s.regIndex < 16);
|
||||
|
||||
sigarray.push_back(s);
|
||||
n = StringFormat::Fmt("%s[%u]", varName.c_str(), a);
|
||||
sig.arrayIndex = a;
|
||||
}
|
||||
|
||||
sig.varName = n;
|
||||
|
||||
if(type->matrixSize == 1)
|
||||
{
|
||||
sigarray.push_back(sig);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uint32_t m=0; m < type->matrixSize; m++)
|
||||
{
|
||||
SigParameter s = sig;
|
||||
s.varName = StringFormat::Fmt("%s:%s%u", n.c_str(), rowmajor ? "row" : "col", m);
|
||||
s.regIndex += m;
|
||||
|
||||
RDCASSERT(s.regIndex < 16);
|
||||
|
||||
sigarray.push_back(s);
|
||||
}
|
||||
}
|
||||
|
||||
sig.regIndex += RDCMAX(1U, type->matrixSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +224,8 @@ namespace renderdoc
|
||||
public byte channelUsedMask;
|
||||
public UInt32 compCount;
|
||||
public UInt32 stream;
|
||||
|
||||
public UInt32 arrayIndex;
|
||||
|
||||
public string TypeString
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user