Commit Graph

444 Commits

Author SHA1 Message Date
Józef Kucia ae8d8036c6 libs/vkd3d-shader: Implement switch control flow instructions. 2017-08-01 10:51:45 +02:00
Józef Kucia 5061dbaf0c libs/vkd3d-shader: Add mechanism for inserting words into SPIR-V streams.
Allows inserting SPIR-V instructions at arbitrary locations in SPIR-V
streams.
2017-08-01 10:51:45 +02:00
Józef Kucia c1c94e248c libs/vkd3d-shader: Allow multiple push constant buffers. 2017-08-01 10:51:45 +02:00
Józef Kucia 3e91bc7c2d libs/vkd3d: Fix push constant ranges allocation.
Any two push constant ranges must not include the same stage.
2017-08-01 10:51:45 +02:00
Józef Kucia d75966ab9e libs/vkd3d: Assign non-overlapping push constant ranges for root constants. 2017-08-01 10:51:45 +02:00
Józef Kucia fec337a03c libs/vkd3d-shader: Fix memory leak in vkd3d_dxbc_compiler_destroy(). 2017-07-28 12:56:18 +02:00
Józef Kucia 85dc44e4ba libs/vkd3d: Remove double semicolons. 2017-07-28 12:56:18 +02:00
Józef Kucia 9725eb3763 libs/vkd3d-shader: Remove double semicolons. 2017-07-28 12:56:18 +02:00
Józef Kucia e074c30dc7 libs/vkd3d: Pass push constants mapping to shader compiler. 2017-07-28 10:19:37 +02:00
Józef Kucia 56b68c486c libs/vkd3d: Implement d3d12_command_list_SetGraphicsRoot32BitConstants(). 2017-07-28 10:19:37 +02:00
Józef Kucia 33eae49eda libs/vkd3d: Implement d3d12_command_list_SetComputeRoot32BitConstants(). 2017-07-28 10:19:37 +02:00
Józef Kucia 21e2633b10 libs/vkd3d: Implement d3d12_command_list_SetGraphicsRoot32BitConstant(). 2017-07-28 10:19:37 +02:00
Józef Kucia 72f723522e libs/vkd3d: Implement d3d12_command_list_SetComputeRoot32BitConstant(). 2017-07-28 10:19:37 +02:00
Henri Verbeet 605a02274e libs/vkd3d: Allocate GPU virtual addresses for resources.
Direct3D 12 resources, buffers in particular, are bound to the pipeline
by their GPU virtual address. In Vulkan, these addresses are not visible
to the application. We previously handled this by returning the VkBuffer
handle as virtual address, but this can't work when the application
binds anything other than the resource's base GPU VA. Instead, we
allocate ranges of GPU address space and associate resources with it.

This uses the (naive) approach of simply allocating subsequent ranges,
and never reclaiming them. Eventually we'll have to revisit that.
2017-07-27 16:28:46 +02:00
Henri Verbeet 1acd3d44b1 Implement d3d12_device_CreateQueryHeap(). 2017-07-27 16:28:29 +02:00
Henri Verbeet e9046a81cc Implement d3d12_device_CreateCommandSignature(). 2017-07-27 16:28:24 +02:00
Henri Verbeet 863a8f3f6f libs/vkd3d: Add DXGI_FORMAT_BC3_UNORM_SRGB. 2017-07-27 16:27:41 +02:00
Henri Verbeet 2a3d121c74 libs/vkd3d: Add DXGI_FORMAT_R8_SNORM. 2017-07-27 16:26:36 +02:00
Henri Verbeet abff100287 libs/vkd3d: Add DXGI_FORMAT_R16G16B16A16_UINT. 2017-07-27 16:25:34 +02:00
Józef Kucia 92fcb9ffa2 libs/vkd3d-shader: Add support for push constants. 2017-07-27 15:24:38 +02:00
Józef Kucia 7aaa801768 libs/vkd3d: Allow root signatures with no descriptors.
A root signature can have no descriptors when it is empty,
or it has only root constants.
2017-07-27 14:19:41 +02:00
Józef Kucia bb80c759fc libs/vkd3d: Introduce d3d12_root_signature_cleanup() helper function.
Reduces code duplication.
2017-07-27 14:19:41 +02:00
Józef Kucia e3d3819789 libs/vkd3d: Fix copy-paste error in d3d12_root_signature_init(). 2017-07-26 16:09:40 +02:00
Józef Kucia 1589ce7682 libs/vkd3d: Fix Vulkan bindings assignment.
Fixes 6d569fcbc6,
2017-07-26 14:50:39 +02:00
Józef Kucia a2e38b5672 libs/vkd3d: Set VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT only if width and height are equal. 2017-07-26 13:45:25 +02:00
Józef Kucia 6d569fcbc6 libs/vkd3d: Assign consecutive Vulkan bindings for D3D12 descriptors. 2017-07-26 13:45:25 +02:00
Józef Kucia edd1e9602d libs/vkd3d-shader: Implement arbitrary mappings from D3D shader register to Vulkan descriptors.
An arbitrary mapping can be passed to vkd3d_shader_compile_dxbc().
2017-07-26 13:45:25 +02:00
Józef Kucia d39d0e4c9f libs/vkd3d: Fix memory leak in d3d12_root_signature_init(). 2017-07-25 18:47:42 +02:00
Sven Hesse 3328be8c87 libs/vkd3d: Unroll descriptor tables and fill in push constants 2017-07-25 17:41:58 +02:00
Józef Kucia 6c174beb4b libs/vkd3d-shader: Use component types from input signatures for shader inputs.
Fixes Vulkan validation layers errors.
2017-07-25 14:23:27 +02:00
Józef Kucia 5a2ebc62f6 libs/vkd3d-shader: Use component types from output signatures for shader outputs.
Fixes Vulkan validation layers errors.
2017-07-25 14:23:27 +02:00
Józef Kucia bb18c171bf libs/vkd3d: Implement d3d12_command_list_Dispatch(). 2017-07-25 12:50:14 +02:00
Józef Kucia 47cb8ba80f libs/vkd3d: Bind compute pipeline. 2017-07-25 12:50:14 +02:00
Józef Kucia 982075db60 libs/vkd3d: Partially implement d3d12_command_list_SetComputeRootDescriptorTable(). 2017-07-25 12:50:14 +02:00
Józef Kucia 5ac8dbfc64 libs/vkd3d: Implement d3d12_device_CreateUnorderedAccessView(). 2017-07-25 12:50:14 +02:00
Józef Kucia 73cdf0164a libs/vkd3d: Implement d3d12_command_list_SetComputeRootSignature(). 2017-07-25 12:50:14 +02:00
Józef Kucia 3f4ef37b88 libs/vkd3d: Introduce d3d12_command_list_allocate_descriptor_set() helper function. 2017-07-25 12:50:14 +02:00
Józef Kucia 055b27da12 libs/vkd3d: Rename current_descriptor_set to graphics_descriptor_set. 2017-07-25 12:50:14 +02:00
Józef Kucia d0a4238e39 libs/vkd3d: Allocate Vulkan descriptors for UAVs. 2017-07-25 12:50:14 +02:00
Józef Kucia bd437d547f libs/vkd3d: Add support for compute command allocators. 2017-07-25 11:22:34 +02:00
Józef Kucia a0e82064dc libs/vkd3d-shader: Mask coordinates for OpImageWrite instructions. 2017-07-24 19:43:50 +02:00
Józef Kucia 046afde8db libs/vkd3d-shader: Store resource type info in table. 2017-07-24 19:43:50 +02:00
Józef Kucia aa3465ac83 libs/vkd3d-shader: Fix bitcasts for shader inputs. 2017-07-24 19:43:50 +02:00
Józef Kucia c71d609fb6 libs/vkd3d-shader: Fix write mask for vThreadIDInGroupFlattened. 2017-07-24 19:43:50 +02:00
Józef Kucia 6bbd6c948a libs/vkd3d-shader: Translate store_uav_typed instructions. 2017-07-24 19:43:50 +02:00
Józef Kucia 4746833a6f libs/vkd3d-shader: Translate dcl_uav_typed instructions. 2017-07-24 19:43:50 +02:00
Józef Kucia 00606b7dff libs/vkd3d: Fix logic for choosing compute-only queue family index. 2017-07-21 22:29:12 +02:00
Józef Kucia d35ffe53ad libs/vkd3d: Initialize device->compute_queue_family_index.
Fixes dadce84a4b.
2017-07-21 22:29:12 +02:00
Sven Hesse dadce84a4b libs/vkd3d: Create a compute queue family. 2017-07-21 15:24:57 +02:00
Józef Kucia ea6b35ef58 libs/vkd3d-shader: Translate udiv instructions. 2017-07-21 14:14:42 +02:00
Józef Kucia c73b201110 libs/vkd3d-shader: Do not print FIXMEs for known global flags. 2017-07-21 14:14:42 +02:00
Józef Kucia 95b6b7b91b libs/vkd3d-shader: Clean up vkd3d_dxbc_compiler_emit_control_flow_instruction(). 2017-07-21 14:14:42 +02:00
Józef Kucia 18c06c8022 libs/vk3d-shader: Translate break instructions for loops. 2017-07-20 13:32:40 +02:00
Józef Kucia 1cbf6ebddf libs/vk3d-shader: Fix return instructions in if/else blocks. 2017-07-20 13:32:40 +02:00
Józef Kucia 2022702858 libs/vkd3d-shader: Translate breakc instructions. 2017-07-20 13:32:40 +02:00
Józef Kucia 98c307cdbc libs/vkd3d-shader: Implement loops. 2017-07-20 13:32:40 +02:00
Józef Kucia f6f70d8c02 libs/vkd3d-shader: Add support for nested control flow. 2017-07-20 13:32:40 +02:00
Józef Kucia 1e9a38005b libs/vkd3d-shader: Use vkd3d_spirv_build_once mechanism for SPIR-V constants. 2017-07-19 14:45:54 +02:00
Józef Kucia ab78c23170 libs/vkd3d-shader: Translate round_{ni,pi} instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia fed8155d08 libs/vkd3d-shader: Translate rcp instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia a4e5d06cac libs/vkd3d-shader: Translate log instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia 87f34094db libs/vkd3d-shader: Translate imul instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia b75022df72 libs/vkd3d-shader: Translate more integer comparison instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia e8edbac33f libs/vkd3d-shader: Translate more integer ALU instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia dddd97f126 libs/vkd3d-shader: Translate imad instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia be276b4182 libs/vkd3d-shader: Translate frc instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia aa8ce19b2e libs/vkd3d-shader: Translate exp instructions. 2017-07-19 13:53:59 +02:00
Józef Kucia e307beee29 libs/vkd3d-shader: Fix immediate constant buffers. 2017-07-18 17:32:26 +02:00
Józef Kucia 2420fdb3af libs/vkd3d-shader: Add support for vThreadGroupID register. 2017-07-18 17:32:26 +02:00
Józef Kucia 79e61d95df libs/vkd3d-shader: Fix shader input register mask handling. 2017-07-18 17:32:26 +02:00
Józef Kucia 78a085199f libs/vkd3d-shader: Use vkd3d_get_spirv_builtin() directly. 2017-07-18 17:32:26 +02:00
Józef Kucia 9d944ad96c libs/vkd3d-shader: Store info about SPIR-V built-ins in table. 2017-07-18 17:32:26 +02:00
Józef Kucia e5a4ad3385 libs/vkd3d-shader: Add support for vThreadIDInGroupFlattened register. 2017-07-18 17:32:26 +02:00
Józef Kucia caa1f4a37a libs/vkd3d-shader: Allow compute shader registers as source operands. 2017-07-18 17:32:26 +02:00
Józef Kucia 9d319bbc3d libs/vkd3d-shader: Translate swapc instructions. 2017-07-18 13:31:46 +02:00
Józef Kucia 3407702d60 libs/vkd3d-shader: Avoid duplicated OpTypeImage instructions. 2017-07-17 18:12:02 +02:00
Józef Kucia 758247de4d libs/vkd3d-shader: Avoid duplicated OpTypeSampledImage instructions. 2017-07-17 18:12:02 +02:00
Józef Kucia 42d8b97176 libs/vkd3d-shader: Avoid duplicated OpTypePointer instructions. 2017-07-17 18:12:02 +02:00
Józef Kucia e715a6d1c9 libs/vkd3d-shader: Add more general way to emit SPIR-V instructions once. 2017-07-17 18:12:02 +02:00
Józef Kucia 3dc307bfb8 libs/vkd3d-shader: Make SPIR-V builder responsible for emitting parameterless types once. 2017-07-17 18:12:02 +02:00
Józef Kucia acb683690b libs/vkd3d-shader: Make SPIR-V builder responsible for emitting OpTypeSampler once. 2017-07-17 18:12:02 +02:00
Józef Kucia cc536e72ab libs/vkd3d-shader: Translate sample instructions. 2017-07-17 16:25:29 +02:00
Józef Kucia e86f7fc82e libs/vkd3d-shader: Translate dcl_resource instructions. 2017-07-17 16:25:29 +02:00
Józef Kucia d1de972430 libs/vkd3d: Allocate Vulkan descriptors for samplers. 2017-07-17 16:25:29 +02:00
Józef Kucia 593a13402d libs/vkd3d: Add support for static samplers.
We still do not implement any reasonable mapping between D3D registers
and Vulkan bindings.
2017-07-17 16:25:29 +02:00
Józef Kucia 02506b24c4 libs/vkd3d: Partially implement d3d12_command_list_SetGraphicsRootDescriptorTable().
A very naive implementation. Mainly to unblock some shader translation
work.
2017-07-17 16:25:29 +02:00
Józef Kucia 733775fbad libs/vkd3d: Implement d3d12_descriptor_heap_GetGPUDescriptorHandleForHeapStart(). 2017-07-17 16:25:29 +02:00
Józef Kucia 091ac41f79 libs/vkd3d: Partially handle descriptor table root parameters. 2017-07-17 16:25:29 +02:00
Józef Kucia 4854b74151 libs/vkd3d-shader: Introduce vkd3d_dxbc_compiler_emit_swizzle() helper function. 2017-07-14 17:21:23 +02:00
Józef Kucia 96f5bb3936 libs/vkd3d-shader: Use vkd3d_dxbc_compiler_emit_load_src() for dot product instructions.
Fixes source modifiers for dot product instructions.
2017-07-14 17:21:23 +02:00
Józef Kucia 2dfbc88a89 libs/vkd3d: Implement copying from buffers to images. 2017-07-14 13:44:35 +02:00
Józef Kucia 7c606089f1 libs/vkd3d-shader: Add FIXME comment for local function variables. 2017-07-14 13:44:35 +02:00
Józef Kucia a47724ce3a libs/vkd3d-shader: Translate dcl_sampler instructions. 2017-07-14 13:44:35 +02:00
Józef Kucia 1c79831873 libs/vkd3d: Implement d3d12_device_CreateShaderResourceView(). 2017-07-14 13:44:35 +02:00
Józef Kucia 8bb54c17f3 libs/vkd3d: Simplify d3d12_resource_destroy(). 2017-07-14 13:44:35 +02:00
Józef Kucia f4f803c7bb libs/vkd3d: Add initial implementation for d3d12_device_GetCopyableFootprints(). 2017-07-13 11:56:30 +02:00
Józef Kucia f3d297574a libs/vkd3d: Implement d3d12_device_CreateSampler(). 2017-07-12 13:10:44 +02:00
Józef Kucia cd07a50b21 libs/vkd3d-shader: Implement relative addressing for immediate constant buffers. 2017-07-11 17:23:02 +02:00
Józef Kucia 1a8b74549a libs/vkd3d-shader: Use vkd3d_dxbc_compiler_emit_variable() in vkd3d_dxbc_compiler_emit_dcl_temps(). 2017-07-11 17:23:02 +02:00
Józef Kucia c8d713dc83 libs/vkd3d-shader: Implement immediate constant buffers. 2017-07-11 17:23:02 +02:00
Józef Kucia d8d5701409 libs/vkd3d-shader: Use appropriate message severity for invalid SPIR-V shaders. 2017-07-11 17:23:02 +02:00
Henri Verbeet d61b6a3545 include: Add the missing "values" parameter to ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat(). 2017-07-11 12:21:15 +02:00
Henri Verbeet 99d2ba411e include: Add the missing ClearUnorderedAccessViewUint() method to the ID3D12GraphicsCommandList interface. 2017-07-11 12:21:11 +02:00
Henri Verbeet 0b656c8354 build: Add a pkg-config file for libvkd3d-utils. 2017-07-10 16:32:01 +02:00
Józef Kucia 682e725d6e libs/vkd3d-shader: Add support for multiple shader outputs packed into single register. 2017-07-10 15:33:34 +02:00
Józef Kucia 7f1242888e libs/vkd3d-shader: Recognize vThreadIDInGroup register. 2017-07-10 15:33:34 +02:00
Józef Kucia 2e6f80e24c libs/vkd3d-shader: Pass buffer size to vkd3d_dxbc_compiler_get_register_name(). 2017-07-10 15:33:34 +02:00
Józef Kucia 649a814b23 libs/vkd3d-shader: Use ERR() instead of FIXME() in vkd3d_dxbc_compiler_emit_ext_glsl_instruction().
vkd3d_dxbc_compiler_emit_ext_glsl_instruction() is called only for
implemented instructions.
2017-07-10 15:33:34 +02:00
Józef Kucia 4c448f0a35 libs/vkd3d-shader: Recognize vThreadID register. 2017-07-10 15:33:34 +02:00
Józef Kucia bf3896adc4 libs/vkd3d-shader: Decorate shader inputs with Component decoration.
Needed when multiple inputs are stored in a single register.
2017-07-10 15:33:34 +02:00
Józef Kucia c6b6a9d542 libs/vkd3d-shader: Add support for multiple shader inputs packed into single register. 2017-07-10 15:33:34 +02:00
Józef Kucia 3f546c8782 libs/vkd3d: Add DXGI_FORMAT_R32_UINT. 2017-07-10 15:33:34 +02:00
Józef Kucia f5319efa4b libs/vkd3d-shader: Translate f32tof16 instruction. 2017-07-06 18:11:57 +02:00
Józef Kucia 83392c92a3 libs/vkd3d-shader: Translate f16tof32 instruction. 2017-07-06 18:11:57 +02:00
Józef Kucia 03ab3d25bc libs/vkd3d-shader: Upgrade FIXME() to ERR() in vkd3d_dxbc_compiler_emit_alu_instruction().
vkd3d_dxbc_compiler_emit_alu_instruction() is called only for
implemented instructions.
2017-07-06 18:11:57 +02:00
Józef Kucia 24134b20fd libs/vkd3d-shader: Translate xor, or and not instructions. 2017-07-06 18:11:57 +02:00
Józef Kucia cb125d0020 libs/vkd3d-shader: Fix swizzling for non floating-point result values.
Avoids incorrect bitcasts.
2017-07-06 18:11:57 +02:00
Józef Kucia fe522495aa libs/vkd3d-shader: Get rid of needless temporary variables. 2017-07-06 10:12:22 +02:00
Józef Kucia f906df13b3 libs/vkd3d-shader: Implement parsing of root signature static samplers. 2017-07-06 10:12:22 +02:00
Józef Kucia 0633cfc55d libs/vkd3d-shader: Implement "absneg" source modifiers. 2017-06-29 13:40:27 +02:00
Józef Kucia 70f5b24f92 libs/vkd3d-shader: Avoid using GLSL.std450 NMin, NMax and NClamp opcodes.
These opcodes were implemented by Mesa just few days ago. In addition
using these opcodes in a shader leads to a crash on Nvidia.

In practice this change doesn't seem to make a difference. We still want
to use NMin, NMax and NClamp for correctness. This commit is meant to be
reverted when problems with these opcodes are resolved.
2017-06-29 13:40:27 +02:00
Józef Kucia c9b271f3c7 libs/vkd3d-shader: Implement _sat destination modifier. 2017-06-29 13:40:27 +02:00
Józef Kucia cd1f9118ee libs/vkd3d-shader: Translate floating-point min/max instructions to NMin/NMax.
The semantics of NMin and NMax match special handling required for NaN.
2017-06-29 13:40:27 +02:00
Józef Kucia f8b25dcea4 libs/vkd3d-shader: Implement "neg" modifier for integers. 2017-06-29 09:02:50 +02:00
Józef Kucia 169b1e7885 libs/vkd3d-shader: Translate movc instruction. 2017-06-29 09:02:50 +02:00
Józef Kucia 0ef0b54eed libs/vkd3d-shader: Translate SM5 bit instructions. 2017-06-29 09:02:50 +02:00
Józef Kucia b2f8454a0f libs/vkd3d-shader: Translate ishl instruction. 2017-06-29 09:02:50 +02:00
Józef Kucia 1e7fc384fc libs/vkd3d-shader: Translate ishr instruction. 2017-06-29 09:02:50 +02:00
Józef Kucia 4de9405a7b libs/vkd3d-shader: Allow input declarations with no write mask. 2017-06-29 09:02:50 +02:00
Józef Kucia c708c56d7b libs/vkd3d-shader: Translate ushr instruction. 2017-06-28 12:28:09 +02:00
Józef Kucia 32cc44150d libs/vkd3d-shader: Translate bitfield instructions. 2017-06-28 12:28:09 +02:00
Józef Kucia dffa2ad80f libs/vkd3d-shader: Use signed integer format when masking bitfield instruction operands.
This shouldn't be strictly needed, but it fixes bfi on Nvidia.
2017-06-28 12:28:09 +02:00
Józef Kucia 2c139bdf81 libs/vkd3d-shader: Mask immediate constant operands for bitfield instructions. 2017-06-28 12:28:09 +02:00
Józef Kucia e623583048 libs/vkd3d-shader: Translate value preserving conversion instructions. 2017-06-28 12:28:09 +02:00
Józef Kucia 7e71b86031 libs/vkd3d-shader: Track current block for control flow instructions. 2017-06-28 12:28:09 +02:00
Józef Kucia 170168c9cb libs/vkd3d-shader: Implement more floating-point comparison instructions. 2017-06-28 12:28:09 +02:00
Józef Kucia 3190fbffb7 libs/vkd3d-shader: Translate iadd instruction. 2017-06-27 22:21:43 +02:00
Józef Kucia 6eb2d9cee4 libs/vkd3d-shader: Translate ieq instruction. 2017-06-27 22:21:43 +02:00
Józef Kucia 6fa98eb77c libs/vkd3d-shader: Implement absolute value source modifier. 2017-06-27 22:21:43 +02:00
Józef Kucia 30018181e0 libs/vkd3d-shader: Translate sqrt instruction. 2017-06-27 22:21:43 +02:00
Józef Kucia 8f6af1125d libs/vkd3d-shader: Get rid of VKD3D_SHADER_FLIP_Y compiler option.
We use negative viewport height to flip Y.
2017-06-27 22:21:43 +02:00
Józef Kucia 0afe0032b0 libs/vkd3d-shader: Add VKD3D_SHADER_STRIP_DEBUG compiler option. 2017-06-27 22:21:43 +02:00
Józef Kucia dbfa823b42 libs/vkd3d-shader: Translate min/max instructions. 2017-06-27 22:21:43 +02:00
Józef Kucia 3f03cd1ec8 libs/vkd3d-shader: Implement root signature parsing. 2017-06-27 13:16:47 +02:00
Józef Kucia d220ae4bfb libs/vkd3d: Add ID3D12RootSignatureDeserializer interface stub. 2017-06-27 13:16:47 +02:00
Józef Kucia d998cb88c5 libs/vkd3d-shader: Implement constant interpolation mode.
For gears demo.
2017-06-27 13:16:47 +02:00
Józef Kucia 00b1a83ef5 libs/vkd3d-shader: Translate if/else/endif instructions. 2017-06-26 17:03:31 +02:00
Józef Kucia 7f4f305225 libs/vkd3d-shader: Introduce vkd3d_spirv_alloc_id() helper function. 2017-06-26 17:03:31 +02:00
Józef Kucia 77b3c5858f libs/vkd3d-shader: Pass format string to vkd3d_spirv_build_op_name(). 2017-06-26 17:03:31 +02:00
Józef Kucia cb79f2ec65 libs/vkd3d-shader: Implement floating-point comparison instructions. 2017-06-26 17:03:31 +02:00