diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 14:50:01 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 14:50:01 +0100 |
| commit | b40d8039a98f57b26bd05860febbabbe59b97873 (patch) | |
| tree | b9d695c6eb44fda9c241bdd42295053bb3a549e8 /runtime/shims/d3d12_com.cpp | |
| parent | 354e129c2029b34f05285d6b100e1fdf02958772 (diff) | |
| parent | 89b047cd8fab50675a43d76722a6a8a881f55dc2 (diff) | |
Merge main into test/valu-int-misc (#1492)
Conflicts: tests/semantic/regen_fixtures.py
AI-assisted.
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index bd264a6ef..6fc3e2c51 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -200,6 +200,7 @@ public: | |||
| 200 | if (!list_.execute_bundle(bundle->list_)) return check(false); | 200 | if (!list_.execute_bundle(bundle->list_)) return check(false); |
| 201 | 201 | ||
| 202 | // Only the sticky state currently recorded by this COM layer is carried back from the bundle. | 202 | // Only the sticky state currently recorded by this COM layer is carried back from the bundle. |
| 203 | if (bundle->blend_factor_set_) blend_factor_ = bundle->blend_factor_; | ||
| 203 | if (bundle->stencil_ref_set_) { | 204 | if (bundle->stencil_ref_set_) { |
| 204 | front_stencil_ref_ = bundle->front_stencil_ref_; | 205 | front_stencil_ref_ = bundle->front_stencil_ref_; |
| 205 | back_stencil_ref_ = bundle->back_stencil_ref_; | 206 | back_stencil_ref_ = bundle->back_stencil_ref_; |
| @@ -315,6 +316,7 @@ public: | |||
| 315 | } | 316 | } |
| 316 | 317 | ||
| 317 | void STDMETHODCALLTYPE OMSetBlendFactor(const FLOAT factor[4]) override { | 318 | void STDMETHODCALLTYPE OMSetBlendFactor(const FLOAT factor[4]) override { |
| 319 | blend_factor_set_ = true; | ||
| 318 | blend_factor_ = factor ? std::array<float, 4>{factor[0], factor[1], factor[2], factor[3]} | 320 | blend_factor_ = factor ? std::array<float, 4>{factor[0], factor[1], factor[2], factor[3]} |
| 319 | : std::array<float, 4>{1, 1, 1, 1}; // null means { 1, 1, 1, 1 } | 321 | : std::array<float, 4>{1, 1, 1, 1}; // null means { 1, 1, 1, 1 } |
| 320 | } | 322 | } |
| @@ -623,9 +625,17 @@ public: | |||
| 623 | t.vertex_va = gd->Triangles.VertexBuffer.StartAddress; | 625 | t.vertex_va = gd->Triangles.VertexBuffer.StartAddress; |
| 624 | t.vertex_count = gd->Triangles.VertexCount; | 626 | t.vertex_count = gd->Triangles.VertexCount; |
| 625 | t.vertex_stride = static_cast<std::uint32_t>(gd->Triangles.VertexBuffer.StrideInBytes); | 627 | t.vertex_stride = static_cast<std::uint32_t>(gd->Triangles.VertexBuffer.StrideInBytes); |
| 626 | t.vertex_format = (gd->Triangles.VertexFormat == DXGI_FORMAT_R32G32_FLOAT) | 628 | // The vertex formats D3D12 allows for BLAS builds; any other stays VK_FORMAT_UNDEFINED and the |
| 627 | ? VK_FORMAT_R32G32_SFLOAT | 629 | // build is refused at replay instead of reading the wrong layout. |
| 628 | : VK_FORMAT_R32G32B32_SFLOAT; | 630 | switch (gd->Triangles.VertexFormat) { |
| 631 | case DXGI_FORMAT_R32G32B32_FLOAT: t.vertex_format = VK_FORMAT_R32G32B32_SFLOAT; break; | ||
| 632 | case DXGI_FORMAT_R32G32_FLOAT: t.vertex_format = VK_FORMAT_R32G32_SFLOAT; break; | ||
| 633 | case DXGI_FORMAT_R16G16B16A16_FLOAT: t.vertex_format = VK_FORMAT_R16G16B16A16_SFLOAT; break; | ||
| 634 | case DXGI_FORMAT_R16G16_FLOAT: t.vertex_format = VK_FORMAT_R16G16_SFLOAT; break; | ||
| 635 | case DXGI_FORMAT_R16G16B16A16_SNORM: t.vertex_format = VK_FORMAT_R16G16B16A16_SNORM; break; | ||
| 636 | case DXGI_FORMAT_R16G16_SNORM: t.vertex_format = VK_FORMAT_R16G16_SNORM; break; | ||
| 637 | default: t.vertex_format = VK_FORMAT_UNDEFINED; break; | ||
| 638 | } | ||
| 629 | t.index_va = gd->Triangles.IndexBuffer; | 639 | t.index_va = gd->Triangles.IndexBuffer; |
| 630 | t.index_count = gd->Triangles.IndexCount; | 640 | t.index_count = gd->Triangles.IndexCount; |
| 631 | if (gd->Triangles.IndexFormat == DXGI_FORMAT_R16_UINT) | 641 | if (gd->Triangles.IndexFormat == DXGI_FORMAT_R16_UINT) |
| @@ -634,6 +644,7 @@ public: | |||
| 634 | t.index_type = 2; | 644 | t.index_type = 2; |
| 635 | t.transform_va = gd->Triangles.Transform3x4; | 645 | t.transform_va = gd->Triangles.Transform3x4; |
| 636 | t.opaque = (gd->Flags & D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE) != 0; | 646 | t.opaque = (gd->Flags & D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE) != 0; |
| 647 | t.flags = static_cast<std::uint32_t>(gd->Flags); | ||
| 637 | cmd.triangles.push_back(t); | 648 | cmd.triangles.push_back(t); |
| 638 | } | 649 | } |
| 639 | } | 650 | } |
| @@ -816,6 +827,7 @@ private: | |||
| 816 | std::vector<leonida::TargetView> render_targets_; | 827 | std::vector<leonida::TargetView> render_targets_; |
| 817 | leonida::TargetView depth_{}; | 828 | leonida::TargetView depth_{}; |
| 818 | std::array<float, 4> blend_factor_{1, 1, 1, 1}; | 829 | std::array<float, 4> blend_factor_{1, 1, 1, 1}; |
| 830 | bool blend_factor_set_ = false; | ||
| 819 | 831 | ||
| 820 | // The root signatures and pipeline states this recording uses. D3D12 lets an application release them right | 832 | // The root signatures and pipeline states this recording uses. D3D12 lets an application release them right |
| 821 | // after Set*RootSignature / SetPipelineState; the list keeps them until Reset or its own release, so the root | 833 | // after Set*RootSignature / SetPipelineState; the list keeps them until Reset or its own release, so the root |
| @@ -854,6 +866,7 @@ private: | |||
| 854 | render_targets_.clear(); | 866 | render_targets_.clear(); |
| 855 | depth_ = {}; | 867 | depth_ = {}; |
| 856 | blend_factor_ = {1, 1, 1, 1}; | 868 | blend_factor_ = {1, 1, 1, 1}; |
| 869 | blend_factor_set_ = false; | ||
| 857 | set_pipeline(state); | 870 | set_pipeline(state); |
| 858 | } | 871 | } |
| 859 | 872 | ||