Clear image update

This commit is contained in:
Dzmitry Malyshau 2018-05-12 21:17:49 -04:00
parent 4e77dbd702
commit 52dcdd097b
6 changed files with 71 additions and 34 deletions

8
Cargo.lock generated
View file

@ -252,7 +252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gfx-backend-dx12"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#10f87e31670448b63a9449b83cddae250af66370"
source = "git+https://github.com/gfx-rs/gfx#f10a8fb4eda0e899a9e3e35777ebf0517b0fc77d"
dependencies = [
"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)",
@ -268,7 +268,7 @@ dependencies = [
[[package]]
name = "gfx-backend-metal"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#10f87e31670448b63a9449b83cddae250af66370"
source = "git+https://github.com/gfx-rs/gfx#f10a8fb4eda0e899a9e3e35777ebf0517b0fc77d"
dependencies = [
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -288,7 +288,7 @@ dependencies = [
[[package]]
name = "gfx-backend-vulkan"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#10f87e31670448b63a9449b83cddae250af66370"
source = "git+https://github.com/gfx-rs/gfx#f10a8fb4eda0e899a9e3e35777ebf0517b0fc77d"
dependencies = [
"ash 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -306,7 +306,7 @@ dependencies = [
[[package]]
name = "gfx-hal"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#10f87e31670448b63a9449b83cddae250af66370"
source = "git+https://github.com/gfx-rs/gfx#f10a8fb4eda0e899a9e3e35777ebf0517b0fc77d"
dependencies = [
"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)",

View file

@ -91,12 +91,12 @@ cts-pick: $(TARGET)
($(DEQP) -n $(name))
cts-debug: $(TARGET)
(cd $(DEQP_DIR) && $(DEBUGGER) ./deqp-vk -n $(name))
#(cd $(DEQP_DIR) && LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) ./deqp-vk -n $(name))
LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) $(DEBUGGER) $(DEQP_DIR)/deqp-vk -n $(name)
clean:
rm -f $(OBJECTS) $(TARGET) $(BINDING)
cargo clean
cherry:
cd $(CHERRY_DIR)
LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go
cherry: $(TARGET)
cd $(CHERRY_DIR) && RUST_LOG=warn LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go

View file

@ -40,4 +40,5 @@ optional = true
[target.'cfg(target_os = "macos")'.dependencies.gfx-backend-metal]
git = "https://github.com/gfx-rs/gfx"
#path = "../../gfx/src/backend/metal"
features = ["metal_default_capture_scope"]
optional = true

View file

@ -170,9 +170,17 @@ pub fn map_subresource_range(subresource: VkImageSubresourceRange) -> image::Sub
image::SubresourceRange {
aspects: map_aspect(subresource.aspectMask),
levels: subresource.baseMipLevel as _
..(subresource.baseMipLevel + subresource.levelCount) as _,
.. if subresource.levelCount as i32 == VK_REMAINING_MIP_LEVELS {
!0
} else {
(subresource.baseMipLevel + subresource.levelCount) as _
},
layers: subresource.baseArrayLayer as _
..(subresource.baseArrayLayer + subresource.layerCount) as _,
.. if subresource.layerCount as i32 == VK_REMAINING_ARRAY_LAYERS {
!0
} else {
(subresource.baseArrayLayer + subresource.layerCount) as _
},
}
}

View file

@ -37,13 +37,6 @@ pub extern "C" fn gfxCreateInstance(
_pAllocator: *const VkAllocationCallbacks,
pInstance: *mut VkInstance,
) -> VkResult {
// Note: is this the best place to enable logging?
#[cfg(feature = "env_logger")]
{
use env_logger;
env_logger::init();
}
let backend = back::Instance::create("portability", 1);
let adapters = backend
.enumerate_adapters()
@ -1756,8 +1749,9 @@ pub extern "C" fn gfxCreateGraphicsPipelines(
depth_bounds: if dyn_states.iter().any(|&ds| ds == VkDynamicState::VK_DYNAMIC_STATE_DEPTH_BOUNDS) {
None
} else {
None // TODO
}
unsafe { info.pDepthStencilState.as_ref() }
.map(|db| db.minDepthBounds .. db.maxDepthBounds)
},
};
let layout = &*info.layout;
@ -3126,25 +3120,55 @@ pub extern "C" fn gfxCmdFillBuffer(
}
#[inline]
pub extern "C" fn gfxCmdClearColorImage(
_commandBuffer: VkCommandBuffer,
_image: VkImage,
_imageLayout: VkImageLayout,
_pColor: *const VkClearColorValue,
_rangeCount: u32,
_pRanges: *const VkImageSubresourceRange,
mut commandBuffer: VkCommandBuffer,
image: VkImage,
imageLayout: VkImageLayout,
pColor: *const VkClearColorValue,
rangeCount: u32,
pRanges: *const VkImageSubresourceRange,
) {
unimplemented!()
let subresource_ranges = unsafe {
slice::from_raw_parts(pRanges, rangeCount as _)
};
commandBuffer.clear_image(
match *image {
Image::Image(ref image) => image,
Image::Unbound(_) => panic!("Bound image expected!"),
},
conv::map_image_layout(imageLayout),
unsafe { mem::transmute(*pColor) },
unsafe { mem::zeroed() },
subresource_ranges
.iter()
.cloned()
.map(conv::map_subresource_range),
);
}
#[inline]
pub extern "C" fn gfxCmdClearDepthStencilImage(
_commandBuffer: VkCommandBuffer,
_image: VkImage,
_imageLayout: VkImageLayout,
_pDepthStencil: *const VkClearDepthStencilValue,
_rangeCount: u32,
_pRanges: *const VkImageSubresourceRange,
mut commandBuffer: VkCommandBuffer,
image: VkImage,
imageLayout: VkImageLayout,
pDepthStencil: *const VkClearDepthStencilValue,
rangeCount: u32,
pRanges: *const VkImageSubresourceRange,
) {
unimplemented!()
let subresource_ranges = unsafe {
slice::from_raw_parts(pRanges, rangeCount as _)
};
commandBuffer.clear_image(
match *image {
Image::Image(ref image) => image,
Image::Unbound(_) => panic!("Bound image expected!"),
},
conv::map_image_layout(imageLayout),
unsafe { mem::zeroed() },
unsafe { mem::transmute(*pDepthStencil) },
subresource_ranges
.iter()
.cloned()
.map(conv::map_subresource_range),
);
}
#[inline]
pub extern "C" fn gfxCmdClearAttachments(
@ -3398,7 +3422,7 @@ pub extern "C" fn gfxCmdBeginRenderPass(
};
let contents = conv::map_subpass_contents(contents);
commandBuffer.begin_render_pass_raw(
commandBuffer.begin_render_pass(
&*info.renderPass,
&*info.framebuffer,
render_area,

View file

@ -31,6 +31,10 @@ use std::collections::HashMap;
pub use impls::*;
#[cfg(feature = "env_logger")]
lazy_static! {
static ref _LOGGER: () = env_logger::init();
}
// Vulkan objects
pub type VkInstance = Handle<RawInstance>;