forked from etc/pineapple-src
early-access version 3280
This commit is contained in:
parent
71158b94ed
commit
ece2622a91
24 changed files with 312 additions and 126 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3279.
|
This is the source code for early-access 3280.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
using ConstIteratorType = typename MapType::const_iterator;
|
using ConstIteratorType = typename MapType::const_iterator;
|
||||||
|
|
||||||
size_t ContinousSizeInternal(KeyT address) const {
|
size_t ContinousSizeInternal(KeyT address) const {
|
||||||
const auto it = GetFirstElemnentBeforeOrOn(address);
|
const auto it = GetFirstElementBeforeOrOn(address);
|
||||||
if (it == container.end() || it->second == null_value) {
|
if (it == container.end() || it->second == null_value) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -72,14 +72,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueT GetValueInternal(KeyT address) const {
|
ValueT GetValueInternal(KeyT address) const {
|
||||||
const auto it = GetFirstElemnentBeforeOrOn(address);
|
const auto it = GetFirstElementBeforeOrOn(address);
|
||||||
if (it == container.end()) {
|
if (it == container.end()) {
|
||||||
return null_value;
|
return null_value;
|
||||||
}
|
}
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstIteratorType GetFirstElemnentBeforeOrOn(KeyT address) const {
|
ConstIteratorType GetFirstElementBeforeOrOn(KeyT address) const {
|
||||||
auto it = container.lower_bound(address);
|
auto it = container.lower_bound(address);
|
||||||
if (it == container.begin()) {
|
if (it == container.begin()) {
|
||||||
return it;
|
return it;
|
||||||
|
|
|
@ -532,6 +532,7 @@ struct Values {
|
||||||
Setting<bool> reporting_services{false, "reporting_services"};
|
Setting<bool> reporting_services{false, "reporting_services"};
|
||||||
Setting<bool> quest_flag{false, "quest_flag"};
|
Setting<bool> quest_flag{false, "quest_flag"};
|
||||||
Setting<bool> disable_macro_jit{false, "disable_macro_jit"};
|
Setting<bool> disable_macro_jit{false, "disable_macro_jit"};
|
||||||
|
Setting<bool> disable_macro_hle{false, "disable_macro_hle"};
|
||||||
Setting<bool> extended_logging{false, "extended_logging"};
|
Setting<bool> extended_logging{false, "extended_logging"};
|
||||||
Setting<bool> use_debug_asserts{false, "use_debug_asserts"};
|
Setting<bool> use_debug_asserts{false, "use_debug_asserts"};
|
||||||
Setting<bool> use_auto_stub{false, "use_auto_stub"};
|
Setting<bool> use_auto_stub{false, "use_auto_stub"};
|
||||||
|
|
|
@ -143,6 +143,9 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, Scal
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
ctx.Add("MOV.F {}.x,{}.baseVertex;", inst, ctx.attrib_name);
|
ctx.Add("MOV.F {}.x,{}.baseVertex;", inst, ctx.attrib_name);
|
||||||
break;
|
break;
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
|
ctx.Add("MOV.F {}.x,{}.draw.id;", inst, ctx.attrib_name);
|
||||||
|
break;
|
||||||
case IR::Attribute::FrontFace:
|
case IR::Attribute::FrontFace:
|
||||||
ctx.Add("CMP.F {}.x,{}.facing.x,0,-1;", inst, ctx.attrib_name);
|
ctx.Add("CMP.F {}.x,{}.facing.x,0,-1;", inst, ctx.attrib_name);
|
||||||
break;
|
break;
|
||||||
|
@ -168,6 +171,9 @@ void EmitGetAttributeU32(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, S
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
ctx.Add("MOV.S {}.x,{}.baseVertex;", inst, ctx.attrib_name);
|
ctx.Add("MOV.S {}.x,{}.baseVertex;", inst, ctx.attrib_name);
|
||||||
break;
|
break;
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
|
ctx.Add("MOV.S {}.x,{}.draw.id;", inst, ctx.attrib_name);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw NotImplementedException("Get U32 attribute {}", attr);
|
throw NotImplementedException("Get U32 attribute {}", attr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,9 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr,
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
ctx.AddF32("{}=itof(gl_BaseVertex);", inst);
|
ctx.AddF32("{}=itof(gl_BaseVertex);", inst);
|
||||||
break;
|
break;
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
|
ctx.AddF32("{}=itof(gl_DrawID);", inst);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw NotImplementedException("Get attribute {}", attr);
|
throw NotImplementedException("Get attribute {}", attr);
|
||||||
}
|
}
|
||||||
|
@ -262,6 +265,9 @@ void EmitGetAttributeU32(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, s
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
ctx.AddU32("{}=uint(gl_BaseVertex);", inst);
|
ctx.AddU32("{}=uint(gl_BaseVertex);", inst);
|
||||||
break;
|
break;
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
|
ctx.AddU32("{}=uint(gl_DrawID);", inst);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw NotImplementedException("Get U32 attribute {}", attr);
|
throw NotImplementedException("Get U32 attribute {}", attr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,6 +343,8 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) {
|
||||||
return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.base_instance));
|
return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.base_instance));
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.base_vertex));
|
return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.base_vertex));
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
|
return ctx.OpBitcast(ctx.F32[1], ctx.OpLoad(ctx.U32[1], ctx.draw_index));
|
||||||
case IR::Attribute::FrontFace:
|
case IR::Attribute::FrontFace:
|
||||||
return ctx.OpSelect(ctx.F32[1], ctx.OpLoad(ctx.U1, ctx.front_face),
|
return ctx.OpSelect(ctx.F32[1], ctx.OpLoad(ctx.U1, ctx.front_face),
|
||||||
ctx.OpBitcast(ctx.F32[1], ctx.Const(std::numeric_limits<u32>::max())),
|
ctx.OpBitcast(ctx.F32[1], ctx.Const(std::numeric_limits<u32>::max())),
|
||||||
|
@ -388,6 +390,8 @@ Id EmitGetAttributeU32(EmitContext& ctx, IR::Attribute attr, Id) {
|
||||||
return ctx.OpLoad(ctx.U32[1], ctx.base_instance);
|
return ctx.OpLoad(ctx.U32[1], ctx.base_instance);
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
return ctx.OpLoad(ctx.U32[1], ctx.base_vertex);
|
return ctx.OpLoad(ctx.U32[1], ctx.base_vertex);
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
|
return ctx.OpLoad(ctx.U32[1], ctx.draw_index);
|
||||||
default:
|
default:
|
||||||
throw NotImplementedException("Read U32 attribute {}", attr);
|
throw NotImplementedException("Read U32 attribute {}", attr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1402,6 +1402,9 @@ void EmitContext::DefineInputs(const IR::Program& program) {
|
||||||
} else if (loads[IR::Attribute::BaseVertex]) {
|
} else if (loads[IR::Attribute::BaseVertex]) {
|
||||||
base_vertex = DefineInput(*this, U32[1], true, spv::BuiltIn::BaseVertex);
|
base_vertex = DefineInput(*this, U32[1], true, spv::BuiltIn::BaseVertex);
|
||||||
}
|
}
|
||||||
|
if (loads[IR::Attribute::DrawID]) {
|
||||||
|
draw_index = DefineInput(*this, U32[1], true, spv::BuiltIn::DrawIndex);
|
||||||
|
}
|
||||||
if (loads[IR::Attribute::FrontFace]) {
|
if (loads[IR::Attribute::FrontFace]) {
|
||||||
front_face = DefineInput(*this, U1, true, spv::BuiltIn::FrontFacing);
|
front_face = DefineInput(*this, U1, true, spv::BuiltIn::FrontFacing);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,6 +218,7 @@ public:
|
||||||
Id base_instance{};
|
Id base_instance{};
|
||||||
Id vertex_id{};
|
Id vertex_id{};
|
||||||
Id vertex_index{};
|
Id vertex_index{};
|
||||||
|
Id draw_index{};
|
||||||
Id base_vertex{};
|
Id base_vertex{};
|
||||||
Id front_face{};
|
Id front_face{};
|
||||||
Id point_coord{};
|
Id point_coord{};
|
||||||
|
|
|
@ -450,6 +450,8 @@ std::string NameOf(Attribute attribute) {
|
||||||
return "BaseInstance";
|
return "BaseInstance";
|
||||||
case Attribute::BaseVertex:
|
case Attribute::BaseVertex:
|
||||||
return "BaseVertex";
|
return "BaseVertex";
|
||||||
|
case Attribute::DrawID:
|
||||||
|
return "DrawID";
|
||||||
}
|
}
|
||||||
return fmt::format("<reserved attribute {}>", static_cast<int>(attribute));
|
return fmt::format("<reserved attribute {}>", static_cast<int>(attribute));
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ enum class Attribute : u64 {
|
||||||
// Implementation attributes
|
// Implementation attributes
|
||||||
BaseInstance = 256,
|
BaseInstance = 256,
|
||||||
BaseVertex = 257,
|
BaseVertex = 257,
|
||||||
|
DrawID = 258,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr size_t NUM_GENERICS = 32;
|
constexpr size_t NUM_GENERICS = 32;
|
||||||
|
|
|
@ -518,6 +518,7 @@ void FoldBitCast(IR::Inst& inst, IR::Opcode reverse) {
|
||||||
case IR::Attribute::VertexId:
|
case IR::Attribute::VertexId:
|
||||||
case IR::Attribute::BaseVertex:
|
case IR::Attribute::BaseVertex:
|
||||||
case IR::Attribute::BaseInstance:
|
case IR::Attribute::BaseInstance:
|
||||||
|
case IR::Attribute::DrawID:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
@ -665,6 +666,8 @@ void FoldConstBuffer(Environment& env, IR::Block& block, IR::Inst& inst) {
|
||||||
return IR::Attribute::BaseInstance;
|
return IR::Attribute::BaseInstance;
|
||||||
case ReplaceConstant::BaseVertex:
|
case ReplaceConstant::BaseVertex:
|
||||||
return IR::Attribute::BaseVertex;
|
return IR::Attribute::BaseVertex;
|
||||||
|
case ReplaceConstant::DrawID:
|
||||||
|
return IR::Attribute::DrawID;
|
||||||
default:
|
default:
|
||||||
throw NotImplementedException("Not implemented replacement variable {}", *replacement);
|
throw NotImplementedException("Not implemented replacement variable {}", *replacement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace Shader {
|
||||||
enum class ReplaceConstant : u32 {
|
enum class ReplaceConstant : u32 {
|
||||||
BaseInstance,
|
BaseInstance,
|
||||||
BaseVertex,
|
BaseVertex,
|
||||||
|
DrawID,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TextureType : u32 {
|
enum class TextureType : u32 {
|
||||||
|
|
|
@ -220,9 +220,6 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
void Maxwell3D::RefreshParametersImpl() {
|
void Maxwell3D::RefreshParametersImpl() {
|
||||||
if (!Settings::IsGPULevelHigh()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
size_t current_index = 0;
|
size_t current_index = 0;
|
||||||
for (auto& segment : macro_segments) {
|
for (auto& segment : macro_segments) {
|
||||||
if (segment.first == 0) {
|
if (segment.first == 0) {
|
||||||
|
@ -448,9 +445,11 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount,
|
||||||
case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 15:
|
case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 15:
|
||||||
ProcessCBMultiData(base_start, amount);
|
ProcessCBMultiData(base_start, amount);
|
||||||
break;
|
break;
|
||||||
case MAXWELL3D_REG_INDEX(inline_data):
|
case MAXWELL3D_REG_INDEX(inline_data): {
|
||||||
|
ASSERT(methods_pending == amount);
|
||||||
upload_state.ProcessData(base_start, amount);
|
upload_state.ProcessData(base_start, amount);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
for (u32 i = 0; i < amount; i++) {
|
for (u32 i = 0; i < amount; i++) {
|
||||||
CallMethod(method, base_start[i], methods_pending - i <= 1);
|
CallMethod(method, base_start[i], methods_pending - i <= 1);
|
||||||
|
@ -537,7 +536,7 @@ void Maxwell3D::ProcessQueryGet() {
|
||||||
void Maxwell3D::ProcessQueryCondition() {
|
void Maxwell3D::ProcessQueryCondition() {
|
||||||
const GPUVAddr condition_address{regs.render_enable.Address()};
|
const GPUVAddr condition_address{regs.render_enable.Address()};
|
||||||
switch (regs.render_enable_override) {
|
switch (regs.render_enable_override) {
|
||||||
case Regs::RenderEnable::Override::AlwaysRender: {
|
case Regs::RenderEnable::Override::AlwaysRender:
|
||||||
execute_on = true;
|
execute_on = true;
|
||||||
break;
|
break;
|
||||||
case Regs::RenderEnable::Override::NeverRender:
|
case Regs::RenderEnable::Override::NeverRender:
|
||||||
|
@ -586,7 +585,6 @@ void Maxwell3D::ProcessQueryCondition() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Maxwell3D::ProcessCounterReset() {
|
void Maxwell3D::ProcessCounterReset() {
|
||||||
|
|
|
@ -1218,12 +1218,12 @@ public:
|
||||||
|
|
||||||
struct Window {
|
struct Window {
|
||||||
union {
|
union {
|
||||||
u32 raw_1;
|
u32 raw_x;
|
||||||
BitField<0, 16, u32> x_min;
|
BitField<0, 16, u32> x_min;
|
||||||
BitField<16, 16, u32> x_max;
|
BitField<16, 16, u32> x_max;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
u32 raw_2;
|
u32 raw_y;
|
||||||
BitField<0, 16, u32> y_min;
|
BitField<0, 16, u32> y_min;
|
||||||
BitField<16, 16, u32> y_max;
|
BitField<16, 16, u32> y_max;
|
||||||
};
|
};
|
||||||
|
@ -3034,6 +3034,7 @@ public:
|
||||||
enum class HLEReplacementAttributeType : u32 {
|
enum class HLEReplacementAttributeType : u32 {
|
||||||
BaseVertex = 0x0,
|
BaseVertex = 0x0,
|
||||||
BaseInstance = 0x1,
|
BaseInstance = 0x1,
|
||||||
|
DrawID = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetHLEReplacementAttributeType(u32 bank, u32 offset, HLEReplacementAttributeType name);
|
void SetHLEReplacementAttributeType(u32 bank, u32 offset, HLEReplacementAttributeType name);
|
||||||
|
@ -3112,6 +3113,10 @@ public:
|
||||||
/// Handles a write to the CB_BIND register.
|
/// Handles a write to the CB_BIND register.
|
||||||
void ProcessCBBind(size_t stage_index);
|
void ProcessCBBind(size_t stage_index);
|
||||||
|
|
||||||
|
/// Handles a write to the CB_DATA[i] register.
|
||||||
|
void ProcessCBData(u32 value);
|
||||||
|
void ProcessCBMultiData(const u32* start_base, u32 amount);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeRegisterDefaults();
|
void InitializeRegisterDefaults();
|
||||||
|
|
||||||
|
@ -3163,10 +3168,6 @@ private:
|
||||||
/// Handles writes to syncing register.
|
/// Handles writes to syncing register.
|
||||||
void ProcessSyncPoint();
|
void ProcessSyncPoint();
|
||||||
|
|
||||||
/// Handles a write to the CB_DATA[i] register.
|
|
||||||
void ProcessCBData(u32 value);
|
|
||||||
void ProcessCBMultiData(const u32* start_base, u32 amount);
|
|
||||||
|
|
||||||
/// Returns a query's value or an empty object if the value will be deferred through a cache.
|
/// Returns a query's value or an empty object if the value will be deferred through a cache.
|
||||||
std::optional<u64> GetQueryResult();
|
std::optional<u64> GetQueryResult();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "video_core/macro/macro_jit_x64.h"
|
#include "video_core/macro/macro_jit_x64.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MICROPROFILE_DEFINE(MacroHLE, "GPU", "Execute macro hle", MP_RGB(128, 192, 192));
|
MICROPROFILE_DEFINE(MacroHLE, "GPU", "Execute macro HLE", MP_RGB(128, 192, 192));
|
||||||
|
|
||||||
namespace Tegra {
|
namespace Tegra {
|
||||||
|
|
||||||
|
@ -107,14 +107,15 @@ void MacroEngine::Execute(u32 method, const std::vector<u32>& parameters) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto hle_program = hle_macros->GetHLEProgram(cache_info.hash)) {
|
auto hle_program = hle_macros->GetHLEProgram(cache_info.hash);
|
||||||
|
if (!hle_program || Settings::values.disable_macro_hle) {
|
||||||
|
maxwell3d.RefreshParameters();
|
||||||
|
cache_info.lle_program->Execute(parameters, method);
|
||||||
|
} else {
|
||||||
cache_info.has_hle_program = true;
|
cache_info.has_hle_program = true;
|
||||||
cache_info.hle_program = std::move(hle_program);
|
cache_info.hle_program = std::move(hle_program);
|
||||||
MICROPROFILE_SCOPE(MacroHLE);
|
MICROPROFILE_SCOPE(MacroHLE);
|
||||||
cache_info.hle_program->Execute(parameters, method);
|
cache_info.hle_program->Execute(parameters, method);
|
||||||
} else {
|
|
||||||
maxwell3d.RefreshParameters();
|
|
||||||
cache_info.lle_program->Execute(parameters, method);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -15,28 +15,28 @@
|
||||||
|
|
||||||
namespace Tegra {
|
namespace Tegra {
|
||||||
|
|
||||||
using Maxwell = Engines::Maxwell3D;
|
using Maxwell3D = Engines::Maxwell3D;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool IsTopologySafe(Maxwell::Regs::PrimitiveTopology topology) {
|
bool IsTopologySafe(Maxwell3D::Regs::PrimitiveTopology topology) {
|
||||||
switch (topology) {
|
switch (topology) {
|
||||||
case Maxwell::Regs::PrimitiveTopology::Points:
|
case Maxwell3D::Regs::PrimitiveTopology::Points:
|
||||||
case Maxwell::Regs::PrimitiveTopology::Lines:
|
case Maxwell3D::Regs::PrimitiveTopology::Lines:
|
||||||
case Maxwell::Regs::PrimitiveTopology::LineLoop:
|
case Maxwell3D::Regs::PrimitiveTopology::LineLoop:
|
||||||
case Maxwell::Regs::PrimitiveTopology::LineStrip:
|
case Maxwell3D::Regs::PrimitiveTopology::LineStrip:
|
||||||
case Maxwell::Regs::PrimitiveTopology::Triangles:
|
case Maxwell3D::Regs::PrimitiveTopology::Triangles:
|
||||||
case Maxwell::Regs::PrimitiveTopology::TriangleStrip:
|
case Maxwell3D::Regs::PrimitiveTopology::TriangleStrip:
|
||||||
case Maxwell::Regs::PrimitiveTopology::TriangleFan:
|
case Maxwell3D::Regs::PrimitiveTopology::TriangleFan:
|
||||||
case Maxwell::Regs::PrimitiveTopology::LinesAdjacency:
|
case Maxwell3D::Regs::PrimitiveTopology::LinesAdjacency:
|
||||||
case Maxwell::Regs::PrimitiveTopology::LineStripAdjacency:
|
case Maxwell3D::Regs::PrimitiveTopology::LineStripAdjacency:
|
||||||
case Maxwell::Regs::PrimitiveTopology::TrianglesAdjacency:
|
case Maxwell3D::Regs::PrimitiveTopology::TrianglesAdjacency:
|
||||||
case Maxwell::Regs::PrimitiveTopology::TriangleStripAdjacency:
|
case Maxwell3D::Regs::PrimitiveTopology::TriangleStripAdjacency:
|
||||||
case Maxwell::Regs::PrimitiveTopology::Patches:
|
case Maxwell3D::Regs::PrimitiveTopology::Patches:
|
||||||
return true;
|
return true;
|
||||||
case Maxwell::Regs::PrimitiveTopology::Quads:
|
case Maxwell3D::Regs::PrimitiveTopology::Quads:
|
||||||
case Maxwell::Regs::PrimitiveTopology::QuadStrip:
|
case Maxwell3D::Regs::PrimitiveTopology::QuadStrip:
|
||||||
case Maxwell::Regs::PrimitiveTopology::Polygon:
|
case Maxwell3D::Regs::PrimitiveTopology::Polygon:
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -44,20 +44,55 @@ bool IsTopologySafe(Maxwell::Regs::PrimitiveTopology topology) {
|
||||||
|
|
||||||
class HLEMacroImpl : public CachedMacro {
|
class HLEMacroImpl : public CachedMacro {
|
||||||
public:
|
public:
|
||||||
explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {}
|
explicit HLEMacroImpl(Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Engines::Maxwell3D& maxwell3d;
|
Maxwell3D& maxwell3d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class HLE_DrawArrays final : public HLEMacroImpl {
|
||||||
|
public:
|
||||||
|
explicit HLE_DrawArrays(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
|
maxwell3d.RefreshParameters();
|
||||||
|
|
||||||
|
auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[0]);
|
||||||
|
maxwell3d.draw_manager->DrawArray(topology, parameters[1], parameters[2],
|
||||||
|
maxwell3d.regs.global_base_instance_index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLE_DrawIndexed final : public HLEMacroImpl {
|
||||||
|
public:
|
||||||
|
explicit HLE_DrawIndexed(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
|
maxwell3d.RefreshParameters();
|
||||||
|
maxwell3d.regs.index_buffer.start_addr_high = parameters[1];
|
||||||
|
maxwell3d.regs.index_buffer.start_addr_low = parameters[2];
|
||||||
|
maxwell3d.regs.index_buffer.format =
|
||||||
|
static_cast<Engines::Maxwell3D::Regs::IndexFormat>(parameters[3]);
|
||||||
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
|
|
||||||
|
auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[0]);
|
||||||
|
maxwell3d.draw_manager->DrawIndex(topology, 0, parameters[4],
|
||||||
|
maxwell3d.regs.global_base_vertex_index,
|
||||||
|
maxwell3d.regs.global_base_instance_index, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @note: these macros have two versions, a normal and extended version, with the extended version
|
||||||
|
* also assigning the base vertex/instance.
|
||||||
|
*/
|
||||||
template <bool extended>
|
template <bool extended>
|
||||||
class HLE_DrawArraysIndirect final : public HLEMacroImpl {
|
class HLE_DrawArraysIndirect final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d_)
|
explicit HLE_DrawArraysIndirect(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
: HLEMacroImpl(maxwell3d_) {}
|
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[0]);
|
auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[0]);
|
||||||
if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) {
|
if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) {
|
||||||
Fallback(parameters);
|
Fallback(parameters);
|
||||||
return;
|
return;
|
||||||
|
@ -73,15 +108,15 @@ public:
|
||||||
params.stride = 0;
|
params.stride = 0;
|
||||||
|
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x640, Maxwell::HLEReplacementAttributeType::BaseInstance);
|
0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxwell3d.draw_manager->DrawArrayIndirect(topology);
|
maxwell3d.draw_manager->DrawArrayIndirect(topology);
|
||||||
|
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,14 +125,14 @@ private:
|
||||||
void Fallback(const std::vector<u32>& parameters) {
|
void Fallback(const std::vector<u32>& parameters) {
|
||||||
SCOPE_EXIT({
|
SCOPE_EXIT({
|
||||||
if (extended) {
|
if (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
|
const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]);
|
||||||
|
|
||||||
auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[0]);
|
auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[0]);
|
||||||
const u32 vertex_first = parameters[3];
|
const u32 vertex_first = parameters[3];
|
||||||
const u32 vertex_count = parameters[1];
|
const u32 vertex_count = parameters[1];
|
||||||
|
|
||||||
|
@ -111,9 +146,9 @@ private:
|
||||||
const u32 base_instance = parameters[4];
|
const u32 base_instance = parameters[4];
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.regs.global_base_instance_index = base_instance;
|
maxwell3d.regs.global_base_instance_index = base_instance;
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x640, Maxwell::HLEReplacementAttributeType::BaseInstance);
|
0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance,
|
maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance,
|
||||||
|
@ -121,19 +156,23 @@ private:
|
||||||
|
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.regs.global_base_instance_index = 0;
|
maxwell3d.regs.global_base_instance_index = 0;
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @note: these macros have two versions, a normal and extended version, with the extended version
|
||||||
|
* also assigning the base vertex/instance.
|
||||||
|
*/
|
||||||
template <bool extended>
|
template <bool extended>
|
||||||
class HLE_DrawIndexedIndirect final : public HLEMacroImpl {
|
class HLE_DrawIndexedIndirect final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
explicit HLE_DrawIndexedIndirect(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[0]);
|
auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[0]);
|
||||||
if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) {
|
if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) {
|
||||||
Fallback(parameters);
|
Fallback(parameters);
|
||||||
return;
|
return;
|
||||||
|
@ -147,11 +186,11 @@ public:
|
||||||
maxwell3d.regs.global_base_instance_index = base_instance;
|
maxwell3d.regs.global_base_instance_index = base_instance;
|
||||||
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x640, Maxwell::HLEReplacementAttributeType::BaseVertex);
|
0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex);
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance);
|
0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance);
|
||||||
}
|
}
|
||||||
auto& params = maxwell3d.draw_manager->GetIndirectParams();
|
auto& params = maxwell3d.draw_manager->GetIndirectParams();
|
||||||
params.is_indexed = true;
|
params.is_indexed = true;
|
||||||
|
@ -167,7 +206,7 @@ public:
|
||||||
maxwell3d.regs.global_base_vertex_index = 0x0;
|
maxwell3d.regs.global_base_vertex_index = 0x0;
|
||||||
maxwell3d.regs.global_base_instance_index = 0x0;
|
maxwell3d.regs.global_base_instance_index = 0x0;
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,22 +222,22 @@ private:
|
||||||
maxwell3d.regs.global_base_instance_index = base_instance;
|
maxwell3d.regs.global_base_instance_index = base_instance;
|
||||||
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x640, Maxwell::HLEReplacementAttributeType::BaseVertex);
|
0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex);
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance);
|
0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxwell3d.draw_manager->DrawIndex(
|
maxwell3d.draw_manager->DrawIndex(
|
||||||
static_cast<Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology>(parameters[0]),
|
static_cast<Tegra::Maxwell3D::Regs::PrimitiveTopology>(parameters[0]), parameters[3],
|
||||||
parameters[3], parameters[1], element_base, base_instance, instance_count);
|
parameters[1], element_base, base_instance, instance_count);
|
||||||
|
|
||||||
maxwell3d.regs.vertex_id_base = 0x0;
|
maxwell3d.regs.vertex_id_base = 0x0;
|
||||||
maxwell3d.regs.global_base_vertex_index = 0x0;
|
maxwell3d.regs.global_base_vertex_index = 0x0;
|
||||||
maxwell3d.regs.global_base_instance_index = 0x0;
|
maxwell3d.regs.global_base_instance_index = 0x0;
|
||||||
if constexpr (extended) {
|
if constexpr (extended) {
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,13 +245,13 @@ private:
|
||||||
|
|
||||||
class HLE_MultiLayerClear final : public HLEMacroImpl {
|
class HLE_MultiLayerClear final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_MultiLayerClear(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
explicit HLE_MultiLayerClear(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
ASSERT(parameters.size() == 1);
|
ASSERT(parameters.size() == 1);
|
||||||
|
|
||||||
const Engines::Maxwell3D::Regs::ClearSurface clear_params{parameters[0]};
|
const Maxwell3D::Regs::ClearSurface clear_params{parameters[0]};
|
||||||
const u32 rt_index = clear_params.RT;
|
const u32 rt_index = clear_params.RT;
|
||||||
const u32 num_layers = maxwell3d.regs.rt[rt_index].depth;
|
const u32 num_layers = maxwell3d.regs.rt[rt_index].depth;
|
||||||
ASSERT(clear_params.layer == 0);
|
ASSERT(clear_params.layer == 0);
|
||||||
|
@ -224,11 +263,10 @@ public:
|
||||||
|
|
||||||
class HLE_MultiDrawIndexedIndirectCount final : public HLEMacroImpl {
|
class HLE_MultiDrawIndexedIndirectCount final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_MultiDrawIndexedIndirectCount(Engines::Maxwell3D& maxwell3d_)
|
explicit HLE_MultiDrawIndexedIndirectCount(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
: HLEMacroImpl(maxwell3d_) {}
|
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
const auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[2]);
|
const auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[2]);
|
||||||
if (!IsTopologySafe(topology)) {
|
if (!IsTopologySafe(topology)) {
|
||||||
Fallback(parameters);
|
Fallback(parameters);
|
||||||
return;
|
return;
|
||||||
|
@ -258,23 +296,24 @@ public:
|
||||||
params.max_draw_counts = draw_count;
|
params.max_draw_counts = draw_count;
|
||||||
params.stride = stride;
|
params.stride = stride;
|
||||||
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.SetHLEReplacementAttributeType(0, 0x640,
|
|
||||||
Maxwell::HLEReplacementAttributeType::BaseVertex);
|
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance);
|
0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex);
|
||||||
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
|
0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance);
|
||||||
|
maxwell3d.SetHLEReplacementAttributeType(0, 0x648,
|
||||||
|
Maxwell3D::HLEReplacementAttributeType::DrawID);
|
||||||
maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate);
|
maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate);
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Fallback(const std::vector<u32>& parameters) {
|
void Fallback(const std::vector<u32>& parameters) {
|
||||||
SCOPE_EXIT({
|
SCOPE_EXIT({
|
||||||
// Clean everything.
|
|
||||||
// Clean everything.
|
// Clean everything.
|
||||||
maxwell3d.regs.vertex_id_base = 0x0;
|
maxwell3d.regs.vertex_id_base = 0x0;
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::None;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::None;
|
||||||
maxwell3d.replace_table.clear();
|
maxwell3d.replace_table.clear();
|
||||||
});
|
});
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
|
@ -284,7 +323,7 @@ private:
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto topology = static_cast<Maxwell::Regs::PrimitiveTopology>(parameters[2]);
|
const auto topology = static_cast<Maxwell3D::Regs::PrimitiveTopology>(parameters[2]);
|
||||||
const u32 padding = parameters[3];
|
const u32 padding = parameters[3];
|
||||||
const std::size_t max_draws = parameters[4];
|
const std::size_t max_draws = parameters[4];
|
||||||
|
|
||||||
|
@ -298,11 +337,13 @@ private:
|
||||||
const u32 base_vertex = parameters[base + 3];
|
const u32 base_vertex = parameters[base + 3];
|
||||||
const u32 base_instance = parameters[base + 4];
|
const u32 base_instance = parameters[base + 4];
|
||||||
maxwell3d.regs.vertex_id_base = base_vertex;
|
maxwell3d.regs.vertex_id_base = base_vertex;
|
||||||
maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro;
|
maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro;
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x640, Maxwell::HLEReplacementAttributeType::BaseVertex);
|
0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex);
|
||||||
maxwell3d.SetHLEReplacementAttributeType(
|
maxwell3d.SetHLEReplacementAttributeType(
|
||||||
0, 0x644, Maxwell::HLEReplacementAttributeType::BaseInstance);
|
0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance);
|
||||||
|
maxwell3d.CallMethod(0x8e3, 0x648, true);
|
||||||
|
maxwell3d.CallMethod(0x8e4, static_cast<u32>(index), true);
|
||||||
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
|
||||||
maxwell3d.draw_manager->DrawIndex(topology, parameters[base + 2], parameters[base],
|
maxwell3d.draw_manager->DrawIndex(topology, parameters[base + 2], parameters[base],
|
||||||
base_vertex, base_instance, parameters[base + 1]);
|
base_vertex, base_instance, parameters[base + 1]);
|
||||||
|
@ -312,7 +353,7 @@ private:
|
||||||
|
|
||||||
class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl {
|
class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_C713C83D8F63CCF3(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
explicit HLE_C713C83D8F63CCF3(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
|
@ -328,7 +369,7 @@ public:
|
||||||
|
|
||||||
class HLE_D7333D26E0A93EDE final : public HLEMacroImpl {
|
class HLE_D7333D26E0A93EDE final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_D7333D26E0A93EDE(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
explicit HLE_D7333D26E0A93EDE(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
|
@ -344,7 +385,7 @@ public:
|
||||||
|
|
||||||
class HLE_BindShader final : public HLEMacroImpl {
|
class HLE_BindShader final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_BindShader(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
explicit HLE_BindShader(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
|
@ -374,7 +415,7 @@ public:
|
||||||
|
|
||||||
class HLE_SetRasterBoundingBox final : public HLEMacroImpl {
|
class HLE_SetRasterBoundingBox final : public HLEMacroImpl {
|
||||||
public:
|
public:
|
||||||
explicit HLE_SetRasterBoundingBox(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
explicit HLE_SetRasterBoundingBox(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
maxwell3d.RefreshParameters();
|
maxwell3d.RefreshParameters();
|
||||||
|
@ -387,60 +428,156 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <size_t base_size>
|
||||||
|
class HLE_ClearConstBuffer final : public HLEMacroImpl {
|
||||||
|
public:
|
||||||
|
explicit HLE_ClearConstBuffer(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
|
maxwell3d.RefreshParameters();
|
||||||
|
static constexpr std::array<u32, base_size> zeroes{};
|
||||||
|
auto& regs = maxwell3d.regs;
|
||||||
|
regs.const_buffer.size = static_cast<u32>(base_size);
|
||||||
|
regs.const_buffer.address_high = parameters[0];
|
||||||
|
regs.const_buffer.address_low = parameters[1];
|
||||||
|
regs.const_buffer.offset = 0;
|
||||||
|
maxwell3d.ProcessCBMultiData(zeroes.data(), parameters[2] * 4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLE_ClearMemory final : public HLEMacroImpl {
|
||||||
|
public:
|
||||||
|
explicit HLE_ClearMemory(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
|
maxwell3d.RefreshParameters();
|
||||||
|
|
||||||
|
const u32 needed_memory = parameters[2] / sizeof(u32);
|
||||||
|
if (needed_memory > zero_memory.size()) {
|
||||||
|
zero_memory.resize(needed_memory, 0);
|
||||||
|
}
|
||||||
|
auto& regs = maxwell3d.regs;
|
||||||
|
regs.upload.line_length_in = parameters[2];
|
||||||
|
regs.upload.line_count = 1;
|
||||||
|
regs.upload.dest.address_high = parameters[0];
|
||||||
|
regs.upload.dest.address_low = parameters[1];
|
||||||
|
maxwell3d.CallMethod(static_cast<size_t>(MAXWELL3D_REG_INDEX(launch_dma)), 0x1011, true);
|
||||||
|
maxwell3d.CallMultiMethod(static_cast<size_t>(MAXWELL3D_REG_INDEX(inline_data)),
|
||||||
|
zero_memory.data(), needed_memory, needed_memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<u32> zero_memory;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLE_TransformFeedbackSetup final : public HLEMacroImpl {
|
||||||
|
public:
|
||||||
|
explicit HLE_TransformFeedbackSetup(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {}
|
||||||
|
|
||||||
|
void Execute(const std::vector<u32>& parameters, [[maybe_unused]] u32 method) override {
|
||||||
|
maxwell3d.RefreshParameters();
|
||||||
|
|
||||||
|
auto& regs = maxwell3d.regs;
|
||||||
|
regs.transform_feedback_enabled = 1;
|
||||||
|
regs.transform_feedback.buffers[0].start_offset = 0;
|
||||||
|
regs.transform_feedback.buffers[1].start_offset = 0;
|
||||||
|
regs.transform_feedback.buffers[2].start_offset = 0;
|
||||||
|
regs.transform_feedback.buffers[3].start_offset = 0;
|
||||||
|
|
||||||
|
regs.upload.line_length_in = 4;
|
||||||
|
regs.upload.line_count = 1;
|
||||||
|
regs.upload.dest.address_high = parameters[0];
|
||||||
|
regs.upload.dest.address_low = parameters[1];
|
||||||
|
maxwell3d.CallMethod(static_cast<size_t>(MAXWELL3D_REG_INDEX(launch_dma)), 0x1011, true);
|
||||||
|
maxwell3d.CallMethod(static_cast<size_t>(MAXWELL3D_REG_INDEX(inline_data)),
|
||||||
|
regs.transform_feedback.controls[0].stride, true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {
|
HLEMacro::HLEMacro(Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {
|
||||||
|
builders.emplace(0xDD6A7FA92A7D2674ULL,
|
||||||
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
|
return std::make_unique<HLE_DrawArrays>(maxwell3d__);
|
||||||
|
}));
|
||||||
builders.emplace(0x0D61FC9FAAC9FCADULL,
|
builders.emplace(0x0D61FC9FAAC9FCADULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawArraysIndirect<false>>(maxwell3d__);
|
return std::make_unique<HLE_DrawArraysIndirect<false>>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x8A4D173EB99A8603ULL,
|
builders.emplace(0x8A4D173EB99A8603ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawArraysIndirect<true>>(maxwell3d__);
|
return std::make_unique<HLE_DrawArraysIndirect<true>>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
|
builders.emplace(0x2DB33AADB741839CULL,
|
||||||
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
|
return std::make_unique<HLE_DrawIndexed>(maxwell3d__);
|
||||||
|
}));
|
||||||
builders.emplace(0x771BB18C62444DA0ULL,
|
builders.emplace(0x771BB18C62444DA0ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawIndexedIndirect<false>>(maxwell3d__);
|
return std::make_unique<HLE_DrawIndexedIndirect<false>>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x0217920100488FF7ULL,
|
builders.emplace(0x0217920100488FF7ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_DrawIndexedIndirect<true>>(maxwell3d__);
|
return std::make_unique<HLE_DrawIndexedIndirect<true>>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0x3F5E74B9C9A50164ULL,
|
builders.emplace(0x3F5E74B9C9A50164ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_MultiDrawIndexedIndirectCount>(
|
return std::make_unique<HLE_MultiDrawIndexedIndirectCount>(
|
||||||
maxwell3d__);
|
maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xEAD26C3E2109B06BULL,
|
builders.emplace(0xEAD26C3E2109B06BULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_MultiLayerClear>(maxwell3d__);
|
return std::make_unique<HLE_MultiLayerClear>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xC713C83D8F63CCF3ULL,
|
builders.emplace(0xC713C83D8F63CCF3ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_C713C83D8F63CCF3>(maxwell3d__);
|
return std::make_unique<HLE_C713C83D8F63CCF3>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xD7333D26E0A93EDEULL,
|
builders.emplace(0xD7333D26E0A93EDEULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_D7333D26E0A93EDE>(maxwell3d__);
|
return std::make_unique<HLE_D7333D26E0A93EDE>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xEB29B2A09AA06D38ULL,
|
builders.emplace(0xEB29B2A09AA06D38ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_BindShader>(maxwell3d__);
|
return std::make_unique<HLE_BindShader>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
builders.emplace(0xDB1341DBEB4C8AF7ULL,
|
builders.emplace(0xDB1341DBEB4C8AF7ULL,
|
||||||
std::function<std::unique_ptr<CachedMacro>(Engines::Maxwell3D&)>(
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
[](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
return std::make_unique<HLE_SetRasterBoundingBox>(maxwell3d__);
|
return std::make_unique<HLE_SetRasterBoundingBox>(maxwell3d__);
|
||||||
}));
|
}));
|
||||||
|
builders.emplace(0x6C97861D891EDf7EULL,
|
||||||
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
|
return std::make_unique<HLE_ClearConstBuffer<0x5F00>>(maxwell3d__);
|
||||||
|
}));
|
||||||
|
builders.emplace(0xD246FDDF3A6173D7ULL,
|
||||||
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
|
return std::make_unique<HLE_ClearConstBuffer<0x7000>>(maxwell3d__);
|
||||||
|
}));
|
||||||
|
builders.emplace(0xEE4D0004BEC8ECF4ULL,
|
||||||
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
|
return std::make_unique<HLE_ClearMemory>(maxwell3d__);
|
||||||
|
}));
|
||||||
|
builders.emplace(0xFC0CF27F5FFAA661ULL,
|
||||||
|
std::function<std::unique_ptr<CachedMacro>(Maxwell3D&)>(
|
||||||
|
[](Maxwell3D& maxwell3d__) -> std::unique_ptr<CachedMacro> {
|
||||||
|
return std::make_unique<HLE_TransformFeedbackSetup>(maxwell3d__);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
HLEMacro::~HLEMacro() = default;
|
HLEMacro::~HLEMacro() = default;
|
||||||
|
|
|
@ -357,21 +357,21 @@ void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size, VideoCommon::CacheType
|
||||||
if (addr == 0 || size == 0) {
|
if (addr == 0 || size == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::TextureCache)) {
|
if (True(which & VideoCommon::CacheType::TextureCache)) {
|
||||||
std::scoped_lock lock{texture_cache.mutex};
|
std::scoped_lock lock{texture_cache.mutex};
|
||||||
texture_cache.DownloadMemory(addr, size);
|
texture_cache.DownloadMemory(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
buffer_cache.DownloadMemory(addr, size);
|
buffer_cache.DownloadMemory(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::QueryCache))) {
|
if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
||||||
query_cache.FlushRegion(addr, size);
|
query_cache.FlushRegion(addr, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RasterizerOpenGL::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheType which) {
|
bool RasterizerOpenGL::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheType which) {
|
||||||
if ((bool(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
if (buffer_cache.IsRegionGpuModified(addr, size)) {
|
if (buffer_cache.IsRegionGpuModified(addr, size)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -380,7 +380,7 @@ bool RasterizerOpenGL::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheT
|
||||||
if (!Settings::IsGPULevelHigh()) {
|
if (!Settings::IsGPULevelHigh()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::TextureCache)) {
|
if (True(which & VideoCommon::CacheType::TextureCache)) {
|
||||||
std::scoped_lock lock{texture_cache.mutex};
|
std::scoped_lock lock{texture_cache.mutex};
|
||||||
return texture_cache.IsRegionGpuModified(addr, size);
|
return texture_cache.IsRegionGpuModified(addr, size);
|
||||||
}
|
}
|
||||||
|
@ -392,18 +392,18 @@ void RasterizerOpenGL::InvalidateRegion(VAddr addr, u64 size, VideoCommon::Cache
|
||||||
if (addr == 0 || size == 0) {
|
if (addr == 0 || size == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::TextureCache)) {
|
if (True(which & VideoCommon::CacheType::TextureCache)) {
|
||||||
std::scoped_lock lock{texture_cache.mutex};
|
std::scoped_lock lock{texture_cache.mutex};
|
||||||
texture_cache.WriteMemory(addr, size);
|
texture_cache.WriteMemory(addr, size);
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::BufferCache)) {
|
if (True(which & VideoCommon::CacheType::BufferCache)) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
buffer_cache.WriteMemory(addr, size);
|
buffer_cache.WriteMemory(addr, size);
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::ShaderCache)) {
|
if (True(which & VideoCommon::CacheType::ShaderCache)) {
|
||||||
shader_cache.InvalidateRegion(addr, size);
|
shader_cache.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::QueryCache)) {
|
if (True(which & VideoCommon::CacheType::QueryCache)) {
|
||||||
query_cache.InvalidateRegion(addr, size);
|
query_cache.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -431,21 +431,21 @@ void RasterizerVulkan::FlushRegion(VAddr addr, u64 size, VideoCommon::CacheType
|
||||||
if (addr == 0 || size == 0) {
|
if (addr == 0 || size == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::TextureCache)) {
|
if (True(which & VideoCommon::CacheType::TextureCache)) {
|
||||||
std::scoped_lock lock{texture_cache.mutex};
|
std::scoped_lock lock{texture_cache.mutex};
|
||||||
texture_cache.DownloadMemory(addr, size);
|
texture_cache.DownloadMemory(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
buffer_cache.DownloadMemory(addr, size);
|
buffer_cache.DownloadMemory(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::QueryCache))) {
|
if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
||||||
query_cache.FlushRegion(addr, size);
|
query_cache.FlushRegion(addr, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RasterizerVulkan::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheType which) {
|
bool RasterizerVulkan::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheType which) {
|
||||||
if ((bool(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
if (buffer_cache.IsRegionGpuModified(addr, size)) {
|
if (buffer_cache.IsRegionGpuModified(addr, size)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -454,7 +454,7 @@ bool RasterizerVulkan::MustFlushRegion(VAddr addr, u64 size, VideoCommon::CacheT
|
||||||
if (!Settings::IsGPULevelHigh()) {
|
if (!Settings::IsGPULevelHigh()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::TextureCache)) {
|
if (True(which & VideoCommon::CacheType::TextureCache)) {
|
||||||
std::scoped_lock lock{texture_cache.mutex};
|
std::scoped_lock lock{texture_cache.mutex};
|
||||||
return texture_cache.IsRegionGpuModified(addr, size);
|
return texture_cache.IsRegionGpuModified(addr, size);
|
||||||
}
|
}
|
||||||
|
@ -465,18 +465,18 @@ void RasterizerVulkan::InvalidateRegion(VAddr addr, u64 size, VideoCommon::Cache
|
||||||
if (addr == 0 || size == 0) {
|
if (addr == 0 || size == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bool(which & VideoCommon::CacheType::TextureCache)) {
|
if (True(which & VideoCommon::CacheType::TextureCache)) {
|
||||||
std::scoped_lock lock{texture_cache.mutex};
|
std::scoped_lock lock{texture_cache.mutex};
|
||||||
texture_cache.WriteMemory(addr, size);
|
texture_cache.WriteMemory(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
std::scoped_lock lock{buffer_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex};
|
||||||
buffer_cache.WriteMemory(addr, size);
|
buffer_cache.WriteMemory(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::QueryCache))) {
|
if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
||||||
query_cache.InvalidateRegion(addr, size);
|
query_cache.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
if ((bool(which & VideoCommon::CacheType::ShaderCache))) {
|
if ((True(which & VideoCommon::CacheType::ShaderCache))) {
|
||||||
pipeline_cache.InvalidateRegion(addr, size);
|
pipeline_cache.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,4 +251,4 @@ void StateTracker::InvalidateState() {
|
||||||
StateTracker::StateTracker()
|
StateTracker::StateTracker()
|
||||||
: flags{&default_flags}, default_flags{}, invalidation_flags{MakeInvalidationFlags()} {}
|
: flags{&default_flags}, default_flags{}, invalidation_flags{MakeInvalidationFlags()} {}
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|
|
@ -357,6 +357,8 @@ std::optional<Shader::ReplaceConstant> GraphicsEnvironment::GetReplaceConstBuffe
|
||||||
return Shader::ReplaceConstant::BaseVertex;
|
return Shader::ReplaceConstant::BaseVertex;
|
||||||
case Tegra::Engines::Maxwell3D::HLEReplacementAttributeType::BaseInstance:
|
case Tegra::Engines::Maxwell3D::HLEReplacementAttributeType::BaseInstance:
|
||||||
return Shader::ReplaceConstant::BaseInstance;
|
return Shader::ReplaceConstant::BaseInstance;
|
||||||
|
case Tegra::Engines::Maxwell3D::HLEReplacementAttributeType::DrawID:
|
||||||
|
return Shader::ReplaceConstant::DrawID;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,6 +563,7 @@ void Config::ReadDebuggingValues() {
|
||||||
ReadBasicSetting(Settings::values.reporting_services);
|
ReadBasicSetting(Settings::values.reporting_services);
|
||||||
ReadBasicSetting(Settings::values.quest_flag);
|
ReadBasicSetting(Settings::values.quest_flag);
|
||||||
ReadBasicSetting(Settings::values.disable_macro_jit);
|
ReadBasicSetting(Settings::values.disable_macro_jit);
|
||||||
|
ReadBasicSetting(Settings::values.disable_macro_hle);
|
||||||
ReadBasicSetting(Settings::values.extended_logging);
|
ReadBasicSetting(Settings::values.extended_logging);
|
||||||
ReadBasicSetting(Settings::values.use_debug_asserts);
|
ReadBasicSetting(Settings::values.use_debug_asserts);
|
||||||
ReadBasicSetting(Settings::values.use_auto_stub);
|
ReadBasicSetting(Settings::values.use_auto_stub);
|
||||||
|
@ -1200,6 +1201,7 @@ void Config::SaveDebuggingValues() {
|
||||||
WriteBasicSetting(Settings::values.quest_flag);
|
WriteBasicSetting(Settings::values.quest_flag);
|
||||||
WriteBasicSetting(Settings::values.use_debug_asserts);
|
WriteBasicSetting(Settings::values.use_debug_asserts);
|
||||||
WriteBasicSetting(Settings::values.disable_macro_jit);
|
WriteBasicSetting(Settings::values.disable_macro_jit);
|
||||||
|
WriteBasicSetting(Settings::values.disable_macro_hle);
|
||||||
WriteBasicSetting(Settings::values.enable_all_controllers);
|
WriteBasicSetting(Settings::values.enable_all_controllers);
|
||||||
WriteBasicSetting(Settings::values.create_crash_dumps);
|
WriteBasicSetting(Settings::values.create_crash_dumps);
|
||||||
WriteBasicSetting(Settings::values.perform_vulkan_check);
|
WriteBasicSetting(Settings::values.perform_vulkan_check);
|
||||||
|
|
|
@ -73,6 +73,8 @@ void ConfigureDebug::SetConfiguration() {
|
||||||
ui->dump_macros->setChecked(Settings::values.dump_macros.GetValue());
|
ui->dump_macros->setChecked(Settings::values.dump_macros.GetValue());
|
||||||
ui->disable_macro_jit->setEnabled(runtime_lock);
|
ui->disable_macro_jit->setEnabled(runtime_lock);
|
||||||
ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit.GetValue());
|
ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit.GetValue());
|
||||||
|
ui->disable_macro_hle->setEnabled(runtime_lock);
|
||||||
|
ui->disable_macro_hle->setChecked(Settings::values.disable_macro_hle.GetValue());
|
||||||
ui->disable_loop_safety_checks->setEnabled(runtime_lock);
|
ui->disable_loop_safety_checks->setEnabled(runtime_lock);
|
||||||
ui->disable_loop_safety_checks->setChecked(
|
ui->disable_loop_safety_checks->setChecked(
|
||||||
Settings::values.disable_shader_loop_safety_checks.GetValue());
|
Settings::values.disable_shader_loop_safety_checks.GetValue());
|
||||||
|
@ -117,6 +119,7 @@ void ConfigureDebug::ApplyConfiguration() {
|
||||||
Settings::values.disable_shader_loop_safety_checks =
|
Settings::values.disable_shader_loop_safety_checks =
|
||||||
ui->disable_loop_safety_checks->isChecked();
|
ui->disable_loop_safety_checks->isChecked();
|
||||||
Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked();
|
Settings::values.disable_macro_jit = ui->disable_macro_jit->isChecked();
|
||||||
|
Settings::values.disable_macro_hle = ui->disable_macro_hle->isChecked();
|
||||||
Settings::values.extended_logging = ui->extended_logging->isChecked();
|
Settings::values.extended_logging = ui->extended_logging->isChecked();
|
||||||
Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked();
|
Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked();
|
||||||
UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked();
|
UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked();
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QCheckBox" name="dump_macros">
|
<widget class="QCheckBox" name="dump_macros">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -202,6 +202,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QCheckBox" name="disable_macro_hle">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>When checked, it disables the macro HLE functions. Enabling this makes games run slower</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable Macro HLE</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="enable_shader_feedback">
|
<widget class="QCheckBox" name="enable_shader_feedback">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
|
|
@ -348,6 +348,7 @@ void Config::ReadValues() {
|
||||||
ReadSetting("Debugging", Settings::values.use_debug_asserts);
|
ReadSetting("Debugging", Settings::values.use_debug_asserts);
|
||||||
ReadSetting("Debugging", Settings::values.use_auto_stub);
|
ReadSetting("Debugging", Settings::values.use_auto_stub);
|
||||||
ReadSetting("Debugging", Settings::values.disable_macro_jit);
|
ReadSetting("Debugging", Settings::values.disable_macro_jit);
|
||||||
|
ReadSetting("Debugging", Settings::values.disable_macro_hle);
|
||||||
ReadSetting("Debugging", Settings::values.use_gdbstub);
|
ReadSetting("Debugging", Settings::values.use_gdbstub);
|
||||||
ReadSetting("Debugging", Settings::values.gdbstub_port);
|
ReadSetting("Debugging", Settings::values.gdbstub_port);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue