summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-24 21:09:30 -0400
committerGravatar bunnei2018-03-26 21:16:55 -0400
commit4369af6b7e266112cf4dd234f2008ac41df5c00e (patch)
treebe2411d45b541523b207f40bca461eb2d812a89f
parentmaxwell_3d: Use names that match envytools for VertexType. (diff)
downloadyuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.gz
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.xz
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.zip
maxwell_to_gl: Add module and function for decoding VertexType.
-rw-r--r--src/video_core/CMakeLists.txt1
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h40
2 files changed, 41 insertions, 0 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 3dab81769..841f27d7f 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -31,6 +31,7 @@ add_library(video_core STATIC
31 renderer_opengl/gl_state.h 31 renderer_opengl/gl_state.h
32 renderer_opengl/gl_stream_buffer.cpp 32 renderer_opengl/gl_stream_buffer.cpp
33 renderer_opengl/gl_stream_buffer.h 33 renderer_opengl/gl_stream_buffer.h
34 renderer_opengl/maxwell_to_gl.h
34 renderer_opengl/renderer_opengl.cpp 35 renderer_opengl/renderer_opengl.cpp
35 renderer_opengl/renderer_opengl.h 36 renderer_opengl/renderer_opengl.h
36 textures/decoders.cpp 37 textures/decoders.cpp
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
new file mode 100644
index 000000000..54859b5a0
--- /dev/null
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -0,0 +1,40 @@
1// Copyright 2018 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <array>
8#include <glad/glad.h>
9#include "common/common_types.h"
10#include "common/logging/log.h"
11#include "video_core/engines/maxwell_3d.h"
12
13namespace MaxwellToGL {
14
15using Maxwell = Tegra::Engines::Maxwell3D::Regs;
16
17inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
18 switch (attrib.type) {
19 case Maxwell::VertexAttribute::Type::UnsignedNorm: {
20
21 switch (attrib.size) {
22 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
23 return GL_UNSIGNED_BYTE;
24 }
25
26 LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size=%s", attrib.SizeString());
27 UNREACHABLE();
28 return {};
29 }
30
31 case Maxwell::VertexAttribute::Type::Float:
32 return GL_FLOAT;
33 }
34
35 LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex type=%s", attrib.TypeString());
36 UNREACHABLE();
37 return {};
38}
39
40} // namespace MaxwellToGL