mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 08:26:50 +00:00
Extend VK_Mesh_Shader tests for struct arrays, struct in a payload
This commit is contained in:
@@ -39,31 +39,40 @@ struct Inner
|
||||
{
|
||||
uint a;
|
||||
uint b;
|
||||
uint c;
|
||||
};
|
||||
|
||||
struct PayLoad
|
||||
{
|
||||
uint padArr[4];
|
||||
uint pad;
|
||||
Inner inner;
|
||||
Inner innerArr[4];
|
||||
uint tri[4];
|
||||
Inner inner[4];
|
||||
};
|
||||
|
||||
taskPayloadSharedEXT PayLoad payLoad;
|
||||
|
||||
void main()
|
||||
{
|
||||
payLoad.tri[0] = 0;
|
||||
payLoad.tri[1] = 1;
|
||||
payLoad.tri[2] = 2;
|
||||
payLoad.tri[3] = 3;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
payLoad.tri[i] = i;
|
||||
|
||||
payLoad.inner[0].a = 10;
|
||||
payLoad.inner[0].b = 10;
|
||||
payLoad.inner[1].a = 11;
|
||||
payLoad.inner[1].b = 11;
|
||||
payLoad.inner[2].a = 12;
|
||||
payLoad.inner[2].b = 12;
|
||||
payLoad.inner[3].a = 13;
|
||||
payLoad.inner[3].b = 13;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
payLoad.padArr[i] = 1000 + i;
|
||||
|
||||
payLoad.pad = 123;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
payLoad.innerArr[i].a = 10*i + 0;
|
||||
payLoad.innerArr[i].b = 10*i + 1;
|
||||
payLoad.innerArr[i].c = 10*i + 2;
|
||||
}
|
||||
|
||||
payLoad.inner.a = 500;
|
||||
payLoad.inner.b = 501;
|
||||
payLoad.inner.c = 502;
|
||||
|
||||
EmitMeshTasksEXT(4, 1, 1);
|
||||
}
|
||||
@@ -79,12 +88,16 @@ struct Inner
|
||||
{
|
||||
uint a;
|
||||
uint b;
|
||||
uint c;
|
||||
};
|
||||
|
||||
struct PayLoad
|
||||
{
|
||||
uint padArr[4];
|
||||
uint pad;
|
||||
Inner inner;
|
||||
Inner innerArr[4];
|
||||
uint tri[4];
|
||||
Inner inner[4];
|
||||
};
|
||||
|
||||
taskPayloadSharedEXT PayLoad payLoad;
|
||||
@@ -101,9 +114,9 @@ void main()
|
||||
SetMeshOutputsEXT(vertexCount, triangleCount);
|
||||
|
||||
uint dtid = gl_GlobalInvocationID.x;
|
||||
uint tri = payLoad.tri[dtid];
|
||||
uint tri = payLoad.tri[dtid];
|
||||
uint vertIdx = 0;
|
||||
vec4 org = vec4(-0.65, 0.0, 0.0, 0.0) + vec4(0.42, 0.0, 0.0, 0.0) * tri;
|
||||
vec4 org = vec4(-0.65, 0.0, 0.0, 0.0) + vec4(0.42, 0.0, 0.0, 0.0) * tri;
|
||||
|
||||
uint vert0 = 0 + vertIdx;
|
||||
uint vert1 = 1 + vertIdx;
|
||||
|
||||
@@ -1008,7 +1008,14 @@ class TestCase:
|
||||
var_data = {}
|
||||
var_data[var.name] = []
|
||||
if (var.type.baseType == rd.VarType.Struct):
|
||||
log.print(f"Ignoring struct variable '{var.name}'")
|
||||
structSize = 0
|
||||
structSize += var.type.members[0].byteOffset
|
||||
for member in var.type.members:
|
||||
byteWidth = rd.VarTypeByteSize(member.type.baseType)
|
||||
structSize += byteWidth * member.type.columns * member.type.elements
|
||||
skipBytes = structSize * var.type.elements
|
||||
log.print(f"Skipping struct variable '{var.name}' Size {skipBytes}")
|
||||
offset += skipBytes
|
||||
continue
|
||||
# This is not complete to decode all possible payload layouts
|
||||
for i in range(var.type.elements):
|
||||
@@ -1019,7 +1026,8 @@ class TestCase:
|
||||
format.type = rd.ResourceFormatType.Regular
|
||||
|
||||
data = analyse.unpack_data(format, buffer_data, offset)
|
||||
var_data[var.name] += data
|
||||
if data:
|
||||
var_data[var.name] += data
|
||||
offset += format.compByteWidth * format.compCount
|
||||
ret.append(var_data)
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ class VK_Mesh_Shader(rdtest.TestCase):
|
||||
|
||||
def build_local_taskout_reference(self):
|
||||
reference = {}
|
||||
reference[0] = { 'tri': [0, 1, 2, 3] }
|
||||
reference[0] = { 'padArr' : [1000,1001,1002,1003] }
|
||||
reference[1] = { 'pad': [123] }
|
||||
reference[2] = { 'tri': [0, 1, 2, 3] }
|
||||
return reference
|
||||
|
||||
def build_meshout_reference(self, orgY, color):
|
||||
|
||||
Reference in New Issue
Block a user