mirror of
https://github.com/RPCS3/glslang.git
synced 2024-11-27 05:00:28 +00:00
ed789649ce
Added following updates to GL_EXT_mesh_shader implementation: 1. Added SPIRV and GLSL test cases 2. Added checks to ensure NV and EXT mesh shader builtins cannot be used interchangeably. 3. Updated the language name by removing the postfix "NV" to MeshShader and TaskShader. 4. Added checks for grammar checking to comply with the spec. 5. Added gl_NumWorkGroups builtin to Mesh shader 6. Fixed data type of gl_PrimitiveLineIndicesEXT and gl_PrimitiveTriangleIndicesEXT 7. Added new constants to the resources table 8. Updates to handle new storage qualifier "taskPayloadSharedEXT" 9. Updated test cases by replacing "taskEXT" with storage qualifier "taskPayloadSharedEXT" Addressed Review comments 1. Fixed instruction description used by glslang disassembly. 2. Updated OpEmitMeshTasksEXT as per spec update 3. Fixed implementation that errors out if there are more then one taskPayloadSharedEXT varjables. 4. Fixed miscellaneous error logs and removed unwanted code. SPIRV 1.6 related build failure fixes - Update SPIRV header to 1.6 - Fix conflict wiht SPIRV 1.6 change, where localSizeId is used for execution mode for mesh/task shaders Enable SPIRV generated for EXT_mesh_shader to be version 1.4 GL_EXT_mesh_shader: Add checks for atomic support and corresponding test cases
154 lines
3.6 KiB
Plaintext
154 lines
3.6 KiB
Plaintext
#version 460
|
|
|
|
|
|
#define BARRIER() \
|
|
memoryBarrierShared(); \
|
|
barrier();
|
|
|
|
#extension GL_EXT_mesh_shader : enable
|
|
|
|
layout(local_size_x = 32, local_size_y=1, local_size_z=1) in;
|
|
|
|
// test use of shared memory in task shaders:
|
|
layout(binding=0) writeonly uniform image2D uni_image;
|
|
uniform block0 {
|
|
uint uni_value;
|
|
};
|
|
shared vec4 mem[10];
|
|
|
|
// test use of task memory in task shaders:
|
|
struct Task {
|
|
vec2 dummy;
|
|
vec2 submesh[3];
|
|
};
|
|
|
|
taskPayloadSharedEXT Task mytask;
|
|
void main()
|
|
{
|
|
uint iid = gl_LocalInvocationID.x;
|
|
uint gid = gl_WorkGroupID.x;
|
|
|
|
// 1. shared memory load and stores
|
|
for (uint i = 0; i < 10; ++i) {
|
|
mem[i] = vec4(i + uni_value);
|
|
}
|
|
imageStore(uni_image, ivec2(iid), mem[gid]);
|
|
imageStore(uni_image, ivec2(iid), mem[gid+1]);
|
|
|
|
BARRIER();
|
|
|
|
// 2. task memory stores
|
|
|
|
mytask.dummy = vec2(30.0, 31.0);
|
|
mytask.submesh[0] = vec2(32.0, 33.0);
|
|
mytask.submesh[1] = vec2(34.0, 35.0);
|
|
mytask.submesh[2] = mytask.submesh[gid%2];
|
|
|
|
BARRIER();
|
|
|
|
// 3. emit task count under uniform control flow
|
|
EmitMeshTasksEXT(3U, 1U, 1U);
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_basic: enable
|
|
void basic_works (void)
|
|
{
|
|
gl_SubgroupSize;
|
|
gl_SubgroupInvocationID;
|
|
subgroupBarrier();
|
|
subgroupMemoryBarrier();
|
|
subgroupMemoryBarrierBuffer();
|
|
subgroupMemoryBarrierImage();
|
|
subgroupElect();
|
|
gl_NumSubgroups; // allowed in task
|
|
gl_SubgroupID; // allowed in task
|
|
subgroupMemoryBarrierShared(); // allowed in task
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_ballot: enable
|
|
void ballot_works(vec4 f4) {
|
|
gl_SubgroupEqMask;
|
|
gl_SubgroupGeMask;
|
|
gl_SubgroupGtMask;
|
|
gl_SubgroupLeMask;
|
|
gl_SubgroupLtMask;
|
|
subgroupBroadcast(f4, 0);
|
|
subgroupBroadcastFirst(f4);
|
|
uvec4 ballot = subgroupBallot(false);
|
|
subgroupInverseBallot(uvec4(0x1));
|
|
subgroupBallotBitExtract(ballot, 0);
|
|
subgroupBallotBitCount(ballot);
|
|
subgroupBallotInclusiveBitCount(ballot);
|
|
subgroupBallotExclusiveBitCount(ballot);
|
|
subgroupBallotFindLSB(ballot);
|
|
subgroupBallotFindMSB(ballot);
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_vote: enable
|
|
void vote_works(vec4 f4)
|
|
{
|
|
subgroupAll(true);
|
|
subgroupAny(false);
|
|
subgroupAllEqual(f4);
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_shuffle: enable
|
|
#extension GL_KHR_shader_subgroup_shuffle_relative: enable
|
|
void shuffle_works(vec4 f4)
|
|
{
|
|
subgroupShuffle(f4, 0);
|
|
subgroupShuffleXor(f4, 0x1);
|
|
subgroupShuffleUp(f4, 1);
|
|
subgroupShuffleDown(f4, 1);
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_arithmetic: enable
|
|
void arith_works(vec4 f4)
|
|
{
|
|
uvec4 ballot;
|
|
subgroupAdd(f4);
|
|
subgroupMul(f4);
|
|
subgroupMin(f4);
|
|
subgroupMax(f4);
|
|
subgroupAnd(ballot);
|
|
subgroupOr(ballot);
|
|
subgroupXor(ballot);
|
|
subgroupInclusiveAdd(f4);
|
|
subgroupInclusiveMul(f4);
|
|
subgroupInclusiveMin(f4);
|
|
subgroupInclusiveMax(f4);
|
|
subgroupInclusiveAnd(ballot);
|
|
subgroupInclusiveOr(ballot);
|
|
subgroupInclusiveXor(ballot);
|
|
subgroupExclusiveAdd(f4);
|
|
subgroupExclusiveMul(f4);
|
|
subgroupExclusiveMin(f4);
|
|
subgroupExclusiveMax(f4);
|
|
subgroupExclusiveAnd(ballot);
|
|
subgroupExclusiveOr(ballot);
|
|
subgroupExclusiveXor(ballot);
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_clustered: enable
|
|
void clustered_works(vec4 f4)
|
|
{
|
|
uvec4 ballot = uvec4(0x55,0,0,0);
|
|
subgroupClusteredAdd(f4, 2);
|
|
subgroupClusteredMul(f4, 2);
|
|
subgroupClusteredMin(f4, 2);
|
|
subgroupClusteredMax(f4, 2);
|
|
subgroupClusteredAnd(ballot, 2);
|
|
subgroupClusteredOr(ballot, 2);
|
|
subgroupClusteredXor(ballot, 2);
|
|
}
|
|
|
|
#extension GL_KHR_shader_subgroup_quad: enable
|
|
void quad_works(vec4 f4)
|
|
{
|
|
subgroupQuadBroadcast(f4, 0);
|
|
subgroupQuadSwapHorizontal(f4);
|
|
subgroupQuadSwapVertical(f4);
|
|
subgroupQuadSwapDiagonal(f4);
|
|
}
|
|
|