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:
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
-rw-r--r--runtime/shims/d3d12_com.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp
index e1c8deca1..38b21d55f 100644
--- a/runtime/shims/d3d12_com.cpp
+++ b/runtime/shims/d3d12_com.cpp
@@ -358,7 +358,8 @@ public:
358 void STDMETHODCALLTYPE OMSetRenderTargets(UINT count, const D3D12_CPU_DESCRIPTOR_HANDLE* targets, BOOL single_range, 358 void STDMETHODCALLTYPE OMSetRenderTargets(UINT count, const D3D12_CPU_DESCRIPTOR_HANDLE* targets, BOOL single_range,
359 const D3D12_CPU_DESCRIPTOR_HANDLE* depth) override { 359 const D3D12_CPU_DESCRIPTOR_HANDLE* depth) override {
360 if (count > D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) return check(false); 360 if (count > D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT) return check(false);
361 render_targets_.assign(count, {}); 361 render_targets_.fill({});
362 render_target_count_ = count;
362 for (UINT i = 0; i < count && targets; ++i) { 363 for (UINT i = 0; i < count && targets; ++i) {
363 const SIZE_T handle = single_range ? targets[0].ptr + SIZE_T(i) * descriptor_size : targets[i].ptr; 364 const SIZE_T handle = single_range ? targets[0].ptr + SIZE_T(i) * descriptor_size : targets[i].ptr;
364 if (handle) render_targets_[i] = *reinterpret_cast<const leonida::TargetView*>(handle); 365 if (handle) render_targets_[i] = *reinterpret_cast<const leonida::TargetView*>(handle);
@@ -978,7 +979,8 @@ private:
978 leonida::IndexBufferView index_{}; 979 leonida::IndexBufferView index_{};
979 leonida::Viewport viewport_{}; 980 leonida::Viewport viewport_{};
980 leonida::Rect scissor_{}; 981 leonida::Rect scissor_{};
981 std::vector<leonida::TargetView> render_targets_; 982 std::array<leonida::TargetView, D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT> render_targets_{};
983 UINT render_target_count_ = 0;
982 leonida::TargetView depth_{}; 984 leonida::TargetView depth_{};
983 std::array<float, 4> blend_factor_{1, 1, 1, 1}; 985 std::array<float, 4> blend_factor_{1, 1, 1, 1};
984 986
@@ -1041,7 +1043,8 @@ private:
1041 index_ = {}; 1043 index_ = {};
1042 viewport_ = {}; 1044 viewport_ = {};
1043 scissor_ = {}; 1045 scissor_ = {};
1044 render_targets_.clear(); 1046 render_targets_.fill({});
1047 render_target_count_ = 0;
1045 depth_ = {}; 1048 depth_ = {};
1046 blend_factor_ = {1, 1, 1, 1}; 1049 blend_factor_ = {1, 1, 1, 1};
1047 set_pipeline(state); 1050 set_pipeline(state);
@@ -1071,10 +1074,10 @@ private:
1071 // and Vulkan forbids a 0x0 viewport, so the draw is not recorded. 1074 // and Vulkan forbids a 0x0 viewport, so the draw is not recorded.
1072 if (!(viewport_.width > 0) || !(viewport_.height > 0)) return; 1075 if (!(viewport_.width > 0) || !(viewport_.height > 0)) return;
1073 leonida::Draw draw{graphics_pipeline_, graphics_.data, render_targets_, depth_, 1076 leonida::Draw draw{graphics_pipeline_, graphics_.data, render_targets_, depth_,
1074 {vertex_buffers_.begin(), vertex_buffers_.end()}, index_, topology_, viewport_, scissor_, 1077 vertex_buffers_, index_, topology_, viewport_, scissor_,
1075 blend_factor_, front_stencil_ref_, back_stencil_ref_, indexed, count, instances, first, 1078 blend_factor_, front_stencil_ref_, back_stencil_ref_, indexed, count, instances, first,
1076 base_vertex, first_instance}; 1079 base_vertex, first_instance, render_target_count_};
1077 check(list_.draw(draw)); 1080 check(list_.draw(std::move(draw)));
1078 } 1081 }
1079}; 1082};
1080 1083