mesa.git
9 years agovk/pipeline: Emit MSAA finishme only if samples > 1
Chad Versace [Wed, 7 Oct 2015 01:55:16 +0000 (18:55 -0700)]
vk/pipeline: Emit MSAA finishme only if samples > 1

If samples == 1, then there's nothing for Mesa to do, and the finishme
message is only noise.

9 years agovk: Remove stale finishme for stencil image views
Chad Versace [Wed, 7 Oct 2015 01:53:29 +0000 (18:53 -0700)]
vk: Remove stale finishme for stencil image views

They don't work completely. But they work well enough to satisfy
Crucible.

9 years agovk: Add anv_image::usage
Chad Versace [Wed, 7 Oct 2015 01:17:09 +0000 (18:17 -0700)]
vk: Add anv_image::usage

It's a copy of VkImageCreateInfo::usage. Will be used for the
VkAttachmentView/VkImageView merge.

9 years agovk/meta: Fix usage flags for image-wrapped-buffers
Chad Versace [Wed, 7 Oct 2015 01:34:37 +0000 (18:34 -0700)]
vk/meta: Fix usage flags for image-wrapped-buffers

In make_image_for_buffer(), use VK_IMAGE_USAGE_SAMPLED_BIT when
transferring from the buffer and use VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
when transferring to the buffer.

9 years agovk/image: Remove stale anv_asserts for depthstencil attachments
Chad Versace [Wed, 7 Oct 2015 01:18:47 +0000 (18:18 -0700)]
vk/image: Remove stale anv_asserts for depthstencil attachments

We don't fully handle mipmapped, array depthstencil attachments. But we
handle the well enough for Crucible's miptree tests.

9 years agonir/spirv: Better texture handling
Jason Ekstrand [Tue, 6 Oct 2015 22:10:45 +0000 (15:10 -0700)]
nir/spirv: Better texture handling

9 years agonir/spirv: Update to SPIR-V Rev. 32
Jason Ekstrand [Tue, 6 Oct 2015 21:44:38 +0000 (14:44 -0700)]
nir/spirv: Update to SPIR-V Rev. 32

9 years agovk/0.170.2: Fairly trivial enum shuffling
Jason Ekstrand [Tue, 6 Oct 2015 17:34:59 +0000 (10:34 -0700)]
vk/0.170.2: Fairly trivial enum shuffling

9 years agovk/0.170.2: s/baseArraySlice/baseArrayLayer/
Jason Ekstrand [Tue, 6 Oct 2015 17:27:50 +0000 (10:27 -0700)]
vk/0.170.2: s/baseArraySlice/baseArrayLayer/

9 years agovk: Merge anv_attachment_view into anv_image_view
Chad Versace [Tue, 6 Oct 2015 18:42:43 +0000 (11:42 -0700)]
vk: Merge anv_attachment_view into anv_image_view

This prepares for merging VkAttachmentView into VkImageView.

9 years agovk: Update comments for anv_image_view
Chad Versace [Tue, 6 Oct 2015 01:13:48 +0000 (18:13 -0700)]
vk: Update comments for anv_image_view

- Document the extent member. It's the extent of the view's base level.
- s/VkAttachmentView/VkImageView/

9 years agovk/0.170.2: Add a stage field to ShaderCreateInfo
Jason Ekstrand [Tue, 6 Oct 2015 17:20:10 +0000 (10:20 -0700)]
vk/0.170.2: Add a stage field to ShaderCreateInfo

9 years agovk/0.170.2: Rename cs to stage in ComputePipelineCreateInfo
Jason Ekstrand [Tue, 6 Oct 2015 17:11:50 +0000 (10:11 -0700)]
vk/0.170.2: Rename cs to stage in ComputePipelineCreateInfo

9 years agovk/0.170.2: Use ImageSubresourceCopy in ImageResolve
Jason Ekstrand [Tue, 6 Oct 2015 17:09:47 +0000 (10:09 -0700)]
vk/0.170.2: Use ImageSubresourceCopy in ImageResolve

9 years agovk/0.170.2: Rename fields in VkClearColorValue
Jason Ekstrand [Tue, 6 Oct 2015 17:07:47 +0000 (10:07 -0700)]
vk/0.170.2: Rename fields in VkClearColorValue

9 years agovk/0.170.2: Rework blits to use ImageSubresourceCopy
Jason Ekstrand [Tue, 6 Oct 2015 17:04:04 +0000 (10:04 -0700)]
vk/0.170.2: Rework blits to use ImageSubresourceCopy

9 years agovulkan.h: Move stuff around
Jason Ekstrand [Tue, 6 Oct 2015 16:50:01 +0000 (09:50 -0700)]
vulkan.h: Move stuff around

This has no functional change but substantially decreases the diff with the
0.170.2 header.

9 years agovk/0.170.2: Rework parameters to CmdClearDepthStencil functions
Jason Ekstrand [Tue, 6 Oct 2015 16:40:39 +0000 (09:40 -0700)]
vk/0.170.2: Rework parameters to CmdClearDepthStencil functions

9 years agovk/0.170.2: Add the flags parameter to GetPhysicalDeviceImageFormatProperties
Jason Ekstrand [Tue, 6 Oct 2015 16:37:21 +0000 (09:37 -0700)]
vk/0.170.2: Add the flags parameter to GetPhysicalDeviceImageFormatProperties

9 years agovk/0.170.2: Remove the pCount parameter from AllocDescriptorSets
Jason Ekstrand [Tue, 6 Oct 2015 16:32:01 +0000 (09:32 -0700)]
vk/0.170.2: Remove the pCount parameter from AllocDescriptorSets

9 years agovk/0.170.2: Rename extension and layer query functions
Jason Ekstrand [Tue, 6 Oct 2015 16:25:03 +0000 (09:25 -0700)]
vk/0.170.2: Rename extension and layer query functions

9 years agovk/0.170.2: Update to the new queue family properties query
Jason Ekstrand [Tue, 6 Oct 2015 04:17:12 +0000 (21:17 -0700)]
vk/0.170.2: Update to the new queue family properties query

9 years agovk/0.170.2: Re-arrange parameters of vkCmdDraw[Indexed]
Jason Ekstrand [Tue, 6 Oct 2015 04:10:20 +0000 (21:10 -0700)]
vk/0.170.2: Re-arrange parameters of vkCmdDraw[Indexed]

9 years agovk/0.170.2: Make destructors return void
Jason Ekstrand [Tue, 6 Oct 2015 03:50:51 +0000 (20:50 -0700)]
vk/0.170.2: Make destructors return void

9 years agovk/0.170.2: Rename VkClearValue.ds to depthStencil
Jason Ekstrand [Tue, 6 Oct 2015 03:35:08 +0000 (20:35 -0700)]
vk/0.170.2: Rename VkClearValue.ds to depthStencil

9 years agovk/0.170.2: Add the subpass field to VkCmdBufferBeginInfo
Jason Ekstrand [Tue, 6 Oct 2015 03:30:53 +0000 (20:30 -0700)]
vk/0.170.2: Add the subpass field to VkCmdBufferBeginInfo

9 years agovk/0.170.2: Rename pointer parameters of VkSubpassDescription
Jason Ekstrand [Tue, 6 Oct 2015 03:26:21 +0000 (20:26 -0700)]
vk/0.170.2: Rename pointer parameters of VkSubpassDescription

9 years agovk/0.170.2: Add unnormalizedCoordinates to VkSamplerCreateInfo
Jason Ekstrand [Tue, 6 Oct 2015 03:17:24 +0000 (20:17 -0700)]
vk/0.170.2: Add unnormalizedCoordinates to VkSamplerCreateInfo

9 years agovk/0.170.2: Rename VkTexAddress to VkTexAddressMode
Jason Ekstrand [Tue, 6 Oct 2015 03:15:06 +0000 (20:15 -0700)]
vk/0.170.2: Rename VkTexAddress to VkTexAddressMode

9 years agovulkan.h: Various cosmetic changes
Jason Ekstrand [Tue, 6 Oct 2015 03:06:05 +0000 (20:06 -0700)]
vulkan.h: Various cosmetic changes

These don't affect the driver in any way.

9 years agovk: Merge anv_*_attachment_view into anv_attachment_view
Chad Versace [Tue, 6 Oct 2015 00:27:38 +0000 (17:27 -0700)]
vk: Merge anv_*_attachment_view into anv_attachment_view

Remove anv_color_attachment_view and anv_depth_stencil_view, merging
them into anv_attachment_view. This prepares for merging
VkAttachmentView into VkImageView.

9 years agovk: Drop anv_attachment_view::extent
Chad Versace [Mon, 5 Oct 2015 23:58:25 +0000 (16:58 -0700)]
vk: Drop anv_attachment_view::extent

It's duplicated by anv_attachment_view::image_view::extent.

9 years agovk: Drop anv_surface_view
Chad Versace [Mon, 5 Oct 2015 23:24:53 +0000 (16:24 -0700)]
vk: Drop anv_surface_view

Push the members of struct anv_surface_view into anv_image_view and
anv_buffer_view, then remove struct anv_surface_view. Observe that
anv_surface_view::range is not needed for anv_image_view, and so was
dropped there.

This prepares for the merge of VkAttachmentView into VkImageView. Remove
the common parent of anv_buffer_view and anv_image_view (that is,
anv_surface_view) will make the merge easier.

9 years agovk: Use consistent names for anv_*_view variables
Chad Versace [Mon, 5 Oct 2015 22:49:10 +0000 (15:49 -0700)]
vk: Use consistent names for anv_*_view variables

Rename all anv_*_view variables to follow this convention:
    - sview -> anv_surface_view
    - bview -> anv_buffer_view
    - iview -> anv_image_view
    - aview -> anv_attachment_view
    - cview -> anv_color_attachment_view
    - ds_view -> anv_depth_stencil_attachment_view

This clarifies existing code. And it will reduce noise in the upcoming
commits that merge VkAttachmentView into VkImageView.

9 years agovk: Unionize anv_desciptor
Chad Versace [Mon, 5 Oct 2015 21:43:23 +0000 (14:43 -0700)]
vk: Unionize anv_desciptor

For a given struct anv_descriptor, all members are NULL (in which case
the descriptor is empty) or exactly one member is non-NULL.
To make struct anv_descriptor better reflect its set of valid states,
convert the struct into a tagged union.

9 years agovk: Drop dependency on no longer extant header
Chad Versace [Tue, 6 Oct 2015 00:02:42 +0000 (17:02 -0700)]
vk: Drop dependency on no longer extant header

anv_meta no longer uses GLSL shaders, and the build system no longer
converts them to SPIR-V. So remove anv_meta_spirv_autogen.h from
Makefile.am.

(cherry picked from commit 2fc8122f66331e76ac436ea77ad5b57a011b188a)

9 years agovk: Return anv_image_view_info by value
Chad Versace [Mon, 5 Oct 2015 20:22:44 +0000 (13:22 -0700)]
vk: Return anv_image_view_info by value

The struct is only 2 bytes. Returning it on the stack is better than
returning a reference into the ELF .data segment.

9 years agovk/image: Document a Vulkan spec requirement for depthstencil
Chad Versace [Mon, 5 Oct 2015 20:17:39 +0000 (13:17 -0700)]
vk/image: Document a Vulkan spec requirement for depthstencil

The Vulkan spec (git a511ba2) requires support for some combined depth
stencil formats.

9 years agovk: Annotate anv_cmd_state::gen7::index_type
Chad Versace [Mon, 5 Oct 2015 15:58:35 +0000 (08:58 -0700)]
vk: Annotate anv_cmd_state::gen7::index_type

It's the value of 3DSTATE_INDEX_BUFFER.IndexFormat.

9 years agovk: Better types for VkShaderStage, VkShaderStageFlags vars
Chad Versace [Mon, 5 Oct 2015 15:52:42 +0000 (08:52 -0700)]
vk: Better types for VkShaderStage, VkShaderStageFlags vars

In most places, the variable type was the uninformative uint32_t.

9 years agovk/0.170.2: Drop VK_BUFFER_USAGE_GENERAL
Chad Versace [Mon, 5 Oct 2015 14:18:46 +0000 (07:18 -0700)]
vk/0.170.2: Drop VK_BUFFER_USAGE_GENERAL

9 years agovk/0.170.2: Drop enum VkBufferViewType
Chad Versace [Mon, 5 Oct 2015 14:17:07 +0000 (07:17 -0700)]
vk/0.170.2: Drop enum VkBufferViewType

9 years agovk/0.170.2: Update VkImageSubresourceRange
Chad Versace [Mon, 5 Oct 2015 13:48:14 +0000 (06:48 -0700)]
vk/0.170.2: Update VkImageSubresourceRange

Replace 'aspect' with 'aspectMask'.

9 years agovk/0.170.2: Drop VK_IMAGE_USAGE_GENERAL
Chad Versace [Mon, 5 Oct 2015 13:44:30 +0000 (06:44 -0700)]
vk/0.170.2: Drop VK_IMAGE_USAGE_GENERAL

9 years agovk/0.170.2: Update VkPipelineMultisampleStateCreateInfo
Chad Versace [Sun, 4 Oct 2015 17:00:25 +0000 (10:00 -0700)]
vk/0.170.2: Update VkPipelineMultisampleStateCreateInfo

9 years agovk/0.170.2: Update Vk VkPipelineDepthStencilStateCreateInfo
Chad Versace [Sun, 4 Oct 2015 16:41:22 +0000 (09:41 -0700)]
vk/0.170.2: Update Vk VkPipelineDepthStencilStateCreateInfo

Rename member depthBoundsEnable -> depthBoundsTestEnable.

9 years agovk/0.170.2: Update VkRenderPassBeginInfo
Chad Versace [Sun, 4 Oct 2015 16:26:25 +0000 (09:26 -0700)]
vk/0.170.2: Update VkRenderPassBeginInfo

Rename members:
    attachmentCount -> clearValueCount
    pAttachmentClearValues -> pClearValues

9 years agovk/0.170.2: Drop VkBufferViewCreateInfo::viewType
Chad Versace [Sun, 4 Oct 2015 16:14:57 +0000 (09:14 -0700)]
vk/0.170.2: Drop VkBufferViewCreateInfo::viewType

9 years agovk: Copy current header to vulkan-0.138.2.h
Chad Versace [Sun, 4 Oct 2015 16:03:13 +0000 (09:03 -0700)]
vk: Copy current header to vulkan-0.138.2.h

While upgrading Mesa to the new 0.170.2 API, it's convenient to have all
three headers available in the tree:
    - vulkan-0.138.2.h, the old one
    - vulkan-0.170.2.h, the new one
    - vulkan.h, the one in transition

9 years agovk: Import header 0.170.2 header LunarG SDK
Chad Versace [Sun, 4 Oct 2015 16:01:12 +0000 (09:01 -0700)]
vk: Import header 0.170.2 header LunarG SDK

From the LunarG SDK at tag sdk-0.9.1, import vulkan.h as
vulkan-0.170.2.h. This header is the first provisional header with the
addition of minor fixes.

9 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Sat, 3 Oct 2015 18:32:29 +0000 (11:32 -0700)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

9 years agodocs: add news item and link release notes for 10.6.9
Emil Velikov [Sat, 3 Oct 2015 12:23:13 +0000 (13:23 +0100)]
docs: add news item and link release notes for 10.6.9

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: add sha256 checksums for 10.6.9
Emil Velikov [Sat, 3 Oct 2015 12:16:18 +0000 (13:16 +0100)]
docs: add sha256 checksums for 10.6.9

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 8957b696f9cc8a92b2c160c551c34545447ec28a)

9 years agodocs: add release notes for 10.6.9
Emil Velikov [Sat, 3 Oct 2015 11:37:15 +0000 (12:37 +0100)]
docs: add release notes for 10.6.9

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit ab9aacce2d26a802bac81fc25748320428996692)

9 years agoegl: rework handling EGL_CONTEXT_FLAGS
Matthew Waters [Mon, 14 Sep 2015 17:35:45 +0000 (18:35 +0100)]
egl: rework handling EGL_CONTEXT_FLAGS

As of version 15 of the EGL_KHR_create_context spec, debug contexts
are allowed for ES contexts.  We should allow creation instead of
erroring.

While we're here provide a more comprehensive checking for the other two
flags - ROBUST_ACCESS_BIT_KHR and FORWARD_COMPATIBLE_BIT_KHR

v2 [Emil Velikov] Rebase. Minor tweak in commit message.

Cc: Boyan Ding <boyan.j.ding@gmail.com>
Cc: Chad Versace <chad.versace@intel.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91044
Signed-off-by: Matthew Waters <ystreet00@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965/wm: Make compute_barycentric_interp_modes take a nir_shader and a devinfo
Jason Ekstrand [Sat, 3 Oct 2015 01:31:17 +0000 (18:31 -0700)]
i965/wm: Make compute_barycentric_interp_modes take a nir_shader and a devinfo

Now that everything comes in through NIR, we can pick this directly out of
the shader source and don't need to reference the gl_fragment_program.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Use nir_foreach_variable
Jason Ekstrand [Sat, 3 Oct 2015 01:16:10 +0000 (18:16 -0700)]
i965: Use nir_foreach_variable

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Add a nir_foreach_variable macro
Jason Ekstrand [Sat, 3 Oct 2015 01:15:06 +0000 (18:15 -0700)]
nir: Add a nir_foreach_variable macro

This is a common enough operation that it's nice to not have to think about
the arguments to foreach_list_typed every time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/nir: Remove the prog parameter from brw_nir_lower_inputs
Jason Ekstrand [Fri, 2 Oct 2015 23:39:51 +0000 (16:39 -0700)]
i965/nir: Remove the prog parameter from brw_nir_lower_inputs

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoMerge remote-tracking branch 'mesa-public/master' into vulkan
Jason Ekstrand [Fri, 2 Oct 2015 23:45:48 +0000 (16:45 -0700)]
Merge remote-tracking branch 'mesa-public/master' into vulkan

9 years agoradeon/llvm: Initialize gallivm targets when initializing the AMDGPU target v2
Tom Stellard [Thu, 24 Sep 2015 16:29:56 +0000 (16:29 +0000)]
radeon/llvm: Initialize gallivm targets when initializing the AMDGPU target v2

This fixes a race condition in the glx-multithreaded-shader-compile
test.

v2:
  - Replace gallivm_init_llvm_{begin,end}() with gallivm_init_llvm_targets().

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agogallivm: Allow drivers and state trackers to initialize gallivm LLVM targets v2
Tom Stellard [Thu, 24 Sep 2015 15:57:02 +0000 (15:57 +0000)]
gallivm: Allow drivers and state trackers to initialize gallivm LLVM targets v2

Drivers and state trackers that use LLVM for generating code, must
register the targets they use with LLVM's global TargetRegistry.
The TargetRegistry is not thread-safe, so all targets must be added
to the registry before it can be queried for target information.

When drivers and state trackers initialize their own targets, they need
a way to force gallivm to initialize its targets at the same time.
Otherwise, there can be a race condition in some multi-threaded
applications (e.g. glx-multihreaded-shader-compile in piglit),
when one thread creates a context for a driver that uses LLVM (e.g.
radeonsi) and another thread creates a gallivm context (glxContextCreate
does this).

The race happens when the driver thread initializes its LLVM targets and
then starts using the registry before the gallivm thread has a chance to
register its targets.

This patch allows users to force gallivm to register its targets by
calling the gallivm_init_llvm_targets() function.

v2:
  - Use call_once and remove mutexes and static initializations.
  - Replace gallivm_init_llvm_{begin,end}() with
    gallivm_init_llvm_targets().

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoanv/allocator: Add a sanity assertion in state stream finish.
Jason Ekstrand [Fri, 2 Oct 2015 23:24:42 +0000 (16:24 -0700)]
anv/allocator: Add a sanity assertion in state stream finish.

We assert that the block offset we got while walking the list of blocks is
actually a multiple of the block size.  If something goes wrong and the GPU
decides to stomp on the surface state buffer we can end up getting
corruptions in our list of blocks.  This assertion makes such corruptions a
crash with a meaningful message rather than an infinite loop.

9 years agoanv: Remove the GLSL -> SPIR-V scraper/converter
Jason Ekstrand [Fri, 2 Oct 2015 23:20:02 +0000 (16:20 -0700)]
anv: Remove the GLSL -> SPIR-V scraper/converter

This was very useful to get us up-and-going.  However, now that we can use
NIR directly for meta shaders, we don't need this anymore and we might as
well drop the glslc dependency.

9 years agogallium/radeon: Use call_once() when initailizing LLVM targets
Tom Stellard [Wed, 30 Sep 2015 15:00:39 +0000 (15:00 +0000)]
gallium/radeon: Use call_once() when initailizing LLVM targets

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoanv/meta: Use NIR directly for blit shaders
Jason Ekstrand [Fri, 2 Oct 2015 23:18:44 +0000 (16:18 -0700)]
anv/meta: Use NIR directly for blit shaders

9 years agoanv/meta: Use NIR directly for clear shaders
Jason Ekstrand [Fri, 2 Oct 2015 23:18:32 +0000 (16:18 -0700)]
anv/meta: Use NIR directly for clear shaders

9 years agoanv: Add a back-door for passing NIR shaders directly into the pipeline
Jason Ekstrand [Fri, 2 Oct 2015 23:16:57 +0000 (16:16 -0700)]
anv: Add a back-door for passing NIR shaders directly into the pipeline

This will allow us to use NIR directly for meta operations rather than
having to go through SPIR-V.

9 years agoanv: Add some NIR builder helpers
Jason Ekstrand [Fri, 2 Oct 2015 23:15:51 +0000 (16:15 -0700)]
anv: Add some NIR builder helpers

These should all eventually be up-streamed.  However, since they currently
have no upstream users, they would just bitrot there.  We'll keep them
local for the time being.

9 years agoi965/shader: Get rid of the shader, prog, and shader_prog fields
Jason Ekstrand [Thu, 1 Oct 2015 22:21:57 +0000 (15:21 -0700)]
i965/shader: Get rid of the shader, prog, and shader_prog fields

Unfortunately, we can't get rid of them entirely.  The FS backend still
needs gl_program for handling TEXTURE_RECTANGLE.  The GS vec4 backend still
needs gl_shader_program for handling transfom feedback.  However, the VS
needs neither and we can substantially reduce the amount they are used.
One day we will be free from their tyranny.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs,vec4: Get rid of the sanity_param_count
Jason Ekstrand [Fri, 2 Oct 2015 01:15:21 +0000 (18:15 -0700)]
i965/fs,vec4: Get rid of the sanity_param_count

It doesn't exist for anything other than an assert that, as far as I can
tell, isn't possible to trip.  Soon, we will remove prog from the visitor
entirely and this will become even more impossible to hit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/vec4: Use nir info instead of pulling things out of [shader_]prog
Jason Ekstrand [Thu, 1 Oct 2015 22:22:23 +0000 (15:22 -0700)]
i965/vec4: Use nir info instead of pulling things out of [shader_]prog

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Use the nir info instead of pulling things out of [shader_]prog
Jason Ekstrand [Thu, 1 Oct 2015 22:12:59 +0000 (15:12 -0700)]
i965/fs: Use the nir info instead of pulling things out of [shader_]prog

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Move sampler unit lookup into rescale_texcoord
Jason Ekstrand [Thu, 1 Oct 2015 23:38:59 +0000 (16:38 -0700)]
i965/fs: Move sampler unit lookup into rescale_texcoord

The texunit variable we create and assign in nir_emit_texture gets passed
through two more layers of function calls before it gets to its sole use in
rescale_texcoord.  The best part is that we already pass the sampler into
rescale_texcoord so we can just look it up there.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cs: Remove the prog argument from local_id_payload_dwords
Jason Ekstrand [Thu, 1 Oct 2015 20:52:21 +0000 (13:52 -0700)]
i965/cs: Remove the prog argument from local_id_payload_dwords

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/backend_shader: Add a field to store the NIR shader
Jason Ekstrand [Thu, 1 Oct 2015 19:23:53 +0000 (12:23 -0700)]
i965/backend_shader: Add a field to store the NIR shader

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Move GS data to nir_shader_info
Jason Ekstrand [Fri, 2 Oct 2015 01:27:38 +0000 (18:27 -0700)]
nir: Move GS data to nir_shader_info

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Add a a nir_shader_info struct
Jason Ekstrand [Thu, 6 Aug 2015 00:14:59 +0000 (17:14 -0700)]
nir: Add a a nir_shader_info struct

This commit also adds code to glsl_to_nir and prog_to_nir to fill it out.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/glsl: Take a gl_shader_program and a stage rather than a gl_shader
Jason Ekstrand [Wed, 5 Aug 2015 23:39:32 +0000 (16:39 -0700)]
nir/glsl: Take a gl_shader_program and a stage rather than a gl_shader

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Move prog_data uniform setup to the codegen level
Jason Ekstrand [Thu, 1 Oct 2015 00:01:03 +0000 (17:01 -0700)]
i965: Move prog_data uniform setup to the codegen level

As of now, uniform setup is more-or-less unified between vec4 and fs and no
longer requires the fs_visitor.  This makes uniform setup more of a
language/API thing than a backend compiler thing.  This commit moves
setting up the stage_prog_data.params arrays to the same place as we set up
the rest of stage_prog_data.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Move binding table setup to codegen time.
Jason Ekstrand [Thu, 1 Oct 2015 15:55:20 +0000 (08:55 -0700)]
i965: Move binding table setup to codegen time.

Setting up binding tables really has little to do with the actual process
of turning shaders into instructions; it's more part of setting up
prog_data.  This commit moves it out of the visitors and with the rest of
the prog_data setup stuff.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/shader: Pull assign_common_binding_table_offsets out of backend_shader
Jason Ekstrand [Thu, 1 Oct 2015 15:30:56 +0000 (08:30 -0700)]
i965/shader: Pull assign_common_binding_table_offsets out of backend_shader

This really has nothing to do with the backend compiler and we'd like to
eventually be able to set this up earlier in the compile process.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/nir: Simplify uniform setup
Jason Ekstrand [Thu, 1 Oct 2015 00:37:36 +0000 (17:37 -0700)]
i965/nir: Simplify uniform setup

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/nir: Pull GLSL uniform handling into a common function
Jason Ekstrand [Fri, 2 Oct 2015 17:45:53 +0000 (10:45 -0700)]
i965/nir: Pull GLSL uniform handling into a common function

The way we deal with GLSL uniforms and builtins is basically the same in
both the vec4 and the fs backend.  This commit takes the best parts of both
implementations and pulls the common code into a shared helper function.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/nir: Pull common ARB program uniform handling into a common function
Jason Ekstrand [Tue, 29 Sep 2015 21:07:20 +0000 (14:07 -0700)]
i965/nir: Pull common ARB program uniform handling into a common function

The way we deal with ARB program uniforms is basically the same in both the
vec4 and the fs backend.  This commit takes the best parts of both
implementations and pulls the common code into a shared helper function.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Use the uniform count from nir_assign_var_locations
Jason Ekstrand [Wed, 30 Sep 2015 20:11:23 +0000 (13:11 -0700)]
i965/vec4: Use the uniform count from nir_assign_var_locations

Previously, we were counting up uniforms as we set them up.  However, this
count should be exactly identical to shader->num_uniforms provided by
nir_assign_var_locations.  (If it's not, we're in trouble anyway because
that means that locations don't match up.)  This matches what the fs
backend is already doing.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/shader: Get rid of the setup_vec4_uniform_value helper
Jason Ekstrand [Wed, 30 Sep 2015 18:47:01 +0000 (11:47 -0700)]
i965/shader: Get rid of the setup_vec4_uniform_value helper

It's not used by anything anymore

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/shader: Pull setup_image_uniform_values out of backend_shader
Jason Ekstrand [Wed, 30 Sep 2015 18:46:36 +0000 (11:46 -0700)]
i965/shader: Pull setup_image_uniform_values out of backend_shader

I tried to do this once before but Curro pointed out that having it in
backend_shader meant it could use the setup_vec4_uniform_values helper
which did different things in vec4 and fs.  Now the setup_uniform_values
function differs only by an assert in the two backends so there's no real
good reason to be using it anymore.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Get rid of the uniform_vector_size array
Jason Ekstrand [Wed, 30 Sep 2015 18:02:14 +0000 (11:02 -0700)]
i965/vec4: Get rid of the uniform_vector_size array

The uniform_vector_size array was only ever used by pack_uniform_registers
which no longer needs it.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Use the actual channels used in pack_uniform_registers
Jason Ekstrand [Wed, 30 Sep 2015 17:31:03 +0000 (10:31 -0700)]
i965/vec4: Use the actual channels used in pack_uniform_registers

Previously, pack_uniform_registers worked based on the size of the uniform
as given to us when we initially set up the uniforms.  However, we have to
walk through the uniforms and figure out liveness anyway, so we migh as
well record the number of channels used as we go.  This may also allow us
to pack things tighter in a few cases.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoglsl/types: Make subroutine types have a single matrix column
Jason Ekstrand [Wed, 30 Sep 2015 22:19:49 +0000 (15:19 -0700)]
glsl/types: Make subroutine types have a single matrix column

That way, if we do the usual thing of multiplying vector_elements by
matrix_columns we get the actual number of components in the type as per
component_slots().

While we're at it, we also switch to using the actual C++ field
initializers for vector_elements and matrix_columns.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Pull stage_prog_data.nr_params out of the NIR shader
Jason Ekstrand [Wed, 30 Sep 2015 23:09:01 +0000 (16:09 -0700)]
i965: Pull stage_prog_data.nr_params out of the NIR shader

Previously, we had a bunch of code in each stage to figure out how many
slots we needed in stage_prog_data.param.  This code was mostly identical
across the stages and had been copied and pasted around.  Unfortunately,
this meant that any time you did something special, you had to add code for
it to each of these places.  In particular, none of the stages took
subroutines into account; they were working entirely by accident.  By
taking this data from the NIR shader, we know the exact number of entries
we need and everything goes a bit smoother.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vs: Move lazy NIR creation to codegen_vs_prog
Jason Ekstrand [Wed, 30 Sep 2015 23:06:43 +0000 (16:06 -0700)]
i965/vs: Move lazy NIR creation to codegen_vs_prog

The next commit will add code to codegen_vs_prog that requires the NIR
shader to be there in all cases.  It doesn't hurt anything to just move it
from brw_vs_emit to its only caller.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Delete the old vec4_vp code
Jason Ekstrand [Mon, 21 Sep 2015 18:07:32 +0000 (11:07 -0700)]
i965/vec4: Delete the old vec4_vp code

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Delete the old ir_visitor code
Jason Ekstrand [Mon, 21 Sep 2015 18:03:29 +0000 (11:03 -0700)]
i965/vec4: Delete the old ir_visitor code

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Always use NIR
Jason Ekstrand [Mon, 21 Sep 2015 17:42:19 +0000 (10:42 -0700)]
i965/vec4: Always use NIR

GLSL IR vs. NIR shader-db results for vec4 programs on i965:

   total instructions in shared programs: 1499328 -> 1388354 (-7.40%)
   instructions in affected programs:     1245199 -> 1134225 (-8.91%)
   helped:                                7469
   HURT:                                  2440

GLSL IR vs. NIR shader-db results for vec4 programs on G4x:

   total instructions in shared programs: 1436799 -> 1325825 (-7.72%)
   instructions in affected programs:     1205599 -> 1094625 (-9.20%)
   helped:                                7469
   HURT:                                  2440

GLSL IR vs. NIR shader-db results for vec4 programs on Iron Lake:

   total instructions in shared programs: 1436654 -> 1325682 (-7.72%)
   instructions in affected programs:     1205503 -> 1094531 (-9.21%)
   helped:                                7468
   HURT:                                  2440

GLSL IR vs. NIR shader-db results for vec4 programs on Sandy Bridge:

   total instructions in shared programs: 2016249 -> 1787033 (-11.37%)
   instructions in affected programs:     1850547 -> 1621331 (-12.39%)
   helped:                                14856
   HURT:                                  1481

GLSL IR vs. NIR shader-db results for vec4 programs on Ivy Bridge:

   total instructions in shared programs: 1848027 -> 1648216 (-10.81%)
   instructions in affected programs:     1660279 -> 1460468 (-12.03%)
   helped:                                14668
   HURT:                                  1369

GLSL IR vs. NIR shader-db results for vec4 programs on Bay Trail:

   total instructions in shared programs: 1848027 -> 1648216 (-10.81%)
   instructions in affected programs:     1660279 -> 1460468 (-12.03%)
   helped:                                14668
   HURT:                                  1369

GLSL IR vs. NIR shader-db results for vec4 programs on Haswell:

   total instructions in shared programs: 1848027 -> 1648216 (-10.81%)
   instructions in affected programs:     1660279 -> 1460468 (-12.03%)
   helped:                                14668
   HURT:                                  1369

I also ran our full suite of benchmarks on a Haswell and had the following
statistically significant (according to ministat) changes:

   Test                        master-glsl     master-nir     diff
   bench_OglGeomPoint          461.556         463.006        1.450
   bench_OglTerrainFlyInst     184.484         187.574        3.090
   bench_OglTerrainPanInst     132.412         136.307        3.895
   bench_OglTexFilterAniso     19.653          19.645         -0.008
   bench_OglTexFilterTri       58.333          58.009         -0.324
   bench_OglVSInstancing       65.049          65.327         0.278
   bench_trexoff               69.474          69.694         0.220
   bench_valley                40.708          41.125         0.417

v2 (Jason Ekstrand):
 - Remove more uses of NirOptions as a switch
 - New shader-db numbers
 - Added benchmark numbers

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agovk/wsi/x11: Send OUT_OF_DATE if the X drawable goes away
Jason Ekstrand [Fri, 2 Oct 2015 20:44:13 +0000 (13:44 -0700)]
vk/wsi/x11: Send OUT_OF_DATE if the X drawable goes away

9 years agoi965: don't forget to free image_param on prog_data free
Ilia Mirkin [Fri, 2 Oct 2015 00:27:06 +0000 (20:27 -0400)]
i965: don't forget to free image_param on prog_data free

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoglsl: avoid leaking hiddenUniforms map when there are no uniforms
Ilia Mirkin [Fri, 2 Oct 2015 00:21:47 +0000 (20:21 -0400)]
glsl: avoid leaking hiddenUniforms map when there are no uniforms

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agomesa: avoid leaking closure when iterating over a string_to_uint_map
Ilia Mirkin [Fri, 2 Oct 2015 00:18:19 +0000 (20:18 -0400)]
mesa: avoid leaking closure when iterating over a string_to_uint_map

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>