Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On 05/17/2017 08:06 PM, Ilia Mirkin wrote: On Wed, May 17, 2017 at 5:17 AM, Samuel Pitoisetwrote: @@ -695,6 +696,7 @@ struct tgsi_instruction_texture unsigned Texture : 8;/* TGSI_TEXTURE_ */ unsigned NumOffsets : 4; unsigned Padding : 20; + unsigned ReturnType : 3; /* TGSI_RETURN_TYPE_x */ }; /* for texture offsets in GLSL and DirectX. You really want to add that second word? Instead of, say, reducing the padding by 3 bits? Fixed in v2. :) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On Wed, May 17, 2017 at 5:17 AM, Samuel Pitoisetwrote: > @@ -695,6 +696,7 @@ struct tgsi_instruction_texture > unsigned Texture : 8;/* TGSI_TEXTURE_ */ > unsigned NumOffsets : 4; > unsigned Padding : 20; > + unsigned ReturnType : 3; /* TGSI_RETURN_TYPE_x */ > }; > > /* for texture offsets in GLSL and DirectX. You really want to add that second word? Instead of, say, reducing the padding by 3 bits? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On 05/17/2017 06:02 PM, Roland Scheidegger wrote: Am 17.05.2017 um 11:17 schrieb Samuel Pitoiset: RadeonSI needs to do a special lowering for Gather4 with integer formats, but with bindless samplers we just can't access the index. Instead, store the return type in the instruction like the target. Signed-off-by: Samuel Pitoiset--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 9eb00d0919..1cdb95cc95 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned extended_token, - unsigned target, unsigned num_offsets) + unsigned target, unsigned return_type, unsigned num_offsets) { union tgsi_any_token *out, *insn; @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, out[0].value = 0; out[0].insn_texture.Texture = target; + out[0].insn_texture.ReturnType = return_type; out[0].insn_texture.NumOffsets = num_offsets; } @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); + ureg_emit_texture( ureg, insn.extended_token, target, return_type, + nr_offset ); for (i = 0; i < nr_offset; i++) ureg_emit_texture_offset( ureg, [i]); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6d2f5c0e99..54f95ba565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned insn_token, - unsigned target, unsigned num_offsets); + unsigned target, unsigned return_type, unsigned num_offsets); void ureg_emit_texture_offset(struct ureg_program *ureg, @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if (ureg_dst_is_empty(dst)) \ return; \ @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg, \ dst.Saturate, \ 1, \ 2);\ - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \ + ureg_emit_texture( ureg, insn.extended_token, target,\ + return_type, 0 ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -796,6 +799,7 @@ static inline void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src3 )\ { \
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On 05/17/2017 02:21 PM, Samuel Pitoiset wrote: On 05/17/2017 02:02 PM, Nicolai Hähnle wrote: On 17.05.2017 11:17, Samuel Pitoiset wrote: RadeonSI needs to do a special lowering for Gather4 with integer formats, but with bindless samplers we just can't access the index. Instead, store the return type in the instruction like the target. Signed-off-by: Samuel Pitoiset--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 9eb00d0919..1cdb95cc95 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned extended_token, - unsigned target, unsigned num_offsets) + unsigned target, unsigned return_type, unsigned num_offsets) { union tgsi_any_token *out, *insn; @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, out[0].value = 0; out[0].insn_texture.Texture = target; + out[0].insn_texture.ReturnType = return_type; out[0].insn_texture.NumOffsets = num_offsets; } @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); + ureg_emit_texture( ureg, insn.extended_token, target, return_type, + nr_offset ); for (i = 0; i < nr_offset; i++) ureg_emit_texture_offset( ureg, [i]); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6d2f5c0e99..54f95ba565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned insn_token, - unsigned target, unsigned num_offsets); + unsigned target, unsigned return_type, unsigned num_offsets); void ureg_emit_texture_offset(struct ureg_program *ureg, @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src1 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if (ureg_dst_is_empty(dst)) \ return; \ @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg,\ dst.Saturate, \ 1, \ 2);\ - ureg_emit_texture( ureg, insn.extended_token, target, 0 );\ + ureg_emit_texture( ureg, insn.extended_token, target,\ + return_type, 0 ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -796,6 +799,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src3 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
Am 17.05.2017 um 11:17 schrieb Samuel Pitoiset: > RadeonSI needs to do a special lowering for Gather4 with integer > formats, but with bindless samplers we just can't access the index. > > Instead, store the return type in the instruction like the target. > > Signed-off-by: Samuel Pitoiset> --- > src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- > src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- > src/gallium/include/pipe/p_shader_tokens.h | 2 ++ > src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- > src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + > src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 > 7 files changed, 43 insertions(+), 21 deletions(-) > > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > index 9eb00d0919..1cdb95cc95 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c > @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, > void > ureg_emit_texture(struct ureg_program *ureg, >unsigned extended_token, > - unsigned target, unsigned num_offsets) > + unsigned target, unsigned return_type, unsigned > num_offsets) > { > union tgsi_any_token *out, *insn; > > @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, > > out[0].value = 0; > out[0].insn_texture.Texture = target; > + out[0].insn_texture.ReturnType = return_type; > out[0].insn_texture.NumOffsets = num_offsets; > } > > @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, >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, > @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, > nr_dst, > nr_src); > > - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); > + ureg_emit_texture( ureg, insn.extended_token, target, return_type, > + nr_offset ); > > for (i = 0; i < nr_offset; i++) >ureg_emit_texture_offset( ureg, [i]); > diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h > b/src/gallium/auxiliary/tgsi/tgsi_ureg.h > index 6d2f5c0e99..54f95ba565 100644 > --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h > +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h > @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, >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, > @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, > void > ureg_emit_texture(struct ureg_program *ureg, >unsigned insn_token, > - unsigned target, unsigned num_offsets); > + unsigned target, unsigned return_type, unsigned > num_offsets); > > void > ureg_emit_texture_offset(struct ureg_program *ureg, > @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg, > \ >struct ureg_src src1 )\ > { \ > unsigned opcode = TGSI_OPCODE_##op; \ > + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ > struct ureg_emit_insn_result insn; \ > if (ureg_dst_is_empty(dst)) \ >return; \ > @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg, > \ > dst.Saturate, \ > 1, \ > 2);\ > - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); > \ > + ureg_emit_texture( ureg, insn.extended_token, target,\ > + return_type, 0 ); \ > ureg_emit_dst( ureg, dst ); \ > ureg_emit_src( ureg, src0 ); \ > ureg_emit_src( ureg, src1 ); \ > @@ -796,6 +799,7 @@ static inline void ureg_##op( struct ureg_program *ureg, > \ >struct ureg_src src3 )
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On 05/17/2017 02:02 PM, Nicolai Hähnle wrote: On 17.05.2017 11:17, Samuel Pitoiset wrote: RadeonSI needs to do a special lowering for Gather4 with integer formats, but with bindless samplers we just can't access the index. Instead, store the return type in the instruction like the target. Signed-off-by: Samuel Pitoiset--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 9eb00d0919..1cdb95cc95 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned extended_token, - unsigned target, unsigned num_offsets) + unsigned target, unsigned return_type, unsigned num_offsets) { union tgsi_any_token *out, *insn; @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, out[0].value = 0; out[0].insn_texture.Texture = target; + out[0].insn_texture.ReturnType = return_type; out[0].insn_texture.NumOffsets = num_offsets; } @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); + ureg_emit_texture( ureg, insn.extended_token, target, return_type, + nr_offset ); for (i = 0; i < nr_offset; i++) ureg_emit_texture_offset( ureg, [i]); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6d2f5c0e99..54f95ba565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned insn_token, - unsigned target, unsigned num_offsets); + unsigned target, unsigned return_type, unsigned num_offsets); void ureg_emit_texture_offset(struct ureg_program *ureg, @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src1 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if (ureg_dst_is_empty(dst)) \ return; \ @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg,\ dst.Saturate, \ 1, \ 2);\ - ureg_emit_texture( ureg, insn.extended_token, target, 0 );\ + ureg_emit_texture( ureg, insn.extended_token, target,\ + return_type, 0 ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -796,6 +799,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src3 )\ { \ unsigned opcode = TGSI_OPCODE_##op;
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On 17.05.2017 11:17, Samuel Pitoiset wrote: RadeonSI needs to do a special lowering for Gather4 with integer formats, but with bindless samplers we just can't access the index. Instead, store the return type in the instruction like the target. Signed-off-by: Samuel Pitoiset--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 9eb00d0919..1cdb95cc95 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned extended_token, - unsigned target, unsigned num_offsets) + unsigned target, unsigned return_type, unsigned num_offsets) { union tgsi_any_token *out, *insn; @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, out[0].value = 0; out[0].insn_texture.Texture = target; + out[0].insn_texture.ReturnType = return_type; out[0].insn_texture.NumOffsets = num_offsets; } @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); + ureg_emit_texture( ureg, insn.extended_token, target, return_type, + nr_offset ); for (i = 0; i < nr_offset; i++) ureg_emit_texture_offset( ureg, [i]); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6d2f5c0e99..54f95ba565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned insn_token, - unsigned target, unsigned num_offsets); + unsigned target, unsigned return_type, unsigned num_offsets); void ureg_emit_texture_offset(struct ureg_program *ureg, @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if (ureg_dst_is_empty(dst)) \ return; \ @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg, \ dst.Saturate, \ 1, \ 2);\ - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \ + ureg_emit_texture( ureg, insn.extended_token, target,\ + return_type, 0 ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -796,6 +799,7 @@ static inline void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src3 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN;
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
On 05/17/2017 12:28 PM, Nils Wallménius wrote: Hi Samuel, A comment below. Den 17 maj 2017 11:18 fm skrev "Samuel Pitoiset">: RadeonSI needs to do a special lowering for Gather4 with integer formats, but with bindless samplers we just can't access the index. Instead, store the return type in the instruction like the target. Signed-off-by: Samuel Pitoiset > --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 9eb00d0919..1cdb95cc95 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned extended_token, - unsigned target, unsigned num_offsets) + unsigned target, unsigned return_type, unsigned num_offsets) { union tgsi_any_token *out, *insn; @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, out[0].value = 0; out[0].insn_texture.Texture = target; + out[0].insn_texture.ReturnType = return_type; out[0].insn_texture.NumOffsets = num_offsets; } @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); + ureg_emit_texture( ureg, insn.extended_token, target, return_type, + nr_offset ); for (i = 0; i < nr_offset; i++) ureg_emit_texture_offset( ureg, [i]); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6d2f5c0e99..54f95ba565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned insn_token, - unsigned target, unsigned num_offsets); + unsigned target, unsigned return_type, unsigned num_offsets); void ureg_emit_texture_offset(struct ureg_program *ureg, @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src1 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if (ureg_dst_is_empty(dst)) \ return; \ @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg,\ dst.Saturate, \ 1, \ 2); \ - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \ + ureg_emit_texture( ureg, insn.extended_token, target, \ +
Re: [Mesa-dev] [PATCH 2/3] tgsi: store the sampler view type directly in the instruction
Hi Samuel, A comment below. Den 17 maj 2017 11:18 fm skrev "Samuel Pitoiset": RadeonSI needs to do a special lowering for Gather4 with integer formats, but with bindless samplers we just can't access the index. Instead, store the return type in the instruction like the target. Signed-off-by: Samuel Pitoiset --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 7 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 11 --- src/gallium/include/pipe/p_shader_tokens.h | 2 ++ src/mesa/state_tracker/st_atifs_to_tgsi.c | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 17 ++--- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 + src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 7 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 9eb00d0919..1cdb95cc95 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1289,7 +1289,7 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned extended_token, - unsigned target, unsigned num_offsets) + unsigned target, unsigned return_type, unsigned num_offsets) { union tgsi_any_token *out, *insn; @@ -1300,6 +1300,7 @@ ureg_emit_texture(struct ureg_program *ureg, out[0].value = 0; out[0].insn_texture.Texture = target; + out[0].insn_texture.ReturnType = return_type; out[0].insn_texture.NumOffsets = num_offsets; } @@ -1386,6 +1387,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -1407,7 +1409,8 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn.extended_token, target, nr_offset ); + ureg_emit_texture( ureg, insn.extended_token, target, return_type, + nr_offset ); for (i = 0; i < nr_offset; i++) ureg_emit_texture_offset( ureg, [i]); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 6d2f5c0e99..54f95ba565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -555,6 +555,7 @@ ureg_tex_insn(struct ureg_program *ureg, 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, @@ -596,7 +597,7 @@ ureg_emit_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, unsigned insn_token, - unsigned target, unsigned num_offsets); + unsigned target, unsigned return_type, unsigned num_offsets); void ureg_emit_texture_offset(struct ureg_program *ureg, @@ -748,6 +749,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src1 )\ { \ unsigned opcode = TGSI_OPCODE_##op; \ + unsigned return_type = TGSI_RETURN_TYPE_UNKNOWN; \ struct ureg_emit_insn_result insn; \ if (ureg_dst_is_empty(dst)) \ return; \ @@ -756,7 +758,8 @@ static inline void ureg_##op( struct ureg_program *ureg,\ dst.Saturate, \ 1, \ 2);\ - ureg_emit_texture( ureg, insn.extended_token, target, 0 ); \ + ureg_emit_texture( ureg, insn.extended_token, target,\ + return_type, 0 ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -796,6 +799,7 @@ static inline void ureg_##op( struct ureg_program *ureg,\ struct ureg_src src3 )\ { \ unsigned opcode = TGSI_OPCODE_##op;