|
|
@@ -9,13 +9,20 @@ use std::sync::atomic::{AtomicU64, Ordering};
|
|
|
use crate::object::{self, E_NOTIMPL, FENCE, HRESULT, Iid, Object, S_OK, Table, This, guid};
|
|
|
use crate::resource::PAGEABLE_IIDS;
|
|
|
|
|
|
-pub(crate) const FENCE_IIDS: [Iid; 4] = [
|
|
|
+pub(crate) const FENCE_IIDS: [Iid; 5] = [
|
|
|
guid(
|
|
|
0x0a753dcf,
|
|
|
0xc4d8,
|
|
|
0x4b91,
|
|
|
[0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76],
|
|
|
),
|
|
|
+ // ID3D12Fence1.
|
|
|
+ guid(
|
|
|
+ 0x433685fe,
|
|
|
+ 0xe22b,
|
|
|
+ 0x4ca0,
|
|
|
+ [0xa8, 0xdb, 0xb5, 0xb4, 0xf4, 0xdd, 0x0e, 0x4a],
|
|
|
+ ),
|
|
|
PAGEABLE_IIDS[0],
|
|
|
PAGEABLE_IIDS[1],
|
|
|
PAGEABLE_IIDS[2],
|
|
|
@@ -190,4 +197,37 @@ mod tests {
|
|
|
unsafe { CloseHandle(event) };
|
|
|
assert_eq!(slot::<extern "system" fn(This) -> u32>(f, 0x10)(f), 0);
|
|
|
}
|
|
|
+
|
|
|
+ #[test]
|
|
|
+ fn fence1_interface_is_created_and_queried() {
|
|
|
+ const FENCE1_IID: Iid = guid(
|
|
|
+ 0x433685fe,
|
|
|
+ 0xe22b,
|
|
|
+ 0x4ca0,
|
|
|
+ [0xa8, 0xdb, 0xb5, 0xb4, 0xf4, 0xdd, 0x0e, 0x4a],
|
|
|
+ );
|
|
|
+ type Query = extern "system" fn(This, *const Iid, *mut This) -> HRESULT;
|
|
|
+ type Flags = extern "system" fn(This) -> u32;
|
|
|
+ type Release = extern "system" fn(This) -> u32;
|
|
|
+
|
|
|
+ // Direct creation as ID3D12Fence1, and GetCreationFlags at slot 0x58.
|
|
|
+ let mut f1 = std::ptr::null();
|
|
|
+ assert_eq!(create(std::ptr::null(), 3, 0x5, &FENCE1_IID, &mut f1), S_OK);
|
|
|
+ assert!(!f1.is_null());
|
|
|
+ assert_eq!(slot::<Flags>(f1, 0x58)(f1), 0x5);
|
|
|
+ assert_eq!(slot::<Release>(f1, 0x10)(f1), 0);
|
|
|
+
|
|
|
+ // QueryInterface from ID3D12Fence to ID3D12Fence1 returns the same object.
|
|
|
+ let mut f = std::ptr::null();
|
|
|
+ assert_eq!(
|
|
|
+ create(std::ptr::null(), 0, 0x2, &FENCE_IIDS[0], &mut f),
|
|
|
+ S_OK
|
|
|
+ );
|
|
|
+ let mut queried = std::ptr::null();
|
|
|
+ assert_eq!(slot::<Query>(f, 0x00)(f, &FENCE1_IID, &mut queried), S_OK);
|
|
|
+ assert_eq!(queried, f);
|
|
|
+ assert_eq!(slot::<Flags>(queried, 0x58)(queried), 0x2);
|
|
|
+ assert_eq!(slot::<Release>(queried, 0x10)(queried), 1);
|
|
|
+ assert_eq!(slot::<Release>(f, 0x10)(f), 0);
|
|
|
+ }
|
|
|
}
|