summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-03-24 07:01:03 +0100
committerbunnei <bunneidev@gmail.com>2018-03-27 03:16:52 +0200
commited2134784e173e071a124c768eea5dd12be8425c (patch)
tree81321ef22c0e035872aa9f3e2aeb6a4b9753039c /src/video_core
parentgl_rasterizer_cache: MortonCopy Switch-style. (diff)
downloadyuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar
yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.gz
yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.bz2
yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.lz
yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.xz
yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.zst
yuzu-ed2134784e173e071a124c768eea5dd12be8425c.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/engines/maxwell_3d.h35
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp22
2 files changed, 56 insertions, 1 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 3c49cd27f..869ddde90 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -229,6 +229,41 @@ public:
BitField<21, 6, VertexSize> size;
BitField<27, 3, VertexType> type;
BitField<31, 1, u32> bgra;
+
+ u32 SizeInBytes() const {
+ switch (size) {
+ case VertexSize::Size_32_32_32_32:
+ return 16;
+ case VertexSize::Size_32_32_32:
+ return 12;
+ case VertexSize::Size_16_16_16_16:
+ return 8;
+ case VertexSize::Size_32_32:
+ return 8;
+ case VertexSize::Size_16_16_16:
+ return 6;
+ case VertexSize::Size_8_8_8_8:
+ return 4;
+ case VertexSize::Size_16_16:
+ return 4;
+ case VertexSize::Size_32:
+ return 4;
+ case VertexSize::Size_8_8_8:
+ return 3;
+ case VertexSize::Size_8_8:
+ return 2;
+ case VertexSize::Size_16:
+ return 2;
+ case VertexSize::Size_8:
+ return 1;
+ case VertexSize::Size_10_10_10_2:
+ return 4;
+ case VertexSize::Size_11_11_10:
+ return 4;
+ default:
+ UNREACHABLE();
+ }
+ }
} vertex_attrib_format[NumVertexAttributes];
INSERT_PADDING_WORDS(0xF);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 286491b73..982e84768 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -14,7 +14,10 @@
#include "common/microprofile.h"
#include "common/scope_exit.h"
#include "common/vector_math.h"
+#include "core/core.h"
+#include "core/hle/kernel/process.h"
#include "core/settings.h"
+#include "video_core/engines/maxwell_3d.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/renderer_opengl.h"
@@ -146,7 +149,24 @@ static constexpr std::array<GLenum, 4> vs_attrib_types{
};
void RasterizerOpenGL::AnalyzeVertexArray(bool is_indexed) {
- UNIMPLEMENTED();
+ const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
+ const auto& vertex_attributes = regs.vertex_attrib_format;
+
+ if (is_indexed) {
+ UNREACHABLE();
+ }
+ const u32 vertex_num = regs.vertex_buffer.count;
+
+ vs_input_size = 0;
+ u32 max_offset{};
+ for (const auto& attrib : vertex_attributes) {
+ if (max_offset >= attrib.offset) {
+ continue;
+ }
+ max_offset = attrib.offset;
+ vs_input_size = max_offset + attrib.SizeInBytes();
+ }
+ vs_input_size *= vertex_num;
}
void RasterizerOpenGL::SetupVertexArray(u8* array_ptr, GLintptr buffer_offset) {