summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-04-29 09:00:48 +1000
committerBen Skeggs <[email protected]>2008-04-29 09:00:48 +1000
commit95295081a8557f0b63cd89f387205d5abe772788 (patch)
treebbc1ee8f36fdb2d2ba34f15cf406292e1439a87d
parent480ab1b7893290505efba925ea95d3b173aa97d4 (diff)
parent059ab50c60f19fd6dd30c574644c0e4e5747a330 (diff)
Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
-rw-r--r--progs/tests/manytex.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c52
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c22
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_x86sse.c20
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_x86sse.h3
-rw-r--r--src/gallium/auxiliary/tgsi/exec/Makefile2
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.c144
-rwxr-xr-xsrc/gallium/auxiliary/tgsi/exec/tgsi_sse2.h4
-rw-r--r--src/gallium/auxiliary/translate/translate_cache.c3
-rw-r--r--src/gallium/auxiliary/translate/translate_cache.h2
-rw-r--r--src/gallium/auxiliary/util/p_tile.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c18
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c3
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--src/mesa/state_tracker/st_format.c6
17 files changed, 259 insertions, 44 deletions
diff --git a/progs/tests/manytex.c b/progs/tests/manytex.c
index 61a1519ae6b..28f7d3b3f2d 100644
--- a/progs/tests/manytex.c
+++ b/progs/tests/manytex.c
@@ -30,6 +30,7 @@ static GLboolean LinearFilter = GL_FALSE;
static GLboolean RandomSize = GL_FALSE;
static GLint Rows, Columns;
static GLint LowPriorityCount = 0;
+static GLint Win;
static void Idle( void )
@@ -128,6 +129,13 @@ static int RandomInt(int min, int max)
}
+static void DeleteTextures(void)
+{
+ glDeleteTextures(NumTextures, TextureID);
+ free(TextureID);
+}
+
+
static void Init( void )
{
@@ -306,9 +314,12 @@ static void Key( unsigned char key, int x, int y )
Zrot += step;
break;
case ' ':
+ DeleteTextures();
Init();
break;
case 27:
+ DeleteTextures();
+ glutDestroyWindow(Win);
exit(0);
break;
}
@@ -324,7 +335,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( WinWidth, WinHeight );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
- glutCreateWindow(argv[0]);
+ Win = glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index f0763dad8d7..4ec20493c4c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -109,9 +109,10 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
struct draw_context *draw = fpme->draw;
struct draw_vertex_shader *shader = draw->vertex_shader;
unsigned opt = fpme->opt;
+ unsigned alloc_count = align_int( fetch_count, 4 );
struct vertex_header *pipeline_verts =
- (struct vertex_header *)MALLOC(fpme->vertex_size * fetch_count);
+ (struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count);
if (!pipeline_verts) {
/* Not much we can do here - just skip the rendering.
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index b1e9f671147..90926aec850 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -47,14 +47,29 @@
#include "tgsi/util/tgsi_parse.h"
#define SSE_MAX_VERTICES 4
+#define SSE_SWIZZLES 0
+#if SSE_SWIZZLES
+typedef void (XSTDCALL *codegen_function) (
+ const struct tgsi_exec_vector *input,
+ struct tgsi_exec_vector *output,
+ float (*constant)[4],
+ struct tgsi_exec_vector *temporary,
+ float (*immediates)[4],
+ const float (*aos_input)[4],
+ uint num_inputs,
+ uint input_stride,
+ float (*aos_output)[4],
+ uint num_outputs,
+ uint output_stride );
+#else
typedef void (XSTDCALL *codegen_function) (
const struct tgsi_exec_vector *input,
struct tgsi_exec_vector *output,
float (*constant)[4],
struct tgsi_exec_vector *temporary,
float (*immediates)[4] );
-
+#endif
struct draw_sse_vertex_shader {
struct draw_vertex_shader base;
@@ -91,12 +106,31 @@ vs_sse_run_linear( struct draw_vertex_shader *base,
{
struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base;
struct tgsi_exec_machine *machine = shader->machine;
- unsigned int i, j;
- unsigned slot;
+ unsigned int i;
for (i = 0; i < count; i += MAX_TGSI_VERTICES) {
unsigned int max_vertices = MIN2(MAX_TGSI_VERTICES, count - i);
+#if SSE_SWIZZLES
+ /* run compiled shader
+ */
+ shader->func(machine->Inputs,
+ machine->Outputs,
+ (float (*)[4])constants,
+ machine->Temps,
+ shader->immediates,
+ input,
+ base->info.num_inputs,
+ input_stride,
+ output,
+ base->info.num_outputs,
+ output_stride );
+
+ input = (const float (*)[4])((const char *)input + input_stride * max_vertices);
+ output = (float (*)[4])((char *)output + output_stride * max_vertices);
+#else
+ unsigned int j, slot;
+
/* Swizzle inputs.
*/
for (j = 0; j < max_vertices; j++) {
@@ -105,10 +139,10 @@ vs_sse_run_linear( struct draw_vertex_shader *base,
machine->Inputs[slot].xyzw[1].f[j] = input[slot][1];
machine->Inputs[slot].xyzw[2].f[j] = input[slot][2];
machine->Inputs[slot].xyzw[3].f[j] = input[slot][3];
- }
+ }
input = (const float (*)[4])((const char *)input + input_stride);
- }
+ }
/* run compiled shader
*/
@@ -118,7 +152,6 @@ vs_sse_run_linear( struct draw_vertex_shader *base,
machine->Temps,
shader->immediates);
-
/* Unswizzle all output results.
*/
for (j = 0; j < max_vertices; j++) {
@@ -127,10 +160,11 @@ vs_sse_run_linear( struct draw_vertex_shader *base,
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
- }
+ }
output = (float (*)[4])((char *)output + output_stride);
- }
+ }
+#endif
}
}
@@ -176,7 +210,7 @@ draw_create_vs_sse(struct draw_context *draw,
x86_init_func( &vs->sse2_program );
if (!tgsi_emit_sse2( (struct tgsi_token *) vs->base.state.tokens,
- &vs->sse2_program, vs->immediates ))
+ &vs->sse2_program, vs->immediates, SSE_SWIZZLES ))
goto fail;
vs->func = (codegen_function) x86_get_func( &vs->sse2_program );
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index d3c1ec4fbea..2fa08429715 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -134,8 +134,6 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
static INLINE void
_fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
-
assert(!fenced_buf->base.base.refcount);
assert(!fenced_buf->fence);
pb_reference(&fenced_buf->buffer, NULL);
@@ -356,11 +354,25 @@ void
buffer_fence(struct pb_buffer *buf,
struct pipe_fence_handle *fence)
{
- struct fenced_buffer *fenced_buf = fenced_buffer(buf);
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
- struct pipe_winsys *winsys = fenced_list->winsys;
+ struct fenced_buffer *fenced_buf;
+ struct fenced_buffer_list *fenced_list;
+ struct pipe_winsys *winsys;
/* FIXME: receive this as a parameter */
unsigned flags = fence ? PIPE_BUFFER_USAGE_GPU_READ_WRITE : 0;
+
+ /* This is a public function, so be extra cautious with the buffer passed,
+ * as happens frequently to receive null buffers, or pointer to buffers
+ * other than fenced buffers. */
+ assert(buf);
+ if(!buf)
+ return;
+ assert(buf->vtbl == &fenced_buffer_vtbl);
+ if(buf->vtbl != &fenced_buffer_vtbl)
+ return;
+
+ fenced_buf = fenced_buffer(buf);
+ fenced_list = fenced_buf->list;
+ winsys = fenced_list->winsys;
if(fence == fenced_buf->fence) {
/* Handle the same fence case specially, not only because it is a fast
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
index 3cd45d7dd9e..d7e22305573 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
@@ -498,6 +498,12 @@ void x86_ret( struct x86_function *p )
emit_1ub(p, 0xc3);
}
+void x86_retw( struct x86_function *p, unsigned short imm )
+{
+ DUMP();
+ emit_3ub(p, 0xc2, imm & 0xff, (imm >> 8) & 0xff);
+}
+
void x86_sahf( struct x86_function *p )
{
DUMP();
@@ -847,6 +853,20 @@ void sse_shufps( struct x86_function *p,
emit_1ub(p, shuf);
}
+void sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
+{
+ DUMP_RR( dst, src );
+ emit_2ub( p, X86_TWOB, 0x15 );
+ emit_modrm( p, dst, src );
+}
+
+void sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src )
+{
+ DUMP_RR( dst, src );
+ emit_2ub( p, X86_TWOB, 0x14 );
+ emit_modrm( p, dst, src );
+}
+
void sse_cmpps( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src,
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
index 695a1cef4e3..ad79b1facf8 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
@@ -203,6 +203,8 @@ void sse_rsqrtps( struct x86_function *p, struct x86_reg dst, struct x86_reg src
void sse_rsqrtss( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void sse_shufps( struct x86_function *p, struct x86_reg dest, struct x86_reg arg0,
unsigned char shuf );
+void sse_unpckhps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
+void sse_unpcklps( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void sse_pmovmskb( struct x86_function *p, struct x86_reg dest, struct x86_reg src );
void sse2_punpcklbw( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
@@ -219,6 +221,7 @@ void x86_or( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_pop( struct x86_function *p, struct x86_reg reg );
void x86_push( struct x86_function *p, struct x86_reg reg );
void x86_ret( struct x86_function *p );
+void x86_retw( struct x86_function *p, unsigned short imm );
void x86_sub( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_test( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_xor( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
diff --git a/src/gallium/auxiliary/tgsi/exec/Makefile b/src/gallium/auxiliary/tgsi/exec/Makefile
new file mode 100644
index 00000000000..451911a3545
--- /dev/null
+++ b/src/gallium/auxiliary/tgsi/exec/Makefile
@@ -0,0 +1,2 @@
+default:
+ cd .. ; make
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
index 9061e00b635..1138f599972 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c
@@ -1788,7 +1788,6 @@ emit_instruction(
break;
case TGSI_OPCODE_RET:
- case TGSI_OPCODE_END:
#ifdef WIN32
emit_retw( func, 16 );
#else
@@ -1796,6 +1795,9 @@ emit_instruction(
#endif
break;
+ case TGSI_OPCODE_END:
+ break;
+
case TGSI_OPCODE_SSG:
return 0;
break;
@@ -2027,6 +2029,129 @@ emit_declaration(
}
}
+static void aos_to_soa( struct x86_function *func, uint aos, uint soa, uint num, uint stride )
+{
+ struct x86_reg soa_input;
+ struct x86_reg aos_input;
+ struct x86_reg num_inputs;
+ struct x86_reg temp;
+ unsigned char *inner_loop;
+
+ soa_input = x86_make_reg( file_REG32, reg_AX );
+ aos_input = x86_make_reg( file_REG32, reg_BX );
+ num_inputs = x86_make_reg( file_REG32, reg_CX );
+ temp = x86_make_reg( file_REG32, reg_DX );
+
+ /* Save EBX */
+ x86_push( func, x86_make_reg( file_REG32, reg_BX ) );
+
+ x86_mov( func, soa_input, get_argument( soa + 1 ) );
+ x86_mov( func, aos_input, get_argument( aos + 1 ) );
+ x86_mov( func, num_inputs, get_argument( num + 1 ) );
+
+ /* do */
+ inner_loop = x86_get_label( func );
+ {
+ x86_mov( func, temp, get_argument( stride + 1 ) );
+ x86_push( func, aos_input );
+ sse_movlps( func, make_xmm( 0 ), x86_make_disp( aos_input, 0 ) );
+ sse_movlps( func, make_xmm( 3 ), x86_make_disp( aos_input, 8 ) );
+ x86_add( func, aos_input, temp );
+ sse_movhps( func, make_xmm( 0 ), x86_make_disp( aos_input, 0 ) );
+ sse_movhps( func, make_xmm( 3 ), x86_make_disp( aos_input, 8 ) );
+ x86_add( func, aos_input, temp );
+ sse_movlps( func, make_xmm( 1 ), x86_make_disp( aos_input, 0 ) );
+ sse_movlps( func, make_xmm( 4 ), x86_make_disp( aos_input, 8 ) );
+ x86_add( func, aos_input, temp );
+ sse_movhps( func, make_xmm( 1 ), x86_make_disp( aos_input, 0 ) );
+ sse_movhps( func, make_xmm( 4 ), x86_make_disp( aos_input, 8 ) );
+ x86_pop( func, aos_input );
+
+ sse_movaps( func, make_xmm( 2 ), make_xmm( 0 ) );
+ sse_movaps( func, make_xmm( 5 ), make_xmm( 3 ) );
+ sse_shufps( func, make_xmm( 0 ), make_xmm( 1 ), 0x88 );
+ sse_shufps( func, make_xmm( 2 ), make_xmm( 1 ), 0xdd );
+ sse_shufps( func, make_xmm( 3 ), make_xmm( 4 ), 0x88 );
+ sse_shufps( func, make_xmm( 5 ), make_xmm( 4 ), 0xdd );
+
+ sse_movups( func, x86_make_disp( soa_input, 0 ), make_xmm( 0 ) );
+ sse_movups( func, x86_make_disp( soa_input, 16 ), make_xmm( 2 ) );
+ sse_movups( func, x86_make_disp( soa_input, 32 ), make_xmm( 3 ) );
+ sse_movups( func, x86_make_disp( soa_input, 48 ), make_xmm( 5 ) );
+
+ /* Advance to next input */
+ x86_lea( func, aos_input, x86_make_disp(aos_input, 16) );
+ x86_lea( func, soa_input, x86_make_disp(soa_input, 64) );
+ }
+ /* while --num_inputs */
+ x86_dec( func, num_inputs );
+ x86_jcc( func, cc_NE, inner_loop );
+
+ /* Restore EBX */
+ x86_pop( func, x86_make_reg( file_REG32, reg_BX ) );
+}
+
+static void soa_to_aos( struct x86_function *func, uint aos, uint soa, uint num, uint stride )
+{
+ struct x86_reg soa_output;
+ struct x86_reg aos_output;
+ struct x86_reg num_outputs;
+ struct x86_reg temp;
+ unsigned char *inner_loop;
+
+ soa_output = x86_make_reg( file_REG32, reg_AX );
+ aos_output = x86_make_reg( file_REG32, reg_BX );
+ num_outputs = x86_make_reg( file_REG32, reg_CX );
+ temp = x86_make_reg( file_REG32, reg_DX );
+
+ /* Save EBX */
+ x86_push( func, x86_make_reg( file_REG32, reg_BX ) );
+
+ x86_mov( func, soa_output, get_argument( soa + 1 ) );
+ x86_mov( func, aos_output, get_argument( aos + 1 ) );
+ x86_mov( func, num_outputs, get_argument( num + 1 ) );
+
+ /* do */
+ inner_loop = x86_get_label( func );
+ {
+ sse_movups( func, make_xmm( 0 ), x86_make_disp( soa_output, 0 ) );
+ sse_movups( func, make_xmm( 1 ), x86_make_disp( soa_output, 16 ) );
+ sse_movups( func, make_xmm( 3 ), x86_make_disp( soa_output, 32 ) );
+ sse_movups( func, make_xmm( 4 ), x86_make_disp( soa_output, 48 ) );
+
+ sse_movaps( func, make_xmm( 2 ), make_xmm( 0 ) );
+ sse_movaps( func, make_xmm( 5 ), make_xmm( 3 ) );
+ sse_unpcklps( func, make_xmm( 0 ), make_xmm( 1 ) );
+ sse_unpckhps( func, make_xmm( 2 ), make_xmm( 1 ) );
+ sse_unpcklps( func, make_xmm( 3 ), make_xmm( 4 ) );
+ sse_unpckhps( func, make_xmm( 5 ), make_xmm( 4 ) );
+
+ x86_mov( func, temp, get_argument( stride + 1 ) );
+ x86_push( func, aos_output );
+ sse_movlps( func, x86_make_disp( aos_output, 0 ), make_xmm( 0 ) );
+ sse_movlps( func, x86_make_disp( aos_output, 8 ), make_xmm( 3 ) );
+ x86_add( func, aos_output, temp );
+ sse_movhps( func, x86_make_disp( aos_output, 0 ), make_xmm( 0 ) );
+ sse_movhps( func, x86_make_disp( aos_output, 8 ), make_xmm( 3 ) );
+ x86_add( func, aos_output, temp );
+ sse_movlps( func, x86_make_disp( aos_output, 0 ), make_xmm( 2 ) );
+ sse_movlps( func, x86_make_disp( aos_output, 8 ), make_xmm( 5 ) );
+ x86_add( func, aos_output, temp );
+ sse_movhps( func, x86_make_disp( aos_output, 0 ), make_xmm( 2 ) );
+ sse_movhps( func, x86_make_disp( aos_output, 8 ), make_xmm( 5 ) );
+ x86_pop( func, aos_output );
+
+ /* Advance to next output */
+ x86_lea( func, aos_output, x86_make_disp(aos_output, 16) );
+ x86_lea( func, soa_output, x86_make_disp(soa_output, 64) );
+ }
+ /* while --num_outputs */
+ x86_dec( func, num_outputs );
+ x86_jcc( func, cc_NE, inner_loop );
+
+ /* Restore EBX */
+ x86_pop( func, x86_make_reg( file_REG32, reg_BX ) );
+}
/**
* Translate a TGSI vertex/fragment shader to SSE2 code.
@@ -2048,7 +2173,8 @@ unsigned
tgsi_emit_sse2(
const struct tgsi_token *tokens,
struct x86_function *func,
- float (*immediates)[4])
+ float (*immediates)[4],
+ boolean do_swizzles )
{
struct tgsi_parse_context parse;
boolean instruction_phase = FALSE;
@@ -2089,6 +2215,9 @@ tgsi_emit_sse2(
else {
assert(parse.FullHeader.Processor.Processor == TGSI_PROCESSOR_VERTEX);
+ if (do_swizzles)
+ aos_to_soa( func, 5, 0, 6, 7 );
+
x86_mov(
func,
get_input_base(),
@@ -2176,6 +2305,17 @@ tgsi_emit_sse2(
}
}
+ if (parse.FullHeader.Processor.Processor == TGSI_PROCESSOR_VERTEX) {
+ if (do_swizzles)
+ soa_to_aos( func, 8, 1, 9, 10 );
+ }
+
+#ifdef WIN32
+ emit_retw( func, 16 );
+#else
+ emit_ret( func );
+#endif
+
tgsi_parse_free( &parse );
return ok;
diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
index 063287dc5e9..e66d1152836 100755
--- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
+++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h
@@ -12,8 +12,8 @@ unsigned
tgsi_emit_sse2(
const struct tgsi_token *tokens,
struct x86_function *function,
- float (*immediates)[4]
- );
+ float (*immediates)[4],
+ boolean do_swizzles );
#if defined __cplusplus
}
diff --git a/src/gallium/auxiliary/translate/translate_cache.c b/src/gallium/auxiliary/translate/translate_cache.c
index e91d648eba4..115dc9287e0 100644
--- a/src/gallium/auxiliary/translate/translate_cache.c
+++ b/src/gallium/auxiliary/translate/translate_cache.c
@@ -28,6 +28,7 @@
#include "pipe/p_util.h"
#include "pipe/p_state.h"
#include "translate.h"
+#include "translate_cache.h"
#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_hash.h"
@@ -36,7 +37,7 @@ struct translate_cache {
struct cso_hash *hash;
};
-struct translate_cache * translate_cache_create()
+struct translate_cache * translate_cache_create( void )
{
struct translate_cache *cache = MALLOC_STRUCT(translate_cache);
cache->hash = cso_hash_create();
diff --git a/src/gallium/auxiliary/translate/translate_cache.h b/src/gallium/auxiliary/translate/translate_cache.h
index 63fc57b7ea3..7dba871e579 100644
--- a/src/gallium/auxiliary/translate/translate_cache.h
+++ b/src/gallium/auxiliary/translate/translate_cache.h
@@ -38,7 +38,7 @@ struct translate_cache;
struct translate_key;
struct translate;
-struct translate_cache *translate_cache_create();
+struct translate_cache *translate_cache_create( void );
void translate_cache_destroy(struct translate_cache *cache);
/**
diff --git a/src/gallium/auxiliary/util/p_tile.c b/src/gallium/auxiliary/util/p_tile.c
index 91283a9ab08..13175ca46e6 100644
--- a/src/gallium/auxiliary/util/p_tile.c
+++ b/src/gallium/auxiliary/util/p_tile.c
@@ -730,6 +730,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
z32_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
s8z24_get_tile_rgba((unsigned *) packed, w, h, p, dst_stride);
break;
case PIPE_FORMAT_Z24S8_UNORM:
@@ -808,6 +809,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
/*z32_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
/*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
case PIPE_FORMAT_Z24S8_UNORM:
@@ -852,6 +854,7 @@ pipe_get_tile_z(struct pipe_context *pipe,
}
break;
case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
{
const uint *pSrc
= (const uint *) pipe_surface_map(ps) + (y * ps->pitch + x);
@@ -912,6 +915,7 @@ pipe_put_tile_z(struct pipe_context *pipe,
}
break;
case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
{
uint *pDest = (uint *) pipe_surface_map(ps) + (y * ps->pitch + x);
for (i = 0; i < h; i++) {
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index f857d26143e..4d569e1e22f 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -133,7 +133,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe,
x86_init_func( &shader->sse2_program );
if (!tgsi_emit_sse2( templ->tokens, &shader->sse2_program,
- shader->immediates)) {
+ shader->immediates, FALSE )) {
FREE(shader);
return NULL;
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 047ea3816bc..7597ea323c7 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -983,22 +983,8 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
else {
/* srcFormat can't be used as a texture format */
if (type == GL_DEPTH) {
- static const enum pipe_format zFormats[] = {
- PIPE_FORMAT_Z16_UNORM,
- PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_Z24S8_UNORM
- };
- uint i;
- texFormat = 0;
- for (i = 0; i < Elements(zFormats); i++) {
- if (screen->is_format_supported(screen, zFormats[i],
- PIPE_TEXTURE)) {
- texFormat = zFormats[i];
- break;
- }
- }
- assert(texFormat); /* XXX no depth texture formats??? */
+ texFormat = st_choose_format(pipe, GL_DEPTH_COMPONENT, PIPE_TEXTURE);
+ assert(texFormat != PIPE_FORMAT_NONE); /* XXX no depth texture formats??? */
}
else {
/* todo */
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 1fef55b8443..ddbe36106c8 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -240,7 +240,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width,
format, type);
- if (strb->surface->format == PIPE_FORMAT_S8Z24_UNORM) {
+ if (strb->surface->format == PIPE_FORMAT_S8Z24_UNORM ||
+ strb->surface->format == PIPE_FORMAT_X8Z24_UNORM) {
if (format == GL_DEPTH_COMPONENT) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH], j;
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 005bb2e54db..3454c3e8e80 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1381,7 +1381,7 @@ copy_image_data_to_texture(struct st_context *st,
st_texture_image_data(st->pipe,
stObj->pt,
stImage->face,
- stImage->level,
+ dstLevel,
stImage->base.Data,
stImage->base.RowStride,
stImage->base.RowStride *
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 3d15a03cab6..8b5f84cd56d 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -293,7 +293,7 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat)
/**
* Find an RGBA format supported by the context/winsys.
*/
-static GLuint
+static enum pipe_format
default_rgba_format(struct pipe_screen *screen, uint type)
{
static const enum pipe_format colorFormats[] = {
@@ -315,7 +315,7 @@ default_rgba_format(struct pipe_screen *screen, uint type)
/**
* Search list of formats for first RGBA format with >8 bits/channel.
*/
-static GLuint
+static enum pipe_format
default_deep_rgba_format(struct pipe_screen *screen, uint type)
{
if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_SNORM, type)) {
@@ -331,7 +331,7 @@ default_deep_rgba_format(struct pipe_screen *screen, uint type)
/**
* Find an Z format supported by the context/winsys.
*/
-static GLuint
+static enum pipe_format
default_depth_format(struct pipe_screen *screen, uint type)
{
static const enum pipe_format zFormats[] = {