upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/d3d12_com.cpp
diff options
context:
space:
mode:
authorKanameS <nk23a4@gmail.com>2026-11-23 02:53:47 +0700
committerKanameS <nk23a4@gmail.com>2026-11-23 02:53:47 +0700
commit70e3acf45902e604dd3adc4cc277d1c8f4149628 (patch)
treeece2d22446d79fcc215029cd1a72e323bc17a6fb /runtime/shims/d3d12_com.cpp
parent162821017ea3c286c8bec860f3ff94f037912061 (diff)
Runtime: a bundle that sets viewports, scissors or render targets, or calls ClearState, fails its Close, as on D3D12
RSSetViewports, RSSetScissorRects, OMSetRenderTargets and ClearState had no bundle check, so the layer accepted them in a bundle while the PC runtime fails that bundle's Close (measured on an RTX 4060 Ti and WARP, no debug layer). They now invalidate the bundle like the other calls a bundle may not make. New host-comparison test d3d12_bundle_forbidden: ten calls, each in a bundle and, as a control, on a direct list, against the PC runtime on the default adapter and WARP. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index e1c8deca1..c22a33093 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -309,7 +309,10 @@ public:
309 } 309 }
310 310
311 // ClearState returns every piece of list state to its default, as Reset does (stencil references included). 311 // ClearState returns every piece of list state to its default, as Reset does (stencil references included).
312 void STDMETHODCALLTYPE ClearState(ID3D12PipelineState* state) override { reset_state(state); } 312 void STDMETHODCALLTYPE ClearState(ID3D12PipelineState* state) override {
313 if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false);
314 reset_state(state);
315 }
313 316
314 // Graphics state. Draws record a copy of it (command_list.h, Draw). 317 // Graphics state. Draws record a copy of it (command_list.h, Draw).
315 void STDMETHODCALLTYPE IASetPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY topology) override { 318 void STDMETHODCALLTYPE IASetPrimitiveTopology(D3D12_PRIMITIVE_TOPOLOGY topology) override {
@@ -338,6 +341,7 @@ public:
338 341
339 // A count of 0 unbinds the viewports; draws then rasterize nothing (record_draw). 342 // A count of 0 unbinds the viewports; draws then rasterize nothing (record_draw).
340 void STDMETHODCALLTYPE RSSetViewports(UINT count, const D3D12_VIEWPORT* viewports) override { 343 void STDMETHODCALLTYPE RSSetViewports(UINT count, const D3D12_VIEWPORT* viewports) override {
344 if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false);
341 if (!count) { 345 if (!count) {
342 viewport_ = {}; 346 viewport_ = {};
343 return; 347 return;
@@ -349,6 +353,7 @@ public:
349 } 353 }
350 354
351 void STDMETHODCALLTYPE RSSetScissorRects(UINT count, const D3D12_RECT* rects) override { 355 void STDMETHODCALLTYPE RSSetScissorRects(UINT count, const D3D12_RECT* rects) override {
356 if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false);
352 if (!count || !rects) return; 357 if (!count || !rects) return;
353 if (count > 1) stub("ID3D12GraphicsCommandList::RSSetScissorRects (more than one rectangle; the first is used)"); 358 if (count > 1) stub("ID3D12GraphicsCommandList::RSSetScissorRects (more than one rectangle; the first is used)");
354 scissor_ = {rects[0].left, rects[0].top, rects[0].right, rects[0].bottom}; 359 scissor_ = {rects[0].left, rects[0].top, rects[0].right, rects[0].bottom};
@@ -357,6 +362,7 @@ public:
357 // D3D12 reads render-target and depth descriptors here, so their views are copied now. 362 // D3D12 reads render-target and depth descriptors here, so their views are copied now.
358 void STDMETHODCALLTYPE OMSetRenderTargets(UINT count, const D3D12_CPU_DESCRIPTOR_HANDLE* targets, BOOL single_range, 363 void STDMETHODCALLTYPE OMSetRenderTargets(UINT count, const D3D12_CPU_DESCRIPTOR_HANDLE* targets, BOOL single_range,
359 const D3D12_CPU_DESCRIPTOR_HANDLE* depth) override { 364 const D3D12_CPU_DESCRIPTOR_HANDLE* depth) override {
365 if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false);
360 if (count > D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) return check(false); 366 if (count > D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) return check(false);
361 render_targets_.assign(count, {}); 367 render_targets_.assign(count, {});
362 for (UINT i = 0; i < count && targets; ++i) { 368 for (UINT i = 0; i < count && targets; ++i) {