wined3d: Load texture coordinates even if no texture is bound to that stage at this time.
This commit is contained in:
parent
cde60c0b94
commit
79ca4e022d
|
@ -1825,46 +1825,41 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, WineDirect3DVertex
|
||||||
unsigned int mapped_stage = 0;
|
unsigned int mapped_stage = 0;
|
||||||
unsigned int textureNo = 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) {
|
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. */
|
int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stateblock->textures[textureNo]) {
|
mapped_stage = stateblock->wineD3DDevice->texUnitMap[textureNo];
|
||||||
int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
|
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));
|
GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
||||||
checkGLcall("glClientActiveTextureARB");
|
checkGLcall("glClientActiveTextureARB");
|
||||||
|
|
||||||
if (coordIdx >= MAX_TEXTURES) {
|
/* The coords to supply depend completely on the fvf / vertex shader */
|
||||||
VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
|
glTexCoordPointer(
|
||||||
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
WINED3D_ATR_SIZE(sd->u.s.texCoords[coordIdx].dwType),
|
||||||
} else if (sd->u.s.texCoords[coordIdx].lpData == NULL && sd->u.s.texCoords[coordIdx].VBO == 0) {
|
WINED3D_ATR_GLTYPE(sd->u.s.texCoords[coordIdx].dwType),
|
||||||
VTRACE(("Bound texture but no texture coordinates supplied, so skipping\n"));
|
sd->u.s.texCoords[coordIdx].dwStride,
|
||||||
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
sd->u.s.texCoords[coordIdx].lpData + stateblock->loadBaseVertexIndex * sd->u.s.texCoords[coordIdx].dwStride + offset[sd->u.s.texCoords[coordIdx].streamNo]);
|
||||||
} else {
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
TRACE("Setting up texture %u, idx %d, cordindx %u, data %p\n",
|
} else {
|
||||||
textureNo, mapped_stage, coordIdx, sd->u.s.texCoords[coordIdx].lpData);
|
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
|
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
|
||||||
|
|
Loading…
Reference in New Issue