diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 5 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 43 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.h | 84 |
6 files changed, 85 insertions, 56 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index bec2141ae..1b30ce018 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -93,6 +93,7 @@ public: | |||
| 93 | 93 | ||
| 94 | struct VertexAttribute { | 94 | struct VertexAttribute { |
| 95 | enum class Size : u32 { | 95 | enum class Size : u32 { |
| 96 | Invalid = 0x0, | ||
| 96 | Size_32_32_32_32 = 0x01, | 97 | Size_32_32_32_32 = 0x01, |
| 97 | Size_32_32_32 = 0x02, | 98 | Size_32_32_32 = 0x02, |
| 98 | Size_16_16_16_16 = 0x03, | 99 | Size_16_16_16_16 = 0x03, |
| @@ -257,6 +258,10 @@ public: | |||
| 257 | bool IsNormalized() const { | 258 | bool IsNormalized() const { |
| 258 | return (type == Type::SignedNorm) || (type == Type::UnsignedNorm); | 259 | return (type == Type::SignedNorm) || (type == Type::UnsignedNorm); |
| 259 | } | 260 | } |
| 261 | |||
| 262 | bool IsValid() const { | ||
| 263 | return size != Size::Invalid; | ||
| 264 | } | ||
| 260 | }; | 265 | }; |
| 261 | 266 | ||
| 262 | enum class PrimitiveTopology : u32 { | 267 | enum class PrimitiveTopology : u32 { |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 834940b83..19e7f1161 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -70,6 +70,7 @@ u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | |||
| 70 | case RenderTargetFormat::RG8_SNORM: | 70 | case RenderTargetFormat::RG8_SNORM: |
| 71 | return 2; | 71 | return 2; |
| 72 | case RenderTargetFormat::R8_UNORM: | 72 | case RenderTargetFormat::R8_UNORM: |
| 73 | case RenderTargetFormat::R8_UINT: | ||
| 73 | return 1; | 74 | return 1; |
| 74 | default: | 75 | default: |
| 75 | UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); | 76 | UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format)); |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index de5b037be..e008d8f26 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -42,6 +42,7 @@ enum class RenderTargetFormat : u32 { | |||
| 42 | R16_UINT = 0xF1, | 42 | R16_UINT = 0xF1, |
| 43 | R16_FLOAT = 0xF2, | 43 | R16_FLOAT = 0xF2, |
| 44 | R8_UNORM = 0xF3, | 44 | R8_UNORM = 0xF3, |
| 45 | R8_UINT = 0xF6, | ||
| 45 | }; | 46 | }; |
| 46 | 47 | ||
| 47 | enum class DepthFormat : u32 { | 48 | enum class DepthFormat : u32 { |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 8360feb5d..3646a1b1b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -161,11 +161,16 @@ std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr, | |||
| 161 | // assume every shader uses them all. | 161 | // assume every shader uses them all. |
| 162 | for (unsigned index = 0; index < 16; ++index) { | 162 | for (unsigned index = 0; index < 16; ++index) { |
| 163 | auto& attrib = regs.vertex_attrib_format[index]; | 163 | auto& attrib = regs.vertex_attrib_format[index]; |
| 164 | |||
| 165 | // Ignore invalid attributes. | ||
| 166 | if (!attrib.IsValid()) | ||
| 167 | continue; | ||
| 168 | |||
| 169 | auto& buffer = regs.vertex_array[attrib.buffer]; | ||
| 164 | LOG_TRACE(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}", | 170 | LOG_TRACE(HW_GPU, "vertex attrib {}, count={}, size={}, type={}, offset={}, normalize={}", |
| 165 | index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(), | 171 | index, attrib.ComponentCount(), attrib.SizeString(), attrib.TypeString(), |
| 166 | attrib.offset.Value(), attrib.IsNormalized()); | 172 | attrib.offset.Value(), attrib.IsNormalized()); |
| 167 | 173 | ||
| 168 | auto& buffer = regs.vertex_array[attrib.buffer]; | ||
| 169 | ASSERT(buffer.IsEnabled()); | 174 | ASSERT(buffer.IsEnabled()); |
| 170 | 175 | ||
| 171 | glEnableVertexAttribArray(index); | 176 | glEnableVertexAttribArray(index); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index d055b1dfa..84c250c63 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -99,6 +99,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form | |||
| 99 | false}, // A2B10G10R10 | 99 | false}, // A2B10G10R10 |
| 100 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5 | 100 | {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, ComponentType::UNorm, false}, // A1B5G5R5 |
| 101 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 | 101 | {GL_R8, GL_RED, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // R8 |
| 102 | {GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, ComponentType::UInt, false}, // R8UI | ||
| 102 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F | 103 | {GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, ComponentType::Float, false}, // RGBA16F |
| 103 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, | 104 | {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, |
| 104 | false}, // R11FG11FB10F | 105 | false}, // R11FG11FB10F |
| @@ -233,26 +234,27 @@ void MortonCopy(u32 stride, u32 block_height, u32 height, std::vector<u8>& gl_bu | |||
| 233 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), | 234 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), |
| 234 | SurfaceParams::MaxPixelFormat> | 235 | SurfaceParams::MaxPixelFormat> |
| 235 | morton_to_gl_fns = { | 236 | morton_to_gl_fns = { |
| 236 | MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>, | 237 | MortonCopy<true, PixelFormat::ABGR8U>, MortonCopy<true, PixelFormat::ABGR8S>, |
| 237 | MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>, | 238 | MortonCopy<true, PixelFormat::B5G6R5>, MortonCopy<true, PixelFormat::A2B10G10R10>, |
| 238 | MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>, | 239 | MortonCopy<true, PixelFormat::A1B5G5R5>, MortonCopy<true, PixelFormat::R8>, |
| 239 | MortonCopy<true, PixelFormat::RGBA16F>, MortonCopy<true, PixelFormat::R11FG11FB10F>, | 240 | MortonCopy<true, PixelFormat::R8UI>, MortonCopy<true, PixelFormat::RGBA16F>, |
| 240 | MortonCopy<true, PixelFormat::RGBA32UI>, MortonCopy<true, PixelFormat::DXT1>, | 241 | MortonCopy<true, PixelFormat::R11FG11FB10F>, MortonCopy<true, PixelFormat::RGBA32UI>, |
| 241 | MortonCopy<true, PixelFormat::DXT23>, MortonCopy<true, PixelFormat::DXT45>, | 242 | MortonCopy<true, PixelFormat::DXT1>, MortonCopy<true, PixelFormat::DXT23>, |
| 242 | MortonCopy<true, PixelFormat::DXN1>, MortonCopy<true, PixelFormat::DXN2UNORM>, | 243 | MortonCopy<true, PixelFormat::DXT45>, MortonCopy<true, PixelFormat::DXN1>, |
| 243 | MortonCopy<true, PixelFormat::DXN2SNORM>, MortonCopy<true, PixelFormat::BC7U>, | 244 | MortonCopy<true, PixelFormat::DXN2UNORM>, MortonCopy<true, PixelFormat::DXN2SNORM>, |
| 244 | MortonCopy<true, PixelFormat::ASTC_2D_4X4>, MortonCopy<true, PixelFormat::G8R8>, | 245 | MortonCopy<true, PixelFormat::BC7U>, MortonCopy<true, PixelFormat::ASTC_2D_4X4>, |
| 245 | MortonCopy<true, PixelFormat::BGRA8>, MortonCopy<true, PixelFormat::RGBA32F>, | 246 | MortonCopy<true, PixelFormat::G8R8>, MortonCopy<true, PixelFormat::BGRA8>, |
| 246 | MortonCopy<true, PixelFormat::RG32F>, MortonCopy<true, PixelFormat::R32F>, | 247 | MortonCopy<true, PixelFormat::RGBA32F>, MortonCopy<true, PixelFormat::RG32F>, |
| 247 | MortonCopy<true, PixelFormat::R16F>, MortonCopy<true, PixelFormat::R16UNORM>, | 248 | MortonCopy<true, PixelFormat::R32F>, MortonCopy<true, PixelFormat::R16F>, |
| 248 | MortonCopy<true, PixelFormat::R16S>, MortonCopy<true, PixelFormat::R16UI>, | 249 | MortonCopy<true, PixelFormat::R16UNORM>, MortonCopy<true, PixelFormat::R16S>, |
| 249 | MortonCopy<true, PixelFormat::R16I>, MortonCopy<true, PixelFormat::RG16>, | 250 | MortonCopy<true, PixelFormat::R16UI>, MortonCopy<true, PixelFormat::R16I>, |
| 250 | MortonCopy<true, PixelFormat::RG16F>, MortonCopy<true, PixelFormat::RG16UI>, | 251 | MortonCopy<true, PixelFormat::RG16>, MortonCopy<true, PixelFormat::RG16F>, |
| 251 | MortonCopy<true, PixelFormat::RG16I>, MortonCopy<true, PixelFormat::RG16S>, | 252 | MortonCopy<true, PixelFormat::RG16UI>, MortonCopy<true, PixelFormat::RG16I>, |
| 252 | MortonCopy<true, PixelFormat::RGB32F>, MortonCopy<true, PixelFormat::SRGBA8>, | 253 | MortonCopy<true, PixelFormat::RG16S>, MortonCopy<true, PixelFormat::RGB32F>, |
| 253 | MortonCopy<true, PixelFormat::RG8S>, MortonCopy<true, PixelFormat::Z24S8>, | 254 | MortonCopy<true, PixelFormat::SRGBA8>, MortonCopy<true, PixelFormat::RG8S>, |
| 254 | MortonCopy<true, PixelFormat::S8Z24>, MortonCopy<true, PixelFormat::Z32F>, | 255 | MortonCopy<true, PixelFormat::Z24S8>, MortonCopy<true, PixelFormat::S8Z24>, |
| 255 | MortonCopy<true, PixelFormat::Z16>, MortonCopy<true, PixelFormat::Z32FS8>, | 256 | MortonCopy<true, PixelFormat::Z32F>, MortonCopy<true, PixelFormat::Z16>, |
| 257 | MortonCopy<true, PixelFormat::Z32FS8>, | ||
| 256 | }; | 258 | }; |
| 257 | 259 | ||
| 258 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), | 260 | static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPUVAddr), |
| @@ -264,6 +266,7 @@ static constexpr std::array<void (*)(u32, u32, u32, std::vector<u8>&, Tegra::GPU | |||
| 264 | MortonCopy<false, PixelFormat::A2B10G10R10>, | 266 | MortonCopy<false, PixelFormat::A2B10G10R10>, |
| 265 | MortonCopy<false, PixelFormat::A1B5G5R5>, | 267 | MortonCopy<false, PixelFormat::A1B5G5R5>, |
| 266 | MortonCopy<false, PixelFormat::R8>, | 268 | MortonCopy<false, PixelFormat::R8>, |
| 269 | MortonCopy<false, PixelFormat::R8UI>, | ||
| 267 | MortonCopy<false, PixelFormat::RGBA16F>, | 270 | MortonCopy<false, PixelFormat::RGBA16F>, |
| 268 | MortonCopy<false, PixelFormat::R11FG11FB10F>, | 271 | MortonCopy<false, PixelFormat::R11FG11FB10F>, |
| 269 | MortonCopy<false, PixelFormat::RGBA32UI>, | 272 | MortonCopy<false, PixelFormat::RGBA32UI>, |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index d7a43652e..202257b58 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h | |||
| @@ -29,44 +29,45 @@ struct SurfaceParams { | |||
| 29 | A2B10G10R10 = 3, | 29 | A2B10G10R10 = 3, |
| 30 | A1B5G5R5 = 4, | 30 | A1B5G5R5 = 4, |
| 31 | R8 = 5, | 31 | R8 = 5, |
| 32 | RGBA16F = 6, | 32 | R8UI = 6, |
| 33 | R11FG11FB10F = 7, | 33 | RGBA16F = 7, |
| 34 | RGBA32UI = 8, | 34 | R11FG11FB10F = 8, |
| 35 | DXT1 = 9, | 35 | RGBA32UI = 9, |
| 36 | DXT23 = 10, | 36 | DXT1 = 10, |
| 37 | DXT45 = 11, | 37 | DXT23 = 11, |
| 38 | DXN1 = 12, // This is also known as BC4 | 38 | DXT45 = 12, |
| 39 | DXN2UNORM = 13, | 39 | DXN1 = 13, // This is also known as BC4 |
| 40 | DXN2SNORM = 14, | 40 | DXN2UNORM = 14, |
| 41 | BC7U = 15, | 41 | DXN2SNORM = 15, |
| 42 | ASTC_2D_4X4 = 16, | 42 | BC7U = 16, |
| 43 | G8R8 = 17, | 43 | ASTC_2D_4X4 = 17, |
| 44 | BGRA8 = 18, | 44 | G8R8 = 18, |
| 45 | RGBA32F = 19, | 45 | BGRA8 = 19, |
| 46 | RG32F = 20, | 46 | RGBA32F = 20, |
| 47 | R32F = 21, | 47 | RG32F = 21, |
| 48 | R16F = 22, | 48 | R32F = 22, |
| 49 | R16UNORM = 23, | 49 | R16F = 23, |
| 50 | R16S = 24, | 50 | R16UNORM = 24, |
| 51 | R16UI = 25, | 51 | R16S = 25, |
| 52 | R16I = 26, | 52 | R16UI = 26, |
| 53 | RG16 = 27, | 53 | R16I = 27, |
| 54 | RG16F = 28, | 54 | RG16 = 28, |
| 55 | RG16UI = 29, | 55 | RG16F = 29, |
| 56 | RG16I = 30, | 56 | RG16UI = 30, |
| 57 | RG16S = 31, | 57 | RG16I = 31, |
| 58 | RGB32F = 32, | 58 | RG16S = 32, |
| 59 | SRGBA8 = 33, | 59 | RGB32F = 33, |
| 60 | RG8S = 34, | 60 | SRGBA8 = 34, |
| 61 | RG8S = 35, | ||
| 61 | 62 | ||
| 62 | MaxColorFormat, | 63 | MaxColorFormat, |
| 63 | 64 | ||
| 64 | // DepthStencil formats | 65 | // DepthStencil formats |
| 65 | Z24S8 = 35, | 66 | Z24S8 = 36, |
| 66 | S8Z24 = 36, | 67 | S8Z24 = 37, |
| 67 | Z32F = 37, | 68 | Z32F = 38, |
| 68 | Z16 = 38, | 69 | Z16 = 39, |
| 69 | Z32FS8 = 39, | 70 | Z32FS8 = 40, |
| 70 | 71 | ||
| 71 | MaxDepthStencilFormat, | 72 | MaxDepthStencilFormat, |
| 72 | 73 | ||
| @@ -110,6 +111,7 @@ struct SurfaceParams { | |||
| 110 | 1, // A2B10G10R10 | 111 | 1, // A2B10G10R10 |
| 111 | 1, // A1B5G5R5 | 112 | 1, // A1B5G5R5 |
| 112 | 1, // R8 | 113 | 1, // R8 |
| 114 | 1, // R8UI | ||
| 113 | 1, // RGBA16F | 115 | 1, // RGBA16F |
| 114 | 1, // R11FG11FB10F | 116 | 1, // R11FG11FB10F |
| 115 | 1, // RGBA32UI | 117 | 1, // RGBA32UI |
| @@ -161,6 +163,7 @@ struct SurfaceParams { | |||
| 161 | 32, // A2B10G10R10 | 163 | 32, // A2B10G10R10 |
| 162 | 16, // A1B5G5R5 | 164 | 16, // A1B5G5R5 |
| 163 | 8, // R8 | 165 | 8, // R8 |
| 166 | 8, // R8UI | ||
| 164 | 64, // RGBA16F | 167 | 64, // RGBA16F |
| 165 | 32, // R11FG11FB10F | 168 | 32, // R11FG11FB10F |
| 166 | 128, // RGBA32UI | 169 | 128, // RGBA32UI |
| @@ -250,6 +253,8 @@ struct SurfaceParams { | |||
| 250 | return PixelFormat::RGBA32UI; | 253 | return PixelFormat::RGBA32UI; |
| 251 | case Tegra::RenderTargetFormat::R8_UNORM: | 254 | case Tegra::RenderTargetFormat::R8_UNORM: |
| 252 | return PixelFormat::R8; | 255 | return PixelFormat::R8; |
| 256 | case Tegra::RenderTargetFormat::R8_UINT: | ||
| 257 | return PixelFormat::R8UI; | ||
| 253 | case Tegra::RenderTargetFormat::RG16_FLOAT: | 258 | case Tegra::RenderTargetFormat::RG16_FLOAT: |
| 254 | return PixelFormat::RG16F; | 259 | return PixelFormat::RG16F; |
| 255 | case Tegra::RenderTargetFormat::RG16_UINT: | 260 | case Tegra::RenderTargetFormat::RG16_UINT: |
| @@ -301,7 +306,15 @@ struct SurfaceParams { | |||
| 301 | case Tegra::Texture::TextureFormat::A1B5G5R5: | 306 | case Tegra::Texture::TextureFormat::A1B5G5R5: |
| 302 | return PixelFormat::A1B5G5R5; | 307 | return PixelFormat::A1B5G5R5; |
| 303 | case Tegra::Texture::TextureFormat::R8: | 308 | case Tegra::Texture::TextureFormat::R8: |
| 304 | return PixelFormat::R8; | 309 | switch (component_type) { |
| 310 | case Tegra::Texture::ComponentType::UNORM: | ||
| 311 | return PixelFormat::R8; | ||
| 312 | case Tegra::Texture::ComponentType::UINT: | ||
| 313 | return PixelFormat::R8UI; | ||
| 314 | } | ||
| 315 | LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", | ||
| 316 | static_cast<u32>(component_type)); | ||
| 317 | UNREACHABLE(); | ||
| 305 | case Tegra::Texture::TextureFormat::G8R8: | 318 | case Tegra::Texture::TextureFormat::G8R8: |
| 306 | return PixelFormat::G8R8; | 319 | return PixelFormat::G8R8; |
| 307 | case Tegra::Texture::TextureFormat::R16_G16_B16_A16: | 320 | case Tegra::Texture::TextureFormat::R16_G16_B16_A16: |
| @@ -435,6 +448,7 @@ struct SurfaceParams { | |||
| 435 | return ComponentType::Float; | 448 | return ComponentType::Float; |
| 436 | case Tegra::RenderTargetFormat::RGBA32_UINT: | 449 | case Tegra::RenderTargetFormat::RGBA32_UINT: |
| 437 | case Tegra::RenderTargetFormat::RG16_UINT: | 450 | case Tegra::RenderTargetFormat::RG16_UINT: |
| 451 | case Tegra::RenderTargetFormat::R8_UINT: | ||
| 438 | case Tegra::RenderTargetFormat::R16_UINT: | 452 | case Tegra::RenderTargetFormat::R16_UINT: |
| 439 | return ComponentType::UInt; | 453 | return ComponentType::UInt; |
| 440 | case Tegra::RenderTargetFormat::RG16_SINT: | 454 | case Tegra::RenderTargetFormat::RG16_SINT: |