Maxwell3D: Address Feedback
This commit is contained in:
parent
7826f0afd9
commit
5ad889f6fd
5 changed files with 13 additions and 17 deletions
|
@ -91,14 +91,11 @@ void Maxwell3D::InitializeRegisterDefaults() {
|
||||||
|
|
||||||
void Maxwell3D::InitDirtySettings() {
|
void Maxwell3D::InitDirtySettings() {
|
||||||
const auto set_block = [this](const u32 start, const u32 range, const u8 position) {
|
const auto set_block = [this](const u32 start, const u32 range, const u8 position) {
|
||||||
const u32 end = start + range;
|
const auto start_itr = dirty_pointers.begin() + start;
|
||||||
for (std::size_t i = start; i < end; i++) {
|
const auto end_itr = start_itr + range;
|
||||||
dirty_pointers[i] = position;
|
std::fill(start_itr, end_itr, position);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
for (std::size_t i = 0; i < DirtyRegs::NUM_REGS; i++) {
|
dirty.regs.fill(true);
|
||||||
dirty.regs[i] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init Render Targets
|
// Init Render Targets
|
||||||
constexpr u32 registers_per_rt = sizeof(regs.rt[0]) / sizeof(u32);
|
constexpr u32 registers_per_rt = sizeof(regs.rt[0]) / sizeof(u32);
|
||||||
|
@ -308,7 +305,7 @@ 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;
|
||||||
std::size_t dirty_reg = dirty_pointers[method];
|
const std::size_t dirty_reg = dirty_pointers[method];
|
||||||
if (dirty_reg) {
|
if (dirty_reg) {
|
||||||
dirty.regs[dirty_reg] = true;
|
dirty.regs[dirty_reg] = true;
|
||||||
if (dirty_reg >= DIRTY_REGS_POS(vertex_array) &&
|
if (dirty_reg >= DIRTY_REGS_POS(vertex_array) &&
|
||||||
|
@ -540,7 +537,7 @@ void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) {
|
||||||
|
|
||||||
void Maxwell3D::ProcessCBData(u32 value) {
|
void Maxwell3D::ProcessCBData(u32 value) {
|
||||||
const u32 id = cb_data_state.id;
|
const u32 id = cb_data_state.id;
|
||||||
cb_data_state.buff[id][cb_data_state.counter] = value;
|
cb_data_state.buffer[id][cb_data_state.counter] = value;
|
||||||
// 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;
|
||||||
cb_data_state.counter++;
|
cb_data_state.counter++;
|
||||||
|
@ -567,7 +564,7 @@ void Maxwell3D::FinishCBData() {
|
||||||
const std::size_t size = regs.const_buffer.cb_pos - cb_data_state.start_pos;
|
const std::size_t size = regs.const_buffer.cb_pos - cb_data_state.start_pos;
|
||||||
|
|
||||||
const u32 id = cb_data_state.id;
|
const u32 id = cb_data_state.id;
|
||||||
memory_manager.WriteBlock(address, cb_data_state.buff[id].data(), size);
|
memory_manager.WriteBlock(address, cb_data_state.buffer[id].data(), size);
|
||||||
dirty.OnMemoryWrite();
|
dirty.OnMemoryWrite();
|
||||||
|
|
||||||
cb_data_state.id = null_cb_data;
|
cb_data_state.id = null_cb_data;
|
||||||
|
|
|
@ -1169,13 +1169,13 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
void ResetVertexArrays() {
|
void ResetVertexArrays() {
|
||||||
std::fill(vertex_array.begin(), vertex_array.end(), true);
|
vertex_array.fill(true);
|
||||||
vertex_array_buffers = true;
|
vertex_array_buffers = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetRenderTargets() {
|
void ResetRenderTargets() {
|
||||||
depth_buffer = true;
|
depth_buffer = true;
|
||||||
std::fill(render_target.begin(), render_target.end(), true);
|
render_target.fill(true);
|
||||||
render_settings = true;
|
render_settings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,7 +1244,7 @@ private:
|
||||||
|
|
||||||
static constexpr u32 null_cb_data = 0xFFFFFFFF;
|
static constexpr u32 null_cb_data = 0xFFFFFFFF;
|
||||||
struct {
|
struct {
|
||||||
std::array<std::array<u32, 0x4000>, 16> buff;
|
std::array<std::array<u32, 0x4000>, 16> buffer;
|
||||||
u32 current{null_cb_data};
|
u32 current{null_cb_data};
|
||||||
u32 id{null_cb_data};
|
u32 id{null_cb_data};
|
||||||
u32 start_pos{};
|
u32 start_pos{};
|
||||||
|
|
|
@ -605,7 +605,7 @@ void RasterizerOpenGL::Clear() {
|
||||||
});
|
});
|
||||||
|
|
||||||
OpenGLState clear_state{OpenGLState::GetCurState()};
|
OpenGLState clear_state{OpenGLState::GetCurState()};
|
||||||
clear_state.DefaultViewports();
|
clear_state.SetDefaultViewports();
|
||||||
if (regs.clear_buffers.R || regs.clear_buffers.G || regs.clear_buffers.B ||
|
if (regs.clear_buffers.R || regs.clear_buffers.G || regs.clear_buffers.B ||
|
||||||
regs.clear_buffers.A) {
|
regs.clear_buffers.A) {
|
||||||
use_color = true;
|
use_color = true;
|
||||||
|
|
|
@ -165,7 +165,7 @@ OpenGLState::OpenGLState() {
|
||||||
alpha_test.ref = 0.0f;
|
alpha_test.ref = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::DefaultViewports() {
|
void OpenGLState::SetDefaultViewports() {
|
||||||
for (auto& item : viewports) {
|
for (auto& item : viewports) {
|
||||||
item.x = 0;
|
item.x = 0;
|
||||||
item.y = 0;
|
item.y = 0;
|
||||||
|
@ -182,7 +182,6 @@ void OpenGLState::DefaultViewports() {
|
||||||
|
|
||||||
depth_clamp.far_plane = false;
|
depth_clamp.far_plane = false;
|
||||||
depth_clamp.near_plane = false;
|
depth_clamp.near_plane = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLState::ApplyDefaultState() {
|
void OpenGLState::ApplyDefaultState() {
|
||||||
|
|
|
@ -195,7 +195,7 @@ public:
|
||||||
s_rgb_used = false;
|
s_rgb_used = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultViewports();
|
void SetDefaultViewports();
|
||||||
/// Apply this state as the current OpenGL state
|
/// Apply this state as the current OpenGL state
|
||||||
void Apply();
|
void Apply();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue