vrend/shader: prefer the use of "arrays of arrays" for passing varyings

Arrays of arrays are way easier to handle and they are available on GLES
3.1, D-GL 4.3, and all hardware that is supported by mesa. The old code
path is still able to use blocks for passing parameters to and from
tesselation and geometry stages, but for the new code path they are
required.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 6 years ago committed by Gert Wollny
parent bb76c1aec7
commit cb51104a07
  1. 2
      src/vrend_renderer.c
  2. 34
      src/vrend_shader.c
  3. 1
      src/vrend_shader.h

@ -5588,6 +5588,8 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de
grctx->shader_cfg.use_core_profile = vrend_state.use_core_profile; grctx->shader_cfg.use_core_profile = vrend_state.use_core_profile;
grctx->shader_cfg.use_explicit_locations = vrend_state.use_explicit_locations; grctx->shader_cfg.use_explicit_locations = vrend_state.use_explicit_locations;
grctx->shader_cfg.max_draw_buffers = vrend_state.max_draw_buffers; grctx->shader_cfg.max_draw_buffers = vrend_state.max_draw_buffers;
grctx->shader_cfg.has_arrays_of_arrays = has_feature(feat_arrays_of_arrays);
vrend_renderer_create_sub_ctx(grctx, 0); vrend_renderer_create_sub_ctx(grctx, 0);
vrend_renderer_set_sub_ctx(grctx, 0); vrend_renderer_set_sub_ctx(grctx, 0);

@ -323,26 +323,34 @@ enum io_type {
io_out io_out
}; };
/* On D-GL we prefer using IO blocks because they are supported since 3.1 and /* We prefer arrays of arrays, but if this is not available then TCS, GEOM, and TES
* arrays of arrays are only available since 4.3 (or with an extension). * inputs must be blocks, but FS input should not because interpolateAt* doesn't
* On the other hand on GLES arrays of arrays are available since 3.1 but * support dereferencing block members. */
* interface blocks are only part odf the spec since 3.2.
*
* In any case the transfer from TCS to TES has to be an interface block
* and the output of FS should not be an interface block because interpolateAt*
* doesn't support this.
*/
static inline bool prefer_generic_io_block(struct dump_ctx *ctx, enum io_type io) static inline bool prefer_generic_io_block(struct dump_ctx *ctx, enum io_type io)
{ {
if (ctx->cfg->has_arrays_of_arrays)
return false;
switch (ctx->prog_type) { switch (ctx->prog_type) {
case TGSI_PROCESSOR_FRAGMENT: case TGSI_PROCESSOR_FRAGMENT:
return io == io_in ? (!ctx->cfg->use_gles) : false; return false;
case TGSI_PROCESSOR_TESS_CTRL: case TGSI_PROCESSOR_TESS_CTRL:
return io == io_in ? (!ctx->cfg->use_gles) : true; return true;
case TGSI_PROCESSOR_TESS_EVAL: case TGSI_PROCESSOR_TESS_EVAL:
return io == io_in ? true : (!ctx->cfg->use_gles); return io == io_in ? true : (ctx->key->gs_present ? true : false);
case TGSI_PROCESSOR_GEOMETRY:
return io == io_in;
case TGSI_PROCESSOR_VERTEX:
if (io == io_in)
return false;
return (ctx->key->gs_present || ctx->key->tes_present);
default: default:
return !ctx->cfg->use_gles; return false;
} }
} }

@ -110,6 +110,7 @@ struct vrend_shader_cfg {
bool use_gles; bool use_gles;
bool use_core_profile; bool use_core_profile;
bool use_explicit_locations; bool use_explicit_locations;
bool has_arrays_of_arrays;
}; };
struct vrend_context; struct vrend_context;

Loading…
Cancel
Save