mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
Handle boolean inputs in vulkan shader parameters
* We change to use VarType instead of CompType for signature parameters which allows us to represent different types of variables beyond just unsigned/signed integer and float.
This commit is contained in:
@@ -899,22 +899,7 @@ ResourceFormat GetInterpretedResourceFormat(const ShaderConstant &elem)
|
||||
ResourceFormat format;
|
||||
format.type = interpretType;
|
||||
|
||||
switch(elem.type.descriptor.type)
|
||||
{
|
||||
case VarType::Half:
|
||||
case VarType::Float: format.compType = CompType::Float; break;
|
||||
case VarType::Double: format.compType = CompType::Double; break;
|
||||
case VarType::SInt:
|
||||
case VarType::SShort:
|
||||
case VarType::SLong:
|
||||
case VarType::SByte: format.compType = CompType::SInt; break;
|
||||
case VarType::Bool:
|
||||
case VarType::UInt:
|
||||
case VarType::UShort:
|
||||
case VarType::ULong:
|
||||
case VarType::UByte: format.compType = CompType::UInt; break;
|
||||
default: format.compType = CompType::UInt; break;
|
||||
}
|
||||
format.compType = VarTypeCompType(elem.type.descriptor.type);
|
||||
|
||||
if(interpretCompType != CompType::Typeless)
|
||||
format.compType = interpretCompType;
|
||||
|
||||
@@ -1140,22 +1140,7 @@ QString ToQStr(const AddressMode addr, const GraphicsAPI apitype)
|
||||
|
||||
QString TypeString(const SigParameter &sig)
|
||||
{
|
||||
QString ret = lit("");
|
||||
|
||||
if(sig.compType == CompType::Float)
|
||||
ret += lit("float");
|
||||
else if(sig.compType == CompType::UInt || sig.compType == CompType::UScaled)
|
||||
ret += lit("uint");
|
||||
else if(sig.compType == CompType::SInt || sig.compType == CompType::SScaled)
|
||||
ret += lit("int");
|
||||
else if(sig.compType == CompType::UNorm || sig.compType == CompType::UNormSRGB)
|
||||
ret += lit("unorm float");
|
||||
else if(sig.compType == CompType::SNorm)
|
||||
ret += lit("snorm float");
|
||||
else if(sig.compType == CompType::Depth)
|
||||
ret += lit("float");
|
||||
else if(sig.compType == CompType::Double)
|
||||
ret += lit("double");
|
||||
QString ret = ToQStr(sig.varType);
|
||||
|
||||
if(sig.compCount > 1)
|
||||
ret += QString::number(sig.compCount);
|
||||
|
||||
@@ -1415,7 +1415,7 @@ static void ConfigureColumnsForShader(ICaptureContext &ctx, const ShaderReflecti
|
||||
p.format.type = ResourceFormatType::Regular;
|
||||
p.format.compByteWidth = sizeof(float);
|
||||
p.format.compCount = sig.compCount;
|
||||
p.format.compType = sig.compType;
|
||||
p.format.compType = VarTypeCompType(sig.varType);
|
||||
|
||||
if(sig.systemValue == ShaderBuiltin::Position)
|
||||
posidx = i;
|
||||
|
||||
@@ -1260,14 +1260,14 @@ void D3D11PipelineStateViewer::setState()
|
||||
.arg(VS[i].compCount);
|
||||
|
||||
// VS wants different types
|
||||
if(IA[i].compType != VS[i].compType)
|
||||
if(IA[i].varType != VS[i].varType)
|
||||
mismatchDetails +=
|
||||
tr("IA bytecode semantic %1 (%2) is %4).arg(VS bytecode semantic %1 (%3) is %5\n")
|
||||
.arg(i)
|
||||
.arg(IAname)
|
||||
.arg(VSname)
|
||||
.arg(ToQStr(IA[i].compType))
|
||||
.arg(ToQStr(VS[i].compType));
|
||||
.arg(ToQStr(IA[i].varType))
|
||||
.arg(ToQStr(VS[i].varType));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1267,7 +1267,7 @@ void GLPipelineStateViewer::setState()
|
||||
{
|
||||
name = state.vertexShader.reflection->inputSignature[attrib].varName;
|
||||
compCount = state.vertexShader.reflection->inputSignature[attrib].compCount;
|
||||
compType = state.vertexShader.reflection->inputSignature[attrib].compType;
|
||||
compType = VarTypeCompType(state.vertexShader.reflection->inputSignature[attrib].varType);
|
||||
usedSlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -789,20 +789,16 @@ rdcarray<VertexInputAttribute> PipeState::GetVertexInputs() const
|
||||
if(!attrs[i].enabled)
|
||||
{
|
||||
uint32_t compCount = m_GL->vertexShader.reflection->inputSignature[attrib].compCount;
|
||||
CompType compType = m_GL->vertexShader.reflection->inputSignature[attrib].compType;
|
||||
VarType varType = m_GL->vertexShader.reflection->inputSignature[attrib].varType;
|
||||
|
||||
for(uint32_t c = 0; c < compCount; c++)
|
||||
{
|
||||
if(compType == CompType::Float)
|
||||
if(varType == VarType::Float)
|
||||
ret[a].genericValue.floatValue[c] = attrs[i].genericValue.floatValue[c];
|
||||
else if(compType == CompType::UInt)
|
||||
else if(varType == VarType::UInt)
|
||||
ret[a].genericValue.uintValue[c] = attrs[i].genericValue.uintValue[c];
|
||||
else if(compType == CompType::SInt)
|
||||
else if(varType == VarType::SInt)
|
||||
ret[a].genericValue.intValue[c] = attrs[i].genericValue.intValue[c];
|
||||
else if(compType == CompType::UScaled)
|
||||
ret[a].genericValue.floatValue[c] = (float)attrs[i].genericValue.uintValue[c];
|
||||
else if(compType == CompType::SScaled)
|
||||
ret[a].genericValue.floatValue[c] = (float)attrs[i].genericValue.intValue[c];
|
||||
}
|
||||
|
||||
ret[a].genericEnabled = true;
|
||||
@@ -811,7 +807,7 @@ rdcarray<VertexInputAttribute> PipeState::GetVertexInputs() const
|
||||
ret[a].instanceRate = 0;
|
||||
ret[a].format.compByteWidth = 4;
|
||||
ret[a].format.compCount = (uint8_t)compCount;
|
||||
ret[a].format.compType = compType;
|
||||
ret[a].format.compType = VarTypeCompType(varType);
|
||||
ret[a].format.type = ResourceFormatType::Regular;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,6 +350,31 @@ enum class CompType : uint8_t
|
||||
|
||||
DECLARE_REFLECTION_ENUM(CompType);
|
||||
|
||||
DOCUMENT(R"(Get the component type of a variable type.
|
||||
|
||||
:param VarType type: The variable type
|
||||
:return: The base component type of this variable type
|
||||
:rtype: CompType
|
||||
)");
|
||||
constexpr CompType VarTypeCompType(VarType type)
|
||||
{
|
||||
// temporarily disable clang-format to make this more readable.
|
||||
// Ideally we'd use a simple switch() but VS2015 doesn't support that :(.
|
||||
// clang-format off
|
||||
return (type == VarType::Double) ? CompType::Double
|
||||
|
||||
: (type == VarType::Float || type == VarType::Half) ? CompType::Float
|
||||
|
||||
: (type == VarType::ULong || type == VarType::UInt ||
|
||||
type == VarType::UShort || type == VarType::UByte || type == VarType::Bool) ? CompType::UInt
|
||||
|
||||
: (type == VarType::SLong || type == VarType::SInt ||
|
||||
type == VarType::SShort || type == VarType::SByte) ? CompType::SInt
|
||||
|
||||
: CompType::Typeless;
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
DOCUMENT(R"(A single source component for a destination texture swizzle.
|
||||
|
||||
.. data:: Red
|
||||
|
||||
@@ -795,7 +795,7 @@ struct SigParameter
|
||||
{
|
||||
return varName == o.varName && semanticName == o.semanticName &&
|
||||
semanticIdxName == o.semanticIdxName && semanticIndex == o.semanticIndex &&
|
||||
regIndex == o.regIndex && systemValue == o.systemValue && compType == o.compType &&
|
||||
regIndex == o.regIndex && systemValue == o.systemValue && varType == o.varType &&
|
||||
regChannelMask == o.regChannelMask && channelUsedMask == o.channelUsedMask &&
|
||||
needSemanticIndex == o.needSemanticIndex && compCount == o.compCount &&
|
||||
stream == o.stream;
|
||||
@@ -814,8 +814,8 @@ struct SigParameter
|
||||
return regIndex < o.regIndex;
|
||||
if(!(systemValue == o.systemValue))
|
||||
return systemValue < o.systemValue;
|
||||
if(!(compType == o.compType))
|
||||
return compType < o.compType;
|
||||
if(!(varType == o.varType))
|
||||
return varType < o.varType;
|
||||
if(!(regChannelMask == o.regChannelMask))
|
||||
return regChannelMask < o.regChannelMask;
|
||||
if(!(channelUsedMask == o.channelUsedMask))
|
||||
@@ -847,8 +847,8 @@ stage. See :data:`systemValue`.
|
||||
DOCUMENT("The :class:`ShaderBuiltin` value that this element contains.");
|
||||
ShaderBuiltin systemValue = ShaderBuiltin::Undefined;
|
||||
|
||||
DOCUMENT("The :class:`component type <CompType>` of data that this element stores.");
|
||||
CompType compType = CompType::Float;
|
||||
DOCUMENT("The :class:`variable type <VarType>` of data that this element stores.");
|
||||
VarType varType = VarType::Float;
|
||||
|
||||
DOCUMENT(R"(A bitmask indicating which components in the shader register are stored, for APIs that
|
||||
pack signatures together.
|
||||
|
||||
@@ -664,7 +664,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -677,7 +677,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 3);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -690,7 +690,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 6);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::UInt);
|
||||
CHECK(sig.varType == VarType::UInt);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -706,7 +706,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::ColorOutput);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -719,7 +719,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 1);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::ColorOutput);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -732,7 +732,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 2);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::ColorOutput);
|
||||
CHECK(sig.compType == CompType::SInt);
|
||||
CHECK(sig.varType == VarType::SInt);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -747,7 +747,7 @@ void main() {
|
||||
// the location of outputs, so this will be wrong
|
||||
// CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::DepthOutput);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1372,7 +1372,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1407,7 +1407,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1420,7 +1420,7 @@ void main() {
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::PointSize);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1468,7 +1468,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1481,7 +1481,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -1494,7 +1494,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 1);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -1507,7 +1507,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 2);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -1520,7 +1520,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 6);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1533,7 +1533,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 7);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1546,7 +1546,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 9);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1559,7 +1559,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 10);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1572,7 +1572,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 11);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1585,7 +1585,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 12);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1653,7 +1653,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1666,7 +1666,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1679,7 +1679,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 1);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -1692,7 +1692,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 2);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1705,7 +1705,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 3);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1718,7 +1718,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 4);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1731,7 +1731,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 5);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1744,7 +1744,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 6);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1757,7 +1757,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 7);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1770,7 +1770,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 8);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1783,7 +1783,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 9);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 1);
|
||||
CHECK(sig.regChannelMask == 0x1);
|
||||
CHECK(sig.channelUsedMask == 0x1);
|
||||
@@ -1853,7 +1853,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1874,7 +1874,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == a);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 3);
|
||||
CHECK(sig.regChannelMask == 0x7);
|
||||
CHECK(sig.channelUsedMask == 0x7);
|
||||
@@ -1948,7 +1948,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1961,7 +1961,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
@@ -1979,7 +1979,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Position);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 4);
|
||||
CHECK(sig.regChannelMask == 0xf);
|
||||
CHECK(sig.channelUsedMask == 0xf);
|
||||
@@ -1992,7 +1992,7 @@ void main()
|
||||
|
||||
CHECK(sig.regIndex == 0);
|
||||
CHECK(sig.systemValue == ShaderBuiltin::Undefined);
|
||||
CHECK(sig.compType == CompType::Float);
|
||||
CHECK(sig.varType == VarType::Float);
|
||||
CHECK(sig.compCount == 2);
|
||||
CHECK(sig.regChannelMask == 0x3);
|
||||
CHECK(sig.channelUsedMask == 0x3);
|
||||
|
||||
@@ -2078,7 +2078,7 @@ ShaderDebugTrace *D3D11Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
if(draw->flags & DrawFlags::Indexed)
|
||||
sv_vertid = idx;
|
||||
|
||||
if(dxbc->GetReflection()->InputSig[i].compType == CompType::Float)
|
||||
if(dxbc->GetReflection()->InputSig[i].varType == VarType::Float)
|
||||
state.inputs[i].value.f.x = state.inputs[i].value.f.y = state.inputs[i].value.f.z =
|
||||
state.inputs[i].value.f.w = (float)sv_vertid;
|
||||
else
|
||||
@@ -2087,7 +2087,7 @@ ShaderDebugTrace *D3D11Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
}
|
||||
else if(dxbc->GetReflection()->InputSig[i].systemValue == ShaderBuiltin::InstanceIndex)
|
||||
{
|
||||
if(dxbc->GetReflection()->InputSig[i].compType == CompType::Float)
|
||||
if(dxbc->GetReflection()->InputSig[i].varType == VarType::Float)
|
||||
state.inputs[i].value.f.x = state.inputs[i].value.f.y = state.inputs[i].value.f.z =
|
||||
state.inputs[i].value.f.w = (float)instid;
|
||||
else
|
||||
|
||||
@@ -2026,7 +2026,7 @@ ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
if(draw->flags & DrawFlags::Indexed)
|
||||
sv_vertid = idx;
|
||||
|
||||
if(dxbc->GetReflection()->InputSig[i].compType == CompType::Float)
|
||||
if(dxbc->GetReflection()->InputSig[i].varType == VarType::Float)
|
||||
state.inputs[i].value.f.x = state.inputs[i].value.f.y = state.inputs[i].value.f.z =
|
||||
state.inputs[i].value.f.w = (float)sv_vertid;
|
||||
else
|
||||
@@ -2035,7 +2035,7 @@ ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
}
|
||||
else if(dxbc->GetReflection()->InputSig[i].systemValue == ShaderBuiltin::InstanceIndex)
|
||||
{
|
||||
if(dxbc->GetReflection()->InputSig[i].compType == CompType::Float)
|
||||
if(dxbc->GetReflection()->InputSig[i].varType == VarType::Float)
|
||||
state.inputs[i].value.f.x = state.inputs[i].value.f.y = state.inputs[i].value.f.z =
|
||||
state.inputs[i].value.f.w = (float)instid;
|
||||
else
|
||||
|
||||
@@ -94,7 +94,7 @@ static void MakeVaryingsFromShaderReflection(ShaderReflection &refl, rdcarray<co
|
||||
if(sig.systemValue == ShaderBuiltin::Position)
|
||||
posidx = int32_t(varyings.size()) - 1;
|
||||
|
||||
uint32_t outputComponents = (sig.compType == CompType::Double ? 2 : 1) * sig.compCount;
|
||||
uint32_t outputComponents = (sig.varType == VarType::Double ? 2 : 1) * sig.compCount;
|
||||
|
||||
stride += sizeof(float) * outputComponents;
|
||||
|
||||
|
||||
@@ -1952,7 +1952,7 @@ void MakeShaderReflection(GLenum shadType, GLuint sepProg, ShaderReflection &ref
|
||||
case eGL_DOUBLE_MAT3x2:
|
||||
case eGL_DOUBLE_MAT2:
|
||||
case eGL_DOUBLE_MAT2x3:
|
||||
case eGL_DOUBLE_MAT2x4: sig.compType = CompType::Double; break;
|
||||
case eGL_DOUBLE_MAT2x4: sig.varType = VarType::Double; break;
|
||||
case eGL_FLOAT:
|
||||
case eGL_FLOAT_VEC2:
|
||||
case eGL_FLOAT_VEC3:
|
||||
@@ -1965,21 +1965,21 @@ void MakeShaderReflection(GLenum shadType, GLuint sepProg, ShaderReflection &ref
|
||||
case eGL_FLOAT_MAT3x2:
|
||||
case eGL_FLOAT_MAT2:
|
||||
case eGL_FLOAT_MAT2x3:
|
||||
case eGL_FLOAT_MAT2x4: sig.compType = CompType::Float; break;
|
||||
case eGL_FLOAT_MAT2x4: sig.varType = VarType::Float; break;
|
||||
case eGL_INT:
|
||||
case eGL_INT_VEC2:
|
||||
case eGL_INT_VEC3:
|
||||
case eGL_INT_VEC4: sig.compType = CompType::SInt; break;
|
||||
case eGL_INT_VEC4: sig.varType = VarType::SInt; break;
|
||||
case eGL_UNSIGNED_INT:
|
||||
case eGL_BOOL:
|
||||
case eGL_UNSIGNED_INT_VEC2:
|
||||
case eGL_BOOL_VEC2:
|
||||
case eGL_UNSIGNED_INT_VEC3:
|
||||
case eGL_UNSIGNED_INT_VEC4: sig.varType = VarType::UInt; break;
|
||||
case eGL_BOOL:
|
||||
case eGL_BOOL_VEC2:
|
||||
case eGL_BOOL_VEC3:
|
||||
case eGL_UNSIGNED_INT_VEC4:
|
||||
case eGL_BOOL_VEC4: sig.compType = CompType::UInt; break;
|
||||
case eGL_BOOL_VEC4: sig.varType = VarType::Bool; break;
|
||||
default:
|
||||
sig.compType = CompType::Float;
|
||||
sig.varType = VarType::Float;
|
||||
RDCWARN("Unhandled signature element type %s", ToStr((GLenum)values[1]).c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,11 +1115,11 @@ DXBCContainer::DXBCContainer(const void *ByteCode, size_t ByteCodeLength)
|
||||
}
|
||||
|
||||
ComponentType compType = (ComponentType)el->componentType;
|
||||
desc.compType = CompType::Float;
|
||||
desc.varType = VarType::Float;
|
||||
if(compType == COMPONENT_TYPE_UINT32)
|
||||
desc.compType = CompType::UInt;
|
||||
desc.varType = VarType::UInt;
|
||||
else if(compType == COMPONENT_TYPE_SINT32)
|
||||
desc.compType = CompType::SInt;
|
||||
desc.varType = VarType::SInt;
|
||||
else if(compType != COMPONENT_TYPE_FLOAT32)
|
||||
RDCERR("Unexpected component type in signature");
|
||||
|
||||
|
||||
@@ -4754,14 +4754,15 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
|
||||
{
|
||||
filled = true;
|
||||
|
||||
if(prevStageDxbc.OutputSig[os].compType == CompType::Float)
|
||||
if(prevStageDxbc.OutputSig[os].varType == VarType::Float)
|
||||
psInputDefinition += "float";
|
||||
else if(prevStageDxbc.OutputSig[os].compType == CompType::SInt)
|
||||
else if(prevStageDxbc.OutputSig[os].varType == VarType::SInt)
|
||||
psInputDefinition += "int";
|
||||
else if(prevStageDxbc.OutputSig[os].compType == CompType::UInt)
|
||||
else if(prevStageDxbc.OutputSig[os].varType == VarType::UInt)
|
||||
psInputDefinition += "uint";
|
||||
else
|
||||
RDCERR("Unexpected input signature type: %d", prevStageDxbc.OutputSig[os].compType);
|
||||
RDCERR("Unexpected input signature type: %s",
|
||||
ToStr(prevStageDxbc.OutputSig[os].varType).c_str());
|
||||
|
||||
int numCols = (prevStageDxbc.OutputSig[os].regChannelMask & 0x1 ? 1 : 0) +
|
||||
(prevStageDxbc.OutputSig[os].regChannelMask & 0x2 ? 1 : 0) +
|
||||
@@ -4792,14 +4793,13 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
|
||||
|
||||
nextreg = sig.regIndex + 1;
|
||||
|
||||
if(sig.compType == CompType::Float)
|
||||
if(sig.varType == VarType::Float)
|
||||
{
|
||||
// if we're packed with ints on either side, we must be nointerpolation
|
||||
bool nointerp = false;
|
||||
for(size_t j = 0; j < numInputs; j++)
|
||||
{
|
||||
if(sig.regIndex == psDxbc.InputSig[j].regIndex &&
|
||||
psDxbc.InputSig[j].compType != CompType::Float)
|
||||
if(sig.regIndex == psDxbc.InputSig[j].regIndex && psDxbc.InputSig[j].varType != VarType::Float)
|
||||
{
|
||||
nointerp = true;
|
||||
break;
|
||||
@@ -4831,12 +4831,12 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
|
||||
|
||||
psInputDefinition += "float";
|
||||
}
|
||||
else if(sig.compType == CompType::SInt)
|
||||
else if(sig.varType == VarType::SInt)
|
||||
psInputDefinition += "nointerpolation int";
|
||||
else if(sig.compType == CompType::UInt)
|
||||
else if(sig.varType == VarType::UInt)
|
||||
psInputDefinition += "nointerpolation uint";
|
||||
else
|
||||
RDCERR("Unexpected input signature type: %d", sig.compType);
|
||||
RDCERR("Unexpected input signature type: %s", ToStr(sig.varType).c_str());
|
||||
|
||||
int numCols = (sig.regChannelMask & 0x1 ? 1 : 0) + (sig.regChannelMask & 0x2 ? 1 : 0) +
|
||||
(sig.regChannelMask & 0x4 ? 1 : 0) + (sig.regChannelMask & 0x8 ? 1 : 0);
|
||||
@@ -4952,7 +4952,7 @@ void GatherPSInputDataForInitialValues(const DXBC::DXBCContainer *dxbc,
|
||||
if(arrayLength > 0)
|
||||
inputVarNames[i] += StringFormat::Fmt("[%d]", RDCMAX(0, arrayIndex));
|
||||
|
||||
if(included && sig.compType == CompType::Float)
|
||||
if(included && sig.varType == VarType::Float)
|
||||
{
|
||||
if(arrayLength == 0)
|
||||
{
|
||||
@@ -5043,13 +5043,7 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
|
||||
: sig.regChannelMask & 0x2
|
||||
? 2
|
||||
: sig.regChannelMask & 0x1 ? 1 : 0;
|
||||
|
||||
if(sig.compType == CompType::UInt)
|
||||
v.type = VarType::UInt;
|
||||
else if(sig.compType == CompType::SInt)
|
||||
v.type = VarType::SInt;
|
||||
else
|
||||
v.type = VarType::Float;
|
||||
v.type = sig.varType;
|
||||
|
||||
ShaderVariable &dst = state.inputs[sig.regIndex];
|
||||
|
||||
@@ -5153,13 +5147,7 @@ ShaderDebugTrace *InterpretDebugger::BeginDebug(const DXBC::DXBCContainer *dxbcC
|
||||
: sig.regChannelMask & 0x2
|
||||
? 2
|
||||
: sig.regChannelMask & 0x1 ? 1 : 0;
|
||||
|
||||
if(sig.compType == CompType::UInt)
|
||||
v.type = VarType::UInt;
|
||||
else if(sig.compType == CompType::SInt)
|
||||
v.type = VarType::SInt;
|
||||
else
|
||||
v.type = VarType::Float;
|
||||
v.type = sig.varType;
|
||||
|
||||
ShaderVariable &dst = state.variables[idx];
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ void Program::FetchComputeProperties(DXBC::Reflection *reflection)
|
||||
|
||||
SigParameter param;
|
||||
|
||||
param.compType = CompType::UInt;
|
||||
param.varType = VarType::UInt;
|
||||
param.regIndex = ~0U;
|
||||
|
||||
switch(type)
|
||||
|
||||
@@ -29,6 +29,26 @@
|
||||
|
||||
namespace rdcspv
|
||||
{
|
||||
Scalar scalar(VarType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case VarType::Float: return scalar<float>();
|
||||
case VarType::Double: return scalar<double>();
|
||||
case VarType::Half: return Scalar(Op::TypeFloat, 16, false);
|
||||
case VarType::SInt: return scalar<int32_t>();
|
||||
case VarType::UInt: return scalar<uint32_t>();
|
||||
case VarType::SShort: return scalar<int16_t>();
|
||||
case VarType::UShort: return scalar<uint16_t>();
|
||||
case VarType::SLong: return scalar<int64_t>();
|
||||
case VarType::ULong: return scalar<uint64_t>();
|
||||
case VarType::SByte: return scalar<int8_t>();
|
||||
case VarType::UByte: return scalar<uint8_t>();
|
||||
case VarType::Bool: return scalar<bool>();
|
||||
default: RDCERR("No scalar type for %s", ToStr(type).c_str()); return scalar<void>();
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutionModes::Register(const OpExecutionMode &mode)
|
||||
{
|
||||
if(mode.mode == ExecutionMode::LocalSize)
|
||||
|
||||
@@ -97,6 +97,8 @@ struct Scalar
|
||||
template <typename T>
|
||||
inline constexpr Scalar scalar();
|
||||
|
||||
Scalar scalar(VarType t);
|
||||
|
||||
#define SCALAR_TYPE(ctype, op, width, sign) \
|
||||
template <> \
|
||||
inline constexpr Scalar scalar<ctype>() \
|
||||
|
||||
@@ -175,10 +175,8 @@ void AddXFBAnnotations(const ShaderReflection &refl, const SPIRVPatchData &patch
|
||||
outpatch[i].ID, rdcspv::DecorationParam<rdcspv::Decoration::Offset>(xfbStride)));
|
||||
}
|
||||
|
||||
uint32_t compByteSize = 4;
|
||||
|
||||
if(outsig[i].compType == CompType::Double)
|
||||
compByteSize = 8;
|
||||
// components always get promoted to at least 32-bit
|
||||
uint32_t compByteSize = RDCMAX(4U, VarTypeByteSize(outsig[i].varType));
|
||||
|
||||
xfbStride += outsig[i].compCount * compByteSize;
|
||||
}
|
||||
@@ -1597,19 +1595,7 @@ void Reflector::AddSignatureParameter(const bool isInput, const ShaderStage stag
|
||||
return;
|
||||
}
|
||||
|
||||
switch(varType->scalar().type)
|
||||
{
|
||||
case Op::TypeBool:
|
||||
case Op::TypeInt:
|
||||
sig.compType = varType->scalar().signedness ? CompType::SInt : CompType::UInt;
|
||||
break;
|
||||
case Op::TypeFloat:
|
||||
sig.compType = varType->scalar().width == 64 ? CompType::Double : CompType::Float;
|
||||
break;
|
||||
default:
|
||||
RDCERR("Unexpected base type of input/output signature %u", varType->scalar().type);
|
||||
break;
|
||||
}
|
||||
sig.varType = varType->scalar().Type();
|
||||
|
||||
sig.compCount = RDCMAX(1U, varType->vector().count);
|
||||
sig.stream = 0;
|
||||
|
||||
@@ -459,16 +459,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
|
||||
// base type - either a scalar or a vector, since matrix outputs are decayed to vectors
|
||||
{
|
||||
rdcspv::Scalar scalarType = rdcspv::scalar<uint32_t>();
|
||||
|
||||
if(refl.outputSignature[i].compType == CompType::UInt)
|
||||
scalarType = rdcspv::scalar<uint32_t>();
|
||||
else if(refl.outputSignature[i].compType == CompType::SInt)
|
||||
scalarType = rdcspv::scalar<int32_t>();
|
||||
else if(refl.outputSignature[i].compType == CompType::Float)
|
||||
scalarType = rdcspv::scalar<float>();
|
||||
else if(refl.outputSignature[i].compType == CompType::Double)
|
||||
scalarType = rdcspv::scalar<double>();
|
||||
rdcspv::Scalar scalarType = rdcspv::scalar(refl.outputSignature[i].varType);
|
||||
|
||||
io.vec4ID = editor.DeclareType(rdcspv::Vector(scalarType, 4));
|
||||
|
||||
@@ -499,33 +490,30 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
|
||||
io.variableID = patchData.inputs[i].ID;
|
||||
|
||||
rdcspv::Scalar scalarType = rdcspv::scalar<uint32_t>();
|
||||
rdcspv::Scalar scalarType = rdcspv::scalar(refl.inputSignature[i].varType);
|
||||
|
||||
// base type - either a scalar or a vector, since matrix outputs are decayed to vectors
|
||||
if(refl.inputSignature[i].compType == CompType::UInt)
|
||||
CompType compType = VarTypeCompType(refl.inputSignature[i].varType);
|
||||
if(compType == CompType::UInt)
|
||||
{
|
||||
scalarType = rdcspv::scalar<uint32_t>();
|
||||
io.tbuffer = tbuffer_uint;
|
||||
}
|
||||
else if(refl.inputSignature[i].compType == CompType::SInt)
|
||||
else if(compType == CompType::SInt)
|
||||
{
|
||||
scalarType = rdcspv::scalar<int32_t>();
|
||||
io.tbuffer = tbuffer_sint;
|
||||
}
|
||||
else if(refl.inputSignature[i].compType == CompType::Float)
|
||||
else if(compType == CompType::Float)
|
||||
{
|
||||
scalarType = rdcspv::scalar<float>();
|
||||
io.tbuffer = tbuffer_float;
|
||||
}
|
||||
else if(refl.inputSignature[i].compType == CompType::Double)
|
||||
else if(compType == CompType::Double)
|
||||
{
|
||||
scalarType = rdcspv::scalar<double>();
|
||||
// doubles are loaded packed from a uint tbuffer
|
||||
io.tbuffer = tbuffer_uint;
|
||||
}
|
||||
|
||||
// doubles are loaded as uvec4 and then packed in pairs, so we need to declare vec4ID as uvec4
|
||||
if(refl.inputSignature[i].compType == CompType::Double)
|
||||
if(compType == CompType::Double)
|
||||
io.vec4ID = editor.DeclareType(rdcspv::Vector(rdcspv::scalar<uint32_t>(), 4));
|
||||
else
|
||||
io.vec4ID = editor.DeclareType(rdcspv::Vector(scalarType, 4));
|
||||
@@ -667,15 +655,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
uint32_t memberOffset = 0;
|
||||
for(uint32_t o = 0; o < numOutputs; o++)
|
||||
{
|
||||
uint32_t elemSize = 0;
|
||||
if(refl.outputSignature[o].compType == CompType::Double)
|
||||
elemSize = 8;
|
||||
else if(refl.outputSignature[o].compType == CompType::SInt ||
|
||||
refl.outputSignature[o].compType == CompType::UInt ||
|
||||
refl.outputSignature[o].compType == CompType::Float)
|
||||
elemSize = 4;
|
||||
else
|
||||
RDCERR("Unexpected component type for output signature element");
|
||||
uint32_t elemSize = RDCMAX(4U, VarTypeByteSize(refl.outputSignature[o].varType));
|
||||
|
||||
uint32_t numComps = refl.outputSignature[o].compCount;
|
||||
|
||||
@@ -951,7 +931,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
|
||||
if(valueID)
|
||||
{
|
||||
if(refl.inputSignature[i].compType == compType)
|
||||
if(VarTypeCompType(refl.inputSignature[i].varType) == compType)
|
||||
{
|
||||
ops.add(rdcspv::OpStore(ins[i].variableID, valueID));
|
||||
}
|
||||
@@ -1022,7 +1002,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
}
|
||||
}
|
||||
|
||||
if(refl.inputSignature[i].compType == CompType::Double)
|
||||
if(refl.inputSignature[i].varType == VarType::Double)
|
||||
{
|
||||
// since doubles are packed into two uints, we need to multiply the index by two
|
||||
idx = ops.add(rdcspv::OpIMul(uint32ID, editor.MakeId(), idx,
|
||||
@@ -1034,7 +1014,7 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, const SPIRV
|
||||
|
||||
uint32_t comp = Bits::CountTrailingZeroes(uint32_t(refl.inputSignature[i].regChannelMask));
|
||||
|
||||
if(refl.inputSignature[i].compType == CompType::Double)
|
||||
if(refl.inputSignature[i].varType == VarType::Double)
|
||||
{
|
||||
// since doubles are packed into two uints, we now need to fetch more data and do
|
||||
// packing. We can fetch the data unconditionally since it's harmless to read out of the
|
||||
|
||||
@@ -2721,27 +2721,28 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
|
||||
{
|
||||
const SigParameter ¶m = shadRefl.refl.inputSignature[i];
|
||||
|
||||
rdcspv::Scalar base;
|
||||
switch(param.compType)
|
||||
{
|
||||
case CompType::Float: base = rdcspv::scalar<float>(); break;
|
||||
case CompType::UInt: base = rdcspv::scalar<uint32_t>(); break;
|
||||
case CompType::SInt: base = rdcspv::scalar<int32_t>(); break;
|
||||
case CompType::Double: base = rdcspv::scalar<double>(); break;
|
||||
default: RDCERR("Unexpected type %s", ToStr(param.compType).c_str());
|
||||
}
|
||||
rdcspv::Scalar base = rdcspv::scalar(param.varType);
|
||||
|
||||
values[i].structIndex = (uint32_t)offsets.size();
|
||||
|
||||
uint32_t width = (base.width / 8);
|
||||
|
||||
// treat bools as uints
|
||||
if(base.type == rdcspv::Op::TypeBool)
|
||||
width = 4;
|
||||
|
||||
offsets.push_back(structStride);
|
||||
structStride += param.compCount * (base.width / 8);
|
||||
structStride += param.compCount * width;
|
||||
|
||||
if(param.compCount == 1)
|
||||
values[i].valueType = editor.DeclareType(base);
|
||||
else
|
||||
values[i].valueType = editor.DeclareType(rdcspv::Vector(base, param.compCount));
|
||||
|
||||
ids.push_back(values[i].valueType);
|
||||
if(values[i].valueType == boolType)
|
||||
ids.push_back(uint32Type);
|
||||
else
|
||||
ids.push_back(values[i].valueType);
|
||||
|
||||
// align offset conservatively, to 16-byte aligned. We do this with explicit uints so we can
|
||||
// preview with spirv-cross (and because it doesn't cost anything particularly)
|
||||
@@ -3036,8 +3037,10 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
|
||||
for(uint32_t idx : access.accessChain)
|
||||
accessIndices.push_back(getUIntConst(idx));
|
||||
|
||||
rdcspv::Id valueType = values[i].valueType;
|
||||
|
||||
rdcspv::Id ptrType =
|
||||
editor.DeclareType(rdcspv::Pointer(values[i].valueType, rdcspv::StorageClass::Input));
|
||||
editor.DeclareType(rdcspv::Pointer(valueType, rdcspv::StorageClass::Input));
|
||||
|
||||
// if we have no access chain it's a global pointer of the type we want, so just load
|
||||
// straight out of it
|
||||
@@ -3047,23 +3050,31 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
|
||||
else
|
||||
ptr = ops.add(rdcspv::OpAccessChain(ptrType, editor.MakeId(), access.ID, accessIndices));
|
||||
|
||||
rdcspv::Id base = ops.add(rdcspv::OpLoad(values[i].valueType, editor.MakeId(), ptr));
|
||||
rdcspv::Id base = ops.add(rdcspv::OpLoad(valueType, editor.MakeId(), ptr));
|
||||
|
||||
if(valueType == boolType)
|
||||
{
|
||||
valueType = uint32Type;
|
||||
// can't store bools directly, need to convert to uint
|
||||
base = ops.add(
|
||||
rdcspv::OpSelect(valueType, editor.MakeId(), base, getUIntConst(1), getUIntConst(0)));
|
||||
}
|
||||
|
||||
values[i].data[Variant_Base] = base;
|
||||
|
||||
editor.SetName(base, StringFormat::Fmt("__rd_base_%zu_%s", i, param.varName.c_str()));
|
||||
|
||||
// only float values have derivatives
|
||||
if(param.compType == CompType::Float)
|
||||
if(VarTypeCompType(param.varType) == CompType::Float)
|
||||
{
|
||||
values[i].data[Variant_ddxcoarse] =
|
||||
ops.add(rdcspv::OpDPdxCoarse(values[i].valueType, editor.MakeId(), base));
|
||||
ops.add(rdcspv::OpDPdxCoarse(valueType, editor.MakeId(), base));
|
||||
values[i].data[Variant_ddycoarse] =
|
||||
ops.add(rdcspv::OpDPdyCoarse(values[i].valueType, editor.MakeId(), base));
|
||||
ops.add(rdcspv::OpDPdyCoarse(valueType, editor.MakeId(), base));
|
||||
values[i].data[Variant_ddxfine] =
|
||||
ops.add(rdcspv::OpDPdxFine(values[i].valueType, editor.MakeId(), base));
|
||||
ops.add(rdcspv::OpDPdxFine(valueType, editor.MakeId(), base));
|
||||
values[i].data[Variant_ddyfine] =
|
||||
ops.add(rdcspv::OpDPdyFine(values[i].valueType, editor.MakeId(), base));
|
||||
ops.add(rdcspv::OpDPdyFine(valueType, editor.MakeId(), base));
|
||||
|
||||
editor.SetName(values[i].data[Variant_ddxcoarse],
|
||||
StringFormat::Fmt("__rd_ddxcoarse_%zu_%s", i, param.varName.c_str()));
|
||||
@@ -3078,7 +3089,7 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
|
||||
{
|
||||
values[i].data[Variant_ddxcoarse] = values[i].data[Variant_ddycoarse] =
|
||||
values[i].data[Variant_ddxfine] = values[i].data[Variant_ddyfine] =
|
||||
editor.AddConstant(rdcspv::OpConstantNull(values[i].valueType, editor.MakeId()));
|
||||
editor.AddConstant(rdcspv::OpConstantNull(valueType, editor.MakeId()));
|
||||
|
||||
editor.SetName(values[i].data[Variant_ddxcoarse],
|
||||
StringFormat::Fmt("__rd_noderiv_%zu_%s", i, param.varName.c_str()));
|
||||
@@ -3265,7 +3276,10 @@ static void CreatePSInputFetcher(rdcarray<uint32_t> &fragspv, uint32_t &structSt
|
||||
|
||||
for(size_t i = 0; i < values.size(); i++)
|
||||
{
|
||||
rdcspv::Id ptrType = editor.DeclareType(rdcspv::Pointer(values[i].valueType, bufferClass));
|
||||
rdcspv::Id valueType = values[i].valueType;
|
||||
if(valueType == boolType)
|
||||
valueType = uint32Type;
|
||||
rdcspv::Id ptrType = editor.DeclareType(rdcspv::Pointer(valueType, bufferClass));
|
||||
|
||||
for(size_t j = 0; j < Variant_Count; j++)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ void DoSerialise(SerialiserType &ser, SigParameter &el)
|
||||
SERIALISE_MEMBER(semanticIndex);
|
||||
SERIALISE_MEMBER(regIndex);
|
||||
SERIALISE_MEMBER(systemValue);
|
||||
SERIALISE_MEMBER(compType);
|
||||
SERIALISE_MEMBER(varType);
|
||||
SERIALISE_MEMBER(regChannelMask);
|
||||
SERIALISE_MEMBER(channelUsedMask);
|
||||
SERIALISE_MEMBER(needSemanticIndex);
|
||||
|
||||
@@ -1768,6 +1768,11 @@ void main()
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case 19:
|
||||
{
|
||||
Color = gl_FrontFacing ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
|
||||
default:
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user