Browse Source

[spirv] Use Invocation(4) as memory barrier in HS. (#1241)

Ehsan 7 years ago
parent
commit
b6abc9f9cd

+ 1 - 1
tools/clang/lib/SPIRV/SPIRVEmitter.cpp

@@ -9326,7 +9326,7 @@ bool SPIRVEmitter::processHSEntryPointOutputAndPCF(
   // Memory Barrier scope = Device (1)
   // Memory Semantics Barrier scope = None (0)
   theBuilder.createBarrier(theBuilder.getConstantUint32(2),
-                           theBuilder.getConstantUint32(1),
+                           theBuilder.getConstantUint32(4),
                            theBuilder.getConstantUint32(0));
 
   // The PCF should be called only once. Therefore, we check the invocationID,

+ 4 - 4
tools/clang/test/CodeGenSPIRV/bezier.hull.hlsl2spv

@@ -161,9 +161,9 @@ BEZIER_CONTROL_POINT SubDToBezierHS(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POIN
 // %_ptr_Output__arr_v3float_uint_3 = OpTypePointer Output %_arr_v3float_uint_3
 // %_ptr_Output_v3float = OpTypePointer Output %v3float
 // %uint_0 = OpConstant %uint 0
+// %uint_4 = OpConstant %uint 4
 // %uint_2 = OpConstant %uint 2
 // %bool = OpTypeBool
-// %uint_4 = OpConstant %uint 4
 // %_arr_float_uint_4 = OpTypeArray %float %uint_4
 // %_arr_float_uint_2 = OpTypeArray %float %uint_2
 // %_arr_v3float_uint_4 = OpTypeArray %v3float %uint_4
@@ -237,10 +237,10 @@ BEZIER_CONTROL_POINT SubDToBezierHS(InputPatch<VS_CONTROL_POINT_OUTPUT, MAX_POIN
 // %57 = OpCompositeExtract %v3float %56 0
 // %61 = OpAccessChain %_ptr_Output_v3float %out_var_BEZIERPOS %51
 // OpStore %61 %57
-// OpControlBarrier %uint_2 %uint_1 %uint_0
-// %65 = OpIEqual %bool %51 %uint_0
+// OpControlBarrier %uint_2 %uint_4 %uint_0
+// %66 = OpIEqual %bool %51 %uint_0
 // OpSelectionMerge %if_merge None
-// OpBranchConditional %65 %if_true %if_merge
+// OpBranchConditional %66 %if_true %if_merge
 // %if_true = OpLabel
 // %75 = OpFunctionCall %HS_CONSTANT_DATA_OUTPUT %SubDToBezierConstantsHS %param_var_ip %param_var_PatchID
 // %76 = OpCompositeExtract %_arr_float_uint_4 %75 0

+ 1 - 1
tools/clang/test/CodeGenSPIRV/hs.structure.hlsl

@@ -12,7 +12,7 @@
 
 // CHECK:      {{%\d+}} = OpFunctionCall %BEZIER_CONTROL_POINT %src_main %param_var_ip %param_var_i %param_var_PatchID
 
-// CHECK:                 OpControlBarrier %uint_2 %uint_1 %uint_0
+// CHECK:                 OpControlBarrier %uint_2 %uint_4 %uint_0
 
 // CHECK: [[cond:%\d+]] = OpIEqual %bool [[id]] %uint_0
 // CHECK:                 OpSelectionMerge %if_merge None