ivec4 still needed as texture index on some SONY VAIO and Toshiba ATI drivers.
This reverts commit b8b235df09.
This commit is contained in:
@@ -679,7 +679,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
|
||||
vec4 diffuseLookup(vec2 texcoord)
|
||||
{
|
||||
switch (vary_texture_index))
|
||||
switch (vary_texture_index.r))
|
||||
{
|
||||
case 0: ret = texture2D(tex0, texcoord); break;
|
||||
case 1: ret = texture2D(tex1, texcoord); break;
|
||||
@@ -703,7 +703,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
|
||||
if (texture_index_channels > 1)
|
||||
{
|
||||
text[count++] = strdup("VARYING_FLAT int vary_texture_index;\n");
|
||||
text[count++] = strdup("VARYING_FLAT ivec4 vary_texture_index;\n");
|
||||
}
|
||||
|
||||
text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
|
||||
@@ -721,7 +721,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
{ //switches are unreliable on old drivers
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string if_string = llformat("\t%sif (vary_texture_index == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
|
||||
std::string if_string = llformat("\t%sif (vary_texture_index.r == %d) { return texture2D(tex%d, texcoord); }\n", i > 0 ? "else " : "", i, i);
|
||||
text[count++] = strdup(if_string.c_str());
|
||||
}
|
||||
text[count++] = strdup("\treturn vec4(1,0,1,1);\n");
|
||||
@@ -730,13 +730,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
||||
else
|
||||
{
|
||||
text[count++] = strdup("\tvec4 ret = vec4(1,0,1,1);\n");
|
||||
text[count++] = strdup("\tswitch (vary_texture_index)\n");
|
||||
text[count++] = strdup("\tswitch (vary_texture_index.r)\n");
|
||||
text[count++] = strdup("\t{\n");
|
||||
|
||||
//switch body
|
||||
for (S32 i = 0; i < texture_index_channels; ++i)
|
||||
{
|
||||
std::string case_str = llformat("\t\tcase %d: return texture2D(tex%d, texcoord);\n", i, i);
|
||||
std::string case_str = llformat("\t\tcase %d: ret = texture2D(tex%d, texcoord); break;\n", i, i);
|
||||
text[count++] = strdup(case_str.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -1249,7 +1249,7 @@ void LLVertexBuffer::setupVertexArray()
|
||||
1, //TYPE_WEIGHT,
|
||||
4, //TYPE_WEIGHT4,
|
||||
4, //TYPE_CLOTHWEIGHT,
|
||||
1, //TYPE_TEXTURE_INDEX
|
||||
4, //TYPE_TEXTURE_INDEX
|
||||
};
|
||||
|
||||
U32 attrib_type[] =
|
||||
@@ -1266,7 +1266,7 @@ void LLVertexBuffer::setupVertexArray()
|
||||
GL_FLOAT, //TYPE_WEIGHT,
|
||||
GL_FLOAT, //TYPE_WEIGHT4,
|
||||
GL_FLOAT, //TYPE_CLOTHWEIGHT,
|
||||
GL_UNSIGNED_INT, //TYPE_TEXTURE_INDEX
|
||||
GL_UNSIGNED_BYTE, //TYPE_TEXTURE_INDEX
|
||||
};
|
||||
|
||||
bool attrib_integer[] =
|
||||
@@ -2313,7 +2313,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
||||
#if !LL_DARWIN
|
||||
S32 loc = TYPE_TEXTURE_INDEX;
|
||||
void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12);
|
||||
glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
glVertexAttribIPointer(loc, 4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
#endif
|
||||
}
|
||||
if (data_mask & MAP_VERTEX)
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
ATTRIBUTE int texture_index;
|
||||
ATTRIBUTE ivec4 texture_index;
|
||||
|
||||
VARYING_FLAT int vary_texture_index;
|
||||
VARYING_FLAT ivec4 vary_texture_index;
|
||||
|
||||
void passTextureIndex()
|
||||
{
|
||||
|
||||
@@ -1635,8 +1635,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
if (!do_xform)
|
||||
{
|
||||
LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM);
|
||||
S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF;
|
||||
LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, tc_size);
|
||||
LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1857,12 +1856,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
||||
|
||||
LLVector4a texIdx;
|
||||
|
||||
S32 index = mTextureIndex < 255 ? mTextureIndex : 0;
|
||||
U8 index = mTextureIndex < 255 ? mTextureIndex : 0;
|
||||
|
||||
F32 val = 0.f;
|
||||
S32* vp = (S32*) &val;
|
||||
*vp = index;
|
||||
|
||||
U8* vp = (U8*) &val;
|
||||
vp[0] = index;
|
||||
vp[1] = 0;
|
||||
vp[2] = 0;
|
||||
vp[3] = 0;
|
||||
|
||||
llassert(index <= LLGLSLShader::sIndexedTextureChannels-1);
|
||||
|
||||
LLVector4Logical mask;
|
||||
|
||||
Reference in New Issue
Block a user