From 40ccbae622d8f09e9513b8837d24f55d877709c6 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Sat, 11 Apr 2020 18:28:41 -0400 Subject: [PATCH] freedreno/computerator: support bindless sampler instructions Signed-off-by: Jonathan Marek Part-of: --- src/freedreno/computerator/ir3_lexer.l | 1 + src/freedreno/computerator/ir3_parser.y | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/freedreno/computerator/ir3_lexer.l b/src/freedreno/computerator/ir3_lexer.l index 44ccd47904c..aca2d62b4db 100644 --- a/src/freedreno/computerator/ir3_lexer.l +++ b/src/freedreno/computerator/ir3_lexer.l @@ -291,6 +291,7 @@ static int parse_reg(const char *str) "p" return 'p'; "s2en" return TOKEN(T_S2EN); "s" return 's'; +"base"[0-9]+ ir3_yylval.num = strtol(yytext+4, NULL, 10); return T_BASE; "=" return '='; "(" return '('; diff --git a/src/freedreno/computerator/ir3_parser.y b/src/freedreno/computerator/ir3_parser.y index 1dfa2c0f687..e4b02cca9ed 100644 --- a/src/freedreno/computerator/ir3_parser.y +++ b/src/freedreno/computerator/ir3_parser.y @@ -458,6 +458,7 @@ static void print_token(FILE *file, int type, YYSTYPE value) %token T_S2EN %token T_SAMP %token T_TEX +%token T_BASE %token T_NAN %token T_INF @@ -719,11 +720,12 @@ cat5_flag: '.' T_3D { instr->flags |= IR3_INSTR_3D; } | '.' 'p' { instr->flags |= IR3_INSTR_P; } | '.' 's' { instr->flags |= IR3_INSTR_S; } | '.' T_S2EN { instr->flags |= IR3_INSTR_S2EN; } +| '.' T_BASE { instr->flags |= IR3_INSTR_B; instr->cat5.tex_base = $2; } cat5_flags: | cat5_flag cat5_flags cat5_samp: T_SAMP { instr->cat5.samp = $1; } -cat5_tex: T_TEX { instr->cat5.tex = $1; } +cat5_tex: T_TEX { if (instr->flags & IR3_INSTR_B) instr->cat5.samp |= ($1 << 4); else instr->cat5.tex = $1; } cat5_type: '(' type ')' { instr->cat5.type = $2; } cat5_instr: cat5_opc_dsxypp cat5_flags dst_reg ',' src_reg -- 2.30.2