d3d11: fix unsoundness in hello triangle
This commit is contained in:
parent
a4a7dca208
commit
98bfb77232
|
@ -128,11 +128,11 @@ where
|
||||||
None, // no parent window
|
None, // no parent window
|
||||||
None, // no menus
|
None, // no menus
|
||||||
instance,
|
instance,
|
||||||
Some(&mut sample as *mut _ as _),
|
Some(&sample as *const _ as _),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
sample.bind_to_window(&hwnd)?;
|
sample.bind_to_window(&hwnd).unwrap();
|
||||||
unsafe { ShowWindow(hwnd, SW_SHOW) };
|
unsafe { ShowWindow(hwnd, SW_SHOW) };
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -285,10 +285,10 @@ pub mod d3d11_hello_triangle {
|
||||||
let (rtv, backbuffer) = create_rtv(&self.device, &swapchain)?;
|
let (rtv, backbuffer) = create_rtv(&self.device, &swapchain)?;
|
||||||
let (depth_buffer, depth_stencil_view) = create_depth_buffer(&self.device)?;
|
let (depth_buffer, depth_stencil_view) = create_depth_buffer(&self.device)?;
|
||||||
let (triangle_vbo, triangle_indices) = create_triangle_buffers(&self.device)?;
|
let (triangle_vbo, triangle_indices) = create_triangle_buffers(&self.device)?;
|
||||||
let triangle_uniforms = create_triangle_uniforms(&self.device)?;
|
let triangle_uniforms = create_triangle_uniforms(&self.device).unwrap();
|
||||||
|
|
||||||
let vs_blob = compile_shader(VERTEX_SHADER, b"main\0", b"vs_5_0")?;
|
let vs_blob = compile_shader(VERTEX_SHADER, b"main\0", b"vs_5_0\0")?;
|
||||||
let ps_blob = compile_shader(PIXEL_SHADER, b"main\0", b"ps_5_0")?;
|
let ps_blob = compile_shader(PIXEL_SHADER, b"main\0", b"ps_5_0\0")?;
|
||||||
|
|
||||||
let vs_compiled = unsafe {
|
let vs_compiled = unsafe {
|
||||||
// SAFETY: slice as valid for as long as vs_blob is alive.
|
// SAFETY: slice as valid for as long as vs_blob is alive.
|
||||||
|
|
|
@ -30,6 +30,7 @@ mod tests {
|
||||||
fn triangle_d3d11() {
|
fn triangle_d3d11() {
|
||||||
let sample = hello_triangle::d3d11_hello_triangle::Sample::new(
|
let sample = hello_triangle::d3d11_hello_triangle::Sample::new(
|
||||||
"../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
"../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||||
|
// "../test/basic.slangp",
|
||||||
Some(&FilterChainOptionsD3D11 {
|
Some(&FilterChainOptionsD3D11 {
|
||||||
use_deferred_context: false,
|
use_deferred_context: false,
|
||||||
force_no_mipmaps: false,
|
force_no_mipmaps: false,
|
||||||
|
|
Loading…
Reference in a new issue