| Index: ddraw/TextureManager.c |
| — | — | @@ -144,6 +144,7 @@ |
| 145 | 145 | int i;
|
| 146 | 146 | int x, y;
|
| 147 | 147 | GLenum error;
|
| | 148 | + if (!texture->miplevel) texture->miplevel = 1;
|
| 148 | 149 | texture->pixelformat.dwSize = sizeof(DDPIXELFORMAT);
|
| 149 | 150 | for(i = 0; i < numtexformats; i++)
|
| 150 | 151 | {
|
| — | — | @@ -572,7 +573,7 @@ |
| 573 | 574 | }
|
| 574 | 575 | }
|
| 575 | 576 |
|
| 576 | | -BOOL TextureManager_FixTexture(TextureManager *This, TEXTURE *texture, void *data, DWORD *dirty)
|
| | 577 | +BOOL TextureManager_FixTexture(TextureManager *This, TEXTURE *texture, void *data, DWORD *dirty, GLint level)
|
| 577 | 578 | {
|
| 578 | 579 | // data should be null to create uninitialized texture or be pointer to top-level
|
| 579 | 580 | // buffer to retain texture data
|
| — | — | @@ -579,7 +580,6 @@ |
| 580 | 581 | TEXTURE newtexture;
|
| 581 | 582 | GLenum error;
|
| 582 | 583 | memcpy(&newtexture, texture, sizeof(TEXTURE));
|
| 583 | | - if (texture->miplevel > 0) return FALSE;
|
| 584 | 584 | if (texture->internalformats[1] == 0) return FALSE;
|
| 585 | 585 | glGenTextures(1, &newtexture.id);
|
| 586 | 586 | TextureManager_SetActiveTexture(This, 0);
|
| — | — | @@ -586,7 +586,7 @@ |
| 587 | 587 | if (data)
|
| 588 | 588 | {
|
| 589 | 589 | TextureManager_SetTexture(This, 0, texture);
|
| 590 | | - glGetTexImage(GL_TEXTURE_2D, 0, texture->format, texture->type, data);
|
| | 590 | + glGetTexImage(GL_TEXTURE_2D, level, texture->format, texture->type, data);
|
| 591 | 591 | if (dirty) *dirty |= 2;
|
| 592 | 592 | }
|
| 593 | 593 | TextureManager_SetTexture(This, 0, &newtexture);
|
| — | — | @@ -595,7 +595,7 @@ |
| 596 | 596 | memmove(&newtexture.internalformats[0], &newtexture.internalformats[1], 7 * sizeof(GLint));
|
| 597 | 597 | newtexture.internalformats[7] = 0;
|
| 598 | 598 | ClearError();
|
| 599 | | - glTexImage2D(GL_TEXTURE_2D, 0, newtexture.internalformats[0], newtexture.width, newtexture.height,
|
| | 599 | + glTexImage2D(GL_TEXTURE_2D, level, newtexture.internalformats[0], newtexture.width, newtexture.height,
|
| 600 | 600 | 0, newtexture.format, newtexture.type, data);
|
| 601 | 601 | error = glGetError();
|
| 602 | 602 | if (error != GL_NO_ERROR)
|
| Index: ddraw/TextureManager.h |
| — | — | @@ -89,7 +89,7 @@ |
| 90 | 90 | void TextureManager_DeleteTexture(TextureManager *This, TEXTURE *texture);
|
| 91 | 91 | void TextureManager_UploadTextureClassic(TextureManager *This, TEXTURE *texture, int level, const void *data, int width, int height, BOOL checkerror);
|
| 92 | 92 | void TextureManager_DownloadTextureClassic(TextureManager *This, TEXTURE *texture, int level, void *data);
|
| 93 | | -BOOL TextureManager_FixTexture(TextureManager *This, TEXTURE *texture, void *data, DWORD *dirty);
|
| | 93 | +BOOL TextureManager_FixTexture(TextureManager *This, TEXTURE *texture, void *data, DWORD *dirty, GLint level);
|
| 94 | 94 |
|
| 95 | 95 | #ifdef __cplusplus
|
| 96 | 96 | }
|
| Index: ddraw/glRenderer.cpp |
| — | — | @@ -1198,7 +1198,7 @@ |
| 1199 | 1199 | {
|
| 1200 | 1200 | if (This->util->SetFBO(dest) == GL_FRAMEBUFFER_COMPLETE) break;
|
| 1201 | 1201 | if (!dest->texture->internalformats[1]) break;
|
| 1202 | | - TextureManager_FixTexture(This->texman, dest->texture, (dest->bigbuffer ? dest->bigbuffer : dest->buffer), &dest->dirty);
|
| | 1202 | + TextureManager_FixTexture(This->texman, dest->texture, (dest->bigbuffer ? dest->bigbuffer : dest->buffer), &dest->dirty, dest->miplevel);
|
| 1203 | 1203 | This->util->SetFBO((FBO*)NULL);
|
| 1204 | 1204 | dest->fbo.fbcolor = NULL;
|
| 1205 | 1205 | dest->fbo.fbz = NULL;
|
| — | — | @@ -1623,7 +1623,7 @@ |
| 1624 | 1624 | {
|
| 1625 | 1625 | if (This->util->SetFBO(target) == GL_FRAMEBUFFER_COMPLETE) break;
|
| 1626 | 1626 | if (!target->texture->internalformats[1]) break;
|
| 1627 | | - TextureManager_FixTexture(This->texman, target->texture, (target->bigbuffer ? target->bigbuffer : target->buffer), &target->dirty);
|
| | 1627 | + TextureManager_FixTexture(This->texman, target->texture, (target->bigbuffer ? target->bigbuffer : target->buffer), &target->dirty, target->miplevel);
|
| 1628 | 1628 | This->util->SetFBO((FBO*)NULL);
|
| 1629 | 1629 | target->fbo.fbcolor = NULL;
|
| 1630 | 1630 | target->fbo.fbz = NULL;
|
| — | — | @@ -2003,7 +2003,7 @@ |
| 2004 | 2004 | if (This->util->SetFBO(device->glDDS7) == GL_FRAMEBUFFER_COMPLETE) break;
|
| 2005 | 2005 | if (!device->glDDS7->texture->internalformats[1]) break;
|
| 2006 | 2006 | TextureManager_FixTexture(This->texman, device->glDDS7->texture,
|
| 2007 | | - (device->glDDS7->bigbuffer ? device->glDDS7->bigbuffer : device->glDDS7->buffer), &device->glDDS7->dirty);
|
| | 2007 | + (device->glDDS7->bigbuffer ? device->glDDS7->bigbuffer : device->glDDS7->buffer), &device->glDDS7->dirty, device->glDDS7->miplevel);
|
| 2008 | 2008 | This->util->SetFBO((FBO*)NULL);
|
| 2009 | 2009 | device->glDDS7->fbo.fbcolor = NULL;
|
| 2010 | 2010 | device->glDDS7->fbo.fbz = NULL;
|