Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added a renderer flag to expose whether a renderer supports render to…

… texture.
  • Loading branch information
slouken committed Jan 20, 2012
1 parent fe84d39 commit d20fed8f47c5c0c1b285cd8442511ce246a2f635
@@ -65,8 +65,10 @@ typedef enum
SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */
SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware
acceleration */
SDL_RENDERER_PRESENTVSYNC = 0x00000004 /**< Present is synchronized
SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized
with the refresh rate */
SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports
rendering to texture */
} SDL_RendererFlags;

/**
@@ -1153,10 +1153,10 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
SDL_bool
SDL_RenderTargetSupported(SDL_Renderer *renderer)
{
if ((!renderer) || (!renderer->SetTargetTexture)) {
if (!renderer || !renderer->SetTargetTexture) {
return SDL_FALSE;
}
return SDL_TRUE;
return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0;
}

int
@@ -122,7 +122,7 @@ SDL_RenderDriver D3D_RenderDriver = {
D3D_CreateRenderer,
{
"direct3d",
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
1,
{SDL_PIXELFORMAT_ARGB8888},
0,
@@ -406,7 +406,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info = D3D_RenderDriver.info;
renderer->driverdata = data;

renderer->info.flags = SDL_RENDERER_ACCELERATED;
renderer->info.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;

SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(window, &windowinfo);
@@ -76,7 +76,7 @@ SDL_RenderDriver GL_RenderDriver = {
GL_CreateRenderer,
{
"opengl",
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
1,
{SDL_PIXELFORMAT_ARGB8888},
0,
@@ -321,7 +321,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->DestroyTexture = GL_DestroyTexture;
renderer->DestroyRenderer = GL_DestroyRenderer;
renderer->info = GL_RenderDriver.info;
renderer->info.flags = SDL_RENDERER_ACCELERATED;
renderer->info.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
renderer->driverdata = data;
renderer->window = window;

@@ -89,7 +89,7 @@ SDL_RenderDriver GLES_RenderDriver = {
GLES_CreateRenderer,
{
"opengles",
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
1,
{SDL_PIXELFORMAT_ABGR8888},
0,
@@ -372,7 +372,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->DestroyTexture = GLES_DestroyTexture;
renderer->DestroyRenderer = GLES_DestroyRenderer;
renderer->info = GLES_RenderDriver.info;
renderer->info.flags = SDL_RENDERER_ACCELERATED;
renderer->info.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
renderer->driverdata = data;
renderer->window = window;
renderer->SetTargetTexture = GLES_SetTargetTexture;
@@ -40,7 +40,7 @@ SDL_RenderDriver GLES2_RenderDriver = {
GLES2_CreateRenderer,
{
"opengles2",
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
(SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE),
4,
{SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_ARGB8888,
@@ -1447,7 +1447,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
return NULL;
}
renderer->info = GLES2_RenderDriver.info;
renderer->info.flags = SDL_RENDERER_ACCELERATED;
renderer->info.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
renderer->driverdata = rdata;
renderer->window = window;

0 comments on commit d20fed8

Please sign in to comment.