extend the code hidden by SDL_HAVE_YUV

This commit is contained in:
pionere 2022-02-05 12:22:34 +01:00 committed by Sylvain
parent ce1883e1e7
commit 3f8b450de2
No known key found for this signature in database
GPG key ID: 5F87E02E5BC0939E
11 changed files with 93 additions and 38 deletions

View file

@ -71,7 +71,9 @@ typedef struct
IDirect3DSurface9 *defaultRenderTarget; IDirect3DSurface9 *defaultRenderTarget;
IDirect3DSurface9 *currentRenderTarget; IDirect3DSurface9 *currentRenderTarget;
void* d3dxDLL; void* d3dxDLL;
#if SDL_HAVE_YUV
LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS]; LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS];
#endif
LPDIRECT3DVERTEXBUFFER9 vertexBuffers[8]; LPDIRECT3DVERTEXBUFFER9 vertexBuffers[8];
size_t vertexBufferSize[8]; size_t vertexBufferSize[8];
int currentVertexBuffer; int currentVertexBuffer;
@ -95,6 +97,7 @@ typedef struct
D3D_TextureRep texture; D3D_TextureRep texture;
D3DTEXTUREFILTERTYPE scaleMode; D3DTEXTUREFILTERTYPE scaleMode;
#if SDL_HAVE_YUV
/* YV12 texture support */ /* YV12 texture support */
SDL_bool yuv; SDL_bool yuv;
D3D_TextureRep utexture; D3D_TextureRep utexture;
@ -102,6 +105,7 @@ typedef struct
Uint8 *pixels; Uint8 *pixels;
int pitch; int pitch;
SDL_Rect locked_rect; SDL_Rect locked_rect;
#endif
} D3D_TextureData; } D3D_TextureData;
typedef struct typedef struct
@ -534,7 +538,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) { if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) {
return -1; return -1;
} }
#if SDL_HAVE_YUV
if (texture->format == SDL_PIXELFORMAT_YV12 || if (texture->format == SDL_PIXELFORMAT_YV12 ||
texture->format == SDL_PIXELFORMAT_IYUV) { texture->format == SDL_PIXELFORMAT_IYUV) {
texturedata->yuv = SDL_TRUE; texturedata->yuv = SDL_TRUE;
@ -547,6 +551,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return -1; return -1;
} }
} }
#endif
return 0; return 0;
} }
@ -563,7 +568,7 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) { if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) {
return -1; return -1;
} }
#if SDL_HAVE_YUV
if (texturedata->yuv) { if (texturedata->yuv) {
if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) { if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) {
return -1; return -1;
@ -573,6 +578,7 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return -1; return -1;
} }
} }
#endif
return 0; return 0;
} }
@ -590,7 +596,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
return -1; return -1;
} }
#if SDL_HAVE_YUV
if (texturedata->yuv) { if (texturedata->yuv) {
/* Skip to the correct offset into the next texture */ /* Skip to the correct offset into the next texture */
pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
@ -605,6 +611,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
return -1; return -1;
} }
} }
#endif
return 0; return 0;
} }
@ -647,7 +654,7 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
if (!texturedata) { if (!texturedata) {
return SDL_SetError("Texture is not currently available"); return SDL_SetError("Texture is not currently available");
} }
#if SDL_HAVE_YUV
texturedata->locked_rect = *rect; texturedata->locked_rect = *rect;
if (texturedata->yuv) { if (texturedata->yuv) {
@ -664,6 +671,9 @@ D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
rect->x * SDL_BYTESPERPIXEL(texture->format)); rect->x * SDL_BYTESPERPIXEL(texture->format));
*pitch = texturedata->pitch; *pitch = texturedata->pitch;
} else { } else {
#else
{
#endif
RECT d3drect; RECT d3drect;
D3DLOCKED_RECT locked; D3DLOCKED_RECT locked;
HRESULT result; HRESULT result;
@ -696,7 +706,7 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (!texturedata) { if (!texturedata) {
return; return;
} }
#if SDL_HAVE_YUV
if (texturedata->yuv) { if (texturedata->yuv) {
const SDL_Rect *rect = &texturedata->locked_rect; const SDL_Rect *rect = &texturedata->locked_rect;
void *pixels = void *pixels =
@ -704,6 +714,9 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
rect->x * SDL_BYTESPERPIXEL(texture->format)); rect->x * SDL_BYTESPERPIXEL(texture->format));
D3D_UpdateTexture(renderer, texture, rect, pixels, texturedata->pitch); D3D_UpdateTexture(renderer, texture, rect, pixels, texturedata->pitch);
} else { } else {
#else
{
#endif
IDirect3DTexture9_UnlockRect(texturedata->texture.staging, 0); IDirect3DTexture9_UnlockRect(texturedata->texture.staging, 0);
texturedata->texture.dirty = SDL_TRUE; texturedata->texture.dirty = SDL_TRUE;
if (data->drawstate.texture == texture) { if (data->drawstate.texture == texture) {
@ -946,7 +959,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH
if (BindTextureRep(data->device, &texturedata->texture, 0) < 0) { if (BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
return -1; return -1;
} }
#if SDL_HAVE_YUV
if (texturedata->yuv) { if (texturedata->yuv) {
switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
case SDL_YUV_CONVERSION_JPEG: case SDL_YUV_CONVERSION_JPEG:
@ -972,6 +985,7 @@ SetupTextureState(D3D_RenderData *data, SDL_Texture * texture, LPDIRECT3DPIXELSH
return -1; return -1;
} }
} }
#endif
return 0; return 0;
} }
@ -990,10 +1004,12 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
if (texture == NULL) { if (texture == NULL) {
IDirect3DDevice9_SetTexture(data->device, 0, NULL); IDirect3DDevice9_SetTexture(data->device, 0, NULL);
} }
#if SDL_HAVE_YUV
if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) { if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) {
IDirect3DDevice9_SetTexture(data->device, 1, NULL); IDirect3DDevice9_SetTexture(data->device, 1, NULL);
IDirect3DDevice9_SetTexture(data->device, 2, NULL); IDirect3DDevice9_SetTexture(data->device, 2, NULL);
} }
#endif
if (texture && SetupTextureState(data, texture, &shader) < 0) { if (texture && SetupTextureState(data, texture, &shader) < 0) {
return -1; return -1;
} }
@ -1010,10 +1026,12 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
} else if (texture) { } else if (texture) {
D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *) texture->driverdata;
UpdateDirtyTexture(data->device, &texturedata->texture); UpdateDirtyTexture(data->device, &texturedata->texture);
#if SDL_HAVE_YUV
if (texturedata->yuv) { if (texturedata->yuv) {
UpdateDirtyTexture(data->device, &texturedata->utexture); UpdateDirtyTexture(data->device, &texturedata->utexture);
UpdateDirtyTexture(data->device, &texturedata->vtexture); UpdateDirtyTexture(data->device, &texturedata->vtexture);
} }
#endif
} }
if (blend != data->drawstate.blend) { if (blend != data->drawstate.blend) {
@ -1353,10 +1371,12 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->drawstate.shader = NULL; renderdata->drawstate.shader = NULL;
IDirect3DDevice9_SetPixelShader(renderdata->device, NULL); IDirect3DDevice9_SetPixelShader(renderdata->device, NULL);
IDirect3DDevice9_SetTexture(renderdata->device, 0, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 0, NULL);
#if SDL_HAVE_YUV
if (data->yuv) { if (data->yuv) {
IDirect3DDevice9_SetTexture(renderdata->device, 1, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 1, NULL);
IDirect3DDevice9_SetTexture(renderdata->device, 2, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 2, NULL);
} }
#endif
} }
if (!data) { if (!data) {
@ -1364,9 +1384,11 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} }
D3D_DestroyTextureRep(&data->texture); D3D_DestroyTextureRep(&data->texture);
#if SDL_HAVE_YUV
D3D_DestroyTextureRep(&data->utexture); D3D_DestroyTextureRep(&data->utexture);
D3D_DestroyTextureRep(&data->vtexture); D3D_DestroyTextureRep(&data->vtexture);
SDL_free(data->pixels); SDL_free(data->pixels);
#endif
SDL_free(data); SDL_free(data);
texture->driverdata = NULL; texture->driverdata = NULL;
} }
@ -1388,12 +1410,14 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
IDirect3DSurface9_Release(data->currentRenderTarget); IDirect3DSurface9_Release(data->currentRenderTarget);
data->currentRenderTarget = NULL; data->currentRenderTarget = NULL;
} }
#if SDL_HAVE_YUV
for (i = 0; i < SDL_arraysize(data->shaders); ++i) { for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
if (data->shaders[i]) { if (data->shaders[i]) {
IDirect3DPixelShader9_Release(data->shaders[i]); IDirect3DPixelShader9_Release(data->shaders[i]);
data->shaders[i] = NULL; data->shaders[i] = NULL;
} }
} }
#endif
/* Release all vertex buffers */ /* Release all vertex buffers */
for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) {
if (data->vertexBuffers[i]) { if (data->vertexBuffers[i]) {
@ -1666,7 +1690,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
/* Set up parameters for rendering */ /* Set up parameters for rendering */
D3D_InitRenderState(data); D3D_InitRenderState(data);
#if SDL_HAVE_YUV
if (caps.MaxSimultaneousTextures >= 3) { if (caps.MaxSimultaneousTextures >= 3) {
int i; int i;
for (i = 0; i < SDL_arraysize(data->shaders); ++i) { for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
@ -1680,7 +1704,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
} }
} }
#endif
data->drawstate.blend = SDL_BLENDMODE_INVALID; data->drawstate.blend = SDL_BLENDMODE_INVALID;
return renderer; return renderer;

View file

@ -91,7 +91,7 @@ typedef struct
int lockedTexturePositionX; int lockedTexturePositionX;
int lockedTexturePositionY; int lockedTexturePositionY;
D3D11_FILTER scaleMode; D3D11_FILTER scaleMode;
#if SDL_HAVE_YUV
/* YV12 texture support */ /* YV12 texture support */
SDL_bool yuv; SDL_bool yuv;
ID3D11Texture2D *mainTextureU; ID3D11Texture2D *mainTextureU;
@ -107,6 +107,7 @@ typedef struct
Uint8 *pixels; Uint8 *pixels;
int pitch; int pitch;
SDL_Rect locked_rect; SDL_Rect locked_rect;
#endif
} D3D11_TextureData; } D3D11_TextureData;
/* Blend mode data */ /* Blend mode data */
@ -1116,7 +1117,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D11_DestroyTexture(renderer, texture); D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
} }
#if SDL_HAVE_YUV
if (texture->format == SDL_PIXELFORMAT_YV12 || if (texture->format == SDL_PIXELFORMAT_YV12 ||
texture->format == SDL_PIXELFORMAT_IYUV) { texture->format == SDL_PIXELFORMAT_IYUV) {
textureData->yuv = SDL_TRUE; textureData->yuv = SDL_TRUE;
@ -1165,7 +1166,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
} }
} }
#endif /* SDL_HAVE_YUV */
resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.Format = textureDesc.Format;
resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
resourceViewDesc.Texture2D.MostDetailedMip = 0; resourceViewDesc.Texture2D.MostDetailedMip = 0;
@ -1179,7 +1180,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D11_DestroyTexture(renderer, texture); D3D11_DestroyTexture(renderer, texture);
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
} }
#if SDL_HAVE_YUV
if (textureData->yuv) { if (textureData->yuv) {
result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
(ID3D11Resource *)textureData->mainTextureU, (ID3D11Resource *)textureData->mainTextureU,
@ -1232,7 +1233,7 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result); return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateRenderTargetView"), result);
} }
} }
#endif /* SDL_HAVE_YUV */
return 0; return 0;
} }
@ -1250,6 +1251,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer,
SAFE_RELEASE(data->mainTextureResourceView); SAFE_RELEASE(data->mainTextureResourceView);
SAFE_RELEASE(data->mainTextureRenderTargetView); SAFE_RELEASE(data->mainTextureRenderTargetView);
SAFE_RELEASE(data->stagingTexture); SAFE_RELEASE(data->stagingTexture);
#if SDL_HAVE_YUV
SAFE_RELEASE(data->mainTextureU); SAFE_RELEASE(data->mainTextureU);
SAFE_RELEASE(data->mainTextureResourceViewU); SAFE_RELEASE(data->mainTextureResourceViewU);
SAFE_RELEASE(data->mainTextureV); SAFE_RELEASE(data->mainTextureV);
@ -1257,6 +1259,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer,
SAFE_RELEASE(data->mainTextureNV); SAFE_RELEASE(data->mainTextureNV);
SAFE_RELEASE(data->mainTextureResourceViewNV); SAFE_RELEASE(data->mainTextureResourceViewNV);
SDL_free(data->pixels); SDL_free(data->pixels);
#endif
SDL_free(data); SDL_free(data);
texture->driverdata = NULL; texture->driverdata = NULL;
} }
@ -1357,7 +1360,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) {
return -1; return -1;
} }
#if SDL_HAVE_YUV
if (textureData->yuv) { if (textureData->yuv) {
/* Skip to the correct offset into the next texture */ /* Skip to the correct offset into the next texture */
srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
@ -1381,6 +1384,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
return -1; return -1;
} }
} }
#endif /* SDL_HAVE_YUV */
return 0; return 0;
} }
@ -1448,7 +1452,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
if (!textureData) { if (!textureData) {
return SDL_SetError("Texture is not currently available"); return SDL_SetError("Texture is not currently available");
} }
#if SDL_HAVE_YUV
if (textureData->yuv || textureData->nv12) { if (textureData->yuv || textureData->nv12) {
/* It's more efficient to upload directly... */ /* It's more efficient to upload directly... */
if (!textureData->pixels) { if (!textureData->pixels) {
@ -1465,7 +1469,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
*pitch = textureData->pitch; *pitch = textureData->pitch;
return 0; return 0;
} }
#endif
if (textureData->stagingTexture) { if (textureData->stagingTexture) {
return SDL_SetError("texture is already locked"); return SDL_SetError("texture is already locked");
} }
@ -1529,7 +1533,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
if (!textureData) { if (!textureData) {
return; return;
} }
#if SDL_HAVE_YUV
if (textureData->yuv || textureData->nv12) { if (textureData->yuv || textureData->nv12) {
const SDL_Rect *rect = &textureData->locked_rect; const SDL_Rect *rect = &textureData->locked_rect;
void *pixels = void *pixels =
@ -1538,7 +1542,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
D3D11_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch); D3D11_UpdateTexture(renderer, texture, rect, pixels, textureData->pitch);
return; return;
} }
#endif
/* Commit the pixel buffer's changes back to the staging texture: */ /* Commit the pixel buffer's changes back to the staging texture: */
ID3D11DeviceContext_Unmap(rendererData->d3dContext, ID3D11DeviceContext_Unmap(rendererData->d3dContext,
(ID3D11Resource *)textureData->stagingTexture, (ID3D11Resource *)textureData->stagingTexture,
@ -1981,7 +1985,7 @@ D3D11_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const
default: default:
return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
} }
#if SDL_HAVE_YUV
if (textureData->yuv) { if (textureData->yuv) {
ID3D11ShaderResourceView *shaderResources[] = { ID3D11ShaderResourceView *shaderResources[] = {
textureData->mainTextureResourceView, textureData->mainTextureResourceView,
@ -2032,7 +2036,7 @@ D3D11_SetCopyState(SDL_Renderer * renderer, const SDL_RenderCommand *cmd, const
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
} }
#endif /* SDL_HAVE_YUV */
return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_RGB], return D3D11_SetDrawState(renderer, cmd, rendererData->pixelShaders[SHADER_RGB],
1, &textureData->mainTextureResourceView, textureSampler, matrix); 1, &textureData->mainTextureResourceView, textureSampler, matrix);
} }

View file

@ -1886,9 +1886,10 @@ static struct
{ {
const void *shader_data; const void *shader_data;
SIZE_T shader_size; SIZE_T shader_size;
} D3D11_shaders[] = { } D3D11_shaders[NUM_SHADERS] = {
{ D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) },
{ D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) },
#if SDL_HAVE_YUV
{ D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) },
{ D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) },
{ D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) },
@ -1898,6 +1899,7 @@ static struct
{ D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) },
{ D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) },
{ D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) },
#endif
}; };
int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout)

View file

@ -25,6 +25,7 @@
typedef enum { typedef enum {
SHADER_SOLID, SHADER_SOLID,
SHADER_RGB, SHADER_RGB,
#if SDL_HAVE_YUV
SHADER_YUV_JPEG, SHADER_YUV_JPEG,
SHADER_YUV_BT601, SHADER_YUV_BT601,
SHADER_YUV_BT709, SHADER_YUV_BT709,
@ -34,6 +35,7 @@ typedef enum {
SHADER_NV21_JPEG, SHADER_NV21_JPEG,
SHADER_NV21_BT601, SHADER_NV21_BT601,
SHADER_NV21_BT709, SHADER_NV21_BT709,
#endif
NUM_SHADERS NUM_SHADERS
} D3D11_Shader; } D3D11_Shader;

View file

@ -167,11 +167,12 @@ typedef struct METAL_ShaderPipelines
@property (nonatomic, retain) id<MTLTexture> mtltexture_uv; @property (nonatomic, retain) id<MTLTexture> mtltexture_uv;
@property (nonatomic, retain) id<MTLSamplerState> mtlsampler; @property (nonatomic, retain) id<MTLSamplerState> mtlsampler;
@property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction; @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction;
#if SDL_HAVE_YUV
@property (nonatomic, assign) BOOL yuv; @property (nonatomic, assign) BOOL yuv;
@property (nonatomic, assign) BOOL nv12; @property (nonatomic, assign) BOOL nv12;
@property (nonatomic, assign) size_t conversionBufferOffset; @property (nonatomic, assign) size_t conversionBufferOffset;
#endif
@property (nonatomic, assign) BOOL hasdata; @property (nonatomic, assign) BOOL hasdata;
@property (nonatomic, retain) id<MTLBuffer> lockedbuffer; @property (nonatomic, retain) id<MTLBuffer> lockedbuffer;
@property (nonatomic, assign) SDL_Rect lockedrect; @property (nonatomic, assign) SDL_Rect lockedrect;
@end @end
@ -612,7 +613,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} }
id<MTLTexture> mtltexture_uv = nil; id<MTLTexture> mtltexture_uv = nil;
#if SDL_HAVE_YUV
BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12);
BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21);
@ -637,7 +638,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return SDL_SetError("Texture allocation failed"); return SDL_SetError("Texture allocation failed");
} }
} }
#endif /* SDL_HAVE_YUV */
METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; METAL_TextureData *texturedata = [[METAL_TextureData alloc] init];
if (texture->scaleMode == SDL_ScaleModeNearest) { if (texture->scaleMode == SDL_ScaleModeNearest) {
texturedata.mtlsampler = data.mtlsamplernearest; texturedata.mtlsampler = data.mtlsamplernearest;
@ -646,7 +647,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} }
texturedata.mtltexture = mtltexture; texturedata.mtltexture = mtltexture;
texturedata.mtltexture_uv = mtltexture_uv; texturedata.mtltexture_uv = mtltexture_uv;
#if SDL_HAVE_YUV
texturedata.yuv = yuv; texturedata.yuv = yuv;
texturedata.nv12 = nv12; texturedata.nv12 = nv12;
@ -657,9 +658,12 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} else if (texture->format == SDL_PIXELFORMAT_NV21) { } else if (texture->format == SDL_PIXELFORMAT_NV21) {
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21; texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21;
} else { } else {
#else
{
#endif /* SDL_HAVE_YUV*/
texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY; texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY;
} }
#if SDL_HAVE_YUV
if (yuv || nv12) { if (yuv || nv12) {
size_t offset = 0; size_t offset = 0;
SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h); SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h);
@ -671,7 +675,7 @@ METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
} }
texturedata.conversionBufferOffset = offset; texturedata.conversionBufferOffset = offset;
} }
#endif
texture->driverdata = (void*)CFBridgingRetain(texturedata); texture->driverdata = (void*)CFBridgingRetain(texturedata);
#if !__has_feature(objc_arc) #if !__has_feature(objc_arc)
@ -785,7 +789,7 @@ METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) { if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) {
return -1; return -1;
} }
#if SDL_HAVE_YUV
if (texturedata.yuv) { if (texturedata.yuv) {
int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0;
int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1;
@ -815,7 +819,7 @@ METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
return -1; return -1;
} }
} }
#endif
texturedata.hasdata = YES; texturedata.hasdata = YES;
return 0; return 0;
@ -896,10 +900,13 @@ METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
} }
*pitch = SDL_BYTESPERPIXEL(texture->format) * rect->w; *pitch = SDL_BYTESPERPIXEL(texture->format) * rect->w;
#if SDL_HAVE_YUV
if (texturedata.yuv || texturedata.nv12) { if (texturedata.yuv || texturedata.nv12) {
buffersize = ((*pitch) * rect->h) + (2 * (*pitch + 1) / 2) * ((rect->h + 1) / 2); buffersize = ((*pitch) * rect->h) + (2 * (*pitch + 1) / 2) * ((rect->h + 1) / 2);
} else { } else {
#else
{
#endif
buffersize = (*pitch) * rect->h; buffersize = (*pitch) * rect->h;
} }
@ -953,7 +960,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
destinationSlice:0 destinationSlice:0
destinationLevel:0 destinationLevel:0
destinationOrigin:MTLOriginMake(rect.x, rect.y, 0)]; destinationOrigin:MTLOriginMake(rect.x, rect.y, 0)];
#if SDL_HAVE_YUV
if (texturedata.yuv) { if (texturedata.yuv) {
int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0;
int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1;
@ -993,7 +1000,7 @@ METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
destinationLevel:0 destinationLevel:0
destinationOrigin:MTLOriginMake(UVrect.x, UVrect.y, 0)]; destinationOrigin:MTLOriginMake(UVrect.x, UVrect.y, 0)];
} }
#endif
[blitcmd endEncoding]; [blitcmd endEncoding];
[data.mtlcmdbuffer commit]; [data.mtlcmdbuffer commit];
@ -1313,10 +1320,12 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const size_t
} }
[data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0]; [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0];
#if SDL_HAVE_YUV
if (texturedata.yuv || texturedata.nv12) { if (texturedata.yuv || texturedata.nv12) {
[data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1]; [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1];
[data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1]; [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1];
} }
#endif
statecache->texture = texture; statecache->texture = texture;
} }
return SDL_TRUE; return SDL_TRUE;

View file

@ -1902,7 +1902,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
} }
SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s", SDL_LogInfo(SDL_LOG_CATEGORY_RENDER, "OpenGL shaders: %s",
data->shaders ? "ENABLED" : "DISABLED"); data->shaders ? "ENABLED" : "DISABLED");
#if SDL_HAVE_YUV
/* We support YV12 textures using 3 textures and a shader */ /* We support YV12 textures using 3 textures and a shader */
if (data->shaders && data->num_texture_units >= 3) { if (data->shaders && data->num_texture_units >= 3) {
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
@ -1910,7 +1910,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12;
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
} }
#endif
#ifdef __MACOSX__ #ifdef __MACOSX__
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
#endif #endif

View file

@ -284,7 +284,7 @@ static const char *shader_source[NUM_SHADERS][2] =
" gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n" " gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n"
"}" "}"
}, },
#if SDL_HAVE_YUV
/* SHADER_YUV_JPEG */ /* SHADER_YUV_JPEG */
{ {
/* vertex shader */ /* vertex shader */
@ -384,6 +384,7 @@ static const char *shader_source[NUM_SHADERS][2] =
BT709_SHADER_CONSTANTS BT709_SHADER_CONSTANTS
NV21_SHADER_BODY NV21_SHADER_BODY
}, },
#endif /* SDL_HAVE_YUV */
}; };
static SDL_bool static SDL_bool

View file

@ -32,6 +32,7 @@ typedef enum {
SHADER_SOLID, SHADER_SOLID,
SHADER_RGB, SHADER_RGB,
SHADER_RGBA, SHADER_RGBA,
#if SDL_HAVE_YUV
SHADER_YUV_JPEG, SHADER_YUV_JPEG,
SHADER_YUV_BT601, SHADER_YUV_BT601,
SHADER_YUV_BT709, SHADER_YUV_BT709,
@ -43,6 +44,7 @@ typedef enum {
SHADER_NV21_JPEG, SHADER_NV21_JPEG,
SHADER_NV21_BT601, SHADER_NV21_BT601,
SHADER_NV21_BT709, SHADER_NV21_BT709,
#endif
NUM_SHADERS NUM_SHADERS
} GL_Shader; } GL_Shader;

View file

@ -561,6 +561,7 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int
case GLES2_IMAGESOURCE_TEXTURE_BGR: case GLES2_IMAGESOURCE_TEXTURE_BGR:
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR; ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR;
break; break;
#if SDL_HAVE_YUV
case GLES2_IMAGESOURCE_TEXTURE_YUV: case GLES2_IMAGESOURCE_TEXTURE_YUV:
switch (SDL_GetYUVConversionModeForResolution(w, h)) { switch (SDL_GetYUVConversionModeForResolution(w, h)) {
case SDL_YUV_CONVERSION_JPEG: case SDL_YUV_CONVERSION_JPEG:
@ -617,6 +618,7 @@ GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, int w, int
goto fault; goto fault;
} }
break; break;
#endif /* SDL_HAVE_YUV */
case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES: case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES:
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES; ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES;
break; break;
@ -1018,6 +1020,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice
break; break;
} }
break; break;
#if SDL_HAVE_YUV
case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_IYUV:
case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_YV12:
sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV; sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV;
@ -1028,6 +1031,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice
case SDL_PIXELFORMAT_NV21: case SDL_PIXELFORMAT_NV21:
sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21;
break; break;
#endif
case SDL_PIXELFORMAT_EXTERNAL_OES: case SDL_PIXELFORMAT_EXTERNAL_OES:
sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES;
break; break;
@ -1051,6 +1055,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice
case SDL_PIXELFORMAT_BGR888: case SDL_PIXELFORMAT_BGR888:
sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR;
break; break;
#if SDL_HAVE_YUV
case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_IYUV:
case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_YV12:
sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV; sourceType = GLES2_IMAGESOURCE_TEXTURE_YUV;
@ -1061,6 +1066,7 @@ SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, void *vertice
case SDL_PIXELFORMAT_NV21: case SDL_PIXELFORMAT_NV21:
sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21;
break; break;
#endif
case SDL_PIXELFORMAT_EXTERNAL_OES: case SDL_PIXELFORMAT_EXTERNAL_OES:
sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES;
break; break;
@ -1364,6 +1370,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
format = GL_RGBA; format = GL_RGBA;
type = GL_UNSIGNED_BYTE; type = GL_UNSIGNED_BYTE;
break; break;
#if SDL_HAVE_YUV
case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_IYUV:
case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_YV12:
case SDL_PIXELFORMAT_NV12: case SDL_PIXELFORMAT_NV12:
@ -1371,7 +1378,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
format = GL_LUMINANCE; format = GL_LUMINANCE;
type = GL_UNSIGNED_BYTE; type = GL_UNSIGNED_BYTE;
break; break;
#ifdef GL_TEXTURE_EXTERNAL_OES #endif
case SDL_PIXELFORMAT_EXTERNAL_OES: case SDL_PIXELFORMAT_EXTERNAL_OES:
format = GL_NONE; format = GL_NONE;
type = GL_NONE; type = GL_NONE;
@ -2129,12 +2136,12 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
renderer->SetVSync = GLES2_SetVSync; renderer->SetVSync = GLES2_SetVSync;
renderer->GL_BindTexture = GLES2_BindTexture; renderer->GL_BindTexture = GLES2_BindTexture;
renderer->GL_UnbindTexture = GLES2_UnbindTexture; renderer->GL_UnbindTexture = GLES2_UnbindTexture;
#if SDL_HAVE_YUV
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12;
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
#ifdef GL_TEXTURE_EXTERNAL_OES #endif
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES;
#endif #endif

View file

@ -335,6 +335,7 @@ const Uint8 *GLES2_GetShader(GLES2_ShaderType type)
return GLES2_Fragment_TextureRGB; return GLES2_Fragment_TextureRGB;
case GLES2_SHADER_FRAGMENT_TEXTURE_BGR: case GLES2_SHADER_FRAGMENT_TEXTURE_BGR:
return GLES2_Fragment_TextureBGR; return GLES2_Fragment_TextureBGR;
#if SDL_HAVE_YUV
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG: case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG:
return GLES2_Fragment_TextureYUVJPEG; return GLES2_Fragment_TextureYUVJPEG;
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601: case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601:
@ -357,6 +358,7 @@ const Uint8 *GLES2_GetShader(GLES2_ShaderType type)
return GLES2_Fragment_TextureNV21BT601; return GLES2_Fragment_TextureNV21BT601;
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709: case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709:
return GLES2_Fragment_TextureNV21BT709; return GLES2_Fragment_TextureNV21BT709;
#endif
case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES: case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES:
return GLES2_Fragment_TextureExternalOES; return GLES2_Fragment_TextureExternalOES;
default: default:

View file

@ -34,6 +34,7 @@ typedef enum
GLES2_SHADER_FRAGMENT_TEXTURE_ARGB, GLES2_SHADER_FRAGMENT_TEXTURE_ARGB,
GLES2_SHADER_FRAGMENT_TEXTURE_BGR, GLES2_SHADER_FRAGMENT_TEXTURE_BGR,
GLES2_SHADER_FRAGMENT_TEXTURE_RGB, GLES2_SHADER_FRAGMENT_TEXTURE_RGB,
#if SDL_HAVE_YUV
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG,
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601,
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709, GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709,
@ -45,6 +46,7 @@ typedef enum
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG,
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601,
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709,
#endif
GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES, GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES,
GLES2_SHADER_COUNT GLES2_SHADER_COUNT
} GLES2_ShaderType; } GLES2_ShaderType;