summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/color.h50
-rw-r--r--src/common/vector_math.h6
-rw-r--r--src/video_core/gpu.h1
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp5
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp42
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h52
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h3
-rw-r--r--src/video_core/textures/decoders.cpp3
8 files changed, 100 insertions, 62 deletions
diff --git a/src/common/color.h b/src/common/color.h
index 24a445dac..0379040be 100644
--- a/src/common/color.h
+++ b/src/common/color.h
@@ -4,6 +4,8 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cstring>
8
7#include "common/common_types.h" 9#include "common/common_types.h"
8#include "common/swap.h" 10#include "common/swap.h"
9#include "common/vector_math.h" 11#include "common/vector_math.h"
@@ -55,7 +57,7 @@ constexpr u8 Convert8To6(u8 value) {
55 * @param bytes Pointer to encoded source color 57 * @param bytes Pointer to encoded source color
56 * @return Result color decoded as Math::Vec4<u8> 58 * @return Result color decoded as Math::Vec4<u8>
57 */ 59 */
58inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) { 60inline Math::Vec4<u8> DecodeRGBA8(const u8* bytes) {
59 return {bytes[3], bytes[2], bytes[1], bytes[0]}; 61 return {bytes[3], bytes[2], bytes[1], bytes[0]};
60} 62}
61 63
@@ -64,7 +66,7 @@ inline const Math::Vec4<u8> DecodeRGBA8(const u8* bytes) {
64 * @param bytes Pointer to encoded source color 66 * @param bytes Pointer to encoded source color
65 * @return Result color decoded as Math::Vec4<u8> 67 * @return Result color decoded as Math::Vec4<u8>
66 */ 68 */
67inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) { 69inline Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
68 return {bytes[2], bytes[1], bytes[0], 255}; 70 return {bytes[2], bytes[1], bytes[0], 255};
69} 71}
70 72
@@ -73,7 +75,7 @@ inline const Math::Vec4<u8> DecodeRGB8(const u8* bytes) {
73 * @param bytes Pointer to encoded source color 75 * @param bytes Pointer to encoded source color
74 * @return Result color decoded as Math::Vec4<u8> 76 * @return Result color decoded as Math::Vec4<u8>
75 */ 77 */
76inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) { 78inline Math::Vec4<u8> DecodeRG8(const u8* bytes) {
77 return {bytes[1], bytes[0], 0, 255}; 79 return {bytes[1], bytes[0], 0, 255};
78} 80}
79 81
@@ -82,8 +84,9 @@ inline const Math::Vec4<u8> DecodeRG8(const u8* bytes) {
82 * @param bytes Pointer to encoded source color 84 * @param bytes Pointer to encoded source color
83 * @return Result color decoded as Math::Vec4<u8> 85 * @return Result color decoded as Math::Vec4<u8>
84 */ 86 */
85inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) { 87inline Math::Vec4<u8> DecodeRGB565(const u8* bytes) {
86 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes); 88 u16_le pixel;
89 std::memcpy(&pixel, bytes, sizeof(pixel));
87 return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F), 90 return {Convert5To8((pixel >> 11) & 0x1F), Convert6To8((pixel >> 5) & 0x3F),
88 Convert5To8(pixel & 0x1F), 255}; 91 Convert5To8(pixel & 0x1F), 255};
89} 92}
@@ -93,8 +96,9 @@ inline const Math::Vec4<u8> DecodeRGB565(const u8* bytes) {
93 * @param bytes Pointer to encoded source color 96 * @param bytes Pointer to encoded source color
94 * @return Result color decoded as Math::Vec4<u8> 97 * @return Result color decoded as Math::Vec4<u8>
95 */ 98 */
96inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) { 99inline Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) {
97 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes); 100 u16_le pixel;
101 std::memcpy(&pixel, bytes, sizeof(pixel));
98 return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F), 102 return {Convert5To8((pixel >> 11) & 0x1F), Convert5To8((pixel >> 6) & 0x1F),
99 Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1)}; 103 Convert5To8((pixel >> 1) & 0x1F), Convert1To8(pixel & 0x1)};
100} 104}
@@ -104,8 +108,9 @@ inline const Math::Vec4<u8> DecodeRGB5A1(const u8* bytes) {
104 * @param bytes Pointer to encoded source color 108 * @param bytes Pointer to encoded source color
105 * @return Result color decoded as Math::Vec4<u8> 109 * @return Result color decoded as Math::Vec4<u8>
106 */ 110 */
107inline const Math::Vec4<u8> DecodeRGBA4(const u8* bytes) { 111inline Math::Vec4<u8> DecodeRGBA4(const u8* bytes) {
108 const u16_le pixel = *reinterpret_cast<const u16_le*>(bytes); 112 u16_le pixel;
113 std::memcpy(&pixel, bytes, sizeof(pixel));
109 return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF), 114 return {Convert4To8((pixel >> 12) & 0xF), Convert4To8((pixel >> 8) & 0xF),
110 Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF)}; 115 Convert4To8((pixel >> 4) & 0xF), Convert4To8(pixel & 0xF)};
111} 116}
@@ -116,7 +121,9 @@ inline const Math::Vec4<u8> DecodeRGBA4(const u8* bytes) {
116 * @return Depth value as an u32 121 * @return Depth value as an u32
117 */ 122 */
118inline u32 DecodeD16(const u8* bytes) { 123inline u32 DecodeD16(const u8* bytes) {
119 return *reinterpret_cast<const u16_le*>(bytes); 124 u16_le data;
125 std::memcpy(&data, bytes, sizeof(data));
126 return data;
120} 127}
121 128
122/** 129/**
@@ -133,7 +140,7 @@ inline u32 DecodeD24(const u8* bytes) {
133 * @param bytes Pointer to encoded source values 140 * @param bytes Pointer to encoded source values
134 * @return Resulting values stored as a Math::Vec2 141 * @return Resulting values stored as a Math::Vec2
135 */ 142 */
136inline const Math::Vec2<u32> DecodeD24S8(const u8* bytes) { 143inline Math::Vec2<u32> DecodeD24S8(const u8* bytes) {
137 return {static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]}; 144 return {static_cast<u32>((bytes[2] << 16) | (bytes[1] << 8) | bytes[0]), bytes[3]};
138} 145}
139 146
@@ -175,8 +182,10 @@ inline void EncodeRG8(const Math::Vec4<u8>& color, u8* bytes) {
175 * @param bytes Destination pointer to store encoded color 182 * @param bytes Destination pointer to store encoded color
176 */ 183 */
177inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) { 184inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) {
178 *reinterpret_cast<u16_le*>(bytes) = 185 const u16_le data =
179 (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b()); 186 (Convert8To5(color.r()) << 11) | (Convert8To6(color.g()) << 5) | Convert8To5(color.b());
187
188 std::memcpy(bytes, &data, sizeof(data));
180} 189}
181 190
182/** 191/**
@@ -185,9 +194,10 @@ inline void EncodeRGB565(const Math::Vec4<u8>& color, u8* bytes) {
185 * @param bytes Destination pointer to store encoded color 194 * @param bytes Destination pointer to store encoded color
186 */ 195 */
187inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) { 196inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) {
188 *reinterpret_cast<u16_le*>(bytes) = (Convert8To5(color.r()) << 11) | 197 const u16_le data = (Convert8To5(color.r()) << 11) | (Convert8To5(color.g()) << 6) |
189 (Convert8To5(color.g()) << 6) | 198 (Convert8To5(color.b()) << 1) | Convert8To1(color.a());
190 (Convert8To5(color.b()) << 1) | Convert8To1(color.a()); 199
200 std::memcpy(bytes, &data, sizeof(data));
191} 201}
192 202
193/** 203/**
@@ -196,9 +206,10 @@ inline void EncodeRGB5A1(const Math::Vec4<u8>& color, u8* bytes) {
196 * @param bytes Destination pointer to store encoded color 206 * @param bytes Destination pointer to store encoded color
197 */ 207 */
198inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) { 208inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) {
199 *reinterpret_cast<u16_le*>(bytes) = (Convert8To4(color.r()) << 12) | 209 const u16 data = (Convert8To4(color.r()) << 12) | (Convert8To4(color.g()) << 8) |
200 (Convert8To4(color.g()) << 8) | 210 (Convert8To4(color.b()) << 4) | Convert8To4(color.a());
201 (Convert8To4(color.b()) << 4) | Convert8To4(color.a()); 211
212 std::memcpy(bytes, &data, sizeof(data));
202} 213}
203 214
204/** 215/**
@@ -207,7 +218,8 @@ inline void EncodeRGBA4(const Math::Vec4<u8>& color, u8* bytes) {
207 * @param bytes Pointer where to store the encoded value 218 * @param bytes Pointer where to store the encoded value
208 */ 219 */
209inline void EncodeD16(u32 value, u8* bytes) { 220inline void EncodeD16(u32 value, u8* bytes) {
210 *reinterpret_cast<u16_le*>(bytes) = value & 0xFFFF; 221 const u16_le data = static_cast<u16>(value);
222 std::memcpy(bytes, &data, sizeof(data));
211} 223}
212 224
213/** 225/**
diff --git a/src/common/vector_math.h b/src/common/vector_math.h
index 5c94fcda3..8feb49941 100644
--- a/src/common/vector_math.h
+++ b/src/common/vector_math.h
@@ -78,7 +78,7 @@ public:
78 } 78 }
79 79
80 template <typename U = T> 80 template <typename U = T>
81 constexpr Vec2<std::enable_if_t<std::is_signed<U>::value, U>> operator-() const { 81 constexpr Vec2<std::enable_if_t<std::is_signed_v<U>, U>> operator-() const {
82 return {-x, -y}; 82 return {-x, -y};
83 } 83 }
84 constexpr Vec2<decltype(T{} * T{})> operator*(const Vec2& other) const { 84 constexpr Vec2<decltype(T{} * T{})> operator*(const Vec2& other) const {
@@ -227,7 +227,7 @@ public:
227 } 227 }
228 228
229 template <typename U = T> 229 template <typename U = T>
230 constexpr Vec3<std::enable_if_t<std::is_signed<U>::value, U>> operator-() const { 230 constexpr Vec3<std::enable_if_t<std::is_signed_v<U>, U>> operator-() const {
231 return {-x, -y, -z}; 231 return {-x, -y, -z};
232 } 232 }
233 233
@@ -436,7 +436,7 @@ public:
436 } 436 }
437 437
438 template <typename U = T> 438 template <typename U = T>
439 constexpr Vec4<std::enable_if_t<std::is_signed<U>::value, U>> operator-() const { 439 constexpr Vec4<std::enable_if_t<std::is_signed_v<U>, U>> operator-() const {
440 return {-x, -y, -z, -w}; 440 return {-x, -y, -z, -w};
441 } 441 }
442 442
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 440505c9d..874eddd78 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -34,6 +34,7 @@ enum class RenderTargetFormat : u32 {
34 RG16_FLOAT = 0xDE, 34 RG16_FLOAT = 0xDE,
35 R11G11B10_FLOAT = 0xE0, 35 R11G11B10_FLOAT = 0xE0,
36 R32_FLOAT = 0xE5, 36 R32_FLOAT = 0xE5,
37 B5G6R5_UNORM = 0xE8,
37 R16_FLOAT = 0xF2, 38 R16_FLOAT = 0xF2,
38 R8_UNORM = 0xF3, 39 R8_UNORM = 0xF3,
39}; 40};
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index bf6b5c3a0..546e86532 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -324,6 +324,11 @@ std::pair<Surface, Surface> RasterizerOpenGL::ConfigureFramebuffers(bool using_c
324 bool using_depth_fb) { 324 bool using_depth_fb) {
325 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; 325 const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
326 326
327 if (regs.rt[0].format == Tegra::RenderTargetFormat::NONE) {
328 LOG_ERROR(HW_GPU, "RenderTargetFormat is not configured");
329 using_color_fb = false;
330 }
331
327 // TODO(bunnei): Implement this 332 // TODO(bunnei): Implement this
328 const bool has_stencil = false; 333 const bool has_stencil = false;
329 334
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 257aa9571..8b6d1b89d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -109,6 +109,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
109 {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 109 {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
110 true}, // DXT45 110 true}, // DXT45
111 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1 111 {GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN1
112 {GL_COMPRESSED_RG_RGTC2, GL_RG, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, true}, // DXN2
112 {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 113 {GL_COMPRESSED_RGBA_BPTC_UNORM_ARB, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
113 true}, // BC7U 114 true}, // BC7U
114 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4 115 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_4X4
@@ -218,17 +219,17 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
218 MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, 219 MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>,
219 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, 220 MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>,
220 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, 221 MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>,
221 MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, 222 MortonCopy<true, PixelFormat::DXN2>, MortonCopy<true, PixelFormat::BC7U>,
222 MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, 223 MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::G8R8>,
223 MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, 224 MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::RGBA32F>,
224 MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, 225 MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::R32F>,
225 MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::RG16>, 226 MortonCopy<true, PixelFormat::R16F>, MortonCopy<true, PixelFormat::R16UNORM>,
226 MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, 227 MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>,
227 MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, 228 MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>,
228 MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, 229 MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>,
229 MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, 230 MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::Z24S8>,
230 MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, 231 MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
231 MortonCopy<true, PixelFormat::Z32FS8>, 232 MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>,
232}; 233};
233 234
234static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr), 235static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -242,7 +243,8 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
242 MortonCopy<false, PixelFormat::RGBA16F>, 243 MortonCopy<false, PixelFormat::RGBA16F>,
243 MortonCopy<false, PixelFormat::R11FG11FB10F>, 244 MortonCopy<false, PixelFormat::R11FG11FB10F>,
244 MortonCopy<false, PixelFormat::RGBA32UI>, 245 MortonCopy<false, PixelFormat::RGBA32UI>,
245 // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/BC7U/ASTC_2D_4X4 formats is not supported 246 // TODO(Subv): Swizzling DXT1/DXT23/DXT45/DXN1/DXN2/BC7U/ASTC_2D_4X4 formats is not
247 // supported
246 nullptr, 248 nullptr,
247 nullptr, 249 nullptr,
248 nullptr, 250 nullptr,
@@ -447,22 +449,24 @@ MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64
447void CachedSurface::LoadGLBuffer() { 449void CachedSurface::LoadGLBuffer() {
448 ASSERT(params.type != SurfaceType::Fill); 450 ASSERT(params.type != SurfaceType::Fill);
449 451
450 u8* const texture_src_data = Memory::GetPointer(params.GetCpuAddr()); 452 const u8* const texture_src_data = Memory::GetPointer(params.GetCpuAddr());
451 453
452 ASSERT(texture_src_data); 454 ASSERT(texture_src_data);
453 455
454 gl_buffer.resize(params.width * params.height * GetGLBytesPerPixel(params.pixel_format)); 456 const u32 bytes_per_pixel = GetGLBytesPerPixel(params.pixel_format);
457 const u32 copy_size = params.width * params.height * bytes_per_pixel;
455 458
456 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); 459 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad);
457 460
458 if (!params.is_tiled) { 461 if (params.is_tiled) {
459 const u32 bytes_per_pixel{params.GetFormatBpp() >> 3}; 462 gl_buffer.resize(copy_size);
460 463
461 std::memcpy(gl_buffer.data(), texture_src_data,
462 bytes_per_pixel * params.width * params.height);
463 } else {
464 morton_to_gl_fns[static_cast<size_t>(params.pixel_format)]( 464 morton_to_gl_fns[static_cast<size_t>(params.pixel_format)](
465 params.width, params.block_height, params.height, gl_buffer.data(), params.addr); 465 params.width, params.block_height, params.height, gl_buffer.data(), params.addr);
466 } else {
467 const u8* const texture_src_data_end = texture_src_data + copy_size;
468
469 gl_buffer.assign(texture_src_data, texture_src_data_end);
466 } 470 }
467 471
468 ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer, params.pixel_format, params.width, params.height); 472 ConvertFormatAsNeeded_LoadGLBuffer(gl_buffer, params.pixel_format, params.width, params.height);
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 0c6652c7a..6f01b2bf0 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -35,31 +35,32 @@ struct SurfaceParams {
35 DXT23 = 9, 35 DXT23 = 9,
36 DXT45 = 10, 36 DXT45 = 10,
37 DXN1 = 11, // This is also known as BC4 37 DXN1 = 11, // This is also known as BC4
38 BC7U = 12, 38 DXN2 = 12, // This is also known as BC5
39 ASTC_2D_4X4 = 13, 39 BC7U = 13,
40 G8R8 = 14, 40 ASTC_2D_4X4 = 14,
41 BGRA8 = 15, 41 G8R8 = 15,
42 RGBA32F = 16, 42 BGRA8 = 16,
43 RG32F = 17, 43 RGBA32F = 17,
44 R32F = 18, 44 RG32F = 18,
45 R16F = 19, 45 R32F = 19,
46 R16UNORM = 20, 46 R16F = 20,
47 RG16 = 21, 47 R16UNORM = 21,
48 RG16F = 22, 48 RG16 = 22,
49 RG16UI = 23, 49 RG16F = 23,
50 RG16I = 24, 50 RG16UI = 24,
51 RG16S = 25, 51 RG16I = 25,
52 RGB32F = 26, 52 RG16S = 26,
53 SRGBA8 = 27, 53 RGB32F = 27,
54 SRGBA8 = 28,
54 55
55 MaxColorFormat, 56 MaxColorFormat,
56 57
57 // DepthStencil formats 58 // DepthStencil formats
58 Z24S8 = 28, 59 Z24S8 = 29,
59 S8Z24 = 29, 60 S8Z24 = 30,
60 Z32F = 30, 61 Z32F = 31,
61 Z16 = 31, 62 Z16 = 32,
62 Z32FS8 = 32, 63 Z32FS8 = 33,
63 64
64 MaxDepthStencilFormat, 65 MaxDepthStencilFormat,
65 66
@@ -109,6 +110,7 @@ struct SurfaceParams {
109 4, // DXT23 110 4, // DXT23
110 4, // DXT45 111 4, // DXT45
111 4, // DXN1 112 4, // DXN1
113 4, // DXN2
112 4, // BC7U 114 4, // BC7U
113 4, // ASTC_2D_4X4 115 4, // ASTC_2D_4X4
114 1, // G8R8 116 1, // G8R8
@@ -153,6 +155,7 @@ struct SurfaceParams {
153 128, // DXT23 155 128, // DXT23
154 128, // DXT45 156 128, // DXT45
155 64, // DXN1 157 64, // DXN1
158 128, // DXN2
156 128, // BC7U 159 128, // BC7U
157 32, // ASTC_2D_4X4 160 32, // ASTC_2D_4X4
158 16, // G8R8 161 16, // G8R8
@@ -221,6 +224,8 @@ struct SurfaceParams {
221 return PixelFormat::RG32F; 224 return PixelFormat::RG32F;
222 case Tegra::RenderTargetFormat::R11G11B10_FLOAT: 225 case Tegra::RenderTargetFormat::R11G11B10_FLOAT:
223 return PixelFormat::R11FG11FB10F; 226 return PixelFormat::R11FG11FB10F;
227 case Tegra::RenderTargetFormat::B5G6R5_UNORM:
228 return PixelFormat::B5G6R5;
224 case Tegra::RenderTargetFormat::RGBA32_UINT: 229 case Tegra::RenderTargetFormat::RGBA32_UINT:
225 return PixelFormat::RGBA32UI; 230 return PixelFormat::RGBA32UI;
226 case Tegra::RenderTargetFormat::R8_UNORM: 231 case Tegra::RenderTargetFormat::R8_UNORM:
@@ -303,6 +308,8 @@ struct SurfaceParams {
303 return PixelFormat::DXT45; 308 return PixelFormat::DXT45;
304 case Tegra::Texture::TextureFormat::DXN1: 309 case Tegra::Texture::TextureFormat::DXN1:
305 return PixelFormat::DXN1; 310 return PixelFormat::DXN1;
311 case Tegra::Texture::TextureFormat::DXN2:
312 return PixelFormat::DXN2;
306 case Tegra::Texture::TextureFormat::BC7U: 313 case Tegra::Texture::TextureFormat::BC7U:
307 return PixelFormat::BC7U; 314 return PixelFormat::BC7U;
308 case Tegra::Texture::TextureFormat::ASTC_2D_4X4: 315 case Tegra::Texture::TextureFormat::ASTC_2D_4X4:
@@ -360,6 +367,8 @@ struct SurfaceParams {
360 return Tegra::Texture::TextureFormat::DXT45; 367 return Tegra::Texture::TextureFormat::DXT45;
361 case PixelFormat::DXN1: 368 case PixelFormat::DXN1:
362 return Tegra::Texture::TextureFormat::DXN1; 369 return Tegra::Texture::TextureFormat::DXN1;
370 case PixelFormat::DXN2:
371 return Tegra::Texture::TextureFormat::DXN2;
363 case PixelFormat::BC7U: 372 case PixelFormat::BC7U:
364 return Tegra::Texture::TextureFormat::BC7U; 373 return Tegra::Texture::TextureFormat::BC7U;
365 case PixelFormat::ASTC_2D_4X4: 374 case PixelFormat::ASTC_2D_4X4:
@@ -441,6 +450,7 @@ struct SurfaceParams {
441 case Tegra::RenderTargetFormat::RGB10_A2_UNORM: 450 case Tegra::RenderTargetFormat::RGB10_A2_UNORM:
442 case Tegra::RenderTargetFormat::R8_UNORM: 451 case Tegra::RenderTargetFormat::R8_UNORM:
443 case Tegra::RenderTargetFormat::RG16_UNORM: 452 case Tegra::RenderTargetFormat::RG16_UNORM:
453 case Tegra::RenderTargetFormat::B5G6R5_UNORM:
444 return ComponentType::UNorm; 454 return ComponentType::UNorm;
445 case Tegra::RenderTargetFormat::RG16_SNORM: 455 case Tegra::RenderTargetFormat::RG16_SNORM:
446 return ComponentType::SNorm; 456 return ComponentType::SNorm;
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index 500d4d4b1..43be69dd1 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -31,6 +31,7 @@ inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
31 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 31 case Maxwell::VertexAttribute::Size::Size_8_8_8_8:
32 return GL_UNSIGNED_BYTE; 32 return GL_UNSIGNED_BYTE;
33 case Maxwell::VertexAttribute::Size::Size_16_16: 33 case Maxwell::VertexAttribute::Size::Size_16_16:
34 case Maxwell::VertexAttribute::Size::Size_16_16_16_16:
34 return GL_UNSIGNED_SHORT; 35 return GL_UNSIGNED_SHORT;
35 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 36 case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
36 return GL_UNSIGNED_INT_2_10_10_10_REV; 37 return GL_UNSIGNED_INT_2_10_10_10_REV;
@@ -85,6 +86,8 @@ inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
85 86
86inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) { 87inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) {
87 switch (topology) { 88 switch (topology) {
89 case Maxwell::PrimitiveTopology::Points:
90 return GL_POINTS;
88 case Maxwell::PrimitiveTopology::Triangles: 91 case Maxwell::PrimitiveTopology::Triangles:
89 return GL_TRIANGLES; 92 return GL_TRIANGLES;
90 case Maxwell::PrimitiveTopology::TriangleStrip: 93 case Maxwell::PrimitiveTopology::TriangleStrip:
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index 65db84ad3..7ea66584c 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -54,6 +54,7 @@ u32 BytesPerPixel(TextureFormat format) {
54 return 8; 54 return 8;
55 case TextureFormat::DXT23: 55 case TextureFormat::DXT23:
56 case TextureFormat::DXT45: 56 case TextureFormat::DXT45:
57 case TextureFormat::DXN2:
57 case TextureFormat::BC7U: 58 case TextureFormat::BC7U:
58 // In this case a 'pixel' actually refers to a 4x4 tile. 59 // In this case a 'pixel' actually refers to a 4x4 tile.
59 return 16; 60 return 16;
@@ -113,6 +114,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
113 case TextureFormat::DXT23: 114 case TextureFormat::DXT23:
114 case TextureFormat::DXT45: 115 case TextureFormat::DXT45:
115 case TextureFormat::DXN1: 116 case TextureFormat::DXN1:
117 case TextureFormat::DXN2:
116 case TextureFormat::BC7U: 118 case TextureFormat::BC7U:
117 // In the DXT and DXN formats, each 4x4 tile is swizzled instead of just individual pixel 119 // In the DXT and DXN formats, each 4x4 tile is swizzled instead of just individual pixel
118 // values. 120 // values.
@@ -179,6 +181,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
179 case TextureFormat::DXT23: 181 case TextureFormat::DXT23:
180 case TextureFormat::DXT45: 182 case TextureFormat::DXT45:
181 case TextureFormat::DXN1: 183 case TextureFormat::DXN1:
184 case TextureFormat::DXN2:
182 case TextureFormat::BC7U: 185 case TextureFormat::BC7U:
183 case TextureFormat::ASTC_2D_4X4: 186 case TextureFormat::ASTC_2D_4X4:
184 case TextureFormat::A8R8G8B8: 187 case TextureFormat::A8R8G8B8: