From b5ddc7821a334177ff3f6c0ea3a5c24245ad194c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Dec 2009 13:28:39 -0700 Subject: mesa: fix binary() function, printf format string Need to use the constant 1ULL and 0xllx format string. This fixes incorrect results and a NULL pointer/parameter bug. --- src/mesa/shader/prog_print.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 52c102cbaa3..9f9789e010c 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -821,8 +821,10 @@ _mesa_print_program(const struct gl_program *prog) /** - * Return binary representation of value (as a string). + * Return binary representation of 64-bit value (as a string). * Insert a comma to separate each group of 8 bits. + * Note we return a pointer to local static storage so this is not + * re-entrant, etc. * XXX move to imports.[ch] if useful elsewhere. */ static const char * @@ -831,7 +833,7 @@ binary(GLbitfield64 val) static char buf[80]; GLint i, len = 0; for (i = 63; i >= 0; --i) { - if (val & (1 << i)) + if (val & (1ULL << i)) buf[len++] = '1'; else if (len > 0 || i == 0) buf[len++] = '0'; @@ -855,7 +857,7 @@ _mesa_fprint_program_parameters(FILE *f, _mesa_fprintf(f, "InputsRead: 0x%x (0b%s)\n", prog->InputsRead, binary(prog->InputsRead)); - _mesa_fprintf(f, "OutputsWritten: 0x%x (0b%s)\n", + _mesa_fprintf(f, "OutputsWritten: 0x%llx (0b%s)\n", prog->OutputsWritten, binary(prog->OutputsWritten)); _mesa_fprintf(f, "NumInstructions=%d\n", prog->NumInstructions); _mesa_fprintf(f, "NumTemporaries=%d\n", prog->NumTemporaries); -- cgit v1.2.3 From 8e8502bc6352227afda370cfeeb1a49b128df752 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sun, 20 Dec 2009 05:03:03 -0800 Subject: gallium: only create pipe buffer when size is nonzero - This fixes a crash upon starting spring (a rts engine/game). Signed-off-by: Maarten Maathuis --- src/mesa/state_tracker/st_cb_bufferobjects.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 63196afba9c..494a3a99c87 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -170,15 +170,19 @@ st_bufferobj_data(GLcontext *ctx, pipe_buffer_reference( &st_obj->buffer, NULL ); - st_obj->buffer = pipe_buffer_create( pipe->screen, 32, buffer_usage, size ); + if (size != 0) { + st_obj->buffer = pipe_buffer_create(pipe->screen, 32, buffer_usage, size); - if (!st_obj->buffer) { - return GL_FALSE; + if (!st_obj->buffer) { + return GL_FALSE; + } + + if (data) + st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0, + size, data); + return GL_TRUE; } - if (data) - st_no_flush_pipe_buffer_write(st_context(ctx), st_obj->buffer, 0, - size, data); return GL_TRUE; } -- cgit v1.2.3 From 7831515e69ac875b1ac0b1b248ab10c6cf37bf52 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Dec 2009 10:09:24 -0700 Subject: st/mesa: add missing case for PIPE_FORMAT_B8G8R8A8_UNORM --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 02f80057c29..091f68190e5 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -291,6 +291,8 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat) return MESA_FORMAT_ARGB8888; case PIPE_FORMAT_X8R8G8B8_UNORM: return MESA_FORMAT_XRGB8888; + case PIPE_FORMAT_B8G8R8A8_UNORM: + return MESA_FORMAT_ARGB8888_REV; case PIPE_FORMAT_A1R5G5B5_UNORM: return MESA_FORMAT_ARGB1555; case PIPE_FORMAT_A4R4G4B4_UNORM: -- cgit v1.2.3