summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-11-01 11:54:52 -0800
committerCorbin Simpson <[email protected]>2009-11-01 11:54:52 -0800
commit1f630fa0167ed799556a764178772c096a3ddeba (patch)
tree41bcdd3ea06bf82e5c613dc52e4fbc30104bc375 /src/gallium
parent3d73852121f13832f6bc87918798ff96589d0349 (diff)
r300g: Miscellania. Avoid draw segfaults, s/true/TRUE/, etc.
Cleared out my git stash.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_debug.c6
-rw-r--r--src/gallium/drivers/r300/r300_emit.c2
-rw-r--r--src/gallium/drivers/r300/r300_state.c28
-rw-r--r--src/gallium/drivers/r300/r300_vs.c4
5 files changed, 28 insertions, 14 deletions
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index b1738452de0..ae7015634cc 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -339,7 +339,7 @@ void r300_init_surface_functions(struct r300_context* r300);
static INLINE boolean DBG_ON(struct r300_context * ctx, unsigned flags)
{
- return (ctx->debug & flags) ? true : false;
+ return (ctx->debug & flags) ? TRUE : FALSE;
}
static INLINE void DBG(struct r300_context * ctx, unsigned flags, const char * fmt, ...)
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index 421253ca722..2a6ed54ac9b 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -49,7 +49,7 @@ static struct debug_option debug_options[] = {
void r300_init_debug(struct r300_context * ctx)
{
const char * options = debug_get_option("RADEON_DEBUG", 0);
- boolean printhint = false;
+ boolean printhint = FALSE;
size_t length;
struct debug_option * opt;
@@ -71,14 +71,14 @@ void r300_init_debug(struct r300_context * ctx)
if (!opt->name) {
debug_printf("Unknown debug option: %s\n", options);
- printhint = true;
+ printhint = TRUE;
}
options += length;
}
if (!ctx->debug)
- printhint = true;
+ printhint = TRUE;
}
if (printhint || ctx->debug & DBG_HELP) {
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 5b03c1aa6c1..79972dbb49e 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -800,7 +800,7 @@ validate:
for (i = 0; i < r300->texture_count; i++) {
tex = r300->textures[i];
if (!tex)
- continue;
+ continue;
if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
r300->context.flush(&r300->context, 0, NULL);
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 4cf01389d2b..af063d4b20a 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -281,7 +281,9 @@ static void
{
struct r300_context* r300 = r300_context(pipe);
- draw_flush(r300->draw);
+ if (r300->draw) {
+ draw_flush(r300->draw);
+ }
r300->framebuffer_state = *state;
@@ -444,10 +446,13 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
struct r300_context* r300 = r300_context(pipe);
struct r300_rs_state* rs = (struct r300_rs_state*)state;
- draw_flush(r300->draw);
- draw_set_rasterizer_state(r300->draw, &rs->rs);
+ if (r300->draw) {
+ draw_flush(r300->draw);
+ draw_set_rasterizer_state(r300->draw, &rs->rs);
+ }
r300->rs_state = rs;
+ /* XXX Clean these up when we move to atom emits */
r300->dirty_state |= R300_NEW_RASTERIZER;
r300->dirty_state |= R300_NEW_RS_BLOCK;
r300->dirty_state |= R300_NEW_SCISSOR;
@@ -623,8 +628,10 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
r300->vertex_buffer_count = count;
- draw_flush(r300->draw);
- draw_set_vertex_buffers(r300->draw, count, buffers);
+ if (r300->draw) {
+ draw_flush(r300->draw);
+ draw_set_vertex_buffers(r300->draw, count, buffers);
+ }
}
static void r300_set_vertex_elements(struct pipe_context* pipe,
@@ -633,8 +640,15 @@ static void r300_set_vertex_elements(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
- draw_flush(r300->draw);
- draw_set_vertex_elements(r300->draw, count, elements);
+ memcpy(r300->vertex_elements, elements,
+ sizeof(struct pipe_vertex_element) * count);
+
+ r300->vertex_element_count = count;
+
+ if (r300->draw) {
+ draw_flush(r300->draw);
+ draw_set_vertex_elements(r300->draw, count, elements);
+ }
}
static void* r300_create_vs_state(struct pipe_context* pipe,
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index eca85879a7f..74ef416dc14 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -37,7 +37,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
struct tgsi_shader_info* info = &vs->info;
struct tgsi_parse_context parser;
struct tgsi_full_declaration * decl;
- boolean pointsize = false;
+ boolean pointsize = FALSE;
int out_colors = 0;
int colors = 0;
int out_generic = 0;
@@ -52,7 +52,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
for (i = 0; i < info->num_outputs; i++) {
switch (info->output_semantic_name[i]) {
case TGSI_SEMANTIC_PSIZE:
- pointsize = true;
+ pointsize = TRUE;
break;
case TGSI_SEMANTIC_COLOR:
out_colors++;