diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 51373b687..6cdbe63d0 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -104,6 +104,11 @@ public: | |||
| 104 | if (!cache_addr) { | 104 | if (!cache_addr) { |
| 105 | return GetNullSurface(SurfaceParams::ExpectedTarget(entry)); | 105 | return GetNullSurface(SurfaceParams::ExpectedTarget(entry)); |
| 106 | } | 106 | } |
| 107 | |||
| 108 | if (!IsTypeCompatible(tic.texture_type, entry)) { | ||
| 109 | return GetNullSurface(SurfaceParams::ExpectedTarget(entry)); | ||
| 110 | } | ||
| 111 | |||
| 107 | const auto params{SurfaceParams::CreateForTexture(format_lookup_table, tic, entry)}; | 112 | const auto params{SurfaceParams::CreateForTexture(format_lookup_table, tic, entry)}; |
| 108 | const auto [surface, view] = GetSurface(gpu_addr, cache_addr, params, true, false); | 113 | const auto [surface, view] = GetSurface(gpu_addr, cache_addr, params, true, false); |
| 109 | if (guard_samplers) { | 114 | if (guard_samplers) { |
| @@ -914,13 +919,15 @@ private: | |||
| 914 | params.width = 1; | 919 | params.width = 1; |
| 915 | params.height = 1; | 920 | params.height = 1; |
| 916 | params.depth = 1; | 921 | params.depth = 1; |
| 922 | if (target == SurfaceTarget::TextureCubemap || target == SurfaceTarget::TextureCubeArray) { | ||
| 923 | params.depth = 6; | ||
| 924 | } | ||
| 917 | params.pitch = 4; | 925 | params.pitch = 4; |
| 918 | params.num_levels = 1; | 926 | params.num_levels = 1; |
| 919 | params.emulated_levels = 1; | 927 | params.emulated_levels = 1; |
| 920 | params.pixel_format = VideoCore::Surface::PixelFormat::RGBA16F; | 928 | params.pixel_format = VideoCore::Surface::PixelFormat::R8U; |
| 921 | params.type = VideoCore::Surface::SurfaceType::ColorTexture; | 929 | params.type = VideoCore::Surface::SurfaceType::ColorTexture; |
| 922 | auto surface = CreateSurface(0ULL, params); | 930 | auto surface = CreateSurface(0ULL, params); |
| 923 | invalid_memory.clear(); | ||
| 924 | invalid_memory.resize(surface->GetHostSizeInBytes(), 0U); | 931 | invalid_memory.resize(surface->GetHostSizeInBytes(), 0U); |
| 925 | surface->UploadTexture(invalid_memory); | 932 | surface->UploadTexture(invalid_memory); |
| 926 | surface->MarkAsModified(false, Tick()); | 933 | surface->MarkAsModified(false, Tick()); |
| @@ -1082,6 +1089,36 @@ private: | |||
| 1082 | return siblings_table[static_cast<std::size_t>(format)]; | 1089 | return siblings_table[static_cast<std::size_t>(format)]; |
| 1083 | } | 1090 | } |
| 1084 | 1091 | ||
| 1092 | /// Returns true the shader sampler entry is compatible with the TIC texture type. | ||
| 1093 | static bool IsTypeCompatible(Tegra::Texture::TextureType tic_type, | ||
| 1094 | const VideoCommon::Shader::Sampler& entry) { | ||
| 1095 | const auto shader_type = entry.GetType(); | ||
| 1096 | switch (tic_type) { | ||
| 1097 | case Tegra::Texture::TextureType::Texture1D: | ||
| 1098 | case Tegra::Texture::TextureType::Texture1DArray: | ||
| 1099 | return shader_type == Tegra::Shader::TextureType::Texture1D; | ||
| 1100 | case Tegra::Texture::TextureType::Texture1DBuffer: | ||
| 1101 | // TODO(Rodrigo): Assume as valid for now | ||
| 1102 | return true; | ||
| 1103 | case Tegra::Texture::TextureType::Texture2D: | ||
| 1104 | case Tegra::Texture::TextureType::Texture2DNoMipmap: | ||
| 1105 | return shader_type == Tegra::Shader::TextureType::Texture2D; | ||
| 1106 | case Tegra::Texture::TextureType::Texture2DArray: | ||
| 1107 | return shader_type == Tegra::Shader::TextureType::Texture2D || | ||
| 1108 | shader_type == Tegra::Shader::TextureType::TextureCube; | ||
| 1109 | case Tegra::Texture::TextureType::Texture3D: | ||
| 1110 | return shader_type == Tegra::Shader::TextureType::Texture3D; | ||
| 1111 | case Tegra::Texture::TextureType::TextureCubeArray: | ||
| 1112 | case Tegra::Texture::TextureType::TextureCubemap: | ||
| 1113 | if (shader_type == Tegra::Shader::TextureType::TextureCube) { | ||
| 1114 | return true; | ||
| 1115 | } | ||
| 1116 | return shader_type == Tegra::Shader::TextureType::Texture2D && entry.IsArray(); | ||
| 1117 | } | ||
| 1118 | UNREACHABLE(); | ||
| 1119 | return true; | ||
| 1120 | } | ||
| 1121 | |||
| 1085 | struct FramebufferTargetInfo { | 1122 | struct FramebufferTargetInfo { |
| 1086 | TSurface target; | 1123 | TSurface target; |
| 1087 | TView view; | 1124 | TView view; |