Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
f8247546
Commit
f8247546
authored
Feb 05, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the SDL_HINT_RENDER_DRIVER and SDL_HINT_RENDER_VSYNC hints.
parent
37f40cdb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
5 deletions
+51
-5
SDL_hints.h
include/SDL_hints.h
+26
-0
SDL_render.c
src/render/SDL_render.c
+17
-5
SDL_video.c
src/video/SDL_video.c
+8
-0
No files found.
include/SDL_hints.h
View file @
f8247546
...
...
@@ -67,6 +67,32 @@ extern "C" {
*/
#define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION"
/**
* \brief A variable specifying which render driver to use.
*
* If the application doesn't pick a specific renderer to use, this variable
* specifies the name of the preferred renderer. If the preferred renderer
* can't be initialized, the normal default renderer is used.
*
* This variable is case insensitive and can be set to the following values:
* "direct3d"
* "opengl"
* "opengles"
* "software"
*/
#define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER"
/**
* \brief A variable controlling whether updates to the SDL 1.2 screen surface should be synchronized with the vertical refresh, to avoid tearing.
*
* This variable can be set to the following values:
* "0" - Disable vsync
* "1" - Enable vsync
*
* By default SDL does not sync screen surface updates with vertical refresh.
*/
#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC"
/**
* \brief An enumeration of hint priorities
...
...
src/render/SDL_render.c
View file @
f8247546
...
...
@@ -23,6 +23,7 @@
/* The SDL 2D rendering system */
#include "SDL_hints.h"
#include "SDL_render.h"
#include "SDL_sysrender.h"
#include "../video/SDL_pixels_c.h"
...
...
@@ -94,21 +95,32 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
{
SDL_Renderer
*
renderer
=
NULL
;
int
n
=
SDL_GetNumRenderDrivers
();
const
char
*
hint
;
if
(
index
<
0
)
{
char
*
override
=
SDL_getenv
(
"SDL_VIDEO_RENDERER"
);
hint
=
SDL_GetHint
(
SDL_HINT_RENDER_VSYNC
);
if
(
hint
)
{
if
(
*
hint
==
'0'
)
{
flags
&=
~
SDL_RENDERER_PRESENTVSYNC
;
}
else
{
flags
|=
SDL_RENDERER_PRESENTVSYNC
;
}
}
if
(
override
)
{
if
(
index
<
0
)
{
hint
=
SDL_GetHint
(
SDL_HINT_RENDER_DRIVER
);
if
(
hint
)
{
for
(
index
=
0
;
index
<
n
;
++
index
)
{
const
SDL_RenderDriver
*
driver
=
render_drivers
[
index
];
if
(
SDL_strcasecmp
(
override
,
driver
->
info
.
name
)
==
0
)
{
if
(
SDL_strcasecmp
(
hint
,
driver
->
info
.
name
)
==
0
)
{
/* Create a new renderer instance */
renderer
=
driver
->
CreateRenderer
(
window
,
flags
);
break
;
}
}
}
else
{
}
if
(
!
renderer
)
{
for
(
index
=
0
;
index
<
n
;
++
index
)
{
const
SDL_RenderDriver
*
driver
=
render_drivers
[
index
];
...
...
src/video/SDL_video.c
View file @
f8247546
...
...
@@ -117,6 +117,14 @@ ShouldUseTextureFramebuffer()
return
SDL_TRUE
;
}
/* If the user has specified a software renderer we can't use a
texture framebuffer, or renderer creation will go recursive.
*/
hint
=
SDL_GetHint
(
SDL_HINT_RENDER_DRIVER
);
if
(
hint
&&
SDL_strcasecmp
(
hint
,
"software"
)
==
0
)
{
return
SDL_FALSE
;
}
/* See if the user or application wants a specific behavior */
hint
=
SDL_GetHint
(
SDL_HINT_FRAMEBUFFER_ACCELERATION
);
if
(
hint
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment