Commit 79ca4e02 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Load texture coordinates even if no texture is bound to that stage at this time.

parent cde60c0b
......@@ -1825,46 +1825,41 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, WineDirect3DVertex
unsigned int mapped_stage = 0;
unsigned int textureNo = 0;
/* The code below uses glClientActiveTexture and glMultiTexCoord* which are all part of the GL_ARB_multitexture extension. */
/* Abort if we don't support the extension. */
if (!GL_SUPPORT(ARB_MULTITEXTURE)) {
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
return;
}
for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
/* The code below uses glClientActiveTexture and glMultiTexCoord* which are all part of the GL_ARB_multitexture extension. */
/* Abort if we don't support the extension. */
if (!GL_SUPPORT(ARB_MULTITEXTURE)) {
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
continue;
}
int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
if (stateblock->textures[textureNo]) {
int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
mapped_stage = stateblock->wineD3DDevice->texUnitMap[textureNo];
if (mapped_stage == -1) continue;
if (coordIdx < MAX_TEXTURES && (sd->u.s.texCoords[coordIdx].lpData || sd->u.s.texCoords[coordIdx].VBO)) {
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
textureNo, mapped_stage, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
if (*curVBO != sd->u.s.texCoords[coordIdx].VBO) {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.texCoords[coordIdx].VBO));
checkGLcall("glBindBufferARB");
*curVBO = sd->u.s.texCoords[coordIdx].VBO;
}
mapped_stage = stateblock->wineD3DDevice->texUnitMap[textureNo];
/* The gl texture unit will never be -1 for a bound texture */
GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
checkGLcall("glClientActiveTextureARB");
if (coordIdx >= MAX_TEXTURES) {
VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
} else if (sd->u.s.texCoords[coordIdx].lpData == NULL && sd->u.s.texCoords[coordIdx].VBO == 0) {
VTRACE(("Bound texture but no texture coordinates supplied, so skipping\n"));
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
} else {
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
textureNo, mapped_stage, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
if (*curVBO != sd->u.s.texCoords[coordIdx].VBO) {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, sd->u.s.texCoords[coordIdx].VBO));
checkGLcall("glBindBufferARB");
*curVBO = sd->u.s.texCoords[coordIdx].VBO;
}
/* The coords to supply depend completely on the fvf / vertex shader */
glTexCoordPointer(
WINED3D_ATR_SIZE(sd->u.s.texCoords[coordIdx].dwType),
WINED3D_ATR_GLTYPE(sd->u.s.texCoords[coordIdx].dwType),
sd->u.s.texCoords[coordIdx].dwStride,
sd->u.s.texCoords[coordIdx].lpData + stateblock->loadBaseVertexIndex * sd->u.s.texCoords[coordIdx].dwStride + offset[sd->u.s.texCoords[coordIdx].streamNo]);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
} else if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1));
/* The coords to supply depend completely on the fvf / vertex shader */
glTexCoordPointer(
WINED3D_ATR_SIZE(sd->u.s.texCoords[coordIdx].dwType),
WINED3D_ATR_GLTYPE(sd->u.s.texCoords[coordIdx].dwType),
sd->u.s.texCoords[coordIdx].dwStride,
sd->u.s.texCoords[coordIdx].lpData + stateblock->loadBaseVertexIndex * sd->u.s.texCoords[coordIdx].dwStride + offset[sd->u.s.texCoords[coordIdx].streamNo]);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
} else {
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
}
}
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
......
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