libs/vkd3d: Implement d3d12_command_list_IASetVertexBuffers().

This commit is contained in:
Henri Verbeet 2016-09-28 13:20:26 +02:00
parent ce509dc70e
commit 7add62e552
3 changed files with 38 additions and 18 deletions

View File

@ -26,6 +26,18 @@ import "dxgibase.h";
#include "unknown.idl"
const UINT D3D12_DEFAULT_DEPTH_BIAS = 0;
cpp_quote("#define D3D12_DEFAULT_DEPTH_BIAS_CLAMP (0.0f)")
cpp_quote("#define D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS (0.0f)")
const UINT D3D12_DEFAULT_STENCIL_READ_MASK = 0xff;
const UINT D3D12_DEFAULT_STENCIL_WRITE_MASK = 0xff;
const UINT D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND = 0xffffffff;
cpp_quote("#define D3D12_FLOAT32_MAX (3.402823466e+38f)")
const UINT D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32;
const UINT D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff;
const UINT D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT = 8;
const UINT D3D12_TEXTURE_DATA_PITCH_ALIGNMENT = 256;
[uuid(8BA5FB08-5195-40E2-AC58-0D989C3A0102), object, local, pointer_default(unique)]
interface ID3D10Blob : IUnknown
{
@ -58,23 +70,6 @@ typedef enum D3D_FEATURE_LEVEL
D3D_FEATURE_LEVEL_12_1 = 0xc100,
} D3D_FEATURE_LEVEL;
cpp_quote("#define D3D12_FLOAT32_MAX (3.402823466e+38f)")
const UINT D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT = 8;
const UINT D3D12_DEFAULT_STENCIL_READ_MASK = 0xff;
const UINT D3D12_DEFAULT_STENCIL_WRITE_MASK = 0xff;
const UINT D3D12_DEFAULT_DEPTH_BIAS = 0;
cpp_quote("#define D3D12_DEFAULT_DEPTH_BIAS_CLAMP (0.0f)")
cpp_quote("#define D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS (0.0f)")
const UINT D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff;
const UINT D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND = 0xffffffff;
const UINT D3D12_TEXTURE_DATA_PITCH_ALIGNMENT = 256;
interface ID3D12Fence;
interface ID3D12RootSignature;
interface ID3D12Heap;

View File

@ -1422,7 +1422,30 @@ static void STDMETHODCALLTYPE d3d12_command_list_IASetIndexBuffer(ID3D12Graphics
static void STDMETHODCALLTYPE d3d12_command_list_IASetVertexBuffers(ID3D12GraphicsCommandList *iface,
UINT start_slot, UINT view_count, const D3D12_VERTEX_BUFFER_VIEW *views)
{
FIXME("iface %p, start_slot %u, view_count %u, views %p stub!\n", iface, start_slot, view_count, views);
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
VkDeviceSize offsets[ARRAY_SIZE(list->strides)];
const struct vkd3d_vk_device_procs *vk_procs;
VkBuffer buffers[ARRAY_SIZE(list->strides)];
unsigned int i;
TRACE("iface %p, start_slot %u, view_count %u, views %p.\n", iface, start_slot, view_count, views);
vk_procs = &list->device->vk_procs;
if (start_slot >= ARRAY_SIZE(list->strides) || view_count > ARRAY_SIZE(list->strides) - start_slot)
{
WARN("Invalid start slot %u / view count %u.\n", start_slot, view_count);
return;
}
for (i = 0; i < view_count; ++i)
{
offsets[i] = 0;
buffers[i] = (VkBuffer)views[i].BufferLocation;
list->strides[start_slot + i] = views[i].StrideInBytes;
}
VK_CALL(vkCmdBindVertexBuffers(list->vk_command_buffer, start_slot, view_count, buffers, offsets));
}
static void STDMETHODCALLTYPE d3d12_command_list_SOSetTargets(ID3D12GraphicsCommandList *iface,
@ -1739,6 +1762,7 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d
return hr;
}
memset(list->strides, 0, sizeof(list->strides));
list->ia_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
list->ia_desc.pNext = NULL;
list->ia_desc.flags = 0;

View File

@ -229,6 +229,7 @@ struct d3d12_command_list
VkCommandBuffer vk_command_buffer;
BOOL is_recording;
uint32_t strides[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
struct VkPipelineInputAssemblyStateCreateInfo ia_desc;
struct d3d12_command_allocator *allocator;