Repository navigation
Conversation
hzqst
added a commit
to hzqst/DiligentCore
that referenced
this pull request
Oct 25, 2026
Integrate DiligentGraphics/DiligentCore PRs DiligentGraphics#812, DiligentGraphics#814 and DiligentGraphics#817 into RTXPT-ray-reconstruction without importing the development merge from PR DiligentGraphics#814. Sources: DiligentGraphics#812 2a7f66e, 55f8504, fbb9a27; DiligentGraphics#814 f3a3a04; DiligentGraphics#817 acac729, 720904a. Add a three-pass native PSO/render-state archive round-trip regression and update modified copyright years. Validated Release Core/API tests and RTXPT builds, 556 unit tests, 59 D3D12 tests, 54 Vulkan tests and 6 WebGPU tests. Three Metal-only mesh tests skipped. D3D12 reference and RR captures exited successfully; RR executed twice. clang-format 10 validated all 15 changed files. Co-Authored-By: Codex <codex@openai.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nes. Retain serialized pipeline library data, use stable content keys, forward caches during archive unpacking, and cache mesh pipelines with explicit topology.
Align consecutive member and local declarations in PipelineStateCacheD3D12Impl.hpp/.cpp and PipelineStateD3D12Impl.cpp to satisfy the format validation pre-check. Whitespace only. Co-Authored-By: Claude Code <noreply@anthropic.com>
Load cached graphics and compute PSOs as ID3D12PipelineState, then explicitly upcast the returned raw pointer for shared DeviceChild storage, matching the mesh pipeline path. A separately queried DeviceChild interface is not guaranteed to be the base subobject of the PipelineState interface expected by downstream static casts and SetPipelineState. Co-Authored-By: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IDataBloband pass them toCreatePipelineLibrary. Retain the blob with the library through deferred release. If the data is rejected as invalid/incompatible, retry with an empty library. If pipeline libraries are unavailable, allow PSO creation to continue without native caching.UnpackInfo.pCache = PSOCreateInfo.pPSOCache.ID3D12PipelineLibrary1, tryLoadPipelinefor mesh PSO streams, and store newly created mesh PSOs. Populate an explicit primitive-topology subobject so creation and lookup use consistent descriptions.PSO_2_<hash>from the root-signature hash, graphics pipeline description when applicable, shader stages, and effective shader bytecode after binding remapping. Hash strings by content rather than pointer address. This removes dependence on display names and supports same-name variants and unnamed pipelines.ID3D12PipelineStateon graphics and compute cache hits. Use a concrete PSO pointer forIID_PPV_ARGS, then explicitly upcast the raw pointer into the existingID3D12DeviceChildstorage, matching the mesh path.Why the cache load must request ID3D12PipelineState
IID_PPV_ARGS(&d3d12PSO)derives the requested IID from the pointer's declared type. WithCComPtr<ID3D12DeviceChild>, the library is asked forIID_ID3D12DeviceChild, notIID_ID3D12PipelineState.Requesting a base COM interface can succeed, but COM does not guarantee that the returned interface pointer has the same address/layout as the base subobject of a separately obtained
ID3D12PipelineStateinterface. The canonical pointer identity guarantee applies to queries forIUnknown; it does not make arbitrary interface pointers interchangeable. See Microsoft's QueryInterface rules.This matters because Diligent stores native pipeline objects in
CComPtr<ID3D12DeviceChild>andGetD3D12PipelineState()later usesstatic_cast<ID3D12PipelineState*>(m_pd3d12PSO.p)before binding. That cast is valid for the base subobject of a realID3D12PipelineStatepointer; it does not performQueryInterfaceand cannot turn an independently returned DeviceChild interface into the required PSO interface. The creation path already requestsID3D12PipelineStateexplicitly.The graphics/compute cache load paths therefore must request
ID3D12PipelineStatedirectly (or explicitly query it before use). They now useCComPtr<ID3D12PipelineState>and returnCComPtr<ID3D12DeviceChild>{d3d12PSO.p}. The ordinary C++ upcast preserves the correct PSO interface's base subobject and retains its reference, without querying the object again for a potentially different DeviceChild interface. This follows the existing mesh-cache implementation and keeps the shared storage/API unchanged. Microsoft's LoadGraphicsPipeline documentation describes the requested PSO interface.On the affected Windows/NVIDIA configuration, a successful cache hit followed by binding the wrong interface caused a node-mask mismatch at
SetPipelineState,E_INVALIDARGfrom command-listClose, and device removal after submission. A later texture allocation reported the fatal error, obscuring the original failure. Validation-layer wrappers could mask the interface-layout problem, so validation-disabled coverage is necessary.Validation
The four-line interface fix was built and exercised in the downstream HLND2T-DiligentGraphics integration checkout; this PR adds the same source change (the file differs only in formatting). These are downstream results, not a run of the entire upstream DiligentCore test suite:
d3d12_pipeline_cacheandvulkan_pipeline_cache: both passed. D3D12 covers validation explicitly disabled and enabled, warm graphics PSO binding/submission, compute GPU readback, native graphics/compute/mesh cache hits, concurrent serialization, and corrupt-data fallback. The old backend failed when the restored graphics PSO was bound.de_dust2, rendered the map/player HUD, and exited normally.git diff --checkpassed for this commit. The upstream full suite was not run in the isolated PR worktree.