8f6df770ce
Add bool members is_read and is_written to SPIRType::Image. Output correct texture read/write access by marking whether textures are read from and written to by the shader. Override bitcast_glsl_op() to use Metal as_type<type> functions. Add implementations of SPIR-V functions inverse(), degrees() & radians(). Map inverseSqrt() to rsqrt(). Map roundEven() to rint(). GLSL functions imageSize() and textureSize() map to equivalent expression using MSL get_width() & get_height() functions. Map several SPIR-V integer bitfield functions to MSL equivalents. Map SPIR-V atomic functions to MSL equivalents. Map texture packing and unpacking functions to MSL equivalents. Refactor existing, and add new, image query functions. Reorganize header lines into includes and pragmas. Simplify type_to_glsl() logic. Add MSL test case vert/functions.vert for added function implementations. Add MSL test case comp/atomic.comp for added function implementations. test_shaders.py use macOS compilation for MSL shader compilation validations.
24 lines
775 B
GLSL
24 lines
775 B
GLSL
#version 310 es
|
|
precision mediump float;
|
|
|
|
layout(binding = 0) uniform sampler2D TextureBase;
|
|
layout(binding = 1) uniform sampler2D TextureDetail;
|
|
|
|
layout(location = 0) in vec4 VertGeom;
|
|
|
|
layout(location = 0) out vec4 FragColor0;
|
|
layout(location = 1) out vec4 FragColor1;
|
|
|
|
void main()
|
|
{
|
|
vec4 texSample0 = texture(TextureBase, VertGeom.xy);
|
|
vec4 texSample1 = textureOffset(TextureDetail, VertGeom.xy, ivec2(3, 2));
|
|
|
|
ivec4 iResult0 = floatBitsToInt(texSample0);
|
|
ivec4 iResult1 = floatBitsToInt(texSample1);
|
|
FragColor0 = (intBitsToFloat(iResult0) * intBitsToFloat(iResult1));
|
|
|
|
uvec4 uResult0 = floatBitsToUint(texSample0);
|
|
uvec4 uResult1 = floatBitsToUint(texSample1);
|
|
FragColor1 = (uintBitsToFloat(uResult0) * uintBitsToFloat(uResult1));
|
|
} |