Re: [Mesa-dev] [PATCH 5/7] ir_to_mesa: Emit warnings instead of errors for IR that can't be lowered

2011-08-02 Thread Kenneth Graunke
On 08/01/2011 10:20 AM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Rely on the driver to do the right thing.  This probably means falling
 back to software.  Page 88 of the OpenGL 2.1 spec specifically says:
 
 A shader should not fail to compile, and a program object should
 not fail to link due to lack of instruction space or lack of
 temporary variables. Implementations should ensure that all valid
 shaders and program objects may be successfully compiled, linked
 and executed.
 
 There is no provision for saying No to a valid shader that is
 difficult for the hardware to handle, so stop doing that.
 
 On i915 this causes a large number of piglit tests to change from FAIL
 to WARN.  The warning is because the driver still emits messages to
 stderr like i915_program_error: Unsupported opcode: BGNLOOP.
 
 It also fixes ES2 conformance CorrectFull_frag and CorrectParse1_frag
 on i915 (and probably other hardware that can't handle loops).
 ---
  src/mesa/program/ir_to_mesa.cpp |   28 
  1 files changed, 24 insertions(+), 4 deletions(-)

Presumably drivers are set up to handle cases where these opcodes slip
through?  I'd hate for them to crash because we started letting things
through.  Though, admittedly, that's a bug in the driver, so if the
compiler were to stop hiding it, people could go fix that. :)

Plus, it looks like i915 already handles them, i965 supports everything
so it doesn't matter, and Gallium's dropping ir_to_mesa soon.  So, meh.
:) Fears unfounded.

Looks like the right thing to do.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/7] ir_to_mesa: Emit warnings instead of errors for IR that can't be lowered

2011-08-01 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Rely on the driver to do the right thing.  This probably means falling
back to software.  Page 88 of the OpenGL 2.1 spec specifically says:

A shader should not fail to compile, and a program object should
not fail to link due to lack of instruction space or lack of
temporary variables. Implementations should ensure that all valid
shaders and program objects may be successfully compiled, linked
and executed.

There is no provision for saying No to a valid shader that is
difficult for the hardware to handle, so stop doing that.

On i915 this causes a large number of piglit tests to change from FAIL
to WARN.  The warning is because the driver still emits messages to
stderr like i915_program_error: Unsupported opcode: BGNLOOP.

It also fixes ES2 conformance CorrectFull_frag and CorrectParse1_frag
on i915 (and probably other hardware that can't handle loops).
---
 src/mesa/program/ir_to_mesa.cpp |   28 
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 3c553a5..83b96f5 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2980,11 +2980,31 @@ get_mesa_program(struct gl_context *ctx,
  if (mesa_inst-SrcReg[src].RelAddr)
 prog-IndirectRegisterFiles |= 1  mesa_inst-SrcReg[src].File;
 
-  if (options-EmitNoIfs  mesa_inst-Opcode == OPCODE_IF) {
-linker_error_printf(shader_program, Couldn't flatten if statement\n);
-  }
-
   switch (mesa_inst-Opcode) {
+  case OPCODE_IF:
+if (options-EmitNoIfs) {
+   linker_warning_printf(shader_program,
+ Couldn't flatten if-statement.  
+ This will likely result in software 
+ rasterization.\n);
+}
+break;
+  case OPCODE_BGNLOOP:
+if (options-EmitNoLoops) {
+   linker_warning_printf(shader_program,
+ Couldn't unroll loop.  
+ This will likely result in software 
+ rasterization.\n);
+}
+break;
+  case OPCODE_CONT:
+if (options-EmitNoCont) {
+   linker_warning_printf(shader_program,
+ Couldn't lower continue-statement.  
+ This will likely result in software 
+ rasterization.\n);
+}
+break;
   case OPCODE_BGNSUB:
 inst-function-inst = i;
 mesa_inst-Comment = strdup(inst-function-sig-function_name());
-- 
1.7.4.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev