forked from eden-emu/eden
		
	gl_shader_decompiler: Fix constant buffer size calculation
The divide logic was wrong and can cause an uniform buffer size overflow.
This commit is contained in:
		
							parent
							
								
									0f02201fb3
								
							
						
					
					
						commit
						ff383ffbcd
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -14,6 +14,7 @@ | ||||||
| #include "common/alignment.h" | #include "common/alignment.h" | ||||||
| #include "common/assert.h" | #include "common/assert.h" | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
|  | #include "common/div_ceil.h" | ||||||
| #include "common/logging/log.h" | #include "common/logging/log.h" | ||||||
| #include "video_core/engines/maxwell_3d.h" | #include "video_core/engines/maxwell_3d.h" | ||||||
| #include "video_core/engines/shader_type.h" | #include "video_core/engines/shader_type.h" | ||||||
|  | @ -877,7 +878,7 @@ private: | ||||||
| 
 | 
 | ||||||
|         u32 binding = device.GetBaseBindings(stage).uniform_buffer; |         u32 binding = device.GetBaseBindings(stage).uniform_buffer; | ||||||
|         for (const auto& [index, info] : ir.GetConstantBuffers()) { |         for (const auto& [index, info] : ir.GetConstantBuffers()) { | ||||||
|             const u32 num_elements = Common::AlignUp(info.GetSize(), 4) / 4; |             const u32 num_elements = Common::DivCeil(info.GetSize(), 4 * sizeof(u32)); | ||||||
|             const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements; |             const u32 size = info.IsIndirect() ? MAX_CONSTBUFFER_ELEMENTS : num_elements; | ||||||
|             code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++, |             code.AddLine("layout (std140, binding = {}) uniform {} {{", binding++, | ||||||
|                          GetConstBufferBlock(index)); |                          GetConstBufferBlock(index)); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 ReinUsesLisp
						ReinUsesLisp