Commit Graph

659 Commits

Author SHA1 Message Date
Józef Kucia
fb67ccd159 libs/vkd3d-shader: Translate geometry shader emit instructions.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-11 22:31:48 +01:00
Józef Kucia
374a23bdd8 libs/vkd3d-shader: Introduce separate stream for execution mode declarations.
Tessellation and geometry shaders generate a lot of execution mode
declarations.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-11 22:31:47 +01:00
Józef Kucia
4ad1f9683e libs/vkd3d-shader: Translate dcl_maxout instructions.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-11 22:31:45 +01:00
Józef Kucia
ee8eb9b4e4 libs/vkd3d: Validate miplevel count while creating resources.
vkd3d_log2i() is imported from wined3d.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-11 22:31:33 +01:00
Józef Kucia
5d85da0d84 libs/vkd3d: Release current command allocator in d3d12_command_list_Close().
d3d12_command_allocator_free_command_buffer() is not a very accurate name.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:37:12 +01:00
Józef Kucia
e061e9f3cb libs/vkd3d: Add more formats.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:37:10 +01:00
Józef Kucia
5123feb750 libs/vkd3d: Remove unused prototype for vkEnumerateInstanceLayerProperties().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:37:08 +01:00
Józef Kucia
8e3302d532 libs/vkd3d: Fix crash when creating NULL CBVs.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:37:04 +01:00
Józef Kucia
f0bc873e7a libs/vkd3d-shader: Generate valid SPIR-V for unimplemented registers.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:37:02 +01:00
Józef Kucia
219b537209 libs/vkd3d-shader: Handle unimplemented registers more gracefully.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-09 20:36:59 +01:00
Józef Kucia
4ae6285c8e libs/vkd3d-shader: Fix result type for OpImageSampleDref instructions.
Per the SPIR-V spec:

  "Result Type must be a scalar of integer type or floating-point type."

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-15 16:27:27 +01:00
Józef Kucia
7ee3a02f92 libs/vkd3d-shader: Avoid theoretical crash in vkd3d_dxbc_compiler_emit_dot().
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-14 13:40:26 +01:00
Józef Kucia
006f36c2ac libs/vkd3d-shader: Introduce vkd3d_dxbc_compiler_get_constant_uint_vector() helper.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-14 13:40:20 +01:00
Józef Kucia
995e3a2359 libs/vkd3d-utils: Use proper name in libvkd3d-utils.pc. 2017-12-12 13:12:47 +01:00
Józef Kucia
879c9e43d1 libs/vkd3d: Do not export D3D12* functions.
Move them to libvkd3d-utils.
2017-12-12 13:12:47 +01:00
Józef Kucia
e0cb3776c1 libs/vkd3d-shader: Fix discard_z instruction. 2017-12-11 12:55:55 +01:00
Józef Kucia
4e121f8b5d libs/vkd3d-shader: Implement SV_IsFrontFace. 2017-10-31 15:44:44 +01:00
Józef Kucia
79f80df1ee libs/vkd3d-shader: Translate dcl_input_ps_sgv instructions. 2017-10-31 15:44:44 +01:00
Józef Kucia
7e5dd39f5f libs/vkd3d: Prefer VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL.
Use VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL if depth/stencil
writes are disabled.
2017-10-30 14:04:53 +01:00
Józef Kucia
3340cafdc4 libs/vkd3d-shader: Avoid potential stack smashing. 2017-10-25 22:55:39 +02:00
Józef Kucia
f04389d90b libs/vkd3d-shader: Use more sensible default descriptor binding assignment. 2017-10-25 14:34:44 +02:00
Józef Kucia
e959686f12 libs/vkd3d-shader: Make sure that OpVariables are first instructions in main function.
The SPIR-V spec says:

  "All OpVariable instructions in a function must be in the first block
  in the function. These instructions, together with any immediately
  preceding OpLine instructions, must be the first instructions in that
  block."
2017-10-25 09:58:14 +02:00
Józef Kucia
b65c42e6f9 libs/vkd3d-shader: Avoid OpVectorShuffle on scalars.
The SPIR-V spec states:

  "Vector 1 and Vector 2 must both have vector types, with the same
  Component Type as Result Type."
2017-10-24 21:26:48 +02:00
Józef Kucia
2b21fbf6b8 libs/vkd3d: Add VKD3D_SHADER_DUMP_PATH environment variable for dumping shaders.
A similar functionality was helpful numerous number of times when
developing libvkd3d-shader.
2017-10-24 15:22:01 +02:00
Józef Kucia
f2b37c732a libs/vkd3d: Use if-else in d3d12_command_list_get_fb_extent(). 2017-10-24 12:10:48 +02:00
Józef Kucia
c70a023aeb libs/vkd3d: Remove FIXME comment from vk_barrier_parameters_from_d3d12_resource_state(). 2017-10-24 12:10:48 +02:00
Józef Kucia
b211df683e libs/vkd3d: Implement copying between depth/stencil and color textures.
This could be implemented more efficiently, but ideally we would get
a Vulkan extension for copying between depth/stencil and color textures.
2017-10-20 18:27:17 +02:00
Józef Kucia
a4bd0c1c90 libs/vkd3d: Allocate GPU virtual addresses in d3d12_committed_resource_init(). 2017-10-20 18:27:17 +02:00
Józef Kucia
a63b81858c libs/vkd3d: Limit buffer usage flags based on heap type. 2017-10-20 18:27:17 +02:00
Józef Kucia
310335f748 libs/vkd3d-shader: Branch directly to merge block when switch default block is absent. 2017-10-20 18:27:17 +02:00
Józef Kucia
137b5d694b libs/vkd3d-shader: Move inside_block field to vkd3d_control_flow_info. 2017-10-18 19:02:46 +02:00
Józef Kucia
c112f2ed46 libs/vkd3d-shader: Get rid of VKD3D_BLOCK_ELSE. 2017-10-18 19:02:46 +02:00
Józef Kucia
9f831b938a libs/vkd3d-shader: Avoid emitting empty else branches.
We have to patch SpvOpBranchConditional instruction when emitting the
else block because we do not know if an else block is present in
advance.
2017-10-18 19:02:46 +02:00
Józef Kucia
646385e871 libs/vkd3d-shader: Get rid of VKD3D_BLOCK_MAIN. 2017-10-18 19:02:46 +02:00
Józef Kucia
8a047a8eb7 libs/vkd3d-shader: Rename control flow union member for if instructions. 2017-10-18 19:02:46 +02:00
Józef Kucia
0369f39a47 libs/vkd3d-shader: Generate correct SPIR-V for rcp with multiple components. 2017-10-18 12:21:24 +02:00
Józef Kucia
7fa3f2ed1a libs/vkd3d: Add FIXME comment for GPU VA allocator. 2017-10-18 11:54:56 +02:00
Józef Kucia
c5e400fa30 libs/vkd3d-shader: Document hacks introduced for Nvidia driver.
See 70f5b24f92.
2017-10-12 17:47:53 +02:00
Józef Kucia
2171ba6d32 libs/vkd3d-shader: Decrement OpAtomicIDecrement result. 2017-10-12 13:10:26 +02:00
Józef Kucia
94a33020d3 libs/vkd3d-shader: Use switch statement in shader_parse_root_parameters(). 2017-10-10 16:57:36 +02:00
Józef Kucia
4522a80de8 libs/vkd3d-shader: Use switch statement in shader_write_root_parameters(). 2017-10-10 16:57:36 +02:00
Józef Kucia
18b285328e libs/vkd3d-shader: Add version argument to vkd3d_shader_serialize_root_signature(). 2017-10-10 16:57:36 +02:00
Józef Kucia
f4cfebcd7e libs/vkd3d: Remove hack for creating root signatures from description. 2017-10-10 16:02:09 +02:00
Józef Kucia
5b5cffcf84 libs/vkd3d: Implement creating root signature from bytecode. 2017-10-10 16:02:09 +02:00
Józef Kucia
4629cbdf8a libs/vkd3d: Implement D3D12SerializeRootSignature(). 2017-10-10 16:02:09 +02:00
Józef Kucia
6b43a5fe38 libs/vkd3d-shader: Implement root signature serialization. 2017-10-10 16:02:09 +02:00
Henri Verbeet
53654baab9 libs/vkd3d: Support D3D12_FEATURE_FORMAT_SUPPORT in d3d12_device_CheckFeatureSupport(). 2017-10-10 13:09:32 +02:00
Józef Kucia
586e1cc532 libs/vkd3d-shader: Implement relative addressing for constant buffers. 2017-10-06 17:06:31 +02:00
Józef Kucia
853068c84d libs/vkd3d: Get rid of host writes memory dependency for intial state transitions. 2017-10-06 17:06:31 +02:00
Józef Kucia
97bfba1167 libs/vkd3d: Avoid read access bits in source access masks.
A memory dependency is used to make memory writes available
and visible.
2017-10-06 17:06:31 +02:00
Józef Kucia
5479ac7011 libs/vkd3d-shader: Always emit default block for OpSwitch.
The default block is required in SPIR-V.
2017-10-05 15:58:51 +02:00
Józef Kucia
9feb7a3956 libs/vkd3d-shader: Recognize nop instruction. 2017-10-05 15:58:51 +02:00
Józef Kucia
67aed755ab libs/vkd3d: Implement d3d12_command_list_ClearUnorderedAccessViewUint() for R32_UINT buffer views.
Ideally, we would store additional informations only in CPU descriptors.
2017-10-04 13:55:33 +02:00
Józef Kucia
fecc94cebc libs/vkd3d: Add helpers for dereferencing descriptor handles. 2017-10-04 13:55:33 +02:00
Józef Kucia
b002cc4cae libs/vkd3d: Use BC1 formats with alpha. 2017-09-26 11:48:03 +02:00
Józef Kucia
e7aa2a7bcf libs/vkd3d-shader: Emit NonReadable decoration for image variables.
Fixes image writes for UNORM formats on Anv. Anv uses special surface
state for write-only storage image descriptors.

The SPIR-V spec doesn't state that the NonReadable decoration is
required for images used with StorageImageWriteWithoutFormat. On the
other hand, glslang requires the 'writeonly' keyword for images without
format, and it emits the NonReadable decoration.
2017-09-26 10:37:41 +02:00
Józef Kucia
5a020d6673 libs/vkd3d-shader: Implement shader visibility for descriptors. 2017-09-22 16:42:07 +02:00
Józef Kucia
14d975da8d libs/vkd3d: Unroll descriptor copies for SRVs and UAVs.
Consecutive binding updates need to have the same descriptor type
according to validation layers.
2017-09-22 16:42:07 +02:00
Józef Kucia
6ef1961ed0 libs/vkd3d: Avoid recording invalid vkCmdCopyImage() commands. 2017-09-21 15:12:13 +02:00
Józef Kucia
8cb004bdc4 libs/vkd3d: Create single default sampler per device. 2017-09-21 15:12:13 +02:00
Józef Kucia
cfa827b2f8 libs/vkd3d: Call compute_input_layout_offsets() unconditionally. 2017-09-21 15:12:13 +02:00
Józef Kucia
54cd424daf libs/vkd3d: Implement d3d12_command_list_SetGraphicsRootShaderResourceView(). 2017-09-19 17:29:20 +02:00
Józef Kucia
eb8eba02bd libs/vkd3d: Implement d3d12_command_list_SetComputeRootShaderResourceView(). 2017-09-19 17:29:20 +02:00
Józef Kucia
90cf804d9b libs/vkd3d: Use Vulkan pipeline cache for graphics pipelines. 2017-09-19 10:58:04 +02:00
Józef Kucia
d2e7fcdf77 libs/vkd3d: Add environment variable for disabling Vulkan extensions.
It's useful for testing, e.g. VKD3D_DISABLE_EXTENSIONS=VK_KHR_push_descriptor
2017-09-18 15:40:42 +02:00
Józef Kucia
acfd64c20e libs/vkd3d: Avoid copying descriptors for dirty root descriptor tables. 2017-09-18 15:40:42 +02:00
Józef Kucia
67641a8999 libs/vkd3d: Initialize device feature options in vkd3d_init_device_caps(). 2017-09-14 15:38:19 +02:00
Józef Kucia
554d07df06 libs/vkd3d: Warn about unmet feature level 11_0 requirements.
This isn't necessarily exhaustive.
2017-09-14 15:38:19 +02:00
Józef Kucia
602f9780f8 libs/vkd3d-shader: Implement "sample" interpolation qualifier. 2017-09-14 15:38:19 +02:00
Józef Kucia
2ea8ffb554 libs/vkd3d: Avoid vkCmdCopyQueryPoolResults() for not issued queries.
The Vulkan spec states:

  * "If the query does not become available in a finite amount of time
    (e.g.  due to not issuing a query since the last reset), a
    VK_ERROR_DEVICE_LOST error may occur."

  * "If queries will never finish (e.g. due to being reset but not
    issued), then vkGetQueryPoolResults may not return in finite time."
2017-09-14 14:57:09 +02:00
Józef Kucia
334c532401 libs/vkd3d: Implement d3d12_command_list_CopyResource() for buffers. 2017-09-14 14:57:09 +02:00
Józef Kucia
6b757f3002 libs/vkd3d-shader: Subtract BaseInstance from InstanceIndex.
Depends on SPV_KHR_shader_draw_parameters extension.
2017-09-12 17:42:42 +02:00
Józef Kucia
a77376121d libs/vkd3d: Require VK_KHR_shader_draw_parameters device extension. 2017-09-12 17:42:42 +02:00
Józef Kucia
2425e2939a libs/vkd3d: Match input layout elements with vertex shader inputs. 2017-09-11 22:35:16 +02:00
Józef Kucia
b19fe74284 libs/vkd3d-shader: Export shader signature parsing. 2017-09-11 22:35:16 +02:00
Józef Kucia
b61c785bd0 libs/vkd3d-shader: Implement SV_InstanceID. 2017-09-11 22:35:16 +02:00
Józef Kucia
cd99601b3c libs/vkd3d: Implement offset computation for D3D12_APPEND_ALIGNED_ELEMENT. 2017-09-11 22:35:16 +02:00
Józef Kucia
8e802ed0af libs/vkd3d: Update descriptor table ranges only with matching descriptor types. 2017-09-11 22:35:16 +02:00
Józef Kucia
a78fe60ef8 Revert "libs/vkd3d: Skip unbound UAV counters."
This reverts commit d9bc635d1a.

We should not need to handle this invalid behavior. It was triggered
by the bug in d3d12_command_list_update_descriptor_table().
2017-09-11 22:35:16 +02:00
Józef Kucia
1cde37d341 libs/vkd3d: Fix updating descriptor sets for descriptor tables with gaps.
Fixes 9afaed918d.
2017-09-11 22:35:16 +02:00
Józef Kucia
32966338df libs/vkd3d: Get rid of UAV counter count from d3d12_pipeline_state. 2017-09-08 15:30:48 +02:00
Józef Kucia
e8868affc0 libs/vkd3d: Clear UAV counters dirty mask after updating descriptors. 2017-09-08 15:30:48 +02:00
Józef Kucia
d9bc635d1a libs/vkd3d: Skip unbound UAV counters. 2017-09-08 15:04:30 +02:00
Józef Kucia
9afaed918d libs/vkd3d: Bind descriptor set for UAV counters. 2017-09-08 15:04:30 +02:00
Józef Kucia
19dc6c412e libs/vkd3d: Constify root signature pointers. 2017-09-08 15:04:30 +02:00
Józef Kucia
0d28036d2a libs/vkd3d: Add UAV counter support for compute pipelines.
UAV counter descriptors are stored in a separate VkDescriptorSet.
A VkPipelineLayout created for compute pipeline is compatible for all
other descriptor sets with the VkPipelineLayout created for the root
signature. This ensures that only UAV counter bindings in the last
descriptor set may be disturbed when switching between pipelines with
compatible root signatures.

The implementation of vkd3d_popcount() is based on
https://graphics.stanford.edu/~seander/bithacks.html
2017-09-08 15:04:30 +02:00
Józef Kucia
37f4c9d2a3 libs/vkd3d: Print only TRACE() messages for not initialized descriptors.
A descriptor do not have to be initialized if it is not used by shaders.
2017-09-07 17:48:43 +02:00
Józef Kucia
30cd4cc59f libs/vkd3d-shader: Always declare format for raw/structured image variables. 2017-09-07 17:48:43 +02:00
Józef Kucia
6dfb4ad520 libs/vkd3d-shader: Mark imm_atomic_alloc as UAV read instruction. 2017-09-07 17:48:43 +02:00
Józef Kucia
4af15035df libs/vkd3d-shader: Improve some debug messages. 2017-09-07 17:48:43 +02:00
Józef Kucia
3191e1eaa9 libs/vkd3d-shader: Implement UAV counters instructions. 2017-09-07 17:15:54 +02:00
Józef Kucia
5ef6f71996 libs/vkd3d-shader: Emit declarations for UAV counters. 2017-09-07 17:15:54 +02:00
Józef Kucia
7416c83ae2 libs/vkd3d-shader: Rename vkd3d_descriptor_type to vkd3d_shader_descriptor_type. 2017-09-07 17:15:54 +02:00
Józef Kucia
efdf2ec691 libs/vkd3d-shader: Rename vkd3d_shader_push_constant to vkd3d_shader_push_constant_buffer.
This should be clearer. Multiple constant buffers can be assigned to
a single push constant range.
2017-09-07 17:15:54 +02:00
Józef Kucia
bd0c886281 libs/vkd3d: Store push constant ranges in root signatures.
In prep for UAV counters support.
2017-09-07 17:15:54 +02:00
Józef Kucia
ce8a0290b4 libs/vkd3d: Factor out vkd3d_create_pipeline_layout() function. 2017-09-07 17:15:54 +02:00
Józef Kucia
22b019137b libs/vkd3d: Factor out vkd3d_create_descriptor_set_layout() function. 2017-09-07 17:15:53 +02:00
Józef Kucia
f587670445 libs/vkd3d: Drop support for SPIR-V shaders. 2017-09-07 17:15:53 +02:00
Józef Kucia
495bd6fddc libs/vkd3d: Create Vulkan buffer views for UAV counter resources. 2017-09-07 17:15:53 +02:00
Józef Kucia
23150f6050 libs/vkd3d: Update Vulkan descriptor sets just before draw call. 2017-09-05 11:53:55 +02:00