yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Jay KwakUse Offset instead of ConstOffset for GLSL function textureGatherOffset (#5426)8b3f9048c

master
814 B27 linesraw
1//TEST:SIMPLE(filecheck=SPV): -allow-glsl -target spirv-asm -entry computeMain -stage compute
2
3// Test if we are correctly using `Offset` option instead of `ConstOffset`
4// when the offset value is not a compile-time constant.
5
6//SPV:OpCapability ImageGatherExtended
7
8#extension GL_EXT_gpu_shader5 : require
9
10layout (location = 0) in highp vec2 v_texCoord;
11
12layout (binding = 0) uniform highp sampler2D u_sampler;
13layout (binding = 1) uniform offset { highp ivec2 u_offset; };
14
15//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
16buffer MyBlockName
17{
18    vec4 result;
19} outputBuffer;
20
21void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
22{
23    //SPV:OpImageGather %
24    //SPV-NOT:Const
25    //SPV-SAME: Offset %
26    outputBuffer.result = textureGatherOffset(u_sampler, v_texCoord, u_offset);
27}