Compare commits

..

221 Commits

Author SHA1 Message Date
Chad Versace
5520221118 vk: Remove unneeded vulkan-138.h 2015-07-15 17:16:07 -07:00
Chad Versace
73a8f9543a vk: Bump vulkan.h version to 0.138 2015-07-15 17:16:07 -07:00
Chad Versace
55781f8d02 vk/0.138: Update VkResult values 2015-07-15 17:16:07 -07:00
Chad Versace
756d8064c1 vk/0.132: Do type-safety 2015-07-15 17:16:07 -07:00
Jason Ekstrand
927f54de68 vk/cmd_buffer: Move batch buffer padding to anv_batch_bo_finish() 2015-07-15 17:11:04 -07:00
Jason Ekstrand
9c0db9d349 vk/cmd_buffer: Rename bo_count to exec2_bo_count 2015-07-15 16:56:29 -07:00
Jason Ekstrand
6037b5d610 vk/cmd_buffer: Add a helper for allocating dynamic state
This matches what we do for surface state and makes the dynamic state pool
more opaque to things that need to get dynamic state.
2015-07-15 16:56:29 -07:00
Jason Ekstrand
7ccc8dd24a vk/private.h: Move cmd_buffer functions to near the cmd_buffer struct 2015-07-15 16:56:29 -07:00
Jason Ekstrand
d22d5f25fc vk: Split command buffer state into its own structure
Everything else in anv_cmd_buffer is the actual guts of the datastructure.
2015-07-15 16:56:29 -07:00
Jason Ekstrand
da4d9f6c7c vk: Move most of the anv_Cmd related stuff to its own file 2015-07-15 16:56:28 -07:00
Jason Ekstrand
d862099198 vk: Pull the guts of anv_cmd_buffer into its own file 2015-07-15 16:56:28 -07:00
Chad Versace
498ae009d3 vk/glsl: Replace raw casts
Needed for upcoming type-safety changes.
2015-07-15 15:51:37 -07:00
Chad Versace
6f140e8af1 vk/meta: Remove raw casts
Needed for upcoming type-safety changes.
2015-07-15 15:51:37 -07:00
Chad Versace
badbf0c94a vk/x11: Remove raw casts
The raw casts in the WSI functions will break the build when the
type-safety changes arrive.
2015-07-15 15:49:10 -07:00
Chad Versace
61a4bfe253 vk: Delete vkDbgSetObjectTag()
Because VkObject is going away.
2015-07-15 15:34:20 -07:00
Jason Ekstrand
e1c78ebe53 vk/device: Remove unneeded checks for NULL 2015-07-15 15:22:32 -07:00
Jason Ekstrand
f4748bff59 vk/device: Provide proper NULL handling in anv_device_free
The Vulkan spec does not specify that the free function provided to
CreateInstance must handle NULL properly so we do it in the wrapper.  If
this ever changes in the spec, we can delete the extra 2 lines.
2015-07-15 15:22:32 -07:00
Chad Versace
4c8e1e5888 vk: Stop internally calling anv_DestroyObject()
Replace each anv_DestroyObject() with anv_DestroyFoo().

Let vkDestroyObject() live for a while longer for Crucible's sake.
2015-07-15 15:11:16 -07:00
Chad Versace
f5ad06eb78 vk: Fix vkDestroyObject dispatch for VkRenderPass
It called anv_device_free() instead of anv_DestroyRenderPass().
2015-07-15 15:07:41 -07:00
Chad Versace
188f2328de vk: Fix vkCreate/DestroyRenderPass
While updating vkDestroyObject, I discovered that vkDestroyPass reliably
crashes. That hasn't been an issue yet, though, because it is never
called.

In vkCreateRenderPass:
    - Don't allocate empty attachment arrays.
    - Ensure that pointers to empty attachment arrays are NULL.
    - Store VkRenderPassCreateInfo::subpassCount as
      anv_render_pass::subpass_count.

In vkDestroyRenderPass:
    - Fix loop bounds: s/attachment_count/subpass_count/
    - Don't call anv_device_free on null pointers.
2015-07-15 15:07:41 -07:00
Chad Versace
c6270e8044 vk: Refactor create/destroy code for anv_descriptor_set
Define two new functions:
    anv_descriptor_set_create
    anv_descriptor_set_destroy
2015-07-15 14:31:22 -07:00
Chad Versace
365d80a91e vk: Replace some raw casts with safe casts
That is, replace some instances of
    (VkFoo) foo
with
    anv_foo_to_handle(foo)
2015-07-15 14:00:21 -07:00
Chad Versace
7529e7ce86 vk: Correct anv_CreateShaderModule's prototype
s/VkShader/VkShaderModule/

:sigh: I look forward to type-safety.
2015-07-15 13:59:47 -07:00
Chad Versace
8213be790e vk: Define struct anv_image_view, anv_buffer_view
Follow the pattern of anv_attachment_view. We need these structs to
implement the type-safety that arrived in the 0.132 header.
2015-07-15 12:19:29 -07:00
Chad Versace
43241a24bc vk/meta: Fix declared type of a shader module
s/VkShader/VkShaderModule/

I'm looking forward to a type-safe vulkan.h ;)
2015-07-15 11:49:37 -07:00
Chad Versace
94e473c993 vk: Remove struct anv_object
Trivial removal because vkDestroyObject() no longer uses it.
2015-07-15 11:29:43 -07:00
Jason Ekstrand
e375f722a6 vk/device: More documentation on surface state flushing 2015-07-15 11:09:02 -07:00
Connor Abbott
9aabe69028 vk/device: explain why a flush is necessary
Jason found this from experimenting, but the docs give a reasonable
explanation of why it's necessary.
2015-07-14 23:03:19 -07:00
Chad Versace
5f46c4608f vk: Fix indentation of anv_dynamic_cb_state 2015-07-14 18:19:10 -07:00
Chad Versace
0eeba6b80c vk: Add finishmes for VkDescriptorPool
VkDescriptorPool is a stub object. As a consequence, it's impossible to
free descriptor set memory.
2015-07-14 18:19:00 -07:00
Jason Ekstrand
2b5a4dc5f3 vk: Add vulkan-138 and remove vulkan-0.132
Now, 138 is the target and not 132.  Once object destruction is finished,
we can delete 138 as it will be identical to vulkan.h
2015-07-14 17:54:13 -07:00
Jason Ekstrand
1f658bed70 vk/device: Add stub support for command pools
Real support isn't really that far away.  We just need a data structure
with a linked list and a few tests.
2015-07-14 17:40:00 -07:00
Jason Ekstrand
ca7243b54e vk/vulkan.h: Add the stuff for cross-queue resource sharing
We only have one queue, so this is currently a no-op on our implementation.
2015-07-14 17:20:50 -07:00
Jason Ekstrand
553b4434ca vk/vulkan.h: Add a couple of size fields for specialization constants 2015-07-14 17:12:39 -07:00
Jason Ekstrand
e5db209d54 vk/vulkan.h: Move around buffer image granularities 2015-07-14 17:10:37 -07:00
Jason Ekstrand
c7fcfebd5b vk: Add stubs for all the sparse resource stuff 2015-07-14 17:06:11 -07:00
Jason Ekstrand
2a9136feb4 vk/image: Add a stub for the new ImageFormatProperties function
This lets the client query about things like multisample.  We don't do
multisample right now, so I'll let Chad deal with that when he gets to it.
2015-07-14 17:05:30 -07:00
Jason Ekstrand
2c4dc92f40 vk/vulkan.h: Rename FormatInfo to FormatProperties 2015-07-14 17:04:46 -07:00
Jason Ekstrand
d7f44852be vk/vulkan.h: Re-order some #define's 2015-07-14 16:41:39 -07:00
Jason Ekstrand
1fd3bc818a vk/vulkan.h: Rename a function parameter 2015-07-14 16:39:01 -07:00
Jason Ekstrand
2e2f48f840 vk: Remove abreviations 2015-07-14 16:34:31 -07:00
Jason Ekstrand
02db21ae11 vk: Add the new extension/layer enumeration entrypoints 2015-07-14 16:11:21 -07:00
Jason Ekstrand
a463eacb8f vk/vulkan.h: Change maxAnisotropy to a float 2015-07-14 15:04:11 -07:00
Jason Ekstrand
98957b18d2 vk/vulkan.h: Add the VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT flag 2015-07-14 15:03:39 -07:00
Jason Ekstrand
a35811d086 vk/vulkan.h: Rename a couple of function parameters
No functional change.
2015-07-14 15:03:01 -07:00
Jason Ekstrand
55723e97f1 vk: Split the memory requirements/binding functions 2015-07-14 14:59:39 -07:00
Jason Ekstrand
ccb2e5cd62 vk: Make barriers more precise (rev. 133) 2015-07-14 14:50:35 -07:00
Jason Ekstrand
30445f8f7a vk: Split the dynamic state binding function into one per state 2015-07-14 14:26:10 -07:00
Jason Ekstrand
d2c0870ff3 vk/vulkan.h: Rename a function parameter to match 132 2015-07-14 14:11:04 -07:00
Jason Ekstrand
8478350992 vk: Implement Multipass 2015-07-14 11:37:14 -07:00
Jason Ekstrand
68768c40be vk/vulkan.h: Re-arrange some enums and definitions in preparation for 131 2015-07-14 11:32:15 -07:00
Chad Versace
66cbb7f76d vk/0.132: Add vkDestroyRenderPass() 2015-07-14 11:21:31 -07:00
Chad Versace
6d0ed38db5 vk/0.132: Add vkDestroy*View()
vkDestroyColorAttachmentView
vkDestroyDepthStencilView

These functions are not in the 0.132 header, but adding them will help
us attain the type-safety API updates more quickly.
2015-07-14 11:19:22 -07:00
Chad Versace
1ca611cbad vk/0.132: Add vkDestroyCommandBuffer() 2015-07-14 11:11:41 -07:00
Chad Versace
6eec0b186c vk/0.132: Add vkDestroyImageView()
Just declare it in vulkan.h. Jason defined the function earlier
in image.c.
2015-07-14 11:09:14 -07:00
Chad Versace
4b2c5a98f0 vk/0.132: Add vkDestroyBufferView()
Just declare it in vulkan.h. Jason already defined the function
earlier in vulkan.c.
2015-07-14 11:06:57 -07:00
Chad Versace
08f7731f67 vk/0.132: Add vkDestroyFramebuffer() 2015-07-14 10:59:30 -07:00
Chad Versace
0c8456ef1e vk/0.132: Add vkDestroyDynamicDepthStencilState() 2015-07-14 10:54:51 -07:00
Chad Versace
b29c929e8e vk/0.132: Add vkDestroyDynamicColorBlendState() 2015-07-14 10:52:45 -07:00
Chad Versace
5e1737c42f vk/0.132: Add vkDestroyDynamicRasterState() 2015-07-14 10:51:08 -07:00
Chad Versace
d80fea1af6 vk/0.132: Add vkDestroyDynamicViewportState() 2015-07-14 10:42:45 -07:00
Chad Versace
9250e1e9e5 vk/0.132: Add vkDestroyDescriptorPool() 2015-07-14 10:38:22 -07:00
Chad Versace
f925ea31e7 vk/0.132: Add vkDestroyDescriptorSetLayout() 2015-07-14 10:36:49 -07:00
Chad Versace
ec5e2f4992 vk/0.132: Add vkDestroySampler() 2015-07-14 10:34:00 -07:00
Chad Versace
a684198935 vk/0.132: Add vkDestroyPipelineLayout() 2015-07-14 10:29:47 -07:00
Chad Versace
6e5ab5cf1b vk/0.132: Add vkDestroyPipeline() 2015-07-14 10:26:17 -07:00
Chad Versace
114015321e vk/0.132: Add vkDestroyPipelineCache() 2015-07-14 10:19:27 -07:00
Chad Versace
cb57bff36c vk/0.132: Add vkDestroyShader() 2015-07-14 10:16:22 -07:00
Chad Versace
8ae8e14ba7 vk/0.132: Add vkDestroyShaderModule() 2015-07-14 10:13:09 -07:00
Chad Versace
dd67c134ad vk/0.132: Add vkDestroyImage()
We only need to add it to vulkan.h because Jason defined the function
earlier in image.c.
2015-07-14 10:13:00 -07:00
Chad Versace
e18377f435 vk/0.132: Dispatch vkDestroyObject to new destructors
Oops. My recent commits added new destructors, but forgot to teach
vkDestroyObject about them. They are:
  vkDestroyFence
  vkDestroyEvent
  vkDestroySemaphore
  vkDestroyQueryPool
  vkDestroyBuffer
2015-07-14 09:58:22 -07:00
Chad Versace
e93b6d8eb1 vk/0.132: Add vkDestroyBuffer() 2015-07-14 09:47:45 -07:00
Chad Versace
584cb7a16f vk/0.132: Add vkDestroyQueryPool() 2015-07-14 09:44:58 -07:00
Chad Versace
68c7ef502d vk/0.132: Add vkDestroyEvent() 2015-07-14 09:33:47 -07:00
Chad Versace
549070b18c vk/0.132: Add vkDestroySemaphore() 2015-07-14 09:31:34 -07:00
Chad Versace
ebb191f145 vk/0.132: Add vkDestroyFence() 2015-07-14 09:29:35 -07:00
Chad Versace
435ccf4056 vk/0.132: Rename VkDynamic*State types
sed -i -e 's/VkDynamicVpState/VkDynamicViewportState/g' \
       -e 's/VkDynamicRsState/VkDynamicRasterState/g' \
       -e 's/VkDynamicCbState/VkDynamicColorBlendState/g' \
       -e 's/VkDynamicDsState/VkDynamicDepthStencilState/g' \
       $(git ls-files include/vulkan src/vulkan)
2015-07-13 16:19:28 -07:00
Connor Abbott
ffb51fd112 nir/spirv: update to SPIR-V revision 31
This means that now the internal version of glslangValidator is
required. This includes some changes due to the sampler/texture rework,
but doesn't actually enable anything more yet. We also don't yet handle
UBO's correctly, and don't handle matrix stride and row major/column
major yet.
2015-07-13 15:01:01 -07:00
Chad Versace
45f8723f44 vk/0.132: Move VkQueryControlFlags 2015-07-13 13:09:32 -07:00
Chad Versace
180c07ee50 vk/0.132: Move VkImageAspectFlags 2015-07-13 13:08:56 -07:00
Chad Versace
4b05a8cd31 vk/0.132: Move VkCmdBufferOptimizeFlags 2015-07-13 13:08:07 -07:00
Chad Versace
f1cf55fae6 vk/0.132: Move VkWaitEvent 2015-07-13 13:06:53 -07:00
Chad Versace
3112098776 vk/0.132: Move VkCmdBufferLevel 2015-07-13 13:06:33 -07:00
Chad Versace
c633ab5822 vk/0.132: Drop VK_ATTACHMENT_STORE_OP_RESOLVE_MSAA 2015-07-13 13:05:24 -07:00
Chad Versace
8f3b2187e1 vk/0.132: Rename bool32_t -> VkBool32
sed -i 's/bool32_t/VkBool32/g' \
  $(git ls-files src/vulkan include/vulkan)
2015-07-13 13:03:36 -07:00
Chad Versace
77dcfe3c70 vk/0.132: Remove stray typedef 2015-07-13 12:58:17 -07:00
Chad Versace
601d0891a6 vk/0.132: Move VKImageUsageFlags 2015-07-13 12:48:44 -07:00
Chad Versace
829810fa27 vk/0.132: Move VkImageType and VkImageTiling 2015-07-13 11:49:56 -07:00
Chad Versace
17c8232ecf vk/0.132: Import the 0.132 header
Import it as vulkan-0.132.h.
2015-07-13 11:47:12 -07:00
Chad Versace
a158ff55f0 vk/vulkan.h: Remove headers for old API versions
Remove the temporary headers for 0.90 and 0.130.
2015-07-13 11:46:30 -07:00
Chad Versace
1c4238a8e5 vk/0.130: Bump header version to 0.130
All APIs have been updated. This eliminates the diff between the
work-in-progress header and the 0.130 header.
2015-07-10 20:06:09 -07:00
Chad Versace
f43a304dc6 vk/0.130: Update vkAllocMemory to use VkMemoryType 2015-07-10 17:35:52 -07:00
Chad Versace
df2a013881 vk/0.130: Implement vkGetPhysicalDeviceMemoryProperties() 2015-07-10 17:35:52 -07:00
Chad Versace
c7f512721c vk/gem: Change signature of anv_gem_get_aperture()
Replace the anv_device parameter with anv_physical_device, because this needs
querying before vkCreateDevice.
2015-07-10 17:35:52 -07:00
Chad Versace
8cda3e9b1b vk/device: Add member anv_physical_device::fd
During anv_physical_device_init(), we opend the DRM device to do some
queries, then promptly closed it. Now we keep it open for the lifetime
of the anv_physical_device so that we can query it some more during
vkGetPhysicalDevice*Properties() [which will happen in follow-up
commits].
2015-07-10 17:35:52 -07:00
Chad Versace
4422bd4cf6 vk/device: Add func anv_physical_device_finish()
Because in a follow-up patch I need to do some non-trival teardown on
anv_physical_device. Currently, however, anv_physical_device_finish() is
currently a no-op that's just called in the right place.

Also, rename function fill_physical_device -> anv_physical_device_init
for symmetry.
2015-07-10 17:35:52 -07:00
Jason Ekstrand
7552e026da vk/device: Add an explicit destructor for RenderPass 2015-07-10 12:33:04 -07:00
Jason Ekstrand
8b342b39a3 vk/image: Add an explicit DestroyImage function 2015-07-10 12:30:58 -07:00
Jason Ekstrand
b94b8dfad5 vk/image: Add explicit constructors for buffer/image view types 2015-07-10 12:26:31 -07:00
Jason Ekstrand
18340883e3 nir: Add C++ versions of NIR_(SRC|DEST)_INIT 2015-07-10 11:57:33 -07:00
Chad Versace
9e64a2a8e4 mesa: Fix generation of git_sha1.h.tmp for gitlinks
Don't assume that $(top_srcdir)/.git is a directory. It may be a
gitlink file [1] if $(top_srcdir) is a submodule checkout or a linked
worktree [2].

[1] A "gitlink" is a text file that specifies the real location of
    the gitdir.
[2] Linked worktrees are a new feature in Git 2.5.

Cc: "10.6, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
(cherry picked from commit 75784243df)
2015-07-10 11:24:25 -07:00
Jason Ekstrand
19f0a9b582 vk/query.c: Use the casting functions 2015-07-09 20:32:44 -07:00
Jason Ekstrand
6eb221c884 vk/pipeline.c: Use the casting functions 2015-07-09 20:28:08 -07:00
Jason Ekstrand
fb4e2195ec vk/formats.c: Use the casting functions 2015-07-09 20:24:17 -07:00
Jason Ekstrand
a52e208203 vk/image.c: Use the casting functions 2015-07-09 20:24:07 -07:00
Jason Ekstrand
b1de1d4f6e vk/device.c: One more use of a casting function 2015-07-09 20:23:46 -07:00
Jason Ekstrand
8739e8fbe2 vk/meta.c: Use the casting functions 2015-07-09 20:16:13 -07:00
Jason Ekstrand
92556c77f4 vk: Fix the build 2015-07-09 18:59:08 -07:00
Jason Ekstrand
098209eedf device.c: Use the cast helpers a bunch of places 2015-07-09 18:49:43 -07:00
Jason Ekstrand
73f9187e33 device.c: Use the cast helpers 2015-07-09 18:41:27 -07:00
Jason Ekstrand
7d24fab4ef vk/private.h: Add a bunch of static inline casting functions
We will need these as soon as we turn on type saftey.  We might as well
define and start using them now rather than later.
2015-07-09 18:40:54 -07:00
Jason Ekstrand
5c49730164 vk/device.c: Fix whitespace issues 2015-07-09 18:20:28 -07:00
Jason Ekstrand
c95f9b61f2 vk/device.c: Use ANV_FROM_HANDLE a bunch of places 2015-07-09 18:20:10 -07:00
Jason Ekstrand
335e88c8ee vk/vulkan.h: Add the pEnabledFeatures field to DeviceCreateInfo 2015-07-09 16:21:31 -07:00
Jason Ekstrand
34871cf7f3 vk/vulkan.h: Change the MsCreateInfo structure to the 130 version
We do nothing with it at the moment, so this is a no-op.
2015-07-09 16:19:54 -07:00
Jason Ekstrand
8c2c37fae7 vk: Remove the old GetPhysicalDeviceInfo call 2015-07-09 16:14:37 -07:00
Jason Ekstrand
1f907011a3 vk: Add the new PhysicalDeviceQueue queries 2015-07-09 16:14:37 -07:00
Jason Ekstrand
977a469bce vk: Support GetPhysicalDeviceProperties 2015-07-09 16:14:37 -07:00
Jason Ekstrand
65e0b304b6 vk: Add support for GetPhysicalDeviceLimits 2015-07-09 16:14:37 -07:00
Jason Ekstrand
f6d51f3fd3 vk: Add GetPhysicalDeviceFeatures 2015-07-09 16:14:37 -07:00
Chad Versace
5b75dffd04 vk/device: Fix vkEnumeratePhysicalDevices()
The Vulkan spec says that pPhysicalDeviceCount is an out parameter if
pPhysicalDevices is NULL; otherwise it's an inout parameter.

Mesa incorrectly treated it unconditionally as an inout parameter, which
could have lead to reading unitialized data.
2015-07-09 15:53:21 -07:00
Chad Versace
fa915b661d vk/device: Move device enumeration to vkEnumeratePhysicalDevices()
Don't enumerate devices in vkCreateInstance(). That's where global,
device-independent initialization should happen. Move device enumeration
to the more logical location, vkEnumeratePhysicalDevices().
2015-07-09 15:41:17 -07:00
Chad Versace
c34d314db3 vk/device: Be consistent about path to DRM device
Function fill_physical_device() has a 'path' parameter, and struct
anv_physical_device has a 'path' member. Sometimes these are used;
sometimes hardcoded "/dev/dri/renderD128" is used instead.

Be consistent. Hardcode "/dev/dri/renderD128" in exactly one location,
during initialization of the physical device.
2015-07-09 15:27:26 -07:00
Connor Abbott
cff06bbe7d vk/compiler: create an empty parameters list
Prevents problems when initializing the sanity_param_count.
2015-07-09 14:29:23 -04:00
Connor Abbott
3318a86d12 nir/spirv: fix wrong writemask for ALU operations 2015-07-09 14:28:39 -04:00
Connor Abbott
b8fedc19f5 nir/spirv: fix memory context for builtin variable
Fixes valgrind errors with func.depthstencil.basic.
2015-07-08 22:03:30 -04:00
Connor Abbott
e4292ac039 nir/spirv: zero out value array
Before values are pushed or annotated with a name, decoration, etc.,
they need to have an invalid type, NULL name, NULL decoration, etc.
ralloc zero's everything by accident, so this wasn't an issue in
practice, but we should be explicitly zero'ing it.
2015-07-08 22:03:30 -04:00
Connor Abbott
997831868f vk/compiler: create the right kind of program struct
This fixes Valgrind errors and gets all the tests to pass with
--use-spir-v.
2015-07-08 22:03:30 -04:00
Connor Abbott
a841e2c747 vk/compiler: mark inputs/outputs as read/written
This doesn't handle inputs and outputs larger than a vec4, but we plan
to add a varyiing splitting/packing pass to handle those anyways.
2015-07-08 22:03:30 -04:00
Jason Ekstrand
8640dc12dc vk/vulkan.h: Copy the VkStructureType enum from version 130
We now have the exact same structs which require pType.
2015-07-08 17:45:52 -07:00
Jason Ekstrand
5a4ebf6bc1 vk: Move to the new pipeline creation API's 2015-07-08 17:30:18 -07:00
Chad Versace
4fcb32a17d vk/0.130: Remove VkImageViewCreateInfo::minLod
It's now set solely through VkSampler.
2015-07-08 14:48:22 -07:00
Jason Ekstrand
367b9ba78f vk/vulkan.h: Move renderPassContinue from GraphicsBeginInfo to BeginInfo 2015-07-08 14:37:30 -07:00
Jason Ekstrand
d29ec8fa36 vk/vulkan.h: Update to the new UpdateDescriptorSets api 2015-07-08 14:24:56 -07:00
Jason Ekstrand
c8577b5f52 vk: Add a macro for creating anv variables from vulkan handles
This is very helpful for doing the mass bunch of casts at the top of a
function.  It will also be invaluable when we get type saftey in the API.
2015-07-08 14:24:14 -07:00
Chad Versace
ccb27a002c vk/0.130 Update VkObjectType values
Don't import any new enum tokens from the 0.130 header. Just update the
values of existing enums. This reduces the diff by about 16 lines.
2015-07-08 12:53:49 -07:00
Chad Versace
8985dd15a1 vk/0.130: Remove VkDescriptorUpdateMode
Nowhere used.
2015-07-08 12:51:46 -07:00
Chad Versace
e02dfa309a vk/0.130: Remove VK_DEVICE_CREATE_MULTI_DEVICE_IQ_MATCH_BIT 2015-07-08 12:49:48 -07:00
Chad Versace
e9034ed875 vk/0.130: Update vkCmdBlitImage signature
Add VkTexFilter param. Ignored for now.
2015-07-08 12:47:48 -07:00
Jason Ekstrand
aae45ab583 vk/vulkan.h: Add packing parameters to BufferImageCopy 2015-07-08 11:51:34 -07:00
Chad Versace
b4ef7f354b vk/0.130: Remove msaa members of VkDepthStencilViewCreateInfo 2015-07-08 11:50:51 -07:00
Jason Ekstrand
522ab835d6 vk/vulkan.h: Move over to the new border color enums 2015-07-08 11:44:52 -07:00
Jason Ekstrand
7598329774 vk/vulkan.h: Move VkFormatProperties 2015-07-08 11:16:45 -07:00
Jason Ekstrand
52940e8fcf vk/vulkan.h: Add RenderPassBeginContents 2015-07-08 10:57:13 -07:00
Jason Ekstrand
e19d6be2a9 vk/vulkan.h: Add command buffer levels 2015-07-08 10:53:32 -07:00
Jason Ekstrand
c84f2d3b8c vk/vulkan.h: Import the VkPipeEvent enum from 130
Now, VkPipeEventFlags is back in sync with VkPipeEvent
2015-07-08 10:49:46 -07:00
Jason Ekstrand
b20cc72603 vk/vulkan.h: Remove VkFormatInfoType 2015-07-08 10:39:31 -07:00
Jason Ekstrand
8e05bbeee9 vk/vulkan.h: Update extension handling to rev 130 2015-07-08 10:38:07 -07:00
Jason Ekstrand
cc29a5f4be vk/vulkan.h: Move format quering to the physical device 2015-07-08 09:34:47 -07:00
Jason Ekstrand
719fa8ac74 vk/vulkan.h: Remove some peer opening structs and STRUCTURE_TYPE enums 2015-07-08 09:25:13 -07:00
Jason Ekstrand
fc6dcc6227 vk: Add a copy of the v90 header. 2015-07-08 09:23:29 -07:00
Jason Ekstrand
12119282e6 vk/vulkan.h: Remove an unneeded comment 2015-07-08 09:18:09 -07:00
Jason Ekstrand
3c65a1ac14 vk/vulkan.h: Remove the MemoryRange stubs and add sparse stubs 2015-07-08 09:16:48 -07:00
Jason Ekstrand
bb6567f5d1 vk/vulkan.h: Switch BindObjectMemory to a device function and remove the index 2015-07-08 09:04:16 -07:00
Jason Ekstrand
e7acdda184 vk/vulkan.h: Switch to the split ProcAddr functions in 130 2015-07-07 18:51:53 -07:00
Jason Ekstrand
db24afee2f vk/vulkan.h: Switch from GetImageSubresourceInfo to GetImageSubresourceLayout 2015-07-07 18:20:18 -07:00
Jason Ekstrand
ef8980e256 vk/vulkan.h: Switch from GetObjectInfo to GetMemoryRequirements 2015-07-07 18:16:42 -07:00
Jason Ekstrand
d9c2caea6a vk: Update memory flushing functions to 130
This involves updating the prototype for FlushMappedMemory, adding
InvalidateMappedMemoryRanges, and removing PinSystemMemory.
2015-07-07 17:22:31 -07:00
Jason Ekstrand
d5349b1b18 vk/vulkan.h: Constify the pFences parameter to ResetFences 2015-07-07 17:18:00 -07:00
Jason Ekstrand
6aa1b89457 vk/vulkan.h: Move the definitions of Create(Framebuffer|RenderPass)
This better matches the 130 header.
2015-07-07 17:13:10 -07:00
Jason Ekstrand
0ff06540ae vk: Implement the GetRenderAreaGranularity function
At the moment, we're just going to scissor clears so a granularity of 1x1
is all we need.
2015-07-07 17:11:37 -07:00
Jason Ekstrand
435b062b26 vk/vulkan.h: Add a PipelineLayout parameter to BindDescriptorSets 2015-07-07 17:06:10 -07:00
Jason Ekstrand
518ca9e254 vk/vulkan.h: Add a compareEnable parameter to SamplerCreateInfo
Our hardware doesn't actually need this, so adding it is a no-op.
2015-07-07 16:49:04 -07:00
Jason Ekstrand
672590710b vk/vulkan.h: Remove initialCount from SemaphoreCreateInfo 2015-07-07 16:42:42 -07:00
Jason Ekstrand
80046a7d54 vk/vulkan.h: Update clear color handling to 130 2015-07-07 16:37:43 -07:00
Jason Ekstrand
3e4b00d283 meta: Use the VkClearColorValue structure for the color attribute 2015-07-07 16:27:06 -07:00
Jason Ekstrand
a35fef1ab2 vk/vulkan.h: Remove the pass argument from EndRenderPass 2015-07-07 16:22:23 -07:00
Jason Ekstrand
d2ca7e24b4 vk/vulkan.h: Rename VertexInputStateInfo to VertexInputStateCreateInfo 2015-07-07 16:15:55 -07:00
Jason Ekstrand
abbb776bbe vk/vulkan.h: Remove programPointSize
Instead, we auto-detect whether or not your shader writes gl_PointSize.  If
it does, we use 1.0, otherwise we take it from the shader.
2015-07-07 16:00:46 -07:00
Chad Versace
e7ddfe03ab vk/0.130: Stub vkCmdClear*Attachment() funcs
vkCmdClearColorAttachment
vkCmdClearDepthStencilAttachment
2015-07-07 15:57:37 -07:00
Chad Versace
f89e2e6304 vk/0.130: Define enum VkImageAspectFlagBits 2015-07-07 15:57:37 -07:00
Chad Versace
55ab1737d3 vk/0.130: Define VkRect3D 2015-07-07 15:55:53 -07:00
Chad Versace
11901a9100 vk/0.130: Update name of vkCmdClearDepthStencilImage() 2015-07-07 15:53:35 -07:00
Chad Versace
dff32238c7 vk/0.130: Stub vkCmdExecuteCommands() 2015-07-07 15:51:55 -07:00
Chad Versace
85c0d69be9 vk/0.130: Update vkCmdWaitEvents() signature 2015-07-07 15:49:57 -07:00
Chad Versace
0ecb789b71 vk: Remove unused 'v' param from stub() macro 2015-07-07 15:47:24 -07:00
Chad Versace
f78d684772 vk: Stub vkCmdPushConstants() from 0.130 header 2015-07-07 15:46:19 -07:00
Chad Versace
18ee32ef9d vk: Update vkCmdPipelineBarrier to 0.130 header 2015-07-07 15:43:41 -07:00
Chad Versace
4af79ab076 vk: Add func anv_clear_mask()
A little helper func for inspecting and clearing bitmasks.
2015-07-07 15:43:41 -07:00
Jason Ekstrand
788a8352b9 vk/vulkan.h: Remove some unused fields.
In particular, the following are removed:

 - disableVertexReuse
 - clipOrigin
 - depthMode
 - pointOrigin
 - provokingVertex
2015-07-07 15:33:00 -07:00
Jason Ekstrand
7fbed521bb vk/vulkan.h: Remove the explicit primitive restart index
Unfortunately, this requires some non-trivial changes to the driver.  Now
that the primitive restart index isn't given explicitly by the client, we
always use ~0 for everything like D3D does.  Unfortunately, our hardware is
awesome and a 32-bit version of ~0 doesn't match any 16-bit values.  This
means, we have to set it to either UINT16_MAX or UINT32_MAX depending on
the size of the index type.  Since we get the index type from
CmdBindIndexBuffer and the rest of the VF packet from the pipeline, we need
to lazy-emit the VF packet.
2015-07-07 15:33:00 -07:00
Chad Versace
d6b840beff vk: Delete some comments not present in 0.130 header
Deleting the comments reduces diff noise.
2015-07-07 15:16:13 -07:00
Chad Versace
84a5bc25e3 vk: Pull in remaining 0.130 handle types
This pulls in the definition of VkShaderModule and VkPipelineCache,
which nowhere used yet.
2015-07-07 15:13:01 -07:00
Chad Versace
f2899b1af2 vk: Pull in #defines from 0.130 header
Despite not being used yet, pulling in the macros does diminish the
header diff.
2015-07-07 15:11:30 -07:00
Jason Ekstrand
962d6932fa vk/vulkan.h: Rename (min|max)Depth to (min|max)DepthBounds 2015-07-07 12:37:54 -07:00
Jason Ekstrand
1fb859e4b2 vk/vulkan.h: Remove client-settable pointSize from DynamicRsState 2015-07-07 12:35:32 -07:00
Jason Ekstrand
245583075c vk/vulkan.h: Remove UINT8 index buffers 2015-07-07 11:26:49 -07:00
Jason Ekstrand
0a42332904 vk/vulkan.h: Re-order the object declarations 2015-07-07 11:26:49 -07:00
Kristian Høgsberg Kristensen
a1eea996d4 vk: Emit 3DSTATE_SAMPLE_MASK
This was missing and was causing the driver to not work with
execlists. Presumably we get a different initial hw context with
execlists enabled, that has sample mask 0 initially.

Set this to 0xffff for now.  When we add MS support, we need to take the
value from VkPipelineMsStateCreateInfo::sampleMask.
2015-07-06 23:54:12 -07:00
Kristian Høgsberg Kristensen
c325bb24b5 vk: Pull in new generated headers
The new headers use stdbool for enable/disable fields which
implicitly converts expressions like (flags & 8) to 0 or 1.
Also handles MBO (must-be-one) fields by setting them to one,
corrects a bspec typo (_3DPRIM_LISTSTRIP_ADJ -> LINESTRIP) and
makes a few enum values less clashy.
2015-07-06 22:12:26 -07:00
Chad Versace
23075bccb3 vk/image: Validate vkCreateImageView more
Exhaustively validate the function input.  If it's not validated and
doesn't have an anv_finishme(), then I overlooked it.
2015-07-06 18:28:26 -07:00
Chad Versace
69e11adecc vk/image: Add more info to VkImageViewType table
Convert the table from the direct mapping
  VkImageViewType -> SurfaceType

into a mapping to an info struct
  VkImageViewType -> struct anv_image_view_info
2015-07-06 18:28:26 -07:00
Chad Versace
b844f542e0 vk: Update VkImageViewType to 0.130.0
This splits 1D and 1D_ARRAY, 2D and 2D_ARRAY, CUBE and CUBE_ARRAY.

The new tokens are unused. This is just a header update.
2015-07-06 18:28:26 -07:00
Chad Versace
5b04db71ff vk/image: Move validation for vkCreateImageView
Move the validation from anv_CreateImageView() and anv_image_view_init()
to anv_validate_CreateImageView(). No new validation is added.
2015-07-06 18:27:14 -07:00
Jason Ekstrand
1f1b26bceb vk/vulkan.h: Rename VkRect to VkRect2D 2015-07-06 17:47:18 -07:00
Jason Ekstrand
63c1190e47 vk/vulkan.h: Rename count to arraySize in VkDescriptorSetLayoutBinding 2015-07-06 17:43:58 -07:00
Jason Ekstrand
d84f3155b1 vk/vulkan.h: Remove the Vk(Memory|Semaphor|Image)OpenInfo structs
We already deleted the functions that need them.  The structs are just
dangling uselessly.
2015-07-06 17:37:13 -07:00
Jason Ekstrand
65f9ccb4e7 vk/vulkan.h: Remove VK_MEMORY_PROPERTY_PREFER_HOST_LOCAL_BIT
We weren't doing anything with it, so this is a no-op
2015-07-06 17:33:45 -07:00
Jason Ekstrand
68fa750f2e vk/vulkan.h: Replace DEVICE_COHERENT_BIT with DEVICE_NON_COHERENT_BIT 2015-07-06 17:32:28 -07:00
Jason Ekstrand
d5b5bd67f6 vk/vulkan.h: Use the query result bits from revision 130
None of the important bits or names actually changed.  It just
added/removed some no-op names.

No functional change.
2015-07-06 17:27:11 -07:00
Jason Ekstrand
d843418c2e vk/vulkan.h: One more quick enum refactor clean-up 2015-07-06 17:26:29 -07:00
Jason Ekstrand
2b37fc28d1 vk/vulkan.h: Get rid of VERTEX_INPUT_STEP_RATE_DRAW
We never supported it, so no functional change.
2015-07-06 17:24:26 -07:00
Jason Ekstrand
a75967b1bb vk/vulkan.h: Remove the CLEAR_OPTIMAL image layout 2015-07-06 17:21:19 -07:00
Jason Ekstrand
2b404e5d00 vk: Rename CPU_READ/WRITE_BIT to HOST_READ/WRITE_BIT 2015-07-06 17:18:25 -07:00
Jason Ekstrand
c57ca3f16f vk/vulkan.h: Remove VK_IMAGE_CREATE_CLONEABLE_BIT 2015-07-06 17:14:30 -07:00
Jason Ekstrand
2de388c49c vk: Remove SHAREABLE bits
They were removed from the Vulkan API and we don't really use them because
there are no multi-GPU i965 systems.
2015-07-06 17:12:51 -07:00
Jason Ekstrand
1b0c47bba6 vk/vulkan.h: Re-order the logic op enums 2015-07-06 17:08:11 -07:00
Jason Ekstrand
c7cef662d0 vk/vulkan.h: Reformat a bunch of enums to match revision 130
In theory, no functional change.
2015-07-06 17:06:02 -07:00
Jason Ekstrand
8c5e48f307 vk: Rename NUM_SHADER_STAGE to SHADER_STAGE_NUM
This is a refactor of more than just the header but it lets us finish
reformating the shader stage enum.
2015-07-06 16:43:28 -07:00
Jason Ekstrand
d9176f2ec7 vk: Reformat a bunch of enums
This accounts for a number differences between the generated headers and
the hand-written header.  Not all reformatting is done in this commit but
it does make the headers much more diffable.

In theory, no functional change.
2015-07-06 16:41:31 -07:00
Jason Ekstrand
e95bf93e5a vk: Pull the VkResult enum from revision 130 2015-07-06 16:15:12 -07:00
Jason Ekstrand
1b7b580756 vk: re-arrange enums to match the order in revision 130 2015-07-06 16:11:05 -07:00
Jason Ekstrand
2fb524b369 vk: Rename a parameter in CmdBindDynamicStateObject 2015-07-06 15:37:17 -07:00
Jason Ekstrand
c5ffcc9958 vk: Remove multi-device stuff 2015-07-06 15:34:55 -07:00
Jason Ekstrand
c5ab5925df vk: Remove ClearDescriptorSets 2015-07-06 15:32:40 -07:00
Jason Ekstrand
ea5fbe1957 vk: Remove begin/end descriptor pool update 2015-07-06 15:32:27 -07:00
Jason Ekstrand
9a798fa946 vk: Remove stub for CloneImageData 2015-07-06 15:30:05 -07:00
Jason Ekstrand
78a0d23d4e vk: Remove the stub support for memory priorities 2015-07-06 15:28:10 -07:00
Jason Ekstrand
11cf214578 vk: Remove the stub support for explicit memory references 2015-07-06 15:27:58 -07:00
Jason Ekstrand
0dc7d4ac8a vk/vulkan.h: Reformat structs to match revision 130
Structs in the old version were specified as

typedef struct VkSomeThing_
{
   type                                        field; // comment
} VkSomeThing;

However, in the generated headers, you have

typedef struct {
   type                                        field;
} VkSomeThing;

This commit also removes some unneeded whitespaces.
2015-07-06 15:19:12 -07:00
Jason Ekstrand
19aabb5730 vk/vulkah.h: Re-arrange structures to match the order in 130 2015-07-06 15:09:30 -07:00
28 changed files with 7776 additions and 9880 deletions

View File

@@ -68,7 +68,7 @@ extern "C"
#endif // !defined(VK_NO_STDINT_H)
typedef uint64_t VkDeviceSize;
typedef uint32_t bool32_t;
typedef uint32_t VkBool32;
typedef uint32_t VkSampleMask;
typedef uint32_t VkFlags;

View File

@@ -37,11 +37,30 @@ extern "C"
{
#endif // __cplusplus
// This macro defines INT_MAX in enumerations to force compilers to use 32 bits
// to represent them. This may or may not be necessary on some compilers. The
// option to compile it out may allow compilers that warn about missing enumerants
// in switch statements to be silenced.
// Using this macro is not needed for flag bit enums because those aren't used
// as storage type anywhere.
#define VK_MAX_ENUM(Prefix) VK_##Prefix##_MAX_ENUM = 0x7FFFFFFF
// This macro defines the BEGIN_RANGE, END_RANGE, NUM, and MAX_ENUM constants for
// the enumerations.
#define VK_ENUM_RANGE(Prefix, First, Last) \
VK_##Prefix##_BEGIN_RANGE = VK_##Prefix##_##First, \
VK_##Prefix##_END_RANGE = VK_##Prefix##_##Last, \
VK_NUM_##Prefix = (VK_##Prefix##_END_RANGE - VK_##Prefix##_BEGIN_RANGE + 1), \
VK_MAX_ENUM(Prefix)
// This is a helper macro to define the value of flag bit enum values.
#define VK_BIT(bit) (1 << (bit))
// ------------------------------------------------------------------------------------------------
// Objects
VK_DEFINE_DISP_SUBCLASS_HANDLE(VkDisplayWSI, VkObject)
VK_DEFINE_DISP_SUBCLASS_HANDLE(VkSwapChainWSI, VkObject)
VK_DEFINE_HANDLE(VkDisplayWSI)
VK_DEFINE_HANDLE(VkSwapChainWSI)
// ------------------------------------------------------------------------------------------------
// Enumeration constants
@@ -59,10 +78,6 @@ VK_DEFINE_DISP_SUBCLASS_HANDLE(VkSwapChainWSI, VkObject)
// Extend VkImageLayout enum with extension specific constants
#define VK_IMAGE_LAYOUT_PRESENT_SOURCE_WSI VK_WSI_LUNARG_ENUM(VkImageLayout, 0)
// Extend VkObjectType enum for new objects
#define VK_OBJECT_TYPE_DISPLAY_WSI VK_WSI_LUNARG_ENUM(VkObjectType, 0)
#define VK_OBJECT_TYPE_SWAP_CHAIN_WSI VK_WSI_LUNARG_ENUM(VkObjectType, 1)
// ------------------------------------------------------------------------------------------------
// Enumerations
@@ -139,7 +154,7 @@ typedef struct VkSwapChainImageInfoWSI_
typedef struct VkPhysicalDeviceQueuePresentPropertiesWSI_
{
bool32_t supportsPresent; // Tells whether the queue supports presenting
VkBool32 supportsPresent; // Tells whether the queue supports presenting
} VkPhysicalDeviceQueuePresentPropertiesWSI;
typedef struct VkPresentInfoWSI_

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -511,7 +511,11 @@ typedef struct nir_src {
bool is_ssa;
} nir_src;
#define NIR_SRC_INIT (nir_src) { { NULL } }
#ifdef __cplusplus
# define NIR_SRC_INIT nir_src()
#else
# define NIR_SRC_INIT (nir_src) { { NULL } }
#endif
#define nir_foreach_use(reg_or_ssa_def, src) \
list_for_each_entry(nir_src, src, &(reg_or_ssa_def)->uses, use_link)
@@ -534,7 +538,11 @@ typedef struct {
bool is_ssa;
} nir_dest;
#define NIR_DEST_INIT (nir_dest) { { { NULL } } }
#ifdef __cplusplus
# define NIR_DEST_INIT nir_dest()
#else
# define NIR_DEST_INIT (nir_dest) { { { NULL } } }
#endif
#define nir_foreach_def(reg, dest) \
list_for_each_entry(nir_dest, dest, &(reg)->defs, reg.def_link)

File diff suppressed because it is too large Load Diff

View File

@@ -334,10 +334,8 @@ struct_member_decoration_cb(struct vtn_builder *b,
return;
switch (dec->decoration) {
case SpvDecorationPrecisionLow:
case SpvDecorationPrecisionMedium:
case SpvDecorationPrecisionHigh:
break; /* FIXME: Do nothing with these for now. */
case SpvDecorationRelaxedPrecision:
break; /* FIXME: Do nothing with this for now. */
case SpvDecorationSmooth:
ctx->fields[member].interpolation = INTERP_QUALIFIER_SMOOTH;
break;
@@ -362,11 +360,32 @@ struct_member_decoration_cb(struct vtn_builder *b,
ctx->type->members[member]->is_builtin = true;
ctx->type->members[member]->builtin = dec->literals[0];
break;
case SpvDecorationOffset:
ctx->type->offsets[member] = dec->literals[0];
break;
default:
unreachable("Unhandled member decoration");
}
}
static void
array_decoration_cb(struct vtn_builder *b,
struct vtn_value *val, int member,
const struct vtn_decoration *dec, void *ctx)
{
struct vtn_type *type = val->type;
assert(member == -1);
switch (dec->decoration) {
case SpvDecorationArrayStride:
type->stride = dec->literals[0];
break;
default:
unreachable("Unhandled array type decoration");
}
}
static void
vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count)
@@ -421,12 +440,14 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_array_type(array_element->type, w[3]);
val->type->array_element = array_element;
val->type->stride = 0;
vtn_foreach_decoration(b, val, array_decoration_cb, NULL);
return;
}
case SpvOpTypeStruct: {
unsigned num_fields = count - 2;
val->type->members = ralloc_array(b, struct vtn_type *, num_fields);
val->type->offsets = ralloc_array(b, unsigned, num_fields);
NIR_VLA(struct glsl_struct_field, fields, count);
for (unsigned i = 0; i < num_fields; i++) {
@@ -479,7 +500,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type = vtn_value(b, w[3], vtn_value_type_type)->type;
return;
case SpvOpTypeSampler: {
case SpvOpTypeImage: {
const struct glsl_type *sampled_type =
vtn_value(b, w[2], vtn_value_type_type)->type->type;
@@ -497,19 +518,21 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
unreachable("Invalid SPIR-V Sampler dimension");
}
/* TODO: Handle the various texture image/filter options */
(void)w[4];
bool is_shadow = w[4];
bool is_array = w[5];
bool is_shadow = w[6];
assert(w[7] == 0 && "FIXME: Handl multi-sampled textures");
assert(w[6] == 0 && "FIXME: Handl multi-sampled textures");
assert(w[7] == 1 && "FIXME: Add support for non-sampled images");
val->type->type = glsl_sampler_type(dim, is_shadow, is_array,
glsl_get_base_type(sampled_type));
return;
}
case SpvOpTypeSampledImage:
val->type = vtn_value(b, w[2], vtn_value_type_type)->type;
break;
case SpvOpTypeRuntimeArray:
case SpvOpTypeOpaque:
case SpvOpTypeEvent:
@@ -693,10 +716,8 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
nir_variable *var = void_var;
switch (dec->decoration) {
case SpvDecorationPrecisionLow:
case SpvDecorationPrecisionMedium:
case SpvDecorationPrecisionHigh:
break; /* FIXME: Do nothing with these for now. */
case SpvDecorationRelaxedPrecision:
break; /* FIXME: Do nothing with this for now. */
case SpvDecorationSmooth:
var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
break;
@@ -758,9 +779,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationRowMajor:
case SpvDecorationColMajor:
case SpvDecorationGLSLShared:
case SpvDecorationGLSLStd140:
case SpvDecorationGLSLStd430:
case SpvDecorationGLSLPacked:
case SpvDecorationPatch:
case SpvDecorationRestrict:
case SpvDecorationAliased:
@@ -773,9 +791,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationSaturatedConversion:
case SpvDecorationStream:
case SpvDecorationOffset:
case SpvDecorationAlignment:
case SpvDecorationXfbBuffer:
case SpvDecorationStride:
case SpvDecorationFuncParamAttr:
case SpvDecorationFPRoundingMode:
case SpvDecorationFPFastMathMode:
@@ -801,7 +817,7 @@ get_builtin_variable(struct vtn_builder *b,
nir_variable_mode mode;
vtn_get_builtin_location(builtin, &var->data.location, &mode);
var->data.mode = mode;
var->name = ralloc_strdup(b->shader, "builtin");
var->name = ralloc_strdup(var, "builtin");
switch (mode) {
case nir_var_shader_in:
@@ -1118,7 +1134,6 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
case SpvStorageClassWorkgroupLocal:
case SpvStorageClassWorkgroupGlobal:
case SpvStorageClassGeneric:
case SpvStorageClassPrivate:
case SpvStorageClassAtomicCounter:
default:
unreachable("Unhandled variable storage class");
@@ -1270,10 +1285,9 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
break;
}
case SpvOpVariableArray:
case SpvOpCopyMemorySized:
case SpvOpArrayLength:
case SpvOpImagePointer:
case SpvOpImageTexelPointer:
default:
unreachable("Unhandled opcode");
}
@@ -1342,31 +1356,24 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
nir_tex_src srcs[8]; /* 8 should be enough */
nir_tex_src *p = srcs;
unsigned idx = 4;
unsigned coord_components = 0;
switch (opcode) {
case SpvOpTextureSample:
case SpvOpTextureSampleDref:
case SpvOpTextureSampleLod:
case SpvOpTextureSampleProj:
case SpvOpTextureSampleGrad:
case SpvOpTextureSampleOffset:
case SpvOpTextureSampleProjLod:
case SpvOpTextureSampleProjGrad:
case SpvOpTextureSampleLodOffset:
case SpvOpTextureSampleProjOffset:
case SpvOpTextureSampleGradOffset:
case SpvOpTextureSampleProjLodOffset:
case SpvOpTextureSampleProjGradOffset:
case SpvOpTextureFetchTexelLod:
case SpvOpTextureFetchTexelOffset:
case SpvOpTextureFetchSample:
case SpvOpTextureFetchTexel:
case SpvOpTextureGather:
case SpvOpTextureGatherOffset:
case SpvOpTextureGatherOffsets:
case SpvOpTextureQueryLod: {
case SpvOpImageSampleImplicitLod:
case SpvOpImageSampleExplicitLod:
case SpvOpImageSampleDrefImplicitLod:
case SpvOpImageSampleDrefExplicitLod:
case SpvOpImageSampleProjImplicitLod:
case SpvOpImageSampleProjExplicitLod:
case SpvOpImageSampleProjDrefImplicitLod:
case SpvOpImageSampleProjDrefExplicitLod:
case SpvOpImageFetch:
case SpvOpImageGather:
case SpvOpImageDrefGather:
case SpvOpImageQueryLod: {
/* All these types have the coordinate as their first real argument */
struct vtn_ssa_value *coord = vtn_ssa_value(b, w[4]);
struct vtn_ssa_value *coord = vtn_ssa_value(b, w[idx++]);
coord_components = glsl_get_vector_elements(coord->type);
p->src = nir_src_for_ssa(coord->def);
p->src_type = nir_tex_src_coord;
@@ -1380,43 +1387,36 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
nir_texop texop;
switch (opcode) {
case SpvOpTextureSample:
case SpvOpImageSampleImplicitLod:
texop = nir_texop_tex;
if (count == 6) {
texop = nir_texop_txb;
*p++ = vtn_tex_src(b, w[5], nir_tex_src_bias);
}
break;
case SpvOpTextureSampleDref:
case SpvOpTextureSampleLod:
case SpvOpTextureSampleProj:
case SpvOpTextureSampleGrad:
case SpvOpTextureSampleOffset:
case SpvOpTextureSampleProjLod:
case SpvOpTextureSampleProjGrad:
case SpvOpTextureSampleLodOffset:
case SpvOpTextureSampleProjOffset:
case SpvOpTextureSampleGradOffset:
case SpvOpTextureSampleProjLodOffset:
case SpvOpTextureSampleProjGradOffset:
case SpvOpTextureFetchTexelLod:
case SpvOpTextureFetchTexelOffset:
case SpvOpTextureFetchSample:
case SpvOpTextureFetchTexel:
case SpvOpTextureGather:
case SpvOpTextureGatherOffset:
case SpvOpTextureGatherOffsets:
case SpvOpTextureQuerySizeLod:
case SpvOpTextureQuerySize:
case SpvOpTextureQueryLod:
case SpvOpTextureQueryLevels:
case SpvOpTextureQuerySamples:
case SpvOpImageSampleExplicitLod:
case SpvOpImageSampleDrefImplicitLod:
case SpvOpImageSampleDrefExplicitLod:
case SpvOpImageSampleProjImplicitLod:
case SpvOpImageSampleProjExplicitLod:
case SpvOpImageSampleProjDrefImplicitLod:
case SpvOpImageSampleProjDrefExplicitLod:
case SpvOpImageFetch:
case SpvOpImageGather:
case SpvOpImageDrefGather:
case SpvOpImageQuerySizeLod:
case SpvOpImageQuerySize:
case SpvOpImageQueryLod:
case SpvOpImageQueryLevels:
case SpvOpImageQuerySamples:
default:
unreachable("Unhandled opcode");
}
/* From now on, the remaining sources are "Optional Image Operands." */
if (idx < count) {
/* XXX handle these (bias, lod, etc.) */
assert(0);
}
nir_tex_instr *instr = nir_tex_instr_create(b->shader, p - srcs);
const struct glsl_type *sampler_type = nir_deref_tail(&sampler->deref)->type;
@@ -1742,7 +1742,8 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
case SpvOpShiftRightArithmetic: op = nir_op_ishr; break;
case SpvOpShiftLeftLogical: op = nir_op_ishl; break;
case SpvOpLogicalOr: op = nir_op_ior; break;
case SpvOpLogicalXor: op = nir_op_ixor; break;
case SpvOpLogicalEqual: op = nir_op_ieq; break;
case SpvOpLogicalNotEqual: op = nir_op_ine; break;
case SpvOpLogicalAnd: op = nir_op_iand; break;
case SpvOpBitwiseOr: op = nir_op_ior; break;
case SpvOpBitwiseXor: op = nir_op_ixor; break;
@@ -1840,6 +1841,7 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
nir_alu_instr *instr = nir_alu_instr_create(b->shader, op);
nir_ssa_dest_init(&instr->instr, &instr->dest.dest,
glsl_get_vector_elements(type), val->name);
instr->dest.write_mask = (1 << glsl_get_vector_elements(type)) - 1;
val->ssa->def = &instr->dest.dest.ssa;
for (unsigned i = 0; i < nir_op_infos[op].num_inputs; i++)
@@ -2199,11 +2201,19 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
switch (opcode) {
case SpvOpSource:
case SpvOpSourceExtension:
case SpvOpCompileFlag:
case SpvOpExtension:
/* Unhandled, but these are for debug so that's ok. */
break;
case SpvOpCapability:
/*
* TODO properly handle these and give a real error if asking for too
* much.
*/
assert(w[1] == SpvCapabilityMatrix ||
w[1] == SpvCapabilityShader);
break;
case SpvOpExtInstImport:
vtn_handle_extension(b, opcode, w, count);
break;
@@ -2220,7 +2230,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
break;
case SpvOpExecutionMode:
unreachable("Execution modes not yet implemented");
/*
* TODO handle these - for Vulkan OriginUpperLeft is always set for
* fragment shaders, so we can ignore this for now
*/
break;
case SpvOpString:
@@ -2253,7 +2266,9 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpTypeFloat:
case SpvOpTypeVector:
case SpvOpTypeMatrix:
case SpvOpTypeImage:
case SpvOpTypeSampler:
case SpvOpTypeSampledImage:
case SpvOpTypeArray:
case SpvOpTypeRuntimeArray:
case SpvOpTypeStruct:
@@ -2273,8 +2288,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpConstant:
case SpvOpConstantComposite:
case SpvOpConstantSampler:
case SpvOpConstantNullPointer:
case SpvOpConstantNullObject:
case SpvOpSpecConstantTrue:
case SpvOpSpecConstantFalse:
case SpvOpSpecConstant:
@@ -2421,7 +2434,6 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
break;
case SpvOpVariable:
case SpvOpVariableArray:
case SpvOpLoad:
case SpvOpStore:
case SpvOpCopyMemory:
@@ -2429,7 +2441,7 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpAccessChain:
case SpvOpInBoundsAccessChain:
case SpvOpArrayLength:
case SpvOpImagePointer:
case SpvOpImageTexelPointer:
vtn_handle_variables(b, opcode, w, count);
break;
@@ -2437,31 +2449,22 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
vtn_handle_function_call(b, opcode, w, count);
break;
case SpvOpTextureSample:
case SpvOpTextureSampleDref:
case SpvOpTextureSampleLod:
case SpvOpTextureSampleProj:
case SpvOpTextureSampleGrad:
case SpvOpTextureSampleOffset:
case SpvOpTextureSampleProjLod:
case SpvOpTextureSampleProjGrad:
case SpvOpTextureSampleLodOffset:
case SpvOpTextureSampleProjOffset:
case SpvOpTextureSampleGradOffset:
case SpvOpTextureSampleProjLodOffset:
case SpvOpTextureSampleProjGradOffset:
case SpvOpTextureFetchTexelLod:
case SpvOpTextureFetchTexelOffset:
case SpvOpTextureFetchSample:
case SpvOpTextureFetchTexel:
case SpvOpTextureGather:
case SpvOpTextureGatherOffset:
case SpvOpTextureGatherOffsets:
case SpvOpTextureQuerySizeLod:
case SpvOpTextureQuerySize:
case SpvOpTextureQueryLod:
case SpvOpTextureQueryLevels:
case SpvOpTextureQuerySamples:
case SpvOpImageSampleImplicitLod:
case SpvOpImageSampleExplicitLod:
case SpvOpImageSampleDrefImplicitLod:
case SpvOpImageSampleDrefExplicitLod:
case SpvOpImageSampleProjImplicitLod:
case SpvOpImageSampleProjExplicitLod:
case SpvOpImageSampleProjDrefImplicitLod:
case SpvOpImageSampleProjDrefExplicitLod:
case SpvOpImageFetch:
case SpvOpImageGather:
case SpvOpImageDrefGather:
case SpvOpImageQuerySizeLod:
case SpvOpImageQuerySize:
case SpvOpImageQueryLod:
case SpvOpImageQueryLevels:
case SpvOpImageQuerySamples:
vtn_handle_texture(b, opcode, w, count);
break;
@@ -2510,7 +2513,8 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpShiftRightArithmetic:
case SpvOpShiftLeftLogical:
case SpvOpLogicalOr:
case SpvOpLogicalXor:
case SpvOpLogicalEqual:
case SpvOpLogicalNotEqual:
case SpvOpLogicalAnd:
case SpvOpBitwiseOr:
case SpvOpBitwiseXor:
@@ -2788,7 +2792,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
struct vtn_builder *b = rzalloc(NULL, struct vtn_builder);
b->shader = shader;
b->value_id_bound = value_id_bound;
b->values = ralloc_array(b, struct vtn_value, value_id_bound);
b->values = rzalloc_array(b, struct vtn_value, value_id_bound);
exec_list_make_empty(&b->functions);
/* Handle all the preamble instructions */

View File

@@ -40,8 +40,11 @@ gl_HEADERS = $(top_srcdir)/include/GL/*.h
.PHONY: main/git_sha1.h.tmp
main/git_sha1.h.tmp:
@# Don't assume that $(top_srcdir)/.git is a directory. It may be
@# a gitlink file if $(top_srcdir) is a submodule checkout or a linked
@# worktree.
@touch main/git_sha1.h.tmp
@if test -d $(top_srcdir)/.git; then \
@if test -e $(top_srcdir)/.git; then \
if which git > /dev/null; then \
git --git-dir=$(top_srcdir)/.git log -n 1 --oneline | \
sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \

View File

@@ -57,6 +57,8 @@ libvulkan_la_SOURCES = \
private.h \
gem.c \
device.c \
anv_cmd_buffer.c \
anv_cmd_emit.c \
aub.c \
allocator.c \
util.c \

706
src/vulkan/anv_cmd_buffer.c Normal file
View File

@@ -0,0 +1,706 @@
/*
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "private.h"
/** \file anv_cmd_buffer.c
*
* This file contains functions related to anv_cmd_buffer as a data
* structure. This involves everything required to create and destroy
* the actual batch buffers as well as link them together and handle
* relocations and surface state. It specifically does *not* contain any
* handling of actual vkCmd calls beyond vkCmdExecuteCommands.
*/
/*-----------------------------------------------------------------------*
* Functions related to anv_reloc_list
*-----------------------------------------------------------------------*/
VkResult
anv_reloc_list_init(struct anv_reloc_list *list, struct anv_device *device)
{
list->num_relocs = 0;
list->array_length = 256;
list->relocs =
anv_device_alloc(device, list->array_length * sizeof(*list->relocs), 8,
VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (list->relocs == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
list->reloc_bos =
anv_device_alloc(device, list->array_length * sizeof(*list->reloc_bos), 8,
VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (list->relocs == NULL) {
anv_device_free(device, list->relocs);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
return VK_SUCCESS;
}
void
anv_reloc_list_finish(struct anv_reloc_list *list, struct anv_device *device)
{
anv_device_free(device, list->relocs);
anv_device_free(device, list->reloc_bos);
}
static VkResult
anv_reloc_list_grow(struct anv_reloc_list *list, struct anv_device *device,
size_t num_additional_relocs)
{
if (list->num_relocs + num_additional_relocs <= list->array_length)
return VK_SUCCESS;
size_t new_length = list->array_length * 2;
while (new_length < list->num_relocs + num_additional_relocs)
new_length *= 2;
struct drm_i915_gem_relocation_entry *new_relocs =
anv_device_alloc(device, new_length * sizeof(*list->relocs), 8,
VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (new_relocs == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct anv_bo **new_reloc_bos =
anv_device_alloc(device, new_length * sizeof(*list->reloc_bos), 8,
VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (new_relocs == NULL) {
anv_device_free(device, new_relocs);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
memcpy(new_relocs, list->relocs, list->num_relocs * sizeof(*list->relocs));
memcpy(new_reloc_bos, list->reloc_bos,
list->num_relocs * sizeof(*list->reloc_bos));
anv_device_free(device, list->relocs);
anv_device_free(device, list->reloc_bos);
list->relocs = new_relocs;
list->reloc_bos = new_reloc_bos;
return VK_SUCCESS;
}
uint64_t
anv_reloc_list_add(struct anv_reloc_list *list, struct anv_device *device,
uint32_t offset, struct anv_bo *target_bo, uint32_t delta)
{
struct drm_i915_gem_relocation_entry *entry;
int index;
anv_reloc_list_grow(list, device, 1);
/* TODO: Handle failure */
/* XXX: Can we use I915_EXEC_HANDLE_LUT? */
index = list->num_relocs++;
list->reloc_bos[index] = target_bo;
entry = &list->relocs[index];
entry->target_handle = target_bo->gem_handle;
entry->delta = delta;
entry->offset = offset;
entry->presumed_offset = target_bo->offset;
entry->read_domains = 0;
entry->write_domain = 0;
return target_bo->offset + delta;
}
static void
anv_reloc_list_append(struct anv_reloc_list *list, struct anv_device *device,
struct anv_reloc_list *other, uint32_t offset)
{
anv_reloc_list_grow(list, device, other->num_relocs);
/* TODO: Handle failure */
memcpy(&list->relocs[list->num_relocs], &other->relocs[0],
other->num_relocs * sizeof(other->relocs[0]));
memcpy(&list->reloc_bos[list->num_relocs], &other->reloc_bos[0],
other->num_relocs * sizeof(other->reloc_bos[0]));
for (uint32_t i = 0; i < other->num_relocs; i++)
list->relocs[i + list->num_relocs].offset += offset;
list->num_relocs += other->num_relocs;
}
/*-----------------------------------------------------------------------*
* Functions related to anv_batch
*-----------------------------------------------------------------------*/
void *
anv_batch_emit_dwords(struct anv_batch *batch, int num_dwords)
{
if (batch->next + num_dwords * 4 > batch->end)
batch->extend_cb(batch, batch->user_data);
void *p = batch->next;
batch->next += num_dwords * 4;
assert(batch->next <= batch->end);
return p;
}
uint64_t
anv_batch_emit_reloc(struct anv_batch *batch,
void *location, struct anv_bo *bo, uint32_t delta)
{
return anv_reloc_list_add(&batch->relocs, batch->device,
location - batch->start, bo, delta);
}
void
anv_batch_emit_batch(struct anv_batch *batch, struct anv_batch *other)
{
uint32_t size, offset;
size = other->next - other->start;
assert(size % 4 == 0);
if (batch->next + size > batch->end)
batch->extend_cb(batch, batch->user_data);
assert(batch->next + size <= batch->end);
memcpy(batch->next, other->start, size);
offset = batch->next - batch->start;
anv_reloc_list_append(&batch->relocs, batch->device,
&other->relocs, offset);
batch->next += size;
}
/*-----------------------------------------------------------------------*
* Functions related to anv_batch_bo
*-----------------------------------------------------------------------*/
static VkResult
anv_batch_bo_create(struct anv_device *device, struct anv_batch_bo **bbo_out)
{
VkResult result;
struct anv_batch_bo *bbo =
anv_device_alloc(device, sizeof(*bbo), 8, VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
bbo->num_relocs = 0;
bbo->prev_batch_bo = NULL;
result = anv_bo_pool_alloc(&device->batch_bo_pool, &bbo->bo);
if (result != VK_SUCCESS) {
anv_device_free(device, bbo);
return result;
}
*bbo_out = bbo;
return VK_SUCCESS;
}
static void
anv_batch_bo_start(struct anv_batch_bo *bbo, struct anv_batch *batch,
size_t batch_padding)
{
batch->next = batch->start = bbo->bo.map;
batch->end = bbo->bo.map + bbo->bo.size - batch_padding;
bbo->first_reloc = batch->relocs.num_relocs;
}
static void
anv_batch_bo_finish(struct anv_batch_bo *bbo, struct anv_batch *batch)
{
/* Round batch up to an even number of dwords. */
if ((batch->next - batch->start) & 4)
anv_batch_emit(batch, GEN8_MI_NOOP);
assert(batch->start == bbo->bo.map);
bbo->length = batch->next - batch->start;
VG(VALGRIND_CHECK_MEM_IS_DEFINED(batch->start, bbo->length));
bbo->num_relocs = batch->relocs.num_relocs - bbo->first_reloc;
}
static void
anv_batch_bo_destroy(struct anv_batch_bo *bbo, struct anv_device *device)
{
anv_bo_pool_free(&device->batch_bo_pool, &bbo->bo);
anv_device_free(device, bbo);
}
/*-----------------------------------------------------------------------*
* Functions related to anv_batch_bo
*-----------------------------------------------------------------------*/
static VkResult
anv_cmd_buffer_chain_batch(struct anv_batch *batch, void *_data)
{
struct anv_cmd_buffer *cmd_buffer = _data;
struct anv_batch_bo *new_bbo, *old_bbo = cmd_buffer->last_batch_bo;
VkResult result = anv_batch_bo_create(cmd_buffer->device, &new_bbo);
if (result != VK_SUCCESS)
return result;
/* We set the end of the batch a little short so we would be sure we
* have room for the chaining command. Since we're about to emit the
* chaining command, let's set it back where it should go.
*/
batch->end += GEN8_MI_BATCH_BUFFER_START_length * 4;
assert(batch->end == old_bbo->bo.map + old_bbo->bo.size);
anv_batch_emit(batch, GEN8_MI_BATCH_BUFFER_START,
GEN8_MI_BATCH_BUFFER_START_header,
._2ndLevelBatchBuffer = _1stlevelbatch,
.AddressSpaceIndicator = ASI_PPGTT,
.BatchBufferStartAddress = { &new_bbo->bo, 0 },
);
anv_batch_bo_finish(cmd_buffer->last_batch_bo, batch);
new_bbo->prev_batch_bo = old_bbo;
cmd_buffer->last_batch_bo = new_bbo;
anv_batch_bo_start(new_bbo, batch, GEN8_MI_BATCH_BUFFER_START_length * 4);
return VK_SUCCESS;
}
struct anv_state
anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer,
uint32_t size, uint32_t alignment)
{
struct anv_state state;
state.offset = align_u32(cmd_buffer->surface_next, alignment);
if (state.offset + size > cmd_buffer->surface_batch_bo->bo.size)
return (struct anv_state) { 0 };
state.map = cmd_buffer->surface_batch_bo->bo.map + state.offset;
state.alloc_size = size;
cmd_buffer->surface_next = state.offset + size;
assert(state.offset + size <= cmd_buffer->surface_batch_bo->bo.size);
return state;
}
struct anv_state
anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer,
uint32_t size, uint32_t alignment)
{
return anv_state_stream_alloc(&cmd_buffer->dynamic_state_stream,
size, alignment);
}
VkResult
anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer)
{
struct anv_batch_bo *new_bbo, *old_bbo = cmd_buffer->surface_batch_bo;
/* Finish off the old buffer */
old_bbo->num_relocs =
cmd_buffer->surface_relocs.num_relocs - old_bbo->first_reloc;
old_bbo->length = cmd_buffer->surface_next;
VkResult result = anv_batch_bo_create(cmd_buffer->device, &new_bbo);
if (result != VK_SUCCESS)
return result;
new_bbo->first_reloc = cmd_buffer->surface_relocs.num_relocs;
cmd_buffer->surface_next = 1;
new_bbo->prev_batch_bo = old_bbo;
cmd_buffer->surface_batch_bo = new_bbo;
/* Re-emit state base addresses so we get the new surface state base
* address before we start emitting binding tables etc.
*/
anv_cmd_buffer_emit_state_base_address(cmd_buffer);
/* After re-setting the surface state base address, we have to do some
* cache flusing so that the sampler engine will pick up the new
* SURFACE_STATE objects and binding tables. From the Broadwell PRM,
* Shared Function > 3D Sampler > State > State Caching (page 96):
*
* Coherency with system memory in the state cache, like the texture
* cache is handled partially by software. It is expected that the
* command stream or shader will issue Cache Flush operation or
* Cache_Flush sampler message to ensure that the L1 cache remains
* coherent with system memory.
*
* [...]
*
* Whenever the value of the Dynamic_State_Base_Addr,
* Surface_State_Base_Addr are altered, the L1 state cache must be
* invalidated to ensure the new surface or sampler state is fetched
* from system memory.
*
* The PIPE_CONTROL command has a "State Cache Invalidation Enable" bit
* which, according the PIPE_CONTROL instruction documentation in the
* Broadwell PRM:
*
* Setting this bit is independent of any other bit in this packet.
* This bit controls the invalidation of the L1 and L2 state caches
* at the top of the pipe i.e. at the parsing time.
*
* Unfortunately, experimentation seems to indicate that state cache
* invalidation through a PIPE_CONTROL does nothing whatsoever in
* regards to surface state and binding tables. In stead, it seems that
* invalidating the texture cache is what is actually needed.
*
* XXX: As far as we have been able to determine through
* experimentation, shows that flush the texture cache appears to be
* sufficient. The theory here is that all of the sampling/rendering
* units cache the binding table in the texture cache. However, we have
* yet to be able to actually confirm this.
*/
anv_batch_emit(&cmd_buffer->batch, GEN8_PIPE_CONTROL,
.TextureCacheInvalidationEnable = true);
return VK_SUCCESS;
}
VkResult anv_CreateCommandBuffer(
VkDevice _device,
const VkCmdBufferCreateInfo* pCreateInfo,
VkCmdBuffer* pCmdBuffer)
{
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_cmd_buffer *cmd_buffer;
VkResult result;
assert(pCreateInfo->level == VK_CMD_BUFFER_LEVEL_PRIMARY);
cmd_buffer = anv_device_alloc(device, sizeof(*cmd_buffer), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (cmd_buffer == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
cmd_buffer->device = device;
result = anv_batch_bo_create(device, &cmd_buffer->last_batch_bo);
if (result != VK_SUCCESS)
goto fail;
result = anv_reloc_list_init(&cmd_buffer->batch.relocs, device);
if (result != VK_SUCCESS)
goto fail_batch_bo;
cmd_buffer->batch.device = device;
cmd_buffer->batch.extend_cb = anv_cmd_buffer_chain_batch;
cmd_buffer->batch.user_data = cmd_buffer;
anv_batch_bo_start(cmd_buffer->last_batch_bo, &cmd_buffer->batch,
GEN8_MI_BATCH_BUFFER_START_length * 4);
result = anv_batch_bo_create(device, &cmd_buffer->surface_batch_bo);
if (result != VK_SUCCESS)
goto fail_batch_relocs;
cmd_buffer->surface_batch_bo->first_reloc = 0;
result = anv_reloc_list_init(&cmd_buffer->surface_relocs, device);
if (result != VK_SUCCESS)
goto fail_ss_batch_bo;
/* Start surface_next at 1 so surface offset 0 is invalid. */
cmd_buffer->surface_next = 1;
cmd_buffer->exec2_objects = NULL;
cmd_buffer->exec2_bos = NULL;
cmd_buffer->exec2_array_length = 0;
anv_state_stream_init(&cmd_buffer->surface_state_stream,
&device->surface_state_block_pool);
anv_state_stream_init(&cmd_buffer->dynamic_state_stream,
&device->dynamic_state_block_pool);
anv_cmd_state_init(&cmd_buffer->state);
*pCmdBuffer = anv_cmd_buffer_to_handle(cmd_buffer);
return VK_SUCCESS;
fail_ss_batch_bo:
anv_batch_bo_destroy(cmd_buffer->surface_batch_bo, device);
fail_batch_relocs:
anv_reloc_list_finish(&cmd_buffer->batch.relocs, device);
fail_batch_bo:
anv_batch_bo_destroy(cmd_buffer->last_batch_bo, device);
fail:
anv_device_free(device, cmd_buffer);
return result;
}
VkResult anv_DestroyCommandBuffer(
VkDevice _device,
VkCmdBuffer _cmd_buffer)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, _cmd_buffer);
anv_cmd_state_fini(&cmd_buffer->state);
/* Destroy all of the batch buffers */
struct anv_batch_bo *bbo = cmd_buffer->last_batch_bo;
while (bbo) {
struct anv_batch_bo *prev = bbo->prev_batch_bo;
anv_batch_bo_destroy(bbo, device);
bbo = prev;
}
anv_reloc_list_finish(&cmd_buffer->batch.relocs, device);
/* Destroy all of the surface state buffers */
bbo = cmd_buffer->surface_batch_bo;
while (bbo) {
struct anv_batch_bo *prev = bbo->prev_batch_bo;
anv_batch_bo_destroy(bbo, device);
bbo = prev;
}
anv_reloc_list_finish(&cmd_buffer->surface_relocs, device);
anv_state_stream_finish(&cmd_buffer->surface_state_stream);
anv_state_stream_finish(&cmd_buffer->dynamic_state_stream);
anv_device_free(device, cmd_buffer->exec2_objects);
anv_device_free(device, cmd_buffer->exec2_bos);
anv_device_free(device, cmd_buffer);
return VK_SUCCESS;
}
static VkResult
anv_cmd_buffer_add_bo(struct anv_cmd_buffer *cmd_buffer,
struct anv_bo *bo,
struct drm_i915_gem_relocation_entry *relocs,
size_t num_relocs)
{
struct drm_i915_gem_exec_object2 *obj;
if (bo->index < cmd_buffer->exec2_bo_count &&
cmd_buffer->exec2_bos[bo->index] == bo)
return VK_SUCCESS;
if (cmd_buffer->exec2_bo_count >= cmd_buffer->exec2_array_length) {
uint32_t new_len = cmd_buffer->exec2_objects ?
cmd_buffer->exec2_array_length * 2 : 64;
struct drm_i915_gem_exec_object2 *new_objects =
anv_device_alloc(cmd_buffer->device, new_len * sizeof(*new_objects),
8, VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (new_objects == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct anv_bo **new_bos =
anv_device_alloc(cmd_buffer->device, new_len * sizeof(*new_bos),
8, VK_SYSTEM_ALLOC_TYPE_INTERNAL);
if (new_objects == NULL) {
anv_device_free(cmd_buffer->device, new_objects);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
if (cmd_buffer->exec2_objects) {
memcpy(new_objects, cmd_buffer->exec2_objects,
cmd_buffer->exec2_bo_count * sizeof(*new_objects));
memcpy(new_bos, cmd_buffer->exec2_bos,
cmd_buffer->exec2_bo_count * sizeof(*new_bos));
}
cmd_buffer->exec2_objects = new_objects;
cmd_buffer->exec2_bos = new_bos;
cmd_buffer->exec2_array_length = new_len;
}
assert(cmd_buffer->exec2_bo_count < cmd_buffer->exec2_array_length);
bo->index = cmd_buffer->exec2_bo_count++;
obj = &cmd_buffer->exec2_objects[bo->index];
cmd_buffer->exec2_bos[bo->index] = bo;
obj->handle = bo->gem_handle;
obj->relocation_count = 0;
obj->relocs_ptr = 0;
obj->alignment = 0;
obj->offset = bo->offset;
obj->flags = 0;
obj->rsvd1 = 0;
obj->rsvd2 = 0;
if (relocs) {
obj->relocation_count = num_relocs;
obj->relocs_ptr = (uintptr_t) relocs;
}
return VK_SUCCESS;
}
static void
anv_cmd_buffer_add_validate_bos(struct anv_cmd_buffer *cmd_buffer,
struct anv_reloc_list *list)
{
for (size_t i = 0; i < list->num_relocs; i++)
anv_cmd_buffer_add_bo(cmd_buffer, list->reloc_bos[i], NULL, 0);
}
static void
anv_cmd_buffer_process_relocs(struct anv_cmd_buffer *cmd_buffer,
struct anv_reloc_list *list)
{
struct anv_bo *bo;
/* If the kernel supports I915_EXEC_NO_RELOC, it will compare offset in
* struct drm_i915_gem_exec_object2 against the bos current offset and if
* all bos haven't moved it will skip relocation processing alltogether.
* If I915_EXEC_NO_RELOC is not supported, the kernel ignores the incoming
* value of offset so we can set it either way. For that to work we need
* to make sure all relocs use the same presumed offset.
*/
for (size_t i = 0; i < list->num_relocs; i++) {
bo = list->reloc_bos[i];
if (bo->offset != list->relocs[i].presumed_offset)
cmd_buffer->need_reloc = true;
list->relocs[i].target_handle = bo->index;
}
}
VkResult anv_EndCommandBuffer(
VkCmdBuffer cmdBuffer)
{
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
struct anv_device *device = cmd_buffer->device;
struct anv_batch *batch = &cmd_buffer->batch;
anv_batch_emit(batch, GEN8_MI_BATCH_BUFFER_END);
anv_batch_bo_finish(cmd_buffer->last_batch_bo, &cmd_buffer->batch);
cmd_buffer->surface_batch_bo->num_relocs =
cmd_buffer->surface_relocs.num_relocs - cmd_buffer->surface_batch_bo->first_reloc;
cmd_buffer->surface_batch_bo->length = cmd_buffer->surface_next;
cmd_buffer->exec2_bo_count = 0;
cmd_buffer->need_reloc = false;
/* Lock for access to bo->index. */
pthread_mutex_lock(&device->mutex);
/* Add surface state bos first so we can add them with their relocs. */
for (struct anv_batch_bo *bbo = cmd_buffer->surface_batch_bo;
bbo != NULL; bbo = bbo->prev_batch_bo) {
anv_cmd_buffer_add_bo(cmd_buffer, &bbo->bo,
&cmd_buffer->surface_relocs.relocs[bbo->first_reloc],
bbo->num_relocs);
}
/* Add all of the BOs referenced by surface state */
anv_cmd_buffer_add_validate_bos(cmd_buffer, &cmd_buffer->surface_relocs);
/* Add all but the first batch BO */
struct anv_batch_bo *batch_bo = cmd_buffer->last_batch_bo;
while (batch_bo->prev_batch_bo) {
anv_cmd_buffer_add_bo(cmd_buffer, &batch_bo->bo,
&batch->relocs.relocs[batch_bo->first_reloc],
batch_bo->num_relocs);
batch_bo = batch_bo->prev_batch_bo;
}
/* Add everything referenced by the batches */
anv_cmd_buffer_add_validate_bos(cmd_buffer, &batch->relocs);
/* Add the first batch bo last */
assert(batch_bo->prev_batch_bo == NULL && batch_bo->first_reloc == 0);
anv_cmd_buffer_add_bo(cmd_buffer, &batch_bo->bo,
&batch->relocs.relocs[batch_bo->first_reloc],
batch_bo->num_relocs);
assert(batch_bo->bo.index == cmd_buffer->exec2_bo_count - 1);
anv_cmd_buffer_process_relocs(cmd_buffer, &cmd_buffer->surface_relocs);
anv_cmd_buffer_process_relocs(cmd_buffer, &batch->relocs);
cmd_buffer->execbuf.buffers_ptr = (uintptr_t) cmd_buffer->exec2_objects;
cmd_buffer->execbuf.buffer_count = cmd_buffer->exec2_bo_count;
cmd_buffer->execbuf.batch_start_offset = 0;
cmd_buffer->execbuf.batch_len = batch->next - batch->start;
cmd_buffer->execbuf.cliprects_ptr = 0;
cmd_buffer->execbuf.num_cliprects = 0;
cmd_buffer->execbuf.DR1 = 0;
cmd_buffer->execbuf.DR4 = 0;
cmd_buffer->execbuf.flags = I915_EXEC_HANDLE_LUT;
if (!cmd_buffer->need_reloc)
cmd_buffer->execbuf.flags |= I915_EXEC_NO_RELOC;
cmd_buffer->execbuf.flags |= I915_EXEC_RENDER;
cmd_buffer->execbuf.rsvd1 = device->context_id;
cmd_buffer->execbuf.rsvd2 = 0;
pthread_mutex_unlock(&device->mutex);
return VK_SUCCESS;
}
VkResult anv_ResetCommandBuffer(
VkCmdBuffer cmdBuffer,
VkCmdBufferResetFlags flags)
{
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
/* Delete all but the first batch bo */
while (cmd_buffer->last_batch_bo->prev_batch_bo) {
struct anv_batch_bo *prev = cmd_buffer->last_batch_bo->prev_batch_bo;
anv_batch_bo_destroy(cmd_buffer->last_batch_bo, cmd_buffer->device);
cmd_buffer->last_batch_bo = prev;
}
assert(cmd_buffer->last_batch_bo->prev_batch_bo == NULL);
cmd_buffer->batch.relocs.num_relocs = 0;
anv_batch_bo_start(cmd_buffer->last_batch_bo, &cmd_buffer->batch,
GEN8_MI_BATCH_BUFFER_START_length * 4);
/* Delete all but the first batch bo */
while (cmd_buffer->surface_batch_bo->prev_batch_bo) {
struct anv_batch_bo *prev = cmd_buffer->surface_batch_bo->prev_batch_bo;
anv_batch_bo_destroy(cmd_buffer->surface_batch_bo, cmd_buffer->device);
cmd_buffer->surface_batch_bo = prev;
}
assert(cmd_buffer->surface_batch_bo->prev_batch_bo == NULL);
cmd_buffer->surface_next = 1;
cmd_buffer->surface_relocs.num_relocs = 0;
anv_cmd_state_fini(&cmd_buffer->state);
anv_cmd_state_init(&cmd_buffer->state);
return VK_SUCCESS;
}

1222
src/vulkan/anv_cmd_emit.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -248,9 +248,9 @@ anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer)
if (writer == NULL)
return;
aub_bos = malloc(cmd_buffer->bo_count * sizeof(aub_bos[0]));
aub_bos = malloc(cmd_buffer->exec2_bo_count * sizeof(aub_bos[0]));
offset = writer->offset;
for (uint32_t i = 0; i < cmd_buffer->bo_count; i++) {
for (uint32_t i = 0; i < cmd_buffer->exec2_bo_count; i++) {
bo = cmd_buffer->exec2_bos[i];
if (bo->map)
aub_bos[i].map = bo->map;
@@ -282,9 +282,9 @@ anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer)
bbo->num_relocs, aub_bos);
}
for (uint32_t i = 0; i < cmd_buffer->bo_count; i++) {
for (uint32_t i = 0; i < cmd_buffer->exec2_bo_count; i++) {
bo = cmd_buffer->exec2_bos[i];
if (i == cmd_buffer->bo_count - 1) {
if (i == cmd_buffer->exec2_bo_count - 1) {
assert(bo == &first_bbo->bo);
aub_write_trace_block(writer, AUB_TRACE_TYPE_BATCH,
aub_bos[i].relocated,

View File

@@ -942,7 +942,7 @@ anv_compile_shader_glsl(struct anv_compiler *compiler,
shader = brw_new_shader(&brw->ctx, name, stage_info[stage].token);
fail_if(shader == NULL, "failed to create %s shader\n", stage_info[stage].name);
shader->Source = strdup(src_as_glsl(pipeline->shaders[stage]->data));
shader->Source = strdup(src_as_glsl(pipeline->shaders[stage]->module->data));
_mesa_glsl_compile_shader(&brw->ctx, shader, false, false);
fail_on_compile_error(shader->CompileStatus, shader->InfoLog);
@@ -950,6 +950,23 @@ anv_compile_shader_glsl(struct anv_compiler *compiler,
program->NumShaders++;
}
static void
setup_nir_io(struct gl_program *prog,
nir_shader *shader)
{
foreach_list_typed(nir_variable, var, node, &shader->inputs) {
prog->InputsRead |= BITFIELD64_BIT(var->data.location);
}
foreach_list_typed(nir_variable, var, node, &shader->outputs) {
/* XXX glslang gives us this but we never use it */
if (!strcmp(var->name, "gl_PerVertex"))
continue;
prog->OutputsWritten |= BITFIELD64_BIT(var->data.location);
}
}
static void
anv_compile_shader_spirv(struct anv_compiler *compiler,
struct gl_shader_program *program,
@@ -964,17 +981,34 @@ anv_compile_shader_spirv(struct anv_compiler *compiler,
fail_if(mesa_shader == NULL,
"failed to create %s shader\n", stage_info[stage].name);
mesa_shader->Program = rzalloc(mesa_shader, struct gl_program);
switch (stage) {
case VK_SHADER_STAGE_VERTEX:
mesa_shader->Program = &rzalloc(mesa_shader, struct brw_vertex_program)->program.Base;
break;
case VK_SHADER_STAGE_GEOMETRY:
mesa_shader->Program = &rzalloc(mesa_shader, struct brw_geometry_program)->program.Base;
break;
case VK_SHADER_STAGE_FRAGMENT:
mesa_shader->Program = &rzalloc(mesa_shader, struct brw_fragment_program)->program.Base;
break;
case VK_SHADER_STAGE_COMPUTE:
mesa_shader->Program = &rzalloc(mesa_shader, struct brw_compute_program)->program.Base;
break;
}
mesa_shader->Program->Parameters =
rzalloc(mesa_shader, struct gl_program_parameter_list);
mesa_shader->Type = stage_info[stage].token;
mesa_shader->Stage = stage_info[stage].stage;
assert(shader->size % 4 == 0);
assert(shader->module->size % 4 == 0);
struct gl_shader_compiler_options *glsl_options =
&compiler->screen->compiler->glsl_compiler_options[stage_info[stage].stage];
mesa_shader->Program->nir =
spirv_to_nir((uint32_t *)shader->data, shader->size / 4,
spirv_to_nir((uint32_t *)shader->module->data, shader->module->size / 4,
glsl_options->NirOptions);
nir_validate_shader(mesa_shader->Program->nir);
@@ -982,6 +1016,8 @@ anv_compile_shader_spirv(struct anv_compiler *compiler,
compiler->screen->devinfo,
NULL, mesa_shader->Stage);
setup_nir_io(mesa_shader->Program, mesa_shader->Program->nir);
fail_if(mesa_shader->Program->nir == NULL,
"failed to translate SPIR-V to NIR\n");
@@ -1018,6 +1054,8 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline)
int name = 0;
struct brw_context *brw = compiler->brw;
pipeline->writes_point_size = false;
/* When we free the pipeline, we detect stages based on the NULL status
* of various prog_data pointers. Make them NULL by default.
*/
@@ -1029,28 +1067,28 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline)
program = brw->ctx.Driver.NewShaderProgram(name);
program->Shaders = (struct gl_shader **)
calloc(VK_NUM_SHADER_STAGE, sizeof(struct gl_shader *));
calloc(VK_SHADER_STAGE_NUM, sizeof(struct gl_shader *));
fail_if(program == NULL || program->Shaders == NULL,
"failed to create program\n");
bool all_spirv = true;
for (unsigned i = 0; i < VK_NUM_SHADER_STAGE; i++) {
for (unsigned i = 0; i < VK_SHADER_STAGE_NUM; i++) {
if (pipeline->shaders[i] == NULL)
continue;
/* You need at least this much for "void main() { }" anyway */
assert(pipeline->shaders[i]->size >= 12);
assert(pipeline->shaders[i]->module->size >= 12);
if (src_as_glsl(pipeline->shaders[i]->data)) {
if (src_as_glsl(pipeline->shaders[i]->module->data)) {
all_spirv = false;
break;
}
assert(pipeline->shaders[i]->size % 4 == 0);
assert(pipeline->shaders[i]->module->size % 4 == 0);
}
if (all_spirv) {
for (unsigned i = 0; i < VK_NUM_SHADER_STAGE; i++) {
for (unsigned i = 0; i < VK_SHADER_STAGE_NUM; i++) {
if (pipeline->shaders[i])
anv_compile_shader_spirv(compiler, program, pipeline, i);
}
@@ -1060,7 +1098,7 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline)
program->_LinkedShaders[shader->Stage] = shader;
}
} else {
for (unsigned i = 0; i < VK_NUM_SHADER_STAGE; i++) {
for (unsigned i = 0; i < VK_SHADER_STAGE_NUM; i++) {
if (pipeline->shaders[i])
anv_compile_shader_glsl(compiler, program, pipeline, i);
}
@@ -1086,6 +1124,9 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline)
fail_if(!success, "do_wm_prog failed\n");
add_compiled_stage(pipeline, VK_SHADER_STAGE_VERTEX,
&pipeline->vs_prog_data.base.base);
if (vp->Base.OutputsWritten & VARYING_SLOT_PSIZ)
pipeline->writes_point_size = true;
} else {
memset(&pipeline->vs_prog_data, 0, sizeof(pipeline->vs_prog_data));
pipeline->vs_simd8 = NO_KERNEL;
@@ -1104,6 +1145,9 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline)
fail_if(!success, "do_gs_prog failed\n");
add_compiled_stage(pipeline, VK_SHADER_STAGE_GEOMETRY,
&pipeline->gs_prog_data.base.base);
if (gp->Base.OutputsWritten & VARYING_SLOT_PSIZ)
pipeline->writes_point_size = true;
} else {
pipeline->gs_vec4 = NO_KERNEL;
}
@@ -1157,7 +1201,7 @@ anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline)
void
anv_compiler_free(struct anv_pipeline *pipeline)
{
for (uint32_t stage = 0; stage < VK_NUM_SHADER_STAGE; stage++) {
for (uint32_t stage = 0; stage < VK_SHADER_STAGE_NUM; stage++) {
if (pipeline->prog_data[stage]) {
free(pipeline->prog_data[stage]->map_entries);
ralloc_free(pipeline->prog_data[stage]->param);

File diff suppressed because it is too large Load Diff

View File

@@ -215,6 +215,19 @@ anv_format_for_vk_format(VkFormat format)
return &anv_formats[format];
}
bool
anv_is_vk_format_depth_or_stencil(VkFormat format)
{
const struct anv_format *format_info =
anv_format_for_vk_format(format);
if (format_info->depth_format != UNSUPPORTED &&
format_info->depth_format != 0)
return true;
return format_info->has_stencil;
}
// Format capabilities
struct surface_format_info {
@@ -232,28 +245,31 @@ struct surface_format_info {
extern const struct surface_format_info surface_formats[];
VkResult anv_validate_GetFormatInfo(
VkDevice _device,
VkResult anv_validate_GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat _format,
VkFormatInfoType infoType,
size_t* pDataSize,
void* pData)
VkFormatProperties* pFormatProperties)
{
const struct anv_format *format = anv_format_for_vk_format(_format);
fprintf(stderr, "vkGetFormatInfo(%s)\n", format->name);
return anv_GetFormatInfo(_device, _format, infoType, pDataSize, pData);
fprintf(stderr, "vkGetFormatProperties(%s)\n", format->name);
return anv_GetPhysicalDeviceFormatProperties(physicalDevice, _format, pFormatProperties);
}
static void
anv_format_get_properties(struct anv_device *device,
const struct anv_format *format,
VkFormatProperties *properties)
VkResult anv_GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat _format,
VkFormatProperties* pFormatProperties)
{
ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
const struct surface_format_info *info;
int gen;
gen = device->info.gen * 10;
if (device->info.is_haswell)
const struct anv_format *format = anv_format_for_vk_format(_format);
if (format == NULL)
return vk_error(VK_ERROR_INVALID_VALUE);
gen = physical_device->info->gen * 10;
if (physical_device->info->is_haswell)
gen += 5;
if (format->surface_format == UNSUPPORTED)
@@ -280,42 +296,39 @@ anv_format_get_properties(struct anv_device *device,
linear |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
}
properties->linearTilingFeatures = linear;
properties->optimalTilingFeatures = tiled;
return;
pFormatProperties->linearTilingFeatures = linear;
pFormatProperties->optimalTilingFeatures = tiled;
return VK_SUCCESS;
unsupported:
properties->linearTilingFeatures = 0;
properties->optimalTilingFeatures = 0;
pFormatProperties->linearTilingFeatures = 0;
pFormatProperties->optimalTilingFeatures = 0;
return VK_SUCCESS;
}
VkResult anv_GetFormatInfo(
VkDevice _device,
VkFormat _format,
VkFormatInfoType infoType,
size_t* pDataSize,
void* pData)
VkResult anv_GetPhysicalDeviceImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkImageFormatProperties* pImageFormatProperties)
{
struct anv_device *device = (struct anv_device *) _device;
const struct anv_format *format;
VkFormatProperties *properties;
format = anv_format_for_vk_format(_format);
if (format == 0)
return vk_error(VK_ERROR_INVALID_VALUE);
switch (infoType) {
case VK_FORMAT_INFO_TYPE_PROPERTIES:
properties = (VkFormatProperties *)pData;
*pDataSize = sizeof(*properties);
if (pData == NULL)
return VK_SUCCESS;
anv_format_get_properties(device, format, properties);
return VK_SUCCESS;
default:
return vk_error(VK_ERROR_INVALID_VALUE);
}
/* TODO: We should do something here. Chad? */
stub_return(VK_UNSUPPORTED);
}
VkResult anv_GetPhysicalDeviceSparseImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
uint32_t samples,
VkImageUsageFlags usage,
VkImageTiling tiling,
uint32_t* pNumProperties,
VkSparseImageFormatProperties* pProperties)
{
stub_return(VK_UNSUPPORTED);
}

View File

@@ -230,13 +230,13 @@ anv_gem_destroy_context(struct anv_device *device, int context)
}
int
anv_gem_get_aperture(struct anv_device *device, uint64_t *size)
anv_gem_get_aperture(struct anv_physical_device *physical_dev, uint64_t *size)
{
struct drm_i915_gem_get_aperture aperture;
int ret;
VG_CLEAR(aperture);
ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
ret = anv_ioctl(physical_dev->fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
if (ret == -1)
return -1;

View File

@@ -184,7 +184,7 @@ GEN75_GPGPU_CSR_BASE_ADDRESS_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_STORE_REGISTER_MEM {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t UseGlobalGTT;
bool UseGlobalGTT;
uint32_t PredicateEnable;
uint32_t DwordLength;
uint32_t RegisterAddress;
@@ -288,27 +288,27 @@ struct GEN75_STATE_BASE_ADDRESS {
__gen_address_type GeneralStateBaseAddress;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE GeneralStateMemoryObjectControlState;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE StatelessDataPortAccessMemoryObjectControlState;
uint32_t GeneralStateBaseAddressModifyEnable;
bool GeneralStateBaseAddressModifyEnable;
__gen_address_type SurfaceStateBaseAddress;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE SurfaceStateMemoryObjectControlState;
uint32_t SurfaceStateBaseAddressModifyEnable;
bool SurfaceStateBaseAddressModifyEnable;
__gen_address_type DynamicStateBaseAddress;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE DynamicStateMemoryObjectControlState;
uint32_t DynamicStateBaseAddressModifyEnable;
bool DynamicStateBaseAddressModifyEnable;
__gen_address_type IndirectObjectBaseAddress;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE IndirectObjectMemoryObjectControlState;
uint32_t IndirectObjectBaseAddressModifyEnable;
bool IndirectObjectBaseAddressModifyEnable;
__gen_address_type InstructionBaseAddress;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE InstructionMemoryObjectControlState;
uint32_t InstructionBaseAddressModifyEnable;
bool InstructionBaseAddressModifyEnable;
__gen_address_type GeneralStateAccessUpperBound;
uint32_t GeneralStateAccessUpperBoundModifyEnable;
bool GeneralStateAccessUpperBoundModifyEnable;
__gen_address_type DynamicStateAccessUpperBound;
uint32_t DynamicStateAccessUpperBoundModifyEnable;
bool DynamicStateAccessUpperBoundModifyEnable;
__gen_address_type IndirectObjectAccessUpperBound;
uint32_t IndirectObjectAccessUpperBoundModifyEnable;
bool IndirectObjectAccessUpperBoundModifyEnable;
__gen_address_type InstructionAccessUpperBound;
uint32_t InstructionAccessUpperBoundModifyEnable;
bool InstructionAccessUpperBoundModifyEnable;
};
static inline void
@@ -546,11 +546,11 @@ struct GEN75_3DPRIMITIVE {
uint32_t CommandSubType;
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t IndirectParameterEnable;
bool IndirectParameterEnable;
uint32_t UAVCoherencyRequired;
uint32_t PredicateEnable;
bool PredicateEnable;
uint32_t DwordLength;
uint32_t EndOffsetEnable;
bool EndOffsetEnable;
#define SEQUENTIAL 0
#define RANDOM 1
uint32_t VertexAccessType;
@@ -1272,7 +1272,7 @@ struct GEN75_3DSTATE_CLEAR_PARAMS {
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t DepthClearValue;
uint32_t DepthClearValueValid;
bool DepthClearValueValid;
};
static inline void
@@ -1316,27 +1316,27 @@ struct GEN75_3DSTATE_CLIP {
uint32_t DwordLength;
uint32_t FrontWinding;
uint32_t VertexSubPixelPrecisionSelect;
uint32_t EarlyCullEnable;
bool EarlyCullEnable;
#define CULLMODE_BOTH 0
#define CULLMODE_NONE 1
#define CULLMODE_FRONT 2
#define CULLMODE_BACK 3
uint32_t CullMode;
uint32_t ClipperStatisticsEnable;
bool ClipperStatisticsEnable;
uint32_t UserClipDistanceCullTestEnableBitmask;
uint32_t ClipEnable;
bool ClipEnable;
#define APIMODE_OGL 0
uint32_t APIMode;
uint32_t ViewportXYClipTestEnable;
uint32_t ViewportZClipTestEnable;
uint32_t GuardbandClipTestEnable;
bool ViewportXYClipTestEnable;
bool ViewportZClipTestEnable;
bool GuardbandClipTestEnable;
uint32_t UserClipDistanceClipTestEnableBitmask;
#define CLIPMODE_NORMAL 0
#define CLIPMODE_REJECT_ALL 3
#define CLIPMODE_ACCEPT_ALL 4
uint32_t ClipMode;
uint32_t PerspectiveDivideDisable;
uint32_t NonPerspectiveBarycentricEnable;
bool PerspectiveDivideDisable;
bool NonPerspectiveBarycentricEnable;
#define Vertex0 0
#define Vertex1 1
#define Vertex2 2
@@ -1350,7 +1350,7 @@ struct GEN75_3DSTATE_CLIP {
uint32_t TriangleFanProvokingVertexSelect;
float MinimumPointWidth;
float MaximumPointWidth;
uint32_t ForceZeroRTAIndexEnable;
bool ForceZeroRTAIndexEnable;
uint32_t MaximumVPIndex;
};
@@ -1654,9 +1654,9 @@ struct GEN75_3DSTATE_DEPTH_BUFFER {
#define SURFTYPE_CUBE 3
#define SURFTYPE_NULL 7
uint32_t SurfaceType;
uint32_t DepthWriteEnable;
uint32_t StencilWriteEnable;
uint32_t HierarchicalDepthBufferEnable;
bool DepthWriteEnable;
bool StencilWriteEnable;
bool HierarchicalDepthBufferEnable;
#define D32_FLOAT 1
#define D24_UNORM_X8_UINT 3
#define D16_UNORM 5
@@ -1862,19 +1862,19 @@ struct GEN75_3DSTATE_DS {
#define IEEE754 0
#define Alternate 1
uint32_t FloatingPointMode;
uint32_t AccessesUAV;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool AccessesUAV;
bool IllegalOpcodeExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBasePointer;
uint32_t PerThreadScratchSpace;
uint32_t DispatchGRFStartRegisterForURBData;
uint32_t PatchURBEntryReadLength;
uint32_t PatchURBEntryReadOffset;
uint32_t MaximumNumberofThreads;
uint32_t StatisticsEnable;
uint32_t ComputeWCoordinateEnable;
uint32_t DSCacheDisable;
uint32_t DSFunctionEnable;
bool StatisticsEnable;
bool ComputeWCoordinateEnable;
bool DSCacheDisable;
bool DSFunctionEnable;
};
static inline void
@@ -2099,7 +2099,7 @@ struct GEN75_3DSTATE_GATHER_CONSTANT_PS {
uint32_t ConstantBufferValid;
uint32_t ConstantBufferBindingTableBlock;
uint32_t GatherBufferOffset;
uint32_t ConstantBufferDx9Enable;
bool ConstantBufferDx9Enable;
/* variable length fields follow */
};
@@ -2146,7 +2146,7 @@ struct GEN75_3DSTATE_GATHER_CONSTANT_VS {
uint32_t ConstantBufferValid;
uint32_t ConstantBufferBindingTableBlock;
uint32_t GatherBufferOffset;
uint32_t ConstantBufferDx9Enable;
bool ConstantBufferDx9Enable;
/* variable length fields follow */
};
@@ -2193,7 +2193,7 @@ struct GEN75_3DSTATE_GATHER_POOL_ALLOC {
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
__gen_address_type GatherPoolBaseAddress;
uint32_t GatherPoolEnable;
bool GatherPoolEnable;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE MemoryObjectControlState;
__gen_address_type GatherPoolUpperBound;
};
@@ -2264,16 +2264,16 @@ struct GEN75_3DSTATE_GS {
#define IEEE754 0
#define alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
bool IllegalOpcodeExceptionEnable;
uint32_t GSaccessesUAV;
uint32_t MaskStackExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool MaskStackExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBasePointer;
uint32_t PerThreadScratchSpace;
uint32_t OutputVertexSize;
uint32_t OutputTopology;
uint32_t VertexURBEntryReadLength;
uint32_t IncludeVertexHandles;
bool IncludeVertexHandles;
uint32_t VertexURBEntryReadOffset;
uint32_t DispatchGRFStartRegisterforURBData;
uint32_t MaximumNumberofThreads;
@@ -2286,13 +2286,13 @@ struct GEN75_3DSTATE_GS {
uint32_t DispatchMode;
uint32_t GSStatisticsEnable;
uint32_t GSInvocationsIncrementValue;
uint32_t IncludePrimitiveID;
bool IncludePrimitiveID;
uint32_t Hint;
#define REORDER_LEADING 0
#define REORDER_TRAILING 1
uint32_t ReorderMode;
uint32_t DiscardAdjacency;
uint32_t GSEnable;
bool DiscardAdjacency;
bool GSEnable;
#define GSCTL_CUT 0
#define GSCTL_SID 1
uint32_t ControlDataFormat;
@@ -2443,11 +2443,11 @@ struct GEN75_3DSTATE_HS {
#define IEEE754 0
#define alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t MaximumNumberofThreads;
uint32_t Enable;
uint32_t StatisticsEnable;
bool Enable;
bool StatisticsEnable;
uint32_t InstanceCount;
uint32_t KernelStartPointer;
uint32_t ScratchSpaceBasePointer;
@@ -2456,8 +2456,8 @@ struct GEN75_3DSTATE_HS {
#define Dmask 0
#define Vmask 1
uint32_t VectorMaskEnable;
uint32_t HSaccessesUAV;
uint32_t IncludeVertexHandles;
bool HSaccessesUAV;
bool IncludeVertexHandles;
uint32_t DispatchGRFStartRegisterForURBData;
uint32_t VertexURBEntryReadLength;
uint32_t VertexURBEntryReadOffset;
@@ -2590,7 +2590,7 @@ struct GEN75_3DSTATE_LINE_STIPPLE {
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
bool ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
uint32_t CurrentRepeatCounter;
uint32_t CurrentStippleIndex;
uint32_t LineStipplePattern;
@@ -2681,7 +2681,7 @@ struct GEN75_3DSTATE_MULTISAMPLE {
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t MultiSampleEnable;
bool MultiSampleEnable;
#define PIXLOC_CENTER 0
#define PIXLOC_UL_CORNER 1
uint32_t PixelLocation;
@@ -2867,27 +2867,27 @@ struct GEN75_3DSTATE_PS {
#define RD 2
#define RTZ 3
uint32_t RoundingMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t MaskStackExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool MaskStackExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBasePointer;
uint32_t PerThreadScratchSpace;
uint32_t MaximumNumberofThreads;
uint32_t SampleMask;
uint32_t PushConstantEnable;
uint32_t AttributeEnable;
uint32_t oMaskPresenttoRenderTarget;
uint32_t RenderTargetFastClearEnable;
uint32_t DualSourceBlendEnable;
uint32_t RenderTargetResolveEnable;
uint32_t PSAccessesUAV;
bool PushConstantEnable;
bool AttributeEnable;
bool oMaskPresenttoRenderTarget;
bool RenderTargetFastClearEnable;
bool DualSourceBlendEnable;
bool RenderTargetResolveEnable;
bool PSAccessesUAV;
#define POSOFFSET_NONE 0
#define POSOFFSET_CENTROID 2
#define POSOFFSET_SAMPLE 3
uint32_t PositionXYOffsetSelect;
uint32_t _32PixelDispatchEnable;
uint32_t _16PixelDispatchEnable;
uint32_t _8PixelDispatchEnable;
bool _32PixelDispatchEnable;
bool _16PixelDispatchEnable;
bool _8PixelDispatchEnable;
uint32_t DispatchGRFStartRegisterforConstantSetupData0;
uint32_t DispatchGRFStartRegisterforConstantSetupData1;
uint32_t DispatchGRFStartRegisterforConstantSetupData2;
@@ -3616,16 +3616,16 @@ struct GEN75_3DSTATE_SBE {
uint32_t DwordLength;
uint32_t AttributeSwizzleControlMode;
uint32_t NumberofSFOutputAttributes;
uint32_t AttributeSwizzleEnable;
bool AttributeSwizzleEnable;
#define UPPERLEFT 0
#define LOWERLEFT 1
uint32_t PointSpriteTextureCoordinateOrigin;
uint32_t VertexURBEntryReadLength;
uint32_t VertexURBEntryReadOffset;
uint32_t Attribute2n1ComponentOverrideW;
uint32_t Attribute2n1ComponentOverrideZ;
uint32_t Attribute2n1ComponentOverrideY;
uint32_t Attribute2n1ComponentOverrideX;
bool Attribute2n1ComponentOverrideW;
bool Attribute2n1ComponentOverrideZ;
bool Attribute2n1ComponentOverrideY;
bool Attribute2n1ComponentOverrideX;
#define CONST_0000 0
#define CONST_0001_FLOAT 1
#define CONST_1111_FLOAT 2
@@ -3637,10 +3637,10 @@ struct GEN75_3DSTATE_SBE {
#define INPUTATTR_FACING_W 3
uint32_t Attribute2n1SwizzleSelect;
uint32_t Attribute2n1SourceAttribute;
uint32_t Attribute2nComponentOverrideW;
uint32_t Attribute2nComponentOverrideZ;
uint32_t Attribute2nComponentOverrideY;
uint32_t Attribute2nComponentOverrideX;
bool Attribute2nComponentOverrideW;
bool Attribute2nComponentOverrideZ;
bool Attribute2nComponentOverrideY;
bool Attribute2nComponentOverrideX;
#define CONST_0000 0
#define CONST_0001_FLOAT 1
#define CONST_1111_FLOAT 2
@@ -3803,11 +3803,11 @@ struct GEN75_3DSTATE_SF {
#define D24_UNORM_X8_UINT 3
#define D16_UNORM 5
uint32_t DepthBufferSurfaceFormat;
uint32_t LegacyGlobalDepthBiasEnable;
uint32_t StatisticsEnable;
uint32_t GlobalDepthOffsetEnableSolid;
uint32_t GlobalDepthOffsetEnableWireframe;
uint32_t GlobalDepthOffsetEnablePoint;
bool LegacyGlobalDepthBiasEnable;
bool StatisticsEnable;
bool GlobalDepthOffsetEnableSolid;
bool GlobalDepthOffsetEnableWireframe;
bool GlobalDepthOffsetEnablePoint;
#define RASTER_SOLID 0
#define RASTER_WIREFRAME 1
#define RASTER_POINT 2
@@ -3816,9 +3816,9 @@ struct GEN75_3DSTATE_SF {
#define RASTER_WIREFRAME 1
#define RASTER_POINT 2
uint32_t BackFaceFillMode;
uint32_t ViewTransformEnable;
bool ViewTransformEnable;
uint32_t FrontWinding;
uint32_t AntiAliasingEnable;
bool AntiAliasingEnable;
#define CULLMODE_BOTH 0
#define CULLMODE_NONE 1
#define CULLMODE_FRONT 2
@@ -3826,11 +3826,11 @@ struct GEN75_3DSTATE_SF {
uint32_t CullMode;
float LineWidth;
uint32_t LineEndCapAntialiasingRegionWidth;
uint32_t LineStippleEnable;
uint32_t ScissorRectangleEnable;
uint32_t RTIndependentRasterizationEnable;
bool LineStippleEnable;
bool ScissorRectangleEnable;
bool RTIndependentRasterizationEnable;
uint32_t MultisampleRasterizationMode;
uint32_t LastPixelEnable;
bool LastPixelEnable;
#define Vertex0 0
#define Vertex1 1
#define Vertex2 2
@@ -4153,7 +4153,7 @@ struct GEN75_3DSTATE_STREAMOUT {
#define LEADING 0
#define TRAILING 1
uint32_t ReorderMode;
uint32_t SOStatisticsEnable;
bool SOStatisticsEnable;
uint32_t SOBufferEnable3;
uint32_t SOBufferEnable2;
uint32_t SOBufferEnable1;
@@ -4227,9 +4227,9 @@ struct GEN75_3DSTATE_TE {
#define EVEN_FRACTIONAL 2
uint32_t Partitioning;
#define POINT 0
#define LINE 1
#define TRI_CW 2
#define TRI_CCW 3
#define OUTPUT_LINE 1
#define OUTPUT_TRI_CW 2
#define OUTPUT_TRI_CCW 3
uint32_t OutputTopology;
#define QUAD 0
#define TRI 1
@@ -4238,7 +4238,7 @@ struct GEN75_3DSTATE_TE {
#define HW_TESS 0
#define SW_TESS 1
uint32_t TEMode;
uint32_t TEEnable;
bool TEEnable;
float MaximumTessellationFactorOdd;
float MaximumTessellationFactorNotOdd;
};
@@ -4415,7 +4415,7 @@ struct GEN75_VERTEX_BUFFER_STATE {
uint32_t BufferAccessType;
struct GEN75_MEMORY_OBJECT_CONTROL_STATE VertexBufferMemoryObjectControlState;
uint32_t AddressModifyEnable;
uint32_t NullVertexBuffer;
bool NullVertexBuffer;
uint32_t VertexFetchInvalidate;
uint32_t BufferPitch;
__gen_address_type BufferStartingAddress;
@@ -4494,9 +4494,9 @@ GEN75_3DSTATE_VERTEX_BUFFERS_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_VERTEX_ELEMENT_STATE {
uint32_t VertexBufferIndex;
uint32_t Valid;
bool Valid;
uint32_t SourceElementFormat;
uint32_t EdgeFlagEnable;
bool EdgeFlagEnable;
uint32_t SourceElementOffset;
uint32_t Component0Control;
uint32_t Component1Control;
@@ -4567,7 +4567,7 @@ struct GEN75_3DSTATE_VF {
uint32_t CommandSubType;
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t IndexedDrawCutIndexEnable;
bool IndexedDrawCutIndexEnable;
uint32_t DwordLength;
uint32_t CutIndex;
};
@@ -4606,7 +4606,7 @@ struct GEN75_3DSTATE_VF_STATISTICS {
uint32_t CommandSubType;
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t StatisticsEnable;
bool StatisticsEnable;
};
static inline void
@@ -4736,18 +4736,18 @@ struct GEN75_3DSTATE_VS {
#define IEEE754 0
#define Alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t VSaccessesUAV;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool VSaccessesUAV;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBaseOffset;
uint32_t PerThreadScratchSpace;
uint32_t DispatchGRFStartRegisterforURBData;
uint32_t VertexURBEntryReadLength;
uint32_t VertexURBEntryReadOffset;
uint32_t MaximumNumberofThreads;
uint32_t StatisticsEnable;
uint32_t VertexCacheDisable;
uint32_t VSFunctionEnable;
bool StatisticsEnable;
bool VertexCacheDisable;
bool VSFunctionEnable;
};
static inline void
@@ -4815,13 +4815,13 @@ struct GEN75_3DSTATE_WM {
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t StatisticsEnable;
uint32_t DepthBufferClear;
uint32_t ThreadDispatchEnable;
uint32_t DepthBufferResolveEnable;
uint32_t HierarchicalDepthBufferResolveEnable;
uint32_t LegacyDiamondLineRasterization;
uint32_t PixelShaderKillPixel;
bool StatisticsEnable;
bool DepthBufferClear;
bool ThreadDispatchEnable;
bool DepthBufferResolveEnable;
bool HierarchicalDepthBufferResolveEnable;
bool LegacyDiamondLineRasterization;
bool PixelShaderKillPixel;
#define PSCDEPTH_OFF 0
#define PSCDEPTH_ON 1
#define PSCDEPTH_ON_GE 2
@@ -4831,19 +4831,19 @@ struct GEN75_3DSTATE_WM {
#define EDSC_PSEXEC 1
#define EDSC_PREPS 2
uint32_t EarlyDepthStencilControl;
uint32_t PixelShaderUsesSourceDepth;
uint32_t PixelShaderUsesSourceW;
bool PixelShaderUsesSourceDepth;
bool PixelShaderUsesSourceW;
#define INTERP_PIXEL 0
#define INTERP_CENTROID 2
#define INTERP_SAMPLE 3
uint32_t PositionZWInterpolationMode;
uint32_t BarycentricInterpolationMode;
uint32_t PixelShaderUsesInputCoverageMask;
bool PixelShaderUsesInputCoverageMask;
uint32_t LineEndCapAntialiasingRegionWidth;
uint32_t LineAntialiasingRegionWidth;
uint32_t RTIndependentRasterizationEnable;
uint32_t PolygonStippleEnable;
uint32_t LineStippleEnable;
bool RTIndependentRasterizationEnable;
bool PolygonStippleEnable;
bool LineStippleEnable;
#define RASTRULE_UPPER_LEFT 0
#define RASTRULE_UPPER_RIGHT 1
uint32_t PointRasterizationRule;
@@ -4919,7 +4919,7 @@ struct GEN75_GPGPU_OBJECT {
uint32_t Pipeline;
uint32_t MediaCommandOpcode;
uint32_t SubOpcode;
uint32_t PredicateEnable;
bool PredicateEnable;
uint32_t DwordLength;
uint32_t SharedLocalMemoryFixedOffset;
uint32_t InterfaceDescriptorOffset;
@@ -5004,8 +5004,8 @@ struct GEN75_GPGPU_WALKER {
uint32_t Pipeline;
uint32_t MediaCommandOpcode;
uint32_t SubOpcodeA;
uint32_t IndirectParameterEnable;
uint32_t PredicateEnable;
bool IndirectParameterEnable;
bool PredicateEnable;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
#define SIMD8 0
@@ -5192,7 +5192,7 @@ struct GEN75_MEDIA_OBJECT {
uint32_t MediaCommandSubOpcode;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
uint32_t ChildrenPresent;
bool ChildrenPresent;
#define Nothreadsynchronization 0
#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
uint32_t ThreadSynchronization;
@@ -5212,7 +5212,7 @@ struct GEN75_MEDIA_OBJECT {
uint32_t ScoredboardY;
uint32_t ScoreboardX;
uint32_t ScoreboardColor;
uint32_t ScoreboardMask;
bool ScoreboardMask;
/* variable length fields follow */
};
@@ -5278,8 +5278,8 @@ struct GEN75_MEDIA_OBJECT_PRT {
uint32_t SubOpcode;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
uint32_t ChildrenPresent;
uint32_t PRT_FenceNeeded;
bool ChildrenPresent;
bool PRT_FenceNeeded;
#define Rootthreadqueue 0
#define VFEstateflush 1
uint32_t PRT_FenceType;
@@ -5333,7 +5333,7 @@ struct GEN75_MEDIA_OBJECT_WALKER {
uint32_t SubOpcode;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
uint32_t ChildrenPresent;
bool ChildrenPresent;
#define Nothreadsynchronization 0
#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
uint32_t ThreadSynchronization;
@@ -5342,10 +5342,10 @@ struct GEN75_MEDIA_OBJECT_WALKER {
uint32_t UseScoreboard;
uint32_t IndirectDataLength;
uint32_t IndirectDataStartAddress;
uint32_t ScoreboardMask;
uint32_t DualMode;
uint32_t Repel;
uint32_t QuadMode;
bool ScoreboardMask;
bool DualMode;
bool Repel;
bool QuadMode;
uint32_t ColorCountMinusOne;
uint32_t MiddleLoopExtraSteps;
uint32_t LocalMidLoopUnitY;
@@ -5483,8 +5483,8 @@ struct GEN75_MEDIA_STATE_FLUSH {
uint32_t MediaCommandOpcode;
uint32_t SubOpcode;
uint32_t DwordLength;
uint32_t DisablePreemption;
uint32_t FlushtoGO;
bool DisablePreemption;
bool FlushtoGO;
uint32_t WatermarkRequired;
uint32_t InterfaceDescriptorOffset;
};
@@ -5667,7 +5667,7 @@ GEN75_MI_ARB_CHECK_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_ARB_ON_OFF {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t ArbitrationEnable;
bool ArbitrationEnable;
};
static inline void
@@ -5721,11 +5721,11 @@ struct GEN75_MI_BATCH_BUFFER_START {
#define _1stlevelbatch 0
#define _2ndlevelbatch 1
uint32_t _2ndLevelBatchBuffer;
uint32_t AddOffsetEnable;
uint32_t PredicationEnable;
bool AddOffsetEnable;
bool PredicationEnable;
uint32_t NonPrivileged;
uint32_t ClearCommandBufferEnable;
uint32_t ResourceStreamerEnable;
bool ClearCommandBufferEnable;
bool ResourceStreamerEnable;
#define ASI_GGTT 0
#define ASI_PPGTT 1
uint32_t AddressSpaceIndicator;
@@ -5861,17 +5861,17 @@ GEN75_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__gen_user_data *data, void * restric
struct GEN75_MI_FLUSH {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t IndirectStatePointersDisable;
uint32_t GenericMediaStateClear;
bool IndirectStatePointersDisable;
bool GenericMediaStateClear;
#define DontReset 0
#define Reset 1
uint32_t GlobalSnapshotCountReset;
bool GlobalSnapshotCountReset;
#define Flush 0
#define DontFlush 1
uint32_t RenderCacheFlushInhibit;
bool RenderCacheFlushInhibit;
#define DontInvalidate 0
#define Invalidate 1
uint32_t StateInstructionCacheInvalidate;
bool StateInstructionCacheInvalidate;
};
static inline void
@@ -5941,7 +5941,7 @@ GEN75_MI_LOAD_REGISTER_IMM_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_LOAD_REGISTER_MEM {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t UseGlobalGTT;
bool UseGlobalGTT;
uint32_t AsyncModeEnable;
uint32_t DwordLength;
uint32_t RegisterAddress;
@@ -6174,7 +6174,7 @@ GEN75_MI_MATH_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_NOOP {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t IdentificationNumberRegisterWriteEnable;
bool IdentificationNumberRegisterWriteEnable;
uint32_t IdentificationNumber;
};
@@ -6202,9 +6202,9 @@ GEN75_MI_NOOP_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_PREDICATE {
uint32_t CommandType;
uint32_t MICommandOpcode;
#define KEEP 0
#define LOAD 2
#define LOADINV 3
#define LOAD_KEEP 0
#define LOAD_LOAD 2
#define LOAD_LOADINV 3
uint32_t LoadOperation;
#define COMBINE_SET 0
#define COMBINE_AND 1
@@ -6265,8 +6265,8 @@ GEN75_MI_REPORT_HEAD_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_RS_CONTEXT {
uint32_t CommandType;
uint32_t MICommandOpcode;
#define Restore 0
#define Save 1
#define RS_RESTORE 0
#define RS_SAVE 1
uint32_t ResourceStreamerSave;
};
@@ -6293,8 +6293,8 @@ GEN75_MI_RS_CONTEXT_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_RS_CONTROL {
uint32_t CommandType;
uint32_t MICommandOpcode;
#define Stop 0
#define Start 1
#define RS_STOP 0
#define RS_START 1
uint32_t ResourceStreamerControl;
};
@@ -6412,9 +6412,9 @@ struct GEN75_MI_SET_CONTEXT {
uint32_t DwordLength;
__gen_address_type LogicalContextAddress;
uint32_t ReservedMustbe1;
uint32_t CoreModeEnable;
uint32_t ResourceStreamerStateSaveEnable;
uint32_t ResourceStreamerStateRestoreEnable;
bool CoreModeEnable;
bool ResourceStreamerStateSaveEnable;
bool ResourceStreamerStateRestoreEnable;
uint32_t ForceRestore;
uint32_t RestoreInhibit;
};
@@ -6459,7 +6459,7 @@ struct GEN75_MI_SET_PREDICATE {
#define PredicateonClear 1
#define PredicateonSet 2
#define PredicateDisable 3
uint32_t PREDICATEENABLE;
bool PREDICATEENABLE;
};
static inline void
@@ -6486,7 +6486,7 @@ GEN75_MI_SET_PREDICATE_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_STORE_DATA_IMM {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t UseGlobalGTT;
bool UseGlobalGTT;
uint32_t DwordLength;
uint32_t Address;
uint32_t CoreModeEnable;
@@ -6615,7 +6615,7 @@ GEN75_MI_STORE_URB_MEM_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_SUSPEND_FLUSH {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t SuspendFlush;
bool SuspendFlush;
};
static inline void
@@ -6791,23 +6791,23 @@ GEN75_MI_USER_INTERRUPT_pack(__gen_user_data *data, void * restrict dst,
struct GEN75_MI_WAIT_FOR_EVENT {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t DisplayPipeCHorizontalBlankWaitEnable;
uint32_t DisplayPipeCVerticalBlankWaitEnable;
uint32_t DisplaySpriteCFlipPendingWaitEnable;
bool DisplayPipeCHorizontalBlankWaitEnable;
bool DisplayPipeCVerticalBlankWaitEnable;
bool DisplaySpriteCFlipPendingWaitEnable;
#define Notenabled 0
uint32_t ConditionCodeWaitSelect;
uint32_t DisplayPlaneCFlipPendingWaitEnable;
uint32_t DisplayPipeCScanLineWaitEnable;
uint32_t DisplayPipeBHorizontalBlankWaitEnable;
uint32_t DisplayPipeBVerticalBlankWaitEnable;
uint32_t DisplaySpriteBFlipPendingWaitEnable;
uint32_t DisplayPlaneBFlipPendingWaitEnable;
uint32_t DisplayPipeBScanLineWaitEnable;
uint32_t DisplayPipeAHorizontalBlankWaitEnable;
uint32_t DisplayPipeAVerticalBlankWaitEnable;
uint32_t DisplaySpriteAFlipPendingWaitEnable;
uint32_t DisplayPlaneAFlipPendingWaitEnable;
uint32_t DisplayPipeAScanLineWaitEnable;
bool DisplayPlaneCFlipPendingWaitEnable;
bool DisplayPipeCScanLineWaitEnable;
bool DisplayPipeBHorizontalBlankWaitEnable;
bool DisplayPipeBVerticalBlankWaitEnable;
bool DisplaySpriteBFlipPendingWaitEnable;
bool DisplayPlaneBFlipPendingWaitEnable;
bool DisplayPipeBScanLineWaitEnable;
bool DisplayPipeAHorizontalBlankWaitEnable;
bool DisplayPipeAVerticalBlankWaitEnable;
bool DisplaySpriteAFlipPendingWaitEnable;
bool DisplayPlaneAFlipPendingWaitEnable;
bool DisplayPipeAScanLineWaitEnable;
};
static inline void
@@ -6866,29 +6866,29 @@ struct GEN75_PIPE_CONTROL {
#define Reset 1
uint32_t GlobalSnapshotCountReset;
uint32_t TLBInvalidate;
uint32_t GenericMediaStateClear;
bool GenericMediaStateClear;
#define NoWrite 0
#define WriteImmediateData 1
#define WritePSDepthCount 2
#define WriteTimestamp 3
uint32_t PostSyncOperation;
uint32_t DepthStallEnable;
bool DepthStallEnable;
#define DisableFlush 0
#define EnableFlush 1
uint32_t RenderTargetCacheFlushEnable;
uint32_t InstructionCacheInvalidateEnable;
uint32_t TextureCacheInvalidationEnable;
uint32_t IndirectStatePointersDisable;
uint32_t NotifyEnable;
uint32_t PipeControlFlushEnable;
uint32_t DCFlushEnable;
uint32_t VFCacheInvalidationEnable;
uint32_t ConstantCacheInvalidationEnable;
uint32_t StateCacheInvalidationEnable;
uint32_t StallAtPixelScoreboard;
bool RenderTargetCacheFlushEnable;
bool InstructionCacheInvalidateEnable;
bool TextureCacheInvalidationEnable;
bool IndirectStatePointersDisable;
bool NotifyEnable;
bool PipeControlFlushEnable;
bool DCFlushEnable;
bool VFCacheInvalidationEnable;
bool ConstantCacheInvalidationEnable;
bool StateCacheInvalidationEnable;
bool StallAtPixelScoreboard;
#define FlushDisabled 0
#define FlushEnabled 1
uint32_t DepthCacheFlushEnable;
bool DepthCacheFlushEnable;
__gen_address_type Address;
uint32_t ImmediateData;
uint32_t ImmediateData0;
@@ -7064,8 +7064,8 @@ GEN75_SF_CLIP_VIEWPORT_pack(__gen_user_data *data, void * restrict dst,
#define GEN75_BLEND_STATE_length 0x00000002
struct GEN75_BLEND_STATE {
uint32_t ColorBufferBlendEnable;
uint32_t IndependentAlphaBlendEnable;
bool ColorBufferBlendEnable;
bool IndependentAlphaBlendEnable;
#define BLENDFUNCTION_ADD 0
#define BLENDFUNCTION_SUBTRACT 1
#define BLENDFUNCTION_REVERSE_SUBTRACT 2
@@ -7101,14 +7101,14 @@ struct GEN75_BLEND_STATE {
uint32_t ColorBlendFunction;
uint32_t SourceBlendFactor;
uint32_t DestinationBlendFactor;
uint32_t AlphaToCoverageEnable;
uint32_t AlphaToOneEnable;
uint32_t AlphaToCoverageDitherEnable;
uint32_t WriteDisableAlpha;
uint32_t WriteDisableRed;
uint32_t WriteDisableGreen;
uint32_t WriteDisableBlue;
uint32_t LogicOpEnable;
bool AlphaToCoverageEnable;
bool AlphaToOneEnable;
bool AlphaToCoverageDitherEnable;
bool WriteDisableAlpha;
bool WriteDisableRed;
bool WriteDisableGreen;
bool WriteDisableBlue;
bool LogicOpEnable;
#define LOGICOP_CLEAR 0
#define LOGICOP_NOR 1
#define LOGICOP_AND_INVERTED 2
@@ -7126,7 +7126,7 @@ struct GEN75_BLEND_STATE {
#define LOGICOP_OR 14
#define LOGICOP_SET 15
uint32_t LogicOpFunction;
uint32_t AlphaTestEnable;
bool AlphaTestEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -7136,15 +7136,15 @@ struct GEN75_BLEND_STATE {
#define COMPAREFUNCTION_NOTEQUAL 6
#define COMPAREFUNCTION_GEQUAL 7
uint32_t AlphaTestFunction;
uint32_t ColorDitherEnable;
bool ColorDitherEnable;
uint32_t XDitherOffset;
uint32_t YDitherOffset;
#define COLORCLAMP_UNORM 0
#define COLORCLAMP_SNORM 1
#define COLORCLAMP_RTFORMAT 2
uint32_t ColorClampRange;
uint32_t PreBlendColorClampEnable;
uint32_t PostBlendColorClampEnable;
bool PreBlendColorClampEnable;
bool PostBlendColorClampEnable;
};
static inline void
@@ -7267,7 +7267,7 @@ GEN75_COLOR_CALC_STATE_pack(__gen_user_data *data, void * restrict dst,
#define GEN75_DEPTH_STENCIL_STATE_length 0x00000003
struct GEN75_DEPTH_STENCIL_STATE {
uint32_t StencilTestEnable;
bool StencilTestEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -7288,8 +7288,8 @@ struct GEN75_DEPTH_STENCIL_STATE {
uint32_t StencilFailOp;
uint32_t StencilPassDepthFailOp;
uint32_t StencilPassDepthPassOp;
uint32_t StencilBufferWriteEnable;
uint32_t DoubleSidedStencilEnable;
bool StencilBufferWriteEnable;
bool DoubleSidedStencilEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -7314,7 +7314,7 @@ struct GEN75_DEPTH_STENCIL_STATE {
uint32_t StencilWriteMask;
uint32_t BackfaceStencilTestMask;
uint32_t BackfaceStencilWriteMask;
uint32_t DepthTestEnable;
bool DepthTestEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -7324,7 +7324,7 @@ struct GEN75_DEPTH_STENCIL_STATE {
#define COMPAREFUNCTION_NOTEQUAL 6
#define COMPAREFUNCTION_GEQUAL 7
uint32_t DepthTestFunction;
uint32_t DepthBufferWriteEnable;
bool DepthBufferWriteEnable;
};
static inline void
@@ -7407,9 +7407,9 @@ struct GEN75_INTERFACE_DESCRIPTOR_DATA {
#define IEEE754 0
#define Alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t MaskStackExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool MaskStackExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t SamplerStatePointer;
#define Nosamplersused 0
#define Between1and4samplersused 1
@@ -7425,7 +7425,7 @@ struct GEN75_INTERFACE_DESCRIPTOR_DATA {
#define RD 2
#define RTZ 3
uint32_t RoundingMode;
uint32_t BarrierEnable;
bool BarrierEnable;
uint32_t SharedLocalMemorySize;
uint32_t NumberofThreadsinGPGPUThreadGroup;
uint32_t CrossThreadConstantDataReadLength;
@@ -7511,7 +7511,7 @@ struct GEN75_RENDER_SURFACE_STATE {
#define SURFTYPE_STRBUF 5
#define SURFTYPE_NULL 7
uint32_t SurfaceType;
uint32_t SurfaceArray;
bool SurfaceArray;
uint32_t SurfaceFormat;
uint32_t SurfaceVerticalAlignment;
#define HALIGN_4 0
@@ -7561,8 +7561,8 @@ struct GEN75_RENDER_SURFACE_STATE {
__gen_address_type MCSBaseAddress;
uint32_t MCSSurfacePitch;
__gen_address_type AppendCounterAddress;
uint32_t AppendCounterEnable;
uint32_t MCSEnable;
bool AppendCounterEnable;
bool MCSEnable;
uint32_t ReservedMBZ;
uint32_t XOffsetforUVPlane;
uint32_t YOffsetforUVPlane;
@@ -7716,7 +7716,7 @@ GEN75_SAMPLER_BORDER_COLOR_STATE_pack(__gen_user_data *data, void * restrict dst
#define GEN75_SAMPLER_STATE_length 0x00000004
struct GEN75_SAMPLER_STATE {
uint32_t SamplerDisable;
bool SamplerDisable;
#define DX10OGL 0
#define DX9 1
uint32_t TextureBorderColorMode;
@@ -7756,7 +7756,7 @@ struct GEN75_SAMPLER_STATE {
#define OVERRIDE 1
uint32_t CubeSurfaceControlMode;
uint32_t BorderColorPointer;
uint32_t ChromaKeyEnable;
bool ChromaKeyEnable;
uint32_t ChromaKeyIndex;
#define KEYFILTER_KILL_ON_ANY_MATCH 0
#define KEYFILTER_REPLACE_BLACK 1
@@ -7770,18 +7770,18 @@ struct GEN75_SAMPLER_STATE {
#define RATIO141 6
#define RATIO161 7
uint32_t MaximumAnisotropy;
uint32_t RAddressMinFilterRoundingEnable;
uint32_t RAddressMagFilterRoundingEnable;
uint32_t VAddressMinFilterRoundingEnable;
uint32_t VAddressMagFilterRoundingEnable;
uint32_t UAddressMinFilterRoundingEnable;
uint32_t UAddressMagFilterRoundingEnable;
bool RAddressMinFilterRoundingEnable;
bool RAddressMagFilterRoundingEnable;
bool VAddressMinFilterRoundingEnable;
bool VAddressMagFilterRoundingEnable;
bool UAddressMinFilterRoundingEnable;
bool UAddressMagFilterRoundingEnable;
#define FULL 0
#define TRIQUAL_HIGHMAG_CLAMP_MIPFILTER 1
#define MED 2
#define LOW 3
uint32_t TrilinearFilterQuality;
uint32_t NonnormalizedCoordinateEnable;
bool NonnormalizedCoordinateEnable;
uint32_t TCXAddressControlMode;
uint32_t TCYAddressControlMode;
uint32_t TCZAddressControlMode;
@@ -7846,7 +7846,7 @@ GEN75_SAMPLER_STATE_pack(__gen_user_data *data, void * restrict dst,
#define _3DPRIM_QUADLIST 7
#define _3DPRIM_QUADSTRIP 8
#define _3DPRIM_LINELIST_ADJ 9
#define _3DPRIM_LISTSTRIP_ADJ 10
#define _3DPRIM_LINESTRIP_ADJ 10
#define _3DPRIM_TRILIST_ADJ 11
#define _3DPRIM_TRISTRIP_ADJ 12
#define _3DPRIM_TRISTRIP_REVERSE 13

View File

@@ -144,7 +144,7 @@ GEN7_3DSTATE_URB_VS_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_STORE_REGISTER_MEM {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t UseGlobalGTT;
bool UseGlobalGTT;
uint32_t DwordLength;
uint32_t RegisterAddress;
__gen_address_type MemoryAddress;
@@ -249,27 +249,27 @@ struct GEN7_STATE_BASE_ADDRESS {
struct GEN7_MEMORY_OBJECT_CONTROL_STATE GeneralStateMemoryObjectControlState;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE StatelessDataPortAccessMemoryObjectControlState;
uint32_t StatelessDataPortAccessForceWriteThru;
uint32_t GeneralStateBaseAddressModifyEnable;
bool GeneralStateBaseAddressModifyEnable;
__gen_address_type SurfaceStateBaseAddress;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE SurfaceStateMemoryObjectControlState;
uint32_t SurfaceStateBaseAddressModifyEnable;
bool SurfaceStateBaseAddressModifyEnable;
__gen_address_type DynamicStateBaseAddress;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE DynamicStateMemoryObjectControlState;
uint32_t DynamicStateBaseAddressModifyEnable;
bool DynamicStateBaseAddressModifyEnable;
__gen_address_type IndirectObjectBaseAddress;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE IndirectObjectMemoryObjectControlState;
uint32_t IndirectObjectBaseAddressModifyEnable;
bool IndirectObjectBaseAddressModifyEnable;
__gen_address_type InstructionBaseAddress;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE InstructionMemoryObjectControlState;
uint32_t InstructionBaseAddressModifyEnable;
bool InstructionBaseAddressModifyEnable;
__gen_address_type GeneralStateAccessUpperBound;
uint32_t GeneralStateAccessUpperBoundModifyEnable;
bool GeneralStateAccessUpperBoundModifyEnable;
__gen_address_type DynamicStateAccessUpperBound;
uint32_t DynamicStateAccessUpperBoundModifyEnable;
bool DynamicStateAccessUpperBoundModifyEnable;
__gen_address_type IndirectObjectAccessUpperBound;
uint32_t IndirectObjectAccessUpperBoundModifyEnable;
bool IndirectObjectAccessUpperBoundModifyEnable;
__gen_address_type InstructionAccessUpperBound;
uint32_t InstructionAccessUpperBoundModifyEnable;
bool InstructionAccessUpperBoundModifyEnable;
};
static inline void
@@ -508,10 +508,10 @@ struct GEN7_3DPRIMITIVE {
uint32_t CommandSubType;
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t IndirectParameterEnable;
uint32_t PredicateEnable;
bool IndirectParameterEnable;
bool PredicateEnable;
uint32_t DwordLength;
uint32_t EndOffsetEnable;
bool EndOffsetEnable;
#define SEQUENTIAL 0
#define RANDOM 1
uint32_t VertexAccessType;
@@ -946,7 +946,7 @@ struct GEN7_3DSTATE_CLEAR_PARAMS {
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t DepthClearValue;
uint32_t DepthClearValueValid;
bool DepthClearValueValid;
};
static inline void
@@ -990,27 +990,27 @@ struct GEN7_3DSTATE_CLIP {
uint32_t DwordLength;
uint32_t FrontWinding;
uint32_t VertexSubPixelPrecisionSelect;
uint32_t EarlyCullEnable;
bool EarlyCullEnable;
#define CULLMODE_BOTH 0
#define CULLMODE_NONE 1
#define CULLMODE_FRONT 2
#define CULLMODE_BACK 3
uint32_t CullMode;
uint32_t ClipperStatisticsEnable;
bool ClipperStatisticsEnable;
uint32_t UserClipDistanceCullTestEnableBitmask;
uint32_t ClipEnable;
bool ClipEnable;
#define APIMODE_OGL 0
uint32_t APIMode;
uint32_t ViewportXYClipTestEnable;
uint32_t ViewportZClipTestEnable;
uint32_t GuardbandClipTestEnable;
bool ViewportXYClipTestEnable;
bool ViewportZClipTestEnable;
bool GuardbandClipTestEnable;
uint32_t UserClipDistanceClipTestEnableBitmask;
#define CLIPMODE_NORMAL 0
#define CLIPMODE_REJECT_ALL 3
#define CLIPMODE_ACCEPT_ALL 4
uint32_t ClipMode;
uint32_t PerspectiveDivideDisable;
uint32_t NonPerspectiveBarycentricEnable;
bool PerspectiveDivideDisable;
bool NonPerspectiveBarycentricEnable;
#define Vertex0 0
#define Vertex1 1
#define Vertex2 2
@@ -1024,7 +1024,7 @@ struct GEN7_3DSTATE_CLIP {
uint32_t TriangleFanProvokingVertexSelect;
float MinimumPointWidth;
float MaximumPointWidth;
uint32_t ForceZeroRTAIndexEnable;
bool ForceZeroRTAIndexEnable;
uint32_t MaximumVPIndex;
};
@@ -1328,9 +1328,9 @@ struct GEN7_3DSTATE_DEPTH_BUFFER {
#define SURFTYPE_CUBE 3
#define SURFTYPE_NULL 7
uint32_t SurfaceType;
uint32_t DepthWriteEnable;
uint32_t StencilWriteEnable;
uint32_t HierarchicalDepthBufferEnable;
bool DepthWriteEnable;
bool StencilWriteEnable;
bool HierarchicalDepthBufferEnable;
#define D32_FLOAT 1
#define D24_UNORM_X8_UINT 3
#define D16_UNORM 5
@@ -1528,18 +1528,18 @@ struct GEN7_3DSTATE_DS {
#define IEEE754 0
#define Alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBasePointer;
uint32_t PerThreadScratchSpace;
uint32_t DispatchGRFStartRegisterForURBData;
uint32_t PatchURBEntryReadLength;
uint32_t PatchURBEntryReadOffset;
uint32_t MaximumNumberofThreads;
uint32_t StatisticsEnable;
uint32_t ComputeWCoordinateEnable;
uint32_t DSCacheDisable;
uint32_t DSFunctionEnable;
bool StatisticsEnable;
bool ComputeWCoordinateEnable;
bool DSCacheDisable;
bool DSFunctionEnable;
};
static inline void
@@ -1624,15 +1624,15 @@ struct GEN7_3DSTATE_GS {
#define IEEE754 0
#define alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t MaskStackExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool MaskStackExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBasePointer;
uint32_t PerThreadScratchSpace;
uint32_t OutputVertexSize;
uint32_t OutputTopology;
uint32_t VertexURBEntryReadLength;
uint32_t IncludeVertexHandles;
bool IncludeVertexHandles;
uint32_t VertexURBEntryReadOffset;
uint32_t DispatchGRFStartRegisterforURBData;
uint32_t MaximumNumberofThreads;
@@ -1648,11 +1648,11 @@ struct GEN7_3DSTATE_GS {
uint32_t DispatchMode;
uint32_t GSStatisticsEnable;
uint32_t GSInvocationsIncrementValue;
uint32_t IncludePrimitiveID;
bool IncludePrimitiveID;
uint32_t Hint;
uint32_t ReorderEnable;
uint32_t DiscardAdjacency;
uint32_t GSEnable;
bool ReorderEnable;
bool DiscardAdjacency;
bool GSEnable;
uint32_t SemaphoreHandle;
};
@@ -1796,11 +1796,11 @@ struct GEN7_3DSTATE_HS {
#define IEEE754 0
#define alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t MaximumNumberofThreads;
uint32_t Enable;
uint32_t StatisticsEnable;
bool Enable;
bool StatisticsEnable;
uint32_t InstanceCount;
uint32_t KernelStartPointer;
uint32_t ScratchSpaceBasePointer;
@@ -1809,7 +1809,7 @@ struct GEN7_3DSTATE_HS {
#define Dmask 0
#define Vmask 1
uint32_t VectorMaskEnable;
uint32_t IncludeVertexHandles;
bool IncludeVertexHandles;
uint32_t DispatchGRFStartRegisterForURBData;
uint32_t VertexURBEntryReadLength;
uint32_t VertexURBEntryReadOffset;
@@ -1884,7 +1884,7 @@ struct GEN7_3DSTATE_INDEX_BUFFER {
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE MemoryObjectControlState;
uint32_t CutIndexEnable;
bool CutIndexEnable;
#define INDEX_BYTE 0
#define INDEX_WORD 1
#define INDEX_DWORD 2
@@ -1942,7 +1942,7 @@ struct GEN7_3DSTATE_LINE_STIPPLE {
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
bool ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
uint32_t CurrentRepeatCounter;
uint32_t CurrentStippleIndex;
uint32_t LineStipplePattern;
@@ -2214,25 +2214,25 @@ struct GEN7_3DSTATE_PS {
#define RD 2
#define RTZ 3
uint32_t RoundingMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t MaskStackExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool MaskStackExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBasePointer;
uint32_t PerThreadScratchSpace;
uint32_t MaximumNumberofThreads;
uint32_t PushConstantEnable;
uint32_t AttributeEnable;
uint32_t oMaskPresenttoRenderTarget;
uint32_t RenderTargetFastClearEnable;
uint32_t DualSourceBlendEnable;
uint32_t RenderTargetResolveEnable;
bool PushConstantEnable;
bool AttributeEnable;
bool oMaskPresenttoRenderTarget;
bool RenderTargetFastClearEnable;
bool DualSourceBlendEnable;
bool RenderTargetResolveEnable;
#define POSOFFSET_NONE 0
#define POSOFFSET_CENTROID 2
#define POSOFFSET_SAMPLE 3
uint32_t PositionXYOffsetSelect;
uint32_t _32PixelDispatchEnable;
uint32_t _16PixelDispatchEnable;
uint32_t _8PixelDispatchEnable;
bool _32PixelDispatchEnable;
bool _16PixelDispatchEnable;
bool _8PixelDispatchEnable;
uint32_t DispatchGRFStartRegisterforConstantSetupData0;
uint32_t DispatchGRFStartRegisterforConstantSetupData1;
uint32_t DispatchGRFStartRegisterforConstantSetupData2;
@@ -2851,16 +2851,16 @@ struct GEN7_3DSTATE_SBE {
#define SWIZ_16_31 1
uint32_t AttributeSwizzleControlMode;
uint32_t NumberofSFOutputAttributes;
uint32_t AttributeSwizzleEnable;
bool AttributeSwizzleEnable;
#define UPPERLEFT 0
#define LOWERLEFT 1
uint32_t PointSpriteTextureCoordinateOrigin;
uint32_t VertexURBEntryReadLength;
uint32_t VertexURBEntryReadOffset;
uint32_t Attribute2n1ComponentOverrideW;
uint32_t Attribute2n1ComponentOverrideZ;
uint32_t Attribute2n1ComponentOverrideY;
uint32_t Attribute2n1ComponentOverrideX;
bool Attribute2n1ComponentOverrideW;
bool Attribute2n1ComponentOverrideZ;
bool Attribute2n1ComponentOverrideY;
bool Attribute2n1ComponentOverrideX;
#define CONST_0000 0
#define CONST_0001_FLOAT 1
#define CONST_1111_FLOAT 2
@@ -2872,10 +2872,10 @@ struct GEN7_3DSTATE_SBE {
#define INPUTATTR_FACING_W 3
uint32_t Attribute2n1SwizzleSelect;
uint32_t Attribute2n1SourceAttribute;
uint32_t Attribute2nComponentOverrideW;
uint32_t Attribute2nComponentOverrideZ;
uint32_t Attribute2nComponentOverrideY;
uint32_t Attribute2nComponentOverrideX;
bool Attribute2nComponentOverrideW;
bool Attribute2nComponentOverrideZ;
bool Attribute2nComponentOverrideY;
bool Attribute2nComponentOverrideX;
#define CONST_0000 0
#define CONST_0001_FLOAT 1
#define CONST_1111_FLOAT 2
@@ -3038,11 +3038,11 @@ struct GEN7_3DSTATE_SF {
#define D24_UNORM_X8_UINT 3
#define D16_UNORM 5
uint32_t DepthBufferSurfaceFormat;
uint32_t LegacyGlobalDepthBiasEnable;
uint32_t StatisticsEnable;
uint32_t GlobalDepthOffsetEnableSolid;
uint32_t GlobalDepthOffsetEnableWireframe;
uint32_t GlobalDepthOffsetEnablePoint;
bool LegacyGlobalDepthBiasEnable;
bool StatisticsEnable;
bool GlobalDepthOffsetEnableSolid;
bool GlobalDepthOffsetEnableWireframe;
bool GlobalDepthOffsetEnablePoint;
#define RASTER_SOLID 0
#define RASTER_WIREFRAME 1
#define RASTER_POINT 2
@@ -3051,9 +3051,9 @@ struct GEN7_3DSTATE_SF {
#define RASTER_WIREFRAME 1
#define RASTER_POINT 2
uint32_t BackFaceFillMode;
uint32_t ViewTransformEnable;
bool ViewTransformEnable;
uint32_t FrontWinding;
uint32_t AntiAliasingEnable;
bool AntiAliasingEnable;
#define CULLMODE_BOTH 0
#define CULLMODE_NONE 1
#define CULLMODE_FRONT 2
@@ -3061,9 +3061,9 @@ struct GEN7_3DSTATE_SF {
uint32_t CullMode;
float LineWidth;
uint32_t LineEndCapAntialiasingRegionWidth;
uint32_t ScissorRectangleEnable;
bool ScissorRectangleEnable;
uint32_t MultisampleRasterizationMode;
uint32_t LastPixelEnable;
bool LastPixelEnable;
#define Vertex0 0
#define Vertex1 1
#define Vertex2 2
@@ -3382,7 +3382,7 @@ struct GEN7_3DSTATE_STREAMOUT {
#define LEADING 0
#define TRAILING 1
uint32_t ReorderMode;
uint32_t SOStatisticsEnable;
bool SOStatisticsEnable;
uint32_t SOBufferEnable3;
uint32_t SOBufferEnable2;
uint32_t SOBufferEnable1;
@@ -3456,9 +3456,9 @@ struct GEN7_3DSTATE_TE {
#define EVEN_FRACTIONAL 2
uint32_t Partitioning;
#define POINT 0
#define LINE 1
#define TRI_CW 2
#define TRI_CCW 3
#define OUTPUT_LINE 1
#define OUTPUT_TRI_CW 2
#define OUTPUT_TRI_CCW 3
uint32_t OutputTopology;
#define QUAD 0
#define TRI 1
@@ -3467,7 +3467,7 @@ struct GEN7_3DSTATE_TE {
#define HW_TESS 0
#define SW_TESS 1
uint32_t TEMode;
uint32_t TEEnable;
bool TEEnable;
float MaximumTessellationFactorOdd;
float MaximumTessellationFactorNotOdd;
};
@@ -3644,7 +3644,7 @@ struct GEN7_VERTEX_BUFFER_STATE {
uint32_t BufferAccessType;
struct GEN7_MEMORY_OBJECT_CONTROL_STATE VertexBufferMemoryObjectControlState;
uint32_t AddressModifyEnable;
uint32_t NullVertexBuffer;
bool NullVertexBuffer;
uint32_t VertexFetchInvalidate;
uint32_t BufferPitch;
__gen_address_type BufferStartingAddress;
@@ -3723,9 +3723,9 @@ GEN7_3DSTATE_VERTEX_BUFFERS_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_VERTEX_ELEMENT_STATE {
uint32_t VertexBufferIndex;
uint32_t Valid;
bool Valid;
uint32_t SourceElementFormat;
uint32_t EdgeFlagEnable;
bool EdgeFlagEnable;
uint32_t SourceElementOffset;
uint32_t Component0Control;
uint32_t Component1Control;
@@ -3795,7 +3795,7 @@ struct GEN7_3DSTATE_VF_STATISTICS {
uint32_t CommandSubType;
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t StatisticsEnable;
bool StatisticsEnable;
};
static inline void
@@ -3922,17 +3922,17 @@ struct GEN7_3DSTATE_VS {
#define IEEE754 0
#define Alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t ScratchSpaceBaseOffset;
uint32_t PerThreadScratchSpace;
uint32_t DispatchGRFStartRegisterforURBData;
uint32_t VertexURBEntryReadLength;
uint32_t VertexURBEntryReadOffset;
uint32_t MaximumNumberofThreads;
uint32_t StatisticsEnable;
uint32_t VertexCacheDisable;
uint32_t VSFunctionEnable;
bool StatisticsEnable;
bool VertexCacheDisable;
bool VSFunctionEnable;
};
static inline void
@@ -3998,13 +3998,13 @@ struct GEN7_3DSTATE_WM {
uint32_t _3DCommandOpcode;
uint32_t _3DCommandSubOpcode;
uint32_t DwordLength;
uint32_t StatisticsEnable;
uint32_t DepthBufferClear;
uint32_t ThreadDispatchEnable;
uint32_t DepthBufferResolveEnable;
uint32_t HierarchicalDepthBufferResolveEnable;
uint32_t LegacyDiamondLineRasterization;
uint32_t PixelShaderKillPixel;
bool StatisticsEnable;
bool DepthBufferClear;
bool ThreadDispatchEnable;
bool DepthBufferResolveEnable;
bool HierarchicalDepthBufferResolveEnable;
bool LegacyDiamondLineRasterization;
bool PixelShaderKillPixel;
#define PSCDEPTH_OFF 0
#define PSCDEPTH_ON 1
#define PSCDEPTH_ON_GE 2
@@ -4014,18 +4014,18 @@ struct GEN7_3DSTATE_WM {
#define EDSC_PSEXEC 1
#define EDSC_PREPS 2
uint32_t EarlyDepthStencilControl;
uint32_t PixelShaderUsesSourceDepth;
uint32_t PixelShaderUsesSourceW;
bool PixelShaderUsesSourceDepth;
bool PixelShaderUsesSourceW;
#define INTERP_PIXEL 0
#define INTERP_CENTROID 2
#define INTERP_SAMPLE 3
uint32_t PositionZWInterpolationMode;
uint32_t BarycentricInterpolationMode;
uint32_t PixelShaderUsesInputCoverageMask;
bool PixelShaderUsesInputCoverageMask;
uint32_t LineEndCapAntialiasingRegionWidth;
uint32_t LineAntialiasingRegionWidth;
uint32_t PolygonStippleEnable;
uint32_t LineStippleEnable;
bool PolygonStippleEnable;
bool LineStippleEnable;
#define RASTRULE_UPPER_LEFT 0
#define RASTRULE_UPPER_RIGHT 1
uint32_t PointRasterizationRule;
@@ -4096,7 +4096,7 @@ struct GEN7_GPGPU_OBJECT {
uint32_t Pipeline;
uint32_t MediaCommandOpcode;
uint32_t SubOpcode;
uint32_t PredicateEnable;
bool PredicateEnable;
uint32_t DwordLength;
uint32_t SharedLocalMemoryFixedOffset;
uint32_t InterfaceDescriptorOffset;
@@ -4177,8 +4177,8 @@ struct GEN7_GPGPU_WALKER {
uint32_t Pipeline;
uint32_t MediaCommandOpcode;
uint32_t SubOpcodeA;
uint32_t IndirectParameterEnable;
uint32_t PredicateEnable;
bool IndirectParameterEnable;
bool PredicateEnable;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
#define SIMD8 0
@@ -4365,7 +4365,7 @@ struct GEN7_MEDIA_OBJECT {
uint32_t MediaCommandSubOpcode;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
uint32_t ChildrenPresent;
bool ChildrenPresent;
#define Nothreadsynchronization 0
#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
uint32_t ThreadSynchronization;
@@ -4381,7 +4381,7 @@ struct GEN7_MEDIA_OBJECT {
uint32_t ScoredboardY;
uint32_t ScoreboardX;
uint32_t ScoreboardColor;
uint32_t ScoreboardMask;
bool ScoreboardMask;
/* variable length fields follow */
};
@@ -4446,8 +4446,8 @@ struct GEN7_MEDIA_OBJECT_PRT {
uint32_t SubOpcode;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
uint32_t ChildrenPresent;
uint32_t PRT_FenceNeeded;
bool ChildrenPresent;
bool PRT_FenceNeeded;
#define Rootthreadqueue 0
#define VFEstateflush 1
uint32_t PRT_FenceType;
@@ -4501,7 +4501,7 @@ struct GEN7_MEDIA_OBJECT_WALKER {
uint32_t SubOpcode;
uint32_t DwordLength;
uint32_t InterfaceDescriptorOffset;
uint32_t ChildrenPresent;
bool ChildrenPresent;
#define Nothreadsynchronization 0
#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
uint32_t ThreadSynchronization;
@@ -4510,9 +4510,9 @@ struct GEN7_MEDIA_OBJECT_WALKER {
uint32_t UseScoreboard;
uint32_t IndirectDataLength;
uint32_t IndirectDataStartAddress;
uint32_t ScoreboardMask;
uint32_t DualMode;
uint32_t Repel;
bool ScoreboardMask;
bool DualMode;
bool Repel;
uint32_t ColorCountMinusOne;
uint32_t MiddleLoopExtraSteps;
uint32_t LocalMidLoopUnitY;
@@ -4833,7 +4833,7 @@ GEN7_MI_ARB_CHECK_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_ARB_ON_OFF {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t ArbitrationEnable;
bool ArbitrationEnable;
};
static inline void
@@ -4884,7 +4884,7 @@ GEN7_MI_BATCH_BUFFER_END_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_BATCH_BUFFER_START {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t ClearCommandBufferEnable;
bool ClearCommandBufferEnable;
#define ASI_GGTT 0
#define ASI_PPGTT 1
uint32_t AddressSpaceIndicator;
@@ -5015,17 +5015,17 @@ GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__gen_user_data *data, void * restrict
struct GEN7_MI_FLUSH {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t IndirectStatePointersDisable;
uint32_t GenericMediaStateClear;
bool IndirectStatePointersDisable;
bool GenericMediaStateClear;
#define DontReset 0
#define Reset 1
uint32_t GlobalSnapshotCountReset;
bool GlobalSnapshotCountReset;
#define Flush 0
#define DontFlush 1
uint32_t RenderCacheFlushInhibit;
bool RenderCacheFlushInhibit;
#define DontInvalidate 0
#define Invalidate 1
uint32_t StateInstructionCacheInvalidate;
bool StateInstructionCacheInvalidate;
};
static inline void
@@ -5095,7 +5095,7 @@ GEN7_MI_LOAD_REGISTER_IMM_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_LOAD_REGISTER_MEM {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t UseGlobalGTT;
bool UseGlobalGTT;
uint32_t AsyncModeEnable;
uint32_t DwordLength;
uint32_t RegisterAddress;
@@ -5137,7 +5137,7 @@ GEN7_MI_LOAD_REGISTER_MEM_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_NOOP {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t IdentificationNumberRegisterWriteEnable;
bool IdentificationNumberRegisterWriteEnable;
uint32_t IdentificationNumber;
};
@@ -5165,9 +5165,9 @@ GEN7_MI_NOOP_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_PREDICATE {
uint32_t CommandType;
uint32_t MICommandOpcode;
#define KEEP 0
#define LOAD 2
#define LOADINV 3
#define LOAD_KEEP 0
#define LOAD_LOAD 2
#define LOAD_LOADINV 3
uint32_t LoadOperation;
#define COMBINE_SET 0
#define COMBINE_AND 1
@@ -5272,8 +5272,8 @@ struct GEN7_MI_SET_CONTEXT {
uint32_t DwordLength;
__gen_address_type LogicalContextAddress;
uint32_t ReservedMustbe1;
uint32_t ExtendedStateSaveEnable;
uint32_t ExtendedStateRestoreEnable;
bool ExtendedStateSaveEnable;
bool ExtendedStateRestoreEnable;
uint32_t ForceRestore;
uint32_t RestoreInhibit;
};
@@ -5313,7 +5313,7 @@ GEN7_MI_SET_CONTEXT_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_STORE_DATA_IMM {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t UseGlobalGTT;
bool UseGlobalGTT;
uint32_t DwordLength;
uint32_t Address;
uint32_t CoreModeEnable;
@@ -5403,7 +5403,7 @@ GEN7_MI_STORE_DATA_INDEX_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_SUSPEND_FLUSH {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t SuspendFlush;
bool SuspendFlush;
};
static inline void
@@ -5551,23 +5551,23 @@ GEN7_MI_USER_INTERRUPT_pack(__gen_user_data *data, void * restrict dst,
struct GEN7_MI_WAIT_FOR_EVENT {
uint32_t CommandType;
uint32_t MICommandOpcode;
uint32_t DisplayPipeCHorizontalBlankWaitEnable;
uint32_t DisplayPipeCVerticalBlankWaitEnable;
uint32_t DisplaySpriteCFlipPendingWaitEnable;
bool DisplayPipeCHorizontalBlankWaitEnable;
bool DisplayPipeCVerticalBlankWaitEnable;
bool DisplaySpriteCFlipPendingWaitEnable;
#define Notenabled 0
uint32_t ConditionCodeWaitSelect;
uint32_t DisplayPlaneCFlipPendingWaitEnable;
uint32_t DisplayPipeCScanLineWaitEnable;
uint32_t DisplayPipeBHorizontalBlankWaitEnable;
uint32_t DisplayPipeBVerticalBlankWaitEnable;
uint32_t DisplaySpriteBFlipPendingWaitEnable;
uint32_t DisplayPlaneBFlipPendingWaitEnable;
uint32_t DisplayPipeBScanLineWaitEnable;
uint32_t DisplayPipeAHorizontalBlankWaitEnable;
uint32_t DisplayPipeAVerticalBlankWaitEnable;
uint32_t DisplaySpriteAFlipPendingWaitEnable;
uint32_t DisplayPlaneAFlipPendingWaitEnable;
uint32_t DisplayPipeAScanLineWaitEnable;
bool DisplayPlaneCFlipPendingWaitEnable;
bool DisplayPipeCScanLineWaitEnable;
bool DisplayPipeBHorizontalBlankWaitEnable;
bool DisplayPipeBVerticalBlankWaitEnable;
bool DisplaySpriteBFlipPendingWaitEnable;
bool DisplayPlaneBFlipPendingWaitEnable;
bool DisplayPipeBScanLineWaitEnable;
bool DisplayPipeAHorizontalBlankWaitEnable;
bool DisplayPipeAVerticalBlankWaitEnable;
bool DisplaySpriteAFlipPendingWaitEnable;
bool DisplayPlaneAFlipPendingWaitEnable;
bool DisplayPipeAScanLineWaitEnable;
};
static inline void
@@ -5626,29 +5626,29 @@ struct GEN7_PIPE_CONTROL {
#define Reset 1
uint32_t GlobalSnapshotCountReset;
uint32_t TLBInvalidate;
uint32_t GenericMediaStateClear;
bool GenericMediaStateClear;
#define NoWrite 0
#define WriteImmediateData 1
#define WritePSDepthCount 2
#define WriteTimestamp 3
uint32_t PostSyncOperation;
uint32_t DepthStallEnable;
bool DepthStallEnable;
#define DisableFlush 0
#define EnableFlush 1
uint32_t RenderTargetCacheFlushEnable;
uint32_t InstructionCacheInvalidateEnable;
uint32_t TextureCacheInvalidationEnable;
uint32_t IndirectStatePointersDisable;
uint32_t NotifyEnable;
uint32_t PipeControlFlushEnable;
uint32_t DCFlushEnable;
uint32_t VFCacheInvalidationEnable;
uint32_t ConstantCacheInvalidationEnable;
uint32_t StateCacheInvalidationEnable;
uint32_t StallAtPixelScoreboard;
bool RenderTargetCacheFlushEnable;
bool InstructionCacheInvalidateEnable;
bool TextureCacheInvalidationEnable;
bool IndirectStatePointersDisable;
bool NotifyEnable;
bool PipeControlFlushEnable;
bool DCFlushEnable;
bool VFCacheInvalidationEnable;
bool ConstantCacheInvalidationEnable;
bool StateCacheInvalidationEnable;
bool StallAtPixelScoreboard;
#define FlushDisabled 0
#define FlushEnabled 1
uint32_t DepthCacheFlushEnable;
bool DepthCacheFlushEnable;
__gen_address_type Address;
uint32_t ImmediateData;
uint32_t ImmediateData0;
@@ -5820,8 +5820,8 @@ GEN7_SF_CLIP_VIEWPORT_pack(__gen_user_data *data, void * restrict dst,
#define GEN7_BLEND_STATE_length 0x00000002
struct GEN7_BLEND_STATE {
uint32_t ColorBufferBlendEnable;
uint32_t IndependentAlphaBlendEnable;
bool ColorBufferBlendEnable;
bool IndependentAlphaBlendEnable;
#define BLENDFUNCTION_ADD 0
#define BLENDFUNCTION_SUBTRACT 1
#define BLENDFUNCTION_REVERSE_SUBTRACT 2
@@ -5857,14 +5857,14 @@ struct GEN7_BLEND_STATE {
uint32_t ColorBlendFunction;
uint32_t SourceBlendFactor;
uint32_t DestinationBlendFactor;
uint32_t AlphaToCoverageEnable;
uint32_t AlphaToOneEnable;
uint32_t AlphaToCoverageDitherEnable;
uint32_t WriteDisableAlpha;
uint32_t WriteDisableRed;
uint32_t WriteDisableGreen;
uint32_t WriteDisableBlue;
uint32_t LogicOpEnable;
bool AlphaToCoverageEnable;
bool AlphaToOneEnable;
bool AlphaToCoverageDitherEnable;
bool WriteDisableAlpha;
bool WriteDisableRed;
bool WriteDisableGreen;
bool WriteDisableBlue;
bool LogicOpEnable;
#define LOGICOP_CLEAR 0
#define LOGICOP_NOR 1
#define LOGICOP_AND_INVERTED 2
@@ -5882,7 +5882,7 @@ struct GEN7_BLEND_STATE {
#define LOGICOP_OR 14
#define LOGICOP_SET 15
uint32_t LogicOpFunction;
uint32_t AlphaTestEnable;
bool AlphaTestEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -5892,15 +5892,15 @@ struct GEN7_BLEND_STATE {
#define COMPAREFUNCTION_NOTEQUAL 6
#define COMPAREFUNCTION_GEQUAL 7
uint32_t AlphaTestFunction;
uint32_t ColorDitherEnable;
bool ColorDitherEnable;
uint32_t XDitherOffset;
uint32_t YDitherOffset;
#define COLORCLAMP_UNORM 0
#define COLORCLAMP_SNORM 1
#define COLORCLAMP_RTFORMAT 2
uint32_t ColorClampRange;
uint32_t PreBlendColorClampEnable;
uint32_t PostBlendColorClampEnable;
bool PreBlendColorClampEnable;
bool PostBlendColorClampEnable;
};
static inline void
@@ -6023,7 +6023,7 @@ GEN7_COLOR_CALC_STATE_pack(__gen_user_data *data, void * restrict dst,
#define GEN7_DEPTH_STENCIL_STATE_length 0x00000003
struct GEN7_DEPTH_STENCIL_STATE {
uint32_t StencilTestEnable;
bool StencilTestEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -6044,8 +6044,8 @@ struct GEN7_DEPTH_STENCIL_STATE {
uint32_t StencilFailOp;
uint32_t StencilPassDepthFailOp;
uint32_t StencilPassDepthPassOp;
uint32_t StencilBufferWriteEnable;
uint32_t DoubleSidedStencilEnable;
bool StencilBufferWriteEnable;
bool DoubleSidedStencilEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -6070,7 +6070,7 @@ struct GEN7_DEPTH_STENCIL_STATE {
uint32_t StencilWriteMask;
uint32_t BackfaceStencilTestMask;
uint32_t BackfaceStencilWriteMask;
uint32_t DepthTestEnable;
bool DepthTestEnable;
#define COMPAREFUNCTION_ALWAYS 0
#define COMPAREFUNCTION_NEVER 1
#define COMPAREFUNCTION_LESS 2
@@ -6080,7 +6080,7 @@ struct GEN7_DEPTH_STENCIL_STATE {
#define COMPAREFUNCTION_NOTEQUAL 6
#define COMPAREFUNCTION_GEQUAL 7
uint32_t DepthTestFunction;
uint32_t DepthBufferWriteEnable;
bool DepthBufferWriteEnable;
};
static inline void
@@ -6133,9 +6133,9 @@ struct GEN7_INTERFACE_DESCRIPTOR_DATA {
#define IEEE754 0
#define Alternate 1
uint32_t FloatingPointMode;
uint32_t IllegalOpcodeExceptionEnable;
uint32_t MaskStackExceptionEnable;
uint32_t SoftwareExceptionEnable;
bool IllegalOpcodeExceptionEnable;
bool MaskStackExceptionEnable;
bool SoftwareExceptionEnable;
uint32_t SamplerStatePointer;
#define Nosamplersused 0
#define Between1and4samplersused 1
@@ -6152,7 +6152,7 @@ struct GEN7_INTERFACE_DESCRIPTOR_DATA {
#define RD 2
#define RTZ 3
uint32_t RoundingMode;
uint32_t BarrierEnable;
bool BarrierEnable;
uint32_t SharedLocalMemorySize;
uint32_t NumberofThreadsinGPGPUThreadGroup;
};
@@ -6425,7 +6425,7 @@ GEN7_SAMPLER_BORDER_COLOR_STATE_pack(__gen_user_data *data, void * restrict dst,
#define GEN7_SAMPLER_STATE_length 0x00000004
struct GEN7_SAMPLER_STATE {
uint32_t SamplerDisable;
bool SamplerDisable;
#define DX10OGL 0
#define DX9 1
uint32_t TextureBorderColorMode;
@@ -6465,7 +6465,7 @@ struct GEN7_SAMPLER_STATE {
#define OVERRIDE 1
uint32_t CubeSurfaceControlMode;
uint32_t BorderColorPointer;
uint32_t ChromaKeyEnable;
bool ChromaKeyEnable;
uint32_t ChromaKeyIndex;
#define KEYFILTER_KILL_ON_ANY_MATCH 0
#define KEYFILTER_REPLACE_BLACK 1
@@ -6479,17 +6479,17 @@ struct GEN7_SAMPLER_STATE {
#define RATIO141 6
#define RATIO161 7
uint32_t MaximumAnisotropy;
uint32_t RAddressMinFilterRoundingEnable;
uint32_t RAddressMagFilterRoundingEnable;
uint32_t VAddressMinFilterRoundingEnable;
uint32_t VAddressMagFilterRoundingEnable;
uint32_t UAddressMinFilterRoundingEnable;
uint32_t UAddressMagFilterRoundingEnable;
bool RAddressMinFilterRoundingEnable;
bool RAddressMagFilterRoundingEnable;
bool VAddressMinFilterRoundingEnable;
bool VAddressMagFilterRoundingEnable;
bool UAddressMinFilterRoundingEnable;
bool UAddressMagFilterRoundingEnable;
#define FULL 0
#define MED 2
#define LOW 3
uint32_t TrilinearFilterQuality;
uint32_t NonnormalizedCoordinateEnable;
bool NonnormalizedCoordinateEnable;
uint32_t TCXAddressControlMode;
uint32_t TCYAddressControlMode;
uint32_t TCZAddressControlMode;
@@ -6554,7 +6554,7 @@ GEN7_SAMPLER_STATE_pack(__gen_user_data *data, void * restrict dst,
#define _3DPRIM_QUADLIST 7
#define _3DPRIM_QUADSTRIP 8
#define _3DPRIM_LINELIST_ADJ 9
#define _3DPRIM_LISTSTRIP_ADJ 10
#define _3DPRIM_LINESTRIP_ADJ 10
#define _3DPRIM_TRILIST_ADJ 11
#define _3DPRIM_TRISTRIP_ADJ 12
#define _3DPRIM_TRISTRIP_REVERSE 13

File diff suppressed because it is too large Load Diff

View File

@@ -101,7 +101,7 @@ class Shader:
line_start += 6
f.write('\n};\n')
token_exp = re.compile(r'(GLSL_VK_SHADER|\(|\)|,)')
token_exp = re.compile(r'(GLSL_VK_SHADER_MODULE|\(|\)|,)')
class Parser:
def __init__(self, f):
@@ -172,7 +172,7 @@ class Parser:
def run(self):
for t in self.token_iter:
if t == 'GLSL_VK_SHADER':
if t == 'GLSL_VK_SHADER_MODULE':
self.handle_macro()
def open_file(name, mode):
@@ -188,9 +188,10 @@ def open_file(name, mode):
def parse_args():
description = dedent("""\
This program scrapes a C file for any instance of the GLSL_VK_SHADER
macro, grabs the GLSL source code, compiles it to SPIR-V. The resulting
SPIR-V code is written to another C file as an array of 32-bit words.
This program scrapes a C file for any instance of the
GLSL_VK_SHADER_MODULE macro, grabs the GLSL source code, compiles it
to SPIR-V. The resulting SPIR-V code is written to another C file as
an array of 32-bit words.
If '-' is passed as the input file or output file, stdin or stdout will be
used instead of a file on disc.""")
@@ -256,15 +257,16 @@ with open_file(outfname, 'w') as outfile:
#define _ANV_GLSL_SRC_VAR2(_line) _glsl_helpers_shader ## _line ## _glsl_src
#define _ANV_GLSL_SRC_VAR(_line) _ANV_GLSL_SRC_VAR2(_line)
#define GLSL_VK_SHADER(device, stage, ...) ({ \\
VkShader __shader; \\
VkShaderCreateInfo __shader_create_info = { \\
.sType = VK_STRUCTURE_TYPE_SHADER_CREATE_INFO, \\
#define GLSL_VK_SHADER_MODULE(device, stage, ...) ({ \\
VkShaderModule __module; \\
VkShaderModuleCreateInfo __shader_create_info = { \\
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, \\
.codeSize = sizeof(_ANV_GLSL_SRC_VAR(__LINE__)), \\
.pCode = _ANV_GLSL_SRC_VAR(__LINE__), \\
}; \\
vkCreateShader((VkDevice) device, &__shader_create_info, &__shader); \\
__shader; \\
vkCreateShaderModule(anv_device_to_handle(device), \\
&__shader_create_info, &__module); \\
__module; \\
})
"""))

View File

@@ -29,6 +29,12 @@
#include "private.h"
struct anv_image_view_info {
uint8_t surface_type; /**< RENDER_SURFACE_STATE.SurfaceType */
bool is_array:1; /**< RENDER_SURFACE_STATE.SurfaceArray */
bool is_cube:1; /**< RENDER_SURFACE_STATE.CubeFaceEnable* */
};
static const uint8_t anv_halign[] = {
[4] = HALIGN4,
[8] = HALIGN8,
@@ -45,13 +51,20 @@ static const uint8_t anv_surf_type_from_image_type[] = {
[VK_IMAGE_TYPE_1D] = SURFTYPE_1D,
[VK_IMAGE_TYPE_2D] = SURFTYPE_2D,
[VK_IMAGE_TYPE_3D] = SURFTYPE_3D,
};
static const uint8_t anv_surf_type_from_image_view_type[] = {
[VK_IMAGE_VIEW_TYPE_1D] = SURFTYPE_1D,
[VK_IMAGE_VIEW_TYPE_2D] = SURFTYPE_2D,
[VK_IMAGE_VIEW_TYPE_3D] = SURFTYPE_3D,
[VK_IMAGE_VIEW_TYPE_CUBE] = SURFTYPE_CUBE,
static const struct anv_image_view_info
anv_image_view_info_table[] = {
#define INFO(s, ...) { .surface_type = s, __VA_ARGS__ }
[VK_IMAGE_VIEW_TYPE_1D] = INFO(SURFTYPE_1D),
[VK_IMAGE_VIEW_TYPE_2D] = INFO(SURFTYPE_2D),
[VK_IMAGE_VIEW_TYPE_3D] = INFO(SURFTYPE_3D),
[VK_IMAGE_VIEW_TYPE_CUBE] = INFO(SURFTYPE_CUBE, .is_cube = 1),
[VK_IMAGE_VIEW_TYPE_1D_ARRAY] = INFO(SURFTYPE_1D, .is_array = 1),
[VK_IMAGE_VIEW_TYPE_2D_ARRAY] = INFO(SURFTYPE_2D, .is_array = 1),
[VK_IMAGE_VIEW_TYPE_CUBE_ARRAY] = INFO(SURFTYPE_CUBE, .is_array = 1, .is_cube = 1),
#undef INFO
};
static const struct anv_surf_type_limits {
@@ -195,7 +208,7 @@ anv_image_create(VkDevice _device,
const struct anv_image_create_info *create_info,
VkImage *pImage)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
const VkExtent3D *restrict extent = &pCreateInfo->extent;
struct anv_image *image = NULL;
@@ -270,7 +283,7 @@ anv_image_create(VkDevice _device,
goto fail;
}
*pImage = (VkImage) image;
*pImage = anv_image_to_handle(image);
return VK_SUCCESS;
@@ -294,48 +307,48 @@ anv_CreateImage(VkDevice device,
}
VkResult
anv_GetImageSubresourceInfo(VkDevice device,
VkImage image,
const VkImageSubresource *pSubresource,
VkSubresourceInfoType infoType,
size_t *pDataSize,
void *pData)
anv_DestroyImage(VkDevice _device, VkImage _image)
{
ANV_FROM_HANDLE(anv_device, device, _device);
anv_device_free(device, anv_image_from_handle(_image));
return VK_SUCCESS;
}
VkResult anv_GetImageSubresourceLayout(
VkDevice device,
VkImage image,
const VkImageSubresource* pSubresource,
VkSubresourceLayout* pLayout)
{
stub_return(VK_UNSUPPORTED);
}
void
anv_surface_view_destroy(struct anv_device *device,
struct anv_object *obj, VkObjectType obj_type)
anv_surface_view_fini(struct anv_device *device,
struct anv_surface_view *view)
{
struct anv_surface_view *view = (struct anv_surface_view *)obj;
assert(obj_type == VK_OBJECT_TYPE_BUFFER_VIEW ||
obj_type == VK_OBJECT_TYPE_IMAGE_VIEW ||
obj_type == VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
anv_state_pool_free(&device->surface_state_pool, view->surface_state);
anv_device_free(device, view);
}
void
anv_image_view_init(struct anv_surface_view *view,
anv_image_view_init(struct anv_image_view *iview,
struct anv_device *device,
const VkImageViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer)
{
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
struct anv_image *image = (struct anv_image *) pCreateInfo->image;
struct anv_surface_view *view = &iview->view;
struct anv_surface *surface;
const struct anv_format *format_info =
anv_format_for_vk_format(pCreateInfo->format);
anv_assert(range->mipLevels > 0);
anv_assert(range->arraySize > 0);
anv_assert(range->baseMipLevel + range->mipLevels <= image->levels);
anv_assert(range->baseArraySlice + range->arraySize <= image->array_size);
const struct anv_image_view_info *view_type_info
= &anv_image_view_info_table[pCreateInfo->viewType];
if (pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D)
anv_finishme("non-2D image views");
@@ -382,7 +395,7 @@ anv_image_view_init(struct anv_surface_view *view,
};
struct GEN8_RENDER_SURFACE_STATE surface_state = {
.SurfaceType = anv_surf_type_from_image_view_type[pCreateInfo->viewType],
.SurfaceType = view_type_info->surface_type,
.SurfaceArray = image->array_size > 1,
.SurfaceFormat = format_info->surface_format,
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
@@ -393,7 +406,13 @@ anv_image_view_init(struct anv_surface_view *view,
.SamplerL2BypassModeDisable = true,
.RenderCacheReadWriteMode = WriteOnlyCache,
.MemoryObjectControlState = GEN8_MOCS,
.BaseMipLevel = (float) pCreateInfo->minLod,
/* The driver sets BaseMipLevel in SAMPLER_STATE, not here in
* RENDER_SURFACE_STATE. The Broadwell PRM says "it is illegal to have
* both Base Mip Level fields nonzero".
*/
.BaseMipLevel = 0.0,
.SurfaceQPitch = surface->qpitch >> 2,
.Height = image->extent.height - 1,
.Width = image->extent.width - 1,
@@ -434,15 +453,93 @@ anv_image_view_init(struct anv_surface_view *view,
GEN8_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
}
VkResult
anv_validate_CreateImageView(VkDevice _device,
const VkImageViewCreateInfo *pCreateInfo,
VkImageView *pView)
{
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *subresource;
const struct anv_image_view_info *view_info;
const struct anv_format *view_format_info;
const struct anv_format *image_format_info;
/* Validate structure type before dereferencing it. */
assert(pCreateInfo);
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO);
subresource = &pCreateInfo->subresourceRange;
/* Validate viewType is in range before using it. */
assert(pCreateInfo->viewType >= VK_IMAGE_VIEW_TYPE_BEGIN_RANGE);
assert(pCreateInfo->viewType <= VK_IMAGE_VIEW_TYPE_END_RANGE);
view_info = &anv_image_view_info_table[pCreateInfo->viewType];
/* Validate format is in range before using it. */
assert(pCreateInfo->format >= VK_FORMAT_BEGIN_RANGE);
assert(pCreateInfo->format <= VK_FORMAT_END_RANGE);
image_format_info = anv_format_for_vk_format(image->format);
view_format_info = anv_format_for_vk_format(pCreateInfo->format);
/* Validate channel swizzles. */
assert(pCreateInfo->channels.r >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
assert(pCreateInfo->channels.r <= VK_CHANNEL_SWIZZLE_END_RANGE);
assert(pCreateInfo->channels.g >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
assert(pCreateInfo->channels.g <= VK_CHANNEL_SWIZZLE_END_RANGE);
assert(pCreateInfo->channels.b >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
assert(pCreateInfo->channels.b <= VK_CHANNEL_SWIZZLE_END_RANGE);
assert(pCreateInfo->channels.a >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
assert(pCreateInfo->channels.a <= VK_CHANNEL_SWIZZLE_END_RANGE);
/* Validate subresource. */
assert(subresource->aspect >= VK_IMAGE_ASPECT_BEGIN_RANGE);
assert(subresource->aspect <= VK_IMAGE_ASPECT_END_RANGE);
assert(subresource->mipLevels > 0);
assert(subresource->arraySize > 0);
assert(subresource->baseMipLevel < image->levels);
assert(subresource->baseMipLevel + subresource->mipLevels <= image->levels);
assert(subresource->baseArraySlice < image->array_size);
assert(subresource->baseArraySlice + subresource->arraySize <= image->array_size);
assert(pView);
if (view_info->is_cube) {
assert(subresource->baseArraySlice % 6 == 0);
assert(subresource->arraySize % 6 == 0);
}
/* Validate format. */
switch (subresource->aspect) {
case VK_IMAGE_ASPECT_COLOR:
assert(!image_format_info->depth_format);
assert(!image_format_info->has_stencil);
assert(!view_format_info->depth_format);
assert(!view_format_info->has_stencil);
assert(view_format_info->cpp == image_format_info->cpp);
break;
case VK_IMAGE_ASPECT_DEPTH:
assert(image_format_info->depth_format);
assert(view_format_info->depth_format);
assert(view_format_info->cpp == image_format_info->cpp);
break;
case VK_IMAGE_ASPECT_STENCIL:
/* FINISHME: Is it legal to have an R8 view of S8? */
assert(image_format_info->has_stencil);
assert(view_format_info->has_stencil);
break;
default:
assert(!"bad VkImageAspect");
break;
}
return anv_CreateImageView(_device, pCreateInfo, pView);
}
VkResult
anv_CreateImageView(VkDevice _device,
const VkImageViewCreateInfo *pCreateInfo,
VkImageView *pView)
{
struct anv_device *device = (struct anv_device *) _device;
struct anv_surface_view *view;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO);
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_image_view *view;
view = anv_device_alloc(device, sizeof(*view), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
@@ -451,31 +548,41 @@ anv_CreateImageView(VkDevice _device,
anv_image_view_init(view, device, pCreateInfo, NULL);
view->base.destructor = anv_surface_view_destroy;
*pView = anv_image_view_to_handle(view);
*pView = (VkImageView) view;
return VK_SUCCESS;
}
VkResult
anv_DestroyImageView(VkDevice _device, VkImageView _iview)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_image_view, iview, _iview);
anv_surface_view_fini(device, &iview->view);
anv_device_free(device, iview);
return VK_SUCCESS;
}
void
anv_color_attachment_view_init(struct anv_surface_view *view,
anv_color_attachment_view_init(struct anv_color_attachment_view *aview,
struct anv_device *device,
const VkColorAttachmentViewCreateInfo* pCreateInfo,
const VkAttachmentViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer)
{
struct anv_image *image = (struct anv_image *) pCreateInfo->image;
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_surface_view *view = &aview->view;
struct anv_surface *surface = &image->primary_surface;
const struct anv_format *format_info =
anv_format_for_vk_format(pCreateInfo->format);
aview->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
anv_assert(pCreateInfo->arraySize > 0);
anv_assert(pCreateInfo->mipLevel < image->levels);
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
if (pCreateInfo->msaaResolveImage)
anv_finishme("msaaResolveImage");
view->bo = image->bo;
view->offset = image->offset + surface->offset;
view->format = pCreateInfo->format;
@@ -512,7 +619,13 @@ anv_color_attachment_view_init(struct anv_surface_view *view,
.SamplerL2BypassModeDisable = true,
.RenderCacheReadWriteMode = WriteOnlyCache,
.MemoryObjectControlState = GEN8_MOCS,
/* The driver sets BaseMipLevel in SAMPLER_STATE, not here in
* RENDER_SURFACE_STATE. The Broadwell PRM says "it is illegal to have
* both Base Mip Level fields nonzero".
*/
.BaseMipLevel = 0.0,
.SurfaceQPitch = surface->qpitch >> 2,
.Height = image->extent.height - 1,
.Width = image->extent.width - 1,
@@ -548,55 +661,22 @@ anv_color_attachment_view_init(struct anv_surface_view *view,
GEN8_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
}
VkResult
anv_CreateColorAttachmentView(VkDevice _device,
const VkColorAttachmentViewCreateInfo *pCreateInfo,
VkColorAttachmentView *pView)
static void
anv_depth_stencil_view_init(struct anv_depth_stencil_view *view,
const VkAttachmentViewCreateInfo *pCreateInfo)
{
struct anv_device *device = (struct anv_device *) _device;
struct anv_surface_view *view;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO);
view = anv_device_alloc(device, sizeof(*view), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (view == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
anv_color_attachment_view_init(view, device, pCreateInfo, NULL);
view->base.destructor = anv_surface_view_destroy;
*pView = (VkColorAttachmentView) view;
return VK_SUCCESS;
}
VkResult
anv_CreateDepthStencilView(VkDevice _device,
const VkDepthStencilViewCreateInfo *pCreateInfo,
VkDepthStencilView *pView)
{
struct anv_device *device = (struct anv_device *) _device;
struct anv_depth_stencil_view *view;
struct anv_image *image = (struct anv_image *) pCreateInfo->image;
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_surface *depth_surface = &image->primary_surface;
struct anv_surface *stencil_surface = &image->stencil_surface;
const struct anv_format *format =
anv_format_for_vk_format(image->format);
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DEPTH_STENCIL_VIEW_CREATE_INFO);
view = anv_device_alloc(device, sizeof(*view), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (view == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
view->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL;
/* XXX: We don't handle any of these */
anv_assert(pCreateInfo->mipLevel == 0);
anv_assert(pCreateInfo->baseArraySlice == 0);
anv_assert(pCreateInfo->arraySize == 1);
anv_assert(pCreateInfo->msaaResolveImage == 0);
view->bo = image->bo;
@@ -608,8 +688,56 @@ anv_CreateDepthStencilView(VkDevice _device,
view->stencil_stride = stencil_surface->stride;
view->stencil_offset = image->offset + stencil_surface->offset;
view->stencil_qpitch = 0; /* FINISHME: QPitch */
}
*pView = (VkDepthStencilView) view;
VkResult
anv_CreateAttachmentView(VkDevice _device,
const VkAttachmentViewCreateInfo *pCreateInfo,
VkAttachmentView *pView)
{
ANV_FROM_HANDLE(anv_device, device, _device);
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO);
if (anv_is_vk_format_depth_or_stencil(pCreateInfo->format)) {
struct anv_depth_stencil_view *view =
anv_device_alloc(device, sizeof(*view), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (view == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
anv_depth_stencil_view_init(view, pCreateInfo);
*pView = anv_attachment_view_to_handle(&view->base);
} else {
struct anv_color_attachment_view *view =
anv_device_alloc(device, sizeof(*view), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (view == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
anv_color_attachment_view_init(view, device, pCreateInfo, NULL);
*pView = anv_attachment_view_to_handle(&view->base);
}
return VK_SUCCESS;
}
VkResult
anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _view)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_attachment_view, view, _view);
if (view->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) {
struct anv_color_attachment_view *aview =
(struct anv_color_attachment_view *)view;
anv_surface_view_fini(device, &aview->view);
}
anv_device_free(device, view);
return VK_SUCCESS;
}

View File

@@ -83,8 +83,8 @@ VkResult anv_CreateDmaBufImageINTEL(
assert(image->extent.height > 0);
assert(image->extent.depth == 1);
*pMem = (VkDeviceMemory) mem;
*pImage = (VkImage) image;
*pMem = anv_device_memory_to_handle(mem);
*pImage = anv_image_to_handle(image);
return VK_SUCCESS;

File diff suppressed because it is too large Load Diff

View File

@@ -31,33 +31,133 @@
// Shader functions
VkResult anv_CreateShaderModule(
VkDevice _device,
const VkShaderModuleCreateInfo* pCreateInfo,
VkShaderModule* pShaderModule)
{
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_shader_module *module;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO);
assert(pCreateInfo->flags == 0);
module = anv_device_alloc(device, sizeof(*module) + pCreateInfo->codeSize, 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (module == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
module->size = pCreateInfo->codeSize;
memcpy(module->data, pCreateInfo->pCode, module->size);
*pShaderModule = anv_shader_module_to_handle(module);
return VK_SUCCESS;
}
VkResult anv_DestroyShaderModule(
VkDevice _device,
VkShaderModule _module)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_shader_module, module, _module);
anv_device_free(device, module);
return VK_SUCCESS;
}
VkResult anv_CreateShader(
VkDevice _device,
const VkShaderCreateInfo* pCreateInfo,
VkShader* pShader)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_shader_module, module, pCreateInfo->module);
struct anv_shader *shader;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SHADER_CREATE_INFO);
assert(pCreateInfo->flags == 0);
shader = anv_device_alloc(device, sizeof(*shader) + pCreateInfo->codeSize, 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
size_t name_len = strlen(pCreateInfo->pName);
if (strcmp(pCreateInfo->pName, "main") != 0) {
anv_finishme("Multiple shaders per module not really supported");
}
shader = anv_device_alloc(device, sizeof(*shader) + name_len + 1, 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (shader == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
shader->size = pCreateInfo->codeSize;
memcpy(shader->data, pCreateInfo->pCode, shader->size);
shader->module = module;
memcpy(shader->entrypoint, pCreateInfo->pName, name_len + 1);
*pShader = (VkShader) shader;
*pShader = anv_shader_to_handle(shader);
return VK_SUCCESS;
}
VkResult anv_DestroyShader(
VkDevice _device,
VkShader _shader)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_shader, shader, _shader);
anv_device_free(device, shader);
return VK_SUCCESS;
}
VkResult anv_CreatePipelineCache(
VkDevice device,
const VkPipelineCacheCreateInfo* pCreateInfo,
VkPipelineCache* pPipelineCache)
{
pPipelineCache->handle = 1;
stub_return(VK_SUCCESS);
}
VkResult anv_DestroyPipelineCache(
VkDevice _device,
VkPipelineCache _cache)
{
/* VkPipelineCache is a dummy object. */
return VK_SUCCESS;
}
size_t anv_GetPipelineCacheSize(
VkDevice device,
VkPipelineCache pipelineCache)
{
stub_return(0);
}
VkResult anv_GetPipelineCacheData(
VkDevice device,
VkPipelineCache pipelineCache,
void* pData)
{
stub_return(VK_UNSUPPORTED);
}
VkResult anv_MergePipelineCaches(
VkDevice device,
VkPipelineCache destCache,
uint32_t srcCacheCount,
const VkPipelineCache* pSrcCaches)
{
stub_return(VK_UNSUPPORTED);
}
// Pipeline functions
static void
emit_vertex_input(struct anv_pipeline *pipeline, VkPipelineVertexInputCreateInfo *info)
emit_vertex_input(struct anv_pipeline *pipeline,
const VkPipelineVertexInputStateCreateInfo *info)
{
const uint32_t num_dwords = 1 + info->attributeCount * 2;
uint32_t *p;
@@ -125,7 +225,7 @@ emit_vertex_input(struct anv_pipeline *pipeline, VkPipelineVertexInputCreateInfo
static void
emit_ia_state(struct anv_pipeline *pipeline,
VkPipelineIaStateCreateInfo *info,
const VkPipelineInputAssemblyStateCreateInfo *info,
const struct anv_pipeline_create_info *extra)
{
static const uint32_t vk_to_gen_primitive_type[] = {
@@ -136,7 +236,7 @@ emit_ia_state(struct anv_pipeline *pipeline,
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP,
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN] = _3DPRIM_TRIFAN,
[VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ] = _3DPRIM_LINELIST_ADJ,
[VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ] = _3DPRIM_LISTSTRIP_ADJ,
[VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ] = _3DPRIM_LINESTRIP_ADJ,
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ] = _3DPRIM_TRILIST_ADJ,
[VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ] = _3DPRIM_TRISTRIP_ADJ,
[VK_PRIMITIVE_TOPOLOGY_PATCH] = _3DPRIM_PATCHLIST_1
@@ -146,15 +246,19 @@ emit_ia_state(struct anv_pipeline *pipeline,
if (extra && extra->use_rectlist)
topology = _3DPRIM_RECTLIST;
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_VF,
.IndexedDrawCutIndexEnable = info->primitiveRestartEnable,
.CutIndex = info->primitiveRestartIndex);
struct GEN8_3DSTATE_VF vf = {
GEN8_3DSTATE_VF_header,
.IndexedDrawCutIndexEnable = info->primitiveRestartEnable,
};
GEN8_3DSTATE_VF_pack(NULL, pipeline->state_vf, &vf);
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_VF_TOPOLOGY,
.PrimitiveTopologyType = topology);
}
static void
emit_rs_state(struct anv_pipeline *pipeline, VkPipelineRsStateCreateInfo *info,
emit_rs_state(struct anv_pipeline *pipeline,
const VkPipelineRasterStateCreateInfo *info,
const struct anv_pipeline_create_info *extra)
{
static const uint32_t vk_to_gen_cullmode[] = {
@@ -174,25 +278,18 @@ emit_rs_state(struct anv_pipeline *pipeline, VkPipelineRsStateCreateInfo *info,
[VK_FRONT_FACE_CCW] = CounterClockwise,
[VK_FRONT_FACE_CW] = Clockwise
};
static const uint32_t vk_to_gen_coordinate_origin[] = {
[VK_COORDINATE_ORIGIN_UPPER_LEFT] = UPPERLEFT,
[VK_COORDINATE_ORIGIN_LOWER_LEFT] = LOWERLEFT
};
struct GEN8_3DSTATE_SF sf = {
GEN8_3DSTATE_SF_header,
.ViewportTransformEnable = !(extra && extra->disable_viewport),
.TriangleStripListProvokingVertexSelect =
info->provokingVertex == VK_PROVOKING_VERTEX_FIRST ? 0 : 2,
.LineStripListProvokingVertexSelect =
info->provokingVertex == VK_PROVOKING_VERTEX_FIRST ? 0 : 1,
.TriangleFanProvokingVertexSelect =
info->provokingVertex == VK_PROVOKING_VERTEX_FIRST ? 0 : 2,
.PointWidthSource = info->programPointSize ? Vertex : State,
.TriangleStripListProvokingVertexSelect = 0,
.LineStripListProvokingVertexSelect = 0,
.TriangleFanProvokingVertexSelect = 0,
.PointWidthSource = pipeline->writes_point_size ? Vertex : State,
.PointWidth = 1.0,
};
/* FINISHME: bool32_t rasterizerDiscardEnable; */
/* FINISHME: VkBool32 rasterizerDiscardEnable; */
GEN8_3DSTATE_SF_pack(NULL, pipeline->state_sf, &sf);
@@ -211,15 +308,15 @@ emit_rs_state(struct anv_pipeline *pipeline, VkPipelineRsStateCreateInfo *info,
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_SBE,
.ForceVertexURBEntryReadLength = false,
.ForceVertexURBEntryReadOffset = false,
.PointSpriteTextureCoordinateOrigin =
vk_to_gen_coordinate_origin[info->pointOrigin],
.PointSpriteTextureCoordinateOrigin = UPPERLEFT,
.NumberofSFOutputAttributes =
pipeline->wm_prog_data.num_varying_inputs);
}
static void
emit_cb_state(struct anv_pipeline *pipeline, VkPipelineCbStateCreateInfo *info)
emit_cb_state(struct anv_pipeline *pipeline,
const VkPipelineColorBlendStateCreateInfo *info)
{
struct anv_device *device = pipeline->device;
@@ -284,7 +381,7 @@ emit_cb_state(struct anv_pipeline *pipeline, VkPipelineCbStateCreateInfo *info)
GEN8_BLEND_STATE_pack(NULL, state, &blend_state);
for (uint32_t i = 0; i < info->attachmentCount; i++) {
const VkPipelineCbAttachmentState *a = &info->pAttachments[i];
const VkPipelineColorBlendAttachmentState *a = &info->pAttachments[i];
struct GEN8_BLEND_STATE_ENTRY entry = {
.LogicOpEnable = info->logicOpEnable,
@@ -336,7 +433,8 @@ static const uint32_t vk_to_gen_stencil_op[] = {
};
static void
emit_ds_state(struct anv_pipeline *pipeline, VkPipelineDsStateCreateInfo *info)
emit_ds_state(struct anv_pipeline *pipeline,
const VkPipelineDepthStencilStateCreateInfo *info)
{
if (info == NULL) {
/* We're going to OR this together with the dynamic state. We need
@@ -347,7 +445,7 @@ emit_ds_state(struct anv_pipeline *pipeline, VkPipelineDsStateCreateInfo *info)
return;
}
/* bool32_t depthBoundsEnable; // optional (depth_bounds_test) */
/* VkBool32 depthBoundsEnable; // optional (depth_bounds_test) */
struct GEN8_3DSTATE_WM_DEPTH_STENCIL wm_depth_stencil = {
.DepthTestEnable = info->depthTestEnable,
@@ -369,30 +467,6 @@ emit_ds_state(struct anv_pipeline *pipeline, VkPipelineDsStateCreateInfo *info)
GEN8_3DSTATE_WM_DEPTH_STENCIL_pack(NULL, pipeline->state_wm_depth_stencil, &wm_depth_stencil);
}
VkResult anv_CreateGraphicsPipeline(
VkDevice device,
const VkGraphicsPipelineCreateInfo* pCreateInfo,
VkPipeline* pPipeline)
{
return anv_pipeline_create(device, pCreateInfo, NULL, pPipeline);
}
static void
anv_pipeline_destroy(struct anv_device *device,
struct anv_object *object,
VkObjectType obj_type)
{
struct anv_pipeline *pipeline = (struct anv_pipeline*) object;
assert(obj_type == VK_OBJECT_TYPE_PIPELINE);
anv_compiler_free(pipeline);
anv_reloc_list_finish(&pipeline->batch.relocs, pipeline->device);
anv_state_stream_finish(&pipeline->program_stream);
anv_state_pool_free(&device->dynamic_state_pool, pipeline->blend_state);
anv_device_free(pipeline->device, pipeline);
}
VkResult
anv_pipeline_create(
VkDevice _device,
@@ -400,15 +474,8 @@ anv_pipeline_create(
const struct anv_pipeline_create_info * extra,
VkPipeline* pPipeline)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_pipeline *pipeline;
const struct anv_common *common;
VkPipelineShaderStageCreateInfo *shader_create_info;
VkPipelineIaStateCreateInfo *ia_info = NULL;
VkPipelineRsStateCreateInfo *rs_info = NULL;
VkPipelineDsStateCreateInfo *ds_info = NULL;
VkPipelineCbStateCreateInfo *cb_info = NULL;
VkPipelineVertexInputCreateInfo *vi_info = NULL;
VkResult result;
uint32_t offset, length;
@@ -419,9 +486,8 @@ anv_pipeline_create(
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
pipeline->base.destructor = anv_pipeline_destroy;
pipeline->device = device;
pipeline->layout = (struct anv_pipeline_layout *) pCreateInfo->layout;
pipeline->layout = anv_pipeline_layout_from_handle(pCreateInfo->layout);
memset(pipeline->shaders, 0, sizeof(pipeline->shaders));
result = anv_reloc_list_init(&pipeline->batch.relocs, device);
@@ -435,42 +501,18 @@ anv_pipeline_create(
anv_state_stream_init(&pipeline->program_stream,
&device->instruction_block_pool);
for (common = pCreateInfo->pNext; common; common = common->pNext) {
switch (common->sType) {
case VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_CREATE_INFO:
vi_info = (VkPipelineVertexInputCreateInfo *) common;
break;
case VK_STRUCTURE_TYPE_PIPELINE_IA_STATE_CREATE_INFO:
ia_info = (VkPipelineIaStateCreateInfo *) common;
break;
case VK_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO:
anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_TESS_STATE_CREATE_INFO");
break;
case VK_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO:
anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_VP_STATE_CREATE_INFO");
break;
case VK_STRUCTURE_TYPE_PIPELINE_RS_STATE_CREATE_INFO:
rs_info = (VkPipelineRsStateCreateInfo *) common;
break;
case VK_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO:
anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_MS_STATE_CREATE_INFO");
break;
case VK_STRUCTURE_TYPE_PIPELINE_CB_STATE_CREATE_INFO:
cb_info = (VkPipelineCbStateCreateInfo *) common;
break;
case VK_STRUCTURE_TYPE_PIPELINE_DS_STATE_CREATE_INFO:
ds_info = (VkPipelineDsStateCreateInfo *) common;
break;
case VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO:
shader_create_info = (VkPipelineShaderStageCreateInfo *) common;
pipeline->shaders[shader_create_info->shader.stage] =
(struct anv_shader *) shader_create_info->shader.shader;
break;
default:
break;
}
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
pipeline->shaders[pCreateInfo->pStages[i].stage] =
anv_shader_from_handle(pCreateInfo->pStages[i].shader);
}
if (pCreateInfo->pTessellationState)
anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO");
if (pCreateInfo->pViewportState)
anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO");
if (pCreateInfo->pMultisampleState)
anv_finishme("VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO");
pipeline->use_repclear = extra && extra->use_repclear;
anv_compiler_run(device->compiler, pipeline);
@@ -479,17 +521,19 @@ anv_pipeline_create(
* hard code this to num_attributes - 2. This is because the attributes
* include VUE header and position, which aren't counted as varying
* inputs. */
if (pipeline->vs_simd8 == NO_KERNEL)
pipeline->wm_prog_data.num_varying_inputs = vi_info->attributeCount - 2;
if (pipeline->vs_simd8 == NO_KERNEL) {
pipeline->wm_prog_data.num_varying_inputs =
pCreateInfo->pVertexInputState->attributeCount - 2;
}
assert(vi_info);
emit_vertex_input(pipeline, vi_info);
assert(ia_info);
emit_ia_state(pipeline, ia_info, extra);
assert(rs_info);
emit_rs_state(pipeline, rs_info, extra);
emit_ds_state(pipeline, ds_info);
emit_cb_state(pipeline, cb_info);
assert(pCreateInfo->pVertexInputState);
emit_vertex_input(pipeline, pCreateInfo->pVertexInputState);
assert(pCreateInfo->pInputAssemblyState);
emit_ia_state(pipeline, pCreateInfo->pInputAssemblyState, extra);
assert(pCreateInfo->pRasterState);
emit_rs_state(pipeline, pCreateInfo->pRasterState, extra);
emit_ds_state(pipeline, pCreateInfo->pDepthStencilState);
emit_cb_state(pipeline, pCreateInfo->pColorBlendState);
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_VF_STATISTICS,
.StatisticsEnable = true);
@@ -538,6 +582,9 @@ anv_pipeline_create(
.PixelLocation = CENTER,
.NumberofMultisamples = log2_samples);
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_SAMPLE_MASK,
.SampleMask = 0xffff);
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_URB_VS,
.VSURBStartingAddress = pipeline->urb.vs_start,
.VSURBEntryAllocationSize = pipeline->urb.vs_size - 1,
@@ -613,7 +660,7 @@ anv_pipeline_create(
* vertex data to read from this field. We use attribute
* count - 1, as we don't count the VUE header here. */
.VertexURBEntryOutputLength =
DIV_ROUND_UP(vi_info->attributeCount - 1, 2));
DIV_ROUND_UP(pCreateInfo->pVertexInputState->attributeCount - 1, 2));
else
anv_batch_emit(&pipeline->batch, GEN8_3DSTATE_VS,
.KernelStartPointer = pipeline->vs_simd8,
@@ -639,7 +686,7 @@ anv_pipeline_create(
.MaximumNumberofThreads = device->info.max_vs_threads - 1,
.StatisticsEnable = false,
.SIMD8DispatchEnable = true,
.VertexCacheDisable = ia_info->disableVertexReuse,
.VertexCacheDisable = false,
.FunctionEnable = true,
.VertexURBEntryOutputReadOffset = offset,
@@ -700,26 +747,58 @@ anv_pipeline_create(
.oMaskPresenttoRenderTarget = wm_prog_data->uses_omask,
.PixelShaderIsPerSample = per_sample_ps);
*pPipeline = (VkPipeline) pipeline;
*pPipeline = anv_pipeline_to_handle(pipeline);
return VK_SUCCESS;
}
VkResult anv_CreateGraphicsPipelineDerivative(
VkDevice device,
const VkGraphicsPipelineCreateInfo* pCreateInfo,
VkPipeline basePipeline,
VkPipeline* pPipeline)
VkResult anv_DestroyPipeline(
VkDevice _device,
VkPipeline _pipeline)
{
stub_return(VK_UNSUPPORTED);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_pipeline, pipeline, _pipeline);
anv_compiler_free(pipeline);
anv_reloc_list_finish(&pipeline->batch.relocs, pipeline->device);
anv_state_stream_finish(&pipeline->program_stream);
anv_state_pool_free(&device->dynamic_state_pool, pipeline->blend_state);
anv_device_free(pipeline->device, pipeline);
return VK_SUCCESS;
}
VkResult anv_CreateComputePipeline(
VkResult anv_CreateGraphicsPipelines(
VkDevice _device,
VkPipelineCache pipelineCache,
uint32_t count,
const VkGraphicsPipelineCreateInfo* pCreateInfos,
VkPipeline* pPipelines)
{
VkResult result = VK_SUCCESS;
unsigned i = 0;
for (; i < count; i++) {
result = anv_pipeline_create(_device, &pCreateInfos[i],
NULL, &pPipelines[i]);
if (result != VK_SUCCESS) {
for (unsigned j = 0; j < i; j++) {
anv_DestroyPipeline(_device, pPipelines[j]);
}
return result;
}
}
return VK_SUCCESS;
}
static VkResult anv_compute_pipeline_create(
VkDevice _device,
const VkComputePipelineCreateInfo* pCreateInfo,
VkPipeline* pPipeline)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_pipeline *pipeline;
VkResult result;
@@ -730,9 +809,8 @@ VkResult anv_CreateComputePipeline(
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
pipeline->base.destructor = anv_pipeline_destroy;
pipeline->device = device;
pipeline->layout = (struct anv_pipeline_layout *) pCreateInfo->layout;
pipeline->layout = anv_pipeline_layout_from_handle(pCreateInfo->layout);
result = anv_reloc_list_init(&pipeline->batch.relocs, device);
if (result != VK_SUCCESS) {
@@ -748,7 +826,7 @@ VkResult anv_CreateComputePipeline(
memset(pipeline->shaders, 0, sizeof(pipeline->shaders));
pipeline->shaders[VK_SHADER_STAGE_COMPUTE] =
(struct anv_shader *) pCreateInfo->cs.shader;
anv_shader_from_handle(pCreateInfo->cs.shader);
pipeline->use_repclear = false;
@@ -781,37 +859,34 @@ VkResult anv_CreateComputePipeline(
pipeline->cs_right_mask = ~0u >> (32 - prog_data->simd_size);
*pPipeline = (VkPipeline) pipeline;
*pPipeline = anv_pipeline_to_handle(pipeline);
return VK_SUCCESS;
}
VkResult anv_StorePipeline(
VkDevice device,
VkPipeline pipeline,
size_t* pDataSize,
void* pData)
VkResult anv_CreateComputePipelines(
VkDevice _device,
VkPipelineCache pipelineCache,
uint32_t count,
const VkComputePipelineCreateInfo* pCreateInfos,
VkPipeline* pPipelines)
{
stub_return(VK_UNSUPPORTED);
}
VkResult result = VK_SUCCESS;
VkResult anv_LoadPipeline(
VkDevice device,
size_t dataSize,
const void* pData,
VkPipeline* pPipeline)
{
stub_return(VK_UNSUPPORTED);
}
unsigned i = 0;
for (; i < count; i++) {
result = anv_compute_pipeline_create(_device, &pCreateInfos[i],
&pPipelines[i]);
if (result != VK_SUCCESS) {
for (unsigned j = 0; j < i; j++) {
anv_DestroyPipeline(_device, pPipelines[j]);
}
VkResult anv_LoadPipelineDerivative(
VkDevice device,
size_t dataSize,
const void* pData,
VkPipeline basePipeline,
VkPipeline* pPipeline)
{
stub_return(VK_UNSUPPORTED);
return result;
}
}
return VK_SUCCESS;
}
// Pipeline layout functions
@@ -821,7 +896,7 @@ VkResult anv_CreatePipelineLayout(
const VkPipelineLayoutCreateInfo* pCreateInfo,
VkPipelineLayout* pPipelineLayout)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_pipeline_layout *layout;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
@@ -833,20 +908,20 @@ VkResult anv_CreatePipelineLayout(
layout->num_sets = pCreateInfo->descriptorSetCount;
uint32_t surface_start[VK_NUM_SHADER_STAGE] = { 0, };
uint32_t sampler_start[VK_NUM_SHADER_STAGE] = { 0, };
uint32_t surface_start[VK_SHADER_STAGE_NUM] = { 0, };
uint32_t sampler_start[VK_SHADER_STAGE_NUM] = { 0, };
for (uint32_t s = 0; s < VK_NUM_SHADER_STAGE; s++) {
for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) {
layout->stage[s].surface_count = 0;
layout->stage[s].sampler_count = 0;
}
for (uint32_t i = 0; i < pCreateInfo->descriptorSetCount; i++) {
struct anv_descriptor_set_layout *set_layout =
(struct anv_descriptor_set_layout *) pCreateInfo->pSetLayouts[i];
ANV_FROM_HANDLE(anv_descriptor_set_layout, set_layout,
pCreateInfo->pSetLayouts[i]);
layout->set[i].layout = set_layout;
for (uint32_t s = 0; s < VK_NUM_SHADER_STAGE; s++) {
for (uint32_t s = 0; s < VK_SHADER_STAGE_NUM; s++) {
layout->set[i].surface_start[s] = surface_start[s];
surface_start[s] += set_layout->stage[s].surface_count;
layout->set[i].sampler_start[s] = sampler_start[s];
@@ -857,7 +932,19 @@ VkResult anv_CreatePipelineLayout(
}
}
*pPipelineLayout = (VkPipelineLayout) layout;
*pPipelineLayout = anv_pipeline_layout_to_handle(layout);
return VK_SUCCESS;
}
VkResult anv_DestroyPipelineLayout(
VkDevice _device,
VkPipelineLayout _pipelineLayout)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_pipeline_layout, pipeline_layout, _pipelineLayout);
anv_device_free(device, pipeline_layout);
return VK_SUCCESS;
}

View File

@@ -90,6 +90,17 @@ anv_minify(uint32_t n, uint32_t levels)
return MAX(n >> levels, 1);
}
static inline bool
anv_clear_mask(uint32_t *inout_mask, uint32_t clear_mask)
{
if (*inout_mask & clear_mask) {
*inout_mask &= ~clear_mask;
return true;
} else {
return false;
}
}
#define for_each_bit(b, dword) \
for (uint32_t __dword = (dword); \
(b) = __builtin_ffs(__dword) - 1, __dword; \
@@ -148,7 +159,7 @@ void anv_abortfv(const char *format, va_list va) anv_noreturn;
return (v); \
} while (0)
#define stub(v) \
#define stub() \
do { \
anv_finishme("stub %s", __func__); \
return; \
@@ -314,17 +325,6 @@ void anv_bo_pool_finish(struct anv_bo_pool *pool);
VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo);
void anv_bo_pool_free(struct anv_bo_pool *pool, const struct anv_bo *bo);
struct anv_object;
struct anv_device;
typedef void (*anv_object_destructor_cb)(struct anv_device *,
struct anv_object *,
VkObjectType);
struct anv_object {
anv_object_destructor_cb destructor;
};
struct anv_physical_device {
struct anv_instance * instance;
uint32_t chipset_id;
@@ -332,6 +332,7 @@ struct anv_physical_device {
const char * path;
const char * name;
const struct brw_device_info * info;
int fd;
};
struct anv_instance {
@@ -355,9 +356,9 @@ struct anv_meta_state {
} blit;
struct {
VkDynamicRsState rs_state;
VkDynamicCbState cb_state;
VkDynamicDsState ds_state;
VkDynamicRasterState rs_state;
VkDynamicColorBlendState cb_state;
VkDynamicDepthStencilState ds_state;
} shared;
};
@@ -401,8 +402,7 @@ struct anv_device {
struct anv_meta_state meta_state;
struct anv_state float_border_colors;
struct anv_state uint32_border_colors;
struct anv_state border_colors;
struct anv_queue queue;
@@ -437,7 +437,7 @@ int anv_gem_set_tiling(struct anv_device *device, int gem_handle,
int anv_gem_create_context(struct anv_device *device);
int anv_gem_destroy_context(struct anv_device *device, int context);
int anv_gem_get_param(int fd, uint32_t param);
int anv_gem_get_aperture(struct anv_device *device, uint64_t *size);
int anv_gem_get_aperture(struct anv_physical_device *physical_dev, uint64_t *size);
int anv_gem_handle_to_fd(struct anv_device *device, int gem_handle);
int anv_gem_fd_to_handle(struct anv_device *device, int fd);
int anv_gem_userptr(struct anv_device *device, void *mem, size_t size);
@@ -456,6 +456,11 @@ VkResult anv_reloc_list_init(struct anv_reloc_list *list,
void anv_reloc_list_finish(struct anv_reloc_list *list,
struct anv_device *device);
uint64_t anv_reloc_list_add(struct anv_reloc_list *list,
struct anv_device *device,
uint32_t offset, struct anv_bo *target_bo,
uint32_t delta);
struct anv_batch_bo {
struct anv_bo bo;
@@ -560,7 +565,6 @@ struct anv_device_memory {
};
struct anv_dynamic_vp_state {
struct anv_object base;
struct anv_state sf_clip_vp;
struct anv_state cc_vp;
struct anv_state scissor;
@@ -577,7 +581,7 @@ struct anv_dynamic_ds_state {
};
struct anv_dynamic_cb_state {
uint32_t state_color_calc[GEN8_COLOR_CALC_STATE_length];
uint32_t state_color_calc[GEN8_COLOR_CALC_STATE_length];
};
@@ -592,7 +596,7 @@ struct anv_descriptor_set_layout {
struct anv_descriptor_slot *surface_start;
uint32_t sampler_count;
struct anv_descriptor_slot *sampler_start;
} stage[VK_NUM_SHADER_STAGE];
} stage[VK_SHADER_STAGE_NUM];
uint32_t count;
uint32_t num_dynamic_buffers;
@@ -609,6 +613,15 @@ struct anv_descriptor_set {
struct anv_descriptor descriptors[0];
};
VkResult
anv_descriptor_set_create(struct anv_device *device,
const struct anv_descriptor_set_layout *layout,
struct anv_descriptor_set **out_set);
void
anv_descriptor_set_destroy(struct anv_device *device,
struct anv_descriptor_set *set);
#define MAX_VBS 32
#define MAX_SETS 8
#define MAX_RTS 8
@@ -616,8 +629,8 @@ struct anv_descriptor_set {
struct anv_pipeline_layout {
struct {
struct anv_descriptor_set_layout *layout;
uint32_t surface_start[VK_NUM_SHADER_STAGE];
uint32_t sampler_start[VK_NUM_SHADER_STAGE];
uint32_t surface_start[VK_SHADER_STAGE_NUM];
uint32_t sampler_start[VK_SHADER_STAGE_NUM];
} set[MAX_SETS];
uint32_t num_sets;
@@ -625,7 +638,7 @@ struct anv_pipeline_layout {
struct {
uint32_t surface_count;
uint32_t sampler_count;
} stage[VK_NUM_SHADER_STAGE];
} stage[VK_SHADER_STAGE_NUM];
};
struct anv_buffer {
@@ -642,6 +655,7 @@ struct anv_buffer {
#define ANV_CMD_BUFFER_DS_DIRTY (1 << 3)
#define ANV_CMD_BUFFER_CB_DIRTY (1 << 4)
#define ANV_CMD_BUFFER_VP_DIRTY (1 << 5)
#define ANV_CMD_BUFFER_INDEX_BUFFER_DIRTY (1 << 6)
struct anv_vertex_binding {
struct anv_buffer * buffer;
@@ -653,27 +667,8 @@ struct anv_descriptor_set_binding {
uint32_t dynamic_offsets[128];
};
struct anv_cmd_buffer {
struct anv_object base;
struct anv_device * device;
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 * exec2_objects;
struct anv_bo ** exec2_bos;
uint32_t exec2_array_length;
bool need_reloc;
uint32_t serial;
uint32_t bo_count;
struct anv_batch batch;
struct anv_batch_bo * last_batch_bo;
struct anv_batch_bo * surface_batch_bo;
uint32_t surface_next;
struct anv_reloc_list surface_relocs;
struct anv_state_stream surface_state_stream;
struct anv_state_stream dynamic_state_stream;
/* State required while building cmd buffer */
/** State required while building cmd buffer */
struct anv_cmd_state {
uint32_t current_pipeline;
uint32_t vb_dirty;
uint32_t dirty;
@@ -683,36 +678,85 @@ struct anv_cmd_buffer {
struct anv_pipeline * pipeline;
struct anv_pipeline * compute_pipeline;
struct anv_framebuffer * framebuffer;
struct anv_render_pass * pass;
struct anv_subpass * subpass;
struct anv_dynamic_rs_state * rs_state;
struct anv_dynamic_ds_state * ds_state;
struct anv_dynamic_vp_state * vp_state;
struct anv_dynamic_cb_state * cb_state;
uint32_t state_vf[GEN8_3DSTATE_VF_length];
struct anv_vertex_binding vertex_bindings[MAX_VBS];
struct anv_descriptor_set_binding descriptors[MAX_SETS];
};
VkResult anv_cmd_state_init(struct anv_cmd_state *state);
void anv_cmd_state_fini(struct anv_cmd_state *state);
struct anv_cmd_buffer {
struct anv_device * device;
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 * exec2_objects;
uint32_t exec2_bo_count;
struct anv_bo ** exec2_bos;
uint32_t exec2_array_length;
bool need_reloc;
uint32_t serial;
struct anv_batch batch;
struct anv_batch_bo * last_batch_bo;
struct anv_batch_bo * surface_batch_bo;
uint32_t surface_next;
struct anv_reloc_list surface_relocs;
struct anv_state_stream surface_state_stream;
struct anv_state_stream dynamic_state_stream;
struct anv_cmd_state state;
};
struct anv_state
anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer,
uint32_t size, uint32_t alignment);
struct anv_state
anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer,
uint32_t size, uint32_t alignment);
VkResult anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer);
void anv_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer);
void anv_cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer,
struct anv_subpass *subpass);
void anv_cmd_buffer_clear_attachments(struct anv_cmd_buffer *cmd_buffer,
struct anv_render_pass *pass,
const VkClearValue *clear_values);
void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer);
void anv_aub_writer_destroy(struct anv_aub_writer *writer);
struct anv_fence {
struct anv_object base;
struct anv_bo bo;
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 exec2_objects[1];
bool ready;
};
struct anv_shader_module {
uint32_t size;
char data[0];
};
struct anv_shader {
uint32_t size;
char data[0];
struct anv_shader_module * module;
char entrypoint[0];
};
struct anv_pipeline {
struct anv_object base;
struct anv_device * device;
struct anv_batch batch;
uint32_t batch_data[256];
struct anv_shader * shaders[VK_NUM_SHADER_STAGE];
struct anv_shader * shaders[VK_SHADER_STAGE_NUM];
struct anv_pipeline_layout * layout;
bool use_repclear;
@@ -720,8 +764,9 @@ struct anv_pipeline {
struct brw_wm_prog_data wm_prog_data;
struct brw_gs_prog_data gs_prog_data;
struct brw_cs_prog_data cs_prog_data;
struct brw_stage_prog_data * prog_data[VK_NUM_SHADER_STAGE];
uint32_t scratch_start[VK_NUM_SHADER_STAGE];
bool writes_point_size;
struct brw_stage_prog_data * prog_data[VK_SHADER_STAGE_NUM];
uint32_t scratch_start[VK_SHADER_STAGE_NUM];
uint32_t total_scratch;
struct {
uint32_t vs_start;
@@ -746,6 +791,7 @@ struct anv_pipeline {
uint32_t binding_stride[MAX_VBS];
uint32_t state_sf[GEN8_3DSTATE_SF_length];
uint32_t state_vf[GEN8_3DSTATE_VF_length];
uint32_t state_raster[GEN8_3DSTATE_RASTER_length];
uint32_t state_wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length];
@@ -777,12 +823,13 @@ struct anv_format {
uint16_t surface_format; /**< RENDER_SURFACE_STATE.SurfaceFormat */
uint8_t cpp; /**< Bytes-per-pixel of anv_format::surface_format. */
uint8_t num_channels;
uint8_t depth_format; /**< 3DSTATE_DEPTH_BUFFER.SurfaceFormat */
uint16_t depth_format; /**< 3DSTATE_DEPTH_BUFFER.SurfaceFormat */
bool has_stencil;
};
const struct anv_format *
anv_format_for_vk_format(VkFormat format);
bool anv_is_vk_format_depth_or_stencil(VkFormat format);
/**
* A proxy for the color surfaces, depth surfaces, and stencil surfaces.
@@ -838,8 +885,6 @@ struct anv_image {
};
struct anv_surface_view {
struct anv_object base;
struct anv_state surface_state;
struct anv_bo * bo;
uint32_t offset;
@@ -848,34 +893,33 @@ struct anv_surface_view {
VkFormat format;
};
struct anv_image_create_info {
const VkImageCreateInfo *vk_info;
bool force_tile_mode;
uint8_t tile_mode;
struct anv_buffer_view {
/* FINISHME: Trim unneeded data from this struct. */
struct anv_surface_view view;
};
VkResult anv_image_create(VkDevice _device,
const struct anv_image_create_info *info,
VkImage *pImage);
struct anv_image_view {
struct anv_surface_view view;
};
void anv_image_view_init(struct anv_surface_view *view,
struct anv_device *device,
const VkImageViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer);
enum anv_attachment_view_type {
ANV_ATTACHMENT_VIEW_TYPE_COLOR,
ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL,
};
void anv_color_attachment_view_init(struct anv_surface_view *view,
struct anv_device *device,
const VkColorAttachmentViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer);
struct anv_attachment_view {
enum anv_attachment_view_type attachment_type;
};
void anv_surface_view_destroy(struct anv_device *device,
struct anv_object *obj, VkObjectType obj_type);
struct anv_color_attachment_view {
struct anv_attachment_view base;
struct anv_sampler {
uint32_t state[4];
struct anv_surface_view view;
};
struct anv_depth_stencil_view {
struct anv_attachment_view base;
struct anv_bo *bo;
uint32_t depth_offset; /**< Offset into bo. */
@@ -888,43 +932,134 @@ struct anv_depth_stencil_view {
uint16_t stencil_qpitch; /**< 3DSTATE_STENCIL_BUFFER.SurfaceQPitch */
};
struct anv_framebuffer {
struct anv_object base;
uint32_t color_attachment_count;
const struct anv_surface_view * color_attachments[MAX_RTS];
const struct anv_depth_stencil_view * depth_stencil;
struct anv_image_create_info {
const VkImageCreateInfo *vk_info;
bool force_tile_mode;
uint8_t tile_mode;
};
uint32_t sample_count;
VkResult anv_image_create(VkDevice _device,
const struct anv_image_create_info *info,
VkImage *pImage);
void anv_image_view_init(struct anv_image_view *view,
struct anv_device *device,
const VkImageViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer);
void anv_color_attachment_view_init(struct anv_color_attachment_view *view,
struct anv_device *device,
const VkAttachmentViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer);
void anv_fill_buffer_surface_state(void *state, VkFormat format,
uint32_t offset, uint32_t range);
void anv_surface_view_fini(struct anv_device *device,
struct anv_surface_view *view);
struct anv_sampler {
uint32_t state[4];
};
struct anv_framebuffer {
uint32_t width;
uint32_t height;
uint32_t layers;
/* Viewport for clears */
VkDynamicVpState vp_state;
VkDynamicViewportState vp_state;
uint32_t attachment_count;
const struct anv_attachment_view * attachments[0];
};
struct anv_render_pass_layer {
VkAttachmentLoadOp color_load_op;
VkClearColor clear_color;
struct anv_subpass {
uint32_t input_count;
uint32_t * input_attachments;
uint32_t color_count;
uint32_t * color_attachments;
uint32_t * resolve_attachments;
uint32_t depth_stencil_attachment;
};
struct anv_render_pass_attachment {
VkFormat format;
uint32_t samples;
VkAttachmentLoadOp load_op;
VkAttachmentLoadOp stencil_load_op;
};
struct anv_render_pass {
VkRect render_area;
uint32_t attachment_count;
uint32_t subpass_count;
uint32_t num_clear_layers;
uint32_t num_layers;
struct anv_render_pass_layer layers[0];
struct anv_render_pass_attachment * attachments;
struct anv_subpass subpasses[0];
};
void anv_device_init_meta(struct anv_device *device);
void anv_device_finish_meta(struct anv_device *device);
void
anv_cmd_buffer_clear(struct anv_cmd_buffer *cmd_buffer,
struct anv_render_pass *pass);
void *anv_lookup_entrypoint(const char *name);
void *
anv_lookup_entrypoint(const char *name);
#define ANV_DEFINE_HANDLE_CASTS(__anv_type, __VkType) \
\
static inline struct __anv_type * \
__anv_type ## _from_handle(__VkType _handle) \
{ \
return (struct __anv_type *) _handle; \
} \
\
static inline __VkType \
__anv_type ## _to_handle(struct __anv_type *_obj) \
{ \
return (__VkType) _obj; \
}
#define ANV_DEFINE_NONDISP_HANDLE_CASTS(__anv_type, __VkType) \
\
static inline struct __anv_type * \
__anv_type ## _from_handle(__VkType _handle) \
{ \
return (struct __anv_type *) _handle.handle; \
} \
\
static inline __VkType \
__anv_type ## _to_handle(struct __anv_type *_obj) \
{ \
return (__VkType) { .handle = (uint64_t) _obj }; \
}
#define ANV_FROM_HANDLE(__anv_type, __name, __handle) \
struct __anv_type *__name = __anv_type ## _from_handle(__handle)
ANV_DEFINE_HANDLE_CASTS(anv_cmd_buffer, VkCmdBuffer)
ANV_DEFINE_HANDLE_CASTS(anv_device, VkDevice)
ANV_DEFINE_HANDLE_CASTS(anv_instance, VkInstance)
ANV_DEFINE_HANDLE_CASTS(anv_physical_device, VkPhysicalDevice)
ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_attachment_view, VkAttachmentView)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer, VkBuffer)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer_view, VkBufferView);
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set, VkDescriptorSet)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set_layout, VkDescriptorSetLayout)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_device_memory, VkDeviceMemory)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_cb_state, VkDynamicColorBlendState)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_ds_state, VkDynamicDepthStencilState)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_rs_state, VkDynamicRasterState)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_vp_state, VkDynamicViewportState)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_fence, VkFence)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_framebuffer, VkFramebuffer)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_image, VkImage)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_image_view, VkImageView);
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_pipeline, VkPipeline)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_pipeline_layout, VkPipelineLayout)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_query_pool, VkQueryPool)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_render_pass, VkRenderPass)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_sampler, VkSampler)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_shader, VkShader)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_shader_module, VkShaderModule)
#ifdef __cplusplus
}

View File

@@ -36,38 +36,23 @@ struct anv_query_pool_slot {
};
struct anv_query_pool {
struct anv_object base;
VkQueryType type;
uint32_t slots;
struct anv_bo bo;
};
static void
anv_query_pool_destroy(struct anv_device *device,
struct anv_object *object,
VkObjectType obj_type)
{
struct anv_query_pool *pool = (struct anv_query_pool *) object;
assert(obj_type == VK_OBJECT_TYPE_QUERY_POOL);
anv_gem_munmap(pool->bo.map, pool->bo.size);
anv_gem_close(device, pool->bo.gem_handle);
anv_device_free(device, pool);
}
VkResult anv_CreateQueryPool(
VkDevice _device,
const VkQueryPoolCreateInfo* pCreateInfo,
VkQueryPool* pQueryPool)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_query_pool *pool;
VkResult result;
size_t size;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO);
switch (pCreateInfo->queryType) {
case VK_QUERY_TYPE_OCCLUSION:
break;
@@ -82,9 +67,6 @@ VkResult anv_CreateQueryPool(
if (pool == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
pool->base.destructor = anv_query_pool_destroy;
pool->type = pCreateInfo->queryType;
size = pCreateInfo->slots * sizeof(struct anv_query_pool_slot);
result = anv_bo_init_new(&pool->bo, device, size);
if (result != VK_SUCCESS)
@@ -92,7 +74,7 @@ VkResult anv_CreateQueryPool(
pool->bo.map = anv_gem_mmap(device, pool->bo.gem_handle, 0, size);
*pQueryPool = (VkQueryPool) pool;
*pQueryPool = anv_query_pool_to_handle(pool);
return VK_SUCCESS;
@@ -102,6 +84,20 @@ VkResult anv_CreateQueryPool(
return result;
}
VkResult anv_DestroyQueryPool(
VkDevice _device,
VkQueryPool _pool)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_query_pool, pool, _pool);
anv_gem_munmap(pool->bo.map, pool->bo.size);
anv_gem_close(device, pool->bo.gem_handle);
anv_device_free(device, pool);
return VK_SUCCESS;
}
VkResult anv_GetQueryPoolResults(
VkDevice _device,
VkQueryPool queryPool,
@@ -111,8 +107,8 @@ VkResult anv_GetQueryPoolResults(
void* pData,
VkQueryResultFlags flags)
{
struct anv_device *device = (struct anv_device *) _device;
struct anv_query_pool *pool = (struct anv_query_pool *) queryPool;
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
struct anv_query_pool_slot *slot = pool->bo.map;
int64_t timeout = INT64_MAX;
uint32_t *dst32 = pData;
@@ -172,8 +168,8 @@ void anv_CmdBeginQuery(
uint32_t slot,
VkQueryControlFlags flags)
{
struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) cmdBuffer;
struct anv_query_pool *pool = (struct anv_query_pool *) queryPool;
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
switch (pool->type) {
case VK_QUERY_TYPE_OCCLUSION:
@@ -192,8 +188,8 @@ void anv_CmdEndQuery(
VkQueryPool queryPool,
uint32_t slot)
{
struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) cmdBuffer;
struct anv_query_pool *pool = (struct anv_query_pool *) queryPool;
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
switch (pool->type) {
case VK_QUERY_TYPE_OCCLUSION:
@@ -224,8 +220,8 @@ void anv_CmdWriteTimestamp(
VkBuffer destBuffer,
VkDeviceSize destOffset)
{
struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) cmdBuffer;
struct anv_buffer *buffer = (struct anv_buffer *) destBuffer;
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
ANV_FROM_HANDLE(anv_buffer, buffer, destBuffer);
struct anv_bo *bo = buffer->bo;
switch (timestampType) {
@@ -305,9 +301,9 @@ void anv_CmdCopyQueryPoolResults(
VkDeviceSize destStride,
VkQueryResultFlags flags)
{
struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) cmdBuffer;
struct anv_query_pool *pool = (struct anv_query_pool *) queryPool;
struct anv_buffer *buffer = (struct anv_buffer *) destBuffer;
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, cmdBuffer);
ANV_FROM_HANDLE(anv_query_pool, pool, queryPool);
ANV_FROM_HANDLE(anv_buffer, buffer, destBuffer);
uint32_t slot_offset, dst_offset;
if (flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) {

View File

@@ -67,6 +67,8 @@ i = 0
for line in fileinput.input():
m = p.match(line)
if (m):
if m.group(2) == 'VoidFunction':
continue
fullname = "vk" + m.group(2)
h = hash(fullname)
entrypoints.append((m.group(1), m.group(2), m.group(3), i, h))

View File

@@ -88,7 +88,8 @@ VkResult anv_CreateSwapChainWSI(
const VkSwapChainCreateInfoWSI* pCreateInfo,
VkSwapChainWSI* pSwapChain)
{
struct anv_device *device = (struct anv_device *) _device;
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_swap_chain *chain;
xcb_void_cookie_t cookie;
VkResult result;
@@ -110,11 +111,13 @@ VkResult anv_CreateSwapChainWSI(
chain->extent = pCreateInfo->imageExtent;
for (uint32_t i = 0; i < chain->count; i++) {
VkDeviceMemory memory_h;
VkImage image_h;
struct anv_image *image;
struct anv_surface *surface;
struct anv_device_memory *memory;
anv_image_create((VkDevice) device,
anv_image_create(_device,
&(struct anv_image_create_info) {
.force_tile_mode = true,
.tile_mode = XMAJOR,
@@ -136,21 +139,23 @@ VkResult anv_CreateSwapChainWSI(
.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
.flags = 0,
}},
(VkImage *) &image);
&image_h);
image = anv_image_from_handle(image_h);
surface = &image->primary_surface;
anv_AllocMemory((VkDevice) device,
anv_AllocMemory(_device,
&(VkMemoryAllocInfo) {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO,
.allocationSize = image->size,
.memoryTypeIndex = 0,
},
(VkDeviceMemory *) &memory);
&memory_h);
anv_QueueBindObjectMemory(VK_NULL_HANDLE,
VK_OBJECT_TYPE_IMAGE,
(VkImage) image, 0,
(VkDeviceMemory) memory, 0);
memory = anv_device_memory_from_handle(memory_h);
anv_BindImageMemory(VK_NULL_HANDLE, anv_image_to_handle(image),
memory_h, 0);
ret = anv_gem_set_tiling(device, memory->bo.gem_handle,
surface->stride, I915_TILING_X);
@@ -241,8 +246,8 @@ VkResult anv_GetSwapChainInfoWSI(
images = pData;
for (uint32_t i = 0; i < chain->count; i++) {
images[i].image = (VkImage) chain->images[i].image;
images[i].memory = (VkDeviceMemory) chain->images[i].memory;
images[i].image = anv_image_to_handle(chain->images[i].image);
images[i].memory = anv_device_memory_to_handle(chain->images[i].memory);
}
return VK_SUCCESS;
@@ -256,7 +261,8 @@ VkResult anv_QueuePresentWSI(
VkQueue queue_,
const VkPresentInfoWSI* pPresentInfo)
{
struct anv_image *image = (struct anv_image *) pPresentInfo->image;
ANV_FROM_HANDLE(anv_image, image, pPresentInfo->image);
struct anv_swap_chain *chain = image->swap_chain;
xcb_void_cookie_t cookie;
xcb_pixmap_t pixmap;
@@ -268,7 +274,7 @@ VkResult anv_QueuePresentWSI(
pixmap = XCB_NONE;
for (uint32_t i = 0; i < chain->count; i++) {
if ((VkImage) chain->images[i].image == pPresentInfo->image) {
if (image == chain->images[i].image) {
pixmap = chain->images[i].pixmap;
break;
}