summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/wgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/wgl')
-rw-r--r--src/gallium/state_trackers/wgl/SConscript3
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c14
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c40
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.h3
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c15
-rw-r--r--src/gallium/state_trackers/wgl/stw_winsys.h2
6 files changed, 24 insertions, 53 deletions
diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript
index b05944a33b..352c087475 100644
--- a/src/gallium/state_trackers/wgl/SConscript
+++ b/src/gallium/state_trackers/wgl/SConscript
@@ -11,10 +11,11 @@ if env['platform'] in ['windows']:
'.',
])
- env.Append(CPPDEFINES = [
+ env.AppendUnique(CPPDEFINES = [
'_GDI32_', # prevent wgl* being declared __declspec(dllimport)
'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
'WIN32_THREADS', # use Win32 thread API
+ 'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
])
sources = [
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index 985b8f0456..7785aba467 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -72,19 +72,7 @@ stw_flush_frontbuffer(struct pipe_screen *screen,
return;
}
-#if DEBUG
- {
- /* ensure that a random surface was not passed to us */
- struct pipe_surface *surface2;
-
- if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 ))
- assert(0);
- else
- assert(surface2 == surface);
- }
-#endif
-
- stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_FRONT_LEFT);
+ stw_framebuffer_present_locked(hdc, fb, surface);
}
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 8a3e11b6b4..129a6298a7 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -30,6 +30,7 @@
#include "main/context.h"
#include "pipe/p_format.h"
#include "pipe/p_screen.h"
+#include "util/u_format.h"
#include "state_tracker/st_context.h"
#include "state_tracker/st_public.h"
@@ -267,15 +268,13 @@ stw_framebuffer_allocate(
enum pipe_format colorFormat, depthFormat, stencilFormat;
colorFormat = pfi->color_format;
-
- assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
-
- if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z ))
+
+ if(util_format_get_component_bits(pfi->depth_stencil_format, UTIL_FORMAT_COLORSPACE_ZS, 0))
depthFormat = pfi->depth_stencil_format;
else
depthFormat = PIPE_FORMAT_NONE;
- if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S ))
+ if(util_format_get_component_bits(pfi->depth_stencil_format, UTIL_FORMAT_COLORSPACE_ZS, 1))
stencilFormat = pfi->depth_stencil_format;
else
stencilFormat = PIPE_FORMAT_NONE;
@@ -475,8 +474,6 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
struct stw_framebuffer *fb;
struct pipe_screen *screen;
struct pipe_surface *surface;
- unsigned surface_index;
- BOOL ret = FALSE;
fb = stw_framebuffer_from_hdc( hdc );
if (fb == NULL)
@@ -484,9 +481,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
screen = stw_dev->screen;
- surface_index = (unsigned)(uintptr_t)data->pPrivateData;
- if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface ))
- goto fail;
+ surface = (struct pipe_surface *)data->pPrivateData;
#ifdef DEBUG
if(stw_dev->trace_running) {
@@ -520,15 +515,11 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
stw_dev->stw_winsys->present( screen, surface, hdc );
}
- ret = TRUE;
-
-fail:
-
stw_framebuffer_update(fb);
stw_framebuffer_release(fb);
- return ret;
+ return TRUE;
}
@@ -540,7 +531,7 @@ fail:
BOOL
stw_framebuffer_present_locked(HDC hdc,
struct stw_framebuffer *fb,
- unsigned surface_index)
+ struct pipe_surface *surface)
{
if(stw_dev->callbacks.wglCbPresentBuffers &&
stw_dev->stw_winsys->compose) {
@@ -551,7 +542,7 @@ stw_framebuffer_present_locked(HDC hdc,
data.magic2 = 0;
data.AdapterLuid = stw_dev->AdapterLuid;
data.rect = fb->client_rect;
- data.pPrivateData = (void *)(uintptr_t)surface_index;
+ data.pPrivateData = (void *)surface;
stw_framebuffer_release(fb);
@@ -559,13 +550,6 @@ stw_framebuffer_present_locked(HDC hdc,
}
else {
struct pipe_screen *screen = stw_dev->screen;
- struct pipe_surface *surface;
-
- if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface )) {
- /* FIXME: this shouldn't happen, but does on glean */
- stw_framebuffer_release(fb);
- return FALSE;
- }
#ifdef DEBUG
if(stw_dev->trace_running) {
@@ -590,6 +574,7 @@ DrvSwapBuffers(
HDC hdc )
{
struct stw_framebuffer *fb;
+ struct pipe_surface *surface = NULL;
fb = stw_framebuffer_from_hdc( hdc );
if (fb == NULL)
@@ -600,12 +585,9 @@ DrvSwapBuffers(
return TRUE;
}
- /* If we're swapping the buffer associated with the current context
- * we have to flush any pending rendering commands first.
- */
- st_notify_swapbuffers( fb->stfb );
+ st_swapbuffers(fb->stfb, &surface, NULL);
- return stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_BACK_LEFT);
+ return stw_framebuffer_present_locked(hdc, fb, surface);
}
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h
index 5afbe74908..b80d168a7c 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.h
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h
@@ -34,6 +34,7 @@
#include "pipe/p_thread.h"
+struct pipe_surface;
struct stw_pixelformat_info;
/**
@@ -140,7 +141,7 @@ stw_framebuffer_allocate(
BOOL
stw_framebuffer_present_locked(HDC hdc,
struct stw_framebuffer *fb,
- unsigned surface_index);
+ struct pipe_surface *surface);
void
stw_framebuffer_update(
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index 7abe5d9f7f..54cc361412 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -32,6 +32,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "util/u_format.h"
#include "util/u_debug.h"
#include "stw_icd.h"
@@ -132,14 +133,12 @@ stw_pixelformat_add(
if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS)
return;
- assert(pf_layout( color->format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
- assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_R ) == color->bits.red );
- assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_G ) == color->bits.green );
- assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_B ) == color->bits.blue );
- assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_A ) == color->bits.alpha );
- assert(pf_layout( depth->format ) == PIPE_FORMAT_LAYOUT_RGBAZS );
- assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_Z ) == depth->bits.depth );
- assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_S ) == depth->bits.stencil );
+ assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 0) == color->bits.red);
+ assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 1) == color->bits.green);
+ assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 2) == color->bits.blue);
+ assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 3) == color->bits.alpha);
+ assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 0) == depth->bits.depth);
+ assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 1) == depth->bits.stencil);
pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count];
diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h
index 1ead47d6e6..1de6e906d0 100644
--- a/src/gallium/state_trackers/wgl/stw_winsys.h
+++ b/src/gallium/state_trackers/wgl/stw_winsys.h
@@ -73,7 +73,7 @@ struct stw_winsys
HANDLE hSharedSurface);
/**
- * Open a shared surface (optional).
+ * Close a shared surface (optional).
*/
void
(*shared_surface_close)(struct pipe_screen *screen,