summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/surface_params.cpp12
-rw-r--r--src/video_core/texture_cache/surface_params.h1
-rw-r--r--src/video_core/texture_cache/texture_cache.h9
3 files changed, 5 insertions, 17 deletions
diff --git a/src/video_core/texture_cache/surface_params.cpp b/src/video_core/texture_cache/surface_params.cpp
index 1e4d3fb79..04b5e8ba3 100644
--- a/src/video_core/texture_cache/surface_params.cpp
+++ b/src/video_core/texture_cache/surface_params.cpp
@@ -13,9 +13,6 @@
13 13
14namespace VideoCommon { 14namespace VideoCommon {
15 15
16using VideoCore::Surface::ComponentTypeFromDepthFormat;
17using VideoCore::Surface::ComponentTypeFromRenderTarget;
18using VideoCore::Surface::ComponentTypeFromTexture;
19using VideoCore::Surface::PixelFormat; 16using VideoCore::Surface::PixelFormat;
20using VideoCore::Surface::PixelFormatFromDepthFormat; 17using VideoCore::Surface::PixelFormatFromDepthFormat;
21using VideoCore::Surface::PixelFormatFromRenderTargetFormat; 18using VideoCore::Surface::PixelFormatFromRenderTargetFormat;
@@ -99,7 +96,6 @@ SurfaceParams SurfaceParams::CreateForTexture(const Tegra::Texture::TICEntry& ti
99 } 96 }
100 params.type = GetFormatType(params.pixel_format); 97 params.type = GetFormatType(params.pixel_format);
101 } 98 }
102 params.component_type = ComponentTypeFromTexture(tic.r_type.Value());
103 params.type = GetFormatType(params.pixel_format); 99 params.type = GetFormatType(params.pixel_format);
104 // TODO: on 1DBuffer we should use the tic info. 100 // TODO: on 1DBuffer we should use the tic info.
105 if (tic.IsBuffer()) { 101 if (tic.IsBuffer()) {
@@ -140,7 +136,6 @@ SurfaceParams SurfaceParams::CreateForImage(const Tegra::Texture::TICEntry& tic,
140 params.pixel_format = 136 params.pixel_format =
141 PixelFormatFromTextureFormat(tic.format, tic.r_type.Value(), params.srgb_conversion); 137 PixelFormatFromTextureFormat(tic.format, tic.r_type.Value(), params.srgb_conversion);
142 params.type = GetFormatType(params.pixel_format); 138 params.type = GetFormatType(params.pixel_format);
143 params.component_type = ComponentTypeFromTexture(tic.r_type.Value());
144 params.type = GetFormatType(params.pixel_format); 139 params.type = GetFormatType(params.pixel_format);
145 params.target = ImageTypeToSurfaceTarget(entry.GetType()); 140 params.target = ImageTypeToSurfaceTarget(entry.GetType());
146 // TODO: on 1DBuffer we should use the tic info. 141 // TODO: on 1DBuffer we should use the tic info.
@@ -181,7 +176,6 @@ SurfaceParams SurfaceParams::CreateForDepthBuffer(
181 params.block_depth = std::min(block_depth, 5U); 176 params.block_depth = std::min(block_depth, 5U);
182 params.tile_width_spacing = 1; 177 params.tile_width_spacing = 1;
183 params.pixel_format = PixelFormatFromDepthFormat(format); 178 params.pixel_format = PixelFormatFromDepthFormat(format);
184 params.component_type = ComponentTypeFromDepthFormat(format);
185 params.type = GetFormatType(params.pixel_format); 179 params.type = GetFormatType(params.pixel_format);
186 params.width = zeta_width; 180 params.width = zeta_width;
187 params.height = zeta_height; 181 params.height = zeta_height;
@@ -206,7 +200,6 @@ SurfaceParams SurfaceParams::CreateForFramebuffer(Core::System& system, std::siz
206 params.block_depth = config.memory_layout.block_depth; 200 params.block_depth = config.memory_layout.block_depth;
207 params.tile_width_spacing = 1; 201 params.tile_width_spacing = 1;
208 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); 202 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format);
209 params.component_type = ComponentTypeFromRenderTarget(config.format);
210 params.type = GetFormatType(params.pixel_format); 203 params.type = GetFormatType(params.pixel_format);
211 if (params.is_tiled) { 204 if (params.is_tiled) {
212 params.pitch = 0; 205 params.pitch = 0;
@@ -236,7 +229,6 @@ SurfaceParams SurfaceParams::CreateForFermiCopySurface(
236 params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 5U) : 0, 229 params.block_depth = params.is_tiled ? std::min(config.BlockDepth(), 5U) : 0,
237 params.tile_width_spacing = 1; 230 params.tile_width_spacing = 1;
238 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format); 231 params.pixel_format = PixelFormatFromRenderTargetFormat(config.format);
239 params.component_type = ComponentTypeFromRenderTarget(config.format);
240 params.type = GetFormatType(params.pixel_format); 232 params.type = GetFormatType(params.pixel_format);
241 params.width = config.width; 233 params.width = config.width;
242 params.height = config.height; 234 params.height = config.height;
@@ -355,10 +347,10 @@ std::size_t SurfaceParams::GetInnerMipmapMemorySize(u32 level, bool as_host_size
355 347
356bool SurfaceParams::operator==(const SurfaceParams& rhs) const { 348bool SurfaceParams::operator==(const SurfaceParams& rhs) const {
357 return std::tie(is_tiled, block_width, block_height, block_depth, tile_width_spacing, width, 349 return std::tie(is_tiled, block_width, block_height, block_depth, tile_width_spacing, width,
358 height, depth, pitch, num_levels, pixel_format, component_type, type, target) == 350 height, depth, pitch, num_levels, pixel_format, type, target) ==
359 std::tie(rhs.is_tiled, rhs.block_width, rhs.block_height, rhs.block_depth, 351 std::tie(rhs.is_tiled, rhs.block_width, rhs.block_height, rhs.block_depth,
360 rhs.tile_width_spacing, rhs.width, rhs.height, rhs.depth, rhs.pitch, 352 rhs.tile_width_spacing, rhs.width, rhs.height, rhs.depth, rhs.pitch,
361 rhs.num_levels, rhs.pixel_format, rhs.component_type, rhs.type, rhs.target); 353 rhs.num_levels, rhs.pixel_format, rhs.type, rhs.target);
362} 354}
363 355
364std::string SurfaceParams::TargetName() const { 356std::string SurfaceParams::TargetName() const {
diff --git a/src/video_core/texture_cache/surface_params.h b/src/video_core/texture_cache/surface_params.h
index c58e7f8a4..a84058869 100644
--- a/src/video_core/texture_cache/surface_params.h
+++ b/src/video_core/texture_cache/surface_params.h
@@ -248,7 +248,6 @@ public:
248 u32 num_levels; 248 u32 num_levels;
249 u32 emulated_levels; 249 u32 emulated_levels;
250 VideoCore::Surface::PixelFormat pixel_format; 250 VideoCore::Surface::PixelFormat pixel_format;
251 VideoCore::Surface::ComponentType component_type;
252 VideoCore::Surface::SurfaceType type; 251 VideoCore::Surface::SurfaceType type;
253 VideoCore::Surface::SurfaceTarget target; 252 VideoCore::Surface::SurfaceTarget target;
254 253
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 6a92b22d3..8074cc945 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -485,15 +485,13 @@ private:
485 GetSiblingFormat(cr_params.pixel_format) == params.pixel_format) { 485 GetSiblingFormat(cr_params.pixel_format) == params.pixel_format) {
486 SurfaceParams new_params = params; 486 SurfaceParams new_params = params;
487 new_params.pixel_format = cr_params.pixel_format; 487 new_params.pixel_format = cr_params.pixel_format;
488 new_params.component_type = cr_params.component_type;
489 new_params.type = cr_params.type; 488 new_params.type = cr_params.type;
490 new_surface = GetUncachedSurface(gpu_addr, new_params); 489 new_surface = GetUncachedSurface(gpu_addr, new_params);
491 } else { 490 } else {
492 new_surface = GetUncachedSurface(gpu_addr, params); 491 new_surface = GetUncachedSurface(gpu_addr, params);
493 } 492 }
494 const auto& final_params = new_surface->GetSurfaceParams(); 493 const auto& final_params = new_surface->GetSurfaceParams();
495 if (cr_params.type != final_params.type || 494 if (cr_params.type != final_params.type) {
496 (cr_params.component_type != final_params.component_type)) {
497 BufferCopy(current_surface, new_surface); 495 BufferCopy(current_surface, new_surface);
498 } else { 496 } else {
499 std::vector<CopyParams> bricks = current_surface->BreakDown(final_params); 497 std::vector<CopyParams> bricks = current_surface->BreakDown(final_params);
@@ -835,12 +833,11 @@ private:
835 } 833 }
836 } 834 }
837 835
838 const auto inherit_format = ([](SurfaceParams& to, TSurface from) { 836 const auto inherit_format = [](SurfaceParams& to, TSurface from) {
839 const SurfaceParams& params = from->GetSurfaceParams(); 837 const SurfaceParams& params = from->GetSurfaceParams();
840 to.pixel_format = params.pixel_format; 838 to.pixel_format = params.pixel_format;
841 to.component_type = params.component_type;
842 to.type = params.type; 839 to.type = params.type;
843 }); 840 };
844 // Now we got the cases where one or both is Depth and the other is not known 841 // Now we got the cases where one or both is Depth and the other is not known
845 if (!incomplete_src) { 842 if (!incomplete_src) {
846 inherit_format(src_params, deduced_src.surface); 843 inherit_format(src_params, deduced_src.surface);