diff options
| author | 2018-03-24 02:01:03 -0400 | |
|---|---|---|
| committer | 2018-03-26 21:16:52 -0400 | |
| commit | ed2134784e173e071a124c768eea5dd12be8425c (patch) | |
| tree | 81321ef22c0e035872aa9f3e2aeb6a4b9753039c /src | |
| parent | gl_rasterizer_cache: MortonCopy Switch-style. (diff) | |
| download | yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.gz yuzu-ed2134784e173e071a124c768eea5dd12be8425c.tar.xz yuzu-ed2134784e173e071a124c768eea5dd12be8425c.zip | |
gl_rasterizer: Implement AnalyzeVertexArray.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 35 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 22 |
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: | |||
| 229 | BitField<21, 6, VertexSize> size; | 229 | BitField<21, 6, VertexSize> size; |
| 230 | BitField<27, 3, VertexType> type; | 230 | BitField<27, 3, VertexType> type; |
| 231 | BitField<31, 1, u32> bgra; | 231 | BitField<31, 1, u32> bgra; |
| 232 | |||
| 233 | u32 SizeInBytes() const { | ||
| 234 | switch (size) { | ||
| 235 | case VertexSize::Size_32_32_32_32: | ||
| 236 | return 16; | ||
| 237 | case VertexSize::Size_32_32_32: | ||
| 238 | return 12; | ||
| 239 | case VertexSize::Size_16_16_16_16: | ||
| 240 | return 8; | ||
| 241 | case VertexSize::Size_32_32: | ||
| 242 | return 8; | ||
| 243 | case VertexSize::Size_16_16_16: | ||
| 244 | return 6; | ||
| 245 | case VertexSize::Size_8_8_8_8: | ||
| 246 | return 4; | ||
| 247 | case VertexSize::Size_16_16: | ||
| 248 | return 4; | ||
| 249 | case VertexSize::Size_32: | ||
| 250 | return 4; | ||
| 251 | case VertexSize::Size_8_8_8: | ||
| 252 | return 3; | ||
| 253 | case VertexSize::Size_8_8: | ||
| 254 | return 2; | ||
| 255 | case VertexSize::Size_16: | ||
| 256 | return 2; | ||
| 257 | case VertexSize::Size_8: | ||
| 258 | return 1; | ||
| 259 | case VertexSize::Size_10_10_10_2: | ||
| 260 | return 4; | ||
| 261 | case VertexSize::Size_11_11_10: | ||
| 262 | return 4; | ||
| 263 | default: | ||
| 264 | UNREACHABLE(); | ||
| 265 | } | ||
| 266 | } | ||
| 232 | } vertex_attrib_format[NumVertexAttributes]; | 267 | } vertex_attrib_format[NumVertexAttributes]; |
| 233 | 268 | ||
| 234 | INSERT_PADDING_WORDS(0xF); | 269 | 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 @@ | |||
| 14 | #include "common/microprofile.h" | 14 | #include "common/microprofile.h" |
| 15 | #include "common/scope_exit.h" | 15 | #include "common/scope_exit.h" |
| 16 | #include "common/vector_math.h" | 16 | #include "common/vector_math.h" |
| 17 | #include "core/core.h" | ||
| 18 | #include "core/hle/kernel/process.h" | ||
| 17 | #include "core/settings.h" | 19 | #include "core/settings.h" |
| 20 | #include "video_core/engines/maxwell_3d.h" | ||
| 18 | #include "video_core/renderer_opengl/gl_rasterizer.h" | 21 | #include "video_core/renderer_opengl/gl_rasterizer.h" |
| 19 | #include "video_core/renderer_opengl/gl_shader_gen.h" | 22 | #include "video_core/renderer_opengl/gl_shader_gen.h" |
| 20 | #include "video_core/renderer_opengl/renderer_opengl.h" | 23 | #include "video_core/renderer_opengl/renderer_opengl.h" |
| @@ -146,7 +149,24 @@ static constexpr std::array<GLenum, 4> vs_attrib_types{ | |||
| 146 | }; | 149 | }; |
| 147 | 150 | ||
| 148 | void RasterizerOpenGL::AnalyzeVertexArray(bool is_indexed) { | 151 | void RasterizerOpenGL::AnalyzeVertexArray(bool is_indexed) { |
| 149 | UNIMPLEMENTED(); | 152 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; |
| 153 | const auto& vertex_attributes = regs.vertex_attrib_format; | ||
| 154 | |||
| 155 | if (is_indexed) { | ||
| 156 | UNREACHABLE(); | ||
| 157 | } | ||
| 158 | const u32 vertex_num = regs.vertex_buffer.count; | ||
| 159 | |||
| 160 | vs_input_size = 0; | ||
| 161 | u32 max_offset{}; | ||
| 162 | for (const auto& attrib : vertex_attributes) { | ||
| 163 | if (max_offset >= attrib.offset) { | ||
| 164 | continue; | ||
| 165 | } | ||
| 166 | max_offset = attrib.offset; | ||
| 167 | vs_input_size = max_offset + attrib.SizeInBytes(); | ||
| 168 | } | ||
| 169 | vs_input_size *= vertex_num; | ||
| 150 | } | 170 | } |
| 151 | 171 | ||
| 152 | void RasterizerOpenGL::SetupVertexArray(u8* array_ptr, GLintptr buffer_offset) { | 172 | void RasterizerOpenGL::SetupVertexArray(u8* array_ptr, GLintptr buffer_offset) { |