Commit fd618abe authored by Sam Lantinga's avatar Sam Lantinga

Date: Mon, 23 Mar 2009 09:17:24 +0200

From: "Mike Gorchak"
Subject: New QNX patches

Please apply patch qnx4.diff, which is attached. What has been done:
1)Added back OpenGL ES renderer for QNX target. Added few corrections to
OpenGL ES renderer to let it work under QNX. OpenGL ES renderer do not
support textures under QNX, so I think some additional work must be done.
2) Added GL_OES_query_matrix extension to SDL_opengles.h header file, which
required by OpenGL ES 1.1 specification.
3) Added attribute clearing at the entrance of function
SDL_GL_GetAttribure(). Added error checking into the function
SDL_GL_GetAttribure(), because some attributes can't be obtained in OpenGL
ES 1.0.
4) Porting testdyngles to OpenGL ES 1.0 (1.1 has glColor4ub() and
glColor4f() functions, but 1.0 has glColor4f() only).
5) Added error checking after obtaining attributes using
SDL_GL_GetAttribute() function to the testgl2 and testgles.
6) Small correction to testmultiaudio with printing errors.
7) Added software and accelerated OpenGL ES 1.0 support into the QNX GF
driver.

Please remove ./src/audio/nto directory - it will not be used anymore.
Please create ./src/audio/qsa directory and add content of the archive
qsa.tar.gz into this directory. I rewrote some sound code, added support for
multiple audio cards, enumeration, etc. Added initial support for capture.

As far as I can understand SDL 1.3 is not supporting audio capture right now
? Sam, Am I right ? Or audio capture must be supported through the
PlayDevice routine ?

And last, please put file SDL_gf_opengles.c to  the ./src/video/qnxgf
directory. It is OpenGL ES 1.1 emulation layer for some functions, which are
not supported by OpenGL ES 1.0.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403566
parent 0543b444
README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
Last changed at 10 Mar 2009.
Last changed at 22 Mar 2009.
QNX Photon and GF drivers are under construction. Please be patient.
QNX Photon and GF drivers are being constructed.
QNX QSA (QNX Sound Architecture) driver is ready.
QNX CDROM driver is ready.
QNX HID input driver is being constructed.
----------------------
-- SDL QSA driver --
----------------------
Due to QNX Sound Architecture limitations software could not determine
what playback channels are designed for, so some casus can be. For example,
output after testmultiaudio test utility execution:
Using audio driver: qsa
playing on device #0: ('Vortex 8820 @ fb000000 d0')...done.
playing on device #1: ('Vortex 8820 @ fb000000 d1')...done.
playing on device #2: ('i8x0 @ d800 d0')...done.
playing on device #3: ('i8x0 @ d800 d1')...done.
playing on all devices...
Open device 3 failed: QSA: snd_pcm_channel_params failed: Invalid argument
If speakers are connected to both audio cards: Vortex 8820 and Intel
Integrated Audio we can hear sound playback on device #0 and devices #2, #3
only. Device #1 is an unknown PCM channel which does not produce any sound.
As for error during device #3 opening, it's caused by QSA software mixer
channel, because it can't open real hardware device #2, since it's already
opened by SDL.
After simultaneous sound playback on all devices utility testmultiaudio
stays running waiting for sound playback finish on device #1, which is
locked up due to some Aureal Vortex 8820 driver limitations.
---------------------
-- SDL GF driver --
......@@ -15,43 +46,61 @@ Here is an additional information about SDL GF driver:
0. Introduction.
SDL GF driver is a layer between SDL and QNX Graphics Framework (GF). Hardware
accelerated features which SDL could support depends on real hardware capabilities.
SDL GF driver is a layer between SDL and QNX Graphics Framework (GF).
SDL GF driver also supports OpenGL ES through the QNX Graphics Framework.
Hardware accelerated features which SDL can support depend on real hardware
capabilities.
1. Environment variables which GF driver supports.
GF driver supports the following environment variables for QNX GF specific
customization options:
a) SDL_VIDEO_GF_REFRESH_RATE - refresh rate of video output in Hz. Without
this environment variable declaration SDL controls refresh rate of your
display. If this enironment variable is set to 0, SDL will control refresh
rate of display, otherwise value of SDL_VIDEO_GF_REFRESH_RATE is used for
all screen resolutions as refresh rate. This example will set 60Hz refresh
rate as refresh rate for all graphics modes:
GF driver supports the following environment variables for QNX GF
specific customization options:
a) SDL_VIDEO_GF_REFRESH_RATE - refresh rate of video output in Hz.
Without this environment variable declaration SDL controls refresh
rate of your display. If this enironment variable is set to 0, SDL
will control refresh rate of display, otherwise value of flag
SDL_VIDEO_GF_REFRESH_RATE is used for all screen resolutions as
refresh rate. This example will set 60Hz refresh rate as refresh rate
for all graphics modes:
export SDL_VIDEO_GF_REFRESH_RATE=60
2. Custom video modes.
Since most QNX graphics drivers supports GENERIC video modes, i.e. you could
specify any horizontal and vertical resolution and any refresh rate, SDL GF
driver uses its own fullscreen modes list, which could be incomplete. You could
add any custom video mode, which your QNX graphics driver supports by editing
file ./src/video/qnxgf/SDL_qnxgf.c. Custom graphics mode definition looks like
Since most QNX graphics drivers support GENERIC video modes, i.e. you
can specify any horizontal and vertical resolution and any refresh rate,
SDL GF driver uses its own fullscreen modes list, which can be incomplete.
You can add any custom video mode, which your QNX graphics driver supports
by editing file ./src/video/qnxgf/SDL_qnxgf.c. Custom graphics mode
definition looks like this:
{0, 1024, 640, 60, NULL}, /* 1024x640 mode is 60Hz only */
You must specify horizontal resolution as second parameter, vertical resolution
as third parameter and refresh rate as fourth parameter. Please leave first and
last parameters as 0 and NULL. Then please send me your changes to e-mail address
which is specified in the header of this document.
You must specify horizontal resolution as the second parameter, vertical
resolution as the third one and refresh rate as the fourth parameter.
Please leave the first and the last parameters as 0 and NULL. Then send me
your changes to e-mail address which is specified in the header of this
document.
3. Limitations.
There are few limitations while using SDL GF driver:
a) Since GF driver supports fullscreen modes only, when you are not specifing
SDL_WINDOW_FULLSCREEN flag, an SDL GF driver will try to find the fullscreen
graphics mode which corresponds to SDL window size. Refresh rate will be the
lowest available, if SDL_VIDEO_GF_REFRESH_RATE environment variable is not set.
a) Since GF driver supports fullscreen modes only, when flag
SDL_WINDOW_FULLSCREEN is not specified, SDL GF driver will try to find the
fullscreen graphics mode which corresponds to SDL window size. Refresh rate
will be the lowest available, if SDL_VIDEO_GF_REFRESH_RATE environment
variable is not set.
b) As confirmed by QSSL none of existing video drivers has support of
doublescan low-resolution video modes. So modes below 640x480 are not
supported. If your video driver supports low-resolution video modes, please
add SDL_GF_LOWRESOLUTION flag to the gf_devicename array in the SDL_qnxgf.c
source file.
-------------------------
-- SDL Photon driver --
-------------------------
----------------------------
-- SDL HID input driver --
----------------------------
......@@ -1705,6 +1705,7 @@ CheckOpenGLESQNX()
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_ES)
AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CM"
else
AC_MSG_CHECKING(for QNX OpenGL ES (CL) support)
......@@ -1719,7 +1720,8 @@ CheckOpenGLESQNX()
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_ES)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CL"
AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGLES_CLS"
fi
fi
fi
......@@ -2501,8 +2503,8 @@ case "$host" in
# Set up files for the audio library
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_QNXNTO)
SOURCES="$SOURCES $srcdir/src/audio/nto/*.c"
AC_DEFINE(SDL_AUDIO_DRIVER_QSA)
SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
have_audio=yes
fi
......
......@@ -193,7 +193,7 @@
#undef SDL_AUDIO_DRIVER_OSS
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
#undef SDL_AUDIO_DRIVER_PAUDIO
#undef SDL_AUDIO_DRIVER_QNXNTO
#undef SDL_AUDIO_DRIVER_QSA
#undef SDL_AUDIO_DRIVER_SNDMGR
#undef SDL_AUDIO_DRIVER_SUNAUDIO
#undef SDL_AUDIO_DRIVER_WINWAVEOUT
......
......@@ -962,6 +962,12 @@ extern "C"
const GLvoid * pointer);
#endif
/* GL_OES_query_matrix */
#ifndef GL_OES_query_matrix
#define GL_OES_query_matrix 1
GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]);
#endif /* GL_OES_query_matrix */
/* GL_OES_point_sprite */
#ifndef GL_OES_point_sprite
#define GL_OES_point_sprite 1
......
......@@ -49,7 +49,7 @@ extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap DMA_bootstrap;
extern AudioBootStrap ALSA_bootstrap;
extern AudioBootStrap PULSEAUDIO_bootstrap;
extern AudioBootStrap QNXNTOAUDIO_bootstrap;
extern AudioBootStrap QSAAUDIO_bootstrap;
extern AudioBootStrap SUNAUDIO_bootstrap;
extern AudioBootStrap DMEDIA_bootstrap;
extern AudioBootStrap ARTS_bootstrap;
......@@ -91,8 +91,8 @@ static AudioBootStrap *bootstrap[] = {
&DSP_bootstrap,
&DMA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_QNXNTO
&QNXNTOAUDIO_bootstrap,
#if SDL_AUDIO_DRIVER_QSA
&QSAAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_SUNAUDIO
&SUNAUDIO_bootstrap,
......
This diff is collapsed.
This diff is collapsed.
......@@ -18,36 +18,45 @@
Sam Lantinga
slouken@libsdl.org
QNX Sound Architecture (QSA) SDL driver
Copyright (C) 2009 Mike Gorchak
(mike@malva.ua, lestat@i.com.ua)
*/
#include "SDL_config.h"
#ifndef __SDL_NTO_AUDIO_H__
#define __SDL_NTO_AUDIO_H__
#ifndef __SDL_QSA_AUDIO_H__
#define __SDL_QSA_AUDIO_H__
#include <sys/asoundlib.h>
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
#define _THIS SDL_AudioDevice* this
struct SDL_PrivateAudioData
{
/* SDL capture state */
int iscapture;
/* The audio device handle */
int cardno;
int deviceno;
snd_pcm_t *audio_handle;
snd_pcm_t* audio_handle;
/* The audio file descriptor */
int audio_fd;
/* The parent process id, to detect when application quits */
pid_t parent;
/* Select timeout status */
uint32_t timeout_on_wait;
/* Raw mixing buffer */
Uint8 *pcm_buf;
Uint8* pcm_buf;
Uint32 pcm_len;
};
#endif /* __SDL_NTO_AUDIO_H__ */
#endif /* __SDL_QSA_AUDIO_H__ */
/* vi: set ts=4 sw=4 expandtab: */
......@@ -30,6 +30,17 @@
#include "SDL_rect_c.h"
#include "SDL_yuv_sw_c.h"
#ifdef __QNXNTO__
/* Empty function stub to get OpenGL ES 1.0 support without */
/* OpenGL ES extension GL_OES_draw_texture_supported */
GL_API void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
{
return;
}
#endif /* __QNXNTO__ */
/* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
static const float inv255f = 1.0f / 255.0f;
......@@ -349,6 +360,7 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GLenum format, type;
int texture_w, texture_h;
GLenum result;
switch (texture->format) {
case SDL_PIXELFORMAT_INDEX1LSB:
case SDL_PIXELFORMAT_INDEX1MSB:
......@@ -479,8 +491,6 @@ static void
SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
int pitch)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
renderdata->glBindTexture(data->type, data->texture);
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
......@@ -888,6 +898,6 @@ GLES_DestroyRenderer(SDL_Renderer * renderer)
SDL_free(renderer);
}
#endif /* SDL_VIDEO_RENDER_OGL */
#endif /* SDL_VIDEO_RENDER_OGL_ES */
/* vi: set ts=4 sw=4 expandtab: */
......@@ -2711,12 +2711,23 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
GLenum (APIENTRY * glGetErrorFunc) (void);
GLenum attrib = 0;
GLenum error = 0;
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if (!glGetIntegervFunc) {
return -1;
}
glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
if (!glGetErrorFunc) {
return -1;
}
/* Clear value in any case */
*value=0;
switch (attr) {
case SDL_GL_RETAINED_BACKING:
*value = _this->gl_config.retained_backing;
......@@ -2738,11 +2749,10 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
attrib = GL_DOUBLEBUFFER;
break;
#else
/*
* I believe double buffering is the only option in OpenGL ES
* -- in any case, GL_DOUBLEBUFFER doesn't exist
*/
*value = 1;
/* OpenGL ES 1.0 and above specifications have EGL_SINGLE_BUFFER */
/* parameter which switches double buffer to single buffer. OpenGL ES */
/* SDL driver must set proper value after initialization */
*value = _this->gl_config.double_buffer;
return 0;
#endif
case SDL_GL_DEPTH_SIZE:
......@@ -2824,6 +2834,29 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
}
glGetIntegervFunc(attrib, (GLint *) value);
error=glGetErrorFunc();
if (error!=GL_NO_ERROR)
{
switch (error)
{
case GL_INVALID_ENUM:
{
SDL_SetError("OpenGL error: GL_INVALID_ENUM");
}
break;
case GL_INVALID_VALUE:
{
SDL_SetError("OpenGL error: GL_INVALID_VALUE");
}
break;
default:
{
SDL_SetError("OpenGL error: %08X", error);
}
break;
}
return -1;
}
return 0;
#else
SDL_Unsupported();
......
Date: Mon, 23 Mar 2009 09:17:24 +0200
From: "Mike Gorchak" <mike@malva.ua>
To: "Sam Lantinga" <slouken@devolution.com>
Subject: New QNX patches
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
QNX Graphics Framework SDL driver
Copyright (C) 2009 Mike Gorchak
(mike@malva.ua, lestat@i.com.ua)
*/
#include <GLES/gl.h>
#include <GLES/glext.h>
/* This is OpenGL ES 1.0 helper functions from OpenGL ES 1.1 specification, */
/* which could be implemented independently from hardware, just wrappers */
GLAPI void APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
{
glTexParameterx(target, pname, (GLfixed)param);
return;
}
GLAPI void APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
{
/* Retrieve one parameter only */
glTexParameterx(target, pname, (GLfixed)*params);
return;
}
GLAPI void APIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
{
glColor4f(((GLfloat)red)/255.f, ((GLfloat)green)/255.f, ((GLfloat)blue)/255.f, ((GLfloat)alpha)/255.f);
return;
}
......@@ -103,6 +103,13 @@ static SDL_Renderer* gf_createrenderer(SDL_Window* window, Uint32 flags)
int32_t jt;
int32_t status;
/* Check if it is OpenGL ES window */
if ((window->flags & SDL_WINDOW_OPENGL)==SDL_WINDOW_OPENGL)
{
/* No error, just no need to create 2D renderer for OpenGL ES window */
return NULL;
}
/* Allocate new renderer structure */
renderer=(SDL_Renderer*)SDL_calloc(1, sizeof(SDL_Renderer));
if (renderer==NULL)
......
This diff is collapsed.
......@@ -30,12 +30,22 @@
#include "../SDL_sysvideo.h"
#include <gf/gf.h>
#include <gf/gf3d.h>
#if defined(SDL_VIDEO_OPENGL_ES)
#include <GLES/egl.h>
#endif /* SDL_VIDEO_OPENGL_ES */
typedef struct SDL_VideoData
{
gf_dev_t gfdev; /* GF device handle */
gf_dev_info_t gfdev_info; /* GF device information */
SDL_bool gfinitialized; /* GF device initialization status */
#if defined(SDL_VIDEO_OPENGL_ES)
EGLDisplay egldisplay; /* OpenGL ES display connection */
uint32_t egl_refcount; /* OpenGL ES reference count */
uint32_t swapinterval; /* OpenGL ES default swap interval */
#endif /* SDL_VIDEO_OPENGL_ES */
} SDL_VideoData;
#define SDL_VIDEO_GF_DEVICENAME_MAX 257
......@@ -55,9 +65,23 @@ typedef struct SDL_DisplayData
typedef struct SDL_WindowData
{
SDL_bool uses_gles; /* if true window must support OpenGL ES*/
SDL_bool uses_gles; /* true if window support OpenGL ES */
#if defined(SDL_VIDEO_OPENGL_ES)
gf_3d_target_t target; /* OpenGL ES window target */
SDL_bool target_created; /* GF 3D target is created if true */
EGLConfig gles_config; /* OpenGL ES framebuffer configuration*/
EGLContext gles_context; /* OpenGL ES context */
EGLint gles_attributes[256]; /* OpenGL ES attributes for context */
EGLSurface gles_surface; /* OpenGL ES target rendering surface */
#endif /* SDL_VIDEO_OPENGL_ES */
} SDL_WindowData;
typedef struct SDL_GLDriverData
{
#if defined(SDL_VIDEO_OPENGL_ES)
#endif /* SDL_VIDEO_OPENGL_ES */
} SDL_GLDriverData;
/****************************************************************************/
/* Low level GF graphics driver capabilities */
/****************************************************************************/
......@@ -69,6 +93,10 @@ typedef struct GF_DeviceCaps
#define SDL_GF_UNACCELERATED 0x00000000
#define SDL_GF_ACCELERATED 0x00000001
#define SDL_GF_NOLOWRESOLUTION 0x00000000
#define SDL_GF_LOWRESOLUTION 0x00000002
#define SDL_GF_UNACCELERATED_3D 0x00000000
#define SDL_GF_ACCELERATED_3D 0x00000004
/****************************************************************************/
/* SDL_VideoDevice functions declaration */
......
......@@ -65,7 +65,7 @@ typedef struct
void (APIENTRY * glClear) (GLbitfield);
void (APIENTRY * glDisable) (GLenum);
void (APIENTRY * glEnable) (GLenum);
void (APIENTRY * glColor4ub) (GLubyte, GLubyte, GLubyte, GLubyte);
void (APIENTRY * glColor4f) (GLfloat, GLfloat, GLfloat, GLfloat);
void (APIENTRY * glPointSize) (GLfloat);
void (APIENTRY * glHint) (GLenum, GLenum);
void (APIENTRY * glBlendFunc) (GLenum, GLenum);
......@@ -89,7 +89,7 @@ init_glfuncs(glfuncs * f)
f->glClear = get_funcaddr("glClear");
f->glDisable = get_funcaddr("glDisable");
f->glEnable = get_funcaddr("glEnable");
f->glColor4ub = get_funcaddr("glColor4ub");
f->glColor4f = get_funcaddr("glColor4f");
f->glPointSize = get_funcaddr("glPointSize");
f->glHint = get_funcaddr("glHint");
f->glBlendFunc = get_funcaddr("glBlendFunc");
......@@ -118,6 +118,10 @@ main(int argc, char *argv[])
/* you may want to change these according to the platform */
video_w = 320;
video_h = 480;
#ifdef __QNXNTO__
video_h = 640;
video_w = 480;
#endif /* __QNXNTO__ */
if (argv[1]) {
gl_library = argv[1];
......@@ -149,7 +153,11 @@ main(int argc, char *argv[])
pixels[3 * i + 2] = rand() % 250 - 125;
}
#ifdef __QNXNTO__
f.glViewport(0, 0, video_h, video_w);
#else
f.glViewport(0, 0, video_w, video_h);
#endif /* __QNXNTO__ */
f.glMatrixMode(GL_PROJECTION);
f.glLoadIdentity();
......@@ -180,7 +188,7 @@ main(int argc, char *argv[])
f.glRotatef(2.0, 1.0, 1.0, 1.0);
f.glRotatef(1.0, 0.0, 1.0, 1.0);
f.glColor4ub(255, 255, 255, 255);
f.glColor4f(1.0, 1.0, 1.0, 1.0);
f.glEnableClientState(GL_VERTEX_ARRAY);
f.glVertexPointer(3, GL_FLOAT, 0, pixels);
......@@ -189,6 +197,8 @@ main(int argc, char *argv[])
SDL_GL_SwapBuffers();
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT)
done = 1;
if (event.type == SDL_KEYDOWN)
done = 1;
}
......
......@@ -168,6 +168,7 @@ main(int argc, char *argv[])
SDL_DisplayMode mode;
SDL_Event event;
Uint32 then, now, frames;
int status;
/* Initialize parameters */
fsaa = 0;
......@@ -241,26 +242,52 @@ main(int argc, char *argv[])
printf("Extensions : %s\n", glGetString(GL_EXTENSIONS));
printf("\n");
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
status=SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
if (!status) {
printf("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
} else {
printf("Failed to get SDL_GL_RED_SIZE: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
if (!status) {
printf("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
} else {
printf("Failed to get SDL_GL_GREEN_SIZE: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
if (!status) {
printf("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
} else {
printf("Failed to get SDL_GL_BLUE_SIZE: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
if (!status) {
printf("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", 16, value);
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &value);
printf("SDL_GL_DOUBLEBUFFER: requested 1, got %d\n", value);
} else {
printf("Failed to get SDL_GL_DEPTH_SIZE: %s\n", SDL_GetError());
}
if (fsaa) {
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
status=SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
if (!status) {
printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
value);
} else {
printf("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
if (!status) {
printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value);
} else {
printf("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", SDL_GetError());
}
}
if (accel) {
SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
status=SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
if (!status)
{
printf("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
} else {
printf("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", SDL_GetError());
}
}
/* Set rendering settings */
......
......@@ -88,6 +88,7 @@ main(int argc, char *argv[])
SDL_DisplayMode mode;
SDL_Event event;
Uint32 then, now, frames;
int status;
/* Initialize parameters */
fsaa = 0;
......@@ -160,24 +161,52 @@ main(int argc, char *argv[])
printf("Extensions : %s\n", glGetString(GL_EXTENSIONS));
printf("\n");
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
status=SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
if (!status) {
printf("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
} else {
printf("Failed to get SDL_GL_RED_SIZE: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
if (!status) {
printf("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
} else {
printf("Failed to get SDL_GL_GREEN_SIZE: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
if (!status) {
printf("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
} else {
printf("Failed to get SDL_GL_BLUE_SIZE: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
if (!status) {
printf("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", 16, value);
} else {
printf("Failed to get SDL_GL_DEPTH_SIZE: %s\n", SDL_GetError());
}
if (fsaa) {
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
status=SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
if (!status) {
printf("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
value);
} else {
printf("Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n", SDL_GetError());
}
status=SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
if (!status) {
printf("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa, value);
} else {
printf("Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n", SDL_GetError());
}
}
if (accel) {
SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
status=SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
if (!status)
{
printf("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
} else {
printf("Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n", SDL_GetError());
}
}
/* Set rendering settings */
......
......@@ -55,7 +55,7 @@ test_multi_audio(int devcount)
spec.userdata = &cbd[0];
cbd[0].dev = SDL_OpenAudioDevice(devname, 0, &spec, NULL, 0);
if (cbd[0].dev == 0) {
printf("Open device failed: %s\n", SDL_GetError());
printf("\nOpen device failed: %s\n", SDL_GetError());
} else {
SDL_PauseAudioDevice(cbd[0].dev, 0);
while (!cbd[0].done)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment