[Mesa-dev] [PATCH] gallium: remove PIPE_SHADER_CAP_OUTPUT_READ

Jose Fonseca jfonseca at vmware.com
Fri Feb 24 06:10:15 PST 2012


Looks good and I think it is the right thing to do. Thanks Marek.

Jose

----- Original Message -----
> r600g is the only driver which has made use of it. The reason the CAP
> was
> added was to fix some piglit tests when the GLSL pass
> lower_output_reads
> didn't exist.
> 
> However, not removing output reads breaks the fallback for
> glClampColorARB,
> which assumes outputs are not readable. The fix would be non-trivial
> and my personal preference is to remove the CAP, considering that
> reading
> outputs is uncommon and that we can now use lower_output_reads to fix
> the issue that the CAP was supposed to workaround in the first place.
> ---
>  src/gallium/drivers/i915/i915_screen.c     |    2 --
>  src/gallium/drivers/nv50/nv50_screen.c     |    2 --
>  src/gallium/drivers/nvc0/nvc0_screen.c     |    2 --
>  src/gallium/drivers/r300/r300_screen.c     |    2 --
>  src/gallium/drivers/r600/r600_pipe.c       |    2 --
>  src/gallium/drivers/svga/svga_screen.c     |    4 ----
>  src/gallium/include/pipe/p_defines.h       |    1 -
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   13 ++-----------
>  8 files changed, 2 insertions(+), 26 deletions(-)
> 
> diff --git a/src/gallium/drivers/i915/i915_screen.c
> b/src/gallium/drivers/i915/i915_screen.c
> index 61340f3..9703210 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -151,8 +151,6 @@ i915_get_shader_param(struct pipe_screen *screen,
> unsigned shader, enum pipe_sha
>           return 0;
>        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
>           return I915_TEX_UNITS;
> -      case PIPE_SHADER_CAP_OUTPUT_READ:
> -         return 0;
>        default:
>           debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);
>           return 0;
> diff --git a/src/gallium/drivers/nv50/nv50_screen.c
> b/src/gallium/drivers/nv50/nv50_screen.c
> index 1d53593..27566e2 100644
> --- a/src/gallium/drivers/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nv50/nv50_screen.c
> @@ -206,8 +206,6 @@ nv50_screen_get_shader_param(struct pipe_screen
> *pscreen, unsigned shader,
>        return 0;
>     case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
>        return 32;
> -   case PIPE_SHADER_CAP_OUTPUT_READ:
> -      return 0; /* maybe support this for fragment shaders ? */
>     default:
>        NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
>        return 0;
> diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c
> b/src/gallium/drivers/nvc0/nvc0_screen.c
> index abc04ab..f7637ee 100644
> --- a/src/gallium/drivers/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nvc0/nvc0_screen.c
> @@ -202,8 +202,6 @@ nvc0_screen_get_shader_param(struct pipe_screen
> *pscreen, unsigned shader,
>     case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLER_VIEWS:
>        return 32;
>        */
> -   case PIPE_SHADER_CAP_OUTPUT_READ:
> -      return 0; /* shader != PIPE_SHADER_TESSELLATION_CONTROL; */
>     default:
>        NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
>        return 0;
> diff --git a/src/gallium/drivers/r300/r300_screen.c
> b/src/gallium/drivers/r300/r300_screen.c
> index 9ac5781..1a8e789 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -210,7 +210,6 @@ static int r300_get_shader_param(struct
> pipe_screen *pscreen, unsigned shader, e
>          case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
>          case PIPE_SHADER_CAP_SUBROUTINES:
>          case PIPE_SHADER_CAP_INTEGERS:
> -        case PIPE_SHADER_CAP_OUTPUT_READ:
>              return 0;
>          }
>          break;
> @@ -256,7 +255,6 @@ static int r300_get_shader_param(struct
> pipe_screen *pscreen, unsigned shader, e
>          case PIPE_SHADER_CAP_SUBROUTINES:
>          case PIPE_SHADER_CAP_INTEGERS:
>          case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
> -        case PIPE_SHADER_CAP_OUTPUT_READ:
>              return 0;
>          }
>          break;
> diff --git a/src/gallium/drivers/r600/r600_pipe.c
> b/src/gallium/drivers/r600/r600_pipe.c
> index 53f9bd6..7c82804 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -541,8 +541,6 @@ static int r600_get_shader_param(struct
> pipe_screen* pscreen, unsigned shader, e
>  		return 0;
>  	case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
>  		return 16;
> -	case PIPE_SHADER_CAP_OUTPUT_READ:
> -		return 1;
>  	}
>  	return 0;
>  }
> diff --git a/src/gallium/drivers/svga/svga_screen.c
> b/src/gallium/drivers/svga/svga_screen.c
> index 8d47e69..20f17d8 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -262,8 +262,6 @@ static int svga_get_shader_param(struct
> pipe_screen *screen, unsigned shader, en
>           return 0;
>        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
>           return 16;
> -      case PIPE_SHADER_CAP_OUTPUT_READ:
> -         return 0;
>        }
>        break;
>     case PIPE_SHADER_VERTEX:
> @@ -307,8 +305,6 @@ static int svga_get_shader_param(struct
> pipe_screen *screen, unsigned shader, en
>           return 0;
>        case PIPE_SHADER_CAP_INTEGERS:
>           return 0;
> -      case PIPE_SHADER_CAP_OUTPUT_READ:
> -         return 0;
>        default:
>           break;
>        }
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index 4155178..096749b 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -533,7 +533,6 @@ enum pipe_shader_cap
>     PIPE_SHADER_CAP_SUBROUTINES = 16, /* BGNSUB, ENDSUB, CAL, RET */
>     PIPE_SHADER_CAP_INTEGERS = 17,
>     PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18,
> -   PIPE_SHADER_CAP_OUTPUT_READ = 19
>  };
>  
>  
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index f139e95..b022785 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -4746,8 +4746,6 @@ get_mesa_program(struct gl_context *ctx,
>  {
>     glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
>     struct gl_program *prog;
> -   struct pipe_screen * screen = st_context(ctx)->pipe->screen;
> -   unsigned pipe_shader_type;
>     GLenum target;
>     const char *target_string;
>     bool progress;
> @@ -4758,17 +4756,14 @@ get_mesa_program(struct gl_context *ctx,
>     case GL_VERTEX_SHADER:
>        target = GL_VERTEX_PROGRAM_ARB;
>        target_string = "vertex";
> -      pipe_shader_type = PIPE_SHADER_VERTEX;
>        break;
>     case GL_FRAGMENT_SHADER:
>        target = GL_FRAGMENT_PROGRAM_ARB;
>        target_string = "fragment";
> -      pipe_shader_type = PIPE_SHADER_FRAGMENT;
>        break;
>     case GL_GEOMETRY_SHADER:
>        target = GL_GEOMETRY_PROGRAM_NV;
>        target_string = "geometry";
> -      pipe_shader_type = PIPE_SHADER_GEOMETRY;
>        break;
>     default:
>        assert(!"should not be reached");
> @@ -4792,12 +4787,8 @@ get_mesa_program(struct gl_context *ctx,
>     _mesa_generate_parameters_list_for_uniforms(shader_program,
>     shader,
>  					       prog->Parameters);
>  
> -   if (!screen->get_shader_param(screen, pipe_shader_type,
> -                                 PIPE_SHADER_CAP_OUTPUT_READ)) {
> -      /* Remove reads to output registers, and to varyings in vertex
> shaders. */
> -      lower_output_reads(shader->ir);
> -   }
> -
> +   /* Remove reads from output registers. */
> +   lower_output_reads(shader->ir);
>  
>     /* Emit intermediate IR for main(). */
>     visit_exec_list(shader->ir, v);
> --
> 1.7.5.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list