mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-02-17 20:34:28 +01:00
direct3d: Make sure streaming textures update before being used for drawing.
Fixes Bugzilla #4402.
This commit is contained in:
parent
b744108af8
commit
33f78eb163
@ -995,11 +995,10 @@ D3D_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD sampler)
|
UpdateDirtyTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture)
|
||||||
{
|
{
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
if (texture->dirty && texture->staging) {
|
if (texture->dirty && texture->staging) {
|
||||||
|
HRESULT result;
|
||||||
if (!texture->texture) {
|
if (!texture->texture) {
|
||||||
result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, texture->usage,
|
result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, texture->usage,
|
||||||
PixelFormatToD3DFMT(texture->format), D3DPOOL_DEFAULT, &texture->texture, NULL);
|
PixelFormatToD3DFMT(texture->format), D3DPOOL_DEFAULT, &texture->texture, NULL);
|
||||||
@ -1014,6 +1013,14 @@ BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD sampler)
|
|||||||
}
|
}
|
||||||
texture->dirty = SDL_FALSE;
|
texture->dirty = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD sampler)
|
||||||
|
{
|
||||||
|
HRESULT result;
|
||||||
|
UpdateDirtyTexture(device, texture);
|
||||||
result = IDirect3DDevice9_SetTexture(device, sampler, (IDirect3DBaseTexture9 *)texture->texture);
|
result = IDirect3DDevice9_SetTexture(device, sampler, (IDirect3DBaseTexture9 *)texture->texture);
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
return D3D_SetError("SetTexture()", result);
|
return D3D_SetError("SetTexture()", result);
|
||||||
@ -1091,6 +1098,13 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
|||||||
SDL_Texture *texture = cmd->data.draw.texture;
|
SDL_Texture *texture = cmd->data.draw.texture;
|
||||||
const SDL_BlendMode blend = cmd->data.draw.blend;
|
const SDL_BlendMode blend = cmd->data.draw.blend;
|
||||||
|
|
||||||
|
if (texture) {
|
||||||
|
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||||
|
if (texturedata) {
|
||||||
|
UpdateDirtyTexture(data->device, &texturedata->texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (texture != data->drawstate.texture) {
|
if (texture != data->drawstate.texture) {
|
||||||
D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *) data->drawstate.texture->driverdata : NULL;
|
D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *) data->drawstate.texture->driverdata : NULL;
|
||||||
D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *) texture->driverdata : NULL;
|
D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *) texture->driverdata : NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user