mSupportedInternalFormats.push_back(GL_DEPTH_COMPONENT16);
FunctionToken f;
- f = FunctionToken("sparseTextureARB", "");
+ f = FunctionToken("sparseTextureARB", "<CUBE_REFZ_DEF>");
f.allowedTargets.insert(GL_TEXTURE_2D);
f.allowedTargets.insert(GL_TEXTURE_2D_ARRAY);
f.allowedTargets.insert(GL_TEXTURE_CUBE_MAP);
if ((target == GL_TEXTURE_CUBE_MAP || target == GL_TEXTURE_CUBE_MAP_ARRAY) &&
funcName.find("Fetch", 0) == std::string::npos)
{
- s.cubeMapCoordDef = " if (point.z == 0) coord.xyz = vec3(1, coord.y * 2 - 1, -coord.x * 2 + 1);\n"
- " if (point.z == 1) coord.xyz = vec3(-1, coord.y * 2 - 1, coord.x * 2 - 1);\n"
- " if (point.z == 2) coord.xyz = vec3(coord.x * 2 - 1, 1, coord.y * 2 - 1);\n"
- " if (point.z == 3) coord.xyz = vec3(coord.x * 2 - 1, -1, -coord.y * 2 + 1);\n"
- " if (point.z == 4) coord.xyz = vec3(coord.x * 2 - 1, coord.y * 2 - 1, 1);\n"
- " if (point.z == 5) coord.xyz = vec3(-coord.x * 2 + 1, coord.y * 2 - 1, -1);\n";
+ s.cubeMapCoordDef = " int face = point.z % 6;\n"
+ " if (face == 0) coord.xyz = vec3(1, coord.y * 2 - 1, -coord.x * 2 + 1);\n"
+ " if (face == 1) coord.xyz = vec3(-1, coord.y * 2 - 1, coord.x * 2 - 1);\n"
+ " if (face == 2) coord.xyz = vec3(coord.x * 2 - 1, 1, coord.y * 2 - 1);\n"
+ " if (face == 3) coord.xyz = vec3(coord.x * 2 - 1, -1, -coord.y * 2 + 1);\n"
+ " if (face == 4) coord.xyz = vec3(coord.x * 2 - 1, coord.y * 2 - 1, 1);\n"
+ " if (face == 5) coord.xyz = vec3(-coord.x * 2 + 1, coord.y * 2 - 1, -1);\n";
}
if (s.coordDef.empty())
s.coordDef += s.refZDef;
}
else
- funcToken.arguments += s.refZDef;
+ s.cubeMapArrayRefZDef = s.refZDef;
s.componentDef = ".r";
}
replaceToken("<EPSILON>", s.epsilon.c_str(), shader);
replaceToken("<SAMPLE_DEF>", s.sampleDef.c_str(), shader);
replaceToken("<REFZ_DEF>", s.refZDef.c_str(), shader);
+ replaceToken("<CUBE_REFZ_DEF>", s.cubeMapArrayRefZDef.c_str(), shader);
replaceToken("<POINT_COORD>", s.pointCoord.c_str(), shader);
replaceToken("<COMPONENT_DEF>", s.componentDef.c_str(), shader);
replaceToken("<CUBE_MAP_COORD_DEF>", s.cubeMapCoordDef.c_str(), shader);
mSupportedInternalFormats.push_back(GL_DEPTH_COMPONENT16);
FunctionToken f;
- f = FunctionToken("sparseTextureClampARB", ", <LOD>");
+ f = FunctionToken("sparseTextureClampARB", "<CUBE_REFZ_DEF>, <LOD>");
f.allowedTargets.insert(GL_TEXTURE_2D);
f.allowedTargets.insert(GL_TEXTURE_2D_ARRAY);
f.allowedTargets.insert(GL_TEXTURE_CUBE_MAP);
if (format == GL_DEPTH_COMPONENT16)
{
- if (target == GL_TEXTURE_CUBE_MAP_ARRAY && funcToken.name == "sparseTextureGradClampARB")
+ if (target == GL_TEXTURE_CUBE_MAP_ARRAY &&
+ (funcToken.name == "sparseTextureGradClampARB" || funcToken.name == "textureGradClampARB"))
return false;
}
replaceToken("<EPSILON>", s.epsilon.c_str(), fragment);
replaceToken("<SAMPLE_DEF>", s.sampleDef.c_str(), fragment);
replaceToken("<REFZ_DEF>", s.refZDef.c_str(), fragment);
+ replaceToken("<CUBE_REFZ_DEF>", s.cubeMapArrayRefZDef.c_str(), fragment);
replaceToken("<POINT_COORD>", s.pointCoord.c_str(), fragment);
replaceToken("<COMPONENT_DEF>", s.componentDef.c_str(), fragment);
replaceToken("<CUBE_MAP_COORD_DEF>", s.cubeMapCoordDef.c_str(), fragment);
floatCoord = glu::va::Float("inCoord", 3, 4, 0, texCoord3D);
else if (target == GL_TEXTURE_CUBE_MAP)
floatCoord = glu::va::Float("inCoord", 3, 4, 0, texCoordCubeMap[layer]);
+ else if (target == GL_TEXTURE_CUBE_MAP_ARRAY)
+ {
+ GLfloat layerCoord = GLfloat(layer) / 6.0f + 0.01f;
+ const GLfloat texCoordCubeMapArray[16] = { 0.0f, 0.0f, layerCoord, GLfloat(layer),
+ 1.0f, 0.0f, layerCoord, GLfloat(layer),
+ 0.0f, 1.0f, layerCoord, GLfloat(layer),
+ 1.0f, 1.0f, layerCoord, GLfloat(layer) };
+ floatCoord = glu::va::Float("inCoord", 4, 4, 0, texCoordCubeMapArray);
+ }
else
floatCoord = glu::va::Float("inCoord", 2, 4, 0, texCoord2D);
mSupportedInternalFormats.push_back(GL_DEPTH_COMPONENT16);
FunctionToken f;
- f = FunctionToken("sparseTextureClampARB", ", <LOD>");
+ f = FunctionToken("sparseTextureClampARB", "<CUBE_REFZ_DEF>, <LOD>");
f.allowedTargets.insert(GL_TEXTURE_2D);
f.allowedTargets.insert(GL_TEXTURE_2D_ARRAY);
f.allowedTargets.insert(GL_TEXTURE_CUBE_MAP);
f.allowedTargets.insert(GL_TEXTURE_3D);
mFunctions.push_back(f);
- f = FunctionToken("textureClampARB", ", <LOD>");
+ f = FunctionToken("textureClampARB", "<CUBE_REFZ_DEF>, <LOD>");
f.allowedTargets.insert(GL_TEXTURE_1D);
f.allowedTargets.insert(GL_TEXTURE_1D_ARRAY);
f.allowedTargets.insert(GL_TEXTURE_2D);
replaceToken("<EPSILON>", s.epsilon.c_str(), fragment);
replaceToken("<SAMPLE_DEF>", s.sampleDef.c_str(), fragment);
replaceToken("<REFZ_DEF>", s.refZDef.c_str(), fragment);
+ replaceToken("<CUBE_REFZ_DEF>", s.cubeMapArrayRefZDef.c_str(), fragment);
replaceToken("<POINT_COORD>", s.pointCoord.c_str(), fragment);
replaceToken("<COMPONENT_DEF>", s.componentDef.c_str(), fragment);
replaceToken("<CUBE_MAP_COORD_DEF>", s.cubeMapCoordDef.c_str(), fragment);