mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-27 14:24:13 +08:00
Fixed SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER with IYUV and YV12 pixel buffers
This commit is contained in:
@@ -830,7 +830,12 @@ static bool METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
|
|||||||
if (yuv) {
|
if (yuv) {
|
||||||
mtltexture = (__bridge id<MTLTexture>)SDL_GetPointerProperty(create_props, SDL_PROP_TEXTURE_CREATE_METAL_TEXTURE_U_POINTER, nil);
|
mtltexture = (__bridge id<MTLTexture>)SDL_GetPointerProperty(create_props, SDL_PROP_TEXTURE_CREATE_METAL_TEXTURE_U_POINTER, nil);
|
||||||
if (mtltexture == nil) {
|
if (mtltexture == nil) {
|
||||||
mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
if (surface) {
|
||||||
|
NSUInteger Uplane = (texture->format == SDL_PIXELFORMAT_YV12) ? 2 : 1;
|
||||||
|
mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:Uplane];
|
||||||
|
} else {
|
||||||
|
mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mtltexture == nil) {
|
if (mtltexture == nil) {
|
||||||
return SDL_SetError("Texture allocation failed");
|
return SDL_SetError("Texture allocation failed");
|
||||||
@@ -840,7 +845,12 @@ static bool METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
|
|||||||
|
|
||||||
mtltexture = (__bridge id<MTLTexture>)SDL_GetPointerProperty(create_props, SDL_PROP_TEXTURE_CREATE_METAL_TEXTURE_V_POINTER, nil);
|
mtltexture = (__bridge id<MTLTexture>)SDL_GetPointerProperty(create_props, SDL_PROP_TEXTURE_CREATE_METAL_TEXTURE_V_POINTER, nil);
|
||||||
if (mtltexture == nil) {
|
if (mtltexture == nil) {
|
||||||
mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
if (surface) {
|
||||||
|
NSUInteger Vplane = (texture->format == SDL_PIXELFORMAT_YV12) ? 1 : 2;
|
||||||
|
mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:Vplane];
|
||||||
|
} else {
|
||||||
|
mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mtltexture == nil) {
|
if (mtltexture == nil) {
|
||||||
return SDL_SetError("Texture allocation failed");
|
return SDL_SetError("Texture allocation failed");
|
||||||
|
|||||||
Reference in New Issue
Block a user