From 88c06f5324ddb538422995b346b7b48598d4bfaa Mon Sep 17 00:00:00 2001 From: espes Date: Thu, 18 Apr 2013 15:26:01 +1000 Subject: [PATCH] clean up nv2a opengl includes and use glo_readpixels --- hw/nv2a.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/hw/nv2a.c b/hw/nv2a.c index 0472bc6bd5..e9dae8b45b 100644 --- a/hw/nv2a.c +++ b/hw/nv2a.c @@ -25,6 +25,7 @@ #include "qemu/queue.h" #include "qemu/thread.h" #include "qapi/qmp/qstring.h" +#include "gl/gloffscreen.h" #include "u_format_r11g11b10f.h" @@ -32,25 +33,15 @@ #ifdef __APPLE__ #include -#include -#include -#include -#include #elif defined(_WIN32) #include #include #include -#include -#include #else -#include #include -#include -#include #endif #include "nv2a.h" -#include "gl/gloffscreen.h" #define DEBUG_NV2A #ifdef DEBUG_NV2A @@ -1459,16 +1450,13 @@ static void kelvin_read_surface(NV2AState *d, KelvinState *kelvin) GLenum gl_format; GLenum gl_type; - unsigned int bytes_per_pixel; switch (kelvin->surface_color.format) { case NV097_SET_SURFACE_FORMAT_COLOR_LE_R5G6B5: - bytes_per_pixel = 2; gl_format = GL_RGB; gl_type = GL_UNSIGNED_SHORT_5_6_5_REV; break; case NV097_SET_SURFACE_FORMAT_COLOR_LE_X8R8G8B8_Z8R8G8B8: case NV097_SET_SURFACE_FORMAT_COLOR_LE_A8R8G8B8: - bytes_per_pixel = 4; gl_format = GL_RGBA; gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; break; @@ -1476,16 +1464,13 @@ static void kelvin_read_surface(NV2AState *d, KelvinState *kelvin) assert(false); } - assert(kelvin->surface_color.pitch % bytes_per_pixel == 0); - - glPixelStorei(GL_PACK_ROW_LENGTH, - kelvin->surface_color.pitch / bytes_per_pixel); - glReadPixels(kelvin->surface_color.x, kelvin->surface_color.y, - kelvin->surface_color.width, kelvin->surface_color.height, - gl_format, gl_type, - d->vram_ptr + /* TODO */ + assert(kelvin->surface_color.x == 0 && kelvin->surface_color.y == 0); + + glo_readpixels(gl_format, gl_type, kelvin->surface_color.pitch, + kelvin->surface_color.width, kelvin->surface_color.height, + d->vram_ptr + color_dma.start + kelvin->surface_color.offset); - glPixelStorei(GL_PACK_ROW_LENGTH, 0); } }