Maxwell3D: Rework the dirty system to be more consistant and scaleable

This commit is contained in:
Fernando Sahmkow 2019-07-10 15:38:31 -04:00 committed by FernandoS27
parent 223a535f3f
commit f2e7b29c14
10 changed files with 211 additions and 80 deletions

View File

@ -22,7 +22,7 @@ void DmaPusher::DispatchCalls() {
MICROPROFILE_SCOPE(DispatchCalls); MICROPROFILE_SCOPE(DispatchCalls);
// On entering GPU code, assume all memory may be touched by the ARM core. // On entering GPU code, assume all memory may be touched by the ARM core.
gpu.Maxwell3D().dirty_flags.OnMemoryWrite(); gpu.Maxwell3D().dirty.OnMemoryWrite();
dma_pushbuffer_subindex = 0; dma_pushbuffer_subindex = 0;

View File

@ -37,7 +37,7 @@ void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) {
const bool is_last_call = method_call.IsLastCall(); const bool is_last_call = method_call.IsLastCall();
upload_state.ProcessData(method_call.argument, is_last_call); upload_state.ProcessData(method_call.argument, is_last_call);
if (is_last_call) { if (is_last_call) {
system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite(); system.GPU().Maxwell3D().dirty.OnMemoryWrite();
} }
break; break;
} }

View File

@ -34,7 +34,7 @@ void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) {
const bool is_last_call = method_call.IsLastCall(); const bool is_last_call = method_call.IsLastCall();
upload_state.ProcessData(method_call.argument, is_last_call); upload_state.ProcessData(method_call.argument, is_last_call);
if (is_last_call) { if (is_last_call) {
system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite(); system.GPU().Maxwell3D().dirty.OnMemoryWrite();
} }
break; break;
} }

View File

@ -22,6 +22,7 @@ Maxwell3D::Maxwell3D(Core::System& system, VideoCore::RasterizerInterface& raste
MemoryManager& memory_manager) MemoryManager& memory_manager)
: system{system}, rasterizer{rasterizer}, memory_manager{memory_manager}, : system{system}, rasterizer{rasterizer}, memory_manager{memory_manager},
macro_interpreter{*this}, upload_state{memory_manager, regs.upload} { macro_interpreter{*this}, upload_state{memory_manager, regs.upload} {
InitDirtySettings();
InitializeRegisterDefaults(); InitializeRegisterDefaults();
} }
@ -86,6 +87,80 @@ void Maxwell3D::InitializeRegisterDefaults() {
regs.rt_separate_frag_data = 1; regs.rt_separate_frag_data = 1;
} }
#define DIRTY_REGS_POS(field_name) (offsetof(Maxwell3D::DirtyRegs, field_name))
void Maxwell3D::InitDirtySettings() {
const auto set_block = [this](const u32 start, const u32 range, const u8 position) {
const u32 end = start + range;
for (std::size_t i = start; i < end; i++) {
dirty_pointers[i] = position;
}
};
for (std::size_t i = 0; i < DirtyRegs::NUM_REGS; i++) {
dirty.regs[i] = true;
}
// Init Render Targets
constexpr u32 registers_per_rt = sizeof(regs.rt[0]) / sizeof(u32);
constexpr u32 rt_start_reg = MAXWELL3D_REG_INDEX(rt);
constexpr u32 rt_end_reg = rt_start_reg + registers_per_rt * 8;
u32 rt_dirty_reg = DIRTY_REGS_POS(render_target);
for (u32 rt_reg = rt_start_reg; rt_reg < rt_end_reg; rt_reg += registers_per_rt) {
set_block(rt_reg, registers_per_rt, rt_dirty_reg);
rt_dirty_reg++;
}
constexpr u32 depth_buffer_flag = DIRTY_REGS_POS(depth_buffer);
dirty_pointers[MAXWELL3D_REG_INDEX(zeta_enable)] = depth_buffer_flag;
dirty_pointers[MAXWELL3D_REG_INDEX(zeta_width)] = depth_buffer_flag;
dirty_pointers[MAXWELL3D_REG_INDEX(zeta_height)] = depth_buffer_flag;
constexpr u32 registers_in_zeta = sizeof(regs.zeta) / sizeof(u32);
constexpr u32 zeta_reg = MAXWELL3D_REG_INDEX(zeta);
set_block(zeta_reg, registers_in_zeta, depth_buffer_flag);
// Init Vertex Arrays
constexpr u32 vertex_array_start = MAXWELL3D_REG_INDEX(vertex_array);
constexpr u32 vertex_array_size = sizeof(regs.vertex_array[0]) / sizeof(u32);
constexpr u32 vertex_array_end = vertex_array_start + vertex_array_size * Regs::NumVertexArrays;
u32 va_reg = DIRTY_REGS_POS(vertex_array);
u32 vi_reg = DIRTY_REGS_POS(vertex_instance);
for (u32 vertex_reg = vertex_array_start; vertex_reg < vertex_array_end;
vertex_reg += vertex_array_size) {
set_block(vertex_reg, 3, va_reg);
// The divisor concerns vertex array instances
dirty_pointers[vertex_reg + 3] = vi_reg;
va_reg++;
vi_reg++;
}
constexpr u32 vertex_limit_start = MAXWELL3D_REG_INDEX(vertex_array_limit);
constexpr u32 vertex_limit_size = sizeof(regs.vertex_array_limit[0]) / sizeof(u32);
constexpr u32 vertex_limit_end = vertex_limit_start + vertex_limit_size * Regs::NumVertexArrays;
va_reg = DIRTY_REGS_POS(vertex_array);
for (u32 vertex_reg = vertex_limit_start; vertex_reg < vertex_limit_end;
vertex_reg += vertex_limit_size) {
set_block(vertex_reg, vertex_limit_size, va_reg);
va_reg++;
}
constexpr u32 vertex_instance_start = MAXWELL3D_REG_INDEX(instanced_arrays);
constexpr u32 vertex_instance_size =
sizeof(regs.instanced_arrays.is_instanced[0]) / sizeof(u32);
constexpr u32 vertex_instance_end =
vertex_instance_start + vertex_instance_size * Regs::NumVertexArrays;
vi_reg = DIRTY_REGS_POS(vertex_instance);
for (u32 vertex_reg = vertex_instance_start; vertex_reg < vertex_instance_end;
vertex_reg += vertex_instance_size) {
set_block(vertex_reg, vertex_instance_size, vi_reg);
vi_reg++;
}
set_block(MAXWELL3D_REG_INDEX(vertex_attrib_format), regs.vertex_attrib_format.size(),
DIRTY_REGS_POS(vertex_attrib_format));
// Init Shaders
constexpr u32 shader_registers_count =
sizeof(regs.shader_config[0]) * Regs::MaxShaderProgram / sizeof(u32);
set_block(MAXWELL3D_REG_INDEX(shader_config[0]), shader_registers_count,
DIRTY_REGS_POS(shaders));
}
void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) {
// Reset the current macro. // Reset the current macro.
executing_macro = 0; executing_macro = 0;
@ -143,49 +218,19 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) {
if (regs.reg_array[method] != method_call.argument) { if (regs.reg_array[method] != method_call.argument) {
regs.reg_array[method] = method_call.argument; regs.reg_array[method] = method_call.argument;
// Color buffers std::size_t dirty_reg = dirty_pointers[method];
constexpr u32 first_rt_reg = MAXWELL3D_REG_INDEX(rt); if (dirty_reg) {
constexpr u32 registers_per_rt = sizeof(regs.rt[0]) / sizeof(u32); dirty.regs[dirty_reg] = true;
if (method >= first_rt_reg && if (dirty_reg >= DIRTY_REGS_POS(vertex_array) &&
method < first_rt_reg + registers_per_rt * Regs::NumRenderTargets) { dirty_reg < DIRTY_REGS_POS(vertex_array_buffers)) {
const std::size_t rt_index = (method - first_rt_reg) / registers_per_rt; dirty.vertex_array_buffers = true;
dirty_flags.color_buffer.set(rt_index); } else if (dirty_reg >= DIRTY_REGS_POS(vertex_instance) &&
} dirty_reg < DIRTY_REGS_POS(vertex_instances)) {
dirty.vertex_instances = true;
// Zeta buffer } else if (dirty_reg >= DIRTY_REGS_POS(render_target) &&
constexpr u32 registers_in_zeta = sizeof(regs.zeta) / sizeof(u32); dirty_reg < DIRTY_REGS_POS(render_settings)) {
if (method == MAXWELL3D_REG_INDEX(zeta_enable) || dirty.render_settings = true;
method == MAXWELL3D_REG_INDEX(zeta_width) || }
method == MAXWELL3D_REG_INDEX(zeta_height) ||
(method >= MAXWELL3D_REG_INDEX(zeta) &&
method < MAXWELL3D_REG_INDEX(zeta) + registers_in_zeta)) {
dirty_flags.zeta_buffer = true;
}
// Shader
constexpr u32 shader_registers_count =
sizeof(regs.shader_config[0]) * Regs::MaxShaderProgram / sizeof(u32);
if (method >= MAXWELL3D_REG_INDEX(shader_config[0]) &&
method < MAXWELL3D_REG_INDEX(shader_config[0]) + shader_registers_count) {
dirty_flags.shaders = true;
}
// Vertex format
if (method >= MAXWELL3D_REG_INDEX(vertex_attrib_format) &&
method < MAXWELL3D_REG_INDEX(vertex_attrib_format) + regs.vertex_attrib_format.size()) {
dirty_flags.vertex_attrib_format = true;
}
// Vertex buffer
if (method >= MAXWELL3D_REG_INDEX(vertex_array) &&
method < MAXWELL3D_REG_INDEX(vertex_array) + 4 * Regs::NumVertexArrays) {
dirty_flags.vertex_array.set((method - MAXWELL3D_REG_INDEX(vertex_array)) >> 2);
} else if (method >= MAXWELL3D_REG_INDEX(vertex_array_limit) &&
method < MAXWELL3D_REG_INDEX(vertex_array_limit) + 2 * Regs::NumVertexArrays) {
dirty_flags.vertex_array.set((method - MAXWELL3D_REG_INDEX(vertex_array_limit)) >> 1);
} else if (method >= MAXWELL3D_REG_INDEX(instanced_arrays) &&
method < MAXWELL3D_REG_INDEX(instanced_arrays) + Regs::NumVertexArrays) {
dirty_flags.vertex_array.set(method - MAXWELL3D_REG_INDEX(instanced_arrays));
} }
} }
@ -261,7 +306,7 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) {
const bool is_last_call = method_call.IsLastCall(); const bool is_last_call = method_call.IsLastCall();
upload_state.ProcessData(method_call.argument, is_last_call); upload_state.ProcessData(method_call.argument, is_last_call);
if (is_last_call) { if (is_last_call) {
dirty_flags.OnMemoryWrite(); dirty.OnMemoryWrite();
} }
break; break;
} }
@ -333,7 +378,6 @@ void Maxwell3D::ProcessQueryGet() {
query_result.timestamp = system.CoreTiming().GetTicks(); query_result.timestamp = system.CoreTiming().GetTicks();
memory_manager.WriteBlock(sequence_address, &query_result, sizeof(query_result)); memory_manager.WriteBlock(sequence_address, &query_result, sizeof(query_result));
} }
dirty_flags.OnMemoryWrite();
break; break;
} }
default: default:
@ -418,8 +462,6 @@ void Maxwell3D::ProcessCBData(u32 value) {
rasterizer.InvalidateRegion(ToCacheAddr(ptr), sizeof(u32)); rasterizer.InvalidateRegion(ToCacheAddr(ptr), sizeof(u32));
memory_manager.Write<u32>(address, value); memory_manager.Write<u32>(address, value);
dirty_flags.OnMemoryWrite();
// Increment the current buffer position. // Increment the current buffer position.
regs.const_buffer.cb_pos = regs.const_buffer.cb_pos + 4; regs.const_buffer.cb_pos = regs.const_buffer.cb_pos + 4;
} }

View File

@ -1124,23 +1124,73 @@ public:
State state{}; State state{};
struct DirtyFlags { struct DirtyRegs {
std::bitset<8> color_buffer{0xFF}; static constexpr std::size_t NUM_REGS = 256;
std::bitset<32> vertex_array{0xFFFFFFFF}; union {
struct {
bool null_dirty;
// Vertex Attributes
bool vertex_attrib_format;
// Vertex Arrays
std::array<bool, 32> vertex_array;
bool vertex_attrib_format = true; bool vertex_array_buffers;
bool zeta_buffer = true; // Vertex Instances
bool shaders = true; std::array<bool, 32> vertex_instance;
bool vertex_instances;
// Render Targets
std::array<bool, 8> render_target;
bool depth_buffer;
bool render_settings;
// Shaders
bool shaders;
// State
bool viewport;
bool clip_enabled;
bool clip_coefficient;
bool cull_mode;
bool primitive_restart;
bool depth_test;
bool stencil_test;
bool blend_state;
bool logic_op;
bool fragment_color_clamp;
bool multi_sample;
bool scissor_test;
bool transform_feedback;
bool point;
bool color_mask;
bool polygon_offset;
bool alpha_test;
bool memory_general;
};
std::array<bool, NUM_REGS> regs;
};
void ResetVertexArrays() {
std::fill(vertex_array.begin(), vertex_array.end(), true);
vertex_array_buffers = true;
}
void ResetRenderTargets() {
depth_buffer = true;
std::fill(render_target.begin(), render_target.end(), true);
render_settings = true;
}
void OnMemoryWrite() { void OnMemoryWrite() {
zeta_buffer = true;
shaders = true; shaders = true;
color_buffer.set(); memory_general = true;
vertex_array.set(); ResetRenderTargets();
ResetVertexArrays();
} }
};
DirtyFlags dirty_flags; } dirty{};
std::array<u8, Regs::NUM_REGS> dirty_pointers{};
/// Reads a register value located at the input method address /// Reads a register value located at the input method address
u32 GetRegisterValue(u32 method) const; u32 GetRegisterValue(u32 method) const;
@ -1200,6 +1250,8 @@ private:
/// Retrieves information about a specific TSC entry from the TSC buffer. /// Retrieves information about a specific TSC entry from the TSC buffer.
Texture::TSCEntry GetTSCEntry(u32 tsc_index) const; Texture::TSCEntry GetTSCEntry(u32 tsc_index) const;
void InitDirtySettings();
/** /**
* Call a macro on this engine. * Call a macro on this engine.
* @param method Method to call * @param method Method to call

View File

@ -58,7 +58,7 @@ void MaxwellDMA::HandleCopy() {
} }
// All copies here update the main memory, so mark all rasterizer states as invalid. // All copies here update the main memory, so mark all rasterizer states as invalid.
system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite(); system.GPU().Maxwell3D().dirty.OnMemoryWrite();
if (regs.exec.is_dst_linear && regs.exec.is_src_linear) { if (regs.exec.is_dst_linear && regs.exec.is_src_linear) {
// When the enable_2d bit is disabled, the copy is performed as if we were copying a 1D // When the enable_2d bit is disabled, the copy is performed as if we were copying a 1D

View File

@ -124,10 +124,10 @@ GLuint RasterizerOpenGL::SetupVertexFormat() {
auto& gpu = system.GPU().Maxwell3D(); auto& gpu = system.GPU().Maxwell3D();
const auto& regs = gpu.regs; const auto& regs = gpu.regs;
if (!gpu.dirty_flags.vertex_attrib_format) { if (!gpu.dirty.vertex_attrib_format) {
return state.draw.vertex_array; return state.draw.vertex_array;
} }
gpu.dirty_flags.vertex_attrib_format = false; gpu.dirty.vertex_attrib_format = false;
MICROPROFILE_SCOPE(OpenGL_VAO); MICROPROFILE_SCOPE(OpenGL_VAO);
@ -181,7 +181,7 @@ GLuint RasterizerOpenGL::SetupVertexFormat() {
} }
// Rebinding the VAO invalidates the vertex buffer bindings. // Rebinding the VAO invalidates the vertex buffer bindings.
gpu.dirty_flags.vertex_array.set(); gpu.dirty.ResetVertexArrays();
state.draw.vertex_array = vao_entry.handle; state.draw.vertex_array = vao_entry.handle;
return vao_entry.handle; return vao_entry.handle;
@ -189,17 +189,20 @@ GLuint RasterizerOpenGL::SetupVertexFormat() {
void RasterizerOpenGL::SetupVertexBuffer(GLuint vao) { void RasterizerOpenGL::SetupVertexBuffer(GLuint vao) {
auto& gpu = system.GPU().Maxwell3D(); auto& gpu = system.GPU().Maxwell3D();
const auto& regs = gpu.regs; if (!gpu.dirty.vertex_array_buffers)
if (gpu.dirty_flags.vertex_array.none())
return; return;
gpu.dirty.vertex_array_buffers = false;
const auto& regs = gpu.regs;
MICROPROFILE_SCOPE(OpenGL_VB); MICROPROFILE_SCOPE(OpenGL_VB);
// Upload all guest vertex arrays sequentially to our buffer // Upload all guest vertex arrays sequentially to our buffer
for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) { for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) {
if (!gpu.dirty_flags.vertex_array[index]) if (!gpu.dirty.vertex_array[index])
continue; continue;
gpu.dirty.vertex_array[index] = false;
gpu.dirty.vertex_instance[index] = false;
const auto& vertex_array = regs.vertex_array[index]; const auto& vertex_array = regs.vertex_array[index];
if (!vertex_array.IsEnabled()) if (!vertex_array.IsEnabled())
@ -224,8 +227,32 @@ void RasterizerOpenGL::SetupVertexBuffer(GLuint vao) {
glVertexArrayBindingDivisor(vao, index, 0); glVertexArrayBindingDivisor(vao, index, 0);
} }
} }
}
gpu.dirty_flags.vertex_array.reset(); void RasterizerOpenGL::SetupVertexInstances(GLuint vao) {
auto& gpu = system.GPU().Maxwell3D();
if (!gpu.dirty.vertex_instances)
return;
gpu.dirty.vertex_instances = false;
const auto& regs = gpu.regs;
// Upload all guest vertex arrays sequentially to our buffer
for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) {
if (!gpu.dirty.vertex_instance[index])
continue;
gpu.dirty.vertex_instance[index] = false;
if (regs.instanced_arrays.IsInstancingEnabled(index) &&
regs.vertex_array[index].divisor != 0) {
// Enable vertex buffer instancing with the specified divisor.
glVertexArrayBindingDivisor(vao, index, regs.vertex_array[index].divisor);
} else {
// Disable the vertex buffer instancing.
glVertexArrayBindingDivisor(vao, index, 0);
}
}
} }
GLintptr RasterizerOpenGL::SetupIndexBuffer() { GLintptr RasterizerOpenGL::SetupIndexBuffer() {
@ -341,7 +368,7 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) {
SyncClipEnabled(clip_distances); SyncClipEnabled(clip_distances);
gpu.dirty_flags.shaders = false; gpu.dirty.shaders = false;
} }
std::size_t RasterizerOpenGL::CalculateVertexArraysSize() const { std::size_t RasterizerOpenGL::CalculateVertexArraysSize() const {
@ -424,13 +451,13 @@ std::pair<bool, bool> RasterizerOpenGL::ConfigureFramebuffers(
const FramebufferConfigState fb_config_state{using_color_fb, using_depth_fb, preserve_contents, const FramebufferConfigState fb_config_state{using_color_fb, using_depth_fb, preserve_contents,
single_color_target}; single_color_target};
if (fb_config_state == current_framebuffer_config_state && if (fb_config_state == current_framebuffer_config_state && !gpu.dirty.render_settings) {
gpu.dirty_flags.color_buffer.none() && !gpu.dirty_flags.zeta_buffer) {
// Only skip if the previous ConfigureFramebuffers call was from the same kind (multiple or // Only skip if the previous ConfigureFramebuffers call was from the same kind (multiple or
// single color targets). This is done because the guest registers may not change but the // single color targets). This is done because the guest registers may not change but the
// host framebuffer may contain different attachments // host framebuffer may contain different attachments
return current_depth_stencil_usage; return current_depth_stencil_usage;
} }
gpu.dirty.render_settings = false;
current_framebuffer_config_state = fb_config_state; current_framebuffer_config_state = fb_config_state;
texture_cache.GuardRenderTargets(true); texture_cache.GuardRenderTargets(true);
@ -661,6 +688,7 @@ void RasterizerOpenGL::DrawArrays() {
// Upload vertex and index data. // Upload vertex and index data.
SetupVertexBuffer(vao); SetupVertexBuffer(vao);
SetupVertexInstances(vao);
const GLintptr index_buffer_offset = SetupIndexBuffer(); const GLintptr index_buffer_offset = SetupIndexBuffer();
// Setup draw parameters. It will automatically choose what glDraw* method to use. // Setup draw parameters. It will automatically choose what glDraw* method to use.
@ -687,7 +715,7 @@ void RasterizerOpenGL::DrawArrays() {
if (invalidate) { if (invalidate) {
// As all cached buffers are invalidated, we need to recheck their state. // As all cached buffers are invalidated, we need to recheck their state.
gpu.dirty_flags.vertex_array.set(); gpu.dirty.ResetVertexArrays();
} }
shader_program_manager->ApplyTo(state); shader_program_manager->ApplyTo(state);
@ -700,6 +728,7 @@ void RasterizerOpenGL::DrawArrays() {
params.DispatchDraw(); params.DispatchDraw();
accelerate_draw = AccelDraw::Disabled; accelerate_draw = AccelDraw::Disabled;
gpu.dirty.memory_general = false;
} }
void RasterizerOpenGL::FlushAll() {} void RasterizerOpenGL::FlushAll() {}

View File

@ -216,6 +216,7 @@ private:
GLuint SetupVertexFormat(); GLuint SetupVertexFormat();
void SetupVertexBuffer(GLuint vao); void SetupVertexBuffer(GLuint vao);
void SetupVertexInstances(GLuint vao);
GLintptr SetupIndexBuffer(); GLintptr SetupIndexBuffer();

View File

@ -572,7 +572,7 @@ std::unordered_map<u64, UnspecializedShader> ShaderCacheOpenGL::GenerateUnspecia
} }
Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) { Shader ShaderCacheOpenGL::GetStageProgram(Maxwell::ShaderProgram program) {
if (!system.GPU().Maxwell3D().dirty_flags.shaders) { if (!system.GPU().Maxwell3D().dirty.shaders) {
return last_shaders[static_cast<std::size_t>(program)]; return last_shaders[static_cast<std::size_t>(program)];
} }

View File

@ -116,10 +116,10 @@ public:
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
auto& maxwell3d = system.GPU().Maxwell3D(); auto& maxwell3d = system.GPU().Maxwell3D();
if (!maxwell3d.dirty_flags.zeta_buffer) { if (!maxwell3d.dirty.depth_buffer) {
return depth_buffer.view; return depth_buffer.view;
} }
maxwell3d.dirty_flags.zeta_buffer = false; maxwell3d.dirty.depth_buffer = false;
const auto& regs{maxwell3d.regs}; const auto& regs{maxwell3d.regs};
const auto gpu_addr{regs.zeta.Address()}; const auto gpu_addr{regs.zeta.Address()};
@ -145,10 +145,10 @@ public:
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets); ASSERT(index < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets);
auto& maxwell3d = system.GPU().Maxwell3D(); auto& maxwell3d = system.GPU().Maxwell3D();
if (!maxwell3d.dirty_flags.color_buffer[index]) { if (!maxwell3d.dirty.render_target[index]) {
return render_targets[index].view; return render_targets[index].view;
} }
maxwell3d.dirty_flags.color_buffer.reset(index); maxwell3d.dirty.render_target[index] = false;
const auto& regs{maxwell3d.regs}; const auto& regs{maxwell3d.regs};
if (index >= regs.rt_control.count || regs.rt[index].Address() == 0 || if (index >= regs.rt_control.count || regs.rt[index].Address() == 0 ||
@ -272,12 +272,19 @@ protected:
void ManageRenderTargetUnregister(TSurface& surface) { void ManageRenderTargetUnregister(TSurface& surface) {
auto& maxwell3d = system.GPU().Maxwell3D(); auto& maxwell3d = system.GPU().Maxwell3D();
<<<<<<< HEAD
const u32 index = surface->GetRenderTarget(); const u32 index = surface->GetRenderTarget();
if (index == DEPTH_RT) { if (index == DEPTH_RT) {
maxwell3d.dirty_flags.zeta_buffer = true; maxwell3d.dirty_flags.zeta_buffer = true;
=======
u32 index = surface->GetRenderTarget();
if (index == 8) {
maxwell3d.dirty.depth_buffer = true;
>>>>>>> Maxwell3D: Rework the dirty system to be more consistant and scaleable
} else { } else {
maxwell3d.dirty_flags.color_buffer.set(index, true); maxwell3d.dirty.render_target[index] = true;
} }
maxwell3d.dirty.render_settings = true;
} }
void Register(TSurface surface) { void Register(TSurface surface) {