fmt: cargo fmt

This commit is contained in:
chyyran 2024-02-19 12:39:44 -05:00
parent d60ff76fb2
commit 7ef3780222
6 changed files with 49 additions and 35 deletions

View file

@ -818,10 +818,11 @@ impl<'a> LowerCombinedImageSamplerPass<'a> {
function_call_operands.push(operand);
function_call_operands.push(Operand::IdRef(op_access_chain_sampler));
let original_type = self
.find_global_instruction(original_result_type)
.cloned()
.expect("huh");
let Some(original_type) =
self.find_global_instruction(original_result_type).cloned()
else {
continue;
};
let sampled_image = CombinedImageSampler {
sampler_variable: op_access_chain_sampler,

View file

@ -489,7 +489,8 @@ impl FilterChainD3D12 {
.into();
// incredibly cursed.
let (reflection, graphics_pipeline) = if let Ok(graphics_pipeline) = D3D12GraphicsPipeline::new_from_dxil(
let (reflection, graphics_pipeline) =
if let Ok(graphics_pipeline) = D3D12GraphicsPipeline::new_from_dxil(
device,
library,
validator,
@ -497,25 +498,26 @@ impl FilterChainD3D12 {
root_signature,
render_format,
disable_cache,
) && !force_hlsl {
(dxil_reflection, graphics_pipeline)
} else {
let hlsl_reflection = hlsl.reflect(index, semantics)?;
let hlsl = hlsl.compile(Some(
librashader_reflect::back::hlsl::HlslShaderModel::V6_0,
))?;
) && !force_hlsl
{
(dxil_reflection, graphics_pipeline)
} else {
let hlsl_reflection = hlsl.reflect(index, semantics)?;
let hlsl = hlsl.compile(Some(
librashader_reflect::back::hlsl::HlslShaderModel::V6_0,
))?;
let graphics_pipeline = D3D12GraphicsPipeline::new_from_hlsl(
device,
library,
compiler,
&hlsl,
root_signature,
render_format,
disable_cache,
)?;
(hlsl_reflection, graphics_pipeline)
};
let graphics_pipeline = D3D12GraphicsPipeline::new_from_hlsl(
device,
library,
compiler,
&hlsl,
root_signature,
render_format,
disable_cache,
)?;
(hlsl_reflection, graphics_pipeline)
};
// minimum size here has to be 1 byte.
let ubo_size = reflection.ubo.as_ref().map_or(1, |ubo| ubo.size as usize);

View file

@ -6,7 +6,9 @@ use librashader_common::Size;
use librashader_runtime::scaling::MipmapSize;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use windows::Win32::Graphics::Direct3D::Dxc::{CLSID_DxcLibrary, CLSID_DxcValidator, DxcCreateInstance};
use windows::Win32::Graphics::Direct3D::Dxc::{
CLSID_DxcLibrary, CLSID_DxcValidator, DxcCreateInstance,
};
use windows::Win32::Graphics::Direct3D12::{
ID3D12DescriptorHeap, ID3D12Device, ID3D12GraphicsCommandList, ID3D12PipelineState,
ID3D12Resource, ID3D12RootSignature, D3D12_COMPUTE_PIPELINE_STATE_DESC,
@ -94,8 +96,7 @@ impl D3D12MipmapGen {
let library = DxcCreateInstance(&CLSID_DxcLibrary)?;
let validator = DxcCreateInstance(&CLSID_DxcValidator)?;
let blob =
dxc_validate_shader(&library, &validator, GENERATE_MIPMAPS_CS)?;
let blob = dxc_validate_shader(&library, &validator, GENERATE_MIPMAPS_CS)?;
let blob =
std::slice::from_raw_parts(blob.GetBufferPointer().cast(), blob.GetBufferSize());

View file

@ -155,7 +155,10 @@ pub fn dxc_compile_shader(
let result = result.GetResult()?;
{
let blob = std::slice::from_raw_parts_mut(result.GetBufferPointer() as *mut u8, result.GetBufferSize());
let blob = std::slice::from_raw_parts_mut(
result.GetBufferPointer() as *mut u8,
result.GetBufferSize(),
);
mach_siegbert_vogt_dxcsa::sign_in_place(blob);
}

View file

@ -289,13 +289,21 @@ pub mod d3d12_hello_triangle {
}
}
let filter =
unsafe { FilterChainD3D12::load_from_path(filter, &device, Some(&librashader_runtime_d3d12::options::FilterChainOptionsD3D12 {
disable_cache: true,
force_hlsl_pipeline: false,
force_no_mipmaps: false,
..Default::default()
})).unwrap() };
let filter = unsafe {
FilterChainD3D12::load_from_path(
filter,
&device,
Some(
&librashader_runtime_d3d12::options::FilterChainOptionsD3D12 {
disable_cache: true,
force_hlsl_pipeline: false,
force_no_mipmaps: false,
..Default::default()
},
),
)
.unwrap()
};
Ok(Sample {
dxgi_factory,

View file

@ -6,7 +6,6 @@ use crate::hello_triangle::{DXSample, SampleCommandLine};
fn triangle_d3d12() {
let sample = hello_triangle::d3d12_hello_triangle::Sample::new(
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
// "../test/shaders_slang/crt/crt-lottes.slangp",
// "../test/basic.slangp",
// "../test/shaders_slang/handheld/console-border/gbc-lcd-grid-v2.slangp",