mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	OpenGL: Check if uniform block exists before updating it (#2581)
This commit is contained in:
		
							parent
							
								
									3a96dd023f
								
							
						
					
					
						commit
						e594e63bb5
					
				| @ -1071,37 +1071,38 @@ void RasterizerOpenGL::SetShader() { | |||||||
| 
 | 
 | ||||||
|         current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); |         current_shader = shader_cache.emplace(config, std::move(shader)).first->second.get(); | ||||||
| 
 | 
 | ||||||
|         unsigned int block_index = |         GLuint block_index = glGetUniformBlockIndex(current_shader->shader.handle, "shader_data"); | ||||||
|             glGetUniformBlockIndex(current_shader->shader.handle, "shader_data"); |         if (block_index != GL_INVALID_INDEX) { | ||||||
|         GLint block_size; |             GLint block_size; | ||||||
|         glGetActiveUniformBlockiv(current_shader->shader.handle, block_index, |             glGetActiveUniformBlockiv(current_shader->shader.handle, block_index, | ||||||
|                                   GL_UNIFORM_BLOCK_DATA_SIZE, &block_size); |                                       GL_UNIFORM_BLOCK_DATA_SIZE, &block_size); | ||||||
|         ASSERT_MSG(block_size == sizeof(UniformData), |             ASSERT_MSG(block_size == sizeof(UniformData), | ||||||
|                    "Uniform block size did not match! Got %d, expected %zu", |                        "Uniform block size did not match! Got %d, expected %zu", | ||||||
|                    static_cast<int>(block_size), sizeof(UniformData)); |                        static_cast<int>(block_size), sizeof(UniformData)); | ||||||
|         glUniformBlockBinding(current_shader->shader.handle, block_index, 0); |             glUniformBlockBinding(current_shader->shader.handle, block_index, 0); | ||||||
| 
 | 
 | ||||||
|         // Update uniforms
 |             // Update uniforms
 | ||||||
|         SyncDepthScale(); |             SyncDepthScale(); | ||||||
|         SyncDepthOffset(); |             SyncDepthOffset(); | ||||||
|         SyncAlphaTest(); |             SyncAlphaTest(); | ||||||
|         SyncCombinerColor(); |             SyncCombinerColor(); | ||||||
|         auto& tev_stages = Pica::g_state.regs.texturing.GetTevStages(); |             auto& tev_stages = Pica::g_state.regs.texturing.GetTevStages(); | ||||||
|         for (int index = 0; index < tev_stages.size(); ++index) |             for (int index = 0; index < tev_stages.size(); ++index) | ||||||
|             SyncTevConstColor(index, tev_stages[index]); |                 SyncTevConstColor(index, tev_stages[index]); | ||||||
| 
 | 
 | ||||||
|         SyncGlobalAmbient(); |             SyncGlobalAmbient(); | ||||||
|         for (int light_index = 0; light_index < 8; light_index++) { |             for (int light_index = 0; light_index < 8; light_index++) { | ||||||
|             SyncLightSpecular0(light_index); |                 SyncLightSpecular0(light_index); | ||||||
|             SyncLightSpecular1(light_index); |                 SyncLightSpecular1(light_index); | ||||||
|             SyncLightDiffuse(light_index); |                 SyncLightDiffuse(light_index); | ||||||
|             SyncLightAmbient(light_index); |                 SyncLightAmbient(light_index); | ||||||
|             SyncLightPosition(light_index); |                 SyncLightPosition(light_index); | ||||||
|             SyncLightDistanceAttenuationBias(light_index); |                 SyncLightDistanceAttenuationBias(light_index); | ||||||
|             SyncLightDistanceAttenuationScale(light_index); |                 SyncLightDistanceAttenuationScale(light_index); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             SyncFogColor(); | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         SyncFogColor(); |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jannik Vogel
						Jannik Vogel