diff options
author | Paul Berry <[email protected]> | 2011-10-25 18:06:37 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2011-10-27 15:30:58 -0700 |
commit | cf45949d6a896651a5f3864d3b195e26d59eee74 (patch) | |
tree | bcea46177d6c94002317b3b26371a85df5dcd61f /src/mesa | |
parent | 0fbc8d301b66aebb95507d715b3128ff711610fd (diff) |
mesa: Expose GLSL interpolation qualifiers in gl_fragment_program.
This patch makes GLSL interpolation qualifiers visible to drivers via
the array InterpQualifier[] in gl_fragment_program, so that they can
easily be used by driver back-ends to select the correct interpolation
mode.
Previous to this patch, the GLSL compiler was using the enum
ir_variable_interpolation to represent interpolation types. Rather
than make a duplicate enum in core mesa to represent the same thing, I
moved the enum into mtypes.h and renamed it to be more consistent with
the other enums defined there.
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/mtypes.h | 19 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4117686414e..9410e3ff67a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1790,6 +1790,18 @@ typedef enum } gl_system_value; +/** + * The possible interpolation qualifiers that can be applied to a fragment + * shader input in GLSL. + */ +enum glsl_interp_qualifier +{ + INTERP_QUALIFIER_SMOOTH, + INTERP_QUALIFIER_FLAT, + INTERP_QUALIFIER_NOPERSPECTIVE +}; + + /** Vertex and fragment instructions */ struct prog_instruction; struct gl_program_parameter_list; @@ -1890,6 +1902,13 @@ struct gl_fragment_program GLboolean OriginUpperLeft; GLboolean PixelCenterInteger; enum gl_frag_depth_layout FragDepthLayout; + + /** + * GLSL interpolation qualifier associated with each fragment shader input. + * For inputs that do not have an interpolation qualifier specified in + * GLSL, the value is INTERP_QUALIFIER_SMOOTH. + */ + enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX]; }; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index bdbb6b93838..93563bdaa5b 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -3191,7 +3191,7 @@ get_mesa_program(struct gl_context *ctx, prog->Instructions = mesa_instructions; prog->NumInstructions = num_instructions; - do_set_program_inouts(shader->ir, prog); + do_set_program_inouts(shader->ir, prog, shader->Type == GL_FRAGMENT_SHADER); count_resources(prog); check_resources(ctx, shader_program, prog); diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 145bd7dcd0c..67a1b513bda 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4966,7 +4966,7 @@ get_mesa_program(struct gl_context *ctx, prog->Instructions = NULL; prog->NumInstructions = 0; - do_set_program_inouts(shader->ir, prog); + do_set_program_inouts(shader->ir, prog, shader->Type == GL_FRAGMENT_SHADER); count_resources(v, prog); check_resources(ctx, shader_program, v, prog); |