mirror of https://github.com/xemu-project/xemu.git
fix windows build
This commit is contained in:
parent
9ec38af3ce
commit
dc39687af6
|
@ -2657,14 +2657,13 @@ if test "$opengl" != "no" ; then
|
||||||
int main(void) { return GL_VERSION != 0; }
|
int main(void) { return GL_VERSION != 0; }
|
||||||
EOF
|
EOF
|
||||||
elif test "$mingw32" = "yes" ; then
|
elif test "$mingw32" = "yes" ; then
|
||||||
opengl_libs="-lglut32win -lOpenGL32 -lglu32 -lglew32 -lgdi32"
|
opengl_libs="-lopengl32 -lglew32 -lgdi32"
|
||||||
cat > $TMPC << EOF
|
cat > $TMPC << EOF
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
#include <GL/wglext.h>
|
#include <GL/wglext.h>
|
||||||
#include <GL/glut.h>
|
|
||||||
int main(void) { return GL_VERSION != 0; }
|
int main(void) { return GL_VERSION != 0; }
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
#include "qemu/atomic.h"
|
#include "qemu/atomic.h"
|
||||||
#include "sysemu/qtest.h"
|
#include "sysemu/qtest.h"
|
||||||
|
|
||||||
|
#if defined(_WIN64)
|
||||||
|
/* Temporary hack for win64 because the include order is broken.
|
||||||
|
* See os-win32.h.
|
||||||
|
*/
|
||||||
|
# define setjmp(env) _setjmp(env, NULL)
|
||||||
|
#endif
|
||||||
|
|
||||||
bool qemu_cpu_has_work(CPUState *cpu)
|
bool qemu_cpu_has_work(CPUState *cpu)
|
||||||
{
|
{
|
||||||
return cpu_has_work(cpu);
|
return cpu_has_work(cpu);
|
||||||
|
|
|
@ -34,10 +34,6 @@
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <OpenGL/gl3.h>
|
#include <OpenGL/gl3.h>
|
||||||
#include <OpenGL/glext.h>
|
#include <OpenGL/glext.h>
|
||||||
#elif defined(_WIN32)
|
|
||||||
#include <GL/glew.h>
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
#else
|
#else
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
|
@ -33,10 +33,9 @@
|
||||||
#include <wingdi.h>
|
#include <wingdi.h>
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
#include <GL/wglew.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
|
||||||
#include <GL/wglext.h>
|
#include <GL/wglext.h>
|
||||||
#include <GL/glut.h>
|
|
||||||
|
|
||||||
#include "gloffscreen.h"
|
#include "gloffscreen.h"
|
||||||
|
|
||||||
|
@ -70,13 +69,6 @@ struct _GloContext {
|
||||||
|
|
||||||
|
|
||||||
#define GLO_WINDOW_CLASS "QEmuGLClass"
|
#define GLO_WINDOW_CLASS "QEmuGLClass"
|
||||||
#define DEFAULT_DEPTH_BUFFER (16)
|
|
||||||
|
|
||||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
|
|
||||||
PFNWGLGETPBUFFERDCARBPROC wglGetPbufferDCARB;
|
|
||||||
PFNWGLRELEASEPBUFFERDCARBPROC wglReleasePbufferDCARB;
|
|
||||||
PFNWGLCREATEPBUFFERARBPROC wglCreatePbufferARB;
|
|
||||||
PFNWGLDESTROYPBUFFERARBPROC wglDestroyPbufferARB;
|
|
||||||
|
|
||||||
/* Initialise gloffscreen */
|
/* Initialise gloffscreen */
|
||||||
static void glo_init(void) {
|
static void glo_init(void) {
|
||||||
|
@ -84,8 +76,8 @@ static void glo_init(void) {
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
|
||||||
if (glo_inited) {
|
if (glo_inited) {
|
||||||
printf("gloffscreen already inited\n");
|
fprintf(stderr, "gloffscreen already inited\n");
|
||||||
exit(EXIT_FAILURE);
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Grab An Instance For Our Window */
|
/* Grab An Instance For Our Window */
|
||||||
|
@ -113,11 +105,12 @@ static void glo_init(void) {
|
||||||
(LPVOID) NULL);
|
(LPVOID) NULL);
|
||||||
|
|
||||||
if (!glo.hWnd) {
|
if (!glo.hWnd) {
|
||||||
printf("Unable to create window\n");
|
fprintf(stderr, "Unable to create window\n");
|
||||||
exit(EXIT_FAILURE);
|
abort();
|
||||||
}
|
}
|
||||||
glo.hDC = GetDC(glo.hWnd);
|
glo.hDC = GetDC(glo.hWnd);
|
||||||
|
|
||||||
|
/* Create a pixel format */
|
||||||
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
|
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
|
||||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||||
pfd.nVersion = 1;
|
pfd.nVersion = 1;
|
||||||
|
@ -131,39 +124,27 @@ static void glo_init(void) {
|
||||||
if (!SetPixelFormat(glo.hDC, pixelFormat, &pfd))
|
if (!SetPixelFormat(glo.hDC, pixelFormat, &pfd))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Create a tempoary OpenGL 2 context */
|
||||||
glo.hContext = wglCreateContext(glo.hDC);
|
glo.hContext = wglCreateContext(glo.hDC);
|
||||||
if (glo.hContext == NULL) {
|
if (glo.hContext == NULL) {
|
||||||
printf("Unable to create GL context\n");
|
fprintf(stderr, "Unable to create GL context\n");
|
||||||
exit(EXIT_FAILURE);
|
abort();
|
||||||
}
|
}
|
||||||
wglMakeCurrent(glo.hDC, glo.hContext);
|
wglMakeCurrent(glo.hDC, glo.hContext);
|
||||||
|
|
||||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)
|
|
||||||
wglGetProcAddress("wglChoosePixelFormatARB");
|
|
||||||
wglGetPbufferDCARB = (PFNWGLGETPBUFFERDCARBPROC)
|
|
||||||
wglGetProcAddress("wglGetPbufferDCARB");
|
|
||||||
wglReleasePbufferDCARB = (PFNWGLRELEASEPBUFFERDCARBPROC)
|
|
||||||
wglGetProcAddress("wglReleasePbufferDCARB");
|
|
||||||
wglCreatePbufferARB = (PFNWGLCREATEPBUFFERARBPROC)
|
|
||||||
wglGetProcAddress("wglCreatePbufferARB");
|
|
||||||
wglDestroyPbufferARB = (PFNWGLDESTROYPBUFFERARBPROC)
|
|
||||||
wglGetProcAddress("wglDestroyPbufferARB");
|
|
||||||
|
|
||||||
if (!wglChoosePixelFormatARB ||
|
|
||||||
!wglGetPbufferDCARB ||
|
|
||||||
!wglReleasePbufferDCARB ||
|
|
||||||
!wglCreatePbufferARB ||
|
|
||||||
!wglDestroyPbufferARB) {
|
|
||||||
printf("Unable to load the required WGL extensions\n");
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize glew */
|
/* Initialize glew */
|
||||||
if (GLEW_OK != glewInit()) {
|
if (glewInit() != GLEW_OK) {
|
||||||
/* GLEW failed! */
|
fprintf(stderr, "Glew init failed.\n");
|
||||||
printf("Glew init failed.");
|
abort();
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WGLEW_ARB_create_context
|
||||||
|
|| !WGLEW_ARB_pixel_format
|
||||||
|
|| !WGLEW_ARB_pbuffer) {
|
||||||
|
fprintf(stderr, "Unable to load the required WGL extensions\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
glo_inited = 1;
|
glo_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,23 +170,6 @@ static void glo_kill(void) {
|
||||||
* the GLO_ constants */
|
* the GLO_ constants */
|
||||||
GloContext *glo_context_create(int formatFlags) {
|
GloContext *glo_context_create(int formatFlags) {
|
||||||
GloContext *context;
|
GloContext *context;
|
||||||
/* pixel format attributes */
|
|
||||||
int pf_attri[] = {
|
|
||||||
WGL_SUPPORT_OPENGL_ARB, TRUE,
|
|
||||||
WGL_DRAW_TO_PBUFFER_ARB, TRUE,
|
|
||||||
WGL_RED_BITS_ARB, 8,
|
|
||||||
WGL_GREEN_BITS_ARB, 8,
|
|
||||||
WGL_BLUE_BITS_ARB, 8,
|
|
||||||
WGL_ALPHA_BITS_ARB, 8,
|
|
||||||
WGL_DEPTH_BITS_ARB, 0,
|
|
||||||
WGL_STENCIL_BITS_ARB, 0,
|
|
||||||
WGL_DOUBLE_BUFFER_ARB, FALSE,
|
|
||||||
0
|
|
||||||
};
|
|
||||||
float pf_attrf[] = {0, 0};
|
|
||||||
unsigned int numReturned = 0;
|
|
||||||
int pb_attr[] = { 0 };
|
|
||||||
int rgbaBits[4];
|
|
||||||
|
|
||||||
if (!glo_inited)
|
if (!glo_inited)
|
||||||
glo_init();
|
glo_init();
|
||||||
|
@ -214,18 +178,22 @@ GloContext *glo_context_create(int formatFlags) {
|
||||||
memset(context, 0, sizeof(GloContext));
|
memset(context, 0, sizeof(GloContext));
|
||||||
context->formatFlags = formatFlags;
|
context->formatFlags = formatFlags;
|
||||||
|
|
||||||
/* set up the surface format from the flags we were given */
|
/* pixel format attributes */
|
||||||
glo_flags_get_rgba_bits(context->formatFlags, rgbaBits);
|
const int pf_attri[] = {
|
||||||
pf_attri[5] = rgbaBits[0];
|
WGL_DRAW_TO_PBUFFER_ARB, TRUE,
|
||||||
pf_attri[7] = rgbaBits[1];
|
WGL_SUPPORT_OPENGL_ARB, TRUE,
|
||||||
pf_attri[9] = rgbaBits[2];
|
WGL_DOUBLE_BUFFER_ARB, FALSE,
|
||||||
pf_attri[11] = rgbaBits[3];
|
WGL_COLOR_BITS_ARB, 32,
|
||||||
pf_attri[13] = glo_flags_get_depth_bits(context->formatFlags);
|
WGL_DEPTH_BITS_ARB, 24,
|
||||||
pf_attri[15] = glo_flags_get_stencil_bits(context->formatFlags);
|
WGL_STENCIL_BITS_ARB, 8,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
const float pf_attrf[] = {0, 0};
|
||||||
|
|
||||||
/* find out what pixel format to use */
|
/* find out what pixel format to use */
|
||||||
|
unsigned int numReturned = 0;
|
||||||
wglChoosePixelFormatARB(glo.hDC, pf_attri, pf_attrf, 1,
|
wglChoosePixelFormatARB(glo.hDC, pf_attri, pf_attrf, 1,
|
||||||
&context->wglPixelFormat, &numReturned);
|
&context->wglPixelFormat, &numReturned);
|
||||||
if (numReturned == 0) {
|
if (numReturned == 0) {
|
||||||
printf( "No matching configs found.\n" );
|
printf( "No matching configs found.\n" );
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -233,22 +201,33 @@ GloContext *glo_context_create(int formatFlags) {
|
||||||
|
|
||||||
/* We create a tiny pbuffer - just so we can make a context of
|
/* We create a tiny pbuffer - just so we can make a context of
|
||||||
* the right pixel format */
|
* the right pixel format */
|
||||||
|
const int pb_attr[] = { 0 };
|
||||||
context->hPBuffer = wglCreatePbufferARB(glo.hDC, context->wglPixelFormat,
|
context->hPBuffer = wglCreatePbufferARB(glo.hDC, context->wglPixelFormat,
|
||||||
16, 16, pb_attr);
|
16, 16, pb_attr);
|
||||||
if (!context->hPBuffer) {
|
if (!context->hPBuffer) {
|
||||||
printf("Couldn't create the PBuffer\n");
|
printf("Couldn't create the PBuffer\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
context->hDC = wglGetPbufferDCARB(context->hPBuffer);
|
context->hDC = wglGetPbufferDCARB(context->hPBuffer);
|
||||||
if (!context->hDC) {
|
if (!context->hDC) {
|
||||||
printf("Couldn't create the DC\n");
|
printf("Couldn't create the DC\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
context->hContext = wglCreateContext(context->hDC);
|
|
||||||
|
/* Create the context proper */
|
||||||
|
const int ctx_attri[] = {
|
||||||
|
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||||
|
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||||
|
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
context->hContext = wglCreateContextAttribsARB(context->hDC, 0, ctx_attri);
|
||||||
if (context->hContext == NULL) {
|
if (context->hContext == NULL) {
|
||||||
printf("Unable to create GL context\n");
|
printf("Unable to create GL context\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
glo_set_current(context);
|
glo_set_current(context);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1235,8 +1235,8 @@ static const SurfaceColorFormatInfo kelvin_surface_color_format_map[] = {
|
||||||
#define GET_MASK(v, mask) (((v) & (mask)) >> (ffs(mask)-1))
|
#define GET_MASK(v, mask) (((v) & (mask)) >> (ffs(mask)-1))
|
||||||
|
|
||||||
#define SET_MASK(v, mask, val) ({ \
|
#define SET_MASK(v, mask, val) ({ \
|
||||||
const typeof(val) __val = (val); \
|
const unsigned int __val = (val); \
|
||||||
const typeof(mask) __mask = (mask); \
|
const unsigned int __mask = (mask); \
|
||||||
(v) &= ~(__mask); \
|
(v) &= ~(__mask); \
|
||||||
(v) |= ((__val) << (ffs(__mask)-1)) & (__mask); \
|
(v) |= ((__val) << (ffs(__mask)-1)) & (__mask); \
|
||||||
})
|
})
|
||||||
|
|
|
@ -747,7 +747,8 @@ QString* vsh_translate(uint16_t version,
|
||||||
QString *body = qstring_from_str("\n");
|
QString *body = qstring_from_str("\n");
|
||||||
|
|
||||||
bool has_final = false;
|
bool has_final = false;
|
||||||
for (int slot=0; slot<length; slot++) {
|
int slot;
|
||||||
|
for (slot=0; slot<length; slot++) {
|
||||||
const uint32_t* cur_token = &tokens[slot * VSH_TOKEN_SIZE];
|
const uint32_t* cur_token = &tokens[slot * VSH_TOKEN_SIZE];
|
||||||
QString *token_str = decode_token(cur_token);
|
QString *token_str = decode_token(cur_token);
|
||||||
qstring_append_fmt(body,
|
qstring_append_fmt(body,
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
|
|
||||||
/* Declaration of ffs() is missing in MinGW's strings.h. */
|
/* Declaration of ffs() is missing in MinGW's strings.h. */
|
||||||
int ffs(int i);
|
int ffs(int i);
|
||||||
|
#define ffs(i) __builtin_ffs(i)
|
||||||
|
|
||||||
/* Missing POSIX functions. Don't use MinGW-w64 macros. */
|
/* Missing POSIX functions. Don't use MinGW-w64 macros. */
|
||||||
#undef gmtime_r
|
#undef gmtime_r
|
||||||
|
@ -81,8 +82,6 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||||
#undef localtime_r
|
#undef localtime_r
|
||||||
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
struct tm *localtime_r(const time_t *timep, struct tm *result);
|
||||||
|
|
||||||
char *strtok_r(char *str, const char *delim, char **saveptr);
|
|
||||||
|
|
||||||
static inline void os_setup_signal_handling(void) {}
|
static inline void os_setup_signal_handling(void) {}
|
||||||
static inline void os_daemonize(void) {}
|
static inline void os_daemonize(void) {}
|
||||||
static inline void os_setup_post(void) {}
|
static inline void os_setup_post(void) {}
|
||||||
|
|
Loading…
Reference in New Issue