summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-24 13:46:07 +0200
committerGitHub <noreply@github.com>2018-07-24 13:46:07 +0200
commit0f830d08f167bc08660f6eddccda9e0193e03931 (patch)
tree68fdf1aaae210d4c88142ead2972e248d58df098 /src/video_core
parentMerge pull request #794 from lioncash/ref (diff)
parentGPU: Implement texture format R32F. (diff)
downloadyuzu-0f830d08f167bc08660f6eddccda9e0193e03931.tar
yuzu-0f830d08f167bc08660f6eddccda9e0193e03931.tar.gz
yuzu-0f830d08f167bc08660f6eddccda9e0193e03931.tar.bz2
yuzu-0f830d08f167bc08660f6eddccda9e0193e03931.tar.lz
yuzu-0f830d08f167bc08660f6eddccda9e0193e03931.tar.xz
yuzu-0f830d08f167bc08660f6eddccda9e0193e03931.tar.zst
yuzu-0f830d08f167bc08660f6eddccda9e0193e03931.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h15
-rw-r--r--src/video_core/textures/decoders.cpp3
3 files changed, 19 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 8f99864a0..1d3aff97b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -110,6 +110,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
{GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
{GL_RGBA32F, GL_RGBA, GL_FLOAT, ComponentType::Float, false}, // RGBA32F
{GL_RG32F, GL_RG, GL_FLOAT, ComponentType::Float, false}, // RG32F
+ {GL_R32F, GL_RED, GL_FLOAT, ComponentType::Float, false}, // R32F
// DepthStencil formats
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, ComponentType::UNorm,
@@ -203,8 +204,9 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>,
MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>,
MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>,
- MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>,
- MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>,
+ MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::Z24S8>,
+ MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>,
+ MortonCopy<true, PixelFormat::Z16>,
};
static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
@@ -229,6 +231,7 @@ static constexpr std::array<void (*)(u32, u32, u32, u8*, Tegra::GPUVAddr),
MortonCopy<false, PixelFormat::BGRA8>,
MortonCopy<false, PixelFormat::RGBA32F>,
MortonCopy<false, PixelFormat::RG32F>,
+ MortonCopy<false, PixelFormat::R32F>,
MortonCopy<false, PixelFormat::Z24S8>,
MortonCopy<false, PixelFormat::S8Z24>,
MortonCopy<false, PixelFormat::Z32F>,
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 23efbe67c..800d239d9 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -40,14 +40,15 @@ struct SurfaceParams {
BGRA8 = 15,
RGBA32F = 16,
RG32F = 17,
+ R32F = 18,
MaxColorFormat,
// DepthStencil formats
- Z24S8 = 18,
- S8Z24 = 19,
- Z32F = 20,
- Z16 = 21,
+ Z24S8 = 19,
+ S8Z24 = 20,
+ Z32F = 21,
+ Z16 = 22,
MaxDepthStencilFormat,
@@ -103,6 +104,7 @@ struct SurfaceParams {
1, // BGRA8
1, // RGBA32F
1, // RG32F
+ 1, // R32F
1, // Z24S8
1, // S8Z24
1, // Z32F
@@ -136,6 +138,7 @@ struct SurfaceParams {
32, // BGRA8
128, // RGBA32F
64, // RG32F
+ 32, // R32F
32, // Z24S8
32, // S8Z24
32, // Z32F
@@ -223,6 +226,8 @@ struct SurfaceParams {
UNREACHABLE();
case Tegra::Texture::TextureFormat::R32_G32:
return PixelFormat::RG32F;
+ case Tegra::Texture::TextureFormat::R32:
+ return PixelFormat::R32F;
case Tegra::Texture::TextureFormat::DXT1:
return PixelFormat::DXT1;
case Tegra::Texture::TextureFormat::DXT23:
@@ -283,6 +288,8 @@ struct SurfaceParams {
return Tegra::Texture::TextureFormat::R32_G32_B32_A32;
case PixelFormat::RG32F:
return Tegra::Texture::TextureFormat::R32_G32;
+ case PixelFormat::R32F:
+ return Tegra::Texture::TextureFormat::R32;
default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}", static_cast<u32>(format));
UNREACHABLE();
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index e5e9e1898..cda2646ad 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -61,6 +61,7 @@ u32 BytesPerPixel(TextureFormat format) {
case TextureFormat::A8R8G8B8:
case TextureFormat::A2B10G10R10:
case TextureFormat::BF10GF11RF11:
+ case TextureFormat::R32:
return 4;
case TextureFormat::A1B5G5R5:
case TextureFormat::B5G6R5:
@@ -121,6 +122,7 @@ std::vector<u8> UnswizzleTexture(VAddr address, TextureFormat format, u32 width,
case TextureFormat::R16_G16_B16_A16:
case TextureFormat::R32_G32_B32_A32:
case TextureFormat::R32_G32:
+ case TextureFormat::R32:
case TextureFormat::BF10GF11RF11:
case TextureFormat::ASTC_2D_4X4:
CopySwizzledData(width, height, bytes_per_pixel, bytes_per_pixel, data,
@@ -178,6 +180,7 @@ std::vector<u8> DecodeTexture(const std::vector<u8>& texture_data, TextureFormat
case TextureFormat::BF10GF11RF11:
case TextureFormat::R32_G32_B32_A32:
case TextureFormat::R32_G32:
+ case TextureFormat::R32:
// TODO(Subv): For the time being just forward the same data without any decoding.
rgba_data = texture_data;
break;