platform/upstream/mesa.git
8 years agonir/spirv: Rework access chains
Jason Ekstrand [Thu, 21 Jan 2016 01:11:55 +0000 (17:11 -0800)]
nir/spirv: Rework access chains

Previously, we were creating nir_deref's immediately.  Now, instead, we
have an intermediate vtn_access_chain structure.  While a little more
awkward initially, this will allow us to more easily do structure splitting
on-the-fly.

8 years agonir/spirv: Implement ModfStruct opcode.
Kenneth Graunke [Thu, 21 Jan 2016 22:56:34 +0000 (14:56 -0800)]
nir/spirv: Implement ModfStruct opcode.

8 years agonir/spirv: Delete stray fmod remnants.
Kenneth Graunke [Thu, 21 Jan 2016 22:53:44 +0000 (14:53 -0800)]
nir/spirv: Delete stray fmod remnants.

Jason left these stray code fragments in
22804de110b97dce1415318fd02c1003e16ef14a.

8 years agovk: Do render cache flush for GEN8+
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 22:14:01 +0000 (14:14 -0800)]
vk: Do render cache flush for GEN8+

This is needed for SKL as well.

8 years agovk: Emit surface state base address before renderpass
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 21:52:41 +0000 (13:52 -0800)]
vk: Emit surface state base address before renderpass

If we're continuing a render pass, make sure we don't emit the depth and
stencil buffer addresses before we set the state base addresses.

Fixes crucible func.cmd-buffer.small-secondaries

8 years agovk: Fix indirect push constants
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 18:43:32 +0000 (10:43 -0800)]
vk: Fix indirect push constants

This currently sets the base and size of all push constants to the
entire push constant block. The idea is that we'll use the base and size
to eventually optimize the amount we actually push, but for now we don't
do that.

8 years agoMerge remote-tracking branch 'jekstrand/wip/i965-uniforms' into vulkan
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 19:07:09 +0000 (11:07 -0800)]
Merge remote-tracking branch 'jekstrand/wip/i965-uniforms' into vulkan

8 years agonir/spirv: Handle compute shared atomics
Jordan Justen [Sun, 10 Jan 2016 19:12:17 +0000 (11:12 -0800)]
nir/spirv: Handle compute shared atomics

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/spirv: Support workgroup (shared) variable translation
Jordan Justen [Sat, 9 Jan 2016 03:45:45 +0000 (19:45 -0800)]
nir/spirv: Support workgroup (shared) variable translation

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8: Set SLM size in interface descriptor
Jordan Justen [Sat, 9 Jan 2016 09:28:40 +0000 (01:28 -0800)]
anv/gen8: Set SLM size in interface descriptor

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8+9: Invalidate color calc state when switching to the GPGPU pipeline
Jordan Justen [Thu, 21 Jan 2016 01:26:41 +0000 (17:26 -0800)]
anv/gen8+9: Invalidate color calc state when switching to the GPGPU pipeline

Port 044acb9256046bebec890cac7e42043754459fc2 to anv.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8: Enable SLM in L3 cache control register
Jordan Justen [Sat, 9 Jan 2016 09:18:24 +0000 (01:18 -0800)]
anv/gen8: Enable SLM in L3 cache control register

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/pipeline: Set size of shared variables in prog_data
Jordan Justen [Mon, 18 Jan 2016 18:00:49 +0000 (10:00 -0800)]
anv/pipeline: Set size of shared variables in prog_data

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/nir: Lower nir compute shader shared variables
Jordan Justen [Mon, 18 Jan 2016 17:45:46 +0000 (09:45 -0800)]
i965/nir: Lower nir compute shader shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Lower shared var atomics during nir_lower_io
Jordan Justen [Mon, 18 Jan 2016 17:59:19 +0000 (09:59 -0800)]
nir: Lower shared var atomics during nir_lower_io

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add support for lowering load/stores of shared variables
Jordan Justen [Mon, 18 Jan 2016 17:44:31 +0000 (09:44 -0800)]
nir: Add support for lowering load/stores of shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add atomic operations on variables
Jordan Justen [Mon, 18 Jan 2016 17:53:44 +0000 (09:53 -0800)]
nir: Add atomic operations on variables

This allows us to first generate atomic operations for shared
variables using these opcodes, and then later we can lower those to
the shared atomics intrinsics with nir_lower_io.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add compute shader shared variable storage class
Jordan Justen [Sat, 9 Jan 2016 01:16:29 +0000 (17:16 -0800)]
nir: Add compute shader shared variable storage class

Previously we were receiving shared variable accesses via a lowered
intrinsic function from glsl. This change allows us to send in
variables instead. For example, when converting from SPIR-V.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/print: Add space after shader_storage var mode
Jordan Justen [Sun, 17 Jan 2016 07:11:16 +0000 (23:11 -0800)]
nir/print: Add space after shader_storage var mode

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/fs/nir: Move shared variable load/store to nir_emit_cs_intrinsic
Jordan Justen [Sat, 16 Jan 2016 02:38:19 +0000 (18:38 -0800)]
i965/fs/nir: Move shared variable load/store to nir_emit_cs_intrinsic

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/image: Stop including gen8_pack.h in common file
Chad Versace [Wed, 20 Jan 2016 23:41:25 +0000 (15:41 -0800)]
anv/image: Stop including gen8_pack.h in common file

8 years agoisl: Add a README
Chad Versace [Fri, 15 Jan 2016 18:00:13 +0000 (10:00 -0800)]
isl: Add a README

Most of the file-level comment in isl.h is moved to the README.

8 years agovk: Make maxSamplerAllocationCount more reasonable
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 22:36:52 +0000 (14:36 -0800)]
vk: Make maxSamplerAllocationCount more reasonable

We can't allocate 4 billion samplers. Let's go with 64k.

8 years agovk/tests: Add stub for anv_gem_get_bit6_swizzle()
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 21:46:54 +0000 (13:46 -0800)]
vk/tests: Add stub for anv_gem_get_bit6_swizzle()

8 years agovk/tests: Add isl include path
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 21:45:25 +0000 (13:45 -0800)]
vk/tests: Add isl include path

8 years agonir/spirv/glsl450: Use fabs not iabs in ldexp.
Kenneth Graunke [Wed, 20 Jan 2016 20:09:29 +0000 (12:09 -0800)]
nir/spirv/glsl450: Use fabs not iabs in ldexp.

This was just wrong.

8 years agoisl: Add ish.h to libsil_la_SOURCES
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 20:02:48 +0000 (12:02 -0800)]
isl: Add ish.h to libsil_la_SOURCES

8 years agonir/spirv/glsl450: Implement FrexpStruct
Jason Ekstrand [Wed, 20 Jan 2016 19:36:41 +0000 (11:36 -0800)]
nir/spirv/glsl450: Implement FrexpStruct

8 years agospirv/nir/glsl450: Use vtn_create_ssa_value to create SSA values
Jason Ekstrand [Wed, 20 Jan 2016 19:36:26 +0000 (11:36 -0800)]
spirv/nir/glsl450: Use vtn_create_ssa_value to create SSA values

8 years agoanv/device: Default to scalar GS on BDW+
Jason Ekstrand [Wed, 20 Jan 2016 19:16:44 +0000 (11:16 -0800)]
anv/device: Default to scalar GS on BDW+

8 years agonir/spirv: Pull texture dimensionality out of the image when available
Jason Ekstrand [Wed, 20 Jan 2016 19:11:30 +0000 (11:11 -0800)]
nir/spirv: Pull texture dimensionality out of the image when available

8 years agoanv/meta: fix UpdateBuffer in the case where we do multiple updates
Jason Ekstrand [Wed, 20 Jan 2016 15:56:48 +0000 (07:56 -0800)]
anv/meta: fix UpdateBuffer in the case where we do multiple updates

8 years agoanv/meta: Fix a finishme
Jason Ekstrand [Wed, 20 Jan 2016 15:33:41 +0000 (07:33 -0800)]
anv/meta: Fix a finishme

8 years agonir/spirv: Move OpPhi handling to vtn_cfg.c
Jason Ekstrand [Wed, 20 Jan 2016 02:58:31 +0000 (18:58 -0800)]
nir/spirv: Move OpPhi handling to vtn_cfg.c

Phi handling is somewhat intrinsically tied to the CFG.  Moving it here
makes it a bit easier to handle that.  In particular, we can now do SSA
repair after we've done the phi node second-pass.  This fixes 6 CTS tests.

8 years agonir/spirv: Handle OpLine and OpNoLine in foreach_instruction
Jason Ekstrand [Wed, 20 Jan 2016 02:44:44 +0000 (18:44 -0800)]
nir/spirv: Handle OpLine and OpNoLine in foreach_instruction

This way we don't have to explicitly handle them everywhere.

8 years agonir: Lower ldexp to arithmetic.
Kenneth Graunke [Wed, 20 Jan 2016 01:40:58 +0000 (17:40 -0800)]
nir: Lower ldexp to arithmetic.

This is a port of Matt's GLSL IR lowering pass to NIR.  It's required
because we translate SPIR-V directly to NIR, bypassing GLSL IR.

I haven't introduced a lower_ldexp flag, as I believe all current NIR
consumers would set the flag.  i965 wants this, vc4 doesn't implement
this feature, and st_glsl_to_tgsi currently lowers ldexp
unconditionally anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Let nir_opt_algebraic rules contain unsigned constants > INT_MAX.
Kenneth Graunke [Wed, 20 Jan 2016 01:34:24 +0000 (17:34 -0800)]
nir: Let nir_opt_algebraic rules contain unsigned constants > INT_MAX.

struct.pack('i', val) interprets `val` as a signed integer, and dies
if `val` > INT_MAX.  For larger constants, we need to use 'I' which
interprets it as an unsigned value.

This patch makes us use 'I' for all values >= 0, and 'i' for negative
values.  This should work in all cases.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/meta: Implement UpdateBuffer
Jason Ekstrand [Wed, 20 Jan 2016 00:39:48 +0000 (16:39 -0800)]
anv/meta: Implement UpdateBuffer

8 years agoanv/meta: Implement CmdFillBuffer
Jason Ekstrand [Wed, 20 Jan 2016 00:17:13 +0000 (16:17 -0800)]
anv/meta: Implement CmdFillBuffer

8 years agoanv/meta_clear: Call emit_clear directly in ClearImage
Jason Ekstrand [Tue, 19 Jan 2016 23:52:03 +0000 (15:52 -0800)]
anv/meta_clear: Call emit_clear directly in ClearImage

Using the load op means that we end up with recursive meta.  We shouldn't
be doing that.

8 years agoanv/meta_clear: Do save/restore in actual entry points
Jason Ekstrand [Tue, 19 Jan 2016 23:27:20 +0000 (15:27 -0800)]
anv/meta_clear: Do save/restore in actual entry points

8 years agoanv: Add support for VK_WHOLE_SIZE several places
Jason Ekstrand [Tue, 19 Jan 2016 23:01:10 +0000 (15:01 -0800)]
anv: Add support for VK_WHOLE_SIZE several places

8 years agonir/spirv/glsl450: Implement Frexp.
Kenneth Graunke [Wed, 20 Jan 2016 00:46:03 +0000 (16:46 -0800)]
nir/spirv/glsl450: Implement Frexp.

8 years agonir/spirv/glsl450: Blindly implement Atan2.
Kenneth Graunke [Tue, 19 Jan 2016 23:56:50 +0000 (15:56 -0800)]
nir/spirv/glsl450: Blindly implement Atan2.

This is untested and probably broken.

We already passed the atan2 CTS tests before implementing this opcode.
Presumably, glslang or something was giving us a plain Atan opcode
instead of Atan2.  I don't know why.

8 years agonir/spirv/glsl450: Implement Atan.
Kenneth Graunke [Tue, 19 Jan 2016 22:30:02 +0000 (14:30 -0800)]
nir/spirv/glsl450: Implement Atan.

8 years agonir/spirv/glsl450: Implement Asin and Acos.
Kenneth Graunke [Tue, 19 Jan 2016 20:15:36 +0000 (12:15 -0800)]
nir/spirv/glsl450: Implement Asin and Acos.

8 years agoanv/pipeline: Fix point size
Jason Ekstrand [Tue, 19 Jan 2016 20:02:53 +0000 (12:02 -0800)]
anv/pipeline: Fix point size

8 years agogetX/state: Set LOD pre-clamp to OpenGL mode
Jason Ekstrand [Tue, 19 Jan 2016 01:45:12 +0000 (17:45 -0800)]
getX/state: Set LOD pre-clamp to OpenGL mode

This gets us another couple hundred sampler tests

8 years agoisl/device: Add a flag for bit 6 swizzling
Jason Ekstrand [Tue, 5 Jan 2016 21:53:05 +0000 (13:53 -0800)]
isl/device: Add a flag for bit 6 swizzling

8 years agoanv/gem: Add a helper for getting bit6 swizzling information
Jason Ekstrand [Mon, 18 Jan 2016 23:42:41 +0000 (15:42 -0800)]
anv/gem: Add a helper for getting bit6 swizzling information

8 years agonir/spirv: Patch through image qualifiers
Jason Ekstrand [Tue, 19 Jan 2016 00:01:00 +0000 (16:01 -0800)]
nir/spirv: Patch through image qualifiers

8 years agonir/spirv: Implement ImageQuerySize for storage iamges
Jason Ekstrand [Tue, 5 Jan 2016 22:03:58 +0000 (14:03 -0800)]
nir/spirv: Implement ImageQuerySize for storage iamges

SPIR-V only has one ImageQuerySize opcode that has to work for both
textures and storage images.  Therefore, we have to special-case that one a
bit and look at the type of the incoming image handle.

8 years agonir/spirv: Insert movs around image intrinsics
Jason Ekstrand [Mon, 18 Jan 2016 23:00:01 +0000 (15:00 -0800)]
nir/spirv: Insert movs around image intrinsics

Image intrinsics always take a vec4 coordinate and always return a vec4.
This simplifies the intrinsics a but but also means that they don't
actually match the incomming SPIR-V.  In order to compensate for this, we
add swizzling movs for both source and destination to get the right number
of components.

8 years agoanv/meta: Improve meta clear cleanup a bit
Jason Ekstrand [Mon, 18 Jan 2016 22:07:46 +0000 (14:07 -0800)]
anv/meta: Improve meta clear cleanup a bit

8 years agoanv: Misc allocation scope fixes
Jason Ekstrand [Mon, 18 Jan 2016 22:04:13 +0000 (14:04 -0800)]
anv: Misc allocation scope fixes

8 years agoanv/meta: Add a meta allocator that uses SCOPE_DEVICE
Jason Ekstrand [Mon, 18 Jan 2016 22:03:20 +0000 (14:03 -0800)]
anv/meta: Add a meta allocator that uses SCOPE_DEVICE

The Vulkan spec requires all allocations that happen for device creation to
happen with SCOPE_DEVICE.  Since meta calls into other things that allocate
memory, the easiest way to do this is with an allocator.

8 years agoanv/meta: Initialize a handle to null
Jason Ekstrand [Mon, 18 Jan 2016 21:05:02 +0000 (13:05 -0800)]
anv/meta: Initialize a handle to null

8 years agogen8: Fix border color
Jason Ekstrand [Mon, 18 Jan 2016 20:16:31 +0000 (12:16 -0800)]
gen8: Fix border color

The border color packet is specified as a 64-byte aligned address relative
to dynamic state base address.  The way the packing functions are currently
set up, we need to provide it with (offset >> 6) because it just shoves the
bits in where the PRM says they go and isn't really aware that it's an
address.

8 years agogenX/pack: Add a __gen_fixed helper and use it for TextureLODBias
Jason Ekstrand [Mon, 18 Jan 2016 19:35:04 +0000 (11:35 -0800)]
genX/pack: Add a __gen_fixed helper and use it for TextureLODBias

The __gen_fixed helper properly clamps the value and also handles negative
values correctly.  Eventually, we need to make the scripts generate this
and use it for more things.

8 years agoanv/pack: Make TextureLODBias a proper 4.8 float
Jason Ekstrand [Mon, 18 Jan 2016 18:36:53 +0000 (10:36 -0800)]
anv/pack: Make TextureLODBias a proper 4.8 float

XXX: We need to update the generators so this doesn't get stompped.

8 years agonir/spirv: Handle if's where the merge is also a break or continue
Jason Ekstrand [Mon, 18 Jan 2016 18:10:47 +0000 (10:10 -0800)]
nir/spirv: Handle if's where the merge is also a break or continue

8 years agonir/spirv: Hanle continues that use SSA values from the loop body
Jason Ekstrand [Mon, 18 Jan 2016 17:33:56 +0000 (09:33 -0800)]
nir/spirv: Hanle continues that use SSA values from the loop body

Instead of emitting the continue before the loop body we emit it
afterwards.  Then, once we've finished with the entire function, we run
nir_repair_ssa to add whatever phi nodes are needed.

8 years agonir/lower_returns: Repair SSA after doing return lowering
Jason Ekstrand [Mon, 18 Jan 2016 17:24:07 +0000 (09:24 -0800)]
nir/lower_returns: Repair SSA after doing return lowering

8 years agonir: Add a pass to repair SSA form
Jason Ekstrand [Mon, 18 Jan 2016 17:19:01 +0000 (09:19 -0800)]
nir: Add a pass to repair SSA form

8 years agonir/vars_to_ssa: Use the new nir_phi_builder helper
Jason Ekstrand [Mon, 18 Jan 2016 16:40:16 +0000 (08:40 -0800)]
nir/vars_to_ssa: Use the new nir_phi_builder helper

The efficiency should be approximately the same.  We do a little more work
per phi node because we have to sort the predecessors.  However, we no
longer have to walk the blocks a second time to pop things off the stack.
The bigger advantage, however, is that we can now re-use the phi placement
and per-block SSA value tracking in other passes.

8 years agonir: Add a phi node placement helper
Jason Ekstrand [Mon, 18 Jan 2016 16:38:57 +0000 (08:38 -0800)]
nir: Add a phi node placement helper

Right now, we have phi placement code in two places and there are other
places where it would be nice to be able to do this analysis.  Instead of
repeating it all over the place, this commit adds a helper for placing all
of the needed phi nodes for a value.

8 years agoutil/bitset: Allow iterating over const bitsets
Jason Ekstrand [Sun, 17 Jan 2016 05:26:10 +0000 (21:26 -0800)]
util/bitset: Allow iterating over const bitsets

8 years agonir/lower_system_values: Lower vertexID to id+base if needed
Jason Ekstrand [Sat, 16 Jan 2016 00:15:50 +0000 (16:15 -0800)]
nir/lower_system_values: Lower vertexID to id+base if needed

8 years agoanv/batch_chain: Remove padding from the BO before emitting BUFFER_END
Jason Ekstrand [Fri, 15 Jan 2016 23:59:58 +0000 (15:59 -0800)]
anv/batch_chain: Remove padding from the BO before emitting BUFFER_END

8 years agoanv/batch_chain: Don't call current_batch_bo() again
Jason Ekstrand [Fri, 15 Jan 2016 23:48:18 +0000 (15:48 -0800)]
anv/batch_chain: Don't call current_batch_bo() again

We call it once at the top of the function and then hold on to the pointer.
It shouldn't have changed, so there's no reason to query for it again.

8 years agonir/spirv: Stop trusting the SPIR-V for the number of texture coordinates
Jason Ekstrand [Fri, 15 Jan 2016 19:10:58 +0000 (11:10 -0800)]
nir/spirv: Stop trusting the SPIR-V for the number of texture coordinates

8 years agoanv: Populate SURFACE_STATE more safely
Chad Versace [Fri, 15 Jan 2016 18:54:05 +0000 (10:54 -0800)]
anv: Populate SURFACE_STATE more safely

genX_image_view_init allocates up to 3 separate SURFACE_STATE structures,
and populates each from a single template. Stop mutating the template
between each final SURFACE_STATE.

8 years agoanv/meta: Stop leaking renderpass and framebuffer
Chad Versace [Fri, 15 Jan 2016 18:07:16 +0000 (10:07 -0800)]
anv/meta: Stop leaking renderpass and framebuffer

8 years agoanv/meta: Reuse code for vkCmdClear{Color,DepthStencil}Image
Chad Versace [Fri, 15 Jan 2016 15:43:31 +0000 (07:43 -0800)]
anv/meta: Reuse code for vkCmdClear{Color,DepthStencil}Image

The two function bodies were very similar. Move common code to
anv_cmd_clear_image().

Fixes all 'dEQP-VK.renderpass.formats.*' on Skylake.

8 years agoanv/gen8: Fix SF_CLIP_VIEWPORT's Z elements
Chad Versace [Fri, 15 Jan 2016 05:29:46 +0000 (21:29 -0800)]
anv/gen8: Fix SF_CLIP_VIEWPORT's Z elements

SF_CLIP_VIEWPORT does not clamp Z values. It only scales and shifts
them. Clamping to VkViewport::minDepth,maxDepth is instead handled by
CC_VIEWPORT.

Fixes dEQP-VK.renderpass.simple.depth on Broadwell.

8 years agoanv/meta: Implement vkCmdClearDepthStencilImage
Chad Versace [Fri, 15 Jan 2016 04:09:38 +0000 (20:09 -0800)]
anv/meta: Implement vkCmdClearDepthStencilImage

8 years agoanv/meta: Implement vkCmdClearAttachments
Chad Versace [Thu, 14 Jan 2016 02:37:27 +0000 (18:37 -0800)]
anv/meta: Implement vkCmdClearAttachments

8 years agoanv/meta: Add VkClearRect param to emit_clear()
Chad Versace [Thu, 14 Jan 2016 02:34:20 +0000 (18:34 -0800)]
anv/meta: Add VkClearRect param to emit_clear()

Prepares for vkCmdClearAttachments.

8 years agoanv: Distinguish between subpass setup and subpass start
Chad Versace [Thu, 14 Jan 2016 23:18:20 +0000 (15:18 -0800)]
anv: Distinguish between subpass setup and subpass start

vkCmdBeginRenderPass, vkCmdNextSubpass, and vkBeginCommandBuffer with
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT, all *setup* the
command buffer for recording commands for some subpass.  But only the
first two, vkCmdBeginRenderPass and vkCmdNextSubpass, can *start*
a subpass.

Therefore, calling anv_cmd_buffer_begin_subpass() inside
vkCmdBeginCommandBuffer is misleading. Clarify its purpose by renaming
it to anv_cmd_buffer_set_subpass() and adding comments.

8 years agoanv: Emit load clears at start of each subpass
Chad Versace [Wed, 13 Jan 2016 22:47:51 +0000 (14:47 -0800)]
anv: Emit load clears at start of each subpass

This should improve cache residency for render targets.

Pre-patch, vkCmdBeginRenderPass emitted all the meta clears for
VK_ATTACHMENT_LOAD_OP_CLEAR before any subpass began. Post-patch,
vCmdBeginRenderPass and vkCmdNextSubpass emit only the clears needed for
that current subpass.

8 years agoanv/meta: Create 8 pipelines for color clears
Chad Versace [Thu, 14 Jan 2016 00:29:45 +0000 (16:29 -0800)]
anv/meta: Create 8 pipelines for color clears

This prepares for moving the clear ops from the start of the render pass
into each subpass.

Pipeline N will be used to clear color attachment N of the current
subpass. Currently meta color clears still create a throwaway subpass
with exactly one attachment, so currently only pipeline 0 is used.

This is an ugly hack to workaround the compiler's current inability to
dynamically set the render target index in the render target write
message.

8 years agoanv: Allow override of pipeline color attachment count
Chad Versace [Thu, 14 Jan 2016 02:24:18 +0000 (18:24 -0800)]
anv: Allow override of pipeline color attachment count

Add anv_graphics_pipeline_create_info::color_attachment_count. If
non-negative, then it overrides the color attachment count in the
pipeline's subpass. Useful for meta. (All the hacks for meta!)

8 years agoanv/meta: Name the nir shaders
Chad Versace [Thu, 14 Jan 2016 02:09:01 +0000 (18:09 -0800)]
anv/meta: Name the nir shaders

The names appear in debug output.

8 years agoanv: Move MAX_* defs to top of anv_private.h
Chad Versace [Thu, 14 Jan 2016 00:03:09 +0000 (16:03 -0800)]
anv: Move MAX_* defs to top of anv_private.h

Because I need to use MAX_RTS in struct anv_meta_state.

8 years agoanv: Define zero() macro
Chad Versace [Thu, 14 Jan 2016 00:24:14 +0000 (16:24 -0800)]
anv: Define zero() macro

zero(x) memsets x to zero. Eliminates bugs due to errors in memset's
size param.

8 years agoanv/meta: Rename emit_load_*_clear funcs
Chad Versace [Wed, 13 Jan 2016 22:09:36 +0000 (14:09 -0800)]
anv/meta: Rename emit_load_*_clear funcs

The functions will soon handle clears unrelated to
VK_ATTACHMENT_LOAD_OP_CLEAR, namely vkCmdClearAttachments. So remove
"load" from their name:

    emit_load_color_clear -> emit_color_clear
    emit_load_depthstencil_clear -> emit_depthstencil_clear

8 years agoanv/meta: Use anv_cmd_state::attachments for clears
Chad Versace [Wed, 13 Jan 2016 19:52:23 +0000 (11:52 -0800)]
anv/meta: Use anv_cmd_state::attachments for clears

Rewrite anv_cmd_buffer_clear_attachments, which emits the top-of-pass
clears, to use the data provided in anv_cmd_state::attachments. This
prepares for deferring each attachment clear to the first subpass that
uses the attachment.

8 years agoanv: Add anv_cmd_state::attachments
Chad Versace [Wed, 13 Jan 2016 19:28:35 +0000 (11:28 -0800)]
anv: Add anv_cmd_state::attachments

This array contains attachment state when recording a renderpass instance.
It's populated on each call to anv_cmd_buffer_set_pass.

The data is currently set but unused. We'll use it later to defer each
attachment clear to the subpass that first uses the attachment.

8 years agoi965/fs/generator: Change a comment as per jordan's suggestion
Jason Ekstrand [Fri, 15 Jan 2016 06:03:15 +0000 (22:03 -0800)]
i965/fs/generator: Change a comment as per jordan's suggestion

8 years agoi965/fs: Always set hannel 2 of texture headers in some stages
Jason Ekstrand [Fri, 15 Jan 2016 04:42:47 +0000 (20:42 -0800)]
i965/fs: Always set hannel 2 of texture headers in some stages

8 years agoi965/fs/generator: Take an actual shader stage rather than a string
Jason Ekstrand [Fri, 15 Jan 2016 04:27:51 +0000 (20:27 -0800)]
i965/fs/generator: Take an actual shader stage rather than a string

8 years agoanv/apply_pipeline_layout: Stomp texture array size to 1
Jason Ekstrand [Fri, 15 Jan 2016 02:58:25 +0000 (18:58 -0800)]
anv/apply_pipeline_layout: Stomp texture array size to 1

8 years agonir/spirv: Fix texture return types
Jason Ekstrand [Fri, 15 Jan 2016 02:40:35 +0000 (18:40 -0800)]
nir/spirv: Fix texture return types

We were just hard-coding everything to a vec4.  This meant we weren't
handling shadow samplers at all and integer things were getting the wrong
return type.

8 years agovk: Fix struct field indentation
Kristian Høgsberg Kristensen [Thu, 14 Jan 2016 23:18:40 +0000 (15:18 -0800)]
vk: Fix struct field indentation

8 years agoanv: Document anv_cmd_state::current_pipeline
Chad Versace [Thu, 14 Jan 2016 21:18:40 +0000 (13:18 -0800)]
anv: Document anv_cmd_state::current_pipeline

It's the value of PIPELINE_SELECT.PipelineSelection.

8 years agoanv: Make vkBeginCommandBuffer reset the command buffer
Chad Versace [Thu, 14 Jan 2016 21:12:35 +0000 (13:12 -0800)]
anv: Make vkBeginCommandBuffer reset the command buffer

If its the command buffer's first call to vkBeginCommandBuffer, we must
*initialize* the command buffer's state. Otherwise, we must *reset* its
state. In both cases, let's use anv_ResetCommandBuffer.

From the Vulkan 1.0 spec:

   If a command buffer is in the executable state and the command buffer
   was allocated from a command pool with the
   VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT flag set, then
   vkBeginCommandBuffer implicitly resets the command buffer, behaving
   as if vkResetCommandBuffer had been called with
   VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT not set. It then puts
   the command buffer in the recording state.

8 years agoanv: Add FIXME for vkResetCommandPool
Chad Versace [Thu, 14 Jan 2016 20:58:46 +0000 (12:58 -0800)]
anv: Add FIXME for vkResetCommandPool

vkResetCommandPool currently destroys its command buffers. The Vulkan
1.0 spec requires that it only reset them:

    Resetting a command pool recycles all of the resources from all of
    the command buffers allocated from the command pool back to the
    command pool. All command buffers that have been allocated from the
    command pool are put in the initial state.

8 years agoanv: Remove duplicate func prototype
Chad Versace [Thu, 14 Jan 2016 03:37:40 +0000 (19:37 -0800)]
anv: Remove duplicate func prototype

anv_private.h declared anv_cmd_buffer_begin_subpass twice.

8 years agoanv/meta: Add FINISHME for clearing multi-layer framebuffers
Chad Versace [Mon, 11 Jan 2016 23:05:47 +0000 (15:05 -0800)]
anv/meta: Add FINISHME for clearing multi-layer framebuffers

8 years agoi965/vec4: Use UW type for multiply into accumulator on GEN8+
Jason Ekstrand [Thu, 14 Jan 2016 20:04:20 +0000 (12:04 -0800)]
i965/vec4: Use UW type for multiply into accumulator on GEN8+

BDW adds the following restriction: "When multiplying DW x DW, the dst
cannot be accumulator."