diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_buffer_cache.cpp | 15 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_graphics_pipeline.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/shader_environment.cpp | 89 | ||||
| -rw-r--r-- | src/video_core/shader_environment.h | 12 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.cpp | 1 |
8 files changed, 109 insertions, 36 deletions
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.cpp b/src/video_core/renderer_opengl/gl_buffer_cache.cpp index 08f4d69ab..6af4ae793 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_buffer_cache.cpp | |||
| @@ -29,17 +29,17 @@ constexpr std::array PROGRAM_LUT{ | |||
| 29 | [[nodiscard]] GLenum GetTextureBufferFormat(GLenum gl_format) { | 29 | [[nodiscard]] GLenum GetTextureBufferFormat(GLenum gl_format) { |
| 30 | switch (gl_format) { | 30 | switch (gl_format) { |
| 31 | case GL_RGBA8_SNORM: | 31 | case GL_RGBA8_SNORM: |
| 32 | return GL_RGBA8; | 32 | return GL_RGBA8I; |
| 33 | case GL_R8_SNORM: | 33 | case GL_R8_SNORM: |
| 34 | return GL_R8; | 34 | return GL_R8I; |
| 35 | case GL_RGBA16_SNORM: | 35 | case GL_RGBA16_SNORM: |
| 36 | return GL_RGBA16; | 36 | return GL_RGBA16I; |
| 37 | case GL_R16_SNORM: | 37 | case GL_R16_SNORM: |
| 38 | return GL_R16; | 38 | return GL_R16I; |
| 39 | case GL_RG16_SNORM: | 39 | case GL_RG16_SNORM: |
| 40 | return GL_RG16; | 40 | return GL_RG16I; |
| 41 | case GL_RG8_SNORM: | 41 | case GL_RG8_SNORM: |
| 42 | return GL_RG8; | 42 | return GL_RG8I; |
| 43 | default: | 43 | default: |
| 44 | return gl_format; | 44 | return gl_format; |
| 45 | } | 45 | } |
| @@ -96,9 +96,6 @@ GLuint Buffer::View(u32 offset, u32 size, PixelFormat format) { | |||
| 96 | texture.Create(GL_TEXTURE_BUFFER); | 96 | texture.Create(GL_TEXTURE_BUFFER); |
| 97 | const GLenum gl_format{MaxwellToGL::GetFormatTuple(format).internal_format}; | 97 | const GLenum gl_format{MaxwellToGL::GetFormatTuple(format).internal_format}; |
| 98 | const GLenum texture_format{GetTextureBufferFormat(gl_format)}; | 98 | const GLenum texture_format{GetTextureBufferFormat(gl_format)}; |
| 99 | if (texture_format != gl_format) { | ||
| 100 | LOG_WARNING(Render_OpenGL, "Emulating SNORM texture buffer with UNORM."); | ||
| 101 | } | ||
| 102 | glTextureBufferRange(texture.handle, texture_format, buffer.handle, offset, size); | 99 | glTextureBufferRange(texture.handle, texture_format, buffer.handle, offset, size); |
| 103 | views.push_back({ | 100 | views.push_back({ |
| 104 | .offset = offset, | 101 | .offset = offset, |
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index daceb05f4..c115dabe1 100644 --- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp | |||
| @@ -504,8 +504,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { | |||
| 504 | } | 504 | } |
| 505 | } | 505 | } |
| 506 | if (info.uses_render_area) { | 506 | if (info.uses_render_area) { |
| 507 | const auto render_area_width(static_cast<GLfloat>(regs.render_area.width)); | 507 | const auto render_area_width(static_cast<GLfloat>(regs.surface_clip.width)); |
| 508 | const auto render_area_height(static_cast<GLfloat>(regs.render_area.height)); | 508 | const auto render_area_height(static_cast<GLfloat>(regs.surface_clip.height)); |
| 509 | if (use_assembly) { | 509 | if (use_assembly) { |
| 510 | glProgramLocalParameter4fARB(AssemblyStage(stage), 1, render_area_width, | 510 | glProgramLocalParameter4fARB(AssemblyStage(stage), 1, render_area_width, |
| 511 | render_area_height, 0.0f, 0.0f); | 511 | render_area_height, 0.0f, 0.0f); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 79d7908d4..72e314d39 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -618,11 +618,11 @@ void RasterizerOpenGL::SyncViewport() { | |||
| 618 | } | 618 | } |
| 619 | flags[Dirty::Viewport0 + index] = false; | 619 | flags[Dirty::Viewport0 + index] = false; |
| 620 | 620 | ||
| 621 | if (!regs.viewport_transform_enabled) { | 621 | if (!regs.viewport_scale_offset_enbled) { |
| 622 | const auto x = static_cast<GLfloat>(regs.render_area.x); | 622 | const auto x = static_cast<GLfloat>(regs.surface_clip.x); |
| 623 | const auto y = static_cast<GLfloat>(regs.render_area.y); | 623 | const auto y = static_cast<GLfloat>(regs.surface_clip.y); |
| 624 | const auto width = static_cast<GLfloat>(regs.render_area.width); | 624 | const auto width = static_cast<GLfloat>(regs.surface_clip.width); |
| 625 | const auto height = static_cast<GLfloat>(regs.render_area.height); | 625 | const auto height = static_cast<GLfloat>(regs.surface_clip.height); |
| 626 | glViewportIndexedf(static_cast<GLuint>(index), x, y, width != 0.0f ? width : 1.0f, | 626 | glViewportIndexedf(static_cast<GLuint>(index), x, y, width != 0.0f ? width : 1.0f, |
| 627 | height != 0.0f ? height : 1.0f); | 627 | height != 0.0f ? height : 1.0f); |
| 628 | continue; | 628 | continue; |
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index b4372a839..81b6c372d 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |||
| @@ -444,8 +444,8 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { | |||
| 444 | const auto& info{stage_infos[0]}; | 444 | const auto& info{stage_infos[0]}; |
| 445 | if (info.uses_render_area) { | 445 | if (info.uses_render_area) { |
| 446 | render_area.uses_render_area = true; | 446 | render_area.uses_render_area = true; |
| 447 | render_area.words = {static_cast<float>(regs.render_area.width), | 447 | render_area.words = {static_cast<float>(regs.surface_clip.width), |
| 448 | static_cast<float>(regs.render_area.height)}; | 448 | static_cast<float>(regs.surface_clip.height)}; |
| 449 | } | 449 | } |
| 450 | }}; | 450 | }}; |
| 451 | if constexpr (Spec::enabled_stages[0]) { | 451 | if constexpr (Spec::enabled_stages[0]) { |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 5af3c930b..f79fa8313 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -683,11 +683,11 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg | |||
| 683 | if (!state_tracker.TouchViewports()) { | 683 | if (!state_tracker.TouchViewports()) { |
| 684 | return; | 684 | return; |
| 685 | } | 685 | } |
| 686 | if (!regs.viewport_transform_enabled) { | 686 | if (!regs.viewport_scale_offset_enbled) { |
| 687 | const auto x = static_cast<float>(regs.render_area.x); | 687 | const auto x = static_cast<float>(regs.surface_clip.x); |
| 688 | const auto y = static_cast<float>(regs.render_area.y); | 688 | const auto y = static_cast<float>(regs.surface_clip.y); |
| 689 | const auto width = static_cast<float>(regs.render_area.width); | 689 | const auto width = static_cast<float>(regs.surface_clip.width); |
| 690 | const auto height = static_cast<float>(regs.render_area.height); | 690 | const auto height = static_cast<float>(regs.surface_clip.height); |
| 691 | VkViewport viewport{ | 691 | VkViewport viewport{ |
| 692 | .x = x, | 692 | .x = x, |
| 693 | .y = y, | 693 | .y = y, |
diff --git a/src/video_core/shader_environment.cpp b/src/video_core/shader_environment.cpp index 63bcf9337..37bb76b72 100644 --- a/src/video_core/shader_environment.cpp +++ b/src/video_core/shader_environment.cpp | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include "video_core/engines/kepler_compute.h" | 19 | #include "video_core/engines/kepler_compute.h" |
| 20 | #include "video_core/memory_manager.h" | 20 | #include "video_core/memory_manager.h" |
| 21 | #include "video_core/shader_environment.h" | 21 | #include "video_core/shader_environment.h" |
| 22 | #include "video_core/texture_cache/format_lookup_table.h" | ||
| 22 | #include "video_core/textures/texture.h" | 23 | #include "video_core/textures/texture.h" |
| 23 | 24 | ||
| 24 | namespace VideoCommon { | 25 | namespace VideoCommon { |
| @@ -33,7 +34,7 @@ static u64 MakeCbufKey(u32 index, u32 offset) { | |||
| 33 | return (static_cast<u64>(index) << 32) | offset; | 34 | return (static_cast<u64>(index) << 32) | offset; |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | static Shader::TextureType ConvertType(const Tegra::Texture::TICEntry& entry) { | 37 | static Shader::TextureType ConvertTextureType(const Tegra::Texture::TICEntry& entry) { |
| 37 | switch (entry.texture_type) { | 38 | switch (entry.texture_type) { |
| 38 | case Tegra::Texture::TextureType::Texture1D: | 39 | case Tegra::Texture::TextureType::Texture1D: |
| 39 | return Shader::TextureType::Color1D; | 40 | return Shader::TextureType::Color1D; |
| @@ -59,6 +60,26 @@ static Shader::TextureType ConvertType(const Tegra::Texture::TICEntry& entry) { | |||
| 59 | } | 60 | } |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 63 | static Shader::TexturePixelFormat ConvertTexturePixelFormat(const Tegra::Texture::TICEntry& entry) { | ||
| 64 | switch (PixelFormatFromTextureInfo(entry.format, entry.r_type, entry.g_type, entry.b_type, | ||
| 65 | entry.a_type, entry.srgb_conversion)) { | ||
| 66 | case VideoCore::Surface::PixelFormat::A8B8G8R8_SNORM: | ||
| 67 | return Shader::TexturePixelFormat::A8B8G8R8_SNORM; | ||
| 68 | case VideoCore::Surface::PixelFormat::R8_SNORM: | ||
| 69 | return Shader::TexturePixelFormat::R8_SNORM; | ||
| 70 | case VideoCore::Surface::PixelFormat::R8G8_SNORM: | ||
| 71 | return Shader::TexturePixelFormat::R8G8_SNORM; | ||
| 72 | case VideoCore::Surface::PixelFormat::R16G16B16A16_SNORM: | ||
| 73 | return Shader::TexturePixelFormat::R16G16B16A16_SNORM; | ||
| 74 | case VideoCore::Surface::PixelFormat::R16G16_SNORM: | ||
| 75 | return Shader::TexturePixelFormat::R16G16_SNORM; | ||
| 76 | case VideoCore::Surface::PixelFormat::R16_SNORM: | ||
| 77 | return Shader::TexturePixelFormat::R16_SNORM; | ||
| 78 | default: | ||
| 79 | return Shader::TexturePixelFormat::OTHER; | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 62 | static std::string_view StageToPrefix(Shader::Stage stage) { | 83 | static std::string_view StageToPrefix(Shader::Stage stage) { |
| 63 | switch (stage) { | 84 | switch (stage) { |
| 64 | case Shader::Stage::VertexB: | 85 | case Shader::Stage::VertexB: |
| @@ -178,10 +199,13 @@ void GenericEnvironment::Dump(u64 hash) { | |||
| 178 | void GenericEnvironment::Serialize(std::ofstream& file) const { | 199 | void GenericEnvironment::Serialize(std::ofstream& file) const { |
| 179 | const u64 code_size{static_cast<u64>(CachedSize())}; | 200 | const u64 code_size{static_cast<u64>(CachedSize())}; |
| 180 | const u64 num_texture_types{static_cast<u64>(texture_types.size())}; | 201 | const u64 num_texture_types{static_cast<u64>(texture_types.size())}; |
| 202 | const u64 num_texture_pixel_formats{static_cast<u64>(texture_pixel_formats.size())}; | ||
| 181 | const u64 num_cbuf_values{static_cast<u64>(cbuf_values.size())}; | 203 | const u64 num_cbuf_values{static_cast<u64>(cbuf_values.size())}; |
| 182 | 204 | ||
| 183 | file.write(reinterpret_cast<const char*>(&code_size), sizeof(code_size)) | 205 | file.write(reinterpret_cast<const char*>(&code_size), sizeof(code_size)) |
| 184 | .write(reinterpret_cast<const char*>(&num_texture_types), sizeof(num_texture_types)) | 206 | .write(reinterpret_cast<const char*>(&num_texture_types), sizeof(num_texture_types)) |
| 207 | .write(reinterpret_cast<const char*>(&num_texture_pixel_formats), | ||
| 208 | sizeof(num_texture_pixel_formats)) | ||
| 185 | .write(reinterpret_cast<const char*>(&num_cbuf_values), sizeof(num_cbuf_values)) | 209 | .write(reinterpret_cast<const char*>(&num_cbuf_values), sizeof(num_cbuf_values)) |
| 186 | .write(reinterpret_cast<const char*>(&local_memory_size), sizeof(local_memory_size)) | 210 | .write(reinterpret_cast<const char*>(&local_memory_size), sizeof(local_memory_size)) |
| 187 | .write(reinterpret_cast<const char*>(&texture_bound), sizeof(texture_bound)) | 211 | .write(reinterpret_cast<const char*>(&texture_bound), sizeof(texture_bound)) |
| @@ -196,6 +220,10 @@ void GenericEnvironment::Serialize(std::ofstream& file) const { | |||
| 196 | file.write(reinterpret_cast<const char*>(&key), sizeof(key)) | 220 | file.write(reinterpret_cast<const char*>(&key), sizeof(key)) |
| 197 | .write(reinterpret_cast<const char*>(&type), sizeof(type)); | 221 | .write(reinterpret_cast<const char*>(&type), sizeof(type)); |
| 198 | } | 222 | } |
| 223 | for (const auto& [key, format] : texture_pixel_formats) { | ||
| 224 | file.write(reinterpret_cast<const char*>(&key), sizeof(key)) | ||
| 225 | .write(reinterpret_cast<const char*>(&format), sizeof(format)); | ||
| 226 | } | ||
| 199 | for (const auto& [key, type] : cbuf_values) { | 227 | for (const auto& [key, type] : cbuf_values) { |
| 200 | file.write(reinterpret_cast<const char*>(&key), sizeof(key)) | 228 | file.write(reinterpret_cast<const char*>(&key), sizeof(key)) |
| 201 | .write(reinterpret_cast<const char*>(&type), sizeof(type)); | 229 | .write(reinterpret_cast<const char*>(&type), sizeof(type)); |
| @@ -239,15 +267,13 @@ std::optional<u64> GenericEnvironment::TryFindSize() { | |||
| 239 | return std::nullopt; | 267 | return std::nullopt; |
| 240 | } | 268 | } |
| 241 | 269 | ||
| 242 | Shader::TextureType GenericEnvironment::ReadTextureTypeImpl(GPUVAddr tic_addr, u32 tic_limit, | 270 | Tegra::Texture::TICEntry GenericEnvironment::ReadTextureInfo(GPUVAddr tic_addr, u32 tic_limit, |
| 243 | bool via_header_index, u32 raw) { | 271 | bool via_header_index, u32 raw) { |
| 244 | const auto handle{Tegra::Texture::TexturePair(raw, via_header_index)}; | 272 | const auto handle{Tegra::Texture::TexturePair(raw, via_header_index)}; |
| 245 | const GPUVAddr descriptor_addr{tic_addr + handle.first * sizeof(Tegra::Texture::TICEntry)}; | 273 | const GPUVAddr descriptor_addr{tic_addr + handle.first * sizeof(Tegra::Texture::TICEntry)}; |
| 246 | Tegra::Texture::TICEntry entry; | 274 | Tegra::Texture::TICEntry entry; |
| 247 | gpu_memory->ReadBlock(descriptor_addr, &entry, sizeof(entry)); | 275 | gpu_memory->ReadBlock(descriptor_addr, &entry, sizeof(entry)); |
| 248 | const Shader::TextureType result{ConvertType(entry)}; | 276 | return entry; |
| 249 | texture_types.emplace(raw, result); | ||
| 250 | return result; | ||
| 251 | } | 277 | } |
| 252 | 278 | ||
| 253 | GraphicsEnvironment::GraphicsEnvironment(Tegra::Engines::Maxwell3D& maxwell3d_, | 279 | GraphicsEnvironment::GraphicsEnvironment(Tegra::Engines::Maxwell3D& maxwell3d_, |
| @@ -307,13 +333,26 @@ u32 GraphicsEnvironment::ReadCbufValue(u32 cbuf_index, u32 cbuf_offset) { | |||
| 307 | Shader::TextureType GraphicsEnvironment::ReadTextureType(u32 handle) { | 333 | Shader::TextureType GraphicsEnvironment::ReadTextureType(u32 handle) { |
| 308 | const auto& regs{maxwell3d->regs}; | 334 | const auto& regs{maxwell3d->regs}; |
| 309 | const bool via_header_index{regs.sampler_binding == Maxwell::SamplerBinding::ViaHeaderBinding}; | 335 | const bool via_header_index{regs.sampler_binding == Maxwell::SamplerBinding::ViaHeaderBinding}; |
| 310 | return ReadTextureTypeImpl(regs.tex_header.Address(), regs.tex_header.limit, via_header_index, | 336 | auto entry = |
| 311 | handle); | 337 | ReadTextureInfo(regs.tex_header.Address(), regs.tex_header.limit, via_header_index, handle); |
| 338 | const Shader::TextureType result{ConvertTextureType(entry)}; | ||
| 339 | texture_types.emplace(handle, result); | ||
| 340 | return result; | ||
| 341 | } | ||
| 342 | |||
| 343 | Shader::TexturePixelFormat GraphicsEnvironment::ReadTexturePixelFormat(u32 handle) { | ||
| 344 | const auto& regs{maxwell3d->regs}; | ||
| 345 | const bool via_header_index{regs.sampler_binding == Maxwell::SamplerBinding::ViaHeaderBinding}; | ||
| 346 | auto entry = | ||
| 347 | ReadTextureInfo(regs.tex_header.Address(), regs.tex_header.limit, via_header_index, handle); | ||
| 348 | const Shader::TexturePixelFormat result(ConvertTexturePixelFormat(entry)); | ||
| 349 | texture_pixel_formats.emplace(handle, result); | ||
| 350 | return result; | ||
| 312 | } | 351 | } |
| 313 | 352 | ||
| 314 | u32 GraphicsEnvironment::ReadViewportTransformState() { | 353 | u32 GraphicsEnvironment::ReadViewportTransformState() { |
| 315 | const auto& regs{maxwell3d->regs}; | 354 | const auto& regs{maxwell3d->regs}; |
| 316 | viewport_transform_state = regs.viewport_transform_enabled; | 355 | viewport_transform_state = regs.viewport_scale_offset_enbled; |
| 317 | return viewport_transform_state; | 356 | return viewport_transform_state; |
| 318 | } | 357 | } |
| 319 | 358 | ||
| @@ -345,7 +384,19 @@ u32 ComputeEnvironment::ReadCbufValue(u32 cbuf_index, u32 cbuf_offset) { | |||
| 345 | Shader::TextureType ComputeEnvironment::ReadTextureType(u32 handle) { | 384 | Shader::TextureType ComputeEnvironment::ReadTextureType(u32 handle) { |
| 346 | const auto& regs{kepler_compute->regs}; | 385 | const auto& regs{kepler_compute->regs}; |
| 347 | const auto& qmd{kepler_compute->launch_description}; | 386 | const auto& qmd{kepler_compute->launch_description}; |
| 348 | return ReadTextureTypeImpl(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle); | 387 | auto entry = ReadTextureInfo(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle); |
| 388 | const Shader::TextureType result{ConvertTextureType(entry)}; | ||
| 389 | texture_types.emplace(handle, result); | ||
| 390 | return result; | ||
| 391 | } | ||
| 392 | |||
| 393 | Shader::TexturePixelFormat ComputeEnvironment::ReadTexturePixelFormat(u32 handle) { | ||
| 394 | const auto& regs{kepler_compute->regs}; | ||
| 395 | const auto& qmd{kepler_compute->launch_description}; | ||
| 396 | auto entry = ReadTextureInfo(regs.tic.Address(), regs.tic.limit, qmd.linked_tsc != 0, handle); | ||
| 397 | const Shader::TexturePixelFormat result(ConvertTexturePixelFormat(entry)); | ||
| 398 | texture_pixel_formats.emplace(handle, result); | ||
| 399 | return result; | ||
| 349 | } | 400 | } |
| 350 | 401 | ||
| 351 | u32 ComputeEnvironment::ReadViewportTransformState() { | 402 | u32 ComputeEnvironment::ReadViewportTransformState() { |
| @@ -355,9 +406,12 @@ u32 ComputeEnvironment::ReadViewportTransformState() { | |||
| 355 | void FileEnvironment::Deserialize(std::ifstream& file) { | 406 | void FileEnvironment::Deserialize(std::ifstream& file) { |
| 356 | u64 code_size{}; | 407 | u64 code_size{}; |
| 357 | u64 num_texture_types{}; | 408 | u64 num_texture_types{}; |
| 409 | u64 num_texture_pixel_formats{}; | ||
| 358 | u64 num_cbuf_values{}; | 410 | u64 num_cbuf_values{}; |
| 359 | file.read(reinterpret_cast<char*>(&code_size), sizeof(code_size)) | 411 | file.read(reinterpret_cast<char*>(&code_size), sizeof(code_size)) |
| 360 | .read(reinterpret_cast<char*>(&num_texture_types), sizeof(num_texture_types)) | 412 | .read(reinterpret_cast<char*>(&num_texture_types), sizeof(num_texture_types)) |
| 413 | .read(reinterpret_cast<char*>(&num_texture_pixel_formats), | ||
| 414 | sizeof(num_texture_pixel_formats)) | ||
| 361 | .read(reinterpret_cast<char*>(&num_cbuf_values), sizeof(num_cbuf_values)) | 415 | .read(reinterpret_cast<char*>(&num_cbuf_values), sizeof(num_cbuf_values)) |
| 362 | .read(reinterpret_cast<char*>(&local_memory_size), sizeof(local_memory_size)) | 416 | .read(reinterpret_cast<char*>(&local_memory_size), sizeof(local_memory_size)) |
| 363 | .read(reinterpret_cast<char*>(&texture_bound), sizeof(texture_bound)) | 417 | .read(reinterpret_cast<char*>(&texture_bound), sizeof(texture_bound)) |
| @@ -375,6 +429,13 @@ void FileEnvironment::Deserialize(std::ifstream& file) { | |||
| 375 | .read(reinterpret_cast<char*>(&type), sizeof(type)); | 429 | .read(reinterpret_cast<char*>(&type), sizeof(type)); |
| 376 | texture_types.emplace(key, type); | 430 | texture_types.emplace(key, type); |
| 377 | } | 431 | } |
| 432 | for (size_t i = 0; i < num_texture_pixel_formats; ++i) { | ||
| 433 | u32 key; | ||
| 434 | Shader::TexturePixelFormat format; | ||
| 435 | file.read(reinterpret_cast<char*>(&key), sizeof(key)) | ||
| 436 | .read(reinterpret_cast<char*>(&format), sizeof(format)); | ||
| 437 | texture_pixel_formats.emplace(key, format); | ||
| 438 | } | ||
| 378 | for (size_t i = 0; i < num_cbuf_values; ++i) { | 439 | for (size_t i = 0; i < num_cbuf_values; ++i) { |
| 379 | u64 key; | 440 | u64 key; |
| 380 | u32 value; | 441 | u32 value; |
| @@ -422,6 +483,14 @@ Shader::TextureType FileEnvironment::ReadTextureType(u32 handle) { | |||
| 422 | return it->second; | 483 | return it->second; |
| 423 | } | 484 | } |
| 424 | 485 | ||
| 486 | Shader::TexturePixelFormat FileEnvironment::ReadTexturePixelFormat(u32 handle) { | ||
| 487 | const auto it{texture_pixel_formats.find(handle)}; | ||
| 488 | if (it == texture_pixel_formats.end()) { | ||
| 489 | throw Shader::LogicError("Uncached read texture pixel format"); | ||
| 490 | } | ||
| 491 | return it->second; | ||
| 492 | } | ||
| 493 | |||
| 425 | u32 FileEnvironment::ReadViewportTransformState() { | 494 | u32 FileEnvironment::ReadViewportTransformState() { |
| 426 | return viewport_transform_state; | 495 | return viewport_transform_state; |
| 427 | } | 496 | } |
diff --git a/src/video_core/shader_environment.h b/src/video_core/shader_environment.h index a05833f38..bb55b029f 100644 --- a/src/video_core/shader_environment.h +++ b/src/video_core/shader_environment.h | |||
| @@ -63,14 +63,15 @@ public: | |||
| 63 | protected: | 63 | protected: |
| 64 | std::optional<u64> TryFindSize(); | 64 | std::optional<u64> TryFindSize(); |
| 65 | 65 | ||
| 66 | Shader::TextureType ReadTextureTypeImpl(GPUVAddr tic_addr, u32 tic_limit, bool via_header_index, | 66 | Tegra::Texture::TICEntry ReadTextureInfo(GPUVAddr tic_addr, u32 tic_limit, |
| 67 | u32 raw); | 67 | bool via_header_index, u32 raw); |
| 68 | 68 | ||
| 69 | Tegra::MemoryManager* gpu_memory{}; | 69 | Tegra::MemoryManager* gpu_memory{}; |
| 70 | GPUVAddr program_base{}; | 70 | GPUVAddr program_base{}; |
| 71 | 71 | ||
| 72 | std::vector<u64> code; | 72 | std::vector<u64> code; |
| 73 | std::unordered_map<u32, Shader::TextureType> texture_types; | 73 | std::unordered_map<u32, Shader::TextureType> texture_types; |
| 74 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; | ||
| 74 | std::unordered_map<u64, u32> cbuf_values; | 75 | std::unordered_map<u64, u32> cbuf_values; |
| 75 | 76 | ||
| 76 | u32 local_memory_size{}; | 77 | u32 local_memory_size{}; |
| @@ -104,6 +105,8 @@ public: | |||
| 104 | 105 | ||
| 105 | Shader::TextureType ReadTextureType(u32 handle) override; | 106 | Shader::TextureType ReadTextureType(u32 handle) override; |
| 106 | 107 | ||
| 108 | Shader::TexturePixelFormat ReadTexturePixelFormat(u32 handle) override; | ||
| 109 | |||
| 107 | u32 ReadViewportTransformState() override; | 110 | u32 ReadViewportTransformState() override; |
| 108 | 111 | ||
| 109 | private: | 112 | private: |
| @@ -124,6 +127,8 @@ public: | |||
| 124 | 127 | ||
| 125 | Shader::TextureType ReadTextureType(u32 handle) override; | 128 | Shader::TextureType ReadTextureType(u32 handle) override; |
| 126 | 129 | ||
| 130 | Shader::TexturePixelFormat ReadTexturePixelFormat(u32 handle) override; | ||
| 131 | |||
| 127 | u32 ReadViewportTransformState() override; | 132 | u32 ReadViewportTransformState() override; |
| 128 | 133 | ||
| 129 | private: | 134 | private: |
| @@ -149,6 +154,8 @@ public: | |||
| 149 | 154 | ||
| 150 | [[nodiscard]] Shader::TextureType ReadTextureType(u32 handle) override; | 155 | [[nodiscard]] Shader::TextureType ReadTextureType(u32 handle) override; |
| 151 | 156 | ||
| 157 | [[nodiscard]] Shader::TexturePixelFormat ReadTexturePixelFormat(u32 handle) override; | ||
| 158 | |||
| 152 | [[nodiscard]] u32 ReadViewportTransformState() override; | 159 | [[nodiscard]] u32 ReadViewportTransformState() override; |
| 153 | 160 | ||
| 154 | [[nodiscard]] u32 LocalMemorySize() const override; | 161 | [[nodiscard]] u32 LocalMemorySize() const override; |
| @@ -164,6 +171,7 @@ public: | |||
| 164 | private: | 171 | private: |
| 165 | std::unique_ptr<u64[]> code; | 172 | std::unique_ptr<u64[]> code; |
| 166 | std::unordered_map<u32, Shader::TextureType> texture_types; | 173 | std::unordered_map<u32, Shader::TextureType> texture_types; |
| 174 | std::unordered_map<u32, Shader::TexturePixelFormat> texture_pixel_formats; | ||
| 167 | std::unordered_map<u64, u32> cbuf_values; | 175 | std::unordered_map<u64, u32> cbuf_values; |
| 168 | std::array<u32, 3> workgroup_size{}; | 176 | std::array<u32, 3> workgroup_size{}; |
| 169 | u32 local_memory_size{}; | 177 | u32 local_memory_size{}; |
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 1223df5a0..e8c908b42 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp | |||
| @@ -516,7 +516,6 @@ void SwizzleBlockLinearImage(Tegra::MemoryManager& gpu_memory, GPUVAddr gpu_addr | |||
| 516 | const u32 num_blocks_per_layer = NumBlocks(level_size, tile_size); | 516 | const u32 num_blocks_per_layer = NumBlocks(level_size, tile_size); |
| 517 | const u32 host_bytes_per_layer = num_blocks_per_layer * bytes_per_block; | 517 | const u32 host_bytes_per_layer = num_blocks_per_layer * bytes_per_block; |
| 518 | 518 | ||
| 519 | UNIMPLEMENTED_IF(info.tile_width_spacing > 0); | ||
| 520 | UNIMPLEMENTED_IF(copy.image_offset.x != 0); | 519 | UNIMPLEMENTED_IF(copy.image_offset.x != 0); |
| 521 | UNIMPLEMENTED_IF(copy.image_offset.y != 0); | 520 | UNIMPLEMENTED_IF(copy.image_offset.y != 0); |
| 522 | UNIMPLEMENTED_IF(copy.image_offset.z != 0); | 521 | UNIMPLEMENTED_IF(copy.image_offset.z != 0); |