[Mesa-dev] [PATCH 06/10] st/mesa: use RESQ to find buffer size

Marek Olšák maraeo at gmail.com
Mon Jan 18 04:36:01 PST 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, Jan 18, 2016 at 6:51 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 0aaa175..602e689 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -569,6 +569,7 @@ static bool
>  is_resource_instruction(unsigned opcode)
>  {
>     switch (opcode) {
> +   case TGSI_OPCODE_RESQ:
>     case TGSI_OPCODE_LOAD:
>     case TGSI_OPCODE_ATOMUADD:
>     case TGSI_OPCODE_ATOMXCHG:
> @@ -2222,6 +2223,22 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>        emit_asm(ir, TGSI_OPCODE_UP2H, result_dst, op[0]);
>        break;
>
> +   case ir_unop_get_buffer_size: {
> +      ir_constant *const_offset = ir->operands[0]->as_constant();
> +      st_src_reg buffer(
> +            PROGRAM_BUFFER,
> +            ctx->Const.Program[shader->Stage].MaxAtomicBuffers +
> +            (const_offset ? const_offset->value.u[0] : 0),
> +            GLSL_TYPE_UINT);
> +      if (!const_offset) {
> +         buffer.reladdr = ralloc(mem_ctx, st_src_reg);
> +         memcpy(buffer.reladdr, &sampler_reladdr, sizeof(sampler_reladdr));
> +         emit_arl(ir, sampler_reladdr, op[0]);
> +      }
> +      emit_asm(ir, TGSI_OPCODE_RESQ, result_dst)->buffer = buffer;
> +      break;
> +   }
> +
>     case ir_unop_pack_snorm_2x16:
>     case ir_unop_pack_unorm_2x16:
>     case ir_unop_pack_snorm_4x8:
> @@ -2245,10 +2262,6 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>         */
>        assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()");
>        break;
> -
> -   case ir_unop_get_buffer_size:
> -      assert(!"Not implemented yet");
> -      break;
>     }
>
>     this->result = result_src;
> @@ -5133,6 +5146,7 @@ compile_tgsi_instruction(struct st_translate *t,
>                      src, num_src);
>        return;
>
> +   case TGSI_OPCODE_RESQ:
>     case TGSI_OPCODE_LOAD:
>     case TGSI_OPCODE_ATOMUADD:
>     case TGSI_OPCODE_ATOMXCHG:
> --
> 2.4.10
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list