Re: [Mesa-dev] [PATCH 4/8] gallium: add PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY

2018-05-24 Thread Nicolai Hähnle

Reviewed-by: Nicolai Hähnle 

On 23.05.2018 22:58, Marek Olšák wrote:

From: Marek Olšák 

---
  src/gallium/docs/source/screen.rst   | 6 ++
  src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 +
  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
  src/gallium/drivers/i915/i915_screen.c   | 1 +
  src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 2 ++
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
  src/gallium/drivers/r300/r300_screen.c   | 1 +
  src/gallium/drivers/r600/r600_pipe.c | 3 +++
  src/gallium/drivers/radeonsi/si_get.c| 3 +++
  src/gallium/drivers/softpipe/sp_screen.c | 2 ++
  src/gallium/drivers/svga/svga_screen.c   | 3 +++
  src/gallium/drivers/swr/swr_screen.cpp   | 2 ++
  src/gallium/drivers/v3d/v3d_screen.c | 3 +++
  src/gallium/drivers/vc4/vc4_screen.c | 1 +
  src/gallium/drivers/virgl/virgl_screen.c | 2 ++
  src/gallium/include/pipe/p_defines.h | 1 +
  18 files changed, 37 insertions(+)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 5bc6ee99f08..0f18b7a94b9 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -86,20 +86,26 @@ The integer capabilities:
  * ``PIPE_CAP_VERTEX_COLOR_CLAMPED``: Whether the driver is capable of
clamping vertex colors when they come out of a vertex shader, as specified
by the pipe_rasterizer_state::clamp_vertex_color flag.  If unsupported,
the vertex colors are never clamped. This is the default for DX10 hardware.
If both clamped and unclamped CAPs are supported, the clamping can be
controlled through pipe_rasterizer_state.  If the driver cannot do vertex
color clamping, the state tracker may insert clamping code into the vertex
shader.
  * ``PIPE_CAP_GLSL_FEATURE_LEVEL``: Whether the driver supports features
equivalent to a specific GLSL version. E.g. for GLSL 1.3, report 130.
+* ``PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY``: Whether the driver supports
+  features equivalent to a specific GLSL version including all legacy OpenGL
+  features only present in the OpenGL compatibility profile.
+  The only legacy features that Gallium drivers must implement are
+  the legacy shader inputs and outputs (colors, texcoords, fog, clipvertex,
+  edgeflag).
  * ``PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION``: Whether quads adhere 
to
the flatshade_first setting in ``pipe_rasterizer_state``.
  * ``PIPE_CAP_USER_VERTEX_BUFFERS``: Whether the driver supports user vertex
buffers.  If not, the state tracker must upload all data which is not in hw
resources.  If user-space buffers are supported, the driver must also still
accept HW resource buffers.
  * ``PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY``: This CAP describes a 
hw
limitation.  If true, pipe_vertex_buffer::buffer_offset must always be 
aligned
to 4.  If false, there are no restrictions on the offset.
  * ``PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY``: This CAP describes a 
hw
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index cada83609a8..244726ea014 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -147,20 +147,21 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
return 1;
 case PIPE_CAP_NATIVE_FENCE_FD:
return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;
  
 /* Memory */

 case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
return 256;
 case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
return 4; /* XXX could easily be supported */
 case PIPE_CAP_GLSL_FEATURE_LEVEL:
+   case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
return 120;
  
 case PIPE_CAP_NPOT_TEXTURES:

return true; /* VIV_FEATURE(priv->dev, chipMinorFeatures1,
NON_POWER_OF_TWO); */
  
 case PIPE_CAP_TEXTURE_SWIZZLE:

 case PIPE_CAP_PRIMITIVE_RESTART:
return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
  
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c

index c59995c75d1..f97c46b0fa2 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -254,20 +254,21 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
 * current firmware) do draw_indirect with base_instance.
 * Since draw_indirect is needed sooner (gles31 and gl40 vs
 * gl42), hide base_instance on a5xx.  :-/
 */
return is_a4xx(screen);
  
  	case 

[Mesa-dev] [PATCH 4/8] gallium: add PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY

2018-05-23 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/docs/source/screen.rst   | 6 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 +
 src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
 src/gallium/drivers/i915/i915_screen.c   | 1 +
 src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 2 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
 src/gallium/drivers/r300/r300_screen.c   | 1 +
 src/gallium/drivers/r600/r600_pipe.c | 3 +++
 src/gallium/drivers/radeonsi/si_get.c| 3 +++
 src/gallium/drivers/softpipe/sp_screen.c | 2 ++
 src/gallium/drivers/svga/svga_screen.c   | 3 +++
 src/gallium/drivers/swr/swr_screen.cpp   | 2 ++
 src/gallium/drivers/v3d/v3d_screen.c | 3 +++
 src/gallium/drivers/vc4/vc4_screen.c | 1 +
 src/gallium/drivers/virgl/virgl_screen.c | 2 ++
 src/gallium/include/pipe/p_defines.h | 1 +
 18 files changed, 37 insertions(+)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 5bc6ee99f08..0f18b7a94b9 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -86,20 +86,26 @@ The integer capabilities:
 * ``PIPE_CAP_VERTEX_COLOR_CLAMPED``: Whether the driver is capable of
   clamping vertex colors when they come out of a vertex shader, as specified
   by the pipe_rasterizer_state::clamp_vertex_color flag.  If unsupported,
   the vertex colors are never clamped. This is the default for DX10 hardware.
   If both clamped and unclamped CAPs are supported, the clamping can be
   controlled through pipe_rasterizer_state.  If the driver cannot do vertex
   color clamping, the state tracker may insert clamping code into the vertex
   shader.
 * ``PIPE_CAP_GLSL_FEATURE_LEVEL``: Whether the driver supports features
   equivalent to a specific GLSL version. E.g. for GLSL 1.3, report 130.
+* ``PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY``: Whether the driver supports
+  features equivalent to a specific GLSL version including all legacy OpenGL
+  features only present in the OpenGL compatibility profile.
+  The only legacy features that Gallium drivers must implement are
+  the legacy shader inputs and outputs (colors, texcoords, fog, clipvertex,
+  edgeflag).
 * ``PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION``: Whether quads adhere 
to
   the flatshade_first setting in ``pipe_rasterizer_state``.
 * ``PIPE_CAP_USER_VERTEX_BUFFERS``: Whether the driver supports user vertex
   buffers.  If not, the state tracker must upload all data which is not in hw
   resources.  If user-space buffers are supported, the driver must also still
   accept HW resource buffers.
 * ``PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY``: This CAP describes a hw
   limitation.  If true, pipe_vertex_buffer::buffer_offset must always be 
aligned
   to 4.  If false, there are no restrictions on the offset.
 * ``PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY``: This CAP describes a hw
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c 
b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index cada83609a8..244726ea014 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -147,20 +147,21 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
   return 1;
case PIPE_CAP_NATIVE_FENCE_FD:
   return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;
 
/* Memory */
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
   return 256;
case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
   return 4; /* XXX could easily be supported */
case PIPE_CAP_GLSL_FEATURE_LEVEL:
+   case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
   return 120;
 
case PIPE_CAP_NPOT_TEXTURES:
   return true; /* VIV_FEATURE(priv->dev, chipMinorFeatures1,
   NON_POWER_OF_TWO); */
 
case PIPE_CAP_TEXTURE_SWIZZLE:
case PIPE_CAP_PRIMITIVE_RESTART:
   return VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
 
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index c59995c75d1..f97c46b0fa2 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -254,20 +254,21 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
 * current firmware) do draw_indirect with base_instance.
 * Since draw_indirect is needed sooner (gles31 and gl40 vs
 * gl42), hide base_instance on a5xx.  :-/
 */
return is_a4xx(screen);
 
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
return 64;
 
case PIPE_CAP_GLSL_FEATURE_LEVEL:
+   case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY: