Replaced SDL_GetTextureDXGIResource() with texture properties

Fixes https://github.com/libsdl-org/SDL/issues/8529
This commit is contained in:
Sam Lantinga 2023-11-10 20:00:53 -08:00
parent 09d1e9defb
commit b374105975
12 changed files with 112 additions and 133 deletions

View file

@ -518,6 +518,10 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
data->texw = (GLfloat)(texture->w) / texture_w;
data->texh = (GLfloat)texture->h / texture_h;
}
SDL_PropertiesID props = SDL_GetTextureProperties(texture);
SDL_SetProperty(props, "SDL.texture.opengl.texture", (void *)(uintptr_t)data->texture);
SDL_SetProperty(props, "SDL.texture.opengl.tex_w", (void *)(uintptr_t)(Uint32)(data->texw * 65536));
SDL_SetProperty(props, "SDL.texture.opengl.tex_h", (void *)(uintptr_t)(Uint32)(data->texh * 65536));
data->format = format;
data->formattype = type;
@ -590,6 +594,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
GL_CLAMP_TO_EDGE);
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, format, type, NULL);
SDL_SetProperty(props, "SDL.texture.opengl.texture_u", (void *)(uintptr_t)data->utexture);
renderdata->glBindTexture(textype, data->vtexture);
renderdata->glTexParameteri(textype, GL_TEXTURE_MIN_FILTER,
@ -602,6 +607,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
GL_CLAMP_TO_EDGE);
renderdata->glTexImage2D(textype, 0, internalFormat, (texture_w + 1) / 2,
(texture_h + 1) / 2, 0, format, type, NULL);
SDL_SetProperty(props, "SDL.texture.opengl.texture_v", (void *)(uintptr_t)data->vtexture);
}
if (texture->format == SDL_PIXELFORMAT_NV12 ||