gl_rasterizer: Add a new dirty flag for any lighting lut.
This commit is contained in:
parent
a8396cdbed
commit
5a9cde138d
2 changed files with 23 additions and 17 deletions
|
@ -67,7 +67,8 @@ RasterizerOpenGL::RasterizerOpenGL()
|
||||||
|
|
||||||
uniform_block_data.dirty = true;
|
uniform_block_data.dirty = true;
|
||||||
|
|
||||||
uniform_block_data.lut_dirty.fill(true);
|
uniform_block_data.lighting_lut_dirty.fill(true);
|
||||||
|
uniform_block_data.lighting_lut_dirty_any = true;
|
||||||
|
|
||||||
uniform_block_data.fog_lut_dirty = true;
|
uniform_block_data.fog_lut_dirty = true;
|
||||||
|
|
||||||
|
@ -1382,7 +1383,8 @@ void RasterizerOpenGL::NotifyPicaRegisterChanged(u32 id) {
|
||||||
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[6], 0x1ce):
|
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[6], 0x1ce):
|
||||||
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[7], 0x1cf): {
|
case PICA_REG_INDEX_WORKAROUND(lighting.lut_data[7], 0x1cf): {
|
||||||
auto& lut_config = regs.lighting.lut_config;
|
auto& lut_config = regs.lighting.lut_config;
|
||||||
uniform_block_data.lut_dirty[lut_config.type] = true;
|
uniform_block_data.lighting_lut_dirty[lut_config.type] = true;
|
||||||
|
uniform_block_data.lighting_lut_dirty_any = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1950,8 +1952,9 @@ void RasterizerOpenGL::SyncAndUploadLUTs() {
|
||||||
sizeof(GLvec4) * 256; // proctex diff
|
sizeof(GLvec4) * 256; // proctex diff
|
||||||
|
|
||||||
// Sync the lighting luts
|
// Sync the lighting luts
|
||||||
for (unsigned index = 0; index < uniform_block_data.lut_dirty.size(); index++) {
|
if (uniform_block_data.lighting_lut_dirty_any) {
|
||||||
if (uniform_block_data.lut_dirty[index]) {
|
for (unsigned index = 0; index < uniform_block_data.lighting_lut_dirty.size(); index++) {
|
||||||
|
if (uniform_block_data.lighting_lut_dirty[index]) {
|
||||||
std::array<GLvec2, 256> new_data;
|
std::array<GLvec2, 256> new_data;
|
||||||
const auto& source_lut = Pica::g_state.lighting.luts[index];
|
const auto& source_lut = Pica::g_state.lighting.luts[index];
|
||||||
std::transform(source_lut.begin(), source_lut.end(), new_data.begin(),
|
std::transform(source_lut.begin(), source_lut.end(), new_data.begin(),
|
||||||
|
@ -1965,9 +1968,11 @@ void RasterizerOpenGL::SyncAndUploadLUTs() {
|
||||||
glBufferSubData(GL_TEXTURE_BUFFER, index * new_data.size() * sizeof(GLvec2),
|
glBufferSubData(GL_TEXTURE_BUFFER, index * new_data.size() * sizeof(GLvec2),
|
||||||
new_data.size() * sizeof(GLvec2), new_data.data());
|
new_data.size() * sizeof(GLvec2), new_data.data());
|
||||||
}
|
}
|
||||||
uniform_block_data.lut_dirty[index] = false;
|
uniform_block_data.lighting_lut_dirty[index] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
uniform_block_data.lighting_lut_dirty_any = false;
|
||||||
|
|
||||||
// Sync the fog lut
|
// Sync the fog lut
|
||||||
if (uniform_block_data.fog_lut_dirty) {
|
if (uniform_block_data.fog_lut_dirty) {
|
||||||
|
|
|
@ -250,7 +250,8 @@ private:
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
UniformData data;
|
UniformData data;
|
||||||
std::array<bool, Pica::LightingRegs::NumLightingSampler> lut_dirty;
|
std::array<bool, Pica::LightingRegs::NumLightingSampler> lighting_lut_dirty;
|
||||||
|
bool lighting_lut_dirty_any;
|
||||||
bool fog_lut_dirty;
|
bool fog_lut_dirty;
|
||||||
bool proctex_noise_lut_dirty;
|
bool proctex_noise_lut_dirty;
|
||||||
bool proctex_color_map_dirty;
|
bool proctex_color_map_dirty;
|
||||||
|
|
Loading…
Reference in a new issue