mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-19 17:58:13 +00:00
Added SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER
This commit is contained in:
@@ -856,6 +856,11 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureWithProperties(SDL_Re
|
|||||||
* - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`: the GLenum for the
|
* - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`: the GLenum for the
|
||||||
* texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
|
* texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
|
||||||
*
|
*
|
||||||
|
* With the gpu renderer:
|
||||||
|
*
|
||||||
|
* - `SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER`: the SDL_GPUTexture associated with
|
||||||
|
* the texture
|
||||||
|
*
|
||||||
* \param texture the texture to query.
|
* \param texture the texture to query.
|
||||||
* \returns a valid property ID on success or 0 on failure; call
|
* \returns a valid property ID on success or 0 on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
@@ -892,6 +897,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Textur
|
|||||||
#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v"
|
#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v"
|
||||||
#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER "SDL.texture.opengles2.target"
|
#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER "SDL.texture.opengles2.target"
|
||||||
#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER "SDL.texture.vulkan.texture"
|
#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER "SDL.texture.vulkan.texture"
|
||||||
|
#define SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER "SDL.texture.gpu.texture"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the renderer that created an SDL_Texture.
|
* Get the renderer that created an SDL_Texture.
|
||||||
|
@@ -233,11 +233,13 @@ static bool GPU_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_
|
|||||||
|
|
||||||
data->format = format;
|
data->format = format;
|
||||||
data->texture = SDL_CreateGPUTexture(renderdata->device, &tci);
|
data->texture = SDL_CreateGPUTexture(renderdata->device, &tci);
|
||||||
|
|
||||||
if (!data->texture) {
|
if (!data->texture) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_PropertiesID props = SDL_GetTextureProperties(texture);
|
||||||
|
SDL_SetPointerProperty(props, SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER, data->texture);
|
||||||
|
|
||||||
if (texture->format == SDL_PIXELFORMAT_RGBA32 || texture->format == SDL_PIXELFORMAT_BGRA32) {
|
if (texture->format == SDL_PIXELFORMAT_RGBA32 || texture->format == SDL_PIXELFORMAT_BGRA32) {
|
||||||
data->shader = FRAG_SHADER_TEXTURE_RGBA;
|
data->shader = FRAG_SHADER_TEXTURE_RGBA;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user