SPIRV-Cross/reference/opt/shaders/vulkan/frag/separate-sampler-texture-array.vk.frag
Hans-Kristian Arntzen 7a6c2da9aa GLSL: Handle more proper semantics for RelaxedPrecision.
GLSL and RelaxedPrecision are quite different in what they affect.
RelaxedPrecision affects operations, while this is merely implied in
GLSL based on inputs.

This leads to situations where we have to promote mediump inputs to
highp, and the simplest approach is to force highp temporaries for
inputs which are consumed in a highp context. For completeness, we also
demote RelaxedPrecision inputs to mediump variables.

PHI is handled by copying the PHI into a temporary.

We have to be very careful with hoisted temporaries, since the child
temporary will not be analyzed up-front. We inherit the hoisted-ness
state and emit the hoisted child temporary as necessary. When faking the
temporaries with OpCopyObject, we make sure to block any variable
hoisting.

Hoisting children of PHI variables is fine, since PHIs are not hoisted with
the same framework as other temporaries.
2022-05-02 15:11:24 +02:00

24 lines
1.1 KiB
GLSL

#version 310 es
precision mediump float;
precision highp int;
uniform mediump sampler2D SPIRV_Cross_CombineduTextureuSampler[4];
uniform mediump sampler2DArray SPIRV_Cross_CombineduTextureArrayuSampler[4];
uniform mediump samplerCube SPIRV_Cross_CombineduTextureCubeuSampler[4];
uniform mediump sampler3D SPIRV_Cross_CombineduTexture3DuSampler[4];
layout(location = 0) in vec2 vTex;
layout(location = 1) in vec3 vTex3;
layout(location = 0) out vec4 FragColor;
void main()
{
highp vec2 _76 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler[1], 0));
vec2 mp_copy_76 = _76;
highp vec2 _86 = vec2(1.0) / vec2(textureSize(SPIRV_Cross_CombineduTextureuSampler[2], 1));
vec2 mp_copy_86 = _86;
vec2 _95 = (vTex + mp_copy_76) + mp_copy_86;
FragColor = ((((texture(SPIRV_Cross_CombineduTextureuSampler[2], _95) + texture(SPIRV_Cross_CombineduTextureuSampler[1], _95)) + texture(SPIRV_Cross_CombineduTextureuSampler[1], _95)) + texture(SPIRV_Cross_CombineduTextureArrayuSampler[3], vTex3)) + texture(SPIRV_Cross_CombineduTextureCubeuSampler[1], vTex3)) + texture(SPIRV_Cross_CombineduTexture3DuSampler[2], vTex3);
}