Mesa (master): i965: Make brw_vs_outputs_written static.

2018-05-01 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 9f6082f6c71b7233d0e7d36368eea84e9c0704cb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f6082f6c71b7233d0e7d36368eea84e9c0704cb

Author: Kenneth Graunke 
Date:   Tue May  1 23:02:16 2018 -0700

i965: Make brw_vs_outputs_written static.

Drop a prototype.  Trivial.

---

 src/mesa/drivers/dri/i965/brw_vs.c | 2 +-
 src/mesa/drivers/dri/i965/brw_vs.h | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 22c7493e23..5154dee3ca 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -69,7 +69,7 @@ brw_select_clip_planes(struct gl_context *ctx)
}
 }
 
-GLbitfield64
+static GLbitfield64
 brw_vs_outputs_written(struct brw_context *brw, struct brw_vs_prog_key *key,
GLbitfield64 user_varyings)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h 
b/src/mesa/drivers/dri/i965/brw_vs.h
index 6e052d7335..9d01aacb6a 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -39,10 +39,6 @@
 extern "C" {
 #endif
 
-GLbitfield64
-brw_vs_outputs_written(struct brw_context *brw, struct brw_vs_prog_key *key,
-   GLbitfield64 outputs_written);
-
 void
 brw_upload_vs_prog(struct brw_context *brw);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Drop unused gen5 sampler default color struct.

2018-05-01 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 1122fb2d986b7962189aae925844f45cf9df03b4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1122fb2d986b7962189aae925844f45cf9df03b4

Author: Kenneth Graunke 
Date:   Tue May  1 23:03:00 2018 -0700

i965: Drop unused gen5 sampler default color struct.

Trivial.

---

 src/mesa/drivers/dri/i965/brw_structs.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_structs.h 
b/src/mesa/drivers/dri/i965/brw_structs.h
index fb592be695..c2d99be750 100644
--- a/src/mesa/drivers/dri/i965/brw_structs.h
+++ b/src/mesa/drivers/dri/i965/brw_structs.h
@@ -65,13 +65,4 @@ struct brw_urb_fence
} bits1;
 };
 
-struct gen5_sampler_default_color {
-   uint8_t ub[4];
-   float f[4];
-   uint16_t hf[4];
-   uint16_t us[4];
-   int16_t s[4];
-   uint8_t b[4];
-};
-
 #endif

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965/tex_image: Avoid the ASTC LDR workaround on gen9lp

2018-05-01 Thread Nanley Chery
Module: Mesa
Branch: master
Commit: 3e56e4642fb5875b3f5c4eb34798ba9f3d827705
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3e56e4642fb5875b3f5c4eb34798ba9f3d827705

Author: Nanley Chery 
Date:   Sat Feb 24 01:26:20 2018 -0800

i965/tex_image: Avoid the ASTC LDR workaround on gen9lp

Both the internal documentation and the results of testing this in the
CI suggest that this is unnecessary. Add the fixes tag because this
reduces an internal benchmark's startup time by about 17 seconds
(reported by Eero).

Fixes: 710b1d2e665 "i965/tex_image: Flush certain subnormal ASTC channel values"
Tested-by: Eero Tamminen 
Acked-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/intel_tex_image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c 
b/src/mesa/drivers/dri/i965/intel_tex_image.c
index 3fd227ad05..856216ecf9 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -927,7 +927,7 @@ intelCompressedTexSubImage(struct gl_context *ctx, GLuint 
dims,
 !_mesa_is_srgb_format(gl_format);
struct brw_context *brw = (struct brw_context*) ctx;
const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   if (devinfo->gen == 9 && is_linear_astc)
+   if (devinfo->gen == 9 && !gen_device_info_is_9lp(devinfo) && is_linear_astc)
   flush_astc_denorms(ctx, dims, texImage,
  xoffset, yoffset, zoffset,
  width, height, depth);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): freedreno: Fix ir3_cmdline.c build.

2018-05-01 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 800be7f2777350f97b43d77b0e6bfc1df2b756a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=800be7f2777350f97b43d77b0e6bfc1df2b756a1

Author: Eric Anholt 
Date:   Tue May  1 13:07:21 2018 -0700

freedreno: Fix ir3_cmdline.c build.

Fixes: 6487e7a30c9e ("nir: move GL specific passes to src/compiler/glsl")
Reviewed-by: Timothy Arceri 
Reviewed-by: Rob Clark 

---

 src/gallium/drivers/freedreno/ir3/ir3_cmdline.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c 
b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index 5631216ebd..55809d527a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -46,6 +46,7 @@
 
 #include "compiler/glsl/standalone.h"
 #include "compiler/glsl/glsl_to_nir.h"
+#include "compiler/glsl/gl_nir.h"
 #include "compiler/nir_types.h"
 #include "compiler/spirv/nir_spirv.h"
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): anv: Don't advertise Float64 or Int64 on HW without 64-bit types

2018-05-01 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: d5a0787f034d6165d3990561a08e933848993032
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5a0787f034d6165d3990561a08e933848993032

Author: Jason Ekstrand 
Date:   Mon Apr 30 15:15:37 2018 -0700

anv: Don't advertise Float64 or Int64 on HW without 64-bit types

Reviewed-by: Anuj Phogat 

---

 src/intel/vulkan/anv_device.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 1c5dbb5189..11ab5e0c1d 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -755,8 +755,10 @@ void anv_GetPhysicalDeviceFeatures(
   .shaderStorageImageArrayDynamicIndexing   = true,
   .shaderClipDistance   = true,
   .shaderCullDistance   = true,
-  .shaderFloat64= pdevice->info.gen >= 8,
-  .shaderInt64  = pdevice->info.gen >= 8,
+  .shaderFloat64= pdevice->info.gen >= 8 &&
+  
pdevice->info.has_64bit_types,
+  .shaderInt64  = pdevice->info.gen >= 8 &&
+  
pdevice->info.has_64bit_types,
   .shaderInt16  = false,
   .shaderResourceMinLod = false,
   .variableMultisampleRate  = false,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): anv: Allow lookup of vkEnumerateInstanceVersion without an instance

2018-05-01 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: d216ffc604573e514904a05691a47dfe5971e8ca
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d216ffc604573e514904a05691a47dfe5971e8ca

Author: Jason Ekstrand 
Date:   Tue May  1 09:59:24 2018 -0700

anv: Allow lookup of vkEnumerateInstanceVersion without an instance

Fixes: cbab2d1da5edfe9df27a010adf8b1aa9dbee473b
Reviewed-by: Bas Nieuwenhuizen 

---

 src/intel/vulkan/anv_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 11ab5e0c1d..856035b8b9 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1179,6 +1179,7 @@ PFN_vkVoidFunction anv_GetInstanceProcAddr(
 
LOOKUP_ANV_ENTRYPOINT(EnumerateInstanceExtensionProperties);
LOOKUP_ANV_ENTRYPOINT(EnumerateInstanceLayerProperties);
+   LOOKUP_ANV_ENTRYPOINT(EnumerateInstanceVersion);
LOOKUP_ANV_ENTRYPOINT(CreateInstance);
 
 #undef LOOKUP_ANV_ENTRYPOINT

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): radv: compute the number of subpass attachments correctly

2018-05-01 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: d8db5986cee83078e46895d695d698db87507019
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8db5986cee83078e46895d695d698db87507019

Author: Samuel Pitoiset 
Date:   Fri Apr 27 10:53:13 2018 +0200

radv: compute the number of subpass attachments correctly

Only count color attachments twice if resolves are used, also
account for the depth stencil attachment if present.

Cc: 18.0 18.1 
Reviewed-by: Bas Nieuwenhuizen 
Signed-off-by: Samuel Pitoiset 

---

 src/amd/vulkan/radv_pass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c
index d059af54f9..a7d54d7d61 100644
--- a/src/amd/vulkan/radv_pass.c
+++ b/src/amd/vulkan/radv_pass.c
@@ -87,8 +87,8 @@ VkResult radv_CreateRenderPass(
subpass_attachment_count +=
desc->inputAttachmentCount +
desc->colorAttachmentCount +
-   /* Count colorAttachmentCount again for 
resolve_attachments */
-   desc->colorAttachmentCount;
+   (desc->pResolveAttachments ? desc->colorAttachmentCount 
: 0) +
+   (desc->pDepthStencilAttachment != NULL);
}
 
if (subpass_attachment_count) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): radv: set fmask_surf_index on fmask surfaces.

2018-05-01 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: e66f64c2855604c6148e8e865a65411ff0c3ba02
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e66f64c2855604c6148e8e865a65411ff0c3ba02

Author: Dave Airlie 
Date:   Tue May  1 12:32:02 2018 +1000

radv: set fmask_surf_index on fmask surfaces.

This is needed for gfx9 and later for all fmask surface index.

(Mentioned by Marek on irc)

Reviewed-by: Bas Nieuwenhuizen 
Reviewed-by: Samuel Pitoiset 

---

 src/amd/vulkan/radv_image.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index a6f3628c8f..bfe497caa3 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -742,8 +742,10 @@ radv_image_get_fmask_info(struct radv_device *device,
info.samples = 1;
fmask.flags = image->surface.flags | RADEON_SURF_FMASK;
 
-   if (!image->shareable)
+   if (!image->shareable) {
+   info.fmask_surf_index = &device->fmask_mrt_offset_counter;
info.surf_index = &device->fmask_mrt_offset_counter;
+   }
 
/* Force 2D tiling if it wasn't set. This may occur when creating
 * FMASK for MSAA resolve on R6xx. On R6xx, the single-sample

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium/i915: fix PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE typo

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: f298ed93d9ded6ef355cf6381b49a845c76084b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f298ed93d9ded6ef355cf6381b49a845c76084b0

Author: Brian Paul 
Date:   Tue May  1 09:51:45 2018 -0600

gallium/i915: fix PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE typo

Fixes: fffe5e2d14f807c ("gallium: add initial support for conservative
rasterization")
Trivial.

---

 src/gallium/drivers/i915/i915_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 9d99238f2b..1b8c0ad9a2 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -441,7 +441,7 @@ i915_get_paramf(struct pipe_screen *screen, enum pipe_capf 
cap)
case PIPE_CAPF_MAX_TEXTURE_LOD_BIAS:
   return 16.0;
 
-   case PIPE_CAPF_MIN_CONSERVTIVE_RASTER_DILATE:
+   case PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE:
   /* fall-through */
case PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE:
   /* fall-through */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium: add initial support for conservative rasterization

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: fffe5e2d14f807cd6b778d91e1aaea3a73434547
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fffe5e2d14f807cd6b778d91e1aaea3a73434547

Author: Rhys Perry 
Date:   Sat Apr  7 16:15:00 2018 -0600

gallium: add initial support for conservative rasterization

Signed-off-by: Rhys Perry 
Reviewed-by: Brian Paul 
Reviewed-by: Marek Olšák 

---

 src/gallium/docs/source/cso/rasterizer.rst   | 23 +++
 src/gallium/docs/source/screen.rst   | 18 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c | 10 ++
 src/gallium/drivers/freedreno/freedreno_screen.c | 10 ++
 src/gallium/drivers/i915/i915_screen.c   | 13 +
 src/gallium/drivers/llvmpipe/lp_screen.c | 12 
 src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 10 ++
 src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 10 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 10 ++
 src/gallium/drivers/r300/r300_screen.c   | 10 ++
 src/gallium/drivers/r600/r600_pipe.c |  6 ++
 src/gallium/drivers/r600/r600_pipe_common.c  |  4 
 src/gallium/drivers/radeonsi/si_get.c| 10 ++
 src/gallium/drivers/softpipe/sp_screen.c | 12 
 src/gallium/drivers/svga/svga_screen.c   | 13 +
 src/gallium/drivers/swr/swr_screen.cpp   | 10 ++
 src/gallium/drivers/vc4/vc4_screen.c | 13 -
 src/gallium/drivers/vc5/vc5_screen.c | 13 -
 src/gallium/drivers/virgl/virgl_screen.c | 10 ++
 src/gallium/include/pipe/p_defines.h | 20 
 src/gallium/include/pipe/p_state.h   |  8 
 21 files changed, 243 insertions(+), 2 deletions(-)

diff --git a/src/gallium/docs/source/cso/rasterizer.rst 
b/src/gallium/docs/source/cso/rasterizer.rst
index 616e4511a2..4dabcc032f 100644
--- a/src/gallium/docs/source/cso/rasterizer.rst
+++ b/src/gallium/docs/source/cso/rasterizer.rst
@@ -340,3 +340,26 @@ clip_plane_enable
 If any clip distance output is written, those half-spaces for which no
 clip distance is written count as disabled; i.e. user clip planes and
 shader clip distances cannot be mixed, and clip distances take precedence.
+
+conservative_raster_mode
+The conservative rasterization mode.  For PIPE_CONSERVATIVE_RASTER_OFF,
+conservative rasterization is disabled.  For 
IPE_CONSERVATIVE_RASTER_POST_SNAP
+or PIPE_CONSERVATIVE_RASTER_PRE_SNAP, conservative rasterization is nabled.
+When conservative rasterization is enabled, the polygon smooth, line mooth,
+point smooth and line stipple settings are ignored.
+With the post-snap mode, unlike the pre-snap mode, fragments are never
+generated for degenerate primitives.  Degenerate primitives, when 
rasterized,
+are considered back-facing and the vertex attributes and depth are that of
+the provoking vertex.
+If the post-snap mode is used with an unsupported primitive, the pre-snap
+mode is used, if supported.  Behavior is similar for the pre-snap mode.
+If the pre-snap mode is used, fragments are generated with respect to the 
primitive
+before vertex snapping.
+
+conservative_raster_dilate
+The amount of dilation during conservative rasterization.
+
+subpixel_precision_x
+A bias added to the horizontal subpixel precision during conservative 
rasterization.
+subpixel_precision_y
+A bias added to the vertical subpixel precision during conservative 
rasterization.
diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 3837360fb4..5bc6ee99f0 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -420,6 +420,18 @@ The integer capabilities:
   by the driver, and the driver can throw assertion failures.
 * ``PIPE_CAP_PACKED_UNIFORMS``: True if the driver supports packed uniforms
   as opposed to padding to vec4s.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES``: Whether the
+  PIPE_CONSERVATIVE_RASTER_POST_SNAP mode is supported for triangles.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES``: Whether the
+PIPE_CONSERVATIVE_RASTER_POST_SNAP mode is supported for points and lines.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES``: Whether the
+PIPE_CONSERVATIVE_RASTER_PRE_SNAP mode is supported for triangles.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES``: Whether the
+PIPE_CONSERVATIVE_RASTER_PRE_SNAP mode is supported for points and lines.
+* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE``: Whether 
PIPE_CAP_POST_DEPTH_COVERAGE
+works with conservative rasterization.
+* ``PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS``: The maximum
+subpixel precision bias in bits during conservative rasterization.
 
 
 .. _pipe_capf:
@@ -437,6 +449,12 @@ The floating-point capabilities are:
   applied t

Mesa (master): mesa: add support for nvidia conservative rasterization extensions

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4580617509d1ba48a7806227533a07e1c495ca81
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4580617509d1ba48a7806227533a07e1c495ca81

Author: Rhys Perry 
Date:   Fri Apr 27 11:35:00 2018 -0600

mesa: add support for nvidia conservative rasterization extensions

Although the specs are written against compatibility GL 4.3 and allows core
profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.

Signed-off-by: Rhys Perry 
Reviewed-by: Brian Paul 

---

 src/mapi/glapi/gen/gl_API.xml   |  47 
 src/mapi/glapi/gen/gl_genexec.py|   1 +
 src/mesa/Makefile.sources   |   2 +
 src/mesa/main/attrib.c  |  60 ---
 src/mesa/main/conservativeraster.c  | 128 
 src/mesa/main/conservativeraster.h  |  48 
 src/mesa/main/context.c |  10 +++
 src/mesa/main/dlist.c   |  86 +
 src/mesa/main/enable.c  |  14 
 src/mesa/main/extensions_table.h|   4 +
 src/mesa/main/get.c |   3 +
 src/mesa/main/get_hash_params.py|  13 
 src/mesa/main/mtypes.h  |  28 ++-
 src/mesa/main/tests/dispatch_sanity.cpp |  27 +++
 src/mesa/main/viewport.c|  58 +++
 src/mesa/main/viewport.h|   6 ++
 src/mesa/meson.build|   2 +
 17 files changed, 526 insertions(+), 11 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 38c1921047..db312370b1 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -12871,6 +12871,53 @@
   
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 http://www.w3.org/2001/XInclude"/>
 
 
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index aaff9f230b..be8013b62b 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -62,6 +62,7 @@ header = """/**
 #include "main/colortab.h"
 #include "main/compute.h"
 #include "main/condrender.h"
+#include "main/conservativeraster.h"
 #include "main/context.h"
 #include "main/convolve.h"
 #include "main/copyimage.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index f910b41d0a..00aba0a2f7 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -47,6 +47,8 @@ MAIN_FILES = \
main/condrender.c \
main/condrender.h \
main/config.h \
+   main/conservativeraster.c \
+   main/conservativeraster.h \
main/context.c \
main/context.h \
main/convolve.c \
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 9f0e7161f3..6127a556d7 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -137,6 +137,9 @@ struct gl_enable_attrib
 
/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
GLboolean sRGBEnabled;
+
+   /* GL_NV_conservative_raster */
+   GLboolean ConservativeRasterization;
 };
 
 
@@ -177,6 +180,13 @@ struct texture_state
 };
 
 
+struct viewport_state
+{
+   struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS];
+   GLuint SubpixelPrecisionBias[2];
+};
+
+
 /** An unused GL_*_BIT value */
 #define DUMMY_BIT 0x1000
 
@@ -393,6 +403,9 @@ _mesa_PushAttrib(GLbitfield mask)
 
   /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
   attr->sRGBEnabled = ctx->Color.sRGBEnabled;
+
+  /* GL_NV_conservative_raster */
+  attr->ConservativeRasterization = ctx->ConservativeRasterization;
}
 
if (mask & GL_EVAL_BIT) {
@@ -544,11 +557,23 @@ _mesa_PushAttrib(GLbitfield mask)
}
 
if (mask & GL_VIEWPORT_BIT) {
-  if (!push_attrib(ctx, &head, GL_VIEWPORT_BIT,
-   sizeof(struct gl_viewport_attrib)
-   * ctx->Const.MaxViewports,
-   (void*)&ctx->ViewportArray))
+  struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state);
+  if (!viewstate) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)");
+ goto end;
+  }
+
+  if (!save_attrib_data(&head, GL_VIEWPORT_BIT, viewstate)) {
+ free(viewstate);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)");
  goto end;
+  }
+
+  memcpy(&viewstate->ViewportArray, &ctx->ViewportArray,
+ sizeof(struct gl_viewport_attrib)*ctx->Const.MaxViewports);
+
+  viewstate->SubpixelPrecisionBias[0] = ctx->SubpixelPrecisionBias[0];
+  viewstate->SubpixelPrecisionBias[1] = ctx->SubpixelPrecisionBias[1];
}
 
/* GL_ARB_multisample */
@@ -713,6 +738,13 @@ pop_enable_group(struct gl_context *ctx, co

Mesa (master): nvc0: add conservative rasterization support

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 07dac3e04056f7e90661eeb39aea66ba0b82538d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=07dac3e04056f7e90661eeb39aea66ba0b82538d

Author: Rhys Perry 
Date:   Sat Apr  7 16:15:00 2018 -0600

nvc0: add conservative rasterization support

Subpixel precision bias, dilation and the post-snap mode are supported on
GM200 and newer. The pre-snap mode is supported for triangle primitives on
GP100.

Signed-off-by: Rhys Perry 
Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/nouveau/nvc0/mme/com9097.mme   | 30 ++
 src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h | 21 +++
 src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h |  5 
 src/gallium/drivers/nouveau/nvc0/nvc0_macros.h |  4 ++-
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 19 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c  | 14 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h   |  2 +-
 7 files changed, 87 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme 
b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
index 7c5ec8f52b..ecf9960667 100644
--- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
+++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme
@@ -550,3 +550,33 @@ qbw_postclamp:
 qbw_done:
exit send (extrinsrt 0x0 $r4 0x0 0x10 0x10)
maddrsend 0x44
+
+/* NVC0_3D_MACRO_CONSERVATIVE_RASTER_STATE:
+ *
+ * This sets basically all the conservative rasterization state. It sets
+ * CONSERVATIVE_RASTER to one while doing so.
+ *
+ * arg = biasx | biasy<<4 | (dilation*4)<<8 | mode<<10
+ */
+.section #mme9097_conservative_raster_state
+   /* Mode and dilation */
+   maddr 0x1d00 /* SCRATCH[0] */
+   send 0x0 /* unknown */
+   send (extrinsrt 0x0 $r1 8 3 23) /* value */
+   mov $r2 0x7
+   send (extrinsrt 0x0 $r2 0 3 23) /* write mask */
+   maddr 0x18c4 /* FIRMWARE[4] */
+   mov $r2 0x831
+   send (extrinsrt 0x0 $r2 0 12 11) /* sends 0x418800 */
+   /* Subpixel precision */
+   mov $r2 (extrinsrt 0x0 $r1 0 3 0)
+   mov $r2 (extrinsrt $r2 $r1 4 4 8)
+   maddr 0x8287 /* SUBPIXEL_PRECISION[0] (incrementing by 8 methods) */
+   mov $r3 16 /* loop counter */
+crs_loop:
+   mov $r3 (add $r3 -1)
+   branz $r3 #crs_loop
+   send $r2
+   /* Enable */
+   exit maddr 0x1452 /* CONSERVATIVE_RASTER */
+   send 0x1
diff --git a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h 
b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
index 9618da6e28..3eacda9a27 100644
--- a/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
+++ b/src/gallium/drivers/nouveau/nvc0/mme/com9097.mme.h
@@ -373,3 +373,24 @@ uint32_t mme9097_query_buffer_write[] = {
0x840100c2,
0x00110071,
 };
+
+uint32_t mme9097_conservative_raster_state[] = {
+   0x07400021,
+   0x0041,
+   0xb8d04042,
+/* 0x000c: crs_loop */
+   0x0001c211,
+   0xb8c08042,
+   0x06310021,
+   0x020c4211,
+   0x5b008042,
+   0x00c04212,
+   0x41085212,
+   0x20a1c021,
+   0x00040311,
+   0xdb11,
+   0xd817,
+   0x1041,
+   0x051480a1,
+   0x4041,
+};
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
index d7245fbcae..c5456e48b5 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
@@ -447,6 +447,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define NVC0_3D_VIEWPORT_TRANSLATE_Z__ESIZE0x0020
 #define NVC0_3D_VIEWPORT_TRANSLATE_Z__LEN  0x0010
 
+#define NVC0_3D_SUBPIXEL_PRECISION(i0)(0x0a1c + 
0x20*(i0))
+#define NVC0_3D_SUBPIXEL_PRECISION__ESIZE  0x0020
+#define NVC0_3D_SUBPIXEL_PRECISION__LEN
0x0010
+
 #define NVC0_3D_VIEWPORT_HORIZ(i0)(0x0c00 + 
0x10*(i0))
 #define NVC0_3D_VIEWPORT_HORIZ__ESIZE  0x0010
 #define NVC0_3D_VIEWPORT_HORIZ__LEN0x0010
@@ -780,6 +784,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define NVC0_3D_UNK11400x1140
 
 #define NVC0_3D_UNK11440x1144
+#define NVC0_3D_CONSERVATIVE_RASTER0x1148
 
 #define NVC0_3D_VTX_ATTR_DEFINE0x114c
 #define NVC0_3D_VTX_ATTR_DEFINE_ATTR__MASK 0x00ff
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h
index eeacc714f3..7aa0633795 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_macros.h
@@ -35,6 +35,8 @@
 
 #define NVC0_3D_MACRO_QUERY_BUFFER_WRITE   0x3858
 
-#define NVC0_CP_MACRO_LAUNCH_GRID_INDIRECT   0x3

Mesa (master): glsl/tests: add GLSL_TYPE_UINT8, GLSL_TYPE_INT8 cases to switch statements

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 31ab0427a767c6c8377c00203e87bf0a03ac3247
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=31ab0427a767c6c8377c00203e87bf0a03ac3247

Author: Brian Paul 
Date:   Thu Apr 26 11:55:46 2018 -0600

glsl/tests: add GLSL_TYPE_UINT8, GLSL_TYPE_INT8 cases to switch statements

To silence warnings about unhandled switch values.
Untested otherwise.

v2: move the INT/UINT8 cases after the INT/UINT16 cases, per Eric.

Reviewed-by: Eric Anholt 

---

 src/compiler/glsl/tests/uniform_initializer_utils.cpp | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/glsl/tests/uniform_initializer_utils.cpp 
b/src/compiler/glsl/tests/uniform_initializer_utils.cpp
index 0d7fa26752..8c00c69b29 100644
--- a/src/compiler/glsl/tests/uniform_initializer_utils.cpp
+++ b/src/compiler/glsl/tests/uniform_initializer_utils.cpp
@@ -113,6 +113,8 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
   case GLSL_TYPE_FLOAT16:
   case GLSL_TYPE_UINT16:
   case GLSL_TYPE_INT16:
+  case GLSL_TYPE_UINT8:
+  case GLSL_TYPE_INT8:
 ASSERT_TRUE(false);
 break;
   }
@@ -156,6 +158,8 @@ generate_data_element(void *mem_ctx, const glsl_type *type,
   case GLSL_TYPE_FLOAT16:
   case GLSL_TYPE_UINT16:
   case GLSL_TYPE_INT16:
+  case GLSL_TYPE_UINT8:
+  case GLSL_TYPE_INT8:
 ASSERT_TRUE(false);
 break;
   }
@@ -287,6 +291,8 @@ verify_data(gl_constant_value *storage, unsigned 
storage_array_size,
  case GLSL_TYPE_FLOAT16:
  case GLSL_TYPE_UINT16:
  case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
ASSERT_TRUE(false);
break;
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): tgsi: use enums instead of unsigned in ureg code

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: efec712d515a329dbd20fd867de9601c4d4a0915
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=efec712d515a329dbd20fd867de9601c4d4a0915

Author: Brian Paul 
Date:   Thu Apr 26 11:55:16 2018 -0600

tgsi: use enums instead of unsigned in ureg code

Reviewed-by: Charmaine Lee 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c | 14 +++---
 src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 393e015001..7d2b9af140 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -170,7 +170,7 @@ struct ureg_program
struct {
   unsigned index;
   enum tgsi_texture_type target;
-  unsigned format;
+  enum pipe_format format;
   boolean wr;
   boolean raw;
} image[PIPE_MAX_SHADER_IMAGES];
@@ -773,7 +773,7 @@ struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw)
 {
@@ -1363,8 +1363,8 @@ void
 ureg_emit_memory(struct ureg_program *ureg,
  unsigned extended_token,
  unsigned qualifier,
- unsigned texture,
- unsigned format)
+ enum tgsi_texture_type texture,
+ enum pipe_format format)
 {
union tgsi_any_token *out, *insn;
 
@@ -1478,8 +1478,8 @@ ureg_memory_insn(struct ureg_program *ureg,
  const struct ureg_src *src,
  unsigned nr_src,
  unsigned qualifier,
- unsigned texture,
- unsigned format)
+ enum tgsi_texture_type texture,
+ enum pipe_format format)
 {
struct ureg_emit_insn_result insn;
unsigned i;
@@ -1719,7 +1719,7 @@ static void
 emit_decl_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw)
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 7eef94a65e..ac46da5508 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -372,7 +372,7 @@ struct ureg_src
 ureg_DECL_image(struct ureg_program *ureg,
 unsigned index,
 enum tgsi_texture_type target,
-unsigned format,
+enum pipe_format format,
 boolean wr,
 boolean raw);
 
@@ -579,8 +579,8 @@ ureg_memory_insn(struct ureg_program *ureg,
  const struct ureg_src *src,
  unsigned nr_src,
  unsigned qualifier,
- unsigned texture,
- unsigned format);
+ enum tgsi_texture_type texture,
+ enum pipe_format format);
 
 /***
  * Internal instruction helpers, don't call these directly:
@@ -619,8 +619,8 @@ void
 ureg_emit_memory(struct ureg_program *ureg,
  unsigned insn_token,
  unsigned qualifier,
- unsigned texture,
- unsigned format);
+ enum tgsi_texture_type texture,
+ enum pipe_format format);
 
 void 
 ureg_emit_dst( struct ureg_program *ureg,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/mesa: add support for nvidia conservative rasterization extensions

2018-05-01 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 97f5f399ef79d72dc7bb6e7fe7b35c10b9000855
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=97f5f399ef79d72dc7bb6e7fe7b35c10b9000855

Author: Rhys Perry 
Date:   Fri Apr 27 08:43:00 2018 -0600

st/mesa: add support for nvidia conservative rasterization extensions

Signed-off-by: Rhys Perry 
Reviewed-by: Brian Paul 

---

 src/mesa/state_tracker/st_atom_rasterizer.c | 15 +
 src/mesa/state_tracker/st_context.c |  2 ++
 src/mesa/state_tracker/st_extensions.c  | 34 +
 3 files changed, 51 insertions(+)

diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c 
b/src/mesa/state_tracker/st_atom_rasterizer.c
index 1be072e6e3..0383b8ac4a 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -298,5 +298,20 @@ st_update_rasterizer(struct st_context *st)
raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
 
+/* ST_NEW_RASTERIZER */
+   if (ctx->ConservativeRasterization) {
+  if (ctx->ConservativeRasterMode == 
GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV)
+ raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_POST_SNAP;
+  else
+ raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_PRE_SNAP;
+   } else {
+  raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_OFF;
+   }
+
+   raster->conservative_raster_dilate = ctx->ConservativeRasterDilate;
+
+   raster->subpixel_precision_x = ctx->SubpixelPrecisionBias[0];
+   raster->subpixel_precision_y = ctx->SubpixelPrecisionBias[1];
+
cso_set_rasterizer(st->cso_context, raster);
 }
diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index b0266bef8b..ee76e07a7d 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -344,6 +344,8 @@ st_init_driver_flags(struct st_context *st)
f->NewPolygonState = ST_NEW_RASTERIZER;
f->NewPolygonStipple = ST_NEW_POLY_STIPPLE;
f->NewViewport = ST_NEW_VIEWPORT;
+   f->NewNvConservativeRasterization = ST_NEW_RASTERIZER;
+   f->NewNvConservativeRasterizationParams = ST_NEW_RASTERIZER;
 }
 
 
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 0dc8adb262..5479e637af 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -494,6 +494,16 @@ void st_init_limits(struct pipe_screen *screen,
c->UseSTD430AsDefaultPacking =
   screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF);
 
+   c->MaxSubpixelPrecisionBiasBits =
+  screen->get_param(screen, 
PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS);
+
+   c->ConservativeRasterDilateRange[0] =
+  screen->get_paramf(screen, PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE);
+   c->ConservativeRasterDilateRange[1] =
+  screen->get_paramf(screen, PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE);
+   c->ConservativeRasterDilateGranularity =
+  screen->get_paramf(screen, 
PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY);
+
/* limit the max combined shader output resources to a driver limit */
temp = screen->get_param(screen, 
PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES);
if (temp > 0 && c->MaxCombinedShaderOutputResources > temp)
@@ -1364,4 +1374,28 @@ void st_init_extensions(struct pipe_screen *screen,
   extensions->ARB_texture_cube_map_array &&
   extensions->ARB_texture_stencil8 &&
   extensions->ARB_texture_multisample;
+
+   if (screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES) &&
+   screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES) &&
+   screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE)) {
+  float max_dilate;
+  bool pre_snap_triangles, pre_snap_points_lines;
+
+  max_dilate = screen->get_paramf(screen, 
PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE);
+
+  pre_snap_triangles =
+ screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES);
+  pre_snap_points_lines =
+ screen->get_param(screen, 
PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES);
+
+  extensions->NV_conservative_raster =
+ screen->get_param(screen, 
PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS) > 1;
+
+  if (extensions->NV_conservative_raster) {
+ extensions->NV_conservative_raster_dilate = max_dilate >= 0.75;
+ extensions->NV_conservative_raster_pre_snap_triangles = 
pre_snap_triangles;
+ extensions->NV_conservative_raster_pre_snap =
+pre_snap_triangles && pre_snap_points_lines;
+  }
+   }
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit