mesa.git
9 years agoanv/pass: Move VkRenderPass code to new file
Chad Versace [Thu, 29 Oct 2015 18:08:23 +0000 (11:08 -0700)]
anv/pass: Move VkRenderPass code to new file

Move it from anv_device.c to new file anv_pass.c. Because it will soon
grow bigger.

9 years agoanv: Fix parsing of load ops in VkAttachmentDescription
Chad Versace [Thu, 29 Oct 2015 17:59:55 +0000 (10:59 -0700)]
anv: Fix parsing of load ops in VkAttachmentDescription

My original understanding of VkAttachmentDescription::loadOp,
stencilLoadOp was incorrect. Below are all possible combinations:

  VkFormat       | loadOp=clear   stencilLoadOp=clear
  ---------------+---------------------------
  color          | clear-color    ignored
  depth-only     | clear-depth    ignored
  stencil-only   | ignored        clear-stencil
  depth-stencil  | clear-depth    clear-stencil

9 years agoanv: Update the README
Jason Ekstrand [Wed, 28 Oct 2015 19:30:32 +0000 (12:30 -0700)]
anv: Update the README

Adds a note that we support SPIR-V revision 32.  Also, we now support
geometry shaders.

9 years agoRevert "nir/intrinsic: Allow up to four indices"
Jason Ekstrand [Tue, 27 Oct 2015 20:44:14 +0000 (13:44 -0700)]
Revert "nir/intrinsic: Allow up to four indices"

This reverts commit 5eccd0b4b947d806c0725899a827e622e605f2cc.

This was only needed for the store_ssbo_vk_indirect intrinsic

9 years agoRevert "nir/intrinsics: Add new Vulkan load/store intrinsics"
Jason Ekstrand [Tue, 27 Oct 2015 20:43:25 +0000 (13:43 -0700)]
Revert "nir/intrinsics: Add new Vulkan load/store intrinsics"

This reverts commit 24bcc89c8fa326b838e9fea002065a40d4d04314.

Now that we have the new vulkan_resource_index intrinsic, these variants of
the classic UBO/SSBO instrinsics aren't needed.

9 years agoanv/nir: Work with the new vulkan_resource_index intrinsic
Jason Ekstrand [Tue, 27 Oct 2015 20:42:51 +0000 (13:42 -0700)]
anv/nir: Work with the new vulkan_resource_index intrinsic

9 years agonir/spirv: Use the new vulkan_resource_index intrinsic
Jason Ekstrand [Tue, 27 Oct 2015 20:41:54 +0000 (13:41 -0700)]
nir/spirv: Use the new vulkan_resource_index intrinsic

This is instead of using the _vk versions of UBO/SSBO load/store intrinsics

9 years agonir: Add a vulkan_resource_index intrinsic
Jason Ekstrand [Tue, 27 Oct 2015 18:45:15 +0000 (11:45 -0700)]
nir: Add a vulkan_resource_index intrinsic

9 years agoAdd a todo comment about intput_slots_valid in the FS shader key
Jason Ekstrand [Sat, 24 Oct 2015 04:30:38 +0000 (21:30 -0700)]
Add a todo comment about intput_slots_valid in the FS shader key

9 years agoanv/gen8_pipeline: Emit a real 3DSTATE_SBE_SWIZ packet
Jason Ekstrand [Sat, 24 Oct 2015 04:30:21 +0000 (21:30 -0700)]
anv/gen8_pipeline: Emit a real 3DSTATE_SBE_SWIZ packet

9 years agoanv/pipeline: Bump the size of the pipeline batch to accomodate GS
Jason Ekstrand [Fri, 23 Oct 2015 23:50:28 +0000 (16:50 -0700)]
anv/pipeline: Bump the size of the pipeline batch to accomodate GS

The 1k batch size wasn't big enough for a full pipeline setup including
geometry shaders.  Some day we should make it dynamic.

9 years agoanv/gen8_pipeline: Various 3DSTATE_GS fixes
Jason Ekstrand [Fri, 23 Oct 2015 23:49:26 +0000 (16:49 -0700)]
anv/gen8_pipeline: Various 3DSTATE_GS fixes

9 years agoanv/pipeline: Use separate-shader
Jason Ekstrand [Fri, 23 Oct 2015 17:53:00 +0000 (10:53 -0700)]
anv/pipeline: Use separate-shader

9 years agoanv/pipeline: Pull separate_shader from NIR for vue map setup
Jason Ekstrand [Fri, 23 Oct 2015 17:48:52 +0000 (10:48 -0700)]
anv/pipeline: Pull separate_shader from NIR for vue map setup

9 years agonir/spirv: Add support for builtins in arrays
Jason Ekstrand [Fri, 23 Oct 2015 00:58:20 +0000 (17:58 -0700)]
nir/spirv: Add support for builtins in arrays

9 years agonir/spirv: Make the builtins array distinguish between in and out
Jason Ekstrand [Fri, 23 Oct 2015 00:54:24 +0000 (17:54 -0700)]
nir/spirv: Make the builtins array distinguish between in and out

9 years agonir/spirv: Make vtn_get_builtin_location smarter
Jason Ekstrand [Fri, 23 Oct 2015 00:45:41 +0000 (17:45 -0700)]
nir/spirv: Make vtn_get_builtin_location smarter

Instead of just stomping on the mode, it now validates asserts that the
previously set mode is correct and only changes it if needed.  We need to
do this because, in geometry shaders, there are some builtins that can be
either an input or an output depending on context.  We can get that
information from the SPIR-V source but we can't throw it away.

9 years agonir/spirv: Make get_builtin_variable take a nir_variable_mode
Jason Ekstrand [Fri, 23 Oct 2015 00:28:25 +0000 (17:28 -0700)]
nir/spirv: Make get_builtin_variable take a nir_variable_mode

We'll want this in a moment for validation but, for now, it just gets
stompped by get_builtin_variable.

9 years agonir/spirv: Remove the vtn_type argument from _vtn_variable_load/store
Jason Ekstrand [Thu, 22 Oct 2015 23:56:38 +0000 (16:56 -0700)]
nir/spirv: Remove the vtn_type argument from _vtn_variable_load/store

Now that builtins are handled in deref chains, we don't really need this
anymore.

9 years agonir/validate: Add better validation of load/store types
Jason Ekstrand [Thu, 22 Oct 2015 23:53:01 +0000 (16:53 -0700)]
nir/validate: Add better validation of load/store types

9 years agoanv/gen8: Set the correct maximum number of GS threads
Jason Ekstrand [Thu, 22 Oct 2015 04:51:16 +0000 (21:51 -0700)]
anv/gen8: Set the correct maximum number of GS threads

This equation was pulled from mesa gen8_gs_state.c

9 years agoanv/pipeline: set the gs_vertex_count in compile_gs
Jason Ekstrand [Thu, 22 Oct 2015 04:50:45 +0000 (21:50 -0700)]
anv/pipeline: set the gs_vertex_count in compile_gs

This was missed in the initial enabling commit.

9 years agoanv/pipeline: Make the has_push_constants computation more accurate
Jason Ekstrand [Thu, 22 Oct 2015 04:45:49 +0000 (21:45 -0700)]
anv/pipeline: Make the has_push_constants computation more accurate

The computation used to only look for uniforms that weren't samplers.  Now
it also filters out arrays of samplers.

9 years agonir/spirv: Add defaults for GS input/output primitive types
Jason Ekstrand [Thu, 22 Oct 2015 04:45:12 +0000 (21:45 -0700)]
nir/spirv: Add defaults for GS input/output primitive types

These are supposed to be specified in the SPIR-V source as SpvExecutionMode
enums but glslang isn't giving them to us.  A bug has been filed:

https://github.com/KhronosGroup/glslang/issues/84

9 years agoi965/vec4: Handle returns at the end of functions
Jason Ekstrand [Thu, 22 Oct 2015 03:42:23 +0000 (20:42 -0700)]
i965/vec4: Handle returns at the end of functions

9 years agoi965: Move get_hw_prim_for_gl_prim to brw_util.c
Jason Ekstrand [Thu, 22 Oct 2015 03:40:28 +0000 (20:40 -0700)]
i965: Move get_hw_prim_for_gl_prim to brw_util.c

9 years agonir/spirv: Add capabilities and decorations for basic geometry shaders
Jason Ekstrand [Thu, 22 Oct 2015 03:36:25 +0000 (20:36 -0700)]
nir/spirv: Add capabilities and decorations for basic geometry shaders

9 years agoanv/pipeline: Add back basic geometry shader support
Jason Ekstrand [Thu, 22 Oct 2015 01:45:48 +0000 (18:45 -0700)]
anv/pipeline: Add back basic geometry shader support

Now that we've done the refactoring upstream, it's much easier to to get
hooked up.  We haven't tested things well enough to know that we're setting
up the GPU state correctly for them yet but at least we can compile them now.

9 years agonir/spirv: Add support for more CS system values
Jason Ekstrand [Thu, 22 Oct 2015 01:39:06 +0000 (18:39 -0700)]
nir/spirv: Add support for more CS system values

9 years agonir/spirv: Add support for various barrier type instructions
Jason Ekstrand [Thu, 22 Oct 2015 01:17:11 +0000 (18:17 -0700)]
nir/spirv: Add support for various barrier type instructions

9 years agoFix a couple of dereferences
Jason Ekstrand [Thu, 22 Oct 2015 01:16:50 +0000 (18:16 -0700)]
Fix a couple of dereferences

9 years agospirv/nir: Add more stage asserts
Jason Ekstrand [Thu, 22 Oct 2015 01:00:05 +0000 (18:00 -0700)]
spirv/nir: Add more stage asserts

9 years agonir/spirv: Add support for GS metadata
Jason Ekstrand [Thu, 22 Oct 2015 00:58:34 +0000 (17:58 -0700)]
nir/spirv: Add support for GS metadata

9 years agonir/gather_info: Add more info for geometry shaders
Jason Ekstrand [Thu, 22 Oct 2015 00:42:47 +0000 (17:42 -0700)]
nir/gather_info: Add more info for geometry shaders

9 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Thu, 22 Oct 2015 00:40:13 +0000 (17:40 -0700)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

9 years agoi965: Implement gl_InvocationID.
Kenneth Graunke [Fri, 10 Jul 2015 07:16:19 +0000 (00:16 -0700)]
i965: Implement gl_InvocationID.

It's stored in bits 31:27 of g1 (along with the URB handles).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Implement nir_intrinsic_load_primitive.
Kenneth Graunke [Thu, 24 Sep 2015 01:59:57 +0000 (18:59 -0700)]
i965: Implement nir_intrinsic_load_primitive.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Add a fs_visitor constructor that takes a brw_gs_compile.
Kenneth Graunke [Tue, 30 Jun 2015 05:50:28 +0000 (22:50 -0700)]
i965: Add a fs_visitor constructor that takes a brw_gs_compile.

Unlike the vs/wm structs, brw_gs_compile is actually useful: it contains
the input VUE map and information about the control data headers.
Passing this in allows us to share that code in brw_gs.c, and calculate
them before deciding on vec4 vs. scalar mode, as it's independent of
that choice.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Add a brw->scalar_gs flag controlled by INTEL_SCALAR_GS=1.
Kenneth Graunke [Fri, 26 Jun 2015 23:20:21 +0000 (16:20 -0700)]
i965: Add a brw->scalar_gs flag controlled by INTEL_SCALAR_GS=1.

This patch introduces a brw->scalar_gs flag, similar to brw->scalar_vs,
which controls whether or not to use SIMD8 geometry shaders.

For now, we control it via a new environment variable, INTEL_SCALAR_GS.
This provides a convenient way to try it out.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Make emit_urb_writes() reserve space for GS header information.
Kenneth Graunke [Wed, 6 May 2015 03:19:04 +0000 (20:19 -0700)]
i965: Make emit_urb_writes() reserve space for GS header information.

Geometry shaders have additional header data at the beginning of their
output URB entries.  Shaders that use EndPrimitive() or multiple streams
have a control data header; shaders with a dynamic vertex count have an
additional vec4 slot to hold the 32-bit vertex count (and 96 bits of
padding).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Make emit_urb_writes() only set EOT for the VS.
Kenneth Graunke [Thu, 12 Mar 2015 08:55:44 +0000 (01:55 -0700)]
i965: Make emit_urb_writes() only set EOT for the VS.

The GS will emit a bunch of vertices, and we don't want to do an EOT
prematurely.  We'll emit GS_OPCODE_THREAD_END when we want to terminate
the thread.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Make fs_visitor::emit_urb_writes reusable for scalar GS.
Kenneth Graunke [Thu, 12 Mar 2015 12:52:13 +0000 (05:52 -0700)]
i965: Make fs_visitor::emit_urb_writes reusable for scalar GS.

GS doesn't have ClampVertexColor, and we don't want to go through VS
structures.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Introduce a brw_vue_prog_data::include_vue_handles flag.
Kenneth Graunke [Tue, 29 Sep 2015 21:43:29 +0000 (14:43 -0700)]
i965: Introduce a brw_vue_prog_data::include_vue_handles flag.

Tessellation shaders and SIMD8 geometry shaders may need to resort to
the pull model for inputs at times.  When set, the state upload code
will tell the hardware to provide URB handles for input data.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Introduce a new SHADER_OPCODE_URB_READ_SIMD8 opcode.
Kenneth Graunke [Tue, 29 Sep 2015 21:32:02 +0000 (14:32 -0700)]
i965: Introduce a new SHADER_OPCODE_URB_READ_SIMD8 opcode.

In scalar mode, geometry shader inputs can easily take up hundreds of
registers.  This makes pushing VUE entries impractical; we'll need to
resort to the pull model in some cases.

To support this, we introduce a new opcode corresponding to the "URB
Read SIMD8" message.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Introduce new SHADER_OPCODE_URB_WRITE_SIMD8_MASKED/PER_SLOT opcodes.
Kenneth Graunke [Wed, 6 May 2015 07:04:10 +0000 (00:04 -0700)]
i965: Introduce new SHADER_OPCODE_URB_WRITE_SIMD8_MASKED/PER_SLOT opcodes.

In the vec4 backend, we have a vec4_instruction::urb_write_flags field.
There are many kinds of flags for SIMD4x2 messages.

However, there are really only two (per-slot offset, use channel masks)
for SIMD8 messages.  Rather than adding a boolean flag for per-slot
offsets (polluting all instructions), I decided to just make three new
opcodes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/gs: Do prog_data setup and other calculations in brw_compile_gs
Jason Ekstrand [Wed, 21 Oct 2015 19:03:21 +0000 (12:03 -0700)]
i965/gs: Do prog_data setup and other calculations in brw_compile_gs

This commit moves the large pile of setup calculations we have to do for
geometry shaders out of brw_gs_emit and into brw_compile_gs.  This has a
couple of nice implications.  First, it's less work that the caller of
brw_compile_gs has to do.  Second, it's consistent with the vertex and
fragment stages.  Finally, it allows us to put brw_gs_compile back behind
the API boundary where it belongs.

v2 (Jason Ekstrand):
 - Pull the changes to use nir info into a separate patch
 - Put brw_gs_compile into brw_shader.h rather than brw_vec4_gs_visitor.h
   so that we can use it for scalar GS.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/gs: Use NIR info for setting up prog_data
Jason Ekstrand [Wed, 21 Oct 2015 19:02:08 +0000 (12:02 -0700)]
i965/gs: Use NIR info for setting up prog_data

Previously, we were pulling bits from GL data structures in order to set up
the prog_data.  However, in this brave new world of NIR, we want to be
pulling it out of the NIR shader whenever possible.  This way, we can move
all this setup code into brw_compile_gs without depending on the old GL
stuff.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/gs: Pull prog_data out of brw_gs_compile
Jason Ekstrand [Wed, 21 Oct 2015 00:12:03 +0000 (17:12 -0700)]
i965/gs: Pull prog_data out of brw_gs_compile

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/gs: Use NIR instead of the brw_geometry_program for GS metadata
Jason Ekstrand [Tue, 20 Oct 2015 23:40:30 +0000 (16:40 -0700)]
i965/gs: Use NIR instead of the brw_geometry_program for GS metadata

With this, we can remove the geometry program from brw_gs_compile.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/gs: Move the mem_ctx argument to brw_compile_gs
Jason Ekstrand [Tue, 20 Oct 2015 23:21:09 +0000 (16:21 -0700)]
i965/gs: Move the mem_ctx argument to brw_compile_gs

This makes it better match the other brw_compile_* functions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/gs: Set static_vertex_count unconditionally on GEN8+
Jason Ekstrand [Tue, 20 Oct 2015 23:46:50 +0000 (16:46 -0700)]
i965/gs: Set static_vertex_count unconditionally on GEN8+

We always have NIR, so there's no reason for the check.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Constify nir_gs_count_vertices
Jason Ekstrand [Wed, 21 Oct 2015 00:40:19 +0000 (17:40 -0700)]
nir: Constify nir_gs_count_vertices

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/info: Add more information about geometry shaders
Jason Ekstrand [Tue, 20 Oct 2015 23:35:44 +0000 (16:35 -0700)]
nir/info: Add more information about geometry shaders

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoanv: Don't teardown uninitialized anv_physical_device
Chad Versace [Wed, 21 Oct 2015 18:36:39 +0000 (11:36 -0700)]
anv: Don't teardown uninitialized anv_physical_device

If the user called vkDestroyDevice but never called
vkEnumeratePhysicalDevices, then the driver tried to ralloc_free() an
unitialized anv_physical_device.

Fixes test 'dEQP-VK.api.device_init.create_instance_name_version'.

9 years agoi965: (trivial) rename computes stencil to gen9
Ben Widawsky [Tue, 20 Oct 2015 21:29:38 +0000 (14:29 -0700)]
i965: (trivial) rename computes stencil to gen9

All the documentation I can find says that this bit (and functionality) only
exists on SKL+. Since the bit isn't yet used, there is no real impact here.

The original code was added by Ken here (a surprisingly long time ago):
commit f3c6d6f1e151f6a44a76038dccebe4434038dcb1
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Nov 29 21:00:27 2012 -0800

    i965: Update 3DSTATE_PS, 3DSTATE_WM, and add 3DSTATE_PS_EXTRA.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Correct the comment about fb write payload
Ben Widawsky [Tue, 20 Oct 2015 21:29:36 +0000 (14:29 -0700)]
i965: Correct the comment about fb write payload

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agomesa/glformats: Undo code changes from _mesa_base_tex_format() move
Nanley Chery [Thu, 8 Oct 2015 23:44:30 +0000 (16:44 -0700)]
mesa/glformats: Undo code changes from _mesa_base_tex_format() move

The refactoring commit, c6bf1cd, accidentally reverted cd49b97
and 99b1f47. These changes caused more code to be added to the
function and removed the existing support for ASTC. This patch
reverts those modifications.

v2. Actually include ASTC support again.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92221
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
9 years agoi965: Mark compacted 3-src instructions as Gen8+.
Matt Turner [Tue, 20 Oct 2015 02:02:16 +0000 (19:02 -0700)]
i965: Mark compacted 3-src instructions as Gen8+.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Add const to brw_compact_inst_bits.
Matt Turner [Tue, 20 Oct 2015 01:59:53 +0000 (18:59 -0700)]
i965: Add const to brw_compact_inst_bits.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Add mask_control_ex field and handle it in compaction.
Matt Turner [Mon, 19 Oct 2015 22:08:28 +0000 (15:08 -0700)]
i965: Add mask_control_ex field and handle it in compaction.

Documentation is sparse, but it appears to have existed on G45 and ILK
as a second bit extension of the mask_control field. Setting the pair of
bits to 0b11 enables "NoCMask".

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Add devinfo->gen assertions for acc_wr_control.
Matt Turner [Mon, 19 Oct 2015 21:47:17 +0000 (14:47 -0700)]
i965: Add devinfo->gen assertions for acc_wr_control.

... and for flag_subreg_nr since it's right near by.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Prepare for next commit by adding more whitespace.
Matt Turner [Mon, 19 Oct 2015 21:46:18 +0000 (14:46 -0700)]
i965: Prepare for next commit by adding more whitespace.

We're going to add a field with a longer name that wouldn't align with
the rest.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Compact acc_wr_control only on Gen6+.
Matt Turner [Mon, 19 Oct 2015 22:01:20 +0000 (15:01 -0700)]
i965: Compact acc_wr_control only on Gen6+.

It only exists on Gen6+, and the next patches will add compaction
support for the (unused) field in the same location on earlier
platforms.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Add devinfo parameter to brw_compact_inst_* funcs.
Matt Turner [Mon, 19 Oct 2015 21:41:36 +0000 (14:41 -0700)]
i965: Add devinfo parameter to brw_compact_inst_* funcs.

The next commit will add assertions dependent on devinfo->gen.

Use compact()/uncompact() macros where possible, like the 3-src code
does.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Don't emit MOVs for unused URB slots.
Matt Turner [Thu, 15 Oct 2015 22:13:12 +0000 (15:13 -0700)]
i965/vec4: Don't emit MOVs for unused URB slots.

Otherwise we'd emit a MOV from the null register (which isn't allowed).

Helps 24 programs in shader-db (the geometry shaders in GSCloth):

instructions in affected programs:     302 -> 262 (-13.25%)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoosmesa: Expose GL entry points for Windows build via DEF file.
Nigel Stewart [Mon, 12 Oct 2015 11:26:37 +0000 (21:26 +1000)]
osmesa: Expose GL entry points for Windows build via DEF file.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92437
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoconfigure.ac: ensure RM is set
Jonathan Gray [Sat, 10 Oct 2015 06:42:40 +0000 (17:42 +1100)]
configure.ac: ensure RM is set

GNU make predefines RM to rm -f but this is not required by POSIX
so ensure that RM is set.  This fixes "make clean" on OpenBSD.

v2: use AC_CHECK_PROG

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965/fs: Disable opt_sampler_eot for more message types
Neil Roberts [Tue, 20 Oct 2015 09:56:15 +0000 (11:56 +0200)]
i965/fs: Disable opt_sampler_eot for more message types

In bfdae9149e0 I disabled the opt_sampler_eot optimisation for TG4
message types because I found by experimentation that it doesn't work.
I wrote in the comment that I couldn't find any documentation for this
problem. However I've now found the documentation and it has
additional restrictions on further message types so this patch updates
the comment and adds the others.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Remove block arg from foreach_inst_in_block_*_starting_from
Neil Roberts [Tue, 20 Oct 2015 09:16:00 +0000 (11:16 +0200)]
i965: Remove block arg from foreach_inst_in_block_*_starting_from

Since 49374fab5d793 these macros no longer actually use the block
argument. I think this is worth doing to make the macros easier to use
because they already have really long names and a confusing set of
arguments.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: check for arrays of arrays when assigning explicit locations
Timothy Arceri [Wed, 21 Oct 2015 02:44:10 +0000 (13:44 +1100)]
glsl: check for arrays of arrays when assigning explicit locations

This fixes assigning explicit locations in the CTS test:

ES31-CTS.explicit_uniform_location.uniform-loc-arrays-of-arrays

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: add is_array_of_arrays() helper
Timothy Arceri [Wed, 21 Oct 2015 02:37:11 +0000 (13:37 +1100)]
glsl: add is_array_of_arrays() helper

As suggested by Ian Romanick

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: Fix bad indentation in bit_logic_result_type().
Kenneth Graunke [Wed, 21 Oct 2015 02:51:56 +0000 (19:51 -0700)]
glsl: Fix bad indentation in bit_logic_result_type().

The first level of indentation was using 4 spaces.  Mesa uses 3.

Trivial.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add AoA support to subroutines
Timothy Arceri [Wed, 5 Aug 2015 05:49:22 +0000 (15:49 +1000)]
glsl: add AoA support to subroutines

process_parameters() will now be called earlier because we need
actual_parameters processed earlier so we can use it with
match_subroutine_by_name() to get the subroutine variable, we need
to do this inside the recursive function generate_array_index() because
we can't create the ir_dereference_array() until we have gotten to the
outermost array.

For the remainder of the array dimensions the type doesn't matter so we
can just use the existing _mesa_ast_array_index_to_hir() function to
process the ast.

Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: fix record type detection in explicit location assign
Tapani Pälli [Tue, 20 Oct 2015 09:18:51 +0000 (12:18 +0300)]
glsl: fix record type detection in explicit location assign

Check current_var directly instead of using the passed in record_type.

This fixes following failing CTS test:
ES31-CTS.explicit_uniform_location.uniform-loc-types-structs

No Piglit regressions.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: do not try to reserve explicit locations for buffer variables
Tapani Pälli [Tue, 20 Oct 2015 07:24:50 +0000 (10:24 +0300)]
glsl: do not try to reserve explicit locations for buffer variables

Explicit locations are only used with uniform variables.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: skip buffer variables when filling UniformRemapTable
Tapani Pälli [Tue, 20 Oct 2015 05:32:15 +0000 (08:32 +0300)]
glsl: skip buffer variables when filling UniformRemapTable

UniformRemapTable is used only for remapping user specified uniform
locations to driver internally used ones, shader storage buffer
variables should not utilize uniform locations.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agosvga: add switch case for PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT
Brian Paul [Wed, 21 Oct 2015 00:22:43 +0000 (18:22 -0600)]
svga: add switch case for PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT

A third instance of this was needed but missed in the previous commit.
Return 32 as for the two other cases.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agodraw: fix splitting of line loops (v2)
Brian Paul [Sat, 17 Oct 2015 18:07:32 +0000 (12:07 -0600)]
draw: fix splitting of line loops (v2)

When the draw module splits long line loops, the sections are emitted
as line strips.  But the primitive type wasn't set correctly so each
section was being drawn as a loop, introducing extra line segments.

To fix this, we pass a new DRAW_LINE_LOOP_AS_STRIP flag to the run()
function.  The linear/elt_run() functions have to check for this flag
and set their primitive type accordingly.

No piglit regressions.  Fixes piglit's lineloop with -count 4097 or
higher.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agoanv/pipeline: Remove a redundant line
Jason Ekstrand [Tue, 20 Oct 2015 23:02:00 +0000 (16:02 -0700)]
anv/pipeline: Remove a redundant line

We set compute_sample_id based on multisample state two lines below.

9 years agoanv/pipeline: Update a comment
Jason Ekstrand [Tue, 20 Oct 2015 23:00:55 +0000 (16:00 -0700)]
anv/pipeline: Update a comment

9 years agoanv/pipeline: Set key->render_to_fbo to false for fragment shaaders
Jason Ekstrand [Tue, 20 Oct 2015 22:37:14 +0000 (15:37 -0700)]
anv/pipeline: Set key->render_to_fbo to false for fragment shaaders

Vulkan uses the upper-left convention.  This is the same as DX one and what
our hardware does.  We had it flipped around.

9 years agonir/spirv: Fix a typo
Jason Ekstrand [Tue, 20 Oct 2015 22:35:13 +0000 (15:35 -0700)]
nir/spirv: Fix a typo

9 years agonir/spirv: Handle SpvExecutionMode
Jason Ekstrand [Tue, 20 Oct 2015 22:23:56 +0000 (15:23 -0700)]
nir/spirv: Handle SpvExecutionMode

9 years agoi965/gen9: Remove temporary variable 'bpp' in tr_mode_..._texture_alignment()
Anuj Phogat [Thu, 13 Aug 2015 18:19:47 +0000 (11:19 -0700)]
i965/gen9: Remove temporary variable 'bpp' in tr_mode_..._texture_alignment()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Remove temporary variable 'align_yf' in tr_mode_..._texture_alignment()
Anuj Phogat [Wed, 12 Aug 2015 23:39:05 +0000 (16:39 -0700)]
i965/gen9: Remove temporary variable 'align_yf' in tr_mode_..._texture_alignment()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Remove parameter 'brw' from tr_mode_..._texture_alignment()
Anuj Phogat [Wed, 23 Sep 2015 23:13:00 +0000 (16:13 -0700)]
i965/gen9: Remove parameter 'brw' from tr_mode_..._texture_alignment()

V2: Rebased on master.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Reuse YF alignment tables in tr_mode_..._texture_alignment()
Anuj Phogat [Wed, 23 Sep 2015 23:12:26 +0000 (16:12 -0700)]
i965/gen9: Reuse YF alignment tables in tr_mode_..._texture_alignment()

Patch just does some refactoring to make the code look better. No
functional changes in here.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoanv: Completely rework shader compilation
Jason Ekstrand [Tue, 20 Oct 2015 05:06:59 +0000 (22:06 -0700)]
anv: Completely rework shader compilation

Now that we have a decent interface in upstream mesa, we can get rid of all
our hacks.  As of this commit, we no longer use any fake GL state objects
and all of shader compilation is moved into anv_pipeline.c.  This should
make way for actually implementing a shader cache one of these days.

As a nice side-benifit, this commit also gains us an extra 300 passing CTS
tests because we're actually filling out the texture swizzle information
for vertex shaders.

9 years agonir: Add a pass to gather info from the shader
Jason Ekstrand [Tue, 20 Oct 2015 05:05:36 +0000 (22:05 -0700)]
nir: Add a pass to gather info from the shader

This pass fills out a bunch of the fields in nir_shader_info by inspecting
the shader.

9 years agoanv: Move the brw_compiler from anv_compiler to physical_device
Jason Ekstrand [Tue, 20 Oct 2015 03:21:45 +0000 (20:21 -0700)]
anv: Move the brw_compiler from anv_compiler to physical_device

9 years agoi965: Move brw_compiler_create to brw_compiler.h
Jason Ekstrand [Tue, 20 Oct 2015 03:19:09 +0000 (20:19 -0700)]
i965: Move brw_compiler_create to brw_compiler.h

9 years agoi965: Split process_nir into two haves; pre- and post-
Jason Ekstrand [Tue, 20 Oct 2015 01:46:29 +0000 (18:46 -0700)]
i965: Split process_nir into two haves; pre- and post-

9 years agoanv/compiler: Remove more pre-SNB shader key setup
Jason Ekstrand [Tue, 20 Oct 2015 01:15:45 +0000 (18:15 -0700)]
anv/compiler: Remove more pre-SNB shader key setup

9 years agoanv/compiler: Get rid of GS support.
Jason Ekstrand [Tue, 20 Oct 2015 00:05:40 +0000 (17:05 -0700)]
anv/compiler: Get rid of GS support.

The geometry shader support is currently completely untested.  As I go
through and re-factor the compiler, I'd rather not refactor dead code that
I don't have a way to know if I broke.  Let's just remove it for now.  We
can put it back in easily enough later and then we'll do it properly.

9 years agoanv/meta: Use the actual render pass for creating blit pipelines
Jason Ekstrand [Tue, 20 Oct 2015 20:01:15 +0000 (13:01 -0700)]
anv/meta: Use the actual render pass for creating blit pipelines

9 years agovbo: convert display list GL_LINE_LOOP prims to GL_LINE_STRIP
Brian Paul [Fri, 16 Oct 2015 04:57:08 +0000 (22:57 -0600)]
vbo: convert display list GL_LINE_LOOP prims to GL_LINE_STRIP

When a long GL_LINE_LOOP prim was split across primitives we drew
stray lines.  See previous commit for details.

This patch converts GL_LINE_LOOP prims into GL_LINE_STRIP prims so
that drivers don't have to worry about the _mesa_prim::begin/end flags.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: fix GL_LINE_LOOP stray line bug
Brian Paul [Fri, 16 Oct 2015 04:31:50 +0000 (22:31 -0600)]
vbo: fix GL_LINE_LOOP stray line bug

When long GL_LINE_LOOP primitives don't fit in one vertex buffer they
have to be split across buffers.  The code to do this was basically correct
but drivers had to pay special attention to the _mesa_prim::begin,end flags
in order to draw the sections of the line loop properly.  Apparently, the
only drivers to do this were those using the old 'tnl' module for software
vertex processing.

Now we convert the split pieces of GL_LINE_LOOP prims into GL_LINE_STRIP
primitives so that drivers don't have to worry about the special begin/end
flags.  The only time a driver will get a GL_LINE_LOOP prim is when the
whole thing fits in one vertex buffer.

Mostly fixes bug 81174, but not completely.  There's another bug somewhere
in the src/gallium/auxiliary/draw/ code.  If the piglit lineloop test is
run with -count 4096, rendering is correct, but with -count 4097 there are
stray lines.  4096 is a magic number in the draw code (search for "4096").

Also note that this does not fix long line loops in display lists.  The
next patch fixes that.

v2: fix incorrect -1 in vbo_compute_max_verts(), per Charmaine.  Remove
incorrect assertion which was added in vbo_copy_vertices().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49779
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28130

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: add new vbo_compute_max_verts() helper function
Brian Paul [Fri, 16 Oct 2015 17:19:40 +0000 (11:19 -0600)]
vbo: add new vbo_compute_max_verts() helper function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: simplify some code in vbo_exec_End()
Brian Paul [Fri, 16 Oct 2015 02:33:52 +0000 (20:33 -0600)]
vbo: simplify some code in vbo_exec_End()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: simplify some code in vbo_copy_vertices()
Brian Paul [Fri, 16 Oct 2015 03:25:18 +0000 (21:25 -0600)]
vbo: simplify some code in vbo_copy_vertices()

As before, use a new 'last_prim' pointer to simplify things.  Plus, add
some const qualifiers.

v2: use 'sz' in another place, per Sinclair.  And update subject line.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>