Fix GatherDref on GLSL.
This commit is contained in:
Родитель
6b478c928d
Коммит
47081f810a
|
@ -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;
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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.
|
// 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 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 grad_y, uint32_t lod, uint32_t coffset, uint32_t offset, uint32_t bias,
|
||||||
uint32_t comp, uint32_t sample, bool *p_forward)
|
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);
|
forward = forward && should_forward(dref);
|
||||||
|
|
||||||
// SPIR-V splits dref and coordinate.
|
// 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 += ", ";
|
||||||
farg_str += to_expression(coord);
|
farg_str += to_expression(coord);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче