mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time) As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing) Also removed some GEKKO cruft.
This commit is contained in:
		
							parent
							
								
									168eb27aee
								
							
						
					
					
						commit
						ef24e72b26
					
				
					 88 changed files with 135 additions and 217 deletions
				
			
		|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| #include <nihstro/shader_binary.h> | ||||
| 
 | ||||
| #include "common/log.h" | ||||
| #include "common/assert.h" | ||||
| #include "common/file_util.h" | ||||
| #include "common/math_util.h" | ||||
| 
 | ||||
|  | @ -197,7 +197,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data | |||
|                         it->component_mask = it->component_mask | component_mask; | ||||
|                     } | ||||
|                 } catch (const std::out_of_range& ) { | ||||
|                     _dbg_assert_msg_(HW_GPU, 0, "Unknown output attribute mapping"); | ||||
|                     DEBUG_ASSERT_MSG(false, "Unknown output attribute mapping"); | ||||
|                     LOG_ERROR(HW_GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", | ||||
|                               (int)output_attributes[i].map_x.Value(), | ||||
|                               (int)output_attributes[i].map_y.Value(), | ||||
|  | @ -571,7 +571,7 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture | |||
| 
 | ||||
|     default: | ||||
|         LOG_ERROR(HW_GPU, "Unknown texture format: %x", (u32)info.format); | ||||
|         _dbg_assert_(HW_GPU, 0); | ||||
|         DEBUG_ASSERT(false); | ||||
|         return {}; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -8,8 +8,6 @@ | |||
| #include <functional> | ||||
| #include <vector> | ||||
| 
 | ||||
| #include "common/log.h" | ||||
| 
 | ||||
| #include "core/hle/service/gsp_gpu.h" | ||||
| 
 | ||||
| #include "command_processor.h" | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| #include "primitive_assembly.h" | ||||
| #include "vertex_shader.h" | ||||
| 
 | ||||
| #include "common/logging/log.h" | ||||
| #include "video_core/debug_utils/debug_utils.h" | ||||
| 
 | ||||
| namespace Pica { | ||||
|  |  | |||
|  | @ -216,7 +216,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
|                 if (!texture.enabled) | ||||
|                     continue; | ||||
| 
 | ||||
|                 _dbg_assert_(HW_GPU, 0 != texture.config.address); | ||||
|                 DEBUG_ASSERT(0 != texture.config.address); | ||||
| 
 | ||||
|                 int s = (int)(uv[i].u() * float24::FromFloat32(static_cast<float>(texture.config.width))).ToFloat32(); | ||||
|                 int t = (int)(uv[i].v() * float24::FromFloat32(static_cast<float>(texture.config.height))).ToFloat32(); | ||||
|  | @ -232,7 +232,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 
 | ||||
|                         default: | ||||
|                             LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode); | ||||
|                             _dbg_assert_(HW_GPU, 0); | ||||
|                             UNIMPLEMENTED(); | ||||
|                             return 0; | ||||
|                     } | ||||
|                 }; | ||||
|  | @ -282,7 +282,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 
 | ||||
|                     default: | ||||
|                         LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source); | ||||
|                         _dbg_assert_(HW_GPU, 0); | ||||
|                         UNIMPLEMENTED(); | ||||
|                         return {}; | ||||
|                     } | ||||
|                 }; | ||||
|  | @ -380,7 +380,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 
 | ||||
|                     default: | ||||
|                         LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); | ||||
|                         _dbg_assert_(HW_GPU, 0); | ||||
|                         UNIMPLEMENTED(); | ||||
|                         return {}; | ||||
|                     } | ||||
|                 }; | ||||
|  | @ -404,7 +404,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 
 | ||||
|                     default: | ||||
|                         LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); | ||||
|                         _dbg_assert_(HW_GPU, 0); | ||||
|                         UNIMPLEMENTED(); | ||||
|                         return 0; | ||||
|                     } | ||||
|                 }; | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
| #include "gl_shader_util.h" | ||||
| #include "common/log.h" | ||||
| #include "common/logging/log.h" | ||||
| 
 | ||||
| #include <vector> | ||||
| #include <algorithm> | ||||
|  |  | |||
|  | @ -99,15 +99,15 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig& | |||
|     const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr); | ||||
| 
 | ||||
|     // TODO: Handle other pixel formats
 | ||||
|     _dbg_assert_msg_(Render_OpenGL, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, | ||||
|     ASSERT_MSG(framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, | ||||
|                      "Unsupported 3DS pixel format."); | ||||
| 
 | ||||
|     size_t pixel_stride = framebuffer.stride / 3; | ||||
|     // OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately
 | ||||
|     _dbg_assert_(Render_OpenGL, pixel_stride * 3 == framebuffer.stride); | ||||
|     ASSERT(pixel_stride * 3 == framebuffer.stride); | ||||
|     // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default
 | ||||
|     // only allows rows to have a memory alignement of 4.
 | ||||
|     _dbg_assert_(Render_OpenGL, pixel_stride % 4 == 0); | ||||
|     ASSERT(pixel_stride % 4 == 0); | ||||
| 
 | ||||
|     glBindTexture(GL_TEXTURE_2D, texture.handle); | ||||
|     glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride); | ||||
|  |  | |||
|  | @ -146,13 +146,10 @@ static void ProcessShaderCode(VertexShaderState& state) { | |||
|         case Instruction::OpCodeType::Arithmetic: | ||||
|         { | ||||
|             bool is_inverted = 0 != (instr.opcode.GetInfo().subtype & Instruction::OpCodeInfo::SrcInversed); | ||||
|             if (is_inverted) { | ||||
|                 // TODO: We don't really support this properly: For instance, the address register
 | ||||
|                 //       offset needs to be applied to SRC2 instead, etc.
 | ||||
|                 //       For now, we just abort in this situation.
 | ||||
|                 LOG_CRITICAL(HW_GPU, "Bad condition..."); | ||||
|                 exit(0); | ||||
|             } | ||||
|             // TODO: We don't really support this properly: For instance, the address register
 | ||||
|             //       offset needs to be applied to SRC2 instead, etc.
 | ||||
|             //       For now, we just abort in this situation.
 | ||||
|             ASSERT_MSG(!is_inverted, "Bad condition..."); | ||||
| 
 | ||||
|             const int address_offset = (instr.common.address_register_index == 0) | ||||
|                                        ? 0 : state.address_registers[instr.common.address_register_index - 1]; | ||||
|  | @ -342,7 +339,7 @@ static void ProcessShaderCode(VertexShaderState& state) { | |||
|             default: | ||||
|                 LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", | ||||
|                           (int)instr.opcode.Value(), instr.opcode.GetInfo().name, instr.hex); | ||||
|                 _dbg_assert_(HW_GPU, 0); | ||||
|                 DEBUG_ASSERT(false); | ||||
|                 break; | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,7 +4,6 @@ | |||
| 
 | ||||
| #include "common/common.h" | ||||
| #include "common/emu_window.h" | ||||
| #include "common/log.h" | ||||
| 
 | ||||
| #include "core/core.h" | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue