mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 22:00:05 +00:00
Fix GatherDref on GLSL.
This commit is contained in:
parent
6b478c928d
commit
47081f810a
22
reference/opt/shaders-msl/frag/gather-dref.frag
Normal file
22
reference/opt/shaders-msl/frag/gather-dref.frag
Normal file
@ -0,0 +1,22 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float3 vUV [[user(locn0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uT [[texture(0)]], sampler uTSmplr [[sampler(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.FragColor = uT.gather_compare(uTSmplr, in.vUV.xy, in.vUV.z);
|
||||
return out;
|
||||
}
|
||||
|
14
reference/opt/shaders/frag/gather-dref.frag
Normal file
14
reference/opt/shaders/frag/gather-dref.frag
Normal file
@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(binding = 0) uniform mediump sampler2DShadow uT;
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(location = 0) in vec3 vUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = textureGather(uT, vUV.xy, vUV.z);
|
||||
}
|
||||
|
22
reference/shaders-msl/frag/gather-dref.frag
Normal file
22
reference/shaders-msl/frag/gather-dref.frag
Normal file
@ -0,0 +1,22 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float3 vUV [[user(locn0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uT [[texture(0)]], sampler uTSmplr [[sampler(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.FragColor = uT.gather_compare(uTSmplr, in.vUV.xy, in.vUV.z);
|
||||
return out;
|
||||
}
|
||||
|
14
reference/shaders/frag/gather-dref.frag
Normal file
14
reference/shaders/frag/gather-dref.frag
Normal file
@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(binding = 0) uniform mediump sampler2DShadow uT;
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(location = 0) in vec3 vUV;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = textureGather(uT, vUV.xy, vUV.z);
|
||||
}
|
||||
|
11
shaders-msl/frag/gather-dref.frag
Normal file
11
shaders-msl/frag/gather-dref.frag
Normal file
@ -0,0 +1,11 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(binding = 0) uniform mediump sampler2DShadow uT;
|
||||
layout(location = 0) in vec3 vUV;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = textureGather(uT, vUV.xy, vUV.z);
|
||||
}
|
11
shaders/frag/gather-dref.frag
Normal file
11
shaders/frag/gather-dref.frag
Normal file
@ -0,0 +1,11 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(binding = 0) uniform mediump sampler2DShadow uT;
|
||||
layout(location = 0) in vec3 vUV;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = textureGather(uT, vUV.xy, vUV.z);
|
||||
}
|
@ -3940,7 +3940,7 @@ std::string CompilerGLSL::convert_separate_image_to_combined(uint32_t id)
|
||||
}
|
||||
|
||||
// Returns the function args for a texture sampling function for the specified image and sampling characteristics.
|
||||
string CompilerGLSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool, bool is_proj,
|
||||
string CompilerGLSL::to_function_args(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool is_proj,
|
||||
uint32_t coord, uint32_t coord_components, uint32_t dref, uint32_t grad_x,
|
||||
uint32_t grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias,
|
||||
uint32_t comp, uint32_t sample, bool *p_forward)
|
||||
@ -3998,7 +3998,7 @@ string CompilerGLSL::to_function_args(uint32_t img, const SPIRType &imgtype, boo
|
||||
forward = forward && should_forward(dref);
|
||||
|
||||
// SPIR-V splits dref and coordinate.
|
||||
if (coord_components == 4) // GLSL also splits the arguments in two.
|
||||
if (is_gather || coord_components == 4) // GLSL also splits the arguments in two. Same for textureGather.
|
||||
{
|
||||
farg_str += ", ";
|
||||
farg_str += to_expression(coord);
|
||||
|
Loading…
Reference in New Issue
Block a user