-
Notifications
You must be signed in to change notification settings - Fork 571
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 #2343 from billhollings/recurs-desc-set-arg-buff
MSL: Support descriptor sets with recursive content when using argument buffers.
- Loading branch information
Showing
4 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...pt/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.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,33 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct recurs; | ||
|
||
struct recurs | ||
{ | ||
int m1; | ||
device recurs* m2; | ||
}; | ||
|
||
struct recurs_1 | ||
{ | ||
int m1; | ||
device recurs_1* m2; | ||
}; | ||
|
||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); | ||
|
||
struct spvDescriptorSetBuffer0 | ||
{ | ||
device recurs* nums [[id(0)]]; | ||
texture2d<uint, access::write> tex [[id(1)]]; | ||
}; | ||
|
||
kernel void main0(constant void* spvDescriptorSet0_vp [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) | ||
{ | ||
constant auto& spvDescriptorSet0 = *(constant spvDescriptorSetBuffer0*)spvDescriptorSet0_vp; | ||
spvDescriptorSet0.tex.write(uint4(uint(((*spvDescriptorSet0.nums).m1 + (*spvDescriptorSet0.nums).m2->m1) + (*spvDescriptorSet0.nums).m2->m2->m1), 0u, 0u, 1u), uint2(int2(gl_GlobalInvocationID.xy))); | ||
} | ||
|
37 changes: 37 additions & 0 deletions
37
...ce/shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.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,37 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct recurs; | ||
|
||
struct recurs | ||
{ | ||
int m1; | ||
device recurs* m2; | ||
}; | ||
|
||
struct recurs_1 | ||
{ | ||
int m1; | ||
device recurs_1* m2; | ||
}; | ||
|
||
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u); | ||
|
||
struct spvDescriptorSetBuffer0 | ||
{ | ||
device recurs* nums [[id(0)]]; | ||
texture2d<uint, access::write> tex [[id(1)]]; | ||
}; | ||
|
||
kernel void main0(constant void* spvDescriptorSet0_vp [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) | ||
{ | ||
constant auto& spvDescriptorSet0 = *(constant spvDescriptorSetBuffer0*)spvDescriptorSet0_vp; | ||
int rslt = 0; | ||
rslt += (*spvDescriptorSet0.nums).m1; | ||
rslt += (*spvDescriptorSet0.nums).m2->m1; | ||
rslt += (*spvDescriptorSet0.nums).m2->m2->m1; | ||
spvDescriptorSet0.tex.write(uint4(uint(rslt), 0u, 0u, 1u), uint2(int2(gl_GlobalInvocationID.xy))); | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
shaders-msl/comp/metal3_1_regression_patch.replace-recursive-inputs.msl3.argument.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,21 @@ | ||
#version 450 | ||
#extension GL_EXT_buffer_reference2 : require | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
|
||
layout(buffer_reference) buffer recurs; | ||
layout(buffer_reference, buffer_reference_align = 16, set = 0, binding = 1, std140) buffer recurs | ||
{ | ||
int m1; | ||
recurs m2; | ||
} nums; | ||
|
||
layout(set = 0, binding = 0, r32ui) uniform writeonly uimage2D tex; | ||
|
||
void main() | ||
{ | ||
int rslt = 0; | ||
rslt += nums.m1; | ||
rslt += nums.m2.m1; | ||
rslt += nums.m2.m2.m1; | ||
imageStore(tex, ivec2(gl_GlobalInvocationID.xy), uvec4(rslt, 0u, 0u, 1u)); | ||
} |
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