[Mesa-dev] [PATCH 3/3] ir_to_mesa: Emit TXD instruction.
Ian Romanick
idr at freedesktop.org
Mon Apr 25 15:09:52 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 04/22/2011 12:02 PM, Kenneth Graunke wrote:
> Mesa already supports this because of NV_fragment_program.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/program/ir_to_mesa.cpp | 13 +++++++++++--
> 1 files changed, 11 insertions(+), 2 deletions(-)
>
> I tried testing this by using texture2DGradARB in a fragment shader on swrast,
> which didn't work. AFAIK that's a limitation of swrast, though, and not
> necessarily a problem with this code. Perhaps this is of use to the Gallium
> drivers...
Does the comparable NV_fragment_program (or ARB_fragment_program with
'OPTION NV_fragment_program;') code work on swrast? Does this produce
the "same" results?
> diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
> index 3c9b973..16a1c2c 100644
> --- a/src/mesa/program/ir_to_mesa.cpp
> +++ b/src/mesa/program/ir_to_mesa.cpp
> @@ -1967,7 +1967,7 @@ ir_to_mesa_visitor::visit(ir_call *ir)
> void
> ir_to_mesa_visitor::visit(ir_texture *ir)
> {
> - src_reg result_src, coord, lod_info, projector;
> + src_reg result_src, coord, lod_info, projector, dx, dy;
> dst_reg result_dst, coord_dst;
> ir_to_mesa_instruction *inst = NULL;
> prog_opcode opcode = OPCODE_NOP;
> @@ -2009,6 +2009,12 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
> lod_info = this->result;
> break;
> case ir_txd:
> + opcode = OPCODE_TXD;
> + ir->lod_info.grad.dPdx->accept(this);
> + dx = this->result;
> + ir->lod_info.grad.dPdy->accept(this);
> + dy = this->result;
> + break;
> case ir_txf:
> assert(!"GLSL 1.30 features unsupported");
> break;
> @@ -2081,7 +2087,10 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
> coord_dst.writemask = WRITEMASK_XYZW;
> }
>
> - inst = emit(ir, opcode, result_dst, coord);
> + if (opcode == OPCODE_TXD)
> + inst = emit(ir, opcode, result_dst, coord, dx, dy);
> + else
> + inst = emit(ir, opcode, result_dst, coord);
>
> if (ir->shadow_comparitor)
> inst->tex_shadow = GL_TRUE;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk218TAACgkQX1gOwKyEAw89dACdGS532L3LVyghk5vPk11AKvaM
aAEAn07eVDhuo8Sf7Qm9EaIQ1BUHlzh4
=l7vm
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list