Implement vkCreateShaderModule and vkDestroyShaderModule

This commit is contained in:
msiglreith 2018-01-07 16:16:22 +01:00
parent a3a7f1f552
commit fb6d185e5f
2 changed files with 20 additions and 12 deletions

View file

@ -790,20 +790,33 @@ pub extern "C" fn gfxDestroyImageView(
}
#[inline]
pub extern "C" fn gfxCreateShaderModule(
device: VkDevice,
gpu: VkDevice,
pCreateInfo: *const VkShaderModuleCreateInfo,
pAllocator: *const VkAllocationCallbacks,
_pAllocator: *const VkAllocationCallbacks,
pShaderModule: *mut VkShaderModule,
) -> VkResult {
unimplemented!()
let info = unsafe { &*pCreateInfo };
let code = unsafe {
slice::from_raw_parts(info.pCode as *const u8, info.codeSize as usize)
};
let shader_module = gpu
.device
.create_shader_module(code)
.expect("Error creating shader module"); // TODO
unsafe {
*pShaderModule = Handle::new(shader_module);
}
VkResult::VK_SUCCESS
}
#[inline]
pub extern "C" fn gfxDestroyShaderModule(
device: VkDevice,
gpu: VkDevice,
shaderModule: VkShaderModule,
pAllocator: *const VkAllocationCallbacks,
_pAllocator: *const VkAllocationCallbacks,
) {
unimplemented!()
gpu.device.destroy_shader_module(*shaderModule.unwrap());
}
#[inline]
pub extern "C" fn gfxCreatePipelineCache(

View file

@ -35,6 +35,7 @@ pub type VkDescriptorPool = Handle<<B as hal::Backend>::DescriptorPool>;
pub type VkDescriptorSet = Handle<<B as hal::Backend>::DescriptorSet>;
pub type VkSampler = Handle<<B as hal::Backend>::Sampler>;
pub type VkBufferView = Handle<<B as hal::Backend>::BufferView>;
pub type VkShaderModule = Handle<<B as hal::Backend>::ShaderModule>;
pub enum Image<B: hal::Backend> {
Image(B::Image),
@ -540,12 +541,6 @@ pub struct VkQueryPool_T {
pub type VkQueryPool = *mut VkQueryPool_T;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct VkShaderModule_T {
_unused: [u8; 0],
}
pub type VkShaderModule = *mut VkShaderModule_T;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct VkPipelineCache_T {
_unused: [u8; 0],
}