summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/TextureCache.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2016-11-27 18:15:02 +1000
committerStenzek <stenzek@gmail.com>2017-04-01 12:32:57 +1000
commit02f887ede0037c4ca30c84ccc5f5b58069da2f5f (patch)
tree7d157ea106043762a2564846cae66566fc6168d0 /Source/Core/VideoBackends/OGL/TextureCache.cpp
parentb01bcb80f4c62ac97a1043101a408340513b937b (diff)
OGL: Add GPUTimer class for measuring execution time of a draw/dispatch
Diffstat (limited to 'Source/Core/VideoBackends/OGL/TextureCache.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/TextureCache.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp
index 72b04fc5b1..bd6f99b2e8 100644
--- a/Source/Core/VideoBackends/OGL/TextureCache.cpp
+++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp
@@ -16,6 +16,7 @@
#include "Common/StringUtil.h"
#include "VideoBackends/OGL/FramebufferManager.h"
+#include "VideoBackends/OGL/GPUTimer.h"
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoBackends/OGL/Render.h"
#include "VideoBackends/OGL/SamplerCache.h"
@@ -62,6 +63,8 @@ struct TextureDecodingProgramInfo
bool valid = false;
};
+//#define TIME_TEXTURE_DECODING 1
+
static std::map<std::pair<u32, u32>, TextureDecodingProgramInfo> s_texture_decoding_program_info;
static std::array<GLuint, TextureConversionShader::BUFFER_FORMAT_COUNT>
s_texture_decoding_buffer_views;
@@ -713,6 +716,10 @@ void TextureCache::DecodeTextureOnGPU(TCacheEntryBase* entry, u32 dst_level, con
if (iter == s_texture_decoding_program_info.end())
return;
+#ifdef TIME_TEXTURE_DECODING
+ GPUTimer timer;
+#endif
+
// Copy to GPU-visible buffer, aligned to the data type.
auto info = iter->second;
u32 bytes_per_buffer_elem =
@@ -775,5 +782,10 @@ void TextureCache::DecodeTextureOnGPU(TCacheEntryBase* entry, u32 dst_level, con
glMemoryBarrier(GL_TEXTURE_UPDATE_BARRIER_BIT);
TextureCache::SetStage();
+
+#ifdef TIME_TEXTURE_DECODING
+ WARN_LOG(VIDEO, "Decode texture format %u size %ux%u took %.4fms", static_cast<u32>(format),
+ width, height, timer.GetTimeMilliseconds());
+#endif
}
}