mirror of https://github.com/xemu-project/xemu.git
Formatting...
This commit is contained in:
parent
602e1269ba
commit
b7a51d7d2d
10
hw/nv2a.c
10
hw/nv2a.c
|
@ -1501,19 +1501,19 @@ static void pgraph_context_init(GraphicsContext *context)
|
||||||
const GLubyte *extensions;
|
const GLubyte *extensions;
|
||||||
extensions = glGetString (GL_EXTENSIONS);
|
extensions = glGetString (GL_EXTENSIONS);
|
||||||
|
|
||||||
assert(glo_check_extension((const GLubyte*)"GL_EXT_texture_compression_s3tc",
|
assert(glo_check_extension(const GLubyte *)"GL_EXT_texture_compression_s3tc",
|
||||||
extensions));
|
extensions));
|
||||||
|
|
||||||
assert(glo_check_extension((const GLubyte*)"GL_EXT_framebuffer_object",
|
assert(glo_check_extension(const GLubyte *)"GL_EXT_framebuffer_object",
|
||||||
extensions));
|
extensions));
|
||||||
|
|
||||||
assert(glo_check_extension((const GLubyte*)"GL_ARB_vertex_program",
|
assert(glo_check_extension(const GLubyte *)"GL_ARB_vertex_program",
|
||||||
extensions));
|
extensions));
|
||||||
|
|
||||||
assert(glo_check_extension((const GLubyte*)"GL_ARB_fragment_program",
|
assert(glo_check_extension(const GLubyte *)"GL_ARB_fragment_program",
|
||||||
extensions));
|
extensions));
|
||||||
|
|
||||||
assert(glo_check_extension((const GLubyte*)"GL_ARB_texture_rectangle",
|
assert(glo_check_extension(const GLubyte *)"GL_ARB_texture_rectangle",
|
||||||
extensions));
|
extensions));
|
||||||
|
|
||||||
GLint max_vertex_attributes;
|
GLint max_vertex_attributes;
|
||||||
|
|
|
@ -7,7 +7,7 @@ obj-$(CONFIG_NO_KVM) += kvm-stub.o
|
||||||
obj-$(CONFIG_LINUX_USER) += ioport-user.o
|
obj-$(CONFIG_LINUX_USER) += ioport-user.o
|
||||||
obj-$(CONFIG_BSD_USER) += ioport-user.o
|
obj-$(CONFIG_BSD_USER) += ioport-user.o
|
||||||
obj-gl-y += gloffscreen_common.o
|
obj-gl-y += gloffscreen_common.o
|
||||||
obj-gl-$(CONFIG_WIN32) += gloffscreen_wgl.o
|
obj-gl-$(CONFIG_WIN32) += gloffscreen_wgl.o
|
||||||
obj-gl-$(CONFIG_LINUX) += gloffscreen_glx.o
|
obj-gl-$(CONFIG_LINUX) += gloffscreen_glx.o
|
||||||
obj-gl-$(CONFIG_DARWIN) += gloffscreen_cgl.o
|
obj-gl-$(CONFIG_DARWIN) += gloffscreen_cgl.o
|
||||||
obj-$(CONFIG_OPENGL) += $(obj-gl-y)
|
obj-$(CONFIG_OPENGL) += $(obj-gl-y)
|
|
@ -72,10 +72,11 @@ extern void glo_set_current(GloContext *context);
|
||||||
extern void glo_kill(void);
|
extern void glo_kill(void);
|
||||||
|
|
||||||
/* Check GL Extensions */
|
/* Check GL Extensions */
|
||||||
extern GLboolean glo_check_extension( const GLubyte *extName, const GLubyte *extString );
|
extern GLboolean glo_check_extension(
|
||||||
|
const GLubyte *extName, const GLubyte *extString);
|
||||||
|
|
||||||
/* Create an OpenGL context for a certain
|
/* Create an OpenGL context for a certain
|
||||||
* pixel format. formatflags are from the
|
* pixel format. formatflags are from the
|
||||||
* GLO_ constants */
|
* GLO_ constants */
|
||||||
extern GloContext *glo_context_create(int formatFlags);
|
extern GloContext *glo_context_create(int formatFlags);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct GloMain glo;
|
||||||
int glo_inited = 0;
|
int glo_inited = 0;
|
||||||
|
|
||||||
struct _GloContext {
|
struct _GloContext {
|
||||||
CGLContextObj cglContext;
|
CGLContextObj cglContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
int glo_initialised(void) {
|
int glo_initialised(void) {
|
||||||
|
@ -74,18 +74,19 @@ void glo_init(void) {
|
||||||
|
|
||||||
/* Uninitialise gloffscreen */
|
/* Uninitialise gloffscreen */
|
||||||
void glo_kill(void) {
|
void glo_kill(void) {
|
||||||
glo_inited = 0;
|
glo_inited = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an OpenGL context for a certain pixel format. formatflags are from the GLO_ constants */
|
/* Create an OpenGL context for a certain pixel format. formatflags are from the GLO_ constants */
|
||||||
GloContext *glo_context_create( int formatFlags ) {
|
GloContext *glo_context_create(int formatFlags)
|
||||||
|
{
|
||||||
GloContext *context;
|
GloContext *context;
|
||||||
|
|
||||||
context = (GloContext*)malloc(sizeof(GloContext));
|
context = (GloContext*)malloc(sizeof(GloContext));
|
||||||
memset(context, 0, sizeof(GloContext));
|
memset(context, 0, sizeof(GloContext));
|
||||||
|
|
||||||
// pixel format attributes
|
// pixel format attributes
|
||||||
CGLPixelFormatAttribute attributes[] = {
|
CGLPixelFormatAttribute attributes[] = {
|
||||||
kCGLPFAAccelerated,
|
kCGLPFAAccelerated,
|
||||||
(CGLPixelFormatAttribute)0
|
(CGLPixelFormatAttribute)0
|
||||||
};
|
};
|
||||||
|
@ -97,31 +98,35 @@ GloContext *glo_context_create( int formatFlags ) {
|
||||||
CGLDestroyPixelFormat(pix);
|
CGLDestroyPixelFormat(pix);
|
||||||
|
|
||||||
if (!glo_inited)
|
if (!glo_inited)
|
||||||
glo_init();
|
glo_init();
|
||||||
|
|
||||||
|
glo_set_current(context);
|
||||||
|
|
||||||
glo_set_current(context);
|
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if an extension is available. */
|
/* Check if an extension is available. */
|
||||||
GLboolean glo_check_extension( const GLubyte *extName, const GLubyte *extString ) {
|
GLboolean glo_check_extension(const GLubyte *extName,
|
||||||
return gluCheckExtension(extName, extString);
|
const GLubyte *extString)
|
||||||
|
{
|
||||||
|
return gluCheckExtension(extName, extString);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set current context */
|
/* Set current context */
|
||||||
void glo_set_current( GloContext *context ) {
|
void glo_set_current(GloContext *context)
|
||||||
if(context == NULL)
|
{
|
||||||
CGLSetCurrentContext(NULL);
|
if(context == NULL)
|
||||||
else
|
CGLSetCurrentContext(NULL);
|
||||||
CGLSetCurrentContext(context->cglContext);
|
else
|
||||||
|
CGLSetCurrentContext(context->cglContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy a previously created OpenGL context */
|
/* Destroy a previously created OpenGL context */
|
||||||
void glo_context_destroy( GloContext *context ) {
|
void glo_context_destroy(GloContext *context)
|
||||||
|
{
|
||||||
if (!context) return;
|
if (!context) return;
|
||||||
|
|
||||||
glo_set_current( NULL );
|
glo_set_current(NULL);
|
||||||
|
|
||||||
CGLDestroyContext(context->cglContext);
|
CGLDestroyContext(context->cglContext);
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,8 +262,8 @@ void glo_set_current(GloContext *context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy a previously created OpenGL context */
|
/* Destroy a previously created OpenGL context */
|
||||||
void glo_context_destroy(GloContext *context) {
|
void glo_context_destroy(GloContext *context)
|
||||||
|
{
|
||||||
if (!context) return;
|
if (!context) return;
|
||||||
|
|
||||||
wglMakeCurrent( NULL, NULL );
|
wglMakeCurrent( NULL, NULL );
|
||||||
|
@ -275,27 +275,30 @@ void glo_context_destroy(GloContext *context) {
|
||||||
ReleaseDC( glo.hWnd, context->hDC );
|
ReleaseDC( glo.hWnd, context->hDC );
|
||||||
}
|
}
|
||||||
if (context->hContext) {
|
if (context->hContext) {
|
||||||
wglDeleteContext(context->hContext);
|
wglDeleteContext(context->hContext);
|
||||||
}
|
}
|
||||||
free(context);
|
free(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Check extension implementation for Windows. The Glu 1.2 framework in Windows doesn't include them... */
|
/* Check extension implementation for Windows.
|
||||||
GLboolean glo_check_extension( const GLubyte *extName, const GLubyte *extString ) {
|
* The Glu 1.2 framework in Windows doesn't include them... */
|
||||||
|
GLboolean glo_check_extension(const GLubyte *extName,
|
||||||
|
const GLubyte *extString)
|
||||||
|
{
|
||||||
|
char *p = (char *) glGetString(GL_EXTENSIONS);
|
||||||
|
char *end;
|
||||||
|
if (p == NULL) {
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
end = p + strlen(p);
|
||||||
|
|
||||||
char *p = (char *) glGetString(GL_EXTENSIONS);
|
while (p < end) {
|
||||||
char *end;
|
int n = strcspn(p, " ");
|
||||||
if(p==NULL)
|
if ((strlen(extName) == n) && (strncmp(extName, p, n) == 0)) {
|
||||||
return GL_FALSE;
|
return GL_TRUE;
|
||||||
end = p + strlen(p);
|
}
|
||||||
|
p += (n + 1);
|
||||||
while (p < end) {
|
}
|
||||||
int n = strcspn(p, " ");
|
return GL_FALSE;
|
||||||
if((strlen(extName) == n) && (strncmp(extName,p,n) == 0)) {
|
|
||||||
return GL_TRUE;
|
|
||||||
}
|
|
||||||
p += (n + 1);
|
|
||||||
}
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue