GPU: fences answer for ID3D12Fence1 as documented
fence.rs already implements ID3D12Fence1::GetCreationFlags at slot 11 (0x58), but FENCE_IIDS only listed ID3D12Fence and PAGEABLE_IIDS, so CreateFence and QueryInterface rejected ID3D12Fence1 with E_NOINTERFACE. Add ID3D12Fence1 (433685fe-e22b-4ca0-a8db-b5b4f4dd0e4a) to FENCE_IIDS and add a unit test covering creation, QueryInterface, and GetCreationFlags. Co-Authored-By: Gemini 4 Neon <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit bbdc3ca7249948b7624ba65f4282615caef895b8)
This commit is contained in:
1 parent
8780871ff7
commit
37e0b45d73
1 file changed
+41
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user