m86: update gpu/d3d/types.rs
@@ -2,7 +2,11 @@ use super::{ID3D12Resource, D3D12_RESOURCE_STATES, DXGI_FORMAT};
use crate::gpu;
use crate::prelude::*;
use skia_bindings::GrD3DTextureResourceInfo;
-use winapi::um::unknwnbase::IUnknown;
+use winapi::{
+ shared::dxgiformat,
+ shared::dxgitype,
+ um::{d3d12, unknwnbase::IUnknown},
+};
pub use wio::com::ComPtr as cp;
@@ -34,12 +38,38 @@ pub struct TextureResourceInfo {
pub resource_state: D3D12_RESOURCE_STATES,
pub format: DXGI_FORMAT,
pub level_count: u32,
- pub sample_quality_level: std::os::raw::c_uint,
+ pub sample_quality_pattern: std::os::raw::c_uint,
pub protected: gpu::Protected,
}
+impl TextureResourceInfo {
+ pub fn from_resource(resource: cp<ID3D12Resource>) -> Self {
+ Self {
+ resource,
+ resource_state: d3d12::D3D12_RESOURCE_STATE_COMMON,
+ format: dxgiformat::DXGI_FORMAT_UNKNOWN,
+ level_count: 0,
+ sample_quality_pattern: dxgitype::DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN,
+ protected: gpu::Protected::No,
+ }
+ }
+}
+
+impl From<cp<ID3D12Resource>> for TextureResourceInfo {
+ fn from(resource: cp<ID3D12Resource>) -> Self {
+ Self::from_resource(resource)
+ }
+}
+
impl NativeTransmutable<GrD3DTextureResourceInfo> for TextureResourceInfo {}
#[test]
fn test_texture_resource_info_layout() {
TextureResourceInfo::test_layout();
}
+
+#[repr(C)]
+#[derive(Clone)]
+pub struct FenceInfo {
+ pub fence: cp<d3d12::ID3D12Fence>,
+ pub value: u64,
+}
