libs/vkd3d: Drop support for SPIR-V shaders.

This commit is contained in:
Józef Kucia 2017-09-07 17:15:53 +02:00
parent 495bd6fddc
commit f587670445

View File

@ -19,8 +19,6 @@
#include "vkd3d_private.h"
#include "spirv/1.0/spirv.h"
/* ID3D12RootSignature */
static inline struct d3d12_root_signature *impl_from_ID3D12RootSignature(ID3D12RootSignature *iface)
{
@ -1140,16 +1138,13 @@ struct d3d12_pipeline_state *unsafe_impl_from_ID3D12PipelineState(ID3D12Pipeline
return impl_from_ID3D12PipelineState(iface);
}
static bool d3d12_shader_bytecode_is_spirv(const D3D12_SHADER_BYTECODE *code)
{
return *(uint32_t *)code->pShaderBytecode == SpvMagicNumber;
}
static HRESULT create_shader_stage(struct d3d12_device *device,
struct VkPipelineShaderStageCreateInfo *stage_desc, enum VkShaderStageFlagBits stage,
const D3D12_SHADER_BYTECODE *code, struct d3d12_root_signature *root_signature)
{
struct vkd3d_shader_code dxbc = {code->pShaderBytecode, code->BytecodeLength};
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
struct vkd3d_shader_interface shader_interface;
struct VkShaderModuleCreateInfo shader_desc;
struct vkd3d_shader_code spirv = {};
VkResult vr;
@ -1166,29 +1161,18 @@ static HRESULT create_shader_stage(struct d3d12_device *device,
shader_desc.pNext = NULL;
shader_desc.flags = 0;
if (d3d12_shader_bytecode_is_spirv(code))
shader_interface.bindings = root_signature->descriptor_mapping;
shader_interface.binding_count = root_signature->descriptor_count;
shader_interface.push_constants = root_signature->push_constants;
shader_interface.push_constant_count = root_signature->constant_count;
shader_interface.default_sampler = root_signature->default_sampler;
if (FAILED(hr = vkd3d_shader_compile_dxbc(&dxbc, &spirv, 0, &shader_interface)))
{
shader_desc.codeSize = code->BytecodeLength;
shader_desc.pCode = code->pShaderBytecode;
}
else
{
struct vkd3d_shader_code dxbc = {code->pShaderBytecode, code->BytecodeLength};
struct vkd3d_shader_interface shader_interface;
shader_interface.bindings = root_signature->descriptor_mapping;
shader_interface.binding_count = root_signature->descriptor_count;
shader_interface.push_constants = root_signature->push_constants;
shader_interface.push_constant_count = root_signature->constant_count;
shader_interface.default_sampler = root_signature->default_sampler;
if (FAILED(hr = vkd3d_shader_compile_dxbc(&dxbc, &spirv, 0, &shader_interface)))
{
WARN("Failed to compile shader, hr %#x.\n", hr);
return hr;
}
shader_desc.codeSize = spirv.size;
shader_desc.pCode = spirv.code;
WARN("Failed to compile shader, hr %#x.\n", hr);
return hr;
}
shader_desc.codeSize = spirv.size;
shader_desc.pCode = spirv.code;
vr = VK_CALL(vkCreateShaderModule(device->vk_device, &shader_desc, NULL, &stage_desc->module));
vkd3d_shader_free_shader_code(&spirv);