intel/fs: Use TEX_LOGICAL whenever implicit lod is supported
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 5 Apr 2019 23:07:16 +0000 (16:07 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 9 Apr 2019 02:29:33 +0000 (19:29 -0700)
Make sure we include compute shaders that have a derivative group
defined.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_fs_nir.cpp

index 747529e72d8159cb78576a379d44fa2e557e9328..e88cb3de9f253db02d416d95a70cc70c933c4760 100644 (file)
@@ -5135,11 +5135,15 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
    srcs[TEX_LOGICAL_SRC_COORD_COMPONENTS] = brw_imm_d(instr->coord_components);
    srcs[TEX_LOGICAL_SRC_GRAD_COMPONENTS] = brw_imm_d(lod_components);
 
+   bool shader_supports_implicit_lod = stage == MESA_SHADER_FRAGMENT ||
+      (stage == MESA_SHADER_COMPUTE &&
+       nir->info.cs.derivative_group != DERIVATIVE_GROUP_NONE);
+
    enum opcode opcode;
    switch (instr->op) {
    case nir_texop_tex:
-      opcode = (stage == MESA_SHADER_FRAGMENT ? SHADER_OPCODE_TEX_LOGICAL :
-                SHADER_OPCODE_TXL_LOGICAL);
+      opcode = shader_supports_implicit_lod ?
+         SHADER_OPCODE_TEX_LOGICAL : SHADER_OPCODE_TXL_LOGICAL;
       break;
    case nir_texop_txb:
       opcode = FS_OPCODE_TXB_LOGICAL;