[Mesa-dev] [PATCH 2/2] st/mesa: fix DDY opcode for FBOs

Paul Berry stereotype441 at gmail.com
Sun Jul 22 21:04:31 PDT 2012


On 22 July 2012 16:37, Marek Olšák <maraeo at gmail.com> wrote:

> This fixes piglit/fbo-deriv.
>

Cool, I'm glad that test proved useful for more drivers than just i965 :)


> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 45136de..fcd69b1 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -1448,9 +1448,29 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>        emit(ir, TGSI_OPCODE_DDX, result_dst, op[0]);
>        break;
>     case ir_unop_dFdy:
> -      op[0].negate = ~op[0].negate;
> -      emit(ir, TGSI_OPCODE_DDY, result_dst, op[0]);
> +   {
> +      /* The X component contains 1 or -1 depending on whether the
> framebuffer
> +       * is a FBO or the window system buffer, respectively.
> +       * It is then multiplied with the source operand of DDY.
> +       */
> +      static const gl_state_index transform_y_state[STATE_LENGTH]
> +         = { STATE_INTERNAL, STATE_FB_WPOS_Y_TRANSFORM };
> +
> +      unsigned transform_y_index =
> +         _mesa_add_state_reference(this->prog->Parameters,
> +                                   transform_y_state);
> +
> +      st_src_reg transform_y = st_src_reg(PROGRAM_STATE_VAR,
> +                                          transform_y_index,
> +                                          glsl_type::vec4_type);
> +      transform_y.swizzle = SWIZZLE_XXXX;
> +
> +      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);
>        break;
> +   }
>
>     case ir_unop_noise: {
>        /* At some point, a motivated person could add a better
> --
> 1.7.9.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120722/919de382/attachment.html>


More information about the mesa-dev mailing list