aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-07-19 14:52:54 -0600
committerBrian Paul <[email protected]>2011-09-23 07:58:47 -0600
commit49a6f5e68eeb6b23bb040cfc1f93befc2f1eb35a (patch)
tree36578885d55da5e1d5bee44f1ae800f7b15fa547 /src/gallium
parent2f40e4aac7ab79deb06ff6ab9ae03a896d7a9169 (diff)
svga: check that we don't exceed input/ouput register limits
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_state_fs.c2
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_decl_sm30.c12
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_insn.c1
3 files changed, 13 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index 8a50bfd344a..5b96750bbf1 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -76,7 +76,7 @@ static enum pipe_error compile_fs( struct svga_context *svga,
result = svga_translate_fragment_program( fs, key );
if (result == NULL) {
- ret = PIPE_ERROR_OUT_OF_MEMORY;
+ ret = PIPE_ERROR; /* some problem during translation */
goto fail;
}
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index 6f162ea7e33..6f408704863 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -124,6 +124,9 @@ ps30_input_emit_depth_fog( struct svga_shader_emitter *emit,
return TRUE;
}
+ if (emit->ps30_input_count >= SVGA3D_INPUTREG_MAX)
+ return FALSE;
+
reg = src_register( SVGA3DREG_INPUT,
emit->ps30_input_count++ );
@@ -195,6 +198,9 @@ static boolean ps30_input( struct svga_shader_emitter *emit,
if (!translate_vs_ps_semantic( semantic, &usage, &index ))
return FALSE;
+ if (emit->ps30_input_count >= SVGA3D_INPUTREG_MAX)
+ return FALSE;
+
reg = dst_register( SVGA3DREG_INPUT, emit->ps30_input_count++ );
if (!emit_decl( emit, reg, usage, index ))
@@ -231,6 +237,9 @@ static boolean ps30_input( struct svga_shader_emitter *emit,
if (!translate_vs_ps_semantic( semantic, &usage, &index ))
return FALSE;
+ if (emit->ps30_input_count >= SVGA3D_INPUTREG_MAX)
+ return FALSE;
+
emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count++ );
reg = dst( emit->input_map[idx] );
@@ -392,6 +401,9 @@ static boolean vs30_output( struct svga_shader_emitter *emit,
if (!translate_vs_ps_semantic( semantic, &usage, &index ))
return FALSE;
+ if (emit->vs30_output_count >= SVGA3D_OUTPUTREG_MAX)
+ return FALSE;
+
dcl.dst = dst_register( SVGA3DREG_OUTPUT, emit->vs30_output_count++ );
dcl.usage = usage;
dcl.index = index;
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index 6f03e61db55..05531a15eb5 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -3184,7 +3184,6 @@ boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit,
goto done;
done:
- assert(ret);
tgsi_parse_free( &parse );
return ret;
}