瀏覽代碼

Updated spirv-cross.

Бранимир Караџић 6 年之前
父節點
當前提交
4a6e889974

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc

@@ -46,7 +46,7 @@ void spvArrayCopyFromConstant1(thread T (&dst)[N], constant T (&src)[N])
     for (uint i = 0; i < N; dst[i] = src[i], i++);
     for (uint i = 0; i < N; dst[i] = src[i], i++);
 }
 }
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
     if (gl_InvocationID < spvIndirectParams[0])
     if (gl_InvocationID < spvIndirectParams[0])

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc

@@ -13,7 +13,7 @@ struct TessLevels
     float outer3;
     float outer3;
 };
 };
 
 
-kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
+kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
 {
 {
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0);
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0);
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0);
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0);

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc

@@ -18,7 +18,7 @@ struct main0_in
     float3 vInput [[attribute(0)]];
     float3 vInput [[attribute(0)]];
 };
 };
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc

@@ -18,7 +18,7 @@ struct main0_in
     float4 gl_Position [[attribute(0)]];
     float4 gl_Position [[attribute(0)]];
 };
 };
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc

@@ -20,7 +20,7 @@ struct main0_in
     float3 Boo_b [[attribute(1)]];
     float3 Boo_b [[attribute(1)]];
 };
 };
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     if (gl_InvocationID < spvIndirectParams[0])
     if (gl_InvocationID < spvIndirectParams[0])

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/basic.tesc

@@ -8,7 +8,7 @@ struct main0_patchOut
     float3 vFoo;
     float3 vFoo;
 };
 };
 
 
-kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
+kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
 {
 {
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375);
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375);

+ 1 - 1
3rdparty/spirv-cross/reference/opt/shaders-msl/tesc/water_tess.tesc

@@ -24,7 +24,7 @@ struct main0_in
     float2 vPatchPosBase [[attribute(0)]];
     float2 vPatchPosBase [[attribute(0)]];
 };
 };
 
 
-kernel void main0(main0_in in [[stage_in]], constant UBO& _41 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], constant UBO& _41 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     if (gl_InvocationID < spvIndirectParams[0])
     if (gl_InvocationID < spvIndirectParams[0])

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/asm/tesc/tess-fixed-input-array-builtin-array.invalid.asm.tesc

@@ -76,7 +76,7 @@ HSConstantOut PatchHS(thread const VertexOutput (&_patch)[3])
     return _output;
     return _output;
 }
 }
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
     if (gl_InvocationID < spvIndirectParams[0])
     if (gl_InvocationID < spvIndirectParams[0])

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/asm/tesc/tess-level-overrun.asm.tesc

@@ -13,7 +13,7 @@ struct TessLevels
     float outer3;
     float outer3;
 };
 };
 
 
-kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
+kernel void main0(const device TessLevels& sb_levels [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
 {
 {
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0);
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(sb_levels.inner0);
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0);
     spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(sb_levels.outer0);

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/arrayed-output.desktop.sso.tesc

@@ -18,7 +18,7 @@ struct main0_in
     float3 vInput [[attribute(0)]];
     float3 vInput [[attribute(0)]];
 };
 };
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/basic.desktop.sso.tesc

@@ -25,7 +25,7 @@ void set_position(device main0_out* thread & gl_out, thread uint& gl_InvocationI
     gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position;
     gl_out[gl_InvocationID].gl_Position = gl_in[0].gl_Position + gl_in[1].gl_Position;
 }
 }
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 1];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/desktop-only/tesc/struct-copy.desktop.sso.tesc

@@ -20,7 +20,7 @@ struct main0_in
     float3 Boo_b [[attribute(1)]];
     float3 Boo_b [[attribute(1)]];
 };
 };
 
 
-kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], device uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
     if (gl_InvocationID < spvIndirectParams[0])
     if (gl_InvocationID < spvIndirectParams[0])

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/tesc/basic.tesc

@@ -8,7 +8,7 @@ struct main0_patchOut
     float3 vFoo;
     float3 vFoo;
 };
 };
 
 
-kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
+kernel void main0(uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]])
 {
 {
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375);
     spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(8.8999996185302734375);

+ 1 - 1
3rdparty/spirv-cross/reference/shaders-msl/tesc/water_tess.tesc

@@ -106,7 +106,7 @@ void compute_tess_levels(thread const float2& p0, constant UBO& v_41, device flo
     gl_TessLevelInner[1] = half(inner);
     gl_TessLevelInner[1] = half(inner);
 }
 }
 
 
-kernel void main0(main0_in in [[stage_in]], constant UBO& v_41 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
+kernel void main0(main0_in in [[stage_in]], constant UBO& v_41 [[buffer(0)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
 {
 {
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
     if (gl_InvocationID < spvIndirectParams[0])
     if (gl_InvocationID < spvIndirectParams[0])

+ 9 - 2
3rdparty/spirv-cross/spirv_msl.cpp

@@ -5608,12 +5608,19 @@ void CompilerMSL::entry_point_args_builtin(string &ep_args)
 			                " [[buffer(", msl_options.shader_output_buffer_index, ")]]");
 			                " [[buffer(", msl_options.shader_output_buffer_index, ")]]");
 		}
 		}
 
 
-		if (stage_out_var_id || get_execution_model() == ExecutionModelTessellationControl)
+		if (get_execution_model() == ExecutionModelTessellationControl)
+		{
+			if (!ep_args.empty())
+				ep_args += ", ";
+			ep_args +=
+				join("constant uint* spvIndirectParams [[buffer(", msl_options.indirect_params_buffer_index, ")]]");
+		}
+		else if (stage_out_var_id)
 		{
 		{
 			if (!ep_args.empty())
 			if (!ep_args.empty())
 				ep_args += ", ";
 				ep_args += ", ";
 			ep_args +=
 			ep_args +=
-			    join("device uint* spvIndirectParams [[buffer(", msl_options.indirect_params_buffer_index, ")]]");
+				join("device uint* spvIndirectParams [[buffer(", msl_options.indirect_params_buffer_index, ")]]");
 		}
 		}
 
 
 		// Tessellation control shaders get three additional parameters:
 		// Tessellation control shaders get three additional parameters: