Graphics/Audio Driver selection at runtime

Hi,

I am starting to work with SDL.

I want my users to be able to select from all drivers (video and audio)
compiled into the SDL Library, so that they can select the driver with
the best features/performance.

I know this can be done by setting the “SDL_VIDEODRIVER” and
"SDL_AUDIODRIVER" environment variables.

I would prefer my users do this by either passing options on the command
line, or having settings in a configuration file.

I would like a modified SDL_InitSubSystem to allow the required names of
the Audio and Video Driver to use to be explicitly declared, and not
just auto probed. Null, or an empty string would auto probe as it does
now. And this would be a copy of SDL_InitSubSystem, renamed something like:

SDL_InitSubSystem_Drivers(flags, VideoDriver, AudioDriver);

then SDL_InitSubSystem would just call SDL_InitSubSystem_Drivers, with
empty entries for VideoDriver and AudioDriver. To maintain complete
compatibility with the current api.

To go with this, i would like to add a function to enumerate drivers, so
its possible at run time to discover what drivers a particular library
supports. A Function something like:

SDL_EnumerateDriver(Type, Index, **Name, **Description) returns True if
its available to be used. False if its in the SDL Library, but not
available to be used.

Type would be “Audio” or “Video”. Index, an increasing number. **Name is
set null if at the end of the list, Description likewise. Name and
Description just get set to the constants from the bootstrap table.

Then the program could display the available drivers, and the user could
select the video method they wanted for best performance.

Or something like that. The purpose of this post is for comments before
I do anything.

Thanks for any comments or pointers.

Also, should i do this work against 1.2.9 or CVS version? Whats the
process for patch approval?

Steven Johnson

[…]

I would like a modified SDL_InitSubSystem to allow the required names of
the Audio and Video Driver to use to be explicitly declared, and not
just auto probed. Null, or an empty string would auto probe as it does
now. And this would be a copy of SDL_InitSubSystem, renamed something
like:

SDL_InitSubSystem_Drivers(flags, VideoDriver, AudioDriver);

There are already
SDL_VideoInit(const char *driver_name, Uint32 flags);
SDL_AudioInit(const char *driver_name);

though it is mentioned that you should have good reasons to use them.

[…]

To go with this, i would like to add a function to enumerate drivers, so
its possible at run time to discover what drivers a particular library
supports.

Don’t know about this one.

Regards,
Johannes

< http://libufo.sourceforge.net > The OpenGL GUI ToolkitOn Thursday 15 September 2005 08:30, Steven Johnson wrote:

You can parse options before initializing SDL and fixes the environment vars
using SDL_putenv in your program just before calling SDL_InitSubSystem. This
function is available for this usage.On 9/15/05, Steven Johnson wrote:

Hi,

I am starting to work with SDL.

I want my users to be able to select from all drivers (video and audio)
compiled into the SDL Library, so that they can select the driver with
the best features/performance.

I know this can be done by setting the “SDL_VIDEODRIVER” and
"SDL_AUDIODRIVER" environment variables.

I would prefer my users do this by either passing options on the command
line, or having settings in a configuration file.

I would like a modified SDL_InitSubSystem to allow the required names of
the Audio and Video Driver to use to be explicitly declared, and not
just auto probed. Null, or an empty string would auto probe as it does
now. And this would be a copy of SDL_InitSubSystem, renamed something
like:

SDL_InitSubSystem_Drivers(flags, VideoDriver, AudioDriver);

then SDL_InitSubSystem would just call SDL_InitSubSystem_Drivers, with
empty entries for VideoDriver and AudioDriver. To maintain complete
compatibility with the current api.

To go with this, i would like to add a function to enumerate drivers, so
its possible at run time to discover what drivers a particular library
supports. A Function something like:

SDL_EnumerateDriver(Type, Index, **Name, **Description) returns True if
its available to be used. False if its in the SDL Library, but not
available to be used.

Type would be “Audio” or “Video”. Index, an increasing number. **Name is
set null if at the end of the list, Description likewise. Name and
Description just get set to the constants from the bootstrap table.

Then the program could display the available drivers, and the user could
select the video method they wanted for best performance.

Or something like that. The purpose of this post is for comments before
I do anything.

Thanks for any comments or pointers.

Also, should i do this work against 1.2.9 or CVS version? Whats the
process for patch approval?

Steven Johnson


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Olivier Delannoy wrote:

You can parse options before initializing SDL and fixes the
environment vars using SDL_putenv in your program just before calling
SDL_InitSubSystem. This function is available for this usage.

I appreciate I can do this, it was my first thought. It just seems a
little bit Kludgey to me, that is all. It also still doesnt allow my
application to probe the available drivers, so the end user knows what
the currently available selections are. So the thought was, if i add
any routines to probe, why not add a “not so kuldgy” way of selecting
those drivers, rather than force environment variables.

Is there any real problem with the suggestion? I wouldnt break any API
compatibility with anything suggested.

Also, I would really need to know which version I should develop against
1.2.9 or CVS, and what is the protocol for submitting patches?

Thanks,
Steven>

On 9/15/05, Steven Johnson <SDL at sakuraindustries.com <mailto:SDL at sakuraindustries.com>> wrote:

Hi,

I am starting to work with SDL.

I want my users to be able to select from all drivers (video and
audio)
compiled into the SDL Library, so that they can select the driver with
the best features/performance.

I know this can be done by setting the "SDL_VIDEODRIVER" and
"SDL_AUDIODRIVER" environment variables.

I would prefer my users do this by either passing options on the
command
line, or having settings in a configuration file.

I would like a modified SDL_InitSubSystem to allow the required
names of
the Audio and Video Driver to use  to be explicitly declared, and not
just auto probed.  Null, or an empty string would auto probe as it
does
now.  And this would be a copy of SDL_InitSubSystem, renamed
something like:

SDL_InitSubSystem_Drivers(flags, VideoDriver, AudioDriver);

then SDL_InitSubSystem would just call SDL_InitSubSystem_Drivers,
with
empty entries for VideoDriver and AudioDriver.  To maintain complete
compatibility with the current api.

To go with this, i would like to add a function to enumerate
drivers, so
its possible at run time to discover what drivers a particular
library
supports.  A Function something like:

SDL_EnumerateDriver(Type, Index, **Name, **Description) returns
True if
its available to be used.  False if its in the SDL Library, but not
available to be used.

Type would be "Audio" or "Video". Index, an increasing number.
**Name is
set null if at the end of the list, Description likewise.  Name and
Description just get set to the constants from the bootstrap table.

Then the program could display the available drivers, and the user
could
select the video method they wanted for best performance.

Or something like that.  The purpose of this post is for comments
before
I do anything.

Thanks for any comments or pointers.

Also, should i do this work against 1.2.9 or CVS version?  Whats the
process for patch approval?

Steven Johnson

_______________________________________________
SDL mailing list
SDL at libsdl.org <mailto:SDL at libsdl.org>
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Olivier Delannoy wrote:

You can parse options before initializing SDL and fixes the
environment vars using SDL_putenv in your program just before calling
SDL_InitSubSystem. This function is available for this usage.

I appreciate I can do this, it was my first thought. It just seems a
little bit Kludgey to me, that is all. It also still doesnt allow my
application to probe the available drivers, so the end user knows what
the currently available selections are. So the thought was, if i add
any routines to probe, why not add a “not so kuldgy” way of selecting
those drivers, rather than force environment variables.

Is there any real problem with the suggestion? I wouldnt break any API
compatibility with anything suggested.

I dunno what your suggestion was, but just wanna point out that much more
important than API compatibility is ABI compatibility.

SDL ensures binary compatibility for major releases. Breaking it should be
due to 2.0.

Cheers,
RicardoEm Sexta, 16 de Setembro de 2005 12:13, o Steven Johnson escreveu:

Also, I would really need to know which version I should develop against
1.2.9 or CVS, and what is the protocol for submitting patches?

Thanks,
Steven

On 9/15/05, Steven Johnson <SDL at sakuraindustries.com <mailto:SDL at sakuraindustries.com>> wrote:

Hi,

I am starting to work with SDL.

I want my users to be able to select from all drivers (video and
audio)
compiled into the SDL Library, so that they can select the driver

with the best features/performance.

I know this can be done by setting the "SDL_VIDEODRIVER" and
"SDL_AUDIODRIVER" environment variables.

I would prefer my users do this by either passing options on the
command
line, or having settings in a configuration file.

I would like a modified SDL_InitSubSystem to allow the required
names of
the Audio and Video Driver to use  to be explicitly declared, and not
just auto probed.  Null, or an empty string would auto probe as it
does
now.  And this would be a copy of SDL_InitSubSystem, renamed
something like:

SDL_InitSubSystem_Drivers(flags, VideoDriver, AudioDriver);

then SDL_InitSubSystem would just call SDL_InitSubSystem_Drivers,
with
empty entries for VideoDriver and AudioDriver.  To maintain complete
compatibility with the current api.

To go with this, i would like to add a function to enumerate
drivers, so
its possible at run time to discover what drivers a particular
library
supports.  A Function something like:

SDL_EnumerateDriver(Type, Index, **Name, **Description) returns
True if
its available to be used.  False if its in the SDL Library, but not
available to be used.

Type would be "Audio" or "Video". Index, an increasing number.
**Name is
set null if at the end of the list, Description likewise.  Name and
Description just get set to the constants from the bootstrap table.

Then the program could display the available drivers, and the user
could
select the video method they wanted for best performance.

Or something like that.  The purpose of this post is for comments
before
I do anything.

Thanks for any comments or pointers.

Also, should i do this work against 1.2.9 or CVS version?  Whats the
process for patch approval?

Steven Johnson

_______________________________________________
SDL mailing list
SDL at libsdl.org <mailto:SDL at libsdl.org>
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


“The only real way to look younger is not to be born so soon.”
– Charles Schulz, “Things I’ve Had to Learn Over and
Over and Over”

SDL ensures binary compatibility for major releases. Breaking it should be
due to 2.0.

Adding functions doesn’t break backwards compatibility; we’ve added
several things in the past few releases (such as the dynamic loading
API, etc).

A better concern is “How do you prompt the user for which video driver
they want to use before they can draw things to the screen?”

–ryan.

This would obviously be a concern for each application. But in my case,
i was thinking of allowing the driver to be selected at runtime, as a
command line argument. And a second command line argument to display
the available drivers on the console, and then exit.

But you could, alternatively, start up using the default selected driver
and then in you app, produce a configuration screen, to select one of
the available drivers, like you would with available screen resolutions,
etc. Save this selection to a config file of some sorts, and then
restart the application. This is much more than i need to do, for my
application, but it could be the way to go with a game.

Steven

Ryan C. Gordon wrote:>> SDL ensures binary compatibility for major releases. Breaking it should be

due to 2.0.

Adding functions doesn’t break backwards compatibility; we’ve added
several things in the past few releases (such as the dynamic loading
API, etc).

A better concern is “How do you prompt the user for which video driver
they want to use before they can draw things to the screen?”

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl