diff options
| author | 2016-04-29 11:27:15 -0400 | |
|---|---|---|
| committer | 2016-05-08 23:08:12 -0400 | |
| commit | 5587383eb72b02af79526d6fe5e662b281b4b32b (patch) | |
| tree | 95c9bb632660e19038401f868a787255178cc460 /src/video_core/vertex_loader.cpp | |
| parent | vertex_loader: Add constructors to facilitate immediate and two-step initiali... (diff) | |
| download | yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.gz yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.tar.xz yuzu-5587383eb72b02af79526d6fe5e662b281b4b32b.zip | |
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.
Diffstat (limited to 'src/video_core/vertex_loader.cpp')
| -rw-r--r-- | src/video_core/vertex_loader.cpp | 6 |
1 files changed, 6 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 @@ | |||
| 21 | namespace Pica { | 21 | namespace Pica { |
| 22 | 22 | ||
| 23 | void VertexLoader::Setup(const Pica::Regs& regs) { | 23 | void VertexLoader::Setup(const Pica::Regs& regs) { |
| 24 | ASSERT_MSG(!is_setup, "VertexLoader is not intended to be setup more than once."); | ||
| 25 | |||
| 24 | const auto& attribute_config = regs.vertex_attributes; | 26 | const auto& attribute_config = regs.vertex_attributes; |
| 25 | num_total_attributes = attribute_config.GetNumTotalAttributes(); | 27 | num_total_attributes = attribute_config.GetNumTotalAttributes(); |
| 26 | 28 | ||
| @@ -60,9 +62,13 @@ void VertexLoader::Setup(const Pica::Regs& regs) { | |||
| 60 | } | 62 | } |
| 61 | } | 63 | } |
| 62 | } | 64 | } |
| 65 | |||
| 66 | is_setup = true; | ||
| 63 | } | 67 | } |
| 64 | 68 | ||
| 65 | void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, DebugUtils::MemoryAccessTracker& memory_accesses) { | 69 | void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, DebugUtils::MemoryAccessTracker& memory_accesses) { |
| 70 | ASSERT_MSG(is_setup, "A VertexLoader needs to be setup before loading vertices."); | ||
| 71 | |||
| 66 | for (int i = 0; i < num_total_attributes; ++i) { | 72 | for (int i = 0; i < num_total_attributes; ++i) { |
| 67 | if (vertex_attribute_elements[i] != 0) { | 73 | if (vertex_attribute_elements[i] != 0) { |
| 68 | // Load per-vertex data from the loader arrays | 74 | // Load per-vertex data from the loader arrays |