nv40: don't crash on empty fragment program
PATCH 1/2 nv40: don't crash on empty fragment program
--- src/gallium/drivers/nv40/nv40_fragprog.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
src/gallium/drivers/nv40/nv40_fragprog.c +2 -1
@@ -843,7 +843,8 @@ nv40_fragprog_translate(struct nv40_context *nv40, fp->fp_control |= fpc->num_regs <<NV40TCL_FP_CONTROL_TEMP_COUNT_SHIFT ;/* Terminate final instruction */ - fp->insn[fpc->inst_offset] |=0x00000001 ; +if (fp->insn) + fp->insn[fpc->inst_offset] |=0x00000001 ;/* Append NOP + END instruction, may or may not be necessary. */ fpc->inst_offset = fp->insn_len;
Signature · 1 line
1.6.3.3
A message that is not in the archive (sent off-list or not yet received): 1263764160-8891-1-git-send-email-luca-Ukmtq+NC3rhBHFWNQifrYwC/[email protected]
PATCH 2/2 st: don't assert on empty fragment program
Sauerbraten triggers this assert.
--- src/mesa/state_tracker/st_atom_shader.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
src/mesa/state_tracker/st_atom_shader.c +0 -2
@@ -79,8 +79,6 @@ translate_fp(struct st_context *st, stfp->num_input_slots = numIn; -assert (stfp->Base.Base.NumInstructions >1 ); -st_translate_fragment_program (st, stfp, stfp->input_to_slot); } }
Signature · 1 line
1.6.3.3
Re: [PATCH 2/2] st: don't assert on empty fragment program
Quoted 10 lines · Luca Barbieri
Sauerbraten triggers this assert.
--- src/mesa/state_tracker/st_atom_shader.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)src/mesa/state_tracker/st_atom_shader.c +0
-0
src/mesa/state_tracker/st_atom_shader.c translate_fp(struct st_context *st, · line 84
Quoted 8 lines
src/mesa/state_tracker/st_atom_shader.c +0
-2@@ -79,8 +79,6 @@ translate_fp(struct st_context *st, stfp->num_input_slots = numIn; -assert (stfp->Base.Base.NumInstructions >1 ); -st_translate_fragment_program (st, stfp, stfp->input_to_slot); } }
How do we end up with a shader that has only one instruction (or none)? Is it an END instruction? I'd like to learn more about what's happening before committing this.
-Brian
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Mesa3d-dev] [PATCH 2/2] st: don't assert on empty fragment program
Breakpoint 3, _mesa_ProgramStringARB (target=34820, format=34933, len=70, string=0x85922ba) at shader/arbprogram.c:434
434 GET_CURRENT_CONTEXT(ctx);
$31 = 0x85922ba "!!ARBfp1.0\n \n OPTION
ARB_precision_hint_fastest;\n \n\n\n END\n"
Not sure why Sauerbraten does this, but it does, at least on my system (Ubuntu Karmic, nv40 driver) and it should be legal.
Re: [PATCH 2/2] st: don't assert on empty fragment program
Quoted 8 lines · Luca Barbieri
Breakpoint 3,
_mesa_ProgramStringARB(target=34820, format=34933, len=70, string=0x85922ba) atshader/arbprogram.c:434
434GET_CURRENT_CONTEXT(ctx);
$31 =0x85922ba"!!ARBfp1.0\n \n OPTION
ARB_precision_hint_fastest;\n \n\n\n END\n"Not sure why Sauerbraten does this, but it does, at least on my system (Ubuntu Karmic, nv40 driver) and it should be legal.
OK, GL_ARB_fragment_programs says a fragment program does not have to write a color result (so the color is undefined).
But the assertion should be changed to "num instructions > 0" and not removed. I'll fix that.
-Brian
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Mesa3d-dev] [PATCH 2/2] st: don't assert on empty fragment program
Quoted 2 lines
But the assertion should be changed to "num instructions > 0" and not removed. I'll fix that.
OK.
Programs without END should be rejected by the parser anyway though.
Re: [PATCH 2/2] st: don't assert on empty fragment program
In reply to Luca BarbieriQuoted 8 lines · Luca Barbieri
Breakpoint 3,
_mesa_ProgramStringARB(target=34820, format=34933, len=70, string=0x85922ba) atshader/arbprogram.c:434
434GET_CURRENT_CONTEXT(ctx);
$31 =0x85922ba"!!ARBfp1.0\n \n OPTION
ARB_precision_hint_fastest;\n \n\n\n END\n"Not sure why Sauerbraten does this, but it does, at least on my system (Ubuntu Karmic, nv40 driver) and it should be legal.
Probably depth writes only enabled for things like shadows?
Roland
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev