summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2008-05-08 22:16:05 +0100
committerKeith Whitwell <[email protected]>2008-05-08 22:16:05 +0100
commitcec016271ccf38d2f32e426f96e7d5d1fdf962f7 (patch)
treef8ea79623ccb5caa787ff1600b803b4817160184 /src/gallium
parent8ea6106f01f38853e9c0f1029da55eb449109aea (diff)
parentb514f5f3ba4c9cf6c39cbcdf5bf0d2d8efb8d19b (diff)
Merge branch 'gallium-0.1' into gallium-vertex-linear
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_emit.c8
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c8
-rw-r--r--src/gallium/auxiliary/translate/translate.h5
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c5
-rw-r--r--src/gallium/winsys/xlib/fakeglx.c9
-rw-r--r--src/gallium/winsys/xlib/xm_api.c3
6 files changed, 26 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index 776ca32cfa9..999b2007a26 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -49,6 +49,7 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
const struct vertex_info *vinfo;
unsigned dst_offset;
struct translate_key hw_key;
+ unsigned keysize;
unsigned i;
boolean ok;
@@ -58,12 +59,10 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
return;
}
- memset(&hw_key, 0, sizeof(hw_key));
-
/* Must do this after set_primitive() above:
*/
vinfo = draw->render->get_vertex_info(draw->render);
-
+ keysize = 2*4 + vinfo->num_attribs * sizeof(hw_key.element[0]);
/* Translate from pipeline vertices to hw vertices.
*/
@@ -122,8 +121,9 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
hw_key.output_stride = vinfo->size * 4;
if (!emit->translate ||
- memcmp(&emit->translate->key, &hw_key, sizeof(hw_key)) != 0)
+ memcmp(&emit->translate->key, &hw_key, keysize) != 0)
{
+ memset((char *)&hw_key + keysize, 0, sizeof(hw_key) - keysize);
emit->translate = translate_cache_find(emit->cache, &hw_key);
}
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index d7cc1807d77..d62cd9358be 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -62,10 +62,11 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
unsigned i, nr = 0;
unsigned dst_offset = 0;
struct translate_key key;
+ unsigned keysize;
fetch->vertex_size = vertex_size;
-
- memset(&key, 0, sizeof(key));
+ keysize = (2*4 +
+ (draw->pt.nr_vertex_elements + 1) * sizeof(key.element[0]));
/* Always emit/leave space for a vertex header.
*
@@ -110,8 +111,9 @@ void draw_pt_fetch_prepare( struct pt_fetch *fetch,
if (!fetch->translate ||
- memcmp(&fetch->translate->key, &key, sizeof(key)) != 0)
+ memcmp(&fetch->translate->key, &key, keysize) != 0)
{
+ memset((char *)&key + keysize, 0, sizeof(key) - keysize);
fetch->translate = translate_cache_find(fetch->cache, &key);
{
diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h
index 6c15d7e4dc7..de6f09d18a2 100644
--- a/src/gallium/auxiliary/translate/translate.h
+++ b/src/gallium/auxiliary/translate/translate.h
@@ -47,10 +47,9 @@
struct translate_element
{
enum pipe_format input_format;
- unsigned input_buffer;
- unsigned input_offset;
-
enum pipe_format output_format;
+ unsigned input_buffer;
+ unsigned input_offset; /* can't really reduce the size of these */
unsigned output_offset;
};
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index df7be01fcd5..5370d85275f 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -717,7 +717,7 @@ void setup_tri( struct setup_context *setup,
const float (*v1)[4],
const float (*v2)[4] )
{
- float det = calc_det(v0, v1, v2);
+ float det;
#if DEBUG_VERTS
debug_printf("Setup triangle:\n");
@@ -728,7 +728,8 @@ void setup_tri( struct setup_context *setup,
if (setup->softpipe->no_rast)
return;
-
+
+ det = calc_det(v0, v1, v2);
/*
debug_printf("%s\n", __FUNCTION__ );
*/
diff --git a/src/gallium/winsys/xlib/fakeglx.c b/src/gallium/winsys/xlib/fakeglx.c
index ec77e81fedb..2c0075e9345 100644
--- a/src/gallium/winsys/xlib/fakeglx.c
+++ b/src/gallium/winsys/xlib/fakeglx.c
@@ -1689,6 +1689,15 @@ static void
Fake_glXSwapBuffers( Display *dpy, GLXDrawable drawable )
{
XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable );
+ static boolean firsttime = 1, no_rast = 0;
+
+ if (firsttime) {
+ no_rast = getenv("SP_NO_RAST") != NULL;
+ firsttime = 0;
+ }
+
+ if (no_rast)
+ return;
if (buffer) {
XMesaSwapBuffers(buffer);
diff --git a/src/gallium/winsys/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c
index 0c248344b15..26b722f3439 100644
--- a/src/gallium/winsys/xlib/xm_api.c
+++ b/src/gallium/winsys/xlib/xm_api.c
@@ -110,6 +110,9 @@ int xmesa_check_for_xshm( XMesaDisplay *display )
int major, minor, ignore;
Bool pixmaps;
+ if (getenv("SP_NO_RAST"))
+ return 0;
+
if (getenv("MESA_NOSHM")) {
return 0;
}