-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2310 from KhronosGroup/fix-2300
MSL: Fix SUMulExtended for 64-bit inputs.
- Loading branch information
Showing
7 changed files
with
124 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
reference/opt/shaders-msl/asm/comp/ulong_smulextended.asm.msl23.comp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct _4 | ||
{ | ||
ulong _m0[1]; | ||
}; | ||
|
||
struct _21 | ||
{ | ||
ulong _m0; | ||
ulong _m1; | ||
}; | ||
|
||
kernel void main0(device _4& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]], device _4& _7 [[buffer(2)]], device _4& _8 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) | ||
{ | ||
_21 _29; | ||
_29._m0 = long(_5._m0[gl_GlobalInvocationID.x]) * long(_6._m0[gl_GlobalInvocationID.x]); | ||
_29._m1 = mulhi(long(_5._m0[gl_GlobalInvocationID.x]), long(_6._m0[gl_GlobalInvocationID.x])); | ||
_7._m0[gl_GlobalInvocationID.x] = _29._m0; | ||
_8._m0[gl_GlobalInvocationID.x] = _29._m1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
reference/shaders-msl/asm/comp/ulong_smulextended.asm.msl23.comp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct _4 | ||
{ | ||
ulong _m0[1]; | ||
}; | ||
|
||
struct _21 | ||
{ | ||
ulong _m0; | ||
ulong _m1; | ||
}; | ||
|
||
kernel void main0(device _4& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]], device _4& _7 [[buffer(2)]], device _4& _8 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) | ||
{ | ||
_21 _29; | ||
_29._m0 = long(_5._m0[gl_GlobalInvocationID.x]) * long(_6._m0[gl_GlobalInvocationID.x]); | ||
_29._m1 = mulhi(long(_5._m0[gl_GlobalInvocationID.x]), long(_6._m0[gl_GlobalInvocationID.x])); | ||
_7._m0[gl_GlobalInvocationID.x] = _29._m0; | ||
_8._m0[gl_GlobalInvocationID.x] = _29._m1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
OpCapability Shader | ||
OpCapability Int64 | ||
|
||
OpMemoryModel Logical GLSL450 | ||
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationId | ||
OpExecutionMode %main LocalSize 1 1 1 | ||
|
||
OpDecorate %gl_GlobalInvocationId BuiltIn GlobalInvocationId | ||
OpDecorate %ra_ulong ArrayStride 8 | ||
OpDecorate %struct_ulong4 BufferBlock | ||
OpMemberDecorate %struct_ulong4 0 Offset 0 | ||
OpDecorate %input0 DescriptorSet 0 | ||
OpDecorate %input0 Binding 0 | ||
OpDecorate %input1 DescriptorSet 0 | ||
OpDecorate %input1 Binding 1 | ||
OpDecorate %output0 DescriptorSet 0 | ||
OpDecorate %output0 Binding 2 | ||
OpDecorate %output1 DescriptorSet 0 | ||
OpDecorate %output1 Binding 3 | ||
|
||
%uint = OpTypeInt 32 0 | ||
%ulong = OpTypeInt 64 0 | ||
%ptr_ulong = OpTypePointer Uniform %ulong | ||
%ptr_input_uint = OpTypePointer Input %uint | ||
%uint3 = OpTypeVector %uint 3 | ||
%ptr_input_uint3 = OpTypePointer Input %uint3 | ||
%void = OpTypeVoid | ||
%voidFn = OpTypeFunction %void | ||
|
||
%uint_0 = OpConstant %uint 0 | ||
%uint_1 = OpConstant %uint 1 | ||
%ra_ulong = OpTypeRuntimeArray %ulong | ||
%ulong4 = OpTypeVector %uint 4 | ||
%struct_ulong4 = OpTypeStruct %ra_ulong | ||
%ptr_struct_ulong4 = OpTypePointer Uniform %struct_ulong4 | ||
%resulttype = OpTypeStruct %ulong %ulong | ||
%gl_GlobalInvocationId = OpVariable %ptr_input_uint3 Input | ||
%input0 = OpVariable %ptr_struct_ulong4 Uniform | ||
%input1 = OpVariable %ptr_struct_ulong4 Uniform | ||
|
||
%output0 = OpVariable %ptr_struct_ulong4 Uniform | ||
%output1 = OpVariable %ptr_struct_ulong4 Uniform | ||
|
||
%main = OpFunction %void None %voidFn | ||
%mainStart = OpLabel | ||
%index_ptr = OpAccessChain %ptr_input_uint %gl_GlobalInvocationId %uint_0 | ||
%index = OpLoad %uint %index_ptr | ||
%in_ptr0 = OpAccessChain %ptr_ulong %input0 %uint_0 %index | ||
%invalue0 = OpLoad %ulong %in_ptr0 | ||
%in_ptr1 = OpAccessChain %ptr_ulong %input1 %uint_0 %index | ||
%invalue1 = OpLoad %ulong %in_ptr1 | ||
|
||
%outvalue = OpSMulExtended %resulttype %invalue0 %invalue1 | ||
%outvalue0 = OpCompositeExtract %ulong %outvalue 0 | ||
%out_ptr0 = OpAccessChain %ptr_ulong %output0 %uint_0 %index | ||
OpStore %out_ptr0 %outvalue0 | ||
%outvalue1 = OpCompositeExtract %ulong %outvalue 1 | ||
%out_ptr1 = OpAccessChain %ptr_ulong %output1 %uint_0 %index | ||
OpStore %out_ptr1 %outvalue1 | ||
|
||
|
||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters