summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2016-04-29 17:27:15 +0200
committerLioncash <mathew1800@gmail.com>2016-05-09 05:08:12 +0200
commit5587383eb72b02af79526d6fe5e662b281b4b32b (patch)
tree95c9bb632660e19038401f868a787255178cc460 /src
parentvertex_loader: Add constructors to facilitate immediate and two-step initialization (diff)
downloadyuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar
yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.gz
yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.bz2
yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.lz
yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.xz
yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.zst
yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/vertex_loader.cpp6
-rw-r--r--src/video_core/vertex_loader.h1
2 files changed, 7 insertions, 0 deletions
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
diff --git a/src/video_core/vertex_loader.h b/src/video_core/vertex_loader.h
index 2a97b97c8..7192120a5 100644
--- a/src/video_core/vertex_loader.h
+++ b/src/video_core/vertex_loader.h
@@ -34,6 +34,7 @@ private:
std::array<u32, 16> vertex_attribute_elements{};
std::array<bool, 16> vertex_attribute_is_default;
int num_total_attributes = 0;
+ bool is_setup = false;
};
} // namespace Pica