summaryrefslogtreecommitdiffstats
path: root/tests/bugs/texture2d-gather.hlsl
blob: 3eecca8f80f7cc932b9caabd9cca2432e75e6477 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//TEST(smoke):COMPARE_HLSL_RENDER:
//DISABLE_TEST(smoke):COMPARE_HLSL_RENDER:-mtl
//TEST_INPUT: Texture2D(size=16, content=chessboard, format=R32Float):name g_texture
//TEST_INPUT: Sampler :name g_sampler

Texture2D<float> g_texture;

SamplerState g_sampler;

cbuffer Uniforms
{
	float4x4 modelViewProjection;
}

struct AssembledVertex
{
	float3	position;
	float3	color;
	float2	uv;
};

// Vertex  Shader
struct VertexStageInput
{
	AssembledVertex assembledVertex	: A;
};

struct VertexStageOutput
{
	float4          color           : COLOR; 
	float4			position		: SV_Position;
};

[shader("vertex")]
VertexStageOutput vertexMain(VertexStageInput input) 
{
    VertexStageOutput output;
    
    output.position = mul(modelViewProjection, float4(input.assembledVertex.position, 1.0));
    output.color = float4(input.assembledVertex.color, 1.0f);
    
    return output;
}

[shader("fragment")]
float4 fragmentMain(VertexStageOutput input) : SV_Target
{
    return g_texture.GatherRed(g_sampler, input.color.xy);
}