nir: add nir_texop_texture_samples and convert from glsl
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 28 Aug 2015 03:05:03 +0000 (23:05 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 10 Sep 2015 21:38:33 +0000 (17:38 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/glsl_to_nir.cpp
src/glsl/nir/nir.h
src/glsl/nir/nir_print.c

index ad7d7dddeaf7814708d9eb1d80eed395aa0ec8ec..bf78b4253d92b42c4668dc11e461dd75dfcf5975 100644 (file)
@@ -1718,6 +1718,11 @@ nir_visitor::visit(ir_texture *ir)
       num_srcs = 0;
       break;
 
+   case ir_texture_samples:
+      op = nir_texop_texture_samples;
+      num_srcs = 0;
+      break;
+
    default:
       unreachable("not reached");
    }
index 2ba7731c1ff8489618816ad54e3255886b1eb951..a93ff11f01b2a0ba8b305f47ca029a797f85e77e 100644 (file)
@@ -944,7 +944,8 @@ typedef enum {
    nir_texop_txs,                /**< Texture size */
    nir_texop_lod,                /**< Texture lod query */
    nir_texop_tg4,                /**< Texture gather */
-   nir_texop_query_levels       /**< Texture levels query */
+   nir_texop_query_levels,       /**< Texture levels query */
+   nir_texop_texture_samples,    /**< Texture samples query */
 } nir_texop;
 
 typedef struct {
@@ -1016,6 +1017,7 @@ nir_tex_instr_dest_size(nir_tex_instr *instr)
    case nir_texop_lod:
       return 2;
 
+   case nir_texop_texture_samples:
    case nir_texop_query_levels:
       return 1;
 
index f591c4b5f8d234118e51cd0ce05b965a59aa3420..69cadbae2b6428d82abb3d7bef6174350df0e065 100644 (file)
@@ -417,6 +417,9 @@ print_tex_instr(nir_tex_instr *instr, print_var_state *state, FILE *fp)
    case nir_texop_query_levels:
       fprintf(fp, "query_levels ");
       break;
+   case nir_texop_texture_samples:
+      fprintf(fp, "texture_samples ");
+      break;
 
    default:
       unreachable("Invalid texture operation");