aboutsummaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger/graphics_vertex_shader.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-25 05:44:59 -0300
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-09-07 16:46:25 -0300
commit3e2dc6f659c5b4902384ea51e8aec4dbb0c0754d (patch)
tree2da28feb56029f9a3880fc4693b9ab2fe7259bf2 /src/citra_qt/debugger/graphics_vertex_shader.cpp
parent8b76af8d0e3e875628947345e3ff2c5732a6a4bd (diff)
Shader Debugger: Initialize input_vertex to prevent crashes
If the first type of breakpoint to be hit wasn't "Vertex Loaded", the input_vertex would contain garbage, which would be passed to the shader interpreter and ocasionally cause crashes.
Diffstat (limited to 'src/citra_qt/debugger/graphics_vertex_shader.cpp')
-rw-r--r--src/citra_qt/debugger/graphics_vertex_shader.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp
index eaa749f300..e5af760741 100644
--- a/src/citra_qt/debugger/graphics_vertex_shader.cpp
+++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp
@@ -301,6 +301,13 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(std::shared_ptr< Pica::De
: BreakPointObserverDock(debug_context, "Pica Vertex Shader", parent) {
setObjectName("PicaVertexShader");
+ // Clear input vertex data so that it contains valid float values in case a debug shader
+ // execution happens before the first Vertex Loaded breakpoint.
+ // TODO: This makes a crash in the interpreter much less likely, but not impossible. The
+ // interpreter should guard against out-of-bounds accesses to ensure crashes in it aren't
+ // possible.
+ std::memset(&input_vertex, 0, sizeof(input_vertex));
+
auto input_data_mapper = new QSignalMapper(this);
// TODO: Support inputting data in hexadecimal raw format