[Mesa-dev] [PATCH 1/3] gallium: add explicit return type to texture opcodes
Roland Scheidegger
sroland at vmware.com
Tue Aug 23 23:52:53 UTC 2016
I don't really like this - I'd like to keep d3d10 semantics unless
there's a good reason to change it.
And I don't see such a reason - even with variable indexing you cannot
use mixed int/uint/float textures since texturing results with using the
wrong type of sampler are undefined anyway. Hence you cannot have a
single array of samplers both with int and float types, it has to be
multiple arrays in glsl.
If tgsi can't have multiple sampler arrays, that should be fixed instead
imho.
Roland
Am 22.08.2016 um 16:06 schrieb Marek Olšák:
> From: Marek Olšák <marek.olsak at amd.com>
>
> Sampler view declarations have return types, but that doesn't work with
> variable indexing (e.g. SAMP[-1+i]).
>
> Adding the return type to the instruction is simpler.
>
> All sampler view declaration flags might have to be removed since variable
> indexing makes them inaccessible.
> ---
> src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 ++-
> src/gallium/auxiliary/tgsi/tgsi_ureg.h | 21 ++++++---
> src/gallium/auxiliary/util/u_simple_shaders.c | 32 +++++++-------
> src/gallium/auxiliary/vl/vl_bicubic_filter.c | 3 +-
> src/gallium/auxiliary/vl/vl_compositor.c | 16 ++++---
> src/gallium/auxiliary/vl/vl_deint_filter.c | 39 +++++++++++------
> src/gallium/auxiliary/vl/vl_idct.c | 6 ++-
> src/gallium/auxiliary/vl/vl_matrix_filter.c | 3 +-
> src/gallium/auxiliary/vl/vl_mc.c | 3 +-
> src/gallium/auxiliary/vl/vl_median_filter.c | 3 +-
> src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 3 +-
> src/gallium/auxiliary/vl/vl_zscan.c | 9 ++--
> src/gallium/drivers/freedreno/freedreno_program.c | 4 +-
> src/gallium/drivers/nouveau/nv50/nv50_surface.c | 4 +-
> src/gallium/include/pipe/p_shader_tokens.h | 3 +-
> src/gallium/state_trackers/nine/nine_ff.c | 6 +--
> src/gallium/state_trackers/nine/nine_shader.c | 53 +++++++++++++++--------
> src/gallium/state_trackers/xa/xa_tgsi.c | 21 +++++----
> src/mesa/state_tracker/st_atifs_to_tgsi.c | 1 +
> src/mesa/state_tracker/st_cb_drawpixels.c | 6 ++-
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 35 +++++++++------
> src/mesa/state_tracker/st_mesa_to_tgsi.c | 1 +
> src/mesa/state_tracker/st_pbo.c | 8 +++-
> 23 files changed, 180 insertions(+), 107 deletions(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> index b67c383..b82a2ea 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
> @@ -1207,32 +1207,33 @@ ureg_fixup_label(struct ureg_program *ureg,
> {
> union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_INSN, label_token );
>
> out->insn_label.Label = instruction_number;
> }
>
>
> void
> ureg_emit_texture(struct ureg_program *ureg,
> unsigned extended_token,
> - unsigned target, unsigned num_offsets)
> + unsigned target, unsigned num_offsets, unsigned return_type)
> {
> union tgsi_any_token *out, *insn;
>
> out = get_tokens( ureg, DOMAIN_INSN, 1 );
> insn = retrieve_token( ureg, DOMAIN_INSN, extended_token );
>
> insn->insn.Texture = 1;
>
> out[0].value = 0;
> out[0].insn_texture.Texture = target;
> out[0].insn_texture.NumOffsets = num_offsets;
> + out[0].insn_texture.ReturnType = return_type;
> }
>
> void
> ureg_emit_texture_offset(struct ureg_program *ureg,
> const struct tgsi_texture_offset *offset)
> {
> union tgsi_any_token *out;
>
> out = get_tokens( ureg, DOMAIN_INSN, 1);
>
> @@ -1321,20 +1322,21 @@ ureg_insn(struct ureg_program *ureg,
>
> ureg_fixup_insn_size( ureg, insn.insn_token );
> }
>
> void
> ureg_tex_insn(struct ureg_program *ureg,
> unsigned opcode,
> const struct ureg_dst *dst,
> unsigned nr_dst,
> unsigned target,
> + unsigned return_type,
> const struct tgsi_texture_offset *texoffsets,
> unsigned nr_offset,
> const struct ureg_src *src,
> unsigned nr_src )
> {
> struct ureg_emit_insn_result insn;
> unsigned i;
> boolean saturate;
> boolean predicate;
> boolean negate = FALSE;
> @@ -1359,21 +1361,22 @@ ureg_tex_insn(struct ureg_program *ureg,
> saturate,
> predicate,
> negate,
> swizzle[0],
> swizzle[1],
> swizzle[2],
> swizzle[3],
> nr_dst,
> nr_src);
>
> - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset );
> + ureg_emit_texture(ureg, insn.extended_token, target, nr_offset,
> + return_type);
>
> for (i = 0; i < nr_offset; i++)
> ureg_emit_texture_offset( ureg, &texoffsets[i]);
>
> for (i = 0; i < nr_dst; i++)
> ureg_emit_dst( ureg, dst[i] );
>
> for (i = 0; i < nr_src; i++)
> ureg_emit_src( ureg, src[i] );
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> index b4258fd..cc0b51a 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
> @@ -516,20 +516,21 @@ ureg_insn(struct ureg_program *ureg,
> const struct ureg_src *src,
> unsigned nr_src );
>
>
> void
> ureg_tex_insn(struct ureg_program *ureg,
> unsigned opcode,
> const struct ureg_dst *dst,
> unsigned nr_dst,
> unsigned target,
> + unsigned return_type,
> const struct tgsi_texture_offset *texoffsets,
> unsigned nr_offset,
> const struct ureg_src *src,
> unsigned nr_src );
>
>
> void
> ureg_label_insn(struct ureg_program *ureg,
> unsigned opcode,
> const struct ureg_src *src,
> @@ -570,21 +571,21 @@ ureg_emit_insn(struct ureg_program *ureg,
> unsigned num_src );
>
> void
> ureg_emit_label(struct ureg_program *ureg,
> unsigned insn_token,
> unsigned *label_token );
>
> void
> ureg_emit_texture(struct ureg_program *ureg,
> unsigned insn_token,
> - unsigned target, unsigned num_offsets);
> + unsigned target, unsigned num_offsets, unsigned return_type);
>
> void
> ureg_emit_texture_offset(struct ureg_program *ureg,
> const struct tgsi_texture_offset *offset);
>
> void
> ureg_emit_memory(struct ureg_program *ureg,
> unsigned insn_token,
> unsigned qualifier,
> unsigned texture,
> @@ -760,68 +761,70 @@ static inline void ureg_##op( struct ureg_program *ureg, \
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP12_TEX( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> unsigned target, \
> + unsigned return_type, \
> struct ureg_src src0, \
> struct ureg_src src1 ) \
> { \
> unsigned opcode = TGSI_OPCODE_##op; \
> struct ureg_emit_insn_result insn; \
> if (ureg_dst_is_empty(dst)) \
> return; \
> insn = ureg_emit_insn(ureg, \
> opcode, \
> dst.Saturate, \
> dst.Predicate, \
> dst.PredNegate, \
> dst.PredSwizzleX, \
> dst.PredSwizzleY, \
> dst.PredSwizzleZ, \
> dst.PredSwizzleW, \
> 1, \
> 2); \
> - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
> + ureg_emit_texture(ureg, insn.extended_token, target, 0, return_type);\
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP12_SAMPLE( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> + unsigned return_type, \
> struct ureg_src src0, \
> struct ureg_src src1 ) \
> { \
> unsigned opcode = TGSI_OPCODE_##op; \
> unsigned target = TGSI_TEXTURE_UNKNOWN; \
> struct ureg_emit_insn_result insn; \
> if (ureg_dst_is_empty(dst)) \
> return; \
> insn = ureg_emit_insn(ureg, \
> opcode, \
> dst.Saturate, \
> dst.Predicate, \
> dst.PredNegate, \
> dst.PredSwizzleX, \
> dst.PredSwizzleY, \
> dst.PredSwizzleZ, \
> dst.PredSwizzleW, \
> 1, \
> 2); \
> - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
> + ureg_emit_texture(ureg, insn.extended_token, target, 0, return_type);\
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP13( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> struct ureg_src src0, \
> @@ -846,84 +849,87 @@ static inline void ureg_##op( struct ureg_program *ureg, \
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_emit_src( ureg, src2 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP13_SAMPLE( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> + unsigned return_type, \
> struct ureg_src src0, \
> struct ureg_src src1, \
> struct ureg_src src2 ) \
> { \
> unsigned opcode = TGSI_OPCODE_##op; \
> unsigned target = TGSI_TEXTURE_UNKNOWN; \
> struct ureg_emit_insn_result insn; \
> if (ureg_dst_is_empty(dst)) \
> return; \
> insn = ureg_emit_insn(ureg, \
> opcode, \
> dst.Saturate, \
> dst.Predicate, \
> dst.PredNegate, \
> dst.PredSwizzleX, \
> dst.PredSwizzleY, \
> dst.PredSwizzleZ, \
> dst.PredSwizzleW, \
> 1, \
> 3); \
> - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
> + ureg_emit_texture(ureg, insn.extended_token, target, 0, return_type);\
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_emit_src( ureg, src2 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP14_TEX( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> unsigned target, \
> + unsigned return_type, \
> struct ureg_src src0, \
> struct ureg_src src1, \
> struct ureg_src src2, \
> struct ureg_src src3 ) \
> { \
> unsigned opcode = TGSI_OPCODE_##op; \
> struct ureg_emit_insn_result insn; \
> if (ureg_dst_is_empty(dst)) \
> return; \
> insn = ureg_emit_insn(ureg, \
> opcode, \
> dst.Saturate, \
> dst.Predicate, \
> dst.PredNegate, \
> dst.PredSwizzleX, \
> dst.PredSwizzleY, \
> dst.PredSwizzleZ, \
> dst.PredSwizzleW, \
> 1, \
> 4); \
> - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
> + ureg_emit_texture(ureg, insn.extended_token, target, 0, return_type);\
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_emit_src( ureg, src2 ); \
> ureg_emit_src( ureg, src3 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP14_SAMPLE( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> + unsigned return_type, \
> struct ureg_src src0, \
> struct ureg_src src1, \
> struct ureg_src src2, \
> struct ureg_src src3 ) \
> { \
> unsigned opcode = TGSI_OPCODE_##op; \
> unsigned target = TGSI_TEXTURE_UNKNOWN; \
> struct ureg_emit_insn_result insn; \
> if (ureg_dst_is_empty(dst)) \
> return; \
> @@ -931,21 +937,21 @@ static inline void ureg_##op( struct ureg_program *ureg, \
> opcode, \
> dst.Saturate, \
> dst.Predicate, \
> dst.PredNegate, \
> dst.PredSwizzleX, \
> dst.PredSwizzleY, \
> dst.PredSwizzleZ, \
> dst.PredSwizzleW, \
> 1, \
> 4); \
> - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
> + ureg_emit_texture(ureg, insn.extended_token, target, 0, return_type);\
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_emit_src( ureg, src2 ); \
> ureg_emit_src( ureg, src3 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
>
> #define OP14( op ) \
> @@ -1009,20 +1015,21 @@ static inline void ureg_##op( struct ureg_program *ureg, \
> ureg_emit_src( ureg, src1 ); \
> ureg_emit_src( ureg, src2 ); \
> ureg_emit_src( ureg, src3 ); \
> ureg_emit_src( ureg, src4 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> #define OP15_SAMPLE( op ) \
> static inline void ureg_##op( struct ureg_program *ureg, \
> struct ureg_dst dst, \
> + unsigned return_type, \
> struct ureg_src src0, \
> struct ureg_src src1, \
> struct ureg_src src2, \
> struct ureg_src src3, \
> struct ureg_src src4 ) \
> { \
> unsigned opcode = TGSI_OPCODE_##op; \
> unsigned target = TGSI_TEXTURE_UNKNOWN; \
> struct ureg_emit_insn_result insn; \
> if (ureg_dst_is_empty(dst)) \
> @@ -1031,21 +1038,21 @@ static inline void ureg_##op( struct ureg_program *ureg, \
> opcode, \
> dst.Saturate, \
> dst.Predicate, \
> dst.PredNegate, \
> dst.PredSwizzleX, \
> dst.PredSwizzleY, \
> dst.PredSwizzleZ, \
> dst.PredSwizzleW, \
> 1, \
> 5); \
> - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \
> + ureg_emit_texture(ureg, insn.extended_token, target, 0, return_type);\
> ureg_emit_dst( ureg, dst ); \
> ureg_emit_src( ureg, src0 ); \
> ureg_emit_src( ureg, src1 ); \
> ureg_emit_src( ureg, src2 ); \
> ureg_emit_src( ureg, src3 ); \
> ureg_emit_src( ureg, src4 ); \
> ureg_fixup_insn_size( ureg, insn.insn_token ); \
> }
>
> /* Use a template include to generate a correctly-typed ureg_OP()
> diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c
> index 1220e18..1262e9e 100644
> --- a/src/gallium/auxiliary/util/u_simple_shaders.c
> +++ b/src/gallium/auxiliary/util/u_simple_shaders.c
> @@ -248,25 +248,25 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
>
> if (writemask != TGSI_WRITEMASK_XYZW) {
> struct ureg_src imm = ureg_imm4f( ureg, 0, 0, 0, 1 );
>
> ureg_MOV( ureg, out, imm );
> }
>
> if (tex_target == TGSI_TEXTURE_BUFFER)
> ureg_TXF(ureg,
> ureg_writemask(out, writemask),
> - tex_target, tex, sampler);
> + tex_target, stype, tex, sampler);
> else
> ureg_TEX(ureg,
> ureg_writemask(out, writemask),
> - tex_target, tex, sampler);
> + tex_target, stype, tex, sampler);
>
> ureg_END( ureg );
>
> return ureg_create_shader_and_destroy( ureg, pipe );
> }
>
>
> /**
> * Make a simple fragment shader that sets the output color to a color
> * taken from a texture.
> @@ -321,23 +321,23 @@ util_make_fragment_tex_shader_writedepth(struct pipe_context *pipe,
> 0 );
>
> depth = ureg_DECL_output( ureg,
> TGSI_SEMANTIC_POSITION,
> 0 );
>
> imm = ureg_imm4f( ureg, 0, 0, 0, 1 );
>
> ureg_MOV( ureg, out, imm );
>
> - ureg_TEX( ureg,
> - ureg_writemask(depth, TGSI_WRITEMASK_Z),
> - tex_target, tex, sampler );
> + ureg_TEX(ureg,
> + ureg_writemask(depth, TGSI_WRITEMASK_Z),
> + tex_target, TGSI_RETURN_TYPE_FLOAT, tex, sampler);
> ureg_END( ureg );
>
> return ureg_create_shader_and_destroy( ureg, pipe );
> }
>
>
> /**
> * Make a simple fragment texture shader which reads the texture unit 0 and 1
> * and writes it as depth and stencil, respectively.
> */
> @@ -382,26 +382,26 @@ util_make_fragment_tex_shader_writedepthstencil(struct pipe_context *pipe,
> 0 );
>
> stencil = ureg_DECL_output( ureg,
> TGSI_SEMANTIC_STENCIL,
> 0 );
>
> imm = ureg_imm4f( ureg, 0, 0, 0, 1 );
>
> ureg_MOV( ureg, out, imm );
>
> - ureg_TEX( ureg,
> - ureg_writemask(depth, TGSI_WRITEMASK_Z),
> - tex_target, tex, depth_sampler );
> - ureg_TEX( ureg,
> - ureg_writemask(stencil, TGSI_WRITEMASK_Y),
> - tex_target, tex, stencil_sampler );
> + ureg_TEX(ureg,
> + ureg_writemask(depth, TGSI_WRITEMASK_Z),
> + tex_target, TGSI_RETURN_TYPE_FLOAT, tex, depth_sampler);
> + ureg_TEX(ureg,
> + ureg_writemask(stencil, TGSI_WRITEMASK_Y),
> + tex_target, TGSI_RETURN_TYPE_UINT, tex, stencil_sampler);
> ureg_END( ureg );
>
> return ureg_create_shader_and_destroy( ureg, pipe );
> }
>
>
> /**
> * Make a simple fragment texture shader which reads a texture and writes it
> * as stencil.
> */
> @@ -437,23 +437,23 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
> 0 );
>
> stencil = ureg_DECL_output( ureg,
> TGSI_SEMANTIC_STENCIL,
> 0 );
>
> imm = ureg_imm4f( ureg, 0, 0, 0, 1 );
>
> ureg_MOV( ureg, out, imm );
>
> - ureg_TEX( ureg,
> - ureg_writemask(stencil, TGSI_WRITEMASK_Y),
> - tex_target, tex, stencil_sampler );
> + ureg_TEX(ureg,
> + ureg_writemask(stencil, TGSI_WRITEMASK_Y),
> + tex_target, TGSI_RETURN_TYPE_UINT, tex, stencil_sampler);
> ureg_END( ureg );
>
> return ureg_create_shader_and_destroy( ureg, pipe );
> }
>
>
> /**
> * Make simple fragment color pass-through shader that replicates OUT[0]
> * to all bound colorbuffers.
> */
> @@ -709,21 +709,21 @@ util_make_fs_msaa_resolve(struct pipe_context *pipe,
> tmp = ureg_DECL_temporary(ureg);
>
> /* Instructions. */
> ureg_MOV(ureg, tmp_sum, ureg_imm1f(ureg, 0));
> ureg_F2U(ureg, tmp_coord, coord);
>
> for (i = 0; i < nr_samples; i++) {
> /* Read one sample. */
> ureg_MOV(ureg, ureg_writemask(tmp_coord, TGSI_WRITEMASK_W),
> ureg_imm1u(ureg, i));
> - ureg_TXF(ureg, tmp, tgsi_tex, ureg_src(tmp_coord), sampler);
> + ureg_TXF(ureg, tmp, tgsi_tex, stype, ureg_src(tmp_coord), sampler);
>
> if (stype == TGSI_RETURN_TYPE_UINT)
> ureg_U2F(ureg, tmp, ureg_src(tmp));
> else if (stype == TGSI_RETURN_TYPE_SINT)
> ureg_I2F(ureg, tmp, ureg_src(tmp));
>
> /* Add it to the sum.*/
> ureg_ADD(ureg, tmp_sum, ureg_src(tmp_sum), ureg_src(tmp));
> }
>
> @@ -784,21 +784,21 @@ util_make_fs_msaa_resolve_bilinear(struct pipe_context *pipe,
> ureg_UADD(ureg, tmp_coord[2], ureg_src(tmp_coord[0]),
> ureg_imm4u(ureg, 0, 1, 0, 0)); /* bottom-left */
> ureg_UADD(ureg, tmp_coord[3], ureg_src(tmp_coord[0]),
> ureg_imm4u(ureg, 1, 1, 0, 0)); /* bottom-right */
>
> for (i = 0; i < nr_samples; i++) {
> for (c = 0; c < 4; c++) {
> /* Read one sample. */
> ureg_MOV(ureg, ureg_writemask(tmp_coord[c], TGSI_WRITEMASK_W),
> ureg_imm1u(ureg, i));
> - ureg_TXF(ureg, tmp, tgsi_tex, ureg_src(tmp_coord[c]), sampler);
> + ureg_TXF(ureg, tmp, tgsi_tex, stype, ureg_src(tmp_coord[c]), sampler);
>
> if (stype == TGSI_RETURN_TYPE_UINT)
> ureg_U2F(ureg, tmp, ureg_src(tmp));
> else if (stype == TGSI_RETURN_TYPE_SINT)
> ureg_I2F(ureg, tmp, ureg_src(tmp));
>
> /* Add it to the sum.*/
> ureg_ADD(ureg, tmp_sum[c], ureg_src(tmp_sum[c]), ureg_src(tmp));
> }
> }
> diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
> index 0364d43..c4dc830 100644
> --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
> @@ -208,21 +208,22 @@ create_frag_shader(struct vl_bicubic_filter *filter, unsigned video_width,
> */
> vtex = ureg_src(t_array[22]);
> for (i = 0; i < 16; ++i) {
> ureg_ADD(shader, ureg_writemask(t_array[i], TGSI_WRITEMASK_XY),
> vtex, ureg_imm2f(shader, offsets[i].x, offsets[i].y));
> ureg_MOV(shader, ureg_writemask(t_array[i], TGSI_WRITEMASK_ZW),
> ureg_imm1f(shader, 0.0f));
> }
>
> for (i = 0; i < 16; ++i) {
> - ureg_TEX(shader, t_array[i], TGSI_TEXTURE_2D, ureg_src(t_array[i]), sampler);
> + ureg_TEX(shader, t_array[i], TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_array[i]), sampler);
> }
>
> for(i = 0; i < 4; ++i)
> create_frag_shader_cubic_interpolater(shader, ureg_src(t_array[4*i]),
> ureg_src(t_array[4*i+1]), ureg_src(t_array[4*i+2]), ureg_src(t_array[4*i+3]),
> ureg_scalar(ureg_src(t), TGSI_SWIZZLE_X), t_array[16+i]);
>
> create_frag_shader_cubic_interpolater(shader, ureg_src(t_array[16]),
> ureg_src(t_array[17]), ureg_src(t_array[18]), ureg_src(t_array[19]),
> ureg_scalar(ureg_src(t), TGSI_SWIZZLE_Y), o_fragment);
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
> index 03a0a64..c2dcd87 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -168,21 +168,21 @@ create_frag_shader_weave(struct ureg_program *shader, struct ureg_dst fragment)
> * texel[0..1].x = tex(t_tc[0..1][0])
> * texel[0..1].y = tex(t_tc[0..1][1])
> * texel[0..1].z = tex(t_tc[0..1][2])
> */
> for (i = 0; i < 2; ++i)
> for (j = 0; j < 3; ++j) {
> struct ureg_src src = ureg_swizzle(ureg_src(t_tc[i]),
> TGSI_SWIZZLE_X, j ? TGSI_SWIZZLE_Z : TGSI_SWIZZLE_Y, TGSI_SWIZZLE_W, TGSI_SWIZZLE_W);
>
> ureg_TEX(shader, ureg_writemask(t_texel[i], TGSI_WRITEMASK_X << j),
> - TGSI_TEXTURE_2D_ARRAY, src, sampler[j]);
> + TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT, src, sampler[j]);
> }
>
> /* calculate linear interpolation factor
> * factor = |round(i_tc.y) - i_tc.y| * 2
> */
> ureg_ROUND(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ), i_tc[0]);
> ureg_ADD(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
> ureg_src(t_tc[0]), ureg_negate(i_tc[0]));
> ureg_MUL(shader, ureg_writemask(t_tc[0], TGSI_WRITEMASK_YZ),
> ureg_abs(ureg_src(t_tc[0])), ureg_imm1f(shader, 2.0f));
> @@ -252,21 +252,22 @@ create_frag_shader_video_buffer(struct vl_compositor *c)
> sampler[i] = ureg_DECL_sampler(shader, i);
>
> texel = ureg_DECL_temporary(shader);
> fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
>
> /*
> * texel.xyz = tex(tc, sampler[i])
> * fragment = csc * texel
> */
> for (i = 0; i < 3; ++i)
> - ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_2D_ARRAY, tc, sampler[i]);
> + ureg_TEX(shader, ureg_writemask(texel, TGSI_WRITEMASK_X << i),
> + TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT, tc, sampler[i]);
>
> create_frag_shader_csc(shader, texel, fragment);
>
> ureg_release_temporary(shader, texel);
> ureg_END(shader);
>
> return ureg_create_shader_and_destroy(shader, c->pipe);
> }
>
> static void *
> @@ -345,30 +346,32 @@ create_frag_shader_palette(struct vl_compositor *c, bool include_cc)
> palette = ureg_DECL_sampler(shader, 1);
>
> texel = ureg_DECL_temporary(shader);
> fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
>
> /*
> * texel = tex(tc, sampler)
> * fragment.xyz = tex(texel, palette) * csc
> * fragment.a = texel.a
> */
> - ureg_TEX(shader, texel, TGSI_TEXTURE_2D, tc, sampler);
> + ureg_TEX(shader, texel, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + tc, sampler);
> ureg_MOV(shader, ureg_writemask(fragment, TGSI_WRITEMASK_W), ureg_src(texel));
>
> if (include_cc) {
> - ureg_TEX(shader, texel, TGSI_TEXTURE_1D, ureg_src(texel), palette);
> + ureg_TEX(shader, texel, TGSI_TEXTURE_1D, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(texel), palette);
> for (i = 0; i < 3; ++i)
> ureg_DP4(shader, ureg_writemask(fragment, TGSI_WRITEMASK_X << i), csc[i], ureg_src(texel));
> } else {
> ureg_TEX(shader, ureg_writemask(fragment, TGSI_WRITEMASK_XYZ),
> - TGSI_TEXTURE_1D, ureg_src(texel), palette);
> + TGSI_TEXTURE_1D, TGSI_RETURN_TYPE_FLOAT, ureg_src(texel), palette);
> }
>
> ureg_release_temporary(shader, texel);
> ureg_END(shader);
>
> return ureg_create_shader_and_destroy(shader, c->pipe);
> }
>
> static void *
> create_frag_shader_rgba(struct vl_compositor *c)
> @@ -383,21 +386,22 @@ create_frag_shader_rgba(struct vl_compositor *c)
>
> tc = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX, TGSI_INTERPOLATE_LINEAR);
> color = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_COLOR, VS_O_COLOR, TGSI_INTERPOLATE_LINEAR);
> sampler = ureg_DECL_sampler(shader, 0);
> texel = ureg_DECL_temporary(shader);
> fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
>
> /*
> * fragment = tex(tc, sampler)
> */
> - ureg_TEX(shader, texel, TGSI_TEXTURE_2D, tc, sampler);
> + ureg_TEX(shader, texel, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + tc, sampler);
> ureg_MUL(shader, fragment, ureg_src(texel), color);
> ureg_END(shader);
>
> return ureg_create_shader_and_destroy(shader, c->pipe);
> }
>
> static bool
> init_shaders(struct vl_compositor *c)
> {
> assert(c);
> diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c
> index 3ca3b49..467cf9f 100644
> --- a/src/gallium/auxiliary/vl/vl_deint_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_deint_filter.c
> @@ -104,21 +104,22 @@ create_copy_frag_shader(struct vl_deint_filter *filter, unsigned field)
>
> ureg_MOV(shader, t_tex, i_vtex);
> if (field) {
> ureg_MOV(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_ZW),
> ureg_imm4f(shader, 0, 0, 1.0f, 0));
> } else {
> ureg_MOV(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_ZW),
> ureg_imm1f(shader, 0));
> }
>
> - ureg_TEX(shader, o_fragment, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_tex), sampler);
> + ureg_TEX(shader, o_fragment, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_tex), sampler);
>
> ureg_release_temporary(shader, t_tex);
> ureg_END(shader);
>
> return ureg_create_shader_and_destroy(shader, filter->pipe);
> }
>
> static void *
> create_deint_frag_shader(struct vl_deint_filter *filter, unsigned field,
> struct vertex2f *sizes, bool spatial_filter)
> @@ -164,56 +165,68 @@ create_deint_frag_shader(struct vl_deint_filter *filter, unsigned field,
>
> // sample between texels for cheap lowpass
> ureg_ADD(shader, t_comp_top, ureg_src(t_tex),
> ureg_imm4f(shader, sizes->x * 0.5f, sizes->y * -0.5f, 0, 0));
> ureg_ADD(shader, t_comp_bot, ureg_src(t_tex),
> ureg_imm4f(shader, sizes->x * -0.5f, sizes->y * 0.5f, 1.0f, 0));
>
> if (field == 0) {
> /* interpolating top field -> current field is a bottom field */
> // cur vs prev2
> - ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_bot), sampler_cur);
> - ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_bot), sampler_prevprev);
> + ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_bot), sampler_cur);
> + ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_bot), sampler_prevprev);
> ureg_SUB(shader, ureg_writemask(t_diff, TGSI_WRITEMASK_X), ureg_src(t_a), ureg_src(t_b));
> // prev vs next
> - ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_top), sampler_prev);
> - ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_top), sampler_next);
> + ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_top), sampler_prev);
> + ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_top), sampler_next);
> ureg_SUB(shader, ureg_writemask(t_diff, TGSI_WRITEMASK_Y), ureg_src(t_a), ureg_src(t_b));
> } else {
> /* interpolating bottom field -> current field is a top field */
> // cur vs prev2
> - ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_top), sampler_cur);
> - ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_top), sampler_prevprev);
> + ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_top), sampler_cur);
> + ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_top), sampler_prevprev);
> ureg_SUB(shader, ureg_writemask(t_diff, TGSI_WRITEMASK_X), ureg_src(t_a), ureg_src(t_b));
> // prev vs next
> - ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_bot), sampler_prev);
> - ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_bot), sampler_next);
> + ureg_TEX(shader, t_a, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_bot), sampler_prev);
> + ureg_TEX(shader, t_b, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_bot), sampler_next);
> ureg_SUB(shader, ureg_writemask(t_diff, TGSI_WRITEMASK_Y), ureg_src(t_a), ureg_src(t_b));
> }
>
> // absolute maximum of differences
> ureg_MAX(shader, ureg_writemask(t_diff, TGSI_WRITEMASK_X), ureg_abs(ureg_src(t_diff)),
> ureg_scalar(ureg_abs(ureg_src(t_diff)), TGSI_SWIZZLE_Y));
>
> if (field == 0) {
> /* weave with prev top field */
> - ureg_TEX(shader, t_weave, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_tex), sampler_prev);
> + ureg_TEX(shader, t_weave, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_tex), sampler_prev);
> /* get linear interpolation from current bottom field */
> ureg_ADD(shader, t_comp_top, ureg_src(t_tex), ureg_imm4f(shader, 0, sizes->y * -1.0f, 1.0f, 0));
> - ureg_TEX(shader, t_linear, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_top), sampler_cur);
> + ureg_TEX(shader, t_linear, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_top), sampler_cur);
> } else {
> /* weave with prev bottom field */
> ureg_ADD(shader, t_comp_bot, ureg_src(t_tex), ureg_imm4f(shader, 0, 0, 1.0f, 0));
> - ureg_TEX(shader, t_weave, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_bot), sampler_prev);
> + ureg_TEX(shader, t_weave, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_bot), sampler_prev);
> /* get linear interpolation from current top field */
> ureg_ADD(shader, t_comp_bot, ureg_src(t_tex), ureg_imm4f(shader, 0, sizes->y * 1.0f, 0, 0));
> - ureg_TEX(shader, t_linear, TGSI_TEXTURE_2D_ARRAY, ureg_src(t_comp_bot), sampler_cur);
> + ureg_TEX(shader, t_linear, TGSI_TEXTURE_2D_ARRAY, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(t_comp_bot), sampler_cur);
> }
>
> // mix between weave and linear
> // fully weave if diff < 6 (0.02353), fully interpolate if diff > 14 (0.05490)
> ureg_ADD(shader, ureg_writemask(t_diff, TGSI_WRITEMASK_X), ureg_src(t_diff),
> ureg_imm4f(shader, -0.02353f, 0, 0, 0));
> ureg_MUL(shader, ureg_saturate(ureg_writemask(t_diff, TGSI_WRITEMASK_X)),
> ureg_src(t_diff), ureg_imm4f(shader, 31.8750f, 0, 0, 0));
> ureg_LRP(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_X), ureg_src(t_diff),
> ureg_src(t_linear), ureg_src(t_weave));
> diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
> index 3e6f581..8c15997 100644
> --- a/src/gallium/auxiliary/vl/vl_idct.c
> +++ b/src/gallium/auxiliary/vl/vl_idct.c
> @@ -108,22 +108,24 @@ increment_addr(struct ureg_program *shader, struct ureg_dst daddr[2],
> ureg_MOV(shader, ureg_writemask(daddr[0], wm_start), saddr[0]);
> ureg_ADD(shader, ureg_writemask(daddr[0], wm_tc), saddr[0], ureg_imm1f(shader, pos / size));
> ureg_MOV(shader, ureg_writemask(daddr[1], wm_start), saddr[1]);
> ureg_ADD(shader, ureg_writemask(daddr[1], wm_tc), saddr[1], ureg_imm1f(shader, pos / size));
> }
>
> static void
> fetch_four(struct ureg_program *shader, struct ureg_dst m[2], struct ureg_src addr[2],
> struct ureg_src sampler, bool resource3d)
> {
> - ureg_TEX(shader, m[0], resource3d ? TGSI_TEXTURE_3D : TGSI_TEXTURE_2D, addr[0], sampler);
> - ureg_TEX(shader, m[1], resource3d ? TGSI_TEXTURE_3D : TGSI_TEXTURE_2D, addr[1], sampler);
> + ureg_TEX(shader, m[0], resource3d ? TGSI_TEXTURE_3D : TGSI_TEXTURE_2D,
> + TGSI_RETURN_TYPE_FLOAT, addr[0], sampler);
> + ureg_TEX(shader, m[1], resource3d ? TGSI_TEXTURE_3D : TGSI_TEXTURE_2D,
> + TGSI_RETURN_TYPE_FLOAT, addr[1], sampler);
> }
>
> static void
> matrix_mul(struct ureg_program *shader, struct ureg_dst dst, struct ureg_dst l[2], struct ureg_dst r[2])
> {
> struct ureg_dst tmp;
>
> tmp = ureg_DECL_temporary(shader);
>
> /*
> diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c
> index e331cb7..9c66390 100644
> --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c
> @@ -113,21 +113,22 @@ create_frag_shader(struct vl_matrix_filter *filter, unsigned num_offsets,
> ureg_ADD(shader, ureg_writemask(t_array[i], TGSI_WRITEMASK_XY),
> i_vtex, ureg_imm2f(shader, offsets[i].x, offsets[i].y));
> ureg_MOV(shader, ureg_writemask(t_array[i], TGSI_WRITEMASK_ZW),
> ureg_imm1f(shader, 0.0f));
> }
> }
>
> for (i = 0; i < num_offsets; ++i) {
> if (matrix_values[i] != 0.0f) {
> struct ureg_src src = is_vec_zero(offsets[i]) ? i_vtex : ureg_src(t_array[i]);
> - ureg_TEX(shader, t_array[i], TGSI_TEXTURE_2D, src, sampler);
> + ureg_TEX(shader, t_array[i], TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + src, sampler);
> }
> }
>
> for (i = 0, first = true; i < num_offsets; ++i) {
> if (matrix_values[i] != 0.0f) {
> if (first) {
> t_sum = t_array[i];
> ureg_MUL(shader, t_sum, ureg_src(t_array[i]),
> ureg_imm1f(shader, matrix_values[i]));
> first = false;
> diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c
> index a202fac..a916d420 100644
> --- a/src/gallium/auxiliary/vl/vl_mc.c
> +++ b/src/gallium/auxiliary/vl/vl_mc.c
> @@ -208,21 +208,22 @@ create_ref_frag_shader(struct vl_mc *r)
> ureg_src(ref), ureg_imm1f(shader, y_scale));
> ureg_FLR(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y), ureg_src(ref));
> ureg_ADD(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y),
> ureg_src(ref), ureg_scalar(ureg_src(ref), TGSI_SWIZZLE_Z));
> ureg_MUL(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y),
> ureg_src(ref), ureg_imm1f(shader, 1.0f / y_scale));
>
> ureg_fixup_label(shader, label, ureg_get_instruction_number(shader));
> ureg_ENDIF(shader);
>
> - ureg_TEX(shader, ureg_writemask(fragment, TGSI_WRITEMASK_XYZ), TGSI_TEXTURE_2D, ureg_src(ref), sampler);
> + ureg_TEX(shader, ureg_writemask(fragment, TGSI_WRITEMASK_XYZ),
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, ureg_src(ref), sampler);
>
> ureg_release_temporary(shader, ref);
>
> ureg_release_temporary(shader, field);
> ureg_END(shader);
>
> return ureg_create_shader_and_destroy(shader, r->pipe);
> }
>
> static void *
> diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c
> index f7477b7..e27a847 100644
> --- a/src/gallium/auxiliary/vl/vl_median_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_median_filter.c
> @@ -122,21 +122,22 @@ create_frag_shader(struct vl_median_filter *filter,
> if (!is_vec_zero(offsets[i])) {
> ureg_ADD(shader, ureg_writemask(t_array[i], TGSI_WRITEMASK_XY),
> i_vtex, ureg_imm2f(shader, offsets[i].x, offsets[i].y));
> ureg_MOV(shader, ureg_writemask(t_array[i], TGSI_WRITEMASK_ZW),
> ureg_imm1f(shader, 0.0f));
> }
> }
>
> for (i = 0; i < num_offsets; ++i) {
> struct ureg_src src = is_vec_zero(offsets[i]) ? i_vtex : ureg_src(t_array[i]);
> - ureg_TEX(shader, t_array[i], TGSI_TEXTURE_2D, src, sampler);
> + ureg_TEX(shader, t_array[i], TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + src, sampler);
> }
>
> // TODO: Couldn't this be improved even more?
> for (i = 0; i <= median; ++i) {
> for (j = 1; j < (num_offsets - i - 1); ++j) {
> struct ureg_dst tmp = ureg_DECL_temporary(shader);
> ureg_MOV(shader, tmp, ureg_src(t_array[j]));
> ureg_MAX(shader, t_array[j], ureg_src(t_array[j]), ureg_src(t_array[j - 1]));
> ureg_MIN(shader, t_array[j - 1], ureg_src(tmp), ureg_src(t_array[j - 1]));
> ureg_release_temporary(shader, tmp);
> diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
> index db62b44..fb1e080 100644
> --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
> +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
> @@ -1092,21 +1092,22 @@ mc_frag_shader_callback(void *priv, struct vl_mc *mc,
>
> assert(priv && mc);
> assert(shader);
>
> if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT) {
> struct vl_idct *idct = mc == &dec->mc_y ? &dec->idct_y : &dec->idct_c;
> vl_idct_stage2_frag_shader(idct, shader, first_input, dst);
> } else {
> src = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, first_input, TGSI_INTERPOLATE_LINEAR);
> sampler = ureg_DECL_sampler(shader, 0);
> - ureg_TEX(shader, dst, TGSI_TEXTURE_2D, src, sampler);
> + ureg_TEX(shader, dst, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + src, sampler);
> }
> }
>
> struct pipe_video_codec *
> vl_create_mpeg12_decoder(struct pipe_context *context,
> const struct pipe_video_codec *templat)
> {
> const unsigned block_size_pixels = VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT;
> const struct format_config *format_config;
> struct vl_mpeg12_decoder *dec;
> diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c
> index ef05af4..0878465 100644
> --- a/src/gallium/auxiliary/vl/vl_zscan.c
> +++ b/src/gallium/auxiliary/vl/vl_zscan.c
> @@ -202,28 +202,31 @@ create_frag_shader(struct vl_zscan *zscan)
> quant = ureg_DECL_temporary(shader);
>
> fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0);
>
> /*
> * tmp.x = tex(vtex, 1)
> * tmp.y = vtex.z
> * fragment = tex(tmp, 0) * quant
> */
> for (i = 0; i < zscan->num_channels; ++i)
> - ureg_TEX(shader, ureg_writemask(tmp[i], TGSI_WRITEMASK_X), TGSI_TEXTURE_2D, vtex[i], samp_scan);
> + ureg_TEX(shader, ureg_writemask(tmp[i], TGSI_WRITEMASK_X),
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, vtex[i], samp_scan);
>
> for (i = 0; i < zscan->num_channels; ++i)
> ureg_MOV(shader, ureg_writemask(tmp[i], TGSI_WRITEMASK_Y), ureg_scalar(vtex[i], TGSI_SWIZZLE_W));
>
> for (i = 0; i < zscan->num_channels; ++i) {
> - ureg_TEX(shader, ureg_writemask(tmp[0], TGSI_WRITEMASK_X << i), TGSI_TEXTURE_2D, ureg_src(tmp[i]), samp_src);
> - ureg_TEX(shader, ureg_writemask(quant, TGSI_WRITEMASK_X << i), TGSI_TEXTURE_3D, vtex[i], samp_quant);
> + ureg_TEX(shader, ureg_writemask(tmp[0], TGSI_WRITEMASK_X << i),
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, ureg_src(tmp[i]), samp_src);
> + ureg_TEX(shader, ureg_writemask(quant, TGSI_WRITEMASK_X << i),
> + TGSI_TEXTURE_3D, TGSI_RETURN_TYPE_FLOAT, vtex[i], samp_quant);
> }
>
> ureg_MUL(shader, quant, ureg_src(quant), ureg_imm1f(shader, 16.0f));
> ureg_MUL(shader, fragment, ureg_src(tmp[0]), ureg_src(quant));
>
> for (i = 0; i < zscan->num_channels; ++i)
> ureg_release_temporary(shader, tmp[i]);
> ureg_END(shader);
>
> FREE(vtex);
> diff --git a/src/gallium/drivers/freedreno/freedreno_program.c b/src/gallium/drivers/freedreno/freedreno_program.c
> index db6b258..8dbf0b8 100644
> --- a/src/gallium/drivers/freedreno/freedreno_program.c
> +++ b/src/gallium/drivers/freedreno/freedreno_program.c
> @@ -100,27 +100,27 @@ fd_prog_blit(struct pipe_context *pctx, int rts, bool depth)
> debug_assert(rts <= MAX_RENDER_TARGETS);
>
> ureg = ureg_create(PIPE_SHADER_FRAGMENT);
> if (!ureg)
> return NULL;
>
> tc = ureg_DECL_fs_input(
> ureg, TGSI_SEMANTIC_GENERIC, 0, TGSI_INTERPOLATE_PERSPECTIVE);
> for (i = 0; i < rts; i++)
> ureg_TEX(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, i),
> - TGSI_TEXTURE_2D, tc, ureg_DECL_sampler(ureg, i));
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, tc, ureg_DECL_sampler(ureg, i));
> if (depth)
> ureg_TEX(ureg,
> ureg_writemask(
> ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0),
> TGSI_WRITEMASK_Z),
> - TGSI_TEXTURE_2D, tc, ureg_DECL_sampler(ureg, rts));
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, tc, ureg_DECL_sampler(ureg, rts));
>
> ureg_END(ureg);
>
> return ureg_create_shader_and_destroy(ureg, pctx);
> }
>
>
> void fd_prog_init(struct pipe_context *pctx)
> {
> struct fd_context *ctx = fd_context(pctx);
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> index 52e8907..2458788 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> @@ -914,29 +914,29 @@ nv50_blitter_make_fp(struct pipe_context *pipe,
> if (ptarg == PIPE_TEXTURE_1D_ARRAY) {
> /* Adjust coordinates. Depth is in z, but TEX expects it to be in y. */
> tc = ureg_swizzle(tc, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Z,
> TGSI_SWIZZLE_Z, TGSI_SWIZZLE_Z);
> }
>
> data = ureg_DECL_temporary(ureg);
>
> if (tex_s) {
> ureg_TEX(ureg, ureg_writemask(data, TGSI_WRITEMASK_X),
> - target, tc, ureg_DECL_sampler(ureg, 1));
> + target, TGSI_RETURN_TYPE_FLOAT, tc, ureg_DECL_sampler(ureg, 1));
> ureg_MOV(ureg, ureg_writemask(data, TGSI_WRITEMASK_Y),
> ureg_scalar(ureg_src(data), TGSI_SWIZZLE_X));
> }
> if (tex_rgbaz) {
> const unsigned mask = (mode == NV50_BLIT_MODE_PASS) ?
> TGSI_WRITEMASK_XYZW : TGSI_WRITEMASK_X;
> ureg_TEX(ureg, ureg_writemask(data, mask),
> - target, tc, ureg_DECL_sampler(ureg, 0));
> + target, TGSI_RETURN_TYPE_FLOAT, tc, ureg_DECL_sampler(ureg, 0));
> }
>
> if (cvt_un8) {
> struct ureg_src mask;
> struct ureg_src scale;
> struct ureg_dst outz;
> struct ureg_dst outs;
> struct ureg_dst zdst3 = ureg_writemask(data, TGSI_WRITEMASK_XYZ);
> struct ureg_dst zdst = ureg_writemask(data, TGSI_WRITEMASK_X);
> struct ureg_dst sdst = ureg_writemask(data, TGSI_WRITEMASK_Y);
> diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
> index 7621ab9..875fcd9 100644
> --- a/src/gallium/include/pipe/p_shader_tokens.h
> +++ b/src/gallium/include/pipe/p_shader_tokens.h
> @@ -646,21 +646,22 @@ enum tgsi_texture_type {
> TGSI_TEXTURE_CUBE_ARRAY,
> TGSI_TEXTURE_SHADOWCUBE_ARRAY,
> TGSI_TEXTURE_UNKNOWN,
> TGSI_TEXTURE_COUNT,
> };
>
> struct tgsi_instruction_texture
> {
> unsigned Texture : 8; /* TGSI_TEXTURE_ */
> unsigned NumOffsets : 4;
> - unsigned Padding : 20;
> + unsigned ReturnType : 2;
> + unsigned Padding : 18;
> };
>
> /* for texture offsets in GLSL and DirectX.
> * Generally these always come from TGSI_FILE_IMMEDIATE,
> * however DX11 appears to have the capability to do
> * non-constant texture offsets.
> */
> struct tgsi_texture_offset
> {
> int Index : 16;
> diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
> index 899e54e..7b96195 100644
> --- a/src/gallium/state_trackers/nine/nine_ff.c
> +++ b/src/gallium/state_trackers/nine/nine_ff.c
> @@ -1338,28 +1338,28 @@ nine_ff_build_ps(struct NineDevice9 *device, struct nine_ff_ps_key *key)
> if (key->ts[s-1].colorop == D3DTOP_BUMPENVMAPLUMINANCE) {
> struct ureg_src bumpenvlscale = ((s-1) & 1) ? _ZZZZ(_CONST(16 + (s-1) / 2)) : _XXXX(_CONST(16 + (s-1) / 2));
> struct ureg_src bumpenvloffset = ((s-1) & 1) ? _WWWW(_CONST(16 + (s-1) / 2)) : _YYYY(_CONST(16 + (s-1) / 2));
>
> ureg_MAD(ureg, ureg_saturate(ureg_writemask(delta, TGSI_WRITEMASK_X)), _Z(ps.rTex), bumpenvlscale, bumpenvloffset);
> }
> }
> if (key->projected & (3 << (s *2))) {
> unsigned dim = 1 + ((key->projected >> (2 * s)) & 3);
> if (dim == 4)
> - ureg_TXP(ureg, ps.rTex, target, texture_coord, ps.s[s]);
> + ureg_TXP(ureg, ps.rTex, target, TGSI_RETURN_TYPE_FLOAT, texture_coord, ps.s[s]);
> else {
> ureg_RCP(ureg, ureg_writemask(ps.rTmp, TGSI_WRITEMASK_X), ureg_scalar(texture_coord, dim-1));
> ureg_MUL(ureg, ps.rTmp, _XXXX(ps.rTmpSrc), texture_coord);
> - ureg_TEX(ureg, ps.rTex, target, ps.rTmpSrc, ps.s[s]);
> + ureg_TEX(ureg, ps.rTex, target, TGSI_RETURN_TYPE_FLOAT, ps.rTmpSrc, ps.s[s]);
> }
> } else {
> - ureg_TEX(ureg, ps.rTex, target, texture_coord, ps.s[s]);
> + ureg_TEX(ureg, ps.rTex, target, TGSI_RETURN_TYPE_FLOAT, texture_coord, ps.s[s]);
> }
> if (s >= 1 && key->ts[s-1].colorop == D3DTOP_BUMPENVMAPLUMINANCE)
> ureg_MUL(ureg, ps.rTex, ureg_src(ps.rTex), _X(delta));
> }
>
> if (((s == 0 && key->ts[0].colorop != D3DTOP_BUMPENVMAP &&
> key->ts[0].colorop != D3DTOP_BUMPENVMAPLUMINANCE) ||
> (s == 1 &&
> (key->ts[0].colorop == D3DTOP_BUMPENVMAP ||
> key->ts[0].colorop == D3DTOP_BUMPENVMAPLUMINANCE)))&&
> diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
> index bd373d7..c54b3ff 100644
> --- a/src/gallium/state_trackers/nine/nine_shader.c
> +++ b/src/gallium/state_trackers/nine/nine_shader.c
> @@ -714,27 +714,27 @@ TEX_with_ps1x_projection(struct shader_translator *tx, struct ureg_dst dst,
> struct ureg_src src1, INT idx)
> {
> unsigned dim = 1 + ((tx->info->projected >> (2 * idx)) & 3);
> struct ureg_dst tmp;
>
> /* dim == 1: no projection
> * Looks like must be disabled when it makes no
> * sense according the texture dimensions
> */
> if (dim == 1 || dim <= target) {
> - ureg_TEX(tx->ureg, dst, target, src0, src1);
> + ureg_TEX(tx->ureg, dst, target, TGSI_RETURN_TYPE_FLOAT, src0, src1);
> } else if (dim == 4) {
> - ureg_TXP(tx->ureg, dst, target, src0, src1);
> + ureg_TXP(tx->ureg, dst, target, TGSI_RETURN_TYPE_FLOAT, src0, src1);
> } else {
> tmp = tx_scratch(tx);
> apply_ps1x_projection(tx, tmp, src0, idx);
> - ureg_TEX(tx->ureg, dst, target, ureg_src(tmp), src1);
> + ureg_TEX(tx->ureg, dst, target, TGSI_RETURN_TYPE_FLOAT, ureg_src(tmp), src1);
> }
> }
>
> static inline void
> tx_texcoord_alloc(struct shader_translator *tx, INT idx)
> {
> assert(IS_PS);
> assert(idx >= 0 && idx < ARRAY_SIZE(tx->regs.vT));
> if (ureg_src_is_undef(tx->regs.vT[idx]))
> tx->regs.vT[idx] = ureg_DECL_fs_input(tx->ureg, tx->texcoord_sn, idx,
> @@ -2286,24 +2286,26 @@ DECL_SPECIAL(TEXBEM)
> ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), m01,
> NINE_APPLY_SWIZZLE(ureg_src(tx->regs.tS[n]), X), ureg_src(texcoord));
> /* v' = v' + D3DTSS_BUMPENVMAT11(stage m)*t(n)G*/
> ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), m11,
> NINE_APPLY_SWIZZLE(ureg_src(tx->regs.tS[n]), Y),
> NINE_APPLY_SWIZZLE(ureg_src(tmp), Y));
>
> /* Now the texture coordinates are in tmp.xy */
>
> if (tx->insn.opcode == D3DSIO_TEXBEM) {
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), ureg_src(tmp), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m),
> + TGSI_RETURN_TYPE_FLOAT, ureg_src(tmp), sample);
> } else if (tx->insn.opcode == D3DSIO_TEXBEML) {
> /* t(m)RGBA = t(m)RGBA * [(t(n)B * D3DTSS_BUMPENVLSCALE(stage m)) + D3DTSS_BUMPENVLOFFSET(stage m)] */
> - ureg_TEX(ureg, tmp, ps1x_sampler_type(tx->info, m), ureg_src(tmp), sample);
> + ureg_TEX(ureg, tmp, ps1x_sampler_type(tx->info, m),
> + TGSI_RETURN_TYPE_FLOAT, ureg_src(tmp), sample);
> ureg_MAD(ureg, tmp2, NINE_APPLY_SWIZZLE(ureg_src(tx->regs.tS[n]), Z),
> bumpenvlscale, bumpenvloffset);
> ureg_MUL(ureg, dst, ureg_src(tmp), ureg_src(tmp2));
> }
>
> tx->info->bumpenvmat_needed = 1;
>
> return D3D_OK;
> }
>
> @@ -2311,37 +2313,39 @@ DECL_SPECIAL(TEXREG2AR)
> {
> struct ureg_program *ureg = tx->ureg;
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> struct ureg_src sample;
> const int m = tx->insn.dst[0].idx;
> const int n = tx->insn.src[0].idx;
> assert(m >= 0 && m > n);
>
> sample = ureg_DECL_sampler(ureg, m);
> tx->info->sampler_mask |= 1 << m;
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), ureg_swizzle(ureg_src(tx->regs.tS[n]), NINE_SWIZZLE4(W,X,X,X)), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), TGSI_RETURN_TYPE_FLOAT,
> + ureg_swizzle(ureg_src(tx->regs.tS[n]), NINE_SWIZZLE4(W,X,X,X)), sample);
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXREG2GB)
> {
> struct ureg_program *ureg = tx->ureg;
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> struct ureg_src sample;
> const int m = tx->insn.dst[0].idx;
> const int n = tx->insn.src[0].idx;
> assert(m >= 0 && m > n);
>
> sample = ureg_DECL_sampler(ureg, m);
> tx->info->sampler_mask |= 1 << m;
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), ureg_swizzle(ureg_src(tx->regs.tS[n]), NINE_SWIZZLE4(Y,Z,Z,Z)), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), TGSI_RETURN_TYPE_FLOAT,
> + ureg_swizzle(ureg_src(tx->regs.tS[n]), NINE_SWIZZLE4(Y,Z,Z,Z)), sample);
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXM3x2PAD)
> {
> return D3D_OK; /* this is just padding */
> }
>
> DECL_SPECIAL(TEXM3x2TEX)
> @@ -2355,21 +2359,22 @@ DECL_SPECIAL(TEXM3x2TEX)
>
> tx_texcoord_alloc(tx, m);
> tx_texcoord_alloc(tx, m+1);
>
> /* performs the matrix multiplication */
> ureg_DP3(ureg, ureg_writemask(dst, TGSI_WRITEMASK_X), tx->regs.vT[m], ureg_src(tx->regs.tS[n]));
> ureg_DP3(ureg, ureg_writemask(dst, TGSI_WRITEMASK_Y), tx->regs.vT[m+1], ureg_src(tx->regs.tS[n]));
>
> sample = ureg_DECL_sampler(ureg, m + 1);
> tx->info->sampler_mask |= 1 << (m + 1);
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 1), ureg_src(dst), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 1),
> + TGSI_RETURN_TYPE_FLOAT, ureg_src(dst), sample);
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXM3x3PAD)
> {
> return D3D_OK; /* this is just padding */
> }
>
> DECL_SPECIAL(TEXM3x3SPEC)
> @@ -2402,37 +2407,39 @@ DECL_SPECIAL(TEXM3x3SPEC)
> ureg_RCP(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X));
> /* at this step tmp.x = 1/N.N */
> ureg_DP3(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_src(dst), E);
> /* at this step tmp.y = N.E */
> ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y));
> /* at this step tmp.x = N.E/N.N */
> ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_imm1f(ureg, 2.0f));
> ureg_MUL(ureg, tmp, ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_src(dst));
> /* at this step tmp.xyz = 2 * (N.E / N.N) * N */
> ureg_SUB(ureg, tmp, ureg_src(tmp), E);
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2), ureg_src(tmp), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2),
> + TGSI_RETURN_TYPE_FLOAT, ureg_src(tmp), sample);
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXREG2RGB)
> {
> struct ureg_program *ureg = tx->ureg;
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> struct ureg_src sample;
> const int m = tx->insn.dst[0].idx;
> const int n = tx->insn.src[0].idx;
> assert(m >= 0 && m > n);
>
> sample = ureg_DECL_sampler(ureg, m);
> tx->info->sampler_mask |= 1 << m;
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), ureg_src(tx->regs.tS[n]), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(tx->regs.tS[n]), sample);
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXDP3TEX)
> {
> struct ureg_program *ureg = tx->ureg;
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> struct ureg_dst tmp;
> struct ureg_src sample;
> @@ -2441,21 +2448,22 @@ DECL_SPECIAL(TEXDP3TEX)
> assert(m >= 0 && m > n);
>
> tx_texcoord_alloc(tx, m);
>
> tmp = tx_scratch(tx);
> ureg_DP3(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), tx->regs.vT[m], ureg_src(tx->regs.tS[n]));
> ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_YZ), ureg_imm1f(ureg, 0.0f));
>
> sample = ureg_DECL_sampler(ureg, m);
> tx->info->sampler_mask |= 1 << m;
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), ureg_src(tmp), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m), TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(tmp), sample);
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXM3x2DEPTH)
> {
> struct ureg_program *ureg = tx->ureg;
> struct ureg_dst tmp;
> const int m = tx->insn.dst[0].idx - 1;
> const int n = tx->insn.src[0].idx;
> @@ -2517,21 +2525,22 @@ DECL_SPECIAL(TEXM3x3)
> ureg_DP3(ureg, ureg_writemask(dst, TGSI_WRITEMASK_Y), tx->regs.vT[m+1], ureg_src(tx->regs.tS[n]));
> ureg_DP3(ureg, ureg_writemask(dst, TGSI_WRITEMASK_Z), tx->regs.vT[m+2], ureg_src(tx->regs.tS[n]));
>
> switch (tx->insn.opcode) {
> case D3DSIO_TEXM3x3:
> ureg_MOV(ureg, ureg_writemask(dst, TGSI_WRITEMASK_W), ureg_imm1f(ureg, 1.0f));
> break;
> case D3DSIO_TEXM3x3TEX:
> sample = ureg_DECL_sampler(ureg, m + 2);
> tx->info->sampler_mask |= 1 << (m + 2);
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2), ureg_src(dst), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2),
> + TGSI_RETURN_TYPE_FLOAT, ureg_src(dst), sample);
> break;
> case D3DSIO_TEXM3x3VSPEC:
> sample = ureg_DECL_sampler(ureg, m + 2);
> tx->info->sampler_mask |= 1 << (m + 2);
> E = tx_scratch(tx);
> tmp = ureg_writemask(tx_scratch(tx), TGSI_WRITEMASK_XYZ);
> ureg_MOV(ureg, ureg_writemask(E, TGSI_WRITEMASK_X), ureg_scalar(tx->regs.vT[m], TGSI_SWIZZLE_W));
> ureg_MOV(ureg, ureg_writemask(E, TGSI_WRITEMASK_Y), ureg_scalar(tx->regs.vT[m+1], TGSI_SWIZZLE_W));
> ureg_MOV(ureg, ureg_writemask(E, TGSI_WRITEMASK_Z), ureg_scalar(tx->regs.vT[m+2], TGSI_SWIZZLE_W));
> /* At this step, dst = N = (u', w', z').
> @@ -2541,21 +2550,22 @@ DECL_SPECIAL(TEXM3x3)
> ureg_RCP(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X));
> /* at this step tmp.x = 1/N.N */
> ureg_DP3(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_src(dst), ureg_src(E));
> /* at this step tmp.y = N.E */
> ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y));
> /* at this step tmp.x = N.E/N.N */
> ureg_MUL(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_imm1f(ureg, 2.0f));
> ureg_MUL(ureg, tmp, ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_X), ureg_src(dst));
> /* at this step tmp.xyz = 2 * (N.E / N.N) * N */
> ureg_SUB(ureg, tmp, ureg_src(tmp), ureg_src(E));
> - ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2), ureg_src(tmp), sample);
> + ureg_TEX(ureg, dst, ps1x_sampler_type(tx->info, m + 2), TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(tmp), sample);
> break;
> default:
> return D3DERR_INVALIDCALL;
> }
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXDEPTH)
> {
> struct ureg_program *ureg = tx->ureg;
> @@ -2632,45 +2642,49 @@ DECL_SPECIAL(TEXLD)
> struct ureg_src src[2] = {
> tx_src_param(tx, &tx->insn.src[0]),
> tx_src_param(tx, &tx->insn.src[1])
> };
> assert(tx->insn.src[1].idx >= 0 &&
> tx->insn.src[1].idx < ARRAY_SIZE(tx->sampler_targets));
> target = tx->sampler_targets[tx->insn.src[1].idx];
>
> switch (tx->insn.flags) {
> case 0:
> - ureg_TEX(ureg, dst, target, src[0], src[1]);
> + ureg_TEX(ureg, dst, target, TGSI_RETURN_TYPE_FLOAT,
> + src[0], src[1]);
> break;
> case NINED3DSI_TEXLD_PROJECT:
> - ureg_TXP(ureg, dst, target, src[0], src[1]);
> + ureg_TXP(ureg, dst, target, TGSI_RETURN_TYPE_FLOAT,
> + src[0], src[1]);
> break;
> case NINED3DSI_TEXLD_BIAS:
> - ureg_TXB(ureg, dst, target, src[0], src[1]);
> + ureg_TXB(ureg, dst, target, TGSI_RETURN_TYPE_FLOAT,
> + src[0], src[1]);
> break;
> default:
> assert(0);
> return D3DERR_INVALIDCALL;
> }
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXLD_14)
> {
> struct ureg_program *ureg = tx->ureg;
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> struct ureg_src src = tx_src_param(tx, &tx->insn.src[0]);
> const unsigned s = tx->insn.dst[0].idx;
> const unsigned t = ps1x_sampler_type(tx->info, s);
>
> tx->info->sampler_mask |= 1 << s;
> - ureg_TEX(ureg, dst, t, src, ureg_DECL_sampler(ureg, s));
> + ureg_TEX(ureg, dst, t, TGSI_RETURN_TYPE_FLOAT,
> + src, ureg_DECL_sampler(ureg, s));
>
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEX)
> {
> struct ureg_program *ureg = tx->ureg;
> const unsigned s = tx->insn.dst[0].idx;
> const unsigned t = ps1x_sampler_type(tx->info, s);
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> @@ -2694,37 +2708,38 @@ DECL_SPECIAL(TEXLDD)
> struct ureg_src src[4] = {
> tx_src_param(tx, &tx->insn.src[0]),
> tx_src_param(tx, &tx->insn.src[1]),
> tx_src_param(tx, &tx->insn.src[2]),
> tx_src_param(tx, &tx->insn.src[3])
> };
> assert(tx->insn.src[1].idx >= 0 &&
> tx->insn.src[1].idx < ARRAY_SIZE(tx->sampler_targets));
> target = tx->sampler_targets[tx->insn.src[1].idx];
>
> - ureg_TXD(tx->ureg, dst, target, src[0], src[2], src[3], src[1]);
> + ureg_TXD(tx->ureg, dst, target, TGSI_RETURN_TYPE_FLOAT,
> + src[0], src[2], src[3], src[1]);
> return D3D_OK;
> }
>
> DECL_SPECIAL(TEXLDL)
> {
> unsigned target;
> struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
> struct ureg_src src[2] = {
> tx_src_param(tx, &tx->insn.src[0]),
> tx_src_param(tx, &tx->insn.src[1])
> };
> assert(tx->insn.src[1].idx >= 0 &&
> tx->insn.src[1].idx < ARRAY_SIZE(tx->sampler_targets));
> target = tx->sampler_targets[tx->insn.src[1].idx];
>
> - ureg_TXL(tx->ureg, dst, target, src[0], src[1]);
> + ureg_TXL(tx->ureg, dst, target, TGSI_RETURN_TYPE_FLOAT, src[0], src[1]);
> return D3D_OK;
> }
>
> DECL_SPECIAL(SETP)
> {
> STUB(D3DERR_INVALIDCALL);
> }
>
> DECL_SPECIAL(BREAKP)
> {
> diff --git a/src/gallium/state_trackers/xa/xa_tgsi.c b/src/gallium/state_trackers/xa/xa_tgsi.c
> index f3f665d..e2391a6 100644
> --- a/src/gallium/state_trackers/xa/xa_tgsi.c
> +++ b/src/gallium/state_trackers/xa/xa_tgsi.c
> @@ -173,21 +173,22 @@ linear_gradient(struct ureg_program *ureg,
>
> ureg_MUL(ureg, temp0,
> ureg_scalar(coords, TGSI_SWIZZLE_Y),
> ureg_scalar(ureg_src(temp4), TGSI_SWIZZLE_Y));
> ureg_MAD(ureg, temp1,
> ureg_scalar(coords, TGSI_SWIZZLE_X),
> ureg_scalar(ureg_src(temp4), TGSI_SWIZZLE_X), ureg_src(temp0));
>
> ureg_MUL(ureg, temp2, ureg_src(temp1), ureg_scalar(coords, TGSI_SWIZZLE_Z));
>
> - ureg_TEX(ureg, out, TGSI_TEXTURE_1D, ureg_src(temp2), sampler);
> + ureg_TEX(ureg, out, TGSI_TEXTURE_1D, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(temp2), sampler);
>
> ureg_release_temporary(ureg, temp0);
> ureg_release_temporary(ureg, temp1);
> ureg_release_temporary(ureg, temp2);
> ureg_release_temporary(ureg, temp3);
> ureg_release_temporary(ureg, temp4);
> ureg_release_temporary(ureg, temp5);
> }
>
> static void
> @@ -241,21 +242,22 @@ radial_gradient(struct ureg_program *ureg,
> ureg_MUL(ureg, temp3, ureg_src(temp1), ureg_src(temp1));
> ureg_SUB(ureg, temp2, ureg_src(temp3), ureg_src(temp0));
> ureg_RSQ(ureg, temp2, ureg_abs(ureg_src(temp2)));
> ureg_RCP(ureg, temp2, ureg_src(temp2));
> ureg_SUB(ureg, temp1, ureg_src(temp2), ureg_src(temp1));
> ureg_ADD(ureg, temp0,
> ureg_scalar(coords, TGSI_SWIZZLE_Z),
> ureg_scalar(coords, TGSI_SWIZZLE_Z));
> ureg_RCP(ureg, temp0, ureg_src(temp0));
> ureg_MUL(ureg, temp2, ureg_src(temp1), ureg_src(temp0));
> - ureg_TEX(ureg, out, TGSI_TEXTURE_1D, ureg_src(temp2), sampler);
> + ureg_TEX(ureg, out, TGSI_TEXTURE_1D, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(temp2), sampler);
>
> ureg_release_temporary(ureg, temp0);
> ureg_release_temporary(ureg, temp1);
> ureg_release_temporary(ureg, temp2);
> ureg_release_temporary(ureg, temp3);
> ureg_release_temporary(ureg, temp4);
> ureg_release_temporary(ureg, temp5);
> }
>
> static void *
> @@ -347,23 +349,23 @@ create_yuv_shader(struct pipe_context *pipe, struct ureg_program *ureg)
> TGSI_RETURN_TYPE_FLOAT, TGSI_RETURN_TYPE_FLOAT);
> ureg_DECL_sampler_view(ureg, 2, TGSI_TEXTURE_2D,
> TGSI_RETURN_TYPE_FLOAT, TGSI_RETURN_TYPE_FLOAT,
> TGSI_RETURN_TYPE_FLOAT, TGSI_RETURN_TYPE_FLOAT);
>
> matrow0 = ureg_DECL_constant(ureg, 0);
> matrow1 = ureg_DECL_constant(ureg, 1);
> matrow2 = ureg_DECL_constant(ureg, 2);
> matrow3 = ureg_DECL_constant(ureg, 3);
>
> - ureg_TEX(ureg, y, TGSI_TEXTURE_2D, pos, y_sampler);
> - ureg_TEX(ureg, u, TGSI_TEXTURE_2D, pos, u_sampler);
> - ureg_TEX(ureg, v, TGSI_TEXTURE_2D, pos, v_sampler);
> + ureg_TEX(ureg, y, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, pos, y_sampler);
> + ureg_TEX(ureg, u, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, pos, u_sampler);
> + ureg_TEX(ureg, v, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT, pos, v_sampler);
>
> ureg_MOV(ureg, rgb, matrow3);
> ureg_MAD(ureg, rgb,
> ureg_scalar(ureg_src(y), TGSI_SWIZZLE_X), matrow0, ureg_src(rgb));
> ureg_MAD(ureg, rgb,
> ureg_scalar(ureg_src(u), TGSI_SWIZZLE_X), matrow1, ureg_src(rgb));
> ureg_MAD(ureg, rgb,
> ureg_scalar(ureg_src(v), TGSI_SWIZZLE_X), matrow2, ureg_src(rgb));
>
> ureg_MOV(ureg, out, ureg_src(rgb));
> @@ -396,45 +398,48 @@ xrender_tex(struct ureg_program *ureg,
> TGSI_SWIZZLE_X,
> TGSI_SWIZZLE_Y), ureg_scalar(imm0,
> TGSI_SWIZZLE_X));
> ureg_SLT(ureg, tmp0,
> ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y,
> TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y), ureg_scalar(imm0,
> TGSI_SWIZZLE_W));
> ureg_MIN(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1));
> ureg_MIN(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X),
> ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y));
> - ureg_TEX(ureg, tmp1, TGSI_TEXTURE_2D, coords, sampler);
> + ureg_TEX(ureg, tmp1, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + coords, sampler);
> if (swizzle)
> ureg_MOV(ureg, tmp1, ureg_swizzle(ureg_src(tmp1),
> TGSI_SWIZZLE_Z,
> TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X,
> TGSI_SWIZZLE_W));
> if (set_alpha)
> ureg_MOV(ureg,
> ureg_writemask(tmp1, TGSI_WRITEMASK_W),
> ureg_scalar(imm0, TGSI_SWIZZLE_W));
> ureg_MUL(ureg, dst, ureg_src(tmp1), ureg_src(tmp0));
> ureg_release_temporary(ureg, tmp0);
> ureg_release_temporary(ureg, tmp1);
> } else {
> if (swizzle) {
> struct ureg_dst tmp = ureg_DECL_temporary(ureg);
>
> - ureg_TEX(ureg, tmp, TGSI_TEXTURE_2D, coords, sampler);
> + ureg_TEX(ureg, tmp, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + coords, sampler);
> ureg_MOV(ureg, dst, ureg_swizzle(ureg_src(tmp),
> TGSI_SWIZZLE_Z,
> TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X,
> TGSI_SWIZZLE_W));
> ureg_release_temporary(ureg, tmp);
> } else {
> - ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler);
> + ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + coords, sampler);
> }
> if (set_alpha)
> ureg_MOV(ureg,
> ureg_writemask(dst, TGSI_WRITEMASK_W),
> ureg_scalar(imm0, TGSI_SWIZZLE_W));
> }
> }
>
> static void *
> create_fs(struct pipe_context *pipe, unsigned fs_traits)
> diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c
> index ae08796..71b786e 100644
> --- a/src/mesa/state_tracker/st_atifs_to_tgsi.c
> +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c
> @@ -324,20 +324,21 @@ compile_setupinst(struct st_translate *t,
> src[0] = ureg_imm1f(t->ureg, 0.0f);
> }
> }
> src[0] = apply_swizzle(t, src[0], texinst->swizzle);
>
> if (texinst->Opcode == ATI_FRAGMENT_SHADER_SAMPLE_OP) {
> /* by default texture and sampler indexes are the same */
> src[1] = t->samplers[r];
> /* the texture target is still unknown, it will be fixed in the draw call */
> ureg_tex_insn(t->ureg, TGSI_OPCODE_TEX, dst, 1, TGSI_TEXTURE_2D,
> + TGSI_RETURN_TYPE_FLOAT,
> NULL, 0, src, 2);
> } else if (texinst->Opcode == ATI_FRAGMENT_SHADER_PASS_OP) {
> ureg_insn(t->ureg, TGSI_OPCODE_MOV, dst, 1, src, 1);
> }
>
> t->regs_written[t->current_pass][r] = true;
> }
>
> /**
> * Compile one arithmetic operation COLOR&ALPHA pair into TGSI instructions.
> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
> index d2b964e..de3d6cd 100644
> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
> @@ -162,27 +162,29 @@ get_drawpix_z_stencil_program(struct st_context *st,
> }
>
> texcoord = ureg_DECL_fs_input(ureg,
> st->needs_texcoord_semantic ?
> TGSI_SEMANTIC_TEXCOORD :
> TGSI_SEMANTIC_GENERIC,
> 0, TGSI_INTERPOLATE_LINEAR);
>
> if (write_depth) {
> ureg_TEX(ureg, ureg_writemask(out_depth, TGSI_WRITEMASK_Z),
> - TGSI_TEXTURE_2D, texcoord, depth_sampler);
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_FLOAT,
> + texcoord, depth_sampler);
> ureg_MOV(ureg, out_color, color);
> }
>
> if (write_stencil)
> ureg_TEX(ureg, ureg_writemask(out_stencil, TGSI_WRITEMASK_Y),
> - TGSI_TEXTURE_2D, texcoord, stencil_sampler);
> + TGSI_TEXTURE_2D, TGSI_RETURN_TYPE_UINT,
> + texcoord, stencil_sampler);
>
> ureg_END(ureg);
> cso = ureg_create_shader_and_destroy(ureg, st->pipe);
>
> /* save the new shader */
> st->drawpix.zs_shaders[shaderIndex] = cso;
> return cso;
> }
>
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 5a9cadc..b8885bc 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -5457,20 +5457,39 @@ src_register(struct st_translate *t, const st_src_reg *reg)
> case PROGRAM_SYSTEM_VALUE:
> assert(reg->index < (int) ARRAY_SIZE(t->systemValues));
> return t->systemValues[reg->index];
>
> default:
> assert(!"unknown src register file");
> return ureg_src_undef();
> }
> }
>
> +static inline unsigned
> +translate_return_type(glsl_base_type type)
> +{
> + switch (type) {
> + case GLSL_TYPE_INT:
> + return TGSI_RETURN_TYPE_SINT;
> + break;
> + case GLSL_TYPE_UINT:
> + return TGSI_RETURN_TYPE_UINT;
> + break;
> + case GLSL_TYPE_FLOAT:
> + return TGSI_RETURN_TYPE_FLOAT;
> + break;
> + default:
> + unreachable("not reached");
> + return 0;
> + }
> +}
> +
> /**
> * Create a TGSI ureg_dst register from an st_dst_reg.
> */
> static struct ureg_dst
> translate_dst(struct st_translate *t,
> const st_dst_reg *dst_reg,
> bool saturate)
> {
> struct ureg_dst dst = dst_register(t, dst_reg->file, dst_reg->index,
> dst_reg->array_id);
> @@ -5655,20 +5674,21 @@ compile_tgsi_instruction(struct st_translate *t,
> num_src++;
> for (i = 0; i < (int)inst->tex_offset_num_offset; i++) {
> texoffsets[i] = translate_tex_offset(t, &inst->tex_offsets[i], i);
> }
> tex_target = st_translate_texture_target(inst->tex_target, inst->tex_shadow);
>
> ureg_tex_insn(ureg,
> inst->op,
> dst, num_dst,
> tex_target,
> + translate_return_type(inst->tex_type),
> texoffsets, inst->tex_offset_num_offset,
> src, num_src);
> return;
>
> case TGSI_OPCODE_RESQ:
> case TGSI_OPCODE_LOAD:
> case TGSI_OPCODE_ATOMUADD:
> case TGSI_OPCODE_ATOMXCHG:
> case TGSI_OPCODE_ATOMCAS:
> case TGSI_OPCODE_ATOMAND:
> @@ -6324,34 +6344,21 @@ st_translate_program(
> t->immediates[i++] = emit_immediate(t, imm->values, imm->type, imm->size32);
> }
> assert(i == program->num_immediates);
>
> /* texture samplers */
> for (i = 0; i < frag_const->MaxTextureImageUnits; i++) {
> if (program->samplers_used & (1u << i)) {
> unsigned type;
>
> t->samplers[i] = ureg_DECL_sampler(ureg, i);
> -
> - switch (program->sampler_types[i]) {
> - case GLSL_TYPE_INT:
> - type = TGSI_RETURN_TYPE_SINT;
> - break;
> - case GLSL_TYPE_UINT:
> - type = TGSI_RETURN_TYPE_UINT;
> - break;
> - case GLSL_TYPE_FLOAT:
> - type = TGSI_RETURN_TYPE_FLOAT;
> - break;
> - default:
> - unreachable("not reached");
> - }
> + type = translate_return_type(program->sampler_types[i]);
>
> ureg_DECL_sampler_view( ureg, i, program->sampler_targets[i],
> type, type, type, type );
> }
> }
>
> for (i = 0; i < frag_const->MaxAtomicBuffers; i++) {
> if (program->buffers_used & (1 << i)) {
> t->buffers[i] = ureg_DECL_buffer(ureg, i, true);
> }
> diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
> index b989257..5ee48ee 100644
> --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
> +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
> @@ -666,20 +666,21 @@ compile_instruction(
> case OPCODE_TXB:
> case OPCODE_TXD:
> case OPCODE_TXL:
> case OPCODE_TXP:
> src[num_src++] = t->samplers[inst->TexSrcUnit];
> ureg_tex_insn( ureg,
> translate_opcode( inst->Opcode ),
> dst, num_dst,
> st_translate_texture_target( inst->TexSrcTarget,
> inst->TexShadow ),
> + TGSI_RETURN_TYPE_FLOAT,
> NULL, 0,
> src, num_src );
> return;
>
> case OPCODE_SCS:
> dst[0] = ureg_writemask(dst[0], TGSI_WRITEMASK_XY );
> ureg_insn( ureg,
> translate_opcode( inst->Opcode ),
> dst, num_dst,
> src, num_src );
> diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c
> index ca6bdea..059e9cd 100644
> --- a/src/mesa/state_tracker/st_pbo.c
> +++ b/src/mesa/state_tracker/st_pbo.c
> @@ -485,33 +485,37 @@ create_fs(struct st_context *st, bool download, enum pipe_texture_target target)
>
> if (target == PIPE_TEXTURE_3D) {
> /* temp1.z += layer_offset */
> ureg_UADD(ureg, temp1_layer,
> ureg_scalar(ureg_src(temp1), TGSI_SWIZZLE_Z),
> ureg_scalar(const1, TGSI_SWIZZLE_X));
> }
> }
>
> /* temp1 = txf(sampler, temp1) */
> + /* TODO: The return type is wrong, though it was also wrong before.
> + */
> ureg_TXF(ureg, temp1, util_pipe_tex_to_tgsi_tex(target, 1),
> - ureg_src(temp1), sampler);
> + TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(temp1), sampler);
>
> /* store(out, temp0, temp1) */
> op[0] = ureg_src(temp0);
> op[1] = ureg_src(temp1);
> ureg_memory_insn(ureg, TGSI_OPCODE_STORE, &out, 1, op, 2, 0,
> TGSI_TEXTURE_BUFFER, PIPE_FORMAT_NONE);
>
> ureg_release_temporary(ureg, temp1);
> } else {
> /* out = txf(sampler, temp0.x) */
> - ureg_TXF(ureg, out, TGSI_TEXTURE_BUFFER, ureg_src(temp0), sampler);
> + ureg_TXF(ureg, out, TGSI_TEXTURE_BUFFER, TGSI_RETURN_TYPE_FLOAT,
> + ureg_src(temp0), sampler);
> }
>
> ureg_release_temporary(ureg, temp0);
>
> ureg_END(ureg);
>
> return ureg_create_shader_and_destroy(ureg, pipe);
> }
>
> void *
>
More information about the mesa-dev
mailing list