From a286b61f75f1b166c34079e6b8f85688bd522ca3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 29 Apr 2016 10:57:06 -0400 Subject: vertex_loader: Correct header ordering --- src/video_core/vertex_loader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/vertex_loader.cpp') diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp index 21ae52949..ce1c8da59 100644 --- a/src/video_core/vertex_loader.cpp +++ b/src/video_core/vertex_loader.cpp @@ -2,8 +2,8 @@ #include -#include "common/assert.h" #include "common/alignment.h" +#include "common/assert.h" #include "common/bit_field.h" #include "common/common_types.h" #include "common/logging/log.h" -- cgit v1.2.3 From 5587383eb72b02af79526d6fe5e662b281b4b32b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 29 Apr 2016 11:27:15 -0400 Subject: vertex_loader: Provide an assertion for ensuring the loader has been setup Also adds an assert to ensure that Setup is not called more than once during a VertexLoader's lifetime. --- src/video_core/vertex_loader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/video_core/vertex_loader.cpp') diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp index ce1c8da59..18a7cf144 100644 --- a/src/video_core/vertex_loader.cpp +++ b/src/video_core/vertex_loader.cpp @@ -21,6 +21,8 @@ namespace Pica { void VertexLoader::Setup(const Pica::Regs& regs) { + ASSERT_MSG(!is_setup, "VertexLoader is not intended to be setup more than once."); + const auto& attribute_config = regs.vertex_attributes; num_total_attributes = attribute_config.GetNumTotalAttributes(); @@ -60,9 +62,13 @@ void VertexLoader::Setup(const Pica::Regs& regs) { } } } + + is_setup = true; } void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, DebugUtils::MemoryAccessTracker& memory_accesses) { + ASSERT_MSG(is_setup, "A VertexLoader needs to be setup before loading vertices."); + for (int i = 0; i < num_total_attributes; ++i) { if (vertex_attribute_elements[i] != 0) { // Load per-vertex data from the loader arrays -- cgit v1.2.3