GLSL: Support GL_EXT_shader_image_load_formatted.
This commit is contained in:
parent
3cb8e7c223
commit
f93a8fb1fe
12
reference/shaders-no-opt/comp/image-load-formatted.comp
Normal file
12
reference/shaders-no-opt/comp/image-load-formatted.comp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#version 450
|
||||||
|
#extension GL_EXT_shader_image_load_formatted : require
|
||||||
|
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
|
||||||
|
|
||||||
|
layout(binding = 0) uniform image2D img;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 v = imageLoad(img, ivec2(gl_GlobalInvocationID.xy));
|
||||||
|
imageStore(img, ivec2(gl_GlobalInvocationID.xy), v + vec4(1.0));
|
||||||
|
}
|
||||||
|
|
11
shaders-no-opt/comp/image-load-formatted.comp
Normal file
11
shaders-no-opt/comp/image-load-formatted.comp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#version 450
|
||||||
|
#extension GL_EXT_shader_image_load_formatted : require
|
||||||
|
layout(local_size_x = 8, local_size_y = 8) in;
|
||||||
|
|
||||||
|
layout(binding = 0) uniform image2D img;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 v = imageLoad(img, ivec2(gl_GlobalInvocationID.xy));
|
||||||
|
imageStore(img, ivec2(gl_GlobalInvocationID.xy), v + 1.0);
|
||||||
|
}
|
@ -12816,10 +12816,24 @@ string CompilerGLSL::to_qualifiers_glsl(uint32_t id)
|
|||||||
res += "coherent ";
|
res += "coherent ";
|
||||||
if (flags.get(DecorationRestrict))
|
if (flags.get(DecorationRestrict))
|
||||||
res += "restrict ";
|
res += "restrict ";
|
||||||
|
|
||||||
if (flags.get(DecorationNonWritable))
|
if (flags.get(DecorationNonWritable))
|
||||||
res += "readonly ";
|
res += "readonly ";
|
||||||
|
|
||||||
|
bool formatted_load = type.image.format == ImageFormatUnknown;
|
||||||
if (flags.get(DecorationNonReadable))
|
if (flags.get(DecorationNonReadable))
|
||||||
|
{
|
||||||
res += "writeonly ";
|
res += "writeonly ";
|
||||||
|
formatted_load = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formatted_load)
|
||||||
|
{
|
||||||
|
if (!options.es)
|
||||||
|
require_extension_internal("GL_EXT_shader_image_load_formatted");
|
||||||
|
else
|
||||||
|
SPIRV_CROSS_THROW("Cannot use GL_EXT_shader_image_load_formatted in ESSL.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res += to_precision_qualifiers_glsl(id);
|
res += to_precision_qualifiers_glsl(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user