Improved Direct3D YUV texture support
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403435
This commit is contained in:
parent
b4dd1e1c1a
commit
4a241fd21e
1 changed files with 208 additions and 116 deletions
|
@ -24,6 +24,7 @@
|
||||||
#if SDL_VIDEO_RENDER_D3D
|
#if SDL_VIDEO_RENDER_D3D
|
||||||
|
|
||||||
#include "SDL_win32video.h"
|
#include "SDL_win32video.h"
|
||||||
|
#include "../SDL_yuv_sw_c.h"
|
||||||
|
|
||||||
/* Direct3D renderer implementation */
|
/* Direct3D renderer implementation */
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@
|
||||||
static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
|
static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags);
|
||||||
static int D3D_DisplayModeChanged(SDL_Renderer * renderer);
|
static int D3D_DisplayModeChanged(SDL_Renderer * renderer);
|
||||||
static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
|
static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
|
||||||
|
static int D3D_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, void **pixels, int *pitch);
|
||||||
static int D3D_SetTexturePalette(SDL_Renderer * renderer,
|
static int D3D_SetTexturePalette(SDL_Renderer * renderer,
|
||||||
SDL_Texture * texture,
|
SDL_Texture * texture,
|
||||||
const SDL_Color * colors, int firstcolor,
|
const SDL_Color * colors, int firstcolor,
|
||||||
|
@ -96,6 +98,7 @@ SDL_RenderDriver D3D_RenderDriver = {
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
IDirect3D9 *d3d;
|
||||||
IDirect3DDevice9 *device;
|
IDirect3DDevice9 *device;
|
||||||
D3DPRESENT_PARAMETERS pparams;
|
D3DPRESENT_PARAMETERS pparams;
|
||||||
SDL_bool beginScene;
|
SDL_bool beginScene;
|
||||||
|
@ -103,6 +106,8 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
SDL_SW_YUVTexture *yuv;
|
||||||
|
Uint32 format;
|
||||||
IDirect3DTexture9 *texture;
|
IDirect3DTexture9 *texture;
|
||||||
} D3D_TextureData;
|
} D3D_TextureData;
|
||||||
|
|
||||||
|
@ -226,6 +231,50 @@ PixelFormatToD3DFMT(Uint32 format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SDL_bool
|
||||||
|
D3D_IsTextureFormatAvailable(IDirect3D9 *d3d, Uint32 display_format, Uint32 texture_format)
|
||||||
|
{
|
||||||
|
HRESULT result;
|
||||||
|
|
||||||
|
result = IDirect3D9_CheckDeviceFormat(d3d,
|
||||||
|
D3DADAPTER_DEFAULT, /* FIXME */
|
||||||
|
D3DDEVTYPE_HAL,
|
||||||
|
PixelFormatToD3DFMT(display_format),
|
||||||
|
0,
|
||||||
|
D3DRTYPE_TEXTURE,
|
||||||
|
PixelFormatToD3DFMT(texture_format));
|
||||||
|
return FAILED(result) ? SDL_FALSE : SDL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
UpdateYUVTextureData(SDL_Texture * texture)
|
||||||
|
{
|
||||||
|
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
||||||
|
SDL_Rect rect;
|
||||||
|
RECT d3drect;
|
||||||
|
D3DLOCKED_RECT locked;
|
||||||
|
HRESULT result;
|
||||||
|
|
||||||
|
d3drect.left = 0;
|
||||||
|
d3drect.right = texture->w;
|
||||||
|
d3drect.top = 0;
|
||||||
|
d3drect.bottom = texture->h;
|
||||||
|
|
||||||
|
result = IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
|
||||||
|
if (FAILED(result)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.x = 0;
|
||||||
|
rect.y = 0;
|
||||||
|
rect.w = texture->w;
|
||||||
|
rect.h = texture->h;
|
||||||
|
SDL_SW_CopyYUVToRGB(data->yuv, &rect, data->format, texture->w,
|
||||||
|
texture->h, locked.pBits, locked.Pitch);
|
||||||
|
|
||||||
|
IDirect3DTexture9_UnlockRect(data->texture, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
D3D_AddRenderDriver(_THIS)
|
D3D_AddRenderDriver(_THIS)
|
||||||
{
|
{
|
||||||
|
@ -246,23 +295,18 @@ D3D_AddRenderDriver(_THIS)
|
||||||
SDL_PIXELFORMAT_RGB888,
|
SDL_PIXELFORMAT_RGB888,
|
||||||
SDL_PIXELFORMAT_ARGB8888,
|
SDL_PIXELFORMAT_ARGB8888,
|
||||||
SDL_PIXELFORMAT_ARGB2101010,
|
SDL_PIXELFORMAT_ARGB2101010,
|
||||||
SDL_PIXELFORMAT_YUY2,
|
|
||||||
SDL_PIXELFORMAT_UYVY,
|
|
||||||
};
|
};
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
||||||
result = IDirect3D9_CheckDeviceFormat(data->d3d,
|
if (D3D_IsTextureFormatAvailable(data->d3d, mode->format, formats[i])) {
|
||||||
D3DADAPTER_DEFAULT, /* FIXME */
|
|
||||||
D3DDEVTYPE_HAL,
|
|
||||||
PixelFormatToD3DFMT(mode->format),
|
|
||||||
0,
|
|
||||||
D3DRTYPE_TEXTURE,
|
|
||||||
PixelFormatToD3DFMT(formats[i]));
|
|
||||||
if (!FAILED(result)) {
|
|
||||||
info->texture_formats[info->num_texture_formats++] = formats[i];
|
info->texture_formats[info->num_texture_formats++] = formats[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YV12;
|
||||||
|
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
|
||||||
|
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YUY2;
|
||||||
|
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_UYVY;
|
||||||
|
info->texture_formats[info->num_texture_formats++] = SDL_PIXELFORMAT_YVYU;
|
||||||
|
|
||||||
SDL_AddRenderDriver(0, &D3D_RenderDriver);
|
SDL_AddRenderDriver(0, &D3D_RenderDriver);
|
||||||
}
|
}
|
||||||
|
@ -293,9 +337,11 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
data->d3d = videodata->d3d;
|
||||||
|
|
||||||
renderer->DisplayModeChanged = D3D_DisplayModeChanged;
|
renderer->DisplayModeChanged = D3D_DisplayModeChanged;
|
||||||
renderer->CreateTexture = D3D_CreateTexture;
|
renderer->CreateTexture = D3D_CreateTexture;
|
||||||
|
renderer->QueryTexturePixels = D3D_QueryTexturePixels;
|
||||||
renderer->SetTexturePalette = D3D_SetTexturePalette;
|
renderer->SetTexturePalette = D3D_SetTexturePalette;
|
||||||
renderer->GetTexturePalette = D3D_GetTexturePalette;
|
renderer->GetTexturePalette = D3D_GetTexturePalette;
|
||||||
renderer->SetTextureColorMod = D3D_SetTextureColorMod;
|
renderer->SetTextureColorMod = D3D_SetTextureColorMod;
|
||||||
|
@ -489,6 +535,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
|
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
|
||||||
SDL_Window *window = SDL_GetWindowFromID(renderer->window);
|
SDL_Window *window = SDL_GetWindowFromID(renderer->window);
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
||||||
|
Uint32 display_format = display->current_mode.format;
|
||||||
D3D_TextureData *data;
|
D3D_TextureData *data;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
|
@ -500,10 +547,25 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
|
|
||||||
texture->driverdata = data;
|
texture->driverdata = data;
|
||||||
|
|
||||||
|
if (SDL_ISPIXELFORMAT_FOURCC(texture->format) &&
|
||||||
|
(texture->format != SDL_PIXELFORMAT_YUY2 ||
|
||||||
|
!D3D_IsTextureFormatAvailable(renderdata->d3d, display_format, texture->format)) &&
|
||||||
|
(texture->format != SDL_PIXELFORMAT_YVYU ||
|
||||||
|
!D3D_IsTextureFormatAvailable(renderdata->d3d, display_format, texture->format))) {
|
||||||
|
data->yuv =
|
||||||
|
SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
|
||||||
|
if (!data->yuv) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
data->format = display->current_mode.format;
|
||||||
|
} else {
|
||||||
|
data->format = texture->format;
|
||||||
|
}
|
||||||
|
|
||||||
result =
|
result =
|
||||||
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
|
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
|
||||||
texture->h, 1, 0,
|
texture->h, 1, 0,
|
||||||
PixelFormatToD3DFMT(texture->format),
|
PixelFormatToD3DFMT(data->format),
|
||||||
D3DPOOL_SDL, &data->texture, NULL);
|
D3DPOOL_SDL, &data->texture, NULL);
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
D3D_SetError("CreateTexture()", result);
|
D3D_SetError("CreateTexture()", result);
|
||||||
|
@ -513,6 +575,20 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
D3D_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
|
void **pixels, int *pitch)
|
||||||
|
{
|
||||||
|
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
||||||
|
|
||||||
|
if (data->yuv) {
|
||||||
|
return SDL_SW_QueryYUVTexturePixels(data->yuv, pixels, pitch);
|
||||||
|
} else {
|
||||||
|
/* D3D textures don't have their pixels hanging out */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
D3D_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
|
D3D_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
const SDL_Color * colors, int firstcolor, int ncolors)
|
const SDL_Color * colors, int firstcolor, int ncolors)
|
||||||
|
@ -578,129 +654,137 @@ D3D_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
|
const SDL_Rect * rect, const void *pixels, int pitch)
|
||||||
|
{
|
||||||
|
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
||||||
|
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
|
||||||
|
|
||||||
|
if (data->yuv) {
|
||||||
|
if (SDL_SW_UpdateYUVTexture(data->yuv, rect, pixels, pitch) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
UpdateYUVTextureData(texture);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
#ifdef SDL_MEMORY_POOL_DEFAULT
|
#ifdef SDL_MEMORY_POOL_DEFAULT
|
||||||
static int
|
IDirect3DTexture9 *temp;
|
||||||
D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
RECT d3drect;
|
||||||
const SDL_Rect * rect, const void *pixels, int pitch)
|
D3DLOCKED_RECT locked;
|
||||||
{
|
const Uint8 *src;
|
||||||
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
Uint8 *dst;
|
||||||
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
|
int row, length;
|
||||||
IDirect3DTexture9 *temp;
|
HRESULT result;
|
||||||
RECT d3drect;
|
|
||||||
D3DLOCKED_RECT locked;
|
|
||||||
const Uint8 *src;
|
|
||||||
Uint8 *dst;
|
|
||||||
int row, length;
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
result =
|
result =
|
||||||
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
|
IDirect3DDevice9_CreateTexture(renderdata->device, texture->w,
|
||||||
texture->h, 1, 0,
|
texture->h, 1, 0,
|
||||||
PixelFormatToD3DFMT(texture->format),
|
PixelFormatToD3DFMT(texture->format),
|
||||||
D3DPOOL_SYSTEMMEM, &temp, NULL);
|
D3DPOOL_SYSTEMMEM, &temp, NULL);
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
D3D_SetError("CreateTexture()", result);
|
D3D_SetError("CreateTexture()", result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
d3drect.left = rect->x;
|
d3drect.left = rect->x;
|
||||||
d3drect.right = rect->x + rect->w;
|
d3drect.right = rect->x + rect->w;
|
||||||
d3drect.top = rect->y;
|
d3drect.top = rect->y;
|
||||||
d3drect.bottom = rect->y + rect->h;
|
d3drect.bottom = rect->y + rect->h;
|
||||||
|
|
||||||
result = IDirect3DTexture9_LockRect(temp, 0, &locked, &d3drect, 0);
|
result = IDirect3DTexture9_LockRect(temp, 0, &locked, &d3drect, 0);
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
|
IDirect3DTexture9_Release(temp);
|
||||||
|
D3D_SetError("LockRect()", result);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
src = pixels;
|
||||||
|
dst = locked.pBits;
|
||||||
|
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
|
||||||
|
for (row = 0; row < rect->h; ++row) {
|
||||||
|
SDL_memcpy(dst, src, length);
|
||||||
|
src += pitch;
|
||||||
|
dst += locked.Pitch;
|
||||||
|
}
|
||||||
|
IDirect3DTexture9_UnlockRect(temp, 0);
|
||||||
|
|
||||||
|
result =
|
||||||
|
IDirect3DDevice9_UpdateTexture(renderdata->device,
|
||||||
|
(IDirect3DBaseTexture9 *) temp,
|
||||||
|
(IDirect3DBaseTexture9 *)
|
||||||
|
data->texture);
|
||||||
IDirect3DTexture9_Release(temp);
|
IDirect3DTexture9_Release(temp);
|
||||||
D3D_SetError("LockRect()", result);
|
if (FAILED(result)) {
|
||||||
return -1;
|
D3D_SetError("UpdateTexture()", result);
|
||||||
}
|
return -1;
|
||||||
|
}
|
||||||
src = pixels;
|
|
||||||
dst = locked.pBits;
|
|
||||||
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
|
|
||||||
for (row = 0; row < rect->h; ++row) {
|
|
||||||
SDL_memcpy(dst, src, length);
|
|
||||||
src += pitch;
|
|
||||||
dst += locked.Pitch;
|
|
||||||
}
|
|
||||||
IDirect3DTexture9_UnlockRect(temp, 0);
|
|
||||||
|
|
||||||
result =
|
|
||||||
IDirect3DDevice9_UpdateTexture(renderdata->device,
|
|
||||||
(IDirect3DBaseTexture9 *) temp,
|
|
||||||
(IDirect3DBaseTexture9 *)
|
|
||||||
data->texture);
|
|
||||||
IDirect3DTexture9_Release(temp);
|
|
||||||
if (FAILED(result)) {
|
|
||||||
D3D_SetError("UpdateTexture()", result);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
static int
|
RECT d3drect;
|
||||||
D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
D3DLOCKED_RECT locked;
|
||||||
const SDL_Rect * rect, const void *pixels, int pitch)
|
const Uint8 *src;
|
||||||
{
|
Uint8 *dst;
|
||||||
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
int row, length;
|
||||||
D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata;
|
HRESULT result;
|
||||||
RECT d3drect;
|
|
||||||
D3DLOCKED_RECT locked;
|
|
||||||
const Uint8 *src;
|
|
||||||
Uint8 *dst;
|
|
||||||
int row, length;
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
d3drect.left = rect->x;
|
d3drect.left = rect->x;
|
||||||
d3drect.right = rect->x + rect->w;
|
d3drect.right = rect->x + rect->w;
|
||||||
d3drect.top = rect->y;
|
d3drect.top = rect->y;
|
||||||
d3drect.bottom = rect->y + rect->h;
|
d3drect.bottom = rect->y + rect->h;
|
||||||
|
|
||||||
result =
|
result =
|
||||||
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
|
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect, 0);
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
D3D_SetError("LockRect()", result);
|
D3D_SetError("LockRect()", result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
src = pixels;
|
src = pixels;
|
||||||
dst = locked.pBits;
|
dst = locked.pBits;
|
||||||
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
|
length = rect->w * SDL_BYTESPERPIXEL(texture->format);
|
||||||
for (row = 0; row < rect->h; ++row) {
|
for (row = 0; row < rect->h; ++row) {
|
||||||
SDL_memcpy(dst, src, length);
|
SDL_memcpy(dst, src, length);
|
||||||
src += pitch;
|
src += pitch;
|
||||||
dst += locked.Pitch;
|
dst += locked.Pitch;
|
||||||
}
|
}
|
||||||
IDirect3DTexture9_UnlockRect(data->texture, 0);
|
IDirect3DTexture9_UnlockRect(data->texture, 0);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif // SDL_MEMORY_POOL_DEFAULT
|
#endif // SDL_MEMORY_POOL_DEFAULT
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
D3D_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
const SDL_Rect * rect, int markDirty, void **pixels,
|
const SDL_Rect * rect, int markDirty, void **pixels,
|
||||||
int *pitch)
|
int *pitch)
|
||||||
{
|
{
|
||||||
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
||||||
RECT d3drect;
|
|
||||||
D3DLOCKED_RECT locked;
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
d3drect.left = rect->x;
|
if (data->yuv) {
|
||||||
d3drect.right = rect->x + rect->w;
|
return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
|
||||||
d3drect.top = rect->y;
|
pitch);
|
||||||
d3drect.bottom = rect->y + rect->h;
|
} else {
|
||||||
|
RECT d3drect;
|
||||||
|
D3DLOCKED_RECT locked;
|
||||||
|
HRESULT result;
|
||||||
|
|
||||||
result =
|
d3drect.left = rect->x;
|
||||||
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
|
d3drect.right = rect->x + rect->w;
|
||||||
markDirty ? 0 : D3DLOCK_NO_DIRTY_UPDATE);
|
d3drect.top = rect->y;
|
||||||
if (FAILED(result)) {
|
d3drect.bottom = rect->y + rect->h;
|
||||||
D3D_SetError("LockRect()", result);
|
|
||||||
return -1;
|
result =
|
||||||
|
IDirect3DTexture9_LockRect(data->texture, 0, &locked, &d3drect,
|
||||||
|
markDirty ? 0 : D3DLOCK_NO_DIRTY_UPDATE);
|
||||||
|
if (FAILED(result)) {
|
||||||
|
D3D_SetError("LockRect()", result);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*pixels = locked.pBits;
|
||||||
|
*pitch = locked.Pitch;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
*pixels = locked.pBits;
|
|
||||||
*pitch = locked.Pitch;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -708,7 +792,12 @@ D3D_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
{
|
{
|
||||||
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
D3D_TextureData *data = (D3D_TextureData *) texture->driverdata;
|
||||||
|
|
||||||
IDirect3DTexture9_UnlockRect(data->texture, 0);
|
if (data->yuv) {
|
||||||
|
SDL_SW_UnlockYUVTexture(data->yuv);
|
||||||
|
UpdateYUVTextureData(texture);
|
||||||
|
} else {
|
||||||
|
IDirect3DTexture9_UnlockRect(data->texture, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1066,6 +1155,9 @@ D3D_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (data->yuv) {
|
||||||
|
SDL_SW_DestroyYUVTexture(data->yuv);
|
||||||
|
}
|
||||||
if (data->texture) {
|
if (data->texture) {
|
||||||
IDirect3DTexture9_Release(data->texture);
|
IDirect3DTexture9_Release(data->texture);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue