diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 24 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/Makefile | 1 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_info.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_sanity.c | 22 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 6 |
6 files changed, 43 insertions, 18 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index f22ba40824..b1ccfc0374 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -765,12 +765,30 @@ void cso_restore_vertex_shader(struct cso_context *ctx) } +/** + * Copy framebuffer state from src to dst with refcounting of surfaces. + */ +static void +copy_framebuffer_state(struct pipe_framebuffer_state *dst, + const struct pipe_framebuffer_state *src) +{ + uint i; + + dst->width = src->width; + dst->height = src->height; + dst->num_cbufs = src->num_cbufs; + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]); + } + pipe_surface_reference(&dst->zsbuf, src->zsbuf); +} + enum pipe_error cso_set_framebuffer(struct cso_context *ctx, const struct pipe_framebuffer_state *fb) { if (memcmp(&ctx->fb, fb, sizeof(*fb)) != 0) { - ctx->fb = *fb; + copy_framebuffer_state(&ctx->fb, fb); ctx->pipe->set_framebuffer_state(ctx->pipe, fb); } return PIPE_OK; @@ -778,13 +796,13 @@ enum pipe_error cso_set_framebuffer(struct cso_context *ctx, void cso_save_framebuffer(struct cso_context *ctx) { - ctx->fb_saved = ctx->fb; + copy_framebuffer_state(&ctx->fb_saved, &ctx->fb); } void cso_restore_framebuffer(struct cso_context *ctx) { if (memcmp(&ctx->fb, &ctx->fb_saved, sizeof(ctx->fb))) { - ctx->fb = ctx->fb_saved; + copy_framebuffer_state(&ctx->fb, &ctx->fb_saved); ctx->pipe->set_framebuffer_state(ctx->pipe, &ctx->fb); } } diff --git a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c index 4f1326053d..e1af9e56a2 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_wide_point.c +++ b/src/gallium/auxiliary/draw/draw_pipe_wide_point.c @@ -222,8 +222,8 @@ static void widepoint_first_point( struct draw_stage *stage, /* find fragment shader PointCoord/Fog input */ wide->point_coord_fs_input = 0; /* XXX fix this! */ - /* setup extra vp output */ - draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_FOG; + /* setup extra vp output (point coord implemented as a texcoord) */ + draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC; draw->extra_vp_outputs.semantic_index = 0; draw->extra_vp_outputs.slot = draw->vs.num_vs_outputs; } diff --git a/src/gallium/auxiliary/tgsi/Makefile b/src/gallium/auxiliary/tgsi/Makefile index 806a2bd4c5..c5d2082087 100644 --- a/src/gallium/auxiliary/tgsi/Makefile +++ b/src/gallium/auxiliary/tgsi/Makefile @@ -4,6 +4,7 @@ include $(TOP)/configs/current LIBNAME = tgsi C_SOURCES = \ + tgsi_sanity.c \ tgsi_build.c \ tgsi_dump.c \ tgsi_exec.c \ diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index a4899cd4c2..68c7a6b7f5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -69,7 +69,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, "COS" }, { 1, 1, 0, 0, "DDX" }, { 1, 1, 0, 0, "DDY" }, - { 0, 1, 0, 0, "KILP" }, + { 0, 0, 0, 0, "KILP" }, { 1, 1, 0, 0, "PK2H" }, { 1, 1, 0, 0, "PK2US" }, { 1, 1, 0, 0, "PK4B" }, @@ -146,7 +146,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 1, 0, 0, "CALLNZ" }, { 0, 1, 0, 0, "IFC" }, { 0, 1, 0, 0, "BREAKC" }, - { 0, 0, 0, 0, "KIL" }, + { 0, 1, 0, 0, "KIL" }, { 0, 0, 0, 0, "END" }, { 1, 1, 0, 0, "SWZ" } }; diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index c659027296..11659247c0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -152,6 +152,12 @@ check_register_usage( { if (!check_file_name( ctx, file )) return FALSE; + + if (index < 0 || index > MAX_REGISTERS) { + report_error( ctx, "%s[%i]: Invalid index %s", file_names[file], index, name ); + return FALSE; + } + if (indirect_access) { if (!is_any_register_declared( ctx, file )) report_error( ctx, "%s: Undeclared %s register", file_names[file], name ); @@ -174,12 +180,10 @@ iter_instruction( const struct tgsi_opcode_info *info; uint i; - /* There must be no other instructions after END. - */ - if (ctx->index_of_END != ~0) { - report_error( ctx, "Unexpected instruction after END" ); - } - else if (inst->Instruction.Opcode == TGSI_OPCODE_END) { + if (inst->Instruction.Opcode == TGSI_OPCODE_END) { + if (ctx->index_of_END != ~0) { + report_error( ctx, "Too many END instructions" ); + } ctx->index_of_END = ctx->num_instructions; } @@ -301,10 +305,10 @@ epilog( struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter; uint file; - /* There must be an END instruction at the end. + /* There must be an END instruction somewhere. */ - if (ctx->index_of_END == ~0 || ctx->index_of_END != ctx->num_instructions - 1) { - report_error( ctx, "Expected END at end of instruction sequence" ); + if (ctx->index_of_END == ~0) { + report_error( ctx, "Missing END instruction" ); } /* Check if all declared registers were used. diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 9b4ca39371..0b10622ee7 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -272,8 +272,10 @@ util_fast_log2(float val) static INLINE float util_fast_pow(float x, float y) { - /* XXX this test may need adjustment */ - if (y >= 3.0 && -0.02f <= x && x <= 0.02f) + /* XXX these tests may need adjustment */ + if (y >= 3.0f && (-0.02f <= x && x <= 0.02f)) + return 0.0f; + if (y >= 50.0f && (-0.9f <= x && x <= 0.9f)) return 0.0f; return util_fast_exp2(util_fast_log2(x) * y); } |