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);
function_call_operands.push(Operand::IdRef(op_access_chain_sampler)); function_call_operands.push(Operand::IdRef(op_access_chain_sampler));
let original_type = self let Some(original_type) =
.find_global_instruction(original_result_type) self.find_global_instruction(original_result_type).cloned()
.cloned() else {
.expect("huh"); continue;
};
let sampled_image = CombinedImageSampler { let sampled_image = CombinedImageSampler {
sampler_variable: op_access_chain_sampler, sampler_variable: op_access_chain_sampler,

View file

@ -489,7 +489,8 @@ impl FilterChainD3D12 {
.into(); .into();
// incredibly cursed. // 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, device,
library, library,
validator, validator,
@ -497,7 +498,8 @@ impl FilterChainD3D12 {
root_signature, root_signature,
render_format, render_format,
disable_cache, disable_cache,
) && !force_hlsl { ) && !force_hlsl
{
(dxil_reflection, graphics_pipeline) (dxil_reflection, graphics_pipeline)
} else { } else {
let hlsl_reflection = hlsl.reflect(index, semantics)?; let hlsl_reflection = hlsl.reflect(index, semantics)?;

View file

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

View file

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

View file

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