[Mesa-dev] [PATCH 12/13] st/mesa: enable ARB_enhanced_layouts and turn the cap on

Jason Wood sandain at hotmail.com
Fri Oct 7 21:06:51 UTC 2016


Thanks for finishing this off Nicolai!

I have one quick question about this patch below.


On 10/07/2016 01:55 PM, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> ---
>  docs/features.txt                        | 16 ++++++++--------
>  docs/relnotes/12.1.0.html                |  2 +-
>  src/gallium/drivers/llvmpipe/lp_screen.c |  2 +-
>  src/gallium/drivers/radeonsi/si_pipe.c   |  2 +-
>  src/gallium/drivers/softpipe/sp_screen.c |  2 +-
>  src/mesa/state_tracker/st_extensions.c   |  7 +++++++
>  6 files changed, 19 insertions(+), 12 deletions(-)
> 
> diff --git a/docs/features.txt b/docs/features.txt
> index 85ad1a1..be75fd7 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -181,37 +181,37 @@ GL 4.3, GLSL 4.30 -- all DONE: i965/gen8+, nvc0, radeonsi
>    GL_ARB_shader_image_size                              DONE (i965, softpipe)
>    GL_ARB_shader_storage_buffer_object                   DONE (i965, softpipe)
>    GL_ARB_stencil_texturing                              DONE (i965/hsw+, nv50, r600, llvmpipe, softpipe, swr)
>    GL_ARB_texture_buffer_range                           DONE (nv50, i965, r600, llvmpipe)
>    GL_ARB_texture_query_levels                           DONE (all drivers that support GLSL 1.30)
>    GL_ARB_texture_storage_multisample                    DONE (all drivers that support GL_ARB_texture_multisample)
>    GL_ARB_texture_view                                   DONE (i965, nv50, r600, llvmpipe, softpipe, swr)
>    GL_ARB_vertex_attrib_binding                          DONE (all drivers)
>  
>  
> -GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+
> +GL 4.4, GLSL 4.40 -- all DONE: i965/gen8+, radeonsi
>  
>    GL_MAX_VERTEX_ATTRIB_STRIDE                           DONE (all drivers)
> -  GL_ARB_buffer_storage                                 DONE (i965, nv50, nvc0, r600, radeonsi)
> -  GL_ARB_clear_texture                                  DONE (i965, nv50, nvc0, r600, radeonsi)
> +  GL_ARB_buffer_storage                                 DONE (i965, nv50, nvc0, r600)
> +  GL_ARB_clear_texture                                  DONE (i965, nv50, nvc0, r600)
>    GL_ARB_enhanced_layouts                               DONE (i965)

Should this list llvmpipe and softpipe as well? It looks like you enable
it for both of them below, and you mention it is done in the relnotes.

>    - compile-time constant expressions                   DONE
>    - explicit byte offsets for blocks                    DONE
>    - forced alignment within blocks                      DONE
> -  - specified vec4-slot component numbers               DONE (i965)
> +  - specified vec4-slot component numbers               DONE (i965, llvmpipe, softpipe)
>    - specified transform/feedback layout                 DONE
>    - input/output block locations                        DONE
>    GL_ARB_multi_bind                                     DONE (all drivers)
> -  GL_ARB_query_buffer_object                            DONE (i965/hsw+, nvc0, radeonsi)
> -  GL_ARB_texture_mirror_clamp_to_edge                   DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe, swr)
> -  GL_ARB_texture_stencil8                               DONE (i965/hsw+, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe, swr)
> -  GL_ARB_vertex_type_10f_11f_11f_rev                    DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe, swr)
> +  GL_ARB_query_buffer_object                            DONE (i965/hsw+, nvc0)
> +  GL_ARB_texture_mirror_clamp_to_edge                   DONE (i965, nv50, nvc0, r600, llvmpipe, softpipe, swr)
> +  GL_ARB_texture_stencil8                               DONE (i965/hsw+, nv50, nvc0, r600, llvmpipe, softpipe, swr)
> +  GL_ARB_vertex_type_10f_11f_11f_rev                    DONE (i965, nv50, nvc0, r600, llvmpipe, softpipe, swr)
>  
>  GL 4.5, GLSL 4.50:
>  
>    GL_ARB_ES3_1_compatibility                            DONE (i965/hsw+, nvc0, radeonsi)
>    GL_ARB_clip_control                                   DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe, swr)
>    GL_ARB_conditional_render_inverted                    DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe, swr)
>    GL_ARB_cull_distance                                  DONE (i965, nv50, nvc0, radeonsi, llvmpipe, softpipe, swr)
>    GL_ARB_derivative_control                             DONE (i965, nv50, nvc0, r600, radeonsi)
>    GL_ARB_direct_state_access                            DONE (all drivers)
>    GL_ARB_get_texture_sub_image                          DONE (all drivers)
> diff --git a/docs/relnotes/12.1.0.html b/docs/relnotes/12.1.0.html
> index aff4dd3..2394bcc 100644
> --- a/docs/relnotes/12.1.0.html
> +++ b/docs/relnotes/12.1.0.html
> @@ -43,21 +43,21 @@ TBD.
>  Note: some of the new features are only available with certain drivers.
>  </p>
>  
>  <ul>
>  <li>OpenGL ES 3.1 on i965/hsw</li>
>  <li>OpenGL ES 3.2 on i965/gen9+ (Skylake and later)</li>
>  <li>GL_ARB_ES3_1_compatibility on i965</li>
>  <li>GL_ARB_ES3_2_compatibility on i965/gen8+</li>
>  <li>GL_ARB_clear_texture on r600, radeonsi</li>
>  <li>GL_ARB_cull_distance on radeonsi</li>
> -<li>GL_ARB_enhanced_layouts on i965</li>
> +<li>GL_ARB_enhanced_layouts on i965, radeonsi, llvmpipe, softpipe</li>
>  <li>GL_ARB_indirect_parameters on radeonsi</li>
>  <li>GL_ARB_query_buffer_object on radeonsi</li>
>  <li>GL_ARB_shader_draw_parameters on radeonsi</li>
>  <li>GL_ARB_shader_group_vote on nvc0</li>
>  <li>GL_ARB_shader_viewport_layer_array on i965/gen6+</li>
>  <li>GL_ARB_stencil_texturing on i965/hsw</li>
>  <li>GL_ARB_texture_stencil8 on i965/hsw</li>
>  <li>GL_EXT_window_rectangles on nv50, nvc0</li>
>  <li>GL_KHR_blend_equation_advanced on i965</li>
>  <li>GL_KHR_robustness on nvc0, radeonsi</li>
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 10b87fa..4daef1d 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -258,20 +258,21 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>        return 0;
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>        return 1;
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>        return 0;
>     case PIPE_CAP_SAMPLER_VIEW_TARGET:
>        return 1;
>     case PIPE_CAP_FAKE_SW_MSAA:
>        return 1;
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +   case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>        return 1;
>  
>     case PIPE_CAP_VENDOR_ID:
>        return 0xFFFFFFFF;
>     case PIPE_CAP_DEVICE_ID:
>        return 0xFFFFFFFF;
>     case PIPE_CAP_ACCELERATED:
>        return 0;
>     case PIPE_CAP_VIDEO_MEMORY: {
>        /* XXX: Do we want to return the full amount fo system memory ? */
> @@ -323,21 +324,20 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_BUS:
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
>     case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
>     case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
>     case PIPE_CAP_TGSI_VOTE:
>     case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
> -   case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>        return 0;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
>     return 0;
>  }
>  
>  static int
>  llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
>  {
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index dc0c72e..5a3f101 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -402,20 +402,21 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
>  	case PIPE_CAP_QUERY_MEMORY_INFO:
>  	case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
>  	case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
>  	case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
>  	case PIPE_CAP_GENERATE_MIPMAP:
>  	case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>  	case PIPE_CAP_STRING_MARKER:
>  	case PIPE_CAP_CLEAR_TEXTURE:
>  	case PIPE_CAP_CULL_DISTANCE:
> +	case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>  		return 1;
>  
>  	case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>  		return !SI_BIG_ENDIAN && sscreen->b.info.has_userptr;
>  
>  	case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>  		return (sscreen->b.info.drm_major == 2 &&
>  			sscreen->b.info.drm_minor >= 43) ||
>  		       sscreen->b.info.drm_major == 3;
>  
> @@ -451,21 +452,20 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	/* Unsupported features. */
>  	case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
>  	case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
>  	case PIPE_CAP_USER_VERTEX_BUFFERS:
>  	case PIPE_CAP_FAKE_SW_MSAA:
>  	case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>  	case PIPE_CAP_VERTEXID_NOBASE:
>  	case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
>  	case PIPE_CAP_TGSI_VOTE:
>  	case PIPE_CAP_MAX_WINDOW_RECTANGLES:
> -	case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>  		return 0;
>  
>  	case PIPE_CAP_QUERY_BUFFER_OBJECT:
>  		return si_have_tgsi_compute(sscreen);
>  
>  	case PIPE_CAP_DRAW_PARAMETERS:
>  	case PIPE_CAP_MULTI_DRAW_INDIRECT:
>  	case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
>  		return sscreen->has_draw_indirect_multi;
>  
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 8d933a9..8eb33f3 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -241,20 +241,21 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return 1;
>     case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
>     case PIPE_CAP_CULL_DISTANCE:
>        return 1;
>     case PIPE_CAP_VERTEXID_NOBASE:
>        return 0;
>     case PIPE_CAP_POLYGON_OFFSET_CLAMP:
>        return 0;
>     case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
> +   case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>        return 1;
>     case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>     case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>     case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>     case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
>     case PIPE_CAP_DEPTH_BOUNDS_TEST:
>     case PIPE_CAP_TGSI_TXQS:
>     case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
>     case PIPE_CAP_SHAREABLE_SHADERS:
>     case PIPE_CAP_CLEAR_TEXTURE:
> @@ -273,21 +274,20 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_PCI_GROUP:
>     case PIPE_CAP_PCI_BUS:
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
>     case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
>     case PIPE_CAP_TGSI_VOTE:
>     case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
> -   case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
>        return 0;
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>        return 4;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
>     return 0;
>  }
>  
>  static int
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 2282dc7..3718c79 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -885,20 +885,27 @@ void st_init_extensions(struct pipe_screen *screen,
>     if (consts->GLSLVersion >= 410)
>        extensions->ARB_shader_precision = GL_TRUE;
>  
>     /* 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 (consts->GLSLVersion >= 150 &&
>         screen->get_param(screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) {
>        extensions->AMD_vertex_shader_layer = GL_TRUE;
>     }
>  
> +   if (consts->GLSLVersion >= 140) {
> +      if (screen->get_param(screen, PIPE_CAP_TGSI_ARRAY_COMPONENTS) &&
> +         screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
> +                                   PIPE_SHADER_CAP_PREFERRED_IR) == PIPE_SHADER_IR_TGSI)
> +         extensions->ARB_enhanced_layouts = GL_TRUE;
> +   }
> +
>     if (consts->GLSLVersion >= 130) {
>        consts->NativeIntegers = GL_TRUE;
>        consts->MaxClipPlanes = 8;
>  
>        if (screen->get_param(screen, PIPE_CAP_VERTEXID_NOBASE)) {
>           consts->VertexID_is_zero_based = GL_TRUE;
>        }
>  
>        /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */
>        extensions->ARB_conservative_depth = GL_TRUE;
> 


More information about the mesa-dev mailing list