Commit graph

77403 commits

Author SHA1 Message Date
Kenneth Graunke
68c9ca1a94 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.
2016-01-19 16:14:05 -08:00
Kenneth Graunke
2ab3efa0ad nir/spirv/glsl450: Implement Atan. 2016-01-19 16:14:05 -08:00
Kenneth Graunke
bc9d9bc2e3 nir/spirv/glsl450: Implement Asin and Acos. 2016-01-19 16:14:05 -08:00
Jason Ekstrand
5e57a87dcf anv/pipeline: Fix point size 2016-01-19 12:03:13 -08:00
Jason Ekstrand
3276610ea6 getX/state: Set LOD pre-clamp to OpenGL mode
This gets us another couple hundred sampler tests
2016-01-18 17:51:35 -08:00
Jason Ekstrand
580b2e85e4 isl/device: Add a flag for bit 6 swizzling 2016-01-18 17:21:05 -08:00
Jason Ekstrand
587842a0ca anv/gem: Add a helper for getting bit6 swizzling information 2016-01-18 17:21:05 -08:00
Jason Ekstrand
c2a6f4302e nir/spirv: Patch through image qualifiers 2016-01-18 17:21:05 -08:00
Jason Ekstrand
56c8a5f2b8 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.
2016-01-18 17:21:05 -08:00
Jason Ekstrand
bb8cadd169 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.
2016-01-18 17:21:05 -08:00
Jason Ekstrand
6f956b0b22 anv/meta: Improve meta clear cleanup a bit 2016-01-18 14:07:46 -08:00
Jason Ekstrand
45d17fcf9b anv: Misc allocation scope fixes 2016-01-18 14:04:13 -08:00
Jason Ekstrand
378af64e30 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.
2016-01-18 14:03:24 -08:00
Jason Ekstrand
3dfa6a881c anv/meta: Initialize a handle to null 2016-01-18 13:05:02 -08:00
Jason Ekstrand
d49298c702 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.
2016-01-18 12:16:31 -08:00
Jason Ekstrand
bfcc744892 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.
2016-01-18 11:35:04 -08:00
Jason Ekstrand
5a67df2546 anv/pack: Make TextureLODBias a proper 4.8 float
XXX: We need to update the generators so this doesn't get stompped.
2016-01-18 10:36:53 -08:00
Jason Ekstrand
15e6af0708 nir/spirv: Handle if's where the merge is also a break or continue 2016-01-18 10:10:47 -08:00
Jason Ekstrand
14ebd0fdd7 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.
2016-01-18 09:43:12 -08:00
Jason Ekstrand
61ba97522e nir/lower_returns: Repair SSA after doing return lowering 2016-01-18 09:43:12 -08:00
Jason Ekstrand
b11825590d nir: Add a pass to repair SSA form 2016-01-18 09:43:12 -08:00
Jason Ekstrand
a7a5e8a2de 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.
2016-01-18 09:18:42 -08:00
Jason Ekstrand
8aab4a7bd2 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.
2016-01-18 09:18:42 -08:00
Jason Ekstrand
b1f1200e80 util/bitset: Allow iterating over const bitsets 2016-01-18 09:18:42 -08:00
Jason Ekstrand
f509a89082 nir/lower_system_values: Lower vertexID to id+base if needed 2016-01-15 16:15:50 -08:00
Jason Ekstrand
6b64dddd71 anv/batch_chain: Remove padding from the BO before emitting BUFFER_END 2016-01-15 15:59:58 -08:00
Jason Ekstrand
67bf74f020 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.
2016-01-15 15:49:32 -08:00
Jason Ekstrand
117cac75d0 nir/spirv: Stop trusting the SPIR-V for the number of texture coordinates 2016-01-15 11:13:51 -08:00
Chad Versace
0e420cb67f 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.
2016-01-15 11:00:22 -08:00
Chad Versace
eab6212efd anv/meta: Stop leaking renderpass and framebuffer 2016-01-15 10:14:07 -08:00
Chad Versace
482a1f5eab 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.
2016-01-15 07:46:10 -08:00
Chad Versace
1afe33f8b3 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.
2016-01-14 22:53:05 -08:00
Chad Versace
842b424d3b anv/meta: Implement vkCmdClearDepthStencilImage 2016-01-14 22:53:05 -08:00
Chad Versace
e4b17a2e1a anv/meta: Implement vkCmdClearAttachments 2016-01-14 22:53:05 -08:00
Chad Versace
0038ae2e4a anv/meta: Add VkClearRect param to emit_clear()
Prepares for vkCmdClearAttachments.
2016-01-14 22:53:05 -08:00
Chad Versace
11f5433715 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.
2016-01-14 22:53:05 -08:00
Chad Versace
deb8dd89b5 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.
2016-01-14 22:53:05 -08:00
Chad Versace
0679bef49f 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.
2016-01-14 22:53:05 -08:00
Chad Versace
2997b0da4a 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!)
2016-01-14 22:53:05 -08:00
Chad Versace
13610c03a7 anv/meta: Name the nir shaders
The names appear in debug output.
2016-01-14 22:53:05 -08:00
Chad Versace
6a1a760e3c anv: Move MAX_* defs to top of anv_private.h
Because I need to use MAX_RTS in struct anv_meta_state.
2016-01-14 22:53:05 -08:00
Chad Versace
4c2bafb9bf anv: Define zero() macro
zero(x) memsets x to zero. Eliminates bugs due to errors in memset's
size param.
2016-01-14 22:53:05 -08:00
Chad Versace
f2700d665c 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
2016-01-14 22:53:05 -08:00
Chad Versace
356f952f87 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.
2016-01-14 22:53:05 -08:00
Chad Versace
a4b045ca44 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.
2016-01-14 22:53:05 -08:00
Jason Ekstrand
5d1c2736b6 i965/fs/generator: Change a comment as per jordan's suggestion 2016-01-14 22:03:15 -08:00
Jason Ekstrand
6be517b20e i965/fs: Always set hannel 2 of texture headers in some stages 2016-01-14 20:42:47 -08:00
Jason Ekstrand
e1d13cd058 i965/fs/generator: Take an actual shader stage rather than a string 2016-01-14 20:27:56 -08:00
Jason Ekstrand
47af950df5 anv/apply_pipeline_layout: Stomp texture array size to 1 2016-01-14 18:58:25 -08:00
Jason Ekstrand
6483d3f8fe 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.
2016-01-14 18:48:57 -08:00