gallium: add support for LODQ opcodes.
authorDave Airlie <airlied@redhat.com>
Tue, 11 Feb 2014 03:26:08 +0000 (13:26 +1000)
committerIlia Mirkin <imirkin@alum.mit.edu>
Mon, 7 Apr 2014 05:06:18 +0000 (01:06 -0400)
This opcode provide support for GL_ARB_texture_query_lod,

Signed-off-by: Dave Airlie <airlied@redhat.com>
[imirkin: rebase, docs update]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
17 files changed:
src/gallium/auxiliary/tgsi/tgsi_info.c
src/gallium/docs/source/screen.rst
src/gallium/docs/source/tgsi.rst
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nouveau/nv30/nv30_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_shader_tokens.h

index 565f274a545e8ac1cd54a439dcf72def67c160a3..5bcc3c918d34d2650a80ab4efe51779fc0e2af23 100644 (file)
@@ -222,6 +222,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 2, 0, 0, 0, 0, COMP, "IMUL_HI", TGSI_OPCODE_IMUL_HI },
    { 1, 2, 0, 0, 0, 0, COMP, "UMUL_HI", TGSI_OPCODE_UMUL_HI },
    { 1, 3, 1, 0, 0, 0, OTHR, "TG4", TGSI_OPCODE_TG4 },
+   { 1, 2, 1, 0, 0, 0, OTHR, "LODQ", TGSI_OPCODE_LODQ },
 };
 
 const struct tgsi_opcode_info *
index 09f809db9c86686907836cab0b17d3bb85c06f2c..943d880782612bb53263b1b1648519307774c747 100644 (file)
@@ -191,6 +191,8 @@ The integer capabilities:
 * ``PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT``: Whether
   PIPE_TRANSFER_PERSISTENT and PIPE_TRANSFER_COHERENT are supported
   for buffers.
+* ``PIPE_CAP_TEXTURE_QUERY_LOD``: Whether the ``LODQ`` instruction is
+  supported.
 
 
 .. _pipe_capf:
index 5a64e16cefa5ea19dfd38e8635eb5c17cdf2bff3..d5325f4a935bbdf7ec4121512d76f8c658cb3fe7 100644 (file)
@@ -1012,6 +1012,18 @@ XXX doesn't look like most of the opcodes really belong here.
 
    dst = texture\_gather (uint, coord, compare)
 
+.. opcode:: LODQ - level of detail query
+
+   Compute the LOD information that the texture pipe would use to access the
+   texture. The Y component contains the computed LOD lambda_prime. The X
+   component contains the LOD that will be accessed, based on min/max lod's
+   and mipmap filters.
+
+.. math::
+
+   coord = src0
+
+   dst.xy = lodq(uint, coord);
 
 Integer ISA
 ^^^^^^^^^^^^^^^^^^^^^^^^
index 4f0675fc84a510adf7e76fa2d4e576f9ab1d396a..96c769ed41ce1369f12aa4cb0c7f8a9713461c6f 100644 (file)
@@ -207,6 +207,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_TEXTURE_GATHER_SM5:
         case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
         case PIPE_CAP_FAKE_SW_MSAA:
+       case PIPE_CAP_TEXTURE_QUERY_LOD:
                return 0;
 
        /* Stream output. */
index 0f8ba30b992cfa30f010840bcee0c92e03cab836..892c3ead37b67dbfec4898d624463e50a3a119a2 100644 (file)
@@ -219,6 +219,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_FAKE_SW_MSAA:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
 
    case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
index 131c9f22caa3d9b763b6a40ba6da2944e6cf5d58..7f2e01fffeb1c602e78f9cc35717555ffcb5d567 100644 (file)
@@ -437,6 +437,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_FAKE_SW_MSAA:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
 
    default:
index 766e433b96870e386edbffe68a8b236619e9735c..6eb7d64b233379433eea324279f2b696c0544b18 100644 (file)
@@ -238,6 +238,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
    case PIPE_CAP_FAKE_SW_MSAA:
        return 1;
index 2439218f341c2b5f4c7ec34366ad1c6ec65773e1..ce1397d413b0dc430a4e0d5aada87b37aa9da7cb 100644 (file)
@@ -132,6 +132,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_FAKE_SW_MSAA:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
index fd5d488bf247967d7a081e82c3af35cc9c76df75..d706508c52e9e211ee55318b5f6155c2eb4b4783 100644 (file)
@@ -196,6 +196,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_FAKE_SW_MSAA:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
    case PIPE_CAP_MAX_VIEWPORTS:
       return NV50_MAX_VIEWPORTS;
index a9f11bc5ada289d32e9ea5bbfb82f1043cb64c2f..794ed3b5a70886cc53095f1a92cf8f8eaa938484 100644 (file)
@@ -178,6 +178,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_FAKE_SW_MSAA:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
    case PIPE_CAP_MAX_VIEWPORTS:
       return 1;
index 0977d3920a3a17e71648005d6b761a46cb332f5d..8ed636a6717f677851069a78410258cb860ed532 100644 (file)
@@ -169,6 +169,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TGSI_VS_LAYER:
         case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
         case PIPE_CAP_TEXTURE_GATHER_SM5:
+        case PIPE_CAP_TEXTURE_QUERY_LOD:
             return 0;
 
         /* SWTCL-only features. */
index 2ba459157548de56930932423ca4ab2d49add79f..8d69358d8023e38bac08057b11422fd5641bf6e5 100644 (file)
@@ -377,6 +377,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_USER_VERTEX_BUFFERS:
        case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
        case PIPE_CAP_TEXTURE_GATHER_SM5:
+       case PIPE_CAP_TEXTURE_QUERY_LOD:
                return 0;
 
        /* Stream output. */
index 7c741b7e2ad6f75af08a360fe6b348f962124afd..09ec60343fec19870a1b58312d143e8e595fcea7 100644 (file)
@@ -291,6 +291,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TEXTURE_GATHER_SM5:
        case PIPE_CAP_TGSI_TEXCOORD:
        case PIPE_CAP_FAKE_SW_MSAA:
+       case PIPE_CAP_TEXTURE_QUERY_LOD:
                return 0;
 
        case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
index c3bb74c4960c310c2182eb6e7a892f49ca21b931..ce04fb81976836c79b8fb278cd98b7fb55294131 100644 (file)
@@ -188,6 +188,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS:
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
    case PIPE_CAP_FAKE_SW_MSAA:
       return 1;
index 5c5b47302ff4e3e3c375b881256a2a01b8958f2f..785b03636e2ec2ebfabb1365b76a7e217f1f0414 100644 (file)
@@ -270,6 +270,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_GATHER_SM5:
    case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
    case PIPE_CAP_FAKE_SW_MSAA:
+   case PIPE_CAP_TEXTURE_QUERY_LOD:
       return 0;
    case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
       return 64;
index 8c092c2e619c5c521a6bc70ecea636c603b8c369..30a65ee5136a1afccfd3b9eaa8029bd7ae293f03 100644 (file)
@@ -552,7 +552,8 @@ enum pipe_cap {
    PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS = 90,
    PIPE_CAP_TEXTURE_GATHER_SM5 = 91,
    PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT = 92,
-   PIPE_CAP_FAKE_SW_MSAA = 93
+   PIPE_CAP_FAKE_SW_MSAA = 93,
+   PIPE_CAP_TEXTURE_QUERY_LOD = 94,
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
index 8fa6a0afaeb22fd96951698c0b7689dc8943d804..a2e649ec439538e8703fdde8fab199c13c23091e 100644 (file)
@@ -455,7 +455,9 @@ struct tgsi_property_data {
 
 #define TGSI_OPCODE_TG4                 182
 
-#define TGSI_OPCODE_LAST                183
+#define TGSI_OPCODE_LODQ                183
+
+#define TGSI_OPCODE_LAST                184
 
 #define TGSI_SAT_NONE            0  /* do not saturate */
 #define TGSI_SAT_ZERO_ONE        1  /* clamp to [0,1] */