aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar archshift <admin@archshift.com>2015-01-20 17:16:47 -0800
committerGravatar archshift <admin@archshift.com>2015-02-10 18:30:31 -0800
commitef24e72b2618806f64345544fa46c84f3f494890 (patch)
treefca138e8377c4d66bd1fe026a3d2fef54a7f090c /src/video_core
parent168eb27aee7992b8abf9f505b8c246a25fc8dca5 (diff)
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.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp6
-rw-r--r--src/video_core/gpu_debugger.h2
-rw-r--r--src/video_core/primitive_assembly.cpp1
-rw-r--r--src/video_core/rasterizer.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_shader_util.cpp2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp6
-rw-r--r--src/video_core/vertex_shader.cpp13
-rw-r--r--src/video_core/video_core.cpp1
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 12f0009b..8c4ec104 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -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 {};
}
}
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h
index a51d49c9..c2c89899 100644
--- a/src/video_core/gpu_debugger.h
+++ b/src/video_core/gpu_debugger.h
@@ -8,8 +8,6 @@
#include <functional>
#include <vector>
-#include "common/log.h"
-
#include "core/hle/service/gsp_gpu.h"
#include "command_processor.h"
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp
index 242a07e2..1776a192 100644
--- a/src/video_core/primitive_assembly.cpp
+++ b/src/video_core/primitive_assembly.cpp
@@ -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 {
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index 06fd8d14..617c767e 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -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;
}
};
diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp
index e982e374..42d0e597 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 @@
// 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>
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index aa47bd61..735c0cf4 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&
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);
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index 48977380..0bd52231 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -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;
}
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index c9707e5f..0a236595 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -4,7 +4,6 @@
#include "common/common.h"
#include "common/emu_window.h"
-#include "common/log.h"
#include "core/core.h"