diff options
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 663f5f3a5..3ccf90a2d 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -336,7 +336,8 @@ public: | |||
| 336 | void STDMETHODCALLTYPE OMSetRenderTargets(UINT count, const D3D12_CPU_DESCRIPTOR_HANDLE* targets, BOOL single_range, | 336 | void STDMETHODCALLTYPE OMSetRenderTargets(UINT count, const D3D12_CPU_DESCRIPTOR_HANDLE* targets, BOOL single_range, |
| 337 | const D3D12_CPU_DESCRIPTOR_HANDLE* depth) override { | 337 | const D3D12_CPU_DESCRIPTOR_HANDLE* depth) override { |
| 338 | if (count > D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) return check(false); | 338 | if (count > D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) return check(false); |
| 339 | render_targets_.assign(count, {}); | 339 | render_targets_.fill({}); |
| 340 | render_target_count_ = count; | ||
| 340 | for (UINT i = 0; i < count && targets; ++i) { | 341 | for (UINT i = 0; i < count && targets; ++i) { |
| 341 | const SIZE_T handle = single_range ? targets[0].ptr + SIZE_T(i) * descriptor_size : targets[i].ptr; | 342 | const SIZE_T handle = single_range ? targets[0].ptr + SIZE_T(i) * descriptor_size : targets[i].ptr; |
| 342 | if (handle) render_targets_[i] = *reinterpret_cast<const leonida::TargetView*>(handle); | 343 | if (handle) render_targets_[i] = *reinterpret_cast<const leonida::TargetView*>(handle); |
| @@ -910,7 +911,8 @@ private: | |||
| 910 | leonida::IndexBufferView index_{}; | 911 | leonida::IndexBufferView index_{}; |
| 911 | leonida::Viewport viewport_{}; | 912 | leonida::Viewport viewport_{}; |
| 912 | leonida::Rect scissor_{}; | 913 | leonida::Rect scissor_{}; |
| 913 | std::vector<leonida::TargetView> render_targets_; | 914 | std::array<leonida::TargetView, D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT> render_targets_{}; |
| 915 | UINT render_target_count_ = 0; | ||
| 914 | leonida::TargetView depth_{}; | 916 | leonida::TargetView depth_{}; |
| 915 | std::array<float, 4> blend_factor_{1, 1, 1, 1}; | 917 | std::array<float, 4> blend_factor_{1, 1, 1, 1}; |
| 916 | bool blend_factor_set_ = false; | 918 | bool blend_factor_set_ = false; |
| @@ -949,7 +951,8 @@ private: | |||
| 949 | index_ = {}; | 951 | index_ = {}; |
| 950 | viewport_ = {}; | 952 | viewport_ = {}; |
| 951 | scissor_ = {}; | 953 | scissor_ = {}; |
| 952 | render_targets_.clear(); | 954 | render_targets_.fill({}); |
| 955 | render_target_count_ = 0; | ||
| 953 | depth_ = {}; | 956 | depth_ = {}; |
| 954 | blend_factor_ = {1, 1, 1, 1}; | 957 | blend_factor_ = {1, 1, 1, 1}; |
| 955 | blend_factor_set_ = false; | 958 | blend_factor_set_ = false; |
| @@ -963,10 +966,10 @@ private: | |||
| 963 | // and Vulkan forbids a 0x0 viewport, so the draw is not recorded. | 966 | // and Vulkan forbids a 0x0 viewport, so the draw is not recorded. |
| 964 | if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; | 967 | if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; |
| 965 | leonida::Draw draw{graphics_pipeline_, graphics_.data, render_targets_, depth_, | 968 | leonida::Draw draw{graphics_pipeline_, graphics_.data, render_targets_, depth_, |
| 966 | {vertex_buffers_.begin(), vertex_buffers_.end()}, index_, topology_, viewport_, scissor_, | 969 | vertex_buffers_, index_, topology_, viewport_, scissor_, |
| 967 | blend_factor_, front_stencil_ref_, back_stencil_ref_, indexed, count, instances, first, | 970 | blend_factor_, front_stencil_ref_, back_stencil_ref_, indexed, count, instances, first, |
| 968 | base_vertex, first_instance}; | 971 | base_vertex, first_instance, render_target_count_}; |
| 969 | check(list_.draw(draw)); | 972 | check(list_.draw(std::move(draw))); |
| 970 | } | 973 | } |
| 971 | }; | 974 | }; |
| 972 | 975 | ||