* @return target Structure of token strings
*/
SparseTexture2CommitmentTestCase::TokenStrings SparseTexture2CommitmentTestCase::createShaderTokens(
- GLint target, GLint format, GLint sample, const std::string outputBase, const std::string inputBase)
+ GLint target, GLint verifyTarget, GLint format, GLint sample, const std::string outputBase, const std::string inputBase)
{
TokenStrings s;
std::string prefix;
if (target == GL_TEXTURE_1D)
{
- s.outputType = "u" + outputBase + "2D";
s.inputType = prefix + inputBase + "1D";
s.pointType = "int";
s.pointDef = "gl_WorkGroupID.x";
}
else if (target == GL_TEXTURE_1D_ARRAY)
{
- s.outputType = "u" + outputBase + "2D_ARRAY";
s.inputType = prefix + inputBase + "1DArray";
s.pointType = "ivec2";
s.pointDef = "gl_WorkGroupID.x, gl_WorkGroupID.z";
}
else if (target == GL_TEXTURE_2D_ARRAY)
{
- s.outputType = "u" + outputBase + "2DArray";
s.inputType = prefix + inputBase + "2DArray";
s.pointType = "ivec3";
s.pointDef = "gl_WorkGroupID.x, gl_WorkGroupID.y, gl_WorkGroupID.z";
}
else if (target == GL_TEXTURE_CUBE_MAP)
{
- s.outputType = "u" + outputBase + "2DArray";
s.inputType = prefix + inputBase + "Cube";
s.pointType = "ivec3";
s.pointDef = "gl_WorkGroupID.x, gl_WorkGroupID.y, gl_WorkGroupID.z % 6";
}
else if (target == GL_TEXTURE_CUBE_MAP_ARRAY)
{
- s.outputType = "u" + outputBase + "2DArray";
s.inputType = prefix + inputBase + "CubeArray";
s.pointType = "ivec3";
s.pointDef = "gl_WorkGroupID.x, gl_WorkGroupID.y, gl_WorkGroupID.z";
}
else if (target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
{
- s.outputType = "u" + outputBase + "2DArray";
s.inputType = prefix + inputBase + "2DMSArray";
s.pointType = "ivec3";
s.pointDef = "gl_WorkGroupID.x, gl_WorkGroupID.y, gl_WorkGroupID.z";
s.sampleDef = ", " + de::toString(sample);
}
+ if (verifyTarget == GL_TEXTURE_2D)
+ {
+ s.outputType = "u" + outputBase + "2D";
+ }
+ else
+ {
+ s.outputType = "u" + outputBase + "2DArray";
+ }
return s;
}
std::string shader = st2_compute_textureFill;
// Adjust shader source to texture format
- TokenStrings s = createShaderTokens(target, format, sample);
+ GLint verifyTarget;
+ if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
+ verifyTarget = GL_TEXTURE_2D;
+ else
+ verifyTarget = GL_TEXTURE_2D_ARRAY;
+ TokenStrings s = createShaderTokens(target, verifyTarget, format, sample);
replaceToken("<INPUT_TYPE>", s.inputType.c_str(), shader);
replaceToken("<POINT_TYPE>", s.pointType.c_str(), shader);
// Create verifying texture
GLint verifyTarget;
- if (target == GL_TEXTURE_2D_MULTISAMPLE)
+ if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
verifyTarget = GL_TEXTURE_2D;
else
verifyTarget = GL_TEXTURE_2D_ARRAY;
std::string shader = st2_compute_textureVerify;
// Adjust shader source to texture format
- TokenStrings s = createShaderTokens(target, format, sample);
+ TokenStrings s = createShaderTokens(target, verifyTarget, format, sample);
replaceToken("<OUTPUT_TYPE>", s.outputType.c_str(), shader);
replaceToken("<FORMAT>", s.format.c_str(), shader);
{
// Create verifying texture
GLint verifyTarget;
- if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D)
+ if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
verifyTarget = GL_TEXTURE_2D;
else
verifyTarget = GL_TEXTURE_2D_ARRAY;
if (target == GL_TEXTURE_CUBE_MAP)
depth = depth * 6;
+ if (depth == 1 && mState.samples == 1)
+ target = GL_TEXTURE_2D;
GLint texSize = width * height * depth;
std::string shader = st2_compute_textureVerify;
// Adjust shader source to texture format
- TokenStrings s = createShaderTokens(target, format, sample);
+ TokenStrings s = createShaderTokens(target, verifyTarget, format, sample);
replaceToken("<OUTPUT_TYPE>", s.outputType.c_str(), shader);
replaceToken("<FORMAT>", s.format.c_str(), shader);
gl.bindImageTexture(0, //unit
verifyTexture,
0, //level
- GL_FALSE, //layered
+ depth > 1, //layered
0, //layer
GL_WRITE_ONLY, GL_R8UI);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindImageTexture");
gl.bindImageTexture(1, //unit
texture,
level, //level
- GL_FALSE, //layered
+ depth > 1, //layered
0, //layer
GL_READ_ONLY, format);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindImageTexture");
// Create verifying texture
GLint verifyTarget;
- if (target == GL_TEXTURE_2D_MULTISAMPLE)
+ if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
verifyTarget = GL_TEXTURE_2D;
else
verifyTarget = GL_TEXTURE_2D_ARRAY;
+ if (target == GL_TEXTURE_CUBE_MAP)
+ depth = depth * 6;
+ if (depth == 1 && mState.samples == 1)
+ target = GL_TEXTURE_2D;
GLint texSize = width * height * depth;
std::string shader = st2_compute_atomicVerify;
// Adjust shader source to texture format
- TokenStrings s = createShaderTokens(target, format, sample);
+ TokenStrings s = createShaderTokens(target, verifyTarget, format, sample);
std::string dataType = (s.returnType == "ivec4" ? "int" : "uint");
replaceToken("<OUTPUT_TYPE>", s.outputType.c_str(), shader);
gl.bindImageTexture(0, //unit
verifyTexture,
0, //level
- GL_FALSE, //layered
+ depth > 1, //layered
0, //layer
GL_WRITE_ONLY, GL_R8UI);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindImageTexture");
gl.bindImageTexture(1, //unit
texture,
level, //level
- GL_FALSE, //layered
+ depth > 1, //layered
0, //layer
GL_READ_ONLY, format);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindImageTexture");
* @return Returns extended token strings structure.
*/
SparseTexture2LookupTestCase::TokenStringsExt SparseTexture2LookupTestCase::createLookupShaderTokens(
- GLint target, GLint format, GLint level, GLint sample, FunctionToken& funcToken)
+ GLint target, GLint verifyTarget, GLint format, GLint level, GLint sample, FunctionToken& funcToken)
{
std::string funcName = funcToken.name;
inputType = "sampler";
// Copy data from TokenStrings to TokenStringsExt
- TokenStrings ss = createShaderTokens(target, format, sample, "image", inputType);
+ TokenStrings ss = createShaderTokens(target, verifyTarget, format, sample, "image", inputType);
s.epsilon = ss.epsilon;
s.format = ss.format;
s.inputType = ss.inputType;
std::string shader = st2_compute_textureFill;
// Adjust shader source to texture format
- TokenStrings s = createShaderTokens(target, format, sample);
+ GLint verifyTarget;
+ if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
+ verifyTarget = GL_TEXTURE_2D;
+ else
+ verifyTarget = GL_TEXTURE_2D_ARRAY;
+ TokenStrings s = createShaderTokens(target, verifyTarget, format, sample);
replaceToken("<INPUT_TYPE>", s.inputType.c_str(), shader);
replaceToken("<POINT_TYPE>", s.pointType.c_str(), shader);
{
gl.useProgram(program.getProgram());
GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram");
- gl.bindImageTexture(0 /* unit */, texture, level /* level */, GL_FALSE /* layered */, 0 /* layer */,
+ gl.bindImageTexture(0 /* unit */, texture, level /* level */, depth > 1 /* layered */, 0 /* layer */,
GL_WRITE_ONLY, convFormat);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindImageTexture");
gl.uniform1i(1, 0 /* image_unit */);
// Create verifying texture
GLint verifyTarget;
- if (target == GL_TEXTURE_2D_MULTISAMPLE)
+ if (target == GL_TEXTURE_2D_MULTISAMPLE || target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE)
verifyTarget = GL_TEXTURE_2D;
else
verifyTarget = GL_TEXTURE_2D_ARRAY;
std::string shader = st2_compute_lookupVerify;
// Adjust shader source to texture format
- TokenStringsExt s = createLookupShaderTokens(target, format, level, sample, f);
+ TokenStringsExt s = createLookupShaderTokens(target, verifyTarget, format, level, sample, f);
replaceToken("<FUNCTION>", f.name.c_str(), shader);
replaceToken("<ARGUMENTS>", f.arguments.c_str(), shader);