mirror of
https://github.com/italicsjenga/portability.git
synced 2025-02-17 06:37:43 +11:00
Multisampling support
This commit is contained in:
parent
cc049bbb7c
commit
545f3bb0f0
1 changed files with 25 additions and 10 deletions
|
@ -1523,12 +1523,12 @@ pub extern "C" fn gfxCreateGraphicsPipelines(
|
||||||
set
|
set
|
||||||
};
|
};
|
||||||
|
|
||||||
let rasterizer = {
|
let (rasterizer, rasterizer_discard) = {
|
||||||
let state = unsafe { &*info.pRasterizationState };
|
let state = unsafe { &*info.pRasterizationState };
|
||||||
|
|
||||||
assert_eq!(state.rasterizerDiscardEnable, VK_FALSE); // TODO
|
assert_eq!(state.rasterizerDiscardEnable, VK_FALSE); // TODO
|
||||||
|
|
||||||
pso::Rasterizer {
|
let rasterizer = pso::Rasterizer {
|
||||||
polygon_mode: conv::map_polygon_mode(state.polygonMode, state.lineWidth),
|
polygon_mode: conv::map_polygon_mode(state.polygonMode, state.lineWidth),
|
||||||
cull_face: conv::map_cull_face(state.cullMode),
|
cull_face: conv::map_cull_face(state.cullMode),
|
||||||
front_face: conv::map_front_face(state.frontFace),
|
front_face: conv::map_front_face(state.frontFace),
|
||||||
|
@ -1543,7 +1543,9 @@ pub extern "C" fn gfxCreateGraphicsPipelines(
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
conservative: false,
|
conservative: false,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
(rasterizer, state.rasterizerDiscardEnable == VK_TRUE)
|
||||||
};
|
};
|
||||||
|
|
||||||
let (vertex_buffers, attributes) = {
|
let (vertex_buffers, attributes) = {
|
||||||
|
@ -1661,9 +1663,23 @@ pub extern "C" fn gfxCreateGraphicsPipelines(
|
||||||
blend_desc
|
blend_desc
|
||||||
};
|
};
|
||||||
|
|
||||||
if !info.pMultisampleState.is_null() {
|
let multisampling = if !rasterizer_discard && !info.pMultisampleState.is_null() {
|
||||||
warn!("Multisampling is not supported yet");
|
let multisampling = unsafe { *info.pMultisampleState };
|
||||||
}
|
|
||||||
|
Some(pso::Multisampling {
|
||||||
|
rasterization_samples: multisampling.rasterizationSamples as _,
|
||||||
|
sample_shading: if multisampling.sampleShadingEnable == VK_TRUE {
|
||||||
|
Some(multisampling.minSampleShading)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
sample_mask: !0, // TODO
|
||||||
|
alpha_coverage: multisampling.alphaToCoverageEnable == VK_TRUE,
|
||||||
|
alpha_to_one: multisampling.alphaToOneEnable == VK_TRUE,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: `pDepthStencilState` could contain garbage, but implementations
|
// TODO: `pDepthStencilState` could contain garbage, but implementations
|
||||||
// can ignore it in some circumstances. How to handle it?
|
// can ignore it in some circumstances. How to handle it?
|
||||||
|
@ -1782,6 +1798,7 @@ pub extern "C" fn gfxCreateGraphicsPipelines(
|
||||||
input_assembler,
|
input_assembler,
|
||||||
blender,
|
blender,
|
||||||
depth_stencil,
|
depth_stencil,
|
||||||
|
multisampling,
|
||||||
baked_states,
|
baked_states,
|
||||||
layout,
|
layout,
|
||||||
subpass,
|
subpass,
|
||||||
|
@ -2341,6 +2358,7 @@ pub extern "C" fn gfxCreateRenderPass(
|
||||||
|
|
||||||
pass::Attachment {
|
pass::Attachment {
|
||||||
format: conv::map_format(attachment.format),
|
format: conv::map_format(attachment.format),
|
||||||
|
samples: attachment.samples as u32 as _,
|
||||||
ops: pass::AttachmentOps {
|
ops: pass::AttachmentOps {
|
||||||
load: conv::map_attachment_load_op(attachment.loadOp),
|
load: conv::map_attachment_load_op(attachment.loadOp),
|
||||||
store: conv::map_attachment_store_op(attachment.storeOp),
|
store: conv::map_attachment_store_op(attachment.storeOp),
|
||||||
|
@ -2389,16 +2407,12 @@ pub extern "C" fn gfxCreateRenderPass(
|
||||||
let resolve = if subpass.pResolveAttachments.is_null() {
|
let resolve = if subpass.pResolveAttachments.is_null() {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
} else {
|
} else {
|
||||||
warn!("TODO: implement resolve attachments");
|
|
||||||
Vec::new()
|
|
||||||
/*
|
|
||||||
unsafe {
|
unsafe {
|
||||||
slice::from_raw_parts(subpass.pResolveAttachments, subpass.colorAttachmentCount as _)
|
slice::from_raw_parts(subpass.pResolveAttachments, subpass.colorAttachmentCount as _)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(map_attachment_ref)
|
.map(map_attachment_ref)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
let depth_stencil = unsafe {
|
let depth_stencil = unsafe {
|
||||||
subpass
|
subpass
|
||||||
|
@ -2431,6 +2445,7 @@ pub extern "C" fn gfxCreateRenderPass(
|
||||||
colors: &attachment_ref.color,
|
colors: &attachment_ref.color,
|
||||||
depth_stencil: attachment_ref.depth_stencil.as_ref(),
|
depth_stencil: attachment_ref.depth_stencil.as_ref(),
|
||||||
inputs: &attachment_ref.input,
|
inputs: &attachment_ref.input,
|
||||||
|
resolves: &attachment_ref.resolve,
|
||||||
preserves: &attachment_ref.preserve,
|
preserves: &attachment_ref.preserve,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue