mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
fix textures with multiple GSG's
This commit is contained in:
parent
48ac976821
commit
bd69f6a38c
@ -1427,12 +1427,10 @@ IDirect3DTexture8 *DXTextureContext8::CreateTexture(DXScreenData &scrn) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(_texture->has_ram_image()) {
|
|
||||||
hr = FillDDSurfTexturePixels();
|
hr = FillDDSurfTexturePixels();
|
||||||
if(FAILED(hr)) {
|
if(FAILED(hr)) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Return the newly created texture
|
// Return the newly created texture
|
||||||
return _pD3DTexture8;
|
return _pD3DTexture8;
|
||||||
@ -1448,10 +1446,21 @@ FillDDSurfTexturePixels(void) {
|
|||||||
HRESULT hr=E_FAIL;
|
HRESULT hr=E_FAIL;
|
||||||
assert(IS_VALID_PTR(_texture));
|
assert(IS_VALID_PTR(_texture));
|
||||||
|
|
||||||
|
// It is a mistake to insist that has_ram_image() be true before
|
||||||
|
// we try to load the texture. This function only indicates
|
||||||
|
// whether the texture image is already present in main ram or
|
||||||
|
// not; it has nothing to do with whether get_ram_image() will
|
||||||
|
// fail. When there is only one GSG in the world, has_ram_image()
|
||||||
|
// will generally be true whenever the texture has not been loaded
|
||||||
|
// before, but when there are multiple GSG's (for instance, if we
|
||||||
|
// close and reopen the main window), then has_ram_image() is
|
||||||
|
// largely irrelevant to the GSG.
|
||||||
|
/*
|
||||||
if(!_texture->has_ram_image()) {
|
if(!_texture->has_ram_image()) {
|
||||||
dxgsg8_cat.warning() << "CreateTexture: tried to fill surface that has no ram image!\n";
|
dxgsg8_cat.warning() << "CreateTexture: tried to fill surface that has no ram image!\n";
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
PixelBuffer *pbuf = _texture->get_ram_image();
|
PixelBuffer *pbuf = _texture->get_ram_image();
|
||||||
if (pbuf == (PixelBuffer *)NULL) {
|
if (pbuf == (PixelBuffer *)NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user