Commit f44d89a3 by Jason Ekstrand

Implement GL_EXT_shader_image_load_formatted

parent d9502833
...@@ -16,7 +16,7 @@ ERROR: 0:47: 'local_size' : can only apply to 'in' ...@@ -16,7 +16,7 @@ ERROR: 0:47: 'local_size' : can only apply to 'in'
ERROR: 0:61: 'assign' : l-value required "ro" (can't modify a readonly buffer) ERROR: 0:61: 'assign' : l-value required "ro" (can't modify a readonly buffer)
ERROR: 0:66: 'buffer' : buffers can be declared only as blocks ERROR: 0:66: 'buffer' : buffers can be declared only as blocks
ERROR: 0:68: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:68: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:76: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:76: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:81: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:81: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:82: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:82: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:87: 'imageAtomicCompSwap' : required extension not requested: GL_OES_shader_image_atomic ERROR: 0:87: 'imageAtomicCompSwap' : required extension not requested: GL_OES_shader_image_atomic
...@@ -54,12 +54,12 @@ ERROR: 0:171: 'samplerCubeArray' : Reserved word. ...@@ -54,12 +54,12 @@ ERROR: 0:171: 'samplerCubeArray' : Reserved word.
ERROR: 0:171: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:171: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:172: 'iimage2DRect' : Reserved word. ERROR: 0:172: 'iimage2DRect' : Reserved word.
ERROR: 0:172: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:172: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:172: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:172: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:173: 'image2DMS' : Reserved word. ERROR: 0:173: 'image2DMS' : Reserved word.
ERROR: 0:173: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:173: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:174: 'uimage2DMSArray' : Reserved word. ERROR: 0:174: 'uimage2DMSArray' : Reserved word.
ERROR: 0:174: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:174: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:174: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:174: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:181: 'rgba32f' : format requires readonly or writeonly memory qualifier ERROR: 0:181: 'rgba32f' : format requires readonly or writeonly memory qualifier
ERROR: 0:182: 'rgba8i' : format requires readonly or writeonly memory qualifier ERROR: 0:182: 'rgba8i' : format requires readonly or writeonly memory qualifier
ERROR: 0:183: 'rgba16ui' : format requires readonly or writeonly memory qualifier ERROR: 0:183: 'rgba16ui' : format requires readonly or writeonly memory qualifier
......
...@@ -19,13 +19,13 @@ ERROR: 0:44: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, ...@@ -19,13 +19,13 @@ ERROR: 0:44: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset,
ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset] ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]
ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset] ERROR: 0:45: 'texel offset' : value is out of range: [gl_MinProgramTexelOffset, gl_MaxProgramTexelOffset]
ERROR: 0:66: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:66: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:66: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:66: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:67: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:67: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:67: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:67: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:68: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:68: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:68: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:68: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:69: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:69: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:69: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:69: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:73: 'binding' : requires block, or sampler/image, or atomic-counter type ERROR: 0:73: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:77: 'location' : location is too large ERROR: 0:77: 'location' : location is too large
ERROR: 0:81: 'location' : too large for fragment output ERROR: 0:81: 'location' : too large for fragment output
...@@ -36,7 +36,7 @@ ERROR: 0:83: 'layout-id value' : cannot be negative ...@@ -36,7 +36,7 @@ ERROR: 0:83: 'layout-id value' : cannot be negative
ERROR: 0:96: 'sampler/image' : type requires declaration of default precision qualifier ERROR: 0:96: 'sampler/image' : type requires declaration of default precision qualifier
ERROR: 0:110: 'out' : cannot be bool ERROR: 0:110: 'out' : cannot be bool
ERROR: 0:111: 'image2D' : sampler/image types can only be used in uniform variables or function parameters: imageOut ERROR: 0:111: 'image2D' : sampler/image types can only be used in uniform variables or function parameters: imageOut
ERROR: 0:111: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:111: 'image variables declared 'writeonly' without a format layout qualifier' : not supported with this profile: es
ERROR: 0:112: 'out' : cannot be a matrix ERROR: 0:112: 'out' : cannot be a matrix
ERROR: 0:114: 'in' : cannot be bool ERROR: 0:114: 'in' : cannot be bool
ERROR: 0:115: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: ino ERROR: 0:115: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: ino
......
...@@ -33,7 +33,7 @@ ERROR: 0:85: '' : vertex input cannot be further qualified ...@@ -33,7 +33,7 @@ ERROR: 0:85: '' : vertex input cannot be further qualified
ERROR: 0:86: 'patch' : not supported in this stage: vertex ERROR: 0:86: 'patch' : not supported in this stage: vertex
ERROR: 0:100: '=' : global const initializers must be constant 'const int' ERROR: 0:100: '=' : global const initializers must be constant 'const int'
ERROR: 0:101: '' : array size must be a constant integer expression ERROR: 0:101: '' : array size must be a constant integer expression
ERROR: 0:107: '' : image variables not declared 'writeonly' must have a format layout qualifier ERROR: 0:107: 'image variables declared 'writeonly' without a format layout qualifier' : not supported for this version or the enabled extensions
ERROR: 0:114: 'imageAtomicMin' : only supported on image with format r32i or r32ui ERROR: 0:114: 'imageAtomicMin' : only supported on image with format r32i or r32ui
ERROR: 0:115: 'imageAtomicMax' : no matching overloaded function found ERROR: 0:115: 'imageAtomicMax' : no matching overloaded function found
ERROR: 0:119: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:119: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter
......
#version 450
#extension GL_EXT_shader_image_load_formatted : require
layout(binding = 0) uniform image1D i1D;
layout(binding = 1) uniform image2D i2D;
layout(binding = 2) uniform image3D i3D;
layout(binding = 3) uniform imageCube iCube;
layout(binding = 4) uniform imageCubeArray iCubeArray;
layout(binding = 5) uniform image2DRect i2DRect;
layout(binding = 6) uniform image1DArray i1DArray;
layout(binding = 7) uniform image2DArray i2DArray;
layout(binding = 8) uniform imageBuffer iBuffer;
layout(binding = 9) uniform image2DMS i2DMS;
layout(binding = 10) uniform image2DMSArray i2DMSArray;
flat in int ic1D;
flat in ivec2 ic2D;
flat in ivec3 ic3D;
flat in ivec4 ic4D;
writeonly layout(binding = 1) uniform image2D wo2D;
flat in uint value;
out vec4 fragData;
void main()
{
ivec3 iv = ivec3(0);
iv.x += imageSize(i1D);
iv.xy += imageSize(i2D);
iv.xyz += imageSize(i3D);
iv.xy += imageSize(iCube);
iv.xyz += imageSize(iCubeArray);
iv.xy += imageSize(i2DRect);
iv.xy += imageSize(i1DArray);
iv.xyz += imageSize(i2DArray);
iv.x += imageSize(iBuffer);
iv.xy += imageSize(i2DMS);
iv.xyz += imageSize(i2DMSArray);
iv.x += imageSamples(i2DMS);
iv.x += imageSamples(i2DMSArray);
vec4 v = vec4(0.0);
v += imageLoad(i1D, ic1D);
imageStore(i1D, ic1D, v);
v += imageLoad(i2D, ic2D);
imageStore(i2D, ic2D, v);
v += imageLoad(i3D, ic3D);
imageStore(i3D, ic3D, v);
v += imageLoad(iCube, ic3D);
imageStore(iCube, ic3D, v);
v += imageLoad(iCubeArray, ic3D);
imageStore(iCubeArray, ic3D, v);
v += imageLoad(i2DRect, ic2D);
imageStore(i2DRect, ic2D, v);
v += imageLoad(i1DArray, ic2D);
imageStore(i1DArray, ic2D, v);
v += imageLoad(i2DArray, ic3D);
imageStore(i2DArray, ic3D, v);
v += imageLoad(iBuffer, ic1D);
imageStore(iBuffer, ic1D, v);
v += imageLoad(i2DMS, ic2D, 1);
imageStore(i2DMS, ic2D, 2, v);
v += imageLoad(i2DMSArray, ic3D, 3);
imageStore(i2DMSArray, ic3D, 4, v);
imageStore(wo2D, ic2D, v);
fragData = v;
}
...@@ -4499,8 +4499,11 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) ...@@ -4499,8 +4499,11 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
} }
} }
} }
} else if (type.isImage() && ! qualifier.writeonly) } else if (type.isImage() && ! qualifier.writeonly) {
error(loc, "image variables not declared 'writeonly' must have a format layout qualifier", "", ""); const char *explanation = "image variables declared 'writeonly' without a format layout qualifier";
requireProfile(loc, ECoreProfile | ECompatibilityProfile, explanation);
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shader_image_load_formatted, explanation);
}
if (qualifier.layoutPushConstant && type.getBasicType() != EbtBlock) if (qualifier.layoutPushConstant && type.getBasicType() != EbtBlock)
error(loc, "can only be used with a block", "push_constant", ""); error(loc, "can only be used with a block", "push_constant", "");
......
...@@ -182,6 +182,7 @@ void TParseVersions::initializeExtensionBehavior() ...@@ -182,6 +182,7 @@ void TParseVersions::initializeExtensionBehavior()
// extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members // extensionBehavior[E_GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable; extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable;
extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable;
// #line and #include // #line and #include
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable; extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
...@@ -303,6 +304,7 @@ void TParseVersions::getPreamble(std::string& preamble) ...@@ -303,6 +304,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_sparse_texture_clamp 1\n" "#define GL_ARB_sparse_texture_clamp 1\n"
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members // "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
"#define GL_EXT_shader_non_constant_global_initializers 1\n" "#define GL_EXT_shader_non_constant_global_initializers 1\n"
"#define GL_EXT_shader_image_load_formatted 1\n"
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
"#define GL_AMD_shader_ballot 1\n" "#define GL_AMD_shader_ballot 1\n"
......
...@@ -130,6 +130,7 @@ const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture ...@@ -130,6 +130,7 @@ const char* const E_GL_ARB_sparse_texture_clamp = "GL_ARB_sparse_texture
// const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members // const char* const E_GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers"; const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers";
const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted";
// #line and #include // #line and #include
const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive"; const char* const E_GL_GOOGLE_cpp_style_line_directive = "GL_GOOGLE_cpp_style_line_directive";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment