static const char* const s_texBufExtString = "GL_EXT_texture_buffer";
-static inline void checkTextureTypeExtensions (const glu::ContextInfo& contextInfo, TextureType type)
+static inline void checkTextureTypeExtensions (const glu::ContextInfo& contextInfo, TextureType type, const RenderContext& renderContext)
{
- if (type == TEXTURETYPE_BUFFER && !contextInfo.isExtensionSupported(s_texBufExtString))
+ if (type == TEXTURETYPE_BUFFER && !contextInfo.isExtensionSupported(s_texBufExtString) && !glu::contextSupports(renderContext.getType(), glu::ApiType::es(3, 2)))
throw tcu::NotSupportedError("Test requires " + string(s_texBufExtString) + " extension");
}
-static inline string textureTypeExtensionShaderRequires (TextureType type)
+static inline string textureTypeExtensionShaderRequires (TextureType type, const RenderContext& renderContext)
{
- if (type == TEXTURETYPE_BUFFER)
+ if (!glu::contextSupports(renderContext.getType(), glu::ApiType::es(3, 2)) && (type == TEXTURETYPE_BUFFER))
return "#extension " + string(s_texBufExtString) + " : require\n";
else
return "";
}
+static const char* const s_imageAtomicExtString = "GL_OES_shader_image_atomic";
+
+static inline string imageAtomicExtensionShaderRequires (const RenderContext& renderContext)
+{
+ if (!glu::contextSupports(renderContext.getType(), glu::ApiType::es(3, 2)))
+ return "#extension " + string(s_imageAtomicExtString) + " : require\n";
+ else
+ return "";
+}
+
namespace
{
TestLog& log = glLog.getLog();
const tcu::ScopedLogSection section(log, "Verification", "Result verification (read texture layer-by-layer in compute shader with texture() into SSBO)");
+ const std::string glslVersionDeclaration = getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
"layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;\n"
"layout (binding = 0) buffer Output\n"
"{\n"
{
}
- void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_textureType); }
+ void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_textureType, m_context.getRenderContext()); }
IterateResult iterate (void);
private:
"(" + toString(imageSize.x()-1) + "-gx)^(" + toString(imageSize.y()-1) + "-gy)^gz)";
const string colorExpr = colorBaseExpr + (storeColorScale == 1.0f ? "" : "*" + toString(storeColorScale))
+ (storeColorBias == 0.0f ? "" : " + float(" + toString(storeColorBias) + ")");
+ const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
- + textureTypeExtensionShaderRequires(shaderImageType) +
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
+ + textureTypeExtensionShaderRequires(shaderImageType, renderCtx) +
"\n"
"precision highp " + shaderImageTypeStr + ";\n"
"\n"
DE_ASSERT(textureFormat.getPixelSize() == imageFormat.getPixelSize());
}
- void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_textureType); }
+ void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_textureType, m_context.getRenderContext()); }
IterateResult iterate (void);
private:
const string shaderImageFormatStr = getShaderImageFormatQualifier(m_imageFormat);
const TextureType shaderImageType = m_singleLayerBind ? textureLayerType(m_textureType) : m_textureType;
const string shaderImageTypeStr = getShaderImageType(m_imageFormat.type, shaderImageType);
+ const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
- + textureTypeExtensionShaderRequires(shaderImageType) +
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
+ + textureTypeExtensionShaderRequires(shaderImageType, renderCtx) +
"\n"
"precision highp " + shaderImageTypeStr + ";\n"
"\n"
void BinaryAtomicOperationCase::init (void)
{
- if (!m_context.getContextInfo().isExtensionSupported("GL_OES_shader_image_atomic"))
+ if (!m_context.getContextInfo().isExtensionSupported("GL_OES_shader_image_atomic") && !glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
throw tcu::NotSupportedError("Test requires OES_shader_image_atomic extension");
- checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType);
+ checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType, m_context.getRenderContext());
}
BinaryAtomicOperationCase::IterateResult BinaryAtomicOperationCase::iterate (void)
const string atomicInvocation = string() + getAtomicOperationShaderFuncName(m_operation) + "(u_results, " + atomicCoord + ", " + atomicArgExpr + ")";
const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
+ const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
- "#extension GL_OES_shader_image_atomic : require\n"
- + textureTypeExtensionShaderRequires(m_imageType) +
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
+ + imageAtomicExtensionShaderRequires(renderCtx)
+ + textureTypeExtensionShaderRequires(m_imageType, renderCtx) +
"\n"
"precision highp " + shaderImageTypeStr + ";\n"
"\n"
void AtomicCompSwapCase::init (void)
{
- if (!m_context.getContextInfo().isExtensionSupported("GL_OES_shader_image_atomic"))
+ if (!m_context.getContextInfo().isExtensionSupported("GL_OES_shader_image_atomic") && !glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
throw tcu::NotSupportedError("Test requires OES_shader_image_atomic extension");
- checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType);
+ checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType, m_context.getRenderContext());
}
class AtomicCompSwapCase::EndResultVerifier : public ImageLayerVerifier
: "ivec3(gx, gy, gz)";
const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
+ const string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
- "#extension GL_OES_shader_image_atomic : require\n"
- + textureTypeExtensionShaderRequires(m_imageType) +
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
+ + imageAtomicExtensionShaderRequires(renderCtx)
+ + textureTypeExtensionShaderRequires(m_imageType, renderCtx) +
"\n"
"precision highp " + shaderImageTypeStr + ";\n"
"\n"
m_format == TextureFormat(TextureFormat::R, TextureFormat::FLOAT));
}
- void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType); }
+ void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType, m_context.getRenderContext()); }
IterateResult iterate (void);
private:
const string localSizeX = de::toString(localSize.x());
const string localSizeY = de::toString(localSize.y());
const string localSizeZ = de::toString(localSize.z());
+ const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
+
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
- + textureTypeExtensionShaderRequires(m_imageType) +
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
+ + textureTypeExtensionShaderRequires(m_imageType, renderCtx) +
"\n"
"precision highp " + shaderImageTypeStr + ";\n"
"\n"
{
}
- void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType); }
+ void init (void) { checkTextureTypeExtensions(m_context.getContextInfo(), m_imageType, m_context.getRenderContext()); }
IterateResult iterate (void);
private:
: DE_NULL;
const string shaderImageFormatStr = getShaderImageFormatQualifier(m_format);
const string shaderImageTypeStr = getShaderImageType(m_format.type, m_imageType);
+ const string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::ComputeSource("#version 310 es\n"
- + textureTypeExtensionShaderRequires(m_imageType) +
+ glu::ProgramSources() << glu::ComputeSource(glslVersionDeclaration + "\n"
+ + textureTypeExtensionShaderRequires(m_imageType, renderCtx) +
"\n"
"precision highp " + shaderImageTypeStr + ";\n"
"precision highp uimage2D;\n"
if (m_context.getContextInfo().getInt(GL_MAX_FRAGMENT_IMAGE_UNIFORMS) == 0)
throw tcu::NotSupportedError("GL_MAX_FRAGMENT_IMAGE_UNIFORMS is zero");
- if (!m_context.getContextInfo().isExtensionSupported("GL_OES_shader_image_atomic"))
+ if (!m_context.getContextInfo().isExtensionSupported("GL_OES_shader_image_atomic") && !glu::contextSupports(m_context.getRenderContext().getType(), glu::ApiType::es(3, 2)))
throw tcu::NotSupportedError("Test requires OES_shader_image_atomic extension");
if (m_type == TESTTYPE_DEPTH &&
// Perform image stores in fragment shader.
{
+ const std::string glslVersionDeclaration = glu::getGLSLVersionDeclaration(glu::getContextTypeGLSLVersion(renderCtx.getType()));
+
// Generate fragment shader.
const glu::ShaderProgram program(renderCtx,
- glu::ProgramSources() << glu::VertexSource( "#version 310 es\n"
+ glu::ProgramSources() << glu::VertexSource( glslVersionDeclaration + "\n"
"\n"
"highp in vec3 a_position;\n"
"\n"
" gl_Position = vec4(a_position, 1.0);\n"
"}\n")
- << glu::FragmentSource( "#version 310 es\n"
- "#extension GL_OES_shader_image_atomic : require\n"
+ << glu::FragmentSource( glslVersionDeclaration + "\n"
+ + imageAtomicExtensionShaderRequires(renderCtx) +
"\n"
+ string(m_useEarlyTests ? "layout (early_fragment_tests) in;\n\n" : "") +
"layout (location = 0) out highp vec4 o_color;\n"