2018-03-25 03:09:30 +02:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2018-03-25 05:22:19 +02:00
|
|
|
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size=%s", attrib.SizeString().c_str());
|
2018-03-25 03:09:30 +02:00
|
|
|
UNREACHABLE();
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
case Maxwell::VertexAttribute::Type::Float:
|
|
|
|
return GL_FLOAT;
|
|
|
|
}
|
|
|
|
|
2018-03-25 05:22:19 +02:00
|
|
|
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex type=%s", attrib.TypeString().c_str());
|
2018-03-25 03:09:30 +02:00
|
|
|
UNREACHABLE();
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2018-03-27 02:09:01 +02:00
|
|
|
inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) {
|
|
|
|
switch (topology) {
|
|
|
|
case Maxwell::PrimitiveTopology::TriangleStrip:
|
|
|
|
return GL_TRIANGLE_STRIP;
|
|
|
|
}
|
|
|
|
LOG_CRITICAL(Render_OpenGL, "Unimplemented primitive topology=%d", topology);
|
|
|
|
UNREACHABLE();
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2018-03-27 04:41:05 +02:00
|
|
|
inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode) {
|
|
|
|
switch (filter_mode) {
|
|
|
|
case Tegra::Texture::TextureFilter::Linear:
|
|
|
|
return GL_LINEAR;
|
|
|
|
case Tegra::Texture::TextureFilter::Nearest:
|
|
|
|
return GL_NEAREST;
|
|
|
|
}
|
|
|
|
LOG_CRITICAL(Render_OpenGL, "Unimplemented texture filter mode=%u",
|
|
|
|
static_cast<u32>(filter_mode));
|
|
|
|
UNREACHABLE();
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
|
|
|
|
switch (wrap_mode) {
|
|
|
|
case Tegra::Texture::WrapMode::ClampToEdge:
|
|
|
|
return GL_CLAMP_TO_EDGE;
|
|
|
|
}
|
|
|
|
LOG_CRITICAL(Render_OpenGL, "Unimplemented texture wrap mode=%u", static_cast<u32>(wrap_mode));
|
|
|
|
UNREACHABLE();
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2018-03-25 03:09:30 +02:00
|
|
|
} // namespace MaxwellToGL
|