rt(d3d12): get rid of size in inputview
This commit is contained in:
parent
4d6793d305
commit
3cda5b706d
|
@ -26,11 +26,11 @@ pub struct libra_source_image_d3d12_t {
|
|||
pub resource: ManuallyDrop<ID3D12Resource>,
|
||||
/// A CPU descriptor handle to a shader resource view of the image.
|
||||
pub descriptor: D3D12_CPU_DESCRIPTOR_HANDLE,
|
||||
/// The format of the image.
|
||||
/// This is currently ignored.
|
||||
pub format: DXGI_FORMAT,
|
||||
/// The width of the source image.
|
||||
/// This is currently ignored.
|
||||
pub width: u32,
|
||||
/// The height of the source image.
|
||||
/// This is currently ignored.
|
||||
pub height: u32,
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,6 @@ impl TryFrom<libra_source_image_d3d12_t> for D3D12InputImage {
|
|||
Ok(D3D12InputImage {
|
||||
resource: ManuallyDrop::into_inner(resource),
|
||||
descriptor: value.descriptor,
|
||||
size: Size::new(value.width, value.height),
|
||||
format: value.format,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT;
|
|||
pub struct D3D12InputImage {
|
||||
pub resource: ID3D12Resource,
|
||||
pub descriptor: D3D12_CPU_DESCRIPTOR_HANDLE,
|
||||
pub size: Size<u32>,
|
||||
pub format: DXGI_FORMAT,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -117,11 +115,12 @@ impl InputTexture {
|
|||
filter: FilterMode,
|
||||
wrap_mode: WrapMode,
|
||||
) -> InputTexture {
|
||||
let desc = unsafe { image.resource.GetDesc() };
|
||||
InputTexture {
|
||||
resource: image.resource,
|
||||
descriptor: InputDescriptor::Raw(image.descriptor),
|
||||
size: image.size,
|
||||
format: image.format,
|
||||
size: Size::new(desc.Width as u32, desc.Height),
|
||||
format: desc.Format,
|
||||
wrap_mode,
|
||||
filter,
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use windows::Win32::Graphics::Direct3D12::{
|
|||
D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX,
|
||||
};
|
||||
use windows::Win32::Graphics::Dxgi::Common::*;
|
||||
use librashader_common::Size;
|
||||
|
||||
/// wtf retroarch?
|
||||
const DXGI_FORMAT_EX_A4R4G4B4_UNORM: DXGI_FORMAT = DXGI_FORMAT(1000);
|
||||
|
@ -387,3 +388,18 @@ unsafe fn memcpy_subresource(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub(crate) trait GetSize {
|
||||
fn size(&self) -> Size<u32>;
|
||||
}
|
||||
|
||||
impl GetSize for ID3D12Resource {
|
||||
fn size(&self) -> Size<u32> {
|
||||
let desc = unsafe {
|
||||
self.GetDesc()
|
||||
};
|
||||
|
||||
Size::new(desc.Width as u32, desc.Height)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -624,11 +624,6 @@ pub mod d3d12_hello_triangle {
|
|||
D3D12InputImage {
|
||||
resource: resources.framebuffer.clone(),
|
||||
descriptor: framebuffer,
|
||||
size: Size::new(
|
||||
resources.viewport.Width as u32,
|
||||
resources.viewport.Height as u32,
|
||||
),
|
||||
format: DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
},
|
||||
&Viewport {
|
||||
x: 0.0,
|
||||
|
|
|
@ -6,12 +6,12 @@ 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/shaders_slang/crt/crt-lottes.slangp",
|
||||
// "../test/basic.slangp",
|
||||
// "../test/shaders_slang/handheld/console-border/gbc-lcd-grid-v2.slangp",
|
||||
// "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_GBA_SP/GBA_SP-[ADV]-[LCD-GRID]-[Night].slangp",
|
||||
// "../test/slang-shaders/test/feedback.slangp",
|
||||
"../test/shaders_slang/test/history.slangp",
|
||||
// "../test/shaders_slang/test/history.slangp",
|
||||
// "../test/shaders_slang/crt/crt-royale.slangp",
|
||||
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
||||
&SampleCommandLine {
|
||||
|
|
Loading…
Reference in a new issue