[Mesa-dev] [PATCH V2 5/5] i965/fs: Add support for shadow comparitors with gather4

Kenneth Graunke kenneth at whitecape.org
Sat Oct 26 09:53:12 CEST 2013


On 10/14/2013 01:30 AM, Chris Forbes wrote:
> Note that gather4_po_c's parameters are too long for SIMD16. It might be
> worth emitting 2xSIMD8 messages in this case at some point.
> 
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 15 ++++++++++++---
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |  3 +++
>  2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> index d1a9370..8c0e361 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
> @@ -433,12 +433,21 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
>           msg_type = GEN5_SAMPLER_MESSAGE_LOD;
>           break;
>        case SHADER_OPCODE_TG4:
> -         assert(brw->gen >= 6);
> -         msg_type = GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4;
> +         if (inst->shadow_compare) {
> +            assert(brw->gen >= 7);
> +            msg_type = GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_C;
> +         } else {
> +            assert(brw->gen >= 6);
> +            msg_type = GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4;
> +         }
>           break;
>        case SHADER_OPCODE_TG4_OFFSET:
>           assert(brw->gen >= 7);
> -         msg_type = GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO;
> +         if (inst->shadow_compare) {
> +            msg_type = GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO_C;
> +         } else {
> +            msg_type = GEN7_SAMPLER_MESSAGE_SAMPLE_GATHER4_PO;
> +         }
>           break;
>        default:
>  	 assert(!"not reached");
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index fe4741d..242634c 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -1351,6 +1351,9 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
>        break;
>     case ir_tg4:
>        if (has_nonconstant_offset) {
> +         if (ir->shadow_comparitor && dispatch_width == 16)
> +            fail("Gen7 does not support gather4_po_c in SIMD16 mode.");
> +

I don't think you actually need this hunk.  AFAICT, it's not explicitly
forbidden, it's just that the maximum message length is too big.  Which
is already caught by

   if (inst->mlen > 11) {
      fail("Message length >11 disallowed by hardware\n");
   }

at the end of the function.


More information about the mesa-dev mailing list