gallium: add support for AMD_vertex_shader_layer
authorMarek Olšák <marek.olsak@amd.com>
Thu, 21 Nov 2013 14:25:55 +0000 (15:25 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 3 Dec 2013 18:39:13 +0000 (19:39 +0100)
16 files changed:
src/gallium/docs/source/screen.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/radeonsi_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_program.c

index 035309da816738724abd5692013c3239194e576e..ce96f6880d5961f203956d1d32d076acf7a75a1d 100644 (file)
@@ -176,6 +176,8 @@ The integer capabilities:
 * ``PIPE_CAP_MIXED_FRAMEBUFFER_SIZES``: Whether it is allowed to have
   different sizes for fb color/zs attachments. This controls whether
   ARB_framebuffer_object is provided.
+* ``PIPE_CAP_TGSI_VS_LAYER``: Whether TGSI_SEMANTIC_LAYER is supported
+  as a vertex shader output.
 
 
 .. _pipe_capf:
index 5dafa927aabc36694e63d96b4e1acb2d6a6eb8bb..4031f556a32dfbf3e033af1ecaa9f724f46d8b95 100644 (file)
@@ -197,6 +197,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_USER_INDEX_BUFFERS:
        case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
        case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
+        case PIPE_CAP_TGSI_VS_LAYER:
                return 0;
 
        /* Stream output. */
index 5e1e18def9161a00a11be8cf3a107d27508111ef..abb97966c66ca03afff85501e823a08653b33c9c 100644 (file)
@@ -222,6 +222,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
+   case PIPE_CAP_TGSI_VS_LAYER:
        return 0;
 
    case PIPE_CAP_GLSL_FEATURE_LEVEL:
index d6e3f94fb1883225e95ca7c264f1f3c49ab45e65..a76966f4a02bf545fa3ba895a2eee66393291e06 100644 (file)
@@ -431,6 +431,8 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return PIPE_ENDIAN_LITTLE;
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
       return true;
+   case PIPE_CAP_TGSI_VS_LAYER:
+      return 0;
 
    default:
       return 0;
index 81ebc69f4f5bbf97d70b61c5b52de52ee8cfab75..742e7f296cea94220e3be2230b824a72efc32f6b 100644 (file)
@@ -234,6 +234,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return PIPE_MAX_VIEWPORTS;
    case PIPE_CAP_ENDIANNESS:
       return PIPE_ENDIAN_NATIVE;
+   case PIPE_CAP_TGSI_VS_LAYER:
+      return 0;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 26ff6812e50c44d1e8df5c3398c86724455624b2..26103303fe6b527d8170ec2c9c98201dae23bf76 100644 (file)
@@ -126,6 +126,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
    case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
+   case PIPE_CAP_TGSI_VS_LAYER:
       return 0;
    case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
index f7dfc98b70bdbaa8f0a885cb4aa543c9a6a520f0..d8169f49476d25036e8531a6792b2716e7ba5f31 100644 (file)
@@ -194,6 +194,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
       return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
    case PIPE_CAP_ENDIANNESS:
       return PIPE_ENDIAN_LITTLE;
+   case PIPE_CAP_TGSI_VS_LAYER:
+      return 0;
    default:
       NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
       return 0;
index cc5814e1f3e649f5a3353858dcd52ce0f29d29c0..62ab2a276da2615a685af89068c54c16154db0cc 100644 (file)
@@ -172,6 +172,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
       return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
    case PIPE_CAP_ENDIANNESS:
       return PIPE_ENDIAN_LITTLE;
+   case PIPE_CAP_TGSI_VS_LAYER:
+      return 0;
    default:
       NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
       return 0;
index c21ee68348bb1260405eb79dfccbc24d13af474c..7eca5e11ac7b62fe2f1ec3f6bba06938fa93d0df 100644 (file)
@@ -164,6 +164,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
         case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
         case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+        case PIPE_CAP_TGSI_VS_LAYER:
             return 0;
 
         /* SWTCL-only features. */
index 5e1d26216acf025b38a9b6fb57a4d1de29012b72..f381e30b6289f7686ba4a6ac802509aeb2460737 100644 (file)
@@ -464,6 +464,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
        case PIPE_CAP_VERTEX_COLOR_CLAMPED:
        case PIPE_CAP_USER_VERTEX_BUFFERS:
+       case PIPE_CAP_TGSI_VS_LAYER:
                return 0;
 
        /* Stream output. */
index 1ff8c14369da5e2f25fb0fdbeb383d1714273a10..0242a035de6083d9ec1e3c7e09c2dfe1de4f156e 100644 (file)
@@ -330,6 +330,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
        case PIPE_CAP_TGSI_INSTANCEID:
        case PIPE_CAP_COMPUTE:
        case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
+        case PIPE_CAP_TGSI_VS_LAYER:
                return 1;
 
        case PIPE_CAP_TEXTURE_MULTISAMPLE:
index 0ec0aad6714dede37974fb9aff69154c8dc24ef4..0c8c94d0e19543eb4a881224bf490848b6fde373 100644 (file)
@@ -186,6 +186,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 1;
    case PIPE_CAP_ENDIANNESS:
       return PIPE_ENDIAN_NATIVE;
+   case PIPE_CAP_TGSI_VS_LAYER:
+      return 0;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 977dec53dfe611b7dd1586342edb955a134faa9a..6c2533800d612522822a572bb1fdace7e54750d8 100644 (file)
@@ -267,6 +267,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
    case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
    case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
+   case PIPE_CAP_TGSI_VS_LAYER:
       return 0;
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
       return 1;
index 7e71e7711827eef6e1e8290caba1fb1030e18c9b..06a9edd27143c57621a3db3e584c44cdffe126af 100644 (file)
@@ -513,7 +513,8 @@ enum pipe_cap {
    PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83,
    PIPE_CAP_MAX_VIEWPORTS = 84,
    PIPE_CAP_ENDIANNESS = 85,
-   PIPE_CAP_MIXED_FRAMEBUFFER_SIZES = 86
+   PIPE_CAP_MIXED_FRAMEBUFFER_SIZES = 86,
+   PIPE_CAP_TGSI_VS_LAYER = 87
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
index cd10a0c9deabddd4419562361625140110db96c0..f3798cffe181cf0b3439777fef4e859e0bbefdca 100644 (file)
@@ -605,6 +605,13 @@ void st_init_extensions(struct st_context *st)
       ctx->Const.ForceGLSLVersion = st->options.force_glsl_version;
    }
 
+   /* This extension needs full OpenGL 3.2, but we don't know if that's
+    * supported at this point. Only check the GLSL version. */
+   if (ctx->Const.GLSLVersion >= 150 &&
+       screen->get_param(screen, PIPE_CAP_TGSI_VS_LAYER)) {
+      ctx->Extensions.AMD_vertex_shader_layer = GL_TRUE;
+   }
+
    if (ctx->Const.GLSLVersion >= 130) {
       ctx->Const.NativeIntegers = GL_TRUE;
       ctx->Const.MaxClipPlanes = 8;
index f010e1889f87c12fbaa560073af92648d9b0e991..e7c357c9e428c7caf6271b5577f0fec2b62edb16 100644 (file)
@@ -258,6 +258,10 @@ st_prepare_vertex_program(struct gl_context *ctx,
             stvp->output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
             stvp->output_semantic_index[slot] = 0;
             break;
+         case VARYING_SLOT_LAYER:
+            stvp->output_semantic_name[slot] = TGSI_SEMANTIC_LAYER;
+            stvp->output_semantic_index[slot] = 0;
+            break;
 
          case VARYING_SLOT_TEX0:
          case VARYING_SLOT_TEX1: