summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-03-12 20:12:15 -0800
committerGravatar Yuri Kunde Schlesner2016-03-12 20:12:15 -0800
commitf62935d2787fdc43ed0f102bf967ae6f25fb6298 (patch)
tree22939821529744351ef1fa1eb11b87c146774b48 /src/video_core
parentMerge pull request #1506 from lioncash/enum (diff)
parentPICA: Align vertex attributes (diff)
downloadyuzu-f62935d2787fdc43ed0f102bf967ae6f25fb6298.tar.gz
yuzu-f62935d2787fdc43ed0f102bf967ae6f25fb6298.tar.xz
yuzu-f62935d2787fdc43ed0f102bf967ae6f25fb6298.zip
Merge pull request #1496 from JayFoxRox/align-attribs
Align attribute components
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/command_processor.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 2274dfa66..54721561e 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -5,6 +5,7 @@
5#include <cmath> 5#include <cmath>
6#include <boost/range/algorithm/fill.hpp> 6#include <boost/range/algorithm/fill.hpp>
7 7
8#include "common/alignment.h"
8#include "common/microprofile.h" 9#include "common/microprofile.h"
9#include "common/profiler.h" 10#include "common/profiler.h"
10 11
@@ -210,14 +211,17 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
210 211
211 u32 attribute_index = loader_config.GetComponent(component); 212 u32 attribute_index = loader_config.GetComponent(component);
212 if (attribute_index < 12) { 213 if (attribute_index < 12) {
214 int element_size = attribute_config.GetElementSizeInBytes(attribute_index);
215 load_address = Common::AlignUp(load_address, element_size);
213 vertex_attribute_sources[attribute_index] = load_address; 216 vertex_attribute_sources[attribute_index] = load_address;
214 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); 217 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count);
215 vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index); 218 vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index);
216 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); 219 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index);
217 vertex_attribute_element_size[attribute_index] = attribute_config.GetElementSizeInBytes(attribute_index); 220 vertex_attribute_element_size[attribute_index] = element_size;
218 load_address += attribute_config.GetStride(attribute_index); 221 load_address += attribute_config.GetStride(attribute_index);
219 } else if (attribute_index < 16) { 222 } else if (attribute_index < 16) {
220 // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, respectively 223 // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, respectively
224 load_address = Common::AlignUp(load_address, 4);
221 load_address += (attribute_index - 11) * 4; 225 load_address += (attribute_index - 11) * 4;
222 } else { 226 } else {
223 UNREACHABLE(); // This is truly unreachable due to the number of bits for each component 227 UNREACHABLE(); // This is truly unreachable due to the number of bits for each component