summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar FernandoS272018-10-12 22:06:04 -0400
committerGravatar FernandoS272018-12-09 17:22:29 -0400
commit7b9c982d297f15c9fc30cd0cd68508b7df46cf45 (patch)
tree609853b36f20ed8f8a180483ed94c7a2ec886ac2 /src
parentMerge pull request #1868 from lioncash/config (diff)
downloadyuzu-7b9c982d297f15c9fc30cd0cd68508b7df46cf45.tar.gz
yuzu-7b9c982d297f15c9fc30cd0cd68508b7df46cf45.tar.xz
yuzu-7b9c982d297f15c9fc30cd0cd68508b7df46cf45.zip
Add more info into textures' object labels
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h52
2 files changed, 57 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 5f4cdd119..cfc0dae29 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -107,6 +107,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
107 params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format)); 107 params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format));
108 params.unaligned_height = config.tic.Height(); 108 params.unaligned_height = config.tic.Height();
109 params.target = SurfaceTargetFromTextureType(config.tic.texture_type); 109 params.target = SurfaceTargetFromTextureType(config.tic.texture_type);
110 params.identity = SurfaceClass::Uploaded;
110 111
111 switch (params.target) { 112 switch (params.target) {
112 case SurfaceTarget::Texture1D: 113 case SurfaceTarget::Texture1D:
@@ -173,6 +174,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
173 params.height = config.height; 174 params.height = config.height;
174 params.unaligned_height = config.height; 175 params.unaligned_height = config.height;
175 params.target = SurfaceTarget::Texture2D; 176 params.target = SurfaceTarget::Texture2D;
177 params.identity = SurfaceClass::RenderTarget;
176 params.depth = 1; 178 params.depth = 1;
177 params.max_mip_level = 1; 179 params.max_mip_level = 1;
178 params.is_layered = false; 180 params.is_layered = false;
@@ -208,6 +210,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
208 params.height = zeta_height; 210 params.height = zeta_height;
209 params.unaligned_height = zeta_height; 211 params.unaligned_height = zeta_height;
210 params.target = SurfaceTarget::Texture2D; 212 params.target = SurfaceTarget::Texture2D;
213 params.identity = SurfaceClass::DepthBuffer;
211 params.depth = 1; 214 params.depth = 1;
212 params.max_mip_level = 1; 215 params.max_mip_level = 1;
213 params.is_layered = false; 216 params.is_layered = false;
@@ -236,6 +239,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
236 params.height = config.height; 239 params.height = config.height;
237 params.unaligned_height = config.height; 240 params.unaligned_height = config.height;
238 params.target = SurfaceTarget::Texture2D; 241 params.target = SurfaceTarget::Texture2D;
242 params.identity = SurfaceClass::Copy;
239 params.depth = 1; 243 params.depth = 1;
240 params.max_mip_level = 1; 244 params.max_mip_level = 1;
241 params.rt = {}; 245 params.rt = {};
@@ -560,8 +564,7 @@ CachedSurface::CachedSurface(const SurfaceParams& params)
560 glTexParameterf(SurfaceTargetToGL(params.target), GL_TEXTURE_LOD_BIAS, 1000.0); 564 glTexParameterf(SurfaceTargetToGL(params.target), GL_TEXTURE_LOD_BIAS, 1000.0);
561 } 565 }
562 566
563 LabelGLObject(GL_TEXTURE, texture.handle, params.addr, 567 OpenGL::LabelGLObject(GL_TEXTURE, texture.handle, params.addr, params.IdentityString());
564 SurfaceParams::SurfaceTargetName(params.target));
565 568
566 // Clamp size to mapped GPU memory region 569 // Clamp size to mapped GPU memory region
567 // TODO(bunnei): Super Mario Odyssey maps a 0x40000 byte region and then uses it for a 0x80000 570 // TODO(bunnei): Super Mario Odyssey maps a 0x40000 byte region and then uses it for a 0x80000
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index c710aa245..ee158bd91 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -35,6 +35,14 @@ using PixelFormat = VideoCore::Surface::PixelFormat;
35using ComponentType = VideoCore::Surface::ComponentType; 35using ComponentType = VideoCore::Surface::ComponentType;
36 36
37struct SurfaceParams { 37struct SurfaceParams {
38
39 enum class SurfaceClass {
40 Uploaded,
41 RenderTarget,
42 DepthBuffer,
43 Copy,
44 };
45
38 static std::string SurfaceTargetName(SurfaceTarget target) { 46 static std::string SurfaceTargetName(SurfaceTarget target) {
39 switch (target) { 47 switch (target) {
40 case SurfaceTarget::Texture1D: 48 case SurfaceTarget::Texture1D:
@@ -210,6 +218,48 @@ struct SurfaceParams {
210 /// Initializes parameters for caching, should be called after everything has been initialized 218 /// Initializes parameters for caching, should be called after everything has been initialized
211 void InitCacheParameters(Tegra::GPUVAddr gpu_addr); 219 void InitCacheParameters(Tegra::GPUVAddr gpu_addr);
212 220
221 std::string TargetName() const {
222 switch (target) {
223 case SurfaceTarget::Texture1D:
224 return "1D";
225 case SurfaceTarget::Texture2D:
226 return "2D";
227 case SurfaceTarget::Texture3D:
228 return "3D";
229 case SurfaceTarget::Texture1DArray:
230 return "1DArray";
231 case SurfaceTarget::Texture2DArray:
232 return "2DArray";
233 case SurfaceTarget::TextureCubemap:
234 return "Cube";
235 default:
236 LOG_CRITICAL(HW_GPU, "Unimplemented surface_target={}", static_cast<u32>(target));
237 UNREACHABLE();
238 return fmt::format("TUK({})", static_cast<u32>(target));
239 }
240 }
241
242 std::string ClassName() const {
243 switch (identity) {
244 case SurfaceClass::Uploaded:
245 return "UP";
246 case SurfaceClass::RenderTarget:
247 return "RT";
248 case SurfaceClass::DepthBuffer:
249 return "DB";
250 case SurfaceClass::Copy:
251 return "CP";
252 default:
253 LOG_CRITICAL(HW_GPU, "Unimplemented surface_class={}", static_cast<u32>(identity));
254 UNREACHABLE();
255 return fmt::format("CUK({})", static_cast<u32>(identity));
256 }
257 }
258
259 std::string IdentityString() const {
260 return ClassName() + '_' + TargetName() + '_' + (is_tiled ? 'T' : 'L');
261 }
262
213 bool is_tiled; 263 bool is_tiled;
214 u32 block_width; 264 u32 block_width;
215 u32 block_height; 265 u32 block_height;
@@ -223,6 +273,7 @@ struct SurfaceParams {
223 u32 depth; 273 u32 depth;
224 u32 unaligned_height; 274 u32 unaligned_height;
225 SurfaceTarget target; 275 SurfaceTarget target;
276 SurfaceClass identity;
226 u32 max_mip_level; 277 u32 max_mip_level;
227 bool is_layered; 278 bool is_layered;
228 bool srgb_conversion; 279 bool srgb_conversion;
@@ -255,6 +306,7 @@ struct SurfaceReserveKey : Common::HashableStruct<OpenGL::SurfaceParams> {
255 static SurfaceReserveKey Create(const OpenGL::SurfaceParams& params) { 306 static SurfaceReserveKey Create(const OpenGL::SurfaceParams& params) {
256 SurfaceReserveKey res; 307 SurfaceReserveKey res;
257 res.state = params; 308 res.state = params;
309 res.state.identity = {}; // Ignore the origin of the texture
258 res.state.gpu_addr = {}; // Ignore GPU vaddr in caching 310 res.state.gpu_addr = {}; // Ignore GPU vaddr in caching
259 res.state.rt = {}; // Ignore rt config in caching 311 res.state.rt = {}; // Ignore rt config in caching
260 return res; 312 return res;