[Mesa-dev] [PATCH 4/5] mesa/st: add support for emitting fine derivative opcodes
Marek Olšák
maraeo at gmail.com
Thu Aug 14 03:58:49 PDT 2014
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Thu, Aug 14, 2014 at 6:52 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> src/mesa/state_tracker/st_extensions.c | 3 ++-
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 9 ++++++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index eace321..24e886c 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -458,7 +458,8 @@ void st_init_extensions(struct pipe_screen *screen,
> { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE },
> { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD },
> { o(ARB_sample_shading), PIPE_CAP_SAMPLE_SHADING },
> - { o(ARB_draw_indirect), PIPE_CAP_DRAW_INDIRECT }
> + { o(ARB_draw_indirect), PIPE_CAP_DRAW_INDIRECT },
> + { o(ARB_derivative_control), PIPE_CAP_TGSI_FS_FINE_DERIVATIVE },
> };
>
> /* Required: render target and sampler support */
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 4898166..84bdc4f 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -1462,9 +1462,15 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
> break;
>
> case ir_unop_dFdx:
> + case ir_unop_dFdx_coarse:
> emit(ir, TGSI_OPCODE_DDX, result_dst, op[0]);
> break;
> + case ir_unop_dFdx_fine:
> + emit(ir, TGSI_OPCODE_DDX_FINE, result_dst, op[0]);
> + break;
> case ir_unop_dFdy:
> + case ir_unop_dFdy_coarse:
> + case ir_unop_dFdy_fine:
> {
> /* The X component contains 1 or -1 depending on whether the framebuffer
> * is a FBO or the window system buffer, respectively.
> @@ -1485,7 +1491,8 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
> st_src_reg temp = get_temp(glsl_type::vec4_type);
>
> emit(ir, TGSI_OPCODE_MUL, st_dst_reg(temp), transform_y, op[0]);
> - emit(ir, TGSI_OPCODE_DDY, result_dst, temp);
> + emit(ir, ir->operation == ir_unop_dFdy_fine ?
> + TGSI_OPCODE_DDY_FINE : TGSI_OPCODE_DDY, result_dst, temp);
> break;
> }
>
> --
> 1.8.5.5
>
> _______________________________________________
> 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