Cleaner destruction of events and query pools

This commit is contained in:
Dzmitry Malyshau 2018-06-05 12:57:17 -04:00
parent d473e1d352
commit 6e0ce965bf
4 changed files with 21 additions and 15 deletions

8
Cargo.lock generated
View file

@ -252,7 +252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#91ec6303fded63498b01e4a55e8ebe6768d3c2cc" source = "git+https://github.com/gfx-rs/gfx#505e8057803d8cc0302b5fdcfe7ae807b8f3b8cf"
dependencies = [ dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -268,7 +268,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#91ec6303fded63498b01e4a55e8ebe6768d3c2cc" source = "git+https://github.com/gfx-rs/gfx#505e8057803d8cc0302b5fdcfe7ae807b8f3b8cf"
dependencies = [ dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -290,7 +290,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#91ec6303fded63498b01e4a55e8ebe6768d3c2cc" source = "git+https://github.com/gfx-rs/gfx#505e8057803d8cc0302b5fdcfe7ae807b8f3b8cf"
dependencies = [ dependencies = [
"ash 0.24.3 (registry+https://github.com/rust-lang/crates.io-index)", "ash 0.24.3 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -308,7 +308,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#91ec6303fded63498b01e4a55e8ebe6768d3c2cc" source = "git+https://github.com/gfx-rs/gfx#505e8057803d8cc0302b5fdcfe7ae807b8f3b8cf"
dependencies = [ dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -104,4 +104,4 @@ clean:
cargo clean cargo clean
cherry: $(TARGET) cherry: $(TARGET)
cd $(CHERRY_DIR) && RUST_LOG=warn LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go cd $(CHERRY_DIR) && rm -f Cherry.db && RUST_LOG=warn LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go

View file

@ -12,6 +12,8 @@ pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
maxImageDimension2D: limits.max_texture_size as _, maxImageDimension2D: limits.max_texture_size as _,
maxImageDimension3D: limits.max_texture_size as _, maxImageDimension3D: limits.max_texture_size as _,
maxImageDimensionCube: limits.max_texture_size as _, maxImageDimensionCube: limits.max_texture_size as _,
maxFramebufferWidth: limits.max_texture_size as _, //TODO
maxFramebufferHeight: limits.max_texture_size as _, //TODO
maxTexelBufferElements: limits.max_texture_size as _, //TODO maxTexelBufferElements: limits.max_texture_size as _, //TODO
maxTessellationPatchSize: limits.max_patch_size as _, maxTessellationPatchSize: limits.max_patch_size as _,
maxViewports: limits.max_viewports as _, maxViewports: limits.max_viewports as _,

View file

@ -10,9 +10,7 @@ use hal::command::RawCommandBuffer;
use hal::queue::RawCommandQueue; use hal::queue::RawCommandQueue;
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
use std::mem; use std::{mem, ptr};
#[cfg(feature = "renderdoc")]
use std::ptr;
#[cfg(feature = "renderdoc")] #[cfg(feature = "renderdoc")]
use std::os::raw::c_void; use std::os::raw::c_void;
@ -596,11 +594,12 @@ pub extern "C" fn gfxCreateDevice(
#[inline] #[inline]
pub extern "C" fn gfxDestroyDevice(gpu: VkDevice, _pAllocator: *const VkAllocationCallbacks) { pub extern "C" fn gfxDestroyDevice(gpu: VkDevice, _pAllocator: *const VkAllocationCallbacks) {
// release all the owned command queues // release all the owned command queues
if let Some(mut d) = gpu.unbox() { if let Some(d) = gpu.unbox() {
#[cfg(feature = "renderdoc")] #[cfg(feature = "renderdoc")]
{ {
use renderdoc::api::RenderDocV100; use renderdoc::api::RenderDocV100;
let device = gpu.capturing as *mut c_void; let device = gpu.capturing as *mut c_void;
let mut d = d;
d.renderdoc.end_frame_capture(device as *mut _, ptr::null()); d.renderdoc.end_frame_capture(device as *mut _, ptr::null());
} }
@ -1142,10 +1141,12 @@ pub extern "C" fn gfxCreateEvent(
#[inline] #[inline]
pub extern "C" fn gfxDestroyEvent( pub extern "C" fn gfxDestroyEvent(
_gpu: VkDevice, _gpu: VkDevice,
_event: VkEvent, event: VkEvent,
_pAllocator: *const VkAllocationCallbacks, _pAllocator: *const VkAllocationCallbacks,
) { ) {
if event != ptr::null_mut() {
unimplemented!() unimplemented!()
}
} }
#[inline] #[inline]
pub extern "C" fn gfxGetEventStatus(_gpu: VkDevice, _event: VkEvent) -> VkResult { pub extern "C" fn gfxGetEventStatus(_gpu: VkDevice, _event: VkEvent) -> VkResult {
@ -1172,10 +1173,12 @@ pub extern "C" fn gfxCreateQueryPool(
#[inline] #[inline]
pub extern "C" fn gfxDestroyQueryPool( pub extern "C" fn gfxDestroyQueryPool(
_gpu: VkDevice, _gpu: VkDevice,
_queryPool: VkQueryPool, queryPool: VkQueryPool,
_pAllocator: *const VkAllocationCallbacks, _pAllocator: *const VkAllocationCallbacks,
) { ) {
if queryPool != ptr::null_mut() {
unimplemented!() unimplemented!()
}
} }
#[inline] #[inline]
pub extern "C" fn gfxGetQueryPoolResults( pub extern "C" fn gfxGetQueryPoolResults(
@ -2540,9 +2543,10 @@ pub extern "C" fn gfxDestroyRenderPass(
pub extern "C" fn gfxGetRenderAreaGranularity( pub extern "C" fn gfxGetRenderAreaGranularity(
_gpu: VkDevice, _gpu: VkDevice,
_renderPass: VkRenderPass, _renderPass: VkRenderPass,
_pGranularity: *mut VkExtent2D, pGranularity: *mut VkExtent2D,
) { ) {
unimplemented!() let granularity = VkExtent2D { width: 1, height: 1 }; //TODO?
unsafe { *pGranularity = granularity };
} }
#[inline] #[inline]