summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar bunnei2021-11-11 18:13:35 -0800
committerGravatar bunnei2022-03-24 18:13:32 -0700
commitd456b9d554da32e4353ba6e837e1cb8690782a9d (patch)
tree75029812af06aabfcc83d29098db4ff85e929ea5 /src/video_core
parenthle: nvflinger: Add implementation for GraphicBuffer class. (diff)
downloadyuzu-d456b9d554da32e4353ba6e837e1cb8690782a9d.tar.gz
yuzu-d456b9d554da32e4353ba6e837e1cb8690782a9d.tar.xz
yuzu-d456b9d554da32e4353ba6e837e1cb8690782a9d.zip
hle: nvflinger: Move PixelFormat to its own header.
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/framebuffer_config.h10
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp8
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h4
-rw-r--r--src/video_core/renderer_vulkan/vk_blit_screen.cpp10
-rw-r--r--src/video_core/surface.cpp8
-rw-r--r--src/video_core/surface.h2
6 files changed, 19 insertions, 23 deletions
diff --git a/src/video_core/framebuffer_config.h b/src/video_core/framebuffer_config.h
index b1d455e30..5921d830e 100644
--- a/src/video_core/framebuffer_config.h
+++ b/src/video_core/framebuffer_config.h
@@ -6,18 +6,14 @@
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/math_util.h" 8#include "common/math_util.h"
9#include "core/hle/service/nvflinger/pixel_format.h"
9 10
10namespace Tegra { 11namespace Tegra {
12
11/** 13/**
12 * Struct describing framebuffer configuration 14 * Struct describing framebuffer configuration
13 */ 15 */
14struct FramebufferConfig { 16struct FramebufferConfig {
15 enum class PixelFormat : u32 {
16 A8B8G8R8_UNORM = 1,
17 RGB565_UNORM = 4,
18 B8G8R8A8_UNORM = 5,
19 };
20
21 enum class TransformFlags : u32 { 17 enum class TransformFlags : u32 {
22 /// No transform flags are set 18 /// No transform flags are set
23 Unset = 0x00, 19 Unset = 0x00,
@@ -38,9 +34,9 @@ struct FramebufferConfig {
38 u32 width{}; 34 u32 width{};
39 u32 height{}; 35 u32 height{};
40 u32 stride{}; 36 u32 stride{};
41 PixelFormat pixel_format{};
42 37
43 TransformFlags transform_flags{}; 38 TransformFlags transform_flags{};
39 android::PixelFormat pixel_format{};
44 Common::Rectangle<int> crop_rect; 40 Common::Rectangle<int> crop_rect;
45}; 41};
46 42
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 795c97831..279421962 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -323,12 +323,12 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
323 323
324 GLint internal_format; 324 GLint internal_format;
325 switch (framebuffer.pixel_format) { 325 switch (framebuffer.pixel_format) {
326 case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: 326 case android::PixelFormat::Rgba8888:
327 internal_format = GL_RGBA8; 327 internal_format = GL_RGBA8;
328 texture.gl_format = GL_RGBA; 328 texture.gl_format = GL_RGBA;
329 texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; 329 texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
330 break; 330 break;
331 case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: 331 case android::PixelFormat::Rgb565:
332 internal_format = GL_RGB565; 332 internal_format = GL_RGB565;
333 texture.gl_format = GL_RGB; 333 texture.gl_format = GL_RGB;
334 texture.gl_type = GL_UNSIGNED_SHORT_5_6_5; 334 texture.gl_type = GL_UNSIGNED_SHORT_5_6_5;
@@ -464,8 +464,8 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
464 const auto& texcoords = screen_info.display_texcoords; 464 const auto& texcoords = screen_info.display_texcoords;
465 auto left = texcoords.left; 465 auto left = texcoords.left;
466 auto right = texcoords.right; 466 auto right = texcoords.right;
467 if (framebuffer_transform_flags != Tegra::FramebufferConfig::TransformFlags::Unset) { 467 if (framebuffer_transform_flags != android::BufferTransformFlags::Unset) {
468 if (framebuffer_transform_flags == Tegra::FramebufferConfig::TransformFlags::FlipV) { 468 if (framebuffer_transform_flags == android::BufferTransformFlags::FlipV) {
469 // Flip the framebuffer vertically 469 // Flip the framebuffer vertically
470 left = texcoords.right; 470 left = texcoords.right;
471 right = texcoords.left; 471 right = texcoords.left;
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index 35706cf05..e6395b900 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -46,7 +46,7 @@ struct TextureInfo {
46 GLsizei height; 46 GLsizei height;
47 GLenum gl_format; 47 GLenum gl_format;
48 GLenum gl_type; 48 GLenum gl_type;
49 Tegra::FramebufferConfig::PixelFormat pixel_format; 49 android::PixelFormat pixel_format;
50}; 50};
51 51
52/// Structure used for storing information about the display target for the Switch screen 52/// Structure used for storing information about the display target for the Switch screen
@@ -135,7 +135,7 @@ private:
135 std::vector<u8> gl_framebuffer_data; 135 std::vector<u8> gl_framebuffer_data;
136 136
137 /// Used for transforming the framebuffer orientation 137 /// Used for transforming the framebuffer orientation
138 Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags{}; 138 android::BufferTransformFlags framebuffer_transform_flags{};
139 Common::Rectangle<int> framebuffer_crop_rect; 139 Common::Rectangle<int> framebuffer_crop_rect;
140}; 140};
141 141
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp
index 0ec85682b..3da16c422 100644
--- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp
+++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp
@@ -94,11 +94,11 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) {
94 94
95VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { 95VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) {
96 switch (framebuffer.pixel_format) { 96 switch (framebuffer.pixel_format) {
97 case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: 97 case android::PixelFormat::Rgba8888:
98 return VK_FORMAT_A8B8G8R8_UNORM_PACK32; 98 return VK_FORMAT_A8B8G8R8_UNORM_PACK32;
99 case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: 99 case android::PixelFormat::Rgb565:
100 return VK_FORMAT_R5G6B5_UNORM_PACK16; 100 return VK_FORMAT_R5G6B5_UNORM_PACK16;
101 case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: 101 case android::PixelFormat::Bgra8888:
102 return VK_FORMAT_B8G8R8A8_UNORM; 102 return VK_FORMAT_B8G8R8A8_UNORM;
103 default: 103 default:
104 UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", 104 UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}",
@@ -1390,9 +1390,9 @@ void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfi
1390 auto right = texcoords.right; 1390 auto right = texcoords.right;
1391 1391
1392 switch (framebuffer_transform_flags) { 1392 switch (framebuffer_transform_flags) {
1393 case Tegra::FramebufferConfig::TransformFlags::Unset: 1393 case android::BufferTransformFlags::Unset:
1394 break; 1394 break;
1395 case Tegra::FramebufferConfig::TransformFlags::FlipV: 1395 case android::BufferTransformFlags::FlipV:
1396 // Flip the framebuffer vertically 1396 // Flip the framebuffer vertically
1397 left = texcoords.right; 1397 left = texcoords.right;
1398 right = texcoords.left; 1398 right = texcoords.left;
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index a36015c8c..f7d29534e 100644
--- a/src/video_core/surface.cpp
+++ b/src/video_core/surface.cpp
@@ -190,13 +190,13 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
190 } 190 }
191} 191}
192 192
193PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { 193PixelFormat PixelFormatFromGPUPixelFormat(android::PixelFormat format) {
194 switch (format) { 194 switch (format) {
195 case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: 195 case android::PixelFormat::Rgba8888:
196 return PixelFormat::A8B8G8R8_UNORM; 196 return PixelFormat::A8B8G8R8_UNORM;
197 case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: 197 case android::PixelFormat::Rgb565:
198 return PixelFormat::R5G6B5_UNORM; 198 return PixelFormat::R5G6B5_UNORM;
199 case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: 199 case android::PixelFormat::Bgra8888:
200 return PixelFormat::B8G8R8A8_UNORM; 200 return PixelFormat::B8G8R8A8_UNORM;
201 default: 201 default:
202 UNIMPLEMENTED_MSG("Unimplemented format={}", format); 202 UNIMPLEMENTED_MSG("Unimplemented format={}", format);
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index 33e8d24ab..1061b2fa7 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -460,7 +460,7 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format);
460 460
461PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format); 461PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format);
462 462
463PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format); 463PixelFormat PixelFormatFromGPUPixelFormat(android::PixelFormat format);
464 464
465SurfaceType GetFormatType(PixelFormat pixel_format); 465SurfaceType GetFormatType(PixelFormat pixel_format);
466 466