summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-03-25 03:09:30 +0200
committerbunnei <bunneidev@gmail.com>2018-03-27 03:16:55 +0200
commit4369af6b7e266112cf4dd234f2008ac41df5c00e (patch)
treebe2411d45b541523b207f40bca461eb2d812a89f
parentmaxwell_3d: Use names that match envytools for VertexType. (diff)
downloadyuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.gz
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.bz2
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.lz
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.xz
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.tar.zst
yuzu-4369af6b7e266112cf4dd234f2008ac41df5c00e.zip
-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
renderer_opengl/gl_state.h
renderer_opengl/gl_stream_buffer.cpp
renderer_opengl/gl_stream_buffer.h
+ renderer_opengl/maxwell_to_gl.h
renderer_opengl/renderer_opengl.cpp
renderer_opengl/renderer_opengl.h
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 @@
+// Copyright 2018 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <glad/glad.h>
+#include "common/common_types.h"
+#include "common/logging/log.h"
+#include "video_core/engines/maxwell_3d.h"
+
+namespace MaxwellToGL {
+
+using Maxwell = Tegra::Engines::Maxwell3D::Regs;
+
+inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
+ switch (attrib.type) {
+ case Maxwell::VertexAttribute::Type::UnsignedNorm: {
+
+ switch (attrib.size) {
+ case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
+ return GL_UNSIGNED_BYTE;
+ }
+
+ LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size=%s", attrib.SizeString());
+ UNREACHABLE();
+ return {};
+ }
+
+ case Maxwell::VertexAttribute::Type::Float:
+ return GL_FLOAT;
+ }
+
+ LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex type=%s", attrib.TypeString());
+ UNREACHABLE();
+ return {};
+}
+
+} // namespace MaxwellToGL