summaryrefslogtreecommitdiff
path: root/src/video_core/vertex_loader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/vertex_loader.cpp')
-rw-r--r--src/video_core/vertex_loader.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp
index 958201e5e..c2630d9eb 100644
--- a/src/video_core/vertex_loader.cpp
+++ b/src/video_core/vertex_loader.cpp
@@ -23,7 +23,6 @@ namespace Pica {
23 23
24void VertexLoader::Setup(const Pica::Regs& regs) { 24void VertexLoader::Setup(const Pica::Regs& regs) {
25 const auto& attribute_config = regs.vertex_attributes; 25 const auto& attribute_config = regs.vertex_attributes;
26 base_address = attribute_config.GetPhysicalBaseAddress();
27 num_total_attributes = attribute_config.GetNumTotalAttributes(); 26 num_total_attributes = attribute_config.GetNumTotalAttributes();
28 27
29 boost::fill(vertex_attribute_sources, 0xdeadbeef); 28 boost::fill(vertex_attribute_sources, 0xdeadbeef);
@@ -49,7 +48,7 @@ void VertexLoader::Setup(const Pica::Regs& regs) {
49 if (attribute_index < 12) { 48 if (attribute_index < 12) {
50 int element_size = attribute_config.GetElementSizeInBytes(attribute_index); 49 int element_size = attribute_config.GetElementSizeInBytes(attribute_index);
51 offset = Common::AlignUp(offset, element_size); 50 offset = Common::AlignUp(offset, element_size);
52 vertex_attribute_sources[attribute_index] = base_address + loader_config.data_offset + offset; 51 vertex_attribute_sources[attribute_index] = loader_config.data_offset + offset;
53 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); 52 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count);
54 vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index); 53 vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index);
55 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); 54 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index);
@@ -66,7 +65,7 @@ void VertexLoader::Setup(const Pica::Regs& regs) {
66 } 65 }
67} 66}
68 67
69void VertexLoader::LoadVertex(int index, int vertex, Shader::InputVertex& input, MemoryAccesses& memory_accesses) { 68void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, MemoryAccesses& memory_accesses) {
70 for (int i = 0; i < num_total_attributes; ++i) { 69 for (int i = 0; i < num_total_attributes; ++i) {
71 if (vertex_attribute_elements[i] != 0) { 70 if (vertex_attribute_elements[i] != 0) {
72 // Default attribute values set if array elements have < 4 components. This 71 // Default attribute values set if array elements have < 4 components. This
@@ -78,7 +77,7 @@ void VertexLoader::LoadVertex(int index, int vertex, Shader::InputVertex& input,
78 77
79 // Load per-vertex data from the loader arrays 78 // Load per-vertex data from the loader arrays
80 for (unsigned int comp = 0; comp < vertex_attribute_elements[i]; ++comp) { 79 for (unsigned int comp = 0; comp < vertex_attribute_elements[i]; ++comp) {
81 u32 source_addr = vertex_attribute_sources[i] + vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i]; 80 u32 source_addr = base_address + vertex_attribute_sources[i] + vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i];
82 const u8* srcdata = Memory::GetPhysicalPointer(source_addr); 81 const u8* srcdata = Memory::GetPhysicalPointer(source_addr);
83 82
84 if (g_debug_context && Pica::g_debug_context->recorder) { 83 if (g_debug_context && Pica::g_debug_context->recorder) {
@@ -97,7 +96,7 @@ void VertexLoader::LoadVertex(int index, int vertex, Shader::InputVertex& input,
97 LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08x + 0x%04x: %f", 96 LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08x + 0x%04x: %f",
98 comp, i, vertex, index, 97 comp, i, vertex, index,
99 base_address, 98 base_address,
100 vertex_attribute_sources[i] - base_address, 99 vertex_attribute_sources[i],
101 vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i], 100 vertex_attribute_strides[i] * vertex + comp * vertex_attribute_element_size[i],
102 input.attr[i][comp].ToFloat32()); 101 input.attr[i][comp].ToFloat32());
103 } 102 }