diff options
| author | 2015-02-10 23:08:04 -0500 | |
|---|---|---|
| committer | 2015-02-10 23:08:04 -0500 | |
| commit | 2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f (patch) | |
| tree | fca138e8377c4d66bd1fe026a3d2fef54a7f090c /src/video_core | |
| parent | GSP: Fixed typo in SignalInterrupt (diff) | |
| parent | Asserts: break/crash program, fit to style guide; log.h->assert.h (diff) | |
| download | yuzu-2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f.tar.gz yuzu-2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f.tar.xz yuzu-2fb1e4c9a2e45aad6c3e9408a3895369b8a8729f.zip | |
Merge pull request #500 from archshift/assert
Made asserts actually break the debugger, or crash if the program is not in debug mode.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/gpu_debugger.h | 2 | ||||
| -rw-r--r-- | src/video_core/primitive_assembly.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_util.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/vertex_shader.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/video_core.cpp | 1 |
8 files changed, 18 insertions, 23 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 12f0009bd..8c4ec1044 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <nihstro/shader_binary.h> | 17 | #include <nihstro/shader_binary.h> |
| 18 | 18 | ||
| 19 | #include "common/log.h" | 19 | #include "common/assert.h" |
| 20 | #include "common/file_util.h" | 20 | #include "common/file_util.h" |
| 21 | #include "common/math_util.h" | 21 | #include "common/math_util.h" |
| 22 | 22 | ||
| @@ -197,7 +197,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data | |||
| 197 | it->component_mask = it->component_mask | component_mask; | 197 | it->component_mask = it->component_mask | component_mask; |
| 198 | } | 198 | } |
| 199 | } catch (const std::out_of_range& ) { | 199 | } catch (const std::out_of_range& ) { |
| 200 | _dbg_assert_msg_(HW_GPU, 0, "Unknown output attribute mapping"); | 200 | DEBUG_ASSERT_MSG(false, "Unknown output attribute mapping"); |
| 201 | LOG_ERROR(HW_GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", | 201 | LOG_ERROR(HW_GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x", |
| 202 | (int)output_attributes[i].map_x.Value(), | 202 | (int)output_attributes[i].map_x.Value(), |
| 203 | (int)output_attributes[i].map_y.Value(), | 203 | (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 | |||
| 571 | 571 | ||
| 572 | default: | 572 | default: |
| 573 | LOG_ERROR(HW_GPU, "Unknown texture format: %x", (u32)info.format); | 573 | LOG_ERROR(HW_GPU, "Unknown texture format: %x", (u32)info.format); |
| 574 | _dbg_assert_(HW_GPU, 0); | 574 | DEBUG_ASSERT(false); |
| 575 | return {}; | 575 | return {}; |
| 576 | } | 576 | } |
| 577 | } | 577 | } |
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index a51d49c92..c2c898992 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h | |||
| @@ -8,8 +8,6 @@ | |||
| 8 | #include <functional> | 8 | #include <functional> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | 10 | ||
| 11 | #include "common/log.h" | ||
| 12 | |||
| 13 | #include "core/hle/service/gsp_gpu.h" | 11 | #include "core/hle/service/gsp_gpu.h" |
| 14 | 12 | ||
| 15 | #include "command_processor.h" | 13 | #include "command_processor.h" |
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp index 242a07e26..1776a1925 100644 --- a/src/video_core/primitive_assembly.cpp +++ b/src/video_core/primitive_assembly.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include "primitive_assembly.h" | 6 | #include "primitive_assembly.h" |
| 7 | #include "vertex_shader.h" | 7 | #include "vertex_shader.h" |
| 8 | 8 | ||
| 9 | #include "common/logging/log.h" | ||
| 9 | #include "video_core/debug_utils/debug_utils.h" | 10 | #include "video_core/debug_utils/debug_utils.h" |
| 10 | 11 | ||
| 11 | namespace Pica { | 12 | namespace Pica { |
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index 06fd8d140..617c767e7 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -216,7 +216,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 216 | if (!texture.enabled) | 216 | if (!texture.enabled) |
| 217 | continue; | 217 | continue; |
| 218 | 218 | ||
| 219 | _dbg_assert_(HW_GPU, 0 != texture.config.address); | 219 | DEBUG_ASSERT(0 != texture.config.address); |
| 220 | 220 | ||
| 221 | int s = (int)(uv[i].u() * float24::FromFloat32(static_cast<float>(texture.config.width))).ToFloat32(); | 221 | int s = (int)(uv[i].u() * float24::FromFloat32(static_cast<float>(texture.config.width))).ToFloat32(); |
| 222 | int t = (int)(uv[i].v() * float24::FromFloat32(static_cast<float>(texture.config.height))).ToFloat32(); | 222 | 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, | |||
| 232 | 232 | ||
| 233 | default: | 233 | default: |
| 234 | LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode); | 234 | LOG_ERROR(HW_GPU, "Unknown texture coordinate wrapping mode %x\n", (int)mode); |
| 235 | _dbg_assert_(HW_GPU, 0); | 235 | UNIMPLEMENTED(); |
| 236 | return 0; | 236 | return 0; |
| 237 | } | 237 | } |
| 238 | }; | 238 | }; |
| @@ -282,7 +282,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 282 | 282 | ||
| 283 | default: | 283 | default: |
| 284 | LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source); | 284 | LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source); |
| 285 | _dbg_assert_(HW_GPU, 0); | 285 | UNIMPLEMENTED(); |
| 286 | return {}; | 286 | return {}; |
| 287 | } | 287 | } |
| 288 | }; | 288 | }; |
| @@ -380,7 +380,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 380 | 380 | ||
| 381 | default: | 381 | default: |
| 382 | LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); | 382 | LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op); |
| 383 | _dbg_assert_(HW_GPU, 0); | 383 | UNIMPLEMENTED(); |
| 384 | return {}; | 384 | return {}; |
| 385 | } | 385 | } |
| 386 | }; | 386 | }; |
| @@ -404,7 +404,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0, | |||
| 404 | 404 | ||
| 405 | default: | 405 | default: |
| 406 | LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); | 406 | LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op); |
| 407 | _dbg_assert_(HW_GPU, 0); | 407 | UNIMPLEMENTED(); |
| 408 | return 0; | 408 | return 0; |
| 409 | } | 409 | } |
| 410 | }; | 410 | }; |
diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index e982e3746..42d0e597c 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "gl_shader_util.h" | 5 | #include "gl_shader_util.h" |
| 6 | #include "common/log.h" | 6 | #include "common/logging/log.h" |
| 7 | 7 | ||
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include <algorithm> | 9 | #include <algorithm> |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index aa47bd616..735c0cf45 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -99,15 +99,15 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig& | |||
| 99 | const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr); | 99 | const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr); |
| 100 | 100 | ||
| 101 | // TODO: Handle other pixel formats | 101 | // TODO: Handle other pixel formats |
| 102 | _dbg_assert_msg_(Render_OpenGL, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, | 102 | ASSERT_MSG(framebuffer.color_format == GPU::Regs::PixelFormat::RGB8, |
| 103 | "Unsupported 3DS pixel format."); | 103 | "Unsupported 3DS pixel format."); |
| 104 | 104 | ||
| 105 | size_t pixel_stride = framebuffer.stride / 3; | 105 | size_t pixel_stride = framebuffer.stride / 3; |
| 106 | // OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately | 106 | // OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately |
| 107 | _dbg_assert_(Render_OpenGL, pixel_stride * 3 == framebuffer.stride); | 107 | ASSERT(pixel_stride * 3 == framebuffer.stride); |
| 108 | // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default | 108 | // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default |
| 109 | // only allows rows to have a memory alignement of 4. | 109 | // only allows rows to have a memory alignement of 4. |
| 110 | _dbg_assert_(Render_OpenGL, pixel_stride % 4 == 0); | 110 | ASSERT(pixel_stride % 4 == 0); |
| 111 | 111 | ||
| 112 | glBindTexture(GL_TEXTURE_2D, texture.handle); | 112 | glBindTexture(GL_TEXTURE_2D, texture.handle); |
| 113 | glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride); | 113 | glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride); |
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 48977380e..0bd52231b 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp | |||
| @@ -146,13 +146,10 @@ static void ProcessShaderCode(VertexShaderState& state) { | |||
| 146 | case Instruction::OpCodeType::Arithmetic: | 146 | case Instruction::OpCodeType::Arithmetic: |
| 147 | { | 147 | { |
| 148 | bool is_inverted = 0 != (instr.opcode.GetInfo().subtype & Instruction::OpCodeInfo::SrcInversed); | 148 | bool is_inverted = 0 != (instr.opcode.GetInfo().subtype & Instruction::OpCodeInfo::SrcInversed); |
| 149 | if (is_inverted) { | 149 | // TODO: We don't really support this properly: For instance, the address register |
| 150 | // TODO: We don't really support this properly: For instance, the address register | 150 | // offset needs to be applied to SRC2 instead, etc. |
| 151 | // offset needs to be applied to SRC2 instead, etc. | 151 | // For now, we just abort in this situation. |
| 152 | // For now, we just abort in this situation. | 152 | ASSERT_MSG(!is_inverted, "Bad condition..."); |
| 153 | LOG_CRITICAL(HW_GPU, "Bad condition..."); | ||
| 154 | exit(0); | ||
| 155 | } | ||
| 156 | 153 | ||
| 157 | const int address_offset = (instr.common.address_register_index == 0) | 154 | const int address_offset = (instr.common.address_register_index == 0) |
| 158 | ? 0 : state.address_registers[instr.common.address_register_index - 1]; | 155 | ? 0 : state.address_registers[instr.common.address_register_index - 1]; |
| @@ -342,7 +339,7 @@ static void ProcessShaderCode(VertexShaderState& state) { | |||
| 342 | default: | 339 | default: |
| 343 | LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", | 340 | LOG_ERROR(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", |
| 344 | (int)instr.opcode.Value(), instr.opcode.GetInfo().name, instr.hex); | 341 | (int)instr.opcode.Value(), instr.opcode.GetInfo().name, instr.hex); |
| 345 | _dbg_assert_(HW_GPU, 0); | 342 | DEBUG_ASSERT(false); |
| 346 | break; | 343 | break; |
| 347 | } | 344 | } |
| 348 | 345 | ||
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index c9707e5f1..0a236595c 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/common.h" | 5 | #include "common/common.h" |
| 6 | #include "common/emu_window.h" | 6 | #include "common/emu_window.h" |
| 7 | #include "common/log.h" | ||
| 8 | 7 | ||
| 9 | #include "core/core.h" | 8 | #include "core/core.h" |
| 10 | 9 | ||