summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-06-05 00:11:41 +0200
committerChristian König <[email protected]>2011-06-05 00:11:41 +0200
commit1eb957bb4108123bea95b818e0544e3b5f255e08 (patch)
treed7febd8e6cc841ab16dca53f031322ec47d5ccd9 /src/gallium/state_trackers
parenta6c76c8a90dc8995feed3c61b02dbd8408149036 (diff)
parent6491e9593d5cbc5644eb02593a2f562447efdcbb (diff)
Merge remote-tracking branch 'origin/master' into pipe-video
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp3
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c30
-rw-r--r--src/gallium/state_trackers/wgl/stw_st.c11
-rw-r--r--src/gallium/state_trackers/wgl/stw_st.h4
4 files changed, 24 insertions, 24 deletions
diff --git a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp
index 2c0f8269af3..30962900122 100644
--- a/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp
+++ b/src/gallium/state_trackers/d3d1x/d3d1xshader/src/sm4_parse.cpp
@@ -91,6 +91,7 @@ struct sm4_parser
break;
case SM4_OPERAND_COMPNUM_1:
op.comps = 1;
+ op.swizzle[1] = op.swizzle[2] = op.swizzle[3] = 0;
break;
case SM4_OPERAND_COMPNUM_4:
op.comps = 4;
@@ -143,7 +144,7 @@ struct sm4_parser
repr = optok.index2_repr;
else
fail("Unhandled operand index representation");
- op.indices[0].disp = 0;
+ op.indices[i].disp = 0;
// TODO: is disp supposed to be signed here??
switch(repr)
{
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 7a689f9977d..f595efe03f4 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -92,6 +92,8 @@ stw_framebuffer_destroy_locked(
stw_st_destroy_framebuffer_locked(fb->stfb);
+ ReleaseDC(fb->hWnd, fb->hDC);
+
pipe_mutex_unlock( fb->mutex );
pipe_mutex_destroy( fb->mutex );
@@ -168,6 +170,7 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb )
#if 0
debug_printf("\n");
+ debug_printf("%s: hwnd = %p\n", __FUNCTION__, fb->hWnd);
debug_printf("%s: client_position = (%li, %li)\n",
__FUNCTION__, client_pos.x, client_pos.y);
debug_printf("%s: window_rect = (%li, %li) - (%li, %li)\n",
@@ -251,7 +254,11 @@ stw_framebuffer_create(
if (fb == NULL)
return NULL;
- fb->hDC = hdc;
+ /* Applications use, create, destroy device contexts, so the hdc passed is. We create our own DC
+ * because we need one for single buffered visuals.
+ */
+ fb->hDC = GetDC(hWnd);
+
fb->hWnd = hWnd;
fb->iPixelFormat = iPixelFormat;
@@ -378,24 +385,13 @@ stw_framebuffer_from_hdc_locked(
HDC hdc )
{
HWND hwnd;
- struct stw_framebuffer *fb;
- /*
- * Some applications create and use several HDCs for the same window, so
- * looking up the framebuffer by the HDC is not reliable. Use HWND whenever
- * possible.
- */
hwnd = WindowFromDC(hdc);
- if(hwnd)
- return stw_framebuffer_from_hwnd_locked(hwnd);
-
- for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next)
- if (fb->hDC == hdc) {
- pipe_mutex_lock(fb->mutex);
- break;
- }
+ if (!hwnd) {
+ return NULL;
+ }
- return fb;
+ return stw_framebuffer_from_hwnd_locked(hwnd);
}
@@ -607,7 +603,7 @@ DrvSwapBuffers(
stw_flush_current_locked(fb);
- return stw_st_swap_framebuffer_locked(fb->stfb);
+ return stw_st_swap_framebuffer_locked(hdc, fb->stfb);
}
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index b58d91673b7..9174533fc06 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -154,7 +154,8 @@ stw_st_framebuffer_validate(struct st_framebuffer_iface *stfb,
* Present an attachment of the framebuffer.
*/
static boolean
-stw_st_framebuffer_present_locked(struct st_framebuffer_iface *stfb,
+stw_st_framebuffer_present_locked(HDC hdc,
+ struct st_framebuffer_iface *stfb,
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
@@ -162,7 +163,7 @@ stw_st_framebuffer_present_locked(struct st_framebuffer_iface *stfb,
resource = stwfb->textures[statt];
if (resource) {
- stw_framebuffer_present_locked(stwfb->fb->hDC, stwfb->fb, resource);
+ stw_framebuffer_present_locked(hdc, stwfb->fb, resource);
}
return TRUE;
@@ -176,7 +177,7 @@ stw_st_framebuffer_flush_front(struct st_framebuffer_iface *stfb,
pipe_mutex_lock(stwfb->fb->mutex);
- return stw_st_framebuffer_present_locked(&stwfb->base, statt);
+ return stw_st_framebuffer_present_locked(stwfb->fb->hDC, &stwfb->base, statt);
}
/**
@@ -220,7 +221,7 @@ stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb)
* Swap the buffers of the given framebuffer.
*/
boolean
-stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
+stw_st_swap_framebuffer_locked(HDC hdc, struct st_framebuffer_iface *stfb)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
unsigned front = ST_ATTACHMENT_FRONT_LEFT, back = ST_ATTACHMENT_BACK_LEFT;
@@ -245,7 +246,7 @@ stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
stwfb->texture_mask = mask;
front = ST_ATTACHMENT_FRONT_LEFT;
- return stw_st_framebuffer_present_locked(&stwfb->base, front);
+ return stw_st_framebuffer_present_locked(hdc, &stwfb->base, front);
}
/**
diff --git a/src/gallium/state_trackers/wgl/stw_st.h b/src/gallium/state_trackers/wgl/stw_st.h
index 23771d8bef6..945d3508b48 100644
--- a/src/gallium/state_trackers/wgl/stw_st.h
+++ b/src/gallium/state_trackers/wgl/stw_st.h
@@ -28,6 +28,8 @@
#ifndef STW_ST_H
#define STW_ST_H
+#include <windows.h>
+
#include "state_tracker/st_api.h"
struct stw_framebuffer;
@@ -42,6 +44,6 @@ void
stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb);
boolean
-stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb);
+stw_st_swap_framebuffer_locked(HDC hdc, struct st_framebuffer_iface *stfb);
#endif /* STW_ST_H */