summaryrefslogtreecommitdiffstats
path: root/tests/bugs/gh-5339.slang
blob: 163b05bc7d9f4eb7ddba20761ff5467a14017f93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//TEST:SIMPLE(filecheck=SPV): -allow-glsl -target spirv-asm -entry computeMain -stage compute

// Test if we are correctly using `Offset` option instead of `ConstOffset`
// when the offset value is not a compile-time constant.

//SPV:OpCapability ImageGatherExtended

#extension GL_EXT_gpu_shader5 : require

layout (location = 0) in highp vec2 v_texCoord;

layout (binding = 0) uniform highp sampler2D u_sampler;
layout (binding = 1) uniform offset { highp ivec2 u_offset; };

//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
buffer MyBlockName
{
    vec4 result;
} outputBuffer;

void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    //SPV:OpImageGather %
    //SPV-NOT:Const
    //SPV-SAME: Offset %
    outputBuffer.result = textureGatherOffset(u_sampler, v_texCoord, u_offset);
}