summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 23:58:29 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 23:58:29 +0000
commiteee50fff9114107a646b89ceb716e1f2de38cf72 (patch)
treee649d27147a2a89e4c39c9ac97d096a43370854c /gpu
parent4b2ec461badcfcc7f25ec66856b8cfc4fa064106 (diff)
downloadchromium_src-eee50fff9114107a646b89ceb716e1f2de38cf72.zip
chromium_src-eee50fff9114107a646b89ceb716e1f2de38cf72.tar.gz
chromium_src-eee50fff9114107a646b89ceb716e1f2de38cf72.tar.bz2
Added TRACE for measuring shader translator timings.
Review URL: https://chromiumcodereview.appspot.com/15692006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/shader_translator.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/gpu/command_buffer/service/shader_translator.cc b/gpu/command_buffer/service/shader_translator.cc
index dfb94c3..3bd2a97 100644
--- a/gpu/command_buffer/service/shader_translator.cc
+++ b/gpu/command_buffer/service/shader_translator.cc
@@ -8,6 +8,7 @@
#include <algorithm>
#include "base/at_exit.h"
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
@@ -16,12 +17,15 @@ namespace {
using gpu::gles2::ShaderTranslator;
void FinalizeShaderTranslator(void* /* dummy */) {
+ TRACE_EVENT0("gpu", "ShFinalize");
ShFinalize();
}
bool InitializeShaderTranslator() {
static bool initialized = false;
- if (!initialized && ShInitialize()) {
+ if (!initialized) {
+ TRACE_EVENT0("gpu", "ShInitialize");
+ CHECK(ShInitialize());
base::AtExitManager::RegisterCallback(&FinalizeShaderTranslator, NULL);
initialized = true;
}
@@ -138,8 +142,11 @@ bool ShaderTranslator::Init(
ShShaderOutput shader_output =
(glsl_implementation_type == kGlslES ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT);
- compiler_ = ShConstructCompiler(
- shader_type, shader_spec, shader_output, resources);
+ {
+ TRACE_EVENT0("gpu", "ShConstructCompiler");
+ compiler_ = ShConstructCompiler(
+ shader_type, shader_spec, shader_output, resources);
+ }
compiler_options_ = *resources;
implementation_is_glsl_es_ = (glsl_implementation_type == kGlslES);
needs_built_in_function_emulation_ =
@@ -168,8 +175,11 @@ bool ShaderTranslator::Translate(const char* shader) {
ClearResults();
bool success = false;
- if (ShCompile(compiler_, &shader, 1, GetCompileOptions())) {
- success = true;
+ {
+ TRACE_EVENT0("gpu", "ShCompile");
+ success = !!ShCompile(compiler_, &shader, 1, GetCompileOptions());
+ }
+ if (success) {
// Get translated shader.
ANGLEGetInfoType obj_code_len = 0;
ShGetInfo(compiler_, SH_OBJECT_CODE_LENGTH, &obj_code_len);