gl_rasterizer: Move TBO syncing helper to one function.

This commit is contained in:
Markus Wick 2018-05-19 11:12:51 +02:00
parent 10fba63b94
commit 8a8c6f059f
2 changed files with 51 additions and 43 deletions

View file

@ -806,49 +806,8 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
shader_dirty = false; shader_dirty = false;
} }
// Sync the lighting luts // Sync the LUTs within the texture buffer
for (unsigned index = 0; index < uniform_block_data.lut_dirty.size(); index++) { SyncAndUploadLUTs();
if (uniform_block_data.lut_dirty[index]) {
SyncLightingLUT(index);
uniform_block_data.lut_dirty[index] = false;
}
}
// Sync the fog lut
if (uniform_block_data.fog_lut_dirty) {
SyncFogLUT();
uniform_block_data.fog_lut_dirty = false;
}
// Sync the proctex noise lut
if (uniform_block_data.proctex_noise_lut_dirty) {
SyncProcTexNoiseLUT();
uniform_block_data.proctex_noise_lut_dirty = false;
}
// Sync the proctex color map
if (uniform_block_data.proctex_color_map_dirty) {
SyncProcTexColorMap();
uniform_block_data.proctex_color_map_dirty = false;
}
// Sync the proctex alpha map
if (uniform_block_data.proctex_alpha_map_dirty) {
SyncProcTexAlphaMap();
uniform_block_data.proctex_alpha_map_dirty = false;
}
// Sync the proctex lut
if (uniform_block_data.proctex_lut_dirty) {
SyncProcTexLUT();
uniform_block_data.proctex_lut_dirty = false;
}
// Sync the proctex difference lut
if (uniform_block_data.proctex_diff_lut_dirty) {
SyncProcTexDiffLUT();
uniform_block_data.proctex_diff_lut_dirty = false;
}
// Sync the uniform data // Sync the uniform data
const bool use_gs = regs.pipeline.use_gs == Pica::PipelineRegs::UseGS::Yes; const bool use_gs = regs.pipeline.use_gs == Pica::PipelineRegs::UseGS::Yes;
@ -2065,6 +2024,52 @@ void RasterizerOpenGL::SyncShadowBias() {
} }
} }
void RasterizerOpenGL::SyncAndUploadLUTs() {
// Sync the lighting luts
for (unsigned index = 0; index < uniform_block_data.lut_dirty.size(); index++) {
if (uniform_block_data.lut_dirty[index]) {
SyncLightingLUT(index);
uniform_block_data.lut_dirty[index] = false;
}
}
// Sync the fog lut
if (uniform_block_data.fog_lut_dirty) {
SyncFogLUT();
uniform_block_data.fog_lut_dirty = false;
}
// Sync the proctex noise lut
if (uniform_block_data.proctex_noise_lut_dirty) {
SyncProcTexNoiseLUT();
uniform_block_data.proctex_noise_lut_dirty = false;
}
// Sync the proctex color map
if (uniform_block_data.proctex_color_map_dirty) {
SyncProcTexColorMap();
uniform_block_data.proctex_color_map_dirty = false;
}
// Sync the proctex alpha map
if (uniform_block_data.proctex_alpha_map_dirty) {
SyncProcTexAlphaMap();
uniform_block_data.proctex_alpha_map_dirty = false;
}
// Sync the proctex lut
if (uniform_block_data.proctex_lut_dirty) {
SyncProcTexLUT();
uniform_block_data.proctex_lut_dirty = false;
}
// Sync the proctex difference lut
if (uniform_block_data.proctex_diff_lut_dirty) {
SyncProcTexDiffLUT();
uniform_block_data.proctex_diff_lut_dirty = false;
}
}
void RasterizerOpenGL::UploadUniforms(bool accelerate_draw, bool use_gs) { void RasterizerOpenGL::UploadUniforms(bool accelerate_draw, bool use_gs) {
// glBindBufferRange below also changes the generic buffer binding point, so we sync the state // glBindBufferRange below also changes the generic buffer binding point, so we sync the state
// first // first

View file

@ -220,6 +220,9 @@ private:
/// Syncs the shadow rendering bias to match the PICA register /// Syncs the shadow rendering bias to match the PICA register
void SyncShadowBias(); void SyncShadowBias();
/// Syncs and uploads the lighting, fog and proctex LUTs
void SyncAndUploadLUTs();
/// Upload the uniform blocks to the uniform buffer object /// Upload the uniform blocks to the uniform buffer object
void UploadUniforms(bool accelerate_draw, bool use_gs); void UploadUniforms(bool accelerate_draw, bool use_gs);