summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/range_map.h8
-rw-r--r--src/shader_recompiler/environment.h4
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h3
-rw-r--r--src/video_core/engines/draw_manager.cpp3
-rw-r--r--src/video_core/engines/maxwell_3d.h2
-rw-r--r--src/video_core/macro/macro_hle.cpp98
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h3
-rw-r--r--src/video_core/renderer_vulkan/fixed_pipeline_state.h3
-rw-r--r--src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp11
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.h3
-rw-r--r--src/video_core/renderer_vulkan/vk_staging_buffer_pool.h5
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp24
-rw-r--r--src/video_core/vulkan_common/vulkan_device.h52
-rw-r--r--src/video_core/vulkan_common/vulkan_wrapper.h3
14 files changed, 94 insertions, 128 deletions
diff --git a/src/common/range_map.h b/src/common/range_map.h
index 993e21643..051e713a7 100644
--- a/src/common/range_map.h
+++ b/src/common/range_map.h
@@ -13,8 +13,8 @@ namespace Common {
13template <typename KeyTBase, typename ValueT> 13template <typename KeyTBase, typename ValueT>
14class RangeMap { 14class RangeMap {
15private: 15private:
16 using KeyT = std::conditional_t<std::is_signed_v<KeyTBase>, typename KeyTBase, 16 using KeyT =
17 std::make_signed_t<KeyTBase>>; 17 std::conditional_t<std::is_signed_v<KeyTBase>, KeyTBase, std::make_signed_t<KeyTBase>>;
18 18
19public: 19public:
20 explicit RangeMap(ValueT null_value_) : null_value{null_value_} { 20 explicit RangeMap(ValueT null_value_) : null_value{null_value_} {
@@ -56,8 +56,8 @@ public:
56 56
57private: 57private:
58 using MapType = std::map<KeyT, ValueT>; 58 using MapType = std::map<KeyT, ValueT>;
59 using IteratorType = MapType::iterator; 59 using IteratorType = typename MapType::iterator;
60 using ConstIteratorType = MapType::const_iterator; 60 using ConstIteratorType = typename MapType::const_iterator;
61 61
62 size_t ContinousSizeInternal(KeyT address) const { 62 size_t ContinousSizeInternal(KeyT address) const {
63 const auto it = GetFirstElemnentBeforeOrOn(address); 63 const auto it = GetFirstElemnentBeforeOrOn(address);
diff --git a/src/shader_recompiler/environment.h b/src/shader_recompiler/environment.h
index b9b4455f6..8fc359126 100644
--- a/src/shader_recompiler/environment.h
+++ b/src/shader_recompiler/environment.h
@@ -36,8 +36,8 @@ public:
36 36
37 [[nodiscard]] virtual bool HasHLEMacroState() const = 0; 37 [[nodiscard]] virtual bool HasHLEMacroState() const = 0;
38 38
39 [[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer( 39 [[nodiscard]] virtual std::optional<ReplaceConstant> GetReplaceConstBuffer(u32 bank,
40 u32 bank, u32 offset) = 0; 40 u32 offset) = 0;
41 41
42 virtual void Dump(u64 hash) = 0; 42 virtual void Dump(u64 hash) = 0;
43 43
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index bdc0681b7..06fd40851 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -200,7 +200,8 @@ public:
200 /// Return true when a CPU region is modified from the CPU 200 /// Return true when a CPU region is modified from the CPU
201 [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size); 201 [[nodiscard]] bool IsRegionCpuModified(VAddr addr, size_t size);
202 202
203 void SetDrawIndirect(const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) { 203 void SetDrawIndirect(
204 const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect_) {
204 current_draw_indirect = current_draw_indirect_; 205 current_draw_indirect = current_draw_indirect_;
205 } 206 }
206 207
diff --git a/src/video_core/engines/draw_manager.cpp b/src/video_core/engines/draw_manager.cpp
index 183d5403c..feea89c0e 100644
--- a/src/video_core/engines/draw_manager.cpp
+++ b/src/video_core/engines/draw_manager.cpp
@@ -97,7 +97,8 @@ void DrawManager::DrawArrayIndirect(PrimitiveTopology topology) {
97 ProcessDrawIndirect(true); 97 ProcessDrawIndirect(true);
98} 98}
99 99
100void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first, u32 index_count) { 100void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first,
101 u32 index_count) {
101 const auto& regs{maxwell3d->regs}; 102 const auto& regs{maxwell3d->regs};
102 draw_state.topology = topology; 103 draw_state.topology = topology;
103 draw_state.index_buffer = regs.index_buffer; 104 draw_state.index_buffer = regs.index_buffer;
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 478ba4dc7..dbefcd715 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -3086,7 +3086,7 @@ public:
3086 3086
3087 std::unique_ptr<DrawManager> draw_manager; 3087 std::unique_ptr<DrawManager> draw_manager;
3088 friend class DrawManager; 3088 friend class DrawManager;
3089 3089
3090 std::vector<u8> inline_index_draw_indexes; 3090 std::vector<u8> inline_index_draw_indexes;
3091 3091
3092 GPUVAddr getMacroAddress(size_t index) const { 3092 GPUVAddr getMacroAddress(size_t index) const {
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp
index 294a338d2..3481fcd41 100644
--- a/src/video_core/macro/macro_hle.cpp
+++ b/src/video_core/macro/macro_hle.cpp
@@ -47,21 +47,7 @@ public:
47 explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} 47 explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {}
48 48
49protected: 49protected:
50 void advanceCheck() {
51 current_value = (current_value + 1) % fibonacci_post;
52 check_limit = current_value == 0;
53 if (check_limit) {
54 const u32 new_fibonacci = fibonacci_pre + fibonacci_post;
55 fibonacci_pre = fibonacci_post;
56 fibonacci_post = new_fibonacci;
57 }
58 }
59
60 Engines::Maxwell3D& maxwell3d; 50 Engines::Maxwell3D& maxwell3d;
61 u32 fibonacci_pre{89};
62 u32 fibonacci_post{144};
63 u32 current_value{fibonacci_post - 1};
64 bool check_limit{};
65}; 51};
66 52
67class HLE_771BB18C62444DA0 final : public HLEMacroImpl { 53class HLE_771BB18C62444DA0 final : public HLEMacroImpl {
@@ -124,12 +110,13 @@ private:
124 maxwell3d.RefreshParameters(); 110 maxwell3d.RefreshParameters();
125 const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); 111 const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
126 112
113 auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[0]);
127 const u32 vertex_first = parameters[3]; 114 const u32 vertex_first = parameters[3];
128 const u32 vertex_count = parameters[1]; 115 const u32 vertex_count = parameters[1];
129
130 116
131 if (maxwell3d.AnyParametersDirty() && 117 if (!IsTopologySafe(topology) &&
132 maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) { 118 static_cast<size_t>(maxwell3d.GetMaxCurrentVertices()) <
119 static_cast<size_t>(vertex_first) + static_cast<size_t>(vertex_count)) {
133 ASSERT_MSG(false, "Faulty draw!"); 120 ASSERT_MSG(false, "Faulty draw!");
134 return; 121 return;
135 } 122 }
@@ -141,9 +128,8 @@ private:
141 maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); 128 maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance);
142 } 129 }
143 130
144 maxwell3d.draw_manager->DrawArray( 131 maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance,
145 static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0]), 132 instance_count);
146 vertex_first, vertex_count, base_instance, instance_count);
147 133
148 if (extended) { 134 if (extended) {
149 maxwell3d.regs.global_base_instance_index = 0; 135 maxwell3d.regs.global_base_instance_index = 0;
@@ -166,13 +152,7 @@ public:
166 return; 152 return;
167 } 153 }
168 154
169 advanceCheck();
170 if (check_limit) {
171 maxwell3d.RefreshParameters();
172 minimum_limit = std::max(parameters[3], minimum_limit);
173 }
174 const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize()); 155 const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
175 const u32 base_size = std::max<u32>(minimum_limit, estimate);
176 const u32 element_base = parameters[4]; 156 const u32 element_base = parameters[4];
177 const u32 base_instance = parameters[5]; 157 const u32 base_instance = parameters[5];
178 maxwell3d.regs.vertex_id_base = element_base; 158 maxwell3d.regs.vertex_id_base = element_base;
@@ -191,7 +171,7 @@ public:
191 params.max_draw_counts = 1; 171 params.max_draw_counts = 1;
192 params.stride = 0; 172 params.stride = 0;
193 maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; 173 maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
194 maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); 174 maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate);
195 maxwell3d.engine_state = Maxwell::EngineHint::None; 175 maxwell3d.engine_state = Maxwell::EngineHint::None;
196 maxwell3d.replace_table.clear(); 176 maxwell3d.replace_table.clear();
197 maxwell3d.regs.vertex_id_base = 0x0; 177 maxwell3d.regs.vertex_id_base = 0x0;
@@ -223,8 +203,6 @@ private:
223 maxwell3d.engine_state = Maxwell::EngineHint::None; 203 maxwell3d.engine_state = Maxwell::EngineHint::None;
224 maxwell3d.replace_table.clear(); 204 maxwell3d.replace_table.clear();
225 } 205 }
226
227 u32 minimum_limit{1 << 18};
228}; 206};
229 207
230class HLE_MultiLayerClear final : public HLEMacroImpl { 208class HLE_MultiLayerClear final : public HLEMacroImpl {
@@ -257,10 +235,6 @@ public:
257 return; 235 return;
258 } 236 }
259 237
260 advanceCheck();
261 if (check_limit) {
262 maxwell3d.RefreshParameters();
263 }
264 const u32 start_indirect = parameters[0]; 238 const u32 start_indirect = parameters[0];
265 const u32 end_indirect = parameters[1]; 239 const u32 end_indirect = parameters[1];
266 if (start_indirect >= end_indirect) { 240 if (start_indirect >= end_indirect) {
@@ -274,20 +248,7 @@ public:
274 const u32 indirect_words = 5 + padding; 248 const u32 indirect_words = 5 + padding;
275 const u32 stride = indirect_words * sizeof(u32); 249 const u32 stride = indirect_words * sizeof(u32);
276 const std::size_t draw_count = end_indirect - start_indirect; 250 const std::size_t draw_count = end_indirect - start_indirect;
277 u32 lowest_first = std::numeric_limits<u32>::max();
278 u32 highest_limit = std::numeric_limits<u32>::min();
279 for (std::size_t index = 0; index < draw_count; index++) {
280 const std::size_t base = index * indirect_words + 5;
281 const u32 count = parameters[base];
282 const u32 first_index = parameters[base + 2];
283 lowest_first = std::min(lowest_first, first_index);
284 highest_limit = std::max(highest_limit, first_index + count);
285 }
286 if (check_limit) {
287 minimum_limit = std::max(highest_limit, minimum_limit);
288 }
289 const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize()); 251 const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
290 const u32 base_size = std::max(minimum_limit, estimate);
291 maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; 252 maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
292 auto& params = maxwell3d.draw_manager->GetIndirectParams(); 253 auto& params = maxwell3d.draw_manager->GetIndirectParams();
293 params.is_indexed = true; 254 params.is_indexed = true;
@@ -301,7 +262,7 @@ public:
301 maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; 262 maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
302 maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); 263 maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex);
303 maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); 264 maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance);
304 maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); 265 maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate);
305 maxwell3d.engine_state = Maxwell::EngineHint::None; 266 maxwell3d.engine_state = Maxwell::EngineHint::None;
306 maxwell3d.replace_table.clear(); 267 maxwell3d.replace_table.clear();
307 } 268 }
@@ -323,7 +284,6 @@ private:
323 return; 284 return;
324 } 285 }
325 const auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[2]); 286 const auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[2]);
326 maxwell3d.regs.draw.topology.Assign(topology);
327 const u32 padding = parameters[3]; 287 const u32 padding = parameters[3];
328 const std::size_t max_draws = parameters[4]; 288 const std::size_t max_draws = parameters[4];
329 289
@@ -345,8 +305,6 @@ private:
345 base_vertex, base_instance, parameters[base + 1]); 305 base_vertex, base_instance, parameters[base + 1]);
346 } 306 }
347 } 307 }
348
349 u32 minimum_limit{1 << 12};
350}; 308};
351 309
352class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl { 310class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl {
@@ -431,53 +389,53 @@ public:
431HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { 389HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {
432 builders.emplace(0x771BB18C62444DA0ULL, 390 builders.emplace(0x771BB18C62444DA0ULL,
433 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 391 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
434 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 392 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
435 return std::make_unique<HLE_771BB18C62444DA0>(maxwell3d); 393 return std::make_unique<HLE_771BB18C62444DA0>(maxwell3d__);
436 })); 394 }));
437 builders.emplace(0x0D61FC9FAAC9FCADULL, 395 builders.emplace(0x0D61FC9FAAC9FCADULL,
438 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 396 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
439 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 397 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
440 return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d); 398 return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d__);
441 })); 399 }));
442 builders.emplace(0x8A4D173EB99A8603ULL, 400 builders.emplace(0x8A4D173EB99A8603ULL,
443 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 401 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
444 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 402 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
445 return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d, true); 403 return std::make_unique<HLE_DrawArraysIndirect>(maxwell3d__, true);
446 })); 404 }));
447 builders.emplace(0x0217920100488FF7ULL, 405 builders.emplace(0x0217920100488FF7ULL,
448 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 406 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
449 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 407 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
450 return std::make_unique<HLE_DrawIndexedIndirect>(maxwell3d); 408 return std::make_unique<HLE_DrawIndexedIndirect>(maxwell3d__);
451 })); 409 }));
452 builders.emplace(0x3F5E74B9C9A50164ULL, 410 builders.emplace(0x3F5E74B9C9A50164ULL,
453 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 411 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
454 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 412 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
455 return std::make_unique<HLE_MultiDrawIndexedIndirectCount>(maxwell3d); 413 return std::make_unique<HLE_MultiDrawIndexedIndirectCount>(maxwell3d__);
456 })); 414 }));
457 builders.emplace(0xEAD26C3E2109B06BULL, 415 builders.emplace(0xEAD26C3E2109B06BULL,
458 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 416 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
459 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 417 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
460 return std::make_unique<HLE_MultiLayerClear>(maxwell3d); 418 return std::make_unique<HLE_MultiLayerClear>(maxwell3d__);
461 })); 419 }));
462 builders.emplace(0xC713C83D8F63CCF3ULL, 420 builders.emplace(0xC713C83D8F63CCF3ULL,
463 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 421 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
464 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 422 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
465 return std::make_unique<HLE_C713C83D8F63CCF3>(maxwell3d); 423 return std::make_unique<HLE_C713C83D8F63CCF3>(maxwell3d__);
466 })); 424 }));
467 builders.emplace(0xD7333D26E0A93EDEULL, 425 builders.emplace(0xD7333D26E0A93EDEULL,
468 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 426 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
469 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 427 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
470 return std::make_unique<HLE_D7333D26E0A93EDE>(maxwell3d); 428 return std::make_unique<HLE_D7333D26E0A93EDE>(maxwell3d__);
471 })); 429 }));
472 builders.emplace(0xEB29B2A09AA06D38ULL, 430 builders.emplace(0xEB29B2A09AA06D38ULL,
473 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 431 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
474 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 432 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
475 return std::make_unique<HLE_BindShader>(maxwell3d); 433 return std::make_unique<HLE_BindShader>(maxwell3d__);
476 })); 434 }));
477 builders.emplace(0xDB1341DBEB4C8AF7ULL, 435 builders.emplace(0xDB1341DBEB4C8AF7ULL,
478 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>( 436 std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
479 [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr<CachedMacro> { 437 [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
480 return std::make_unique<HLE_SetRasterBoundingBox>(maxwell3d); 438 return std::make_unique<HLE_SetRasterBoundingBox>(maxwell3d__);
481 })); 439 }));
482} 440}
483 441
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index d119c2b66..be4f76c18 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -93,8 +93,7 @@ public:
93 void SignalReference() override; 93 void SignalReference() override;
94 void ReleaseFences() override; 94 void ReleaseFences() override;
95 void FlushAndInvalidateRegion( 95 void FlushAndInvalidateRegion(
96 VAddr addr, u64 size, 96 VAddr addr, u64 size, VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
97 VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
98 void WaitForIdle() override; 97 void WaitForIdle() override;
99 void FragmentBarrier() override; 98 void FragmentBarrier() override;
100 void TiledCacheBarrier() override; 99 void TiledCacheBarrier() override;
diff --git a/src/video_core/renderer_vulkan/fixed_pipeline_state.h b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
index f47406347..98ea20b42 100644
--- a/src/video_core/renderer_vulkan/fixed_pipeline_state.h
+++ b/src/video_core/renderer_vulkan/fixed_pipeline_state.h
@@ -164,7 +164,8 @@ struct FixedPipelineState {
164 }; 164 };
165 165
166 void Refresh(const Maxwell& regs); 166 void Refresh(const Maxwell& regs);
167 void Refresh2(const Maxwell& regs, Maxwell::PrimitiveTopology topology, bool base_feautures_supported); 167 void Refresh2(const Maxwell& regs, Maxwell::PrimitiveTopology topology,
168 bool base_feautures_supported);
168 void Refresh3(const Maxwell& regs); 169 void Refresh3(const Maxwell& regs);
169 170
170 Maxwell::ComparisonOp DepthTestFunc() const noexcept { 171 Maxwell::ComparisonOp DepthTestFunc() const noexcept {
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
index c69ebe396..d11383bf1 100644
--- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
+++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp
@@ -227,7 +227,8 @@ struct DefaultSpec {
227 227
228ConfigureFuncPtr ConfigureFunc(const std::array<vk::ShaderModule, NUM_STAGES>& modules, 228ConfigureFuncPtr ConfigureFunc(const std::array<vk::ShaderModule, NUM_STAGES>& modules,
229 const std::array<Shader::Info, NUM_STAGES>& infos) { 229 const std::array<Shader::Info, NUM_STAGES>& infos) {
230 return FindSpec<SimpleVertexSpec, SimpleVertexFragmentSpec, SimpleStorageSpec, SimpleImageSpec, DefaultSpec>(modules, infos); 230 return FindSpec<SimpleVertexSpec, SimpleVertexFragmentSpec, SimpleStorageSpec, SimpleImageSpec,
231 DefaultSpec>(modules, infos);
231} 232}
232} // Anonymous namespace 233} // Anonymous namespace
233 234
@@ -505,11 +506,9 @@ void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling,
505 if (bind_pipeline) { 506 if (bind_pipeline) {
506 cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline); 507 cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);
507 } 508 }
508 if (is_rescaling) { 509 cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS,
509 cmdbuf.PushConstants(*pipeline_layout, VK_SHADER_STAGE_ALL_GRAPHICS, 510 RESCALING_LAYOUT_WORDS_OFFSET, sizeof(rescaling_data),
510 RESCALING_LAYOUT_WORDS_OFFSET, sizeof(rescaling_data), 511 rescaling_data.data());
511 rescaling_data.data());
512 }
513 if (update_rescaling) { 512 if (update_rescaling) {
514 const f32 config_down_factor{Settings::values.resolution_info.down_factor}; 513 const f32 config_down_factor{Settings::values.resolution_info.down_factor};
515 const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f}; 514 const f32 scale_down_factor{is_rescaling ? config_down_factor : 1.0f};
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h
index c06182807..c661e5b19 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.h
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.h
@@ -89,8 +89,7 @@ public:
89 void SignalReference() override; 89 void SignalReference() override;
90 void ReleaseFences() override; 90 void ReleaseFences() override;
91 void FlushAndInvalidateRegion( 91 void FlushAndInvalidateRegion(
92 VAddr addr, u64 size, 92 VAddr addr, u64 size, VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
93 VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
94 void WaitForIdle() override; 93 void WaitForIdle() override;
95 void FragmentBarrier() override; 94 void FragmentBarrier() override;
96 void TiledCacheBarrier() override; 95 void TiledCacheBarrier() override;
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h
index 2906d92a4..4fd15f11a 100644
--- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h
+++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.h
@@ -1,6 +1,5 @@
1// Copyright 2019 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
2// Licensed under GPLv2 or any later version 2// SPDX-License-Identifier: GPL-3.0-or-later
3// Refer to the license.txt file included.
4 3
5#pragma once 4#pragma once
6 5
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 780f5dede..ea62edb13 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -587,11 +587,16 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
587 dynamic_state_3 = { 587 dynamic_state_3 = {
588 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT, 588 .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT,
589 .pNext = nullptr, 589 .pNext = nullptr,
590 .extendedDynamicState3DepthClampEnable = ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE, 590 .extendedDynamicState3DepthClampEnable =
591 .extendedDynamicState3LogicOpEnable = ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE, 591 ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE,
592 .extendedDynamicState3ColorBlendEnable = ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE, 592 .extendedDynamicState3LogicOpEnable =
593 .extendedDynamicState3ColorBlendEquation = ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE, 593 ext_extended_dynamic_state_3_enables ? VK_TRUE : VK_FALSE,
594 .extendedDynamicState3ColorWriteMask = ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE, 594 .extendedDynamicState3ColorBlendEnable =
595 ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
596 .extendedDynamicState3ColorBlendEquation =
597 ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
598 .extendedDynamicState3ColorWriteMask =
599 ext_extended_dynamic_state_3_blend ? VK_TRUE : VK_FALSE,
595 }; 600 };
596 SetNext(next, dynamic_state_3); 601 SetNext(next, dynamic_state_3);
597 } else { 602 } else {
@@ -1342,14 +1347,17 @@ std::vector<const char*> Device::LoadExtensions(bool requires_surface) {
1342 features.pNext = &extended_dynamic_state_3; 1347 features.pNext = &extended_dynamic_state_3;
1343 physical.GetFeatures2(features); 1348 physical.GetFeatures2(features);
1344 1349
1345 ext_extended_dynamic_state_3_blend = extended_dynamic_state_3.extendedDynamicState3ColorBlendEnable && 1350 ext_extended_dynamic_state_3_blend =
1351 extended_dynamic_state_3.extendedDynamicState3ColorBlendEnable &&
1346 extended_dynamic_state_3.extendedDynamicState3ColorBlendEquation && 1352 extended_dynamic_state_3.extendedDynamicState3ColorBlendEquation &&
1347 extended_dynamic_state_3.extendedDynamicState3ColorWriteMask; 1353 extended_dynamic_state_3.extendedDynamicState3ColorWriteMask;
1348 1354
1349 ext_extended_dynamic_state_3_enables = extended_dynamic_state_3.extendedDynamicState3DepthClampEnable && 1355 ext_extended_dynamic_state_3_enables =
1356 extended_dynamic_state_3.extendedDynamicState3DepthClampEnable &&
1350 extended_dynamic_state_3.extendedDynamicState3LogicOpEnable; 1357 extended_dynamic_state_3.extendedDynamicState3LogicOpEnable;
1351 1358
1352 ext_extended_dynamic_state_3 = ext_extended_dynamic_state_3_blend || ext_extended_dynamic_state_3_enables; 1359 ext_extended_dynamic_state_3 =
1360 ext_extended_dynamic_state_3_blend || ext_extended_dynamic_state_3_enables;
1353 if (ext_extended_dynamic_state_3) { 1361 if (ext_extended_dynamic_state_3) {
1354 extensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME); 1362 extensions.push_back(VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME);
1355 } 1363 }
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h
index b58ec736f..920a8f4e3 100644
--- a/src/video_core/vulkan_common/vulkan_device.h
+++ b/src/video_core/vulkan_common/vulkan_device.h
@@ -486,33 +486,33 @@ private:
486 bool ext_sampler_filter_minmax{}; ///< Support for VK_EXT_sampler_filter_minmax. 486 bool ext_sampler_filter_minmax{}; ///< Support for VK_EXT_sampler_filter_minmax.
487 bool ext_depth_clip_control{}; ///< Support for VK_EXT_depth_clip_control 487 bool ext_depth_clip_control{}; ///< Support for VK_EXT_depth_clip_control
488 bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted. 488 bool ext_depth_range_unrestricted{}; ///< Support for VK_EXT_depth_range_unrestricted.
489 bool ext_shader_viewport_index_layer{}; ///< Support for VK_EXT_shader_viewport_index_layer. 489 bool ext_shader_viewport_index_layer{}; ///< Support for VK_EXT_shader_viewport_index_layer.
490 bool ext_tooling_info{}; ///< Support for VK_EXT_tooling_info. 490 bool ext_tooling_info{}; ///< Support for VK_EXT_tooling_info.
491 bool ext_subgroup_size_control{}; ///< Support for VK_EXT_subgroup_size_control. 491 bool ext_subgroup_size_control{}; ///< Support for VK_EXT_subgroup_size_control.
492 bool ext_transform_feedback{}; ///< Support for VK_EXT_transform_feedback. 492 bool ext_transform_feedback{}; ///< Support for VK_EXT_transform_feedback.
493 bool ext_custom_border_color{}; ///< Support for VK_EXT_custom_border_color. 493 bool ext_custom_border_color{}; ///< Support for VK_EXT_custom_border_color.
494 bool ext_extended_dynamic_state{}; ///< Support for VK_EXT_extended_dynamic_state. 494 bool ext_extended_dynamic_state{}; ///< Support for VK_EXT_extended_dynamic_state.
495 bool ext_extended_dynamic_state_2{}; ///< Support for VK_EXT_extended_dynamic_state2. 495 bool ext_extended_dynamic_state_2{}; ///< Support for VK_EXT_extended_dynamic_state2.
496 bool ext_extended_dynamic_state_2_extra{}; ///< Support for VK_EXT_extended_dynamic_state2. 496 bool ext_extended_dynamic_state_2_extra{}; ///< Support for VK_EXT_extended_dynamic_state2.
497 bool ext_extended_dynamic_state_3{}; ///< Support for VK_EXT_extended_dynamic_state3. 497 bool ext_extended_dynamic_state_3{}; ///< Support for VK_EXT_extended_dynamic_state3.
498 bool ext_extended_dynamic_state_3_blend{}; ///< Support for VK_EXT_extended_dynamic_state3. 498 bool ext_extended_dynamic_state_3_blend{}; ///< Support for VK_EXT_extended_dynamic_state3.
499 bool ext_extended_dynamic_state_3_enables{}; ///< Support for VK_EXT_extended_dynamic_state3. 499 bool ext_extended_dynamic_state_3_enables{}; ///< Support for VK_EXT_extended_dynamic_state3.
500 bool ext_line_rasterization{}; ///< Support for VK_EXT_line_rasterization. 500 bool ext_line_rasterization{}; ///< Support for VK_EXT_line_rasterization.
501 bool ext_vertex_input_dynamic_state{}; ///< Support for VK_EXT_vertex_input_dynamic_state. 501 bool ext_vertex_input_dynamic_state{}; ///< Support for VK_EXT_vertex_input_dynamic_state.
502 bool ext_shader_stencil_export{}; ///< Support for VK_EXT_shader_stencil_export. 502 bool ext_shader_stencil_export{}; ///< Support for VK_EXT_shader_stencil_export.
503 bool ext_shader_atomic_int64{}; ///< Support for VK_KHR_shader_atomic_int64. 503 bool ext_shader_atomic_int64{}; ///< Support for VK_KHR_shader_atomic_int64.
504 bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization. 504 bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization.
505 bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex. 505 bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex.
506 bool ext_memory_budget{}; ///< Support for VK_EXT_memory_budget. 506 bool ext_memory_budget{}; ///< Support for VK_EXT_memory_budget.
507 bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. 507 bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config.
508 bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit 508 bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit
509 bool has_renderdoc{}; ///< Has RenderDoc attached 509 bool has_renderdoc{}; ///< Has RenderDoc attached
510 bool has_nsight_graphics{}; ///< Has Nsight Graphics attached 510 bool has_nsight_graphics{}; ///< Has Nsight Graphics attached
511 bool supports_d24_depth{}; ///< Supports D24 depth buffers. 511 bool supports_d24_depth{}; ///< Supports D24 depth buffers.
512 bool cant_blit_msaa{}; ///< Does not support MSAA<->MSAA blitting. 512 bool cant_blit_msaa{}; ///< Does not support MSAA<->MSAA blitting.
513 bool must_emulate_bgr565{}; ///< Emulates BGR565 by swizzling RGB565 format. 513 bool must_emulate_bgr565{}; ///< Emulates BGR565 by swizzling RGB565 format.
514 u32 max_vertex_input_attributes{}; ///< Max vertex input attributes in pipeline 514 u32 max_vertex_input_attributes{}; ///< Max vertex input attributes in pipeline
515 u32 max_vertex_input_bindings{}; ///< Max vertex input buffers in pipeline 515 u32 max_vertex_input_bindings{}; ///< Max vertex input buffers in pipeline
516 516
517 // Telemetry parameters 517 // Telemetry parameters
518 std::string vendor_name; ///< Device's driver name. 518 std::string vendor_name; ///< Device's driver name.
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h
index d7ae14478..accfad8c1 100644
--- a/src/video_core/vulkan_common/vulkan_wrapper.h
+++ b/src/video_core/vulkan_common/vulkan_wrapper.h
@@ -1269,7 +1269,8 @@ public:
1269 dld->vkCmdSetColorBlendEnableEXT(handle, first, enables.size(), enables.data()); 1269 dld->vkCmdSetColorBlendEnableEXT(handle, first, enables.size(), enables.data());
1270 } 1270 }
1271 1271
1272 void SetColorBlendEquationEXT(u32 first, Span<VkColorBlendEquationEXT> equations) const noexcept { 1272 void SetColorBlendEquationEXT(u32 first,
1273 Span<VkColorBlendEquationEXT> equations) const noexcept {
1273 dld->vkCmdSetColorBlendEquationEXT(handle, first, equations.size(), equations.data()); 1274 dld->vkCmdSetColorBlendEquationEXT(handle, first, equations.size(), equations.data());
1274 } 1275 }
1275 1276