summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/client')
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h28
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h32
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc56
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h1
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h11
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h8
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h8
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h12
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h8
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h23
-rw-r--r--gpu/command_buffer/client/program_info_manager.cc38
-rw-r--r--gpu/command_buffer/client/program_info_manager.h8
12 files changed, 233 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index b274a6b..8cb59a9 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -1704,6 +1704,21 @@ void GL_APIENTRY GLES2BlendBarrierKHR() {
void GL_APIENTRY GLES2ApplyScreenSpaceAntialiasingCHROMIUM() {
gles2::GetGLContext()->ApplyScreenSpaceAntialiasingCHROMIUM();
}
+void GL_APIENTRY GLES2BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char* name) {
+ gles2::GetGLContext()->BindFragDataLocationIndexedEXT(program, colorNumber,
+ index, name);
+}
+void GL_APIENTRY GLES2BindFragDataLocationEXT(GLuint program,
+ GLuint colorNumber,
+ const char* name) {
+ gles2::GetGLContext()->BindFragDataLocationEXT(program, colorNumber, name);
+}
+GLint GL_APIENTRY GLES2GetFragDataIndexEXT(GLuint program, const char* name) {
+ return gles2::GetGLContext()->GetFragDataIndexEXT(program, name);
+}
namespace gles2 {
@@ -2994,6 +3009,19 @@ extern const NameToFunc g_gles2_function_table[] = {
glApplyScreenSpaceAntialiasingCHROMIUM),
},
{
+ "glBindFragDataLocationIndexedEXT",
+ reinterpret_cast<GLES2FunctionPointer>(
+ glBindFragDataLocationIndexedEXT),
+ },
+ {
+ "glBindFragDataLocationEXT",
+ reinterpret_cast<GLES2FunctionPointer>(glBindFragDataLocationEXT),
+ },
+ {
+ "glGetFragDataIndexEXT",
+ reinterpret_cast<GLES2FunctionPointer>(glGetFragDataIndexEXT),
+ },
+ {
NULL, NULL,
},
};
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index b5cf24c..b87750a 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -3166,4 +3166,36 @@ void ApplyScreenSpaceAntialiasingCHROMIUM() {
}
}
+void BindFragDataLocationIndexedEXTBucket(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ uint32_t name_bucket_id) {
+ gles2::cmds::BindFragDataLocationIndexedEXTBucket* c =
+ GetCmdSpace<gles2::cmds::BindFragDataLocationIndexedEXTBucket>();
+ if (c) {
+ c->Init(program, colorNumber, index, name_bucket_id);
+ }
+}
+
+void BindFragDataLocationEXTBucket(GLuint program,
+ GLuint colorNumber,
+ uint32_t name_bucket_id) {
+ gles2::cmds::BindFragDataLocationEXTBucket* c =
+ GetCmdSpace<gles2::cmds::BindFragDataLocationEXTBucket>();
+ if (c) {
+ c->Init(program, colorNumber, name_bucket_id);
+ }
+}
+
+void GetFragDataIndexEXT(GLuint program,
+ uint32_t name_bucket_id,
+ uint32_t index_shm_id,
+ uint32_t index_shm_offset) {
+ gles2::cmds::GetFragDataIndexEXT* c =
+ GetCmdSpace<gles2::cmds::GetFragDataIndexEXT>();
+ if (c) {
+ c->Init(program, name_bucket_id, index_shm_id, index_shm_offset);
+ }
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 6a00426..7c7f99d 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -1396,6 +1396,33 @@ void GLES2Implementation::BindAttribLocation(
CheckGLError();
}
+void GLES2Implementation::BindFragDataLocationEXT(GLuint program,
+ GLuint colorName,
+ const char* name) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT("
+ << program << ", " << colorName << ", " << name << ")");
+ SetBucketAsString(kResultBucketId, name);
+ helper_->BindFragDataLocationEXTBucket(program, colorName, kResultBucketId);
+ helper_->SetBucketSize(kResultBucketId, 0);
+ CheckGLError();
+}
+
+void GLES2Implementation::BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorName,
+ GLuint index,
+ const char* name) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFragDataLocationEXT("
+ << program << ", " << colorName << ", " << index << ", "
+ << name << ")");
+ SetBucketAsString(kResultBucketId, name);
+ helper_->BindFragDataLocationIndexedEXTBucket(program, colorName, index,
+ kResultBucketId);
+ helper_->SetBucketSize(kResultBucketId, 0);
+ CheckGLError();
+}
+
void GLES2Implementation::BindUniformLocationCHROMIUM(
GLuint program, GLint location, const char* name) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
@@ -1607,6 +1634,35 @@ bool GLES2Implementation::GetProgramivHelper(
return got_value;
}
+GLint GLES2Implementation::GetFragDataIndexEXTHelper(GLuint program,
+ const char* name) {
+ typedef cmds::GetFragDataIndexEXT::Result Result;
+ Result* result = GetResultAs<Result*>();
+ if (!result) {
+ return -1;
+ }
+ *result = -1;
+ SetBucketAsCString(kResultBucketId, name);
+ helper_->GetFragDataIndexEXT(program, kResultBucketId, GetResultShmId(),
+ GetResultShmOffset());
+ WaitForCmd();
+ helper_->SetBucketSize(kResultBucketId, 0);
+ return *result;
+}
+
+GLint GLES2Implementation::GetFragDataIndexEXT(GLuint program,
+ const char* name) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFragDataIndexEXT(" << program
+ << ", " << name << ")");
+ TRACE_EVENT0("gpu", "GLES2::GetFragDataIndexEXT");
+ GLint loc = share_group_->program_info_manager()->GetFragDataIndex(
+ this, program, name);
+ GPU_CLIENT_LOG("returned " << loc);
+ CheckGLError();
+ return loc;
+}
+
GLint GLES2Implementation::GetFragDataLocationHelper(
GLuint program, const char* name) {
typedef cmds::GetFragDataLocation::Result Result;
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 1c2eba9..1c55b83 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -215,6 +215,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation
void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result);
GLint GetAttribLocationHelper(GLuint program, const char* name);
GLint GetUniformLocationHelper(GLuint program, const char* name);
+ GLint GetFragDataIndexEXTHelper(GLuint program, const char* name);
GLint GetFragDataLocationHelper(GLuint program, const char* name);
bool GetActiveAttribHelper(
GLuint program, GLuint index, GLsizei bufsize, GLsizei* length,
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index 0a4f886..10ebcc3 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -1184,4 +1184,15 @@ void BlendBarrierKHR() override;
void ApplyScreenSpaceAntialiasingCHROMIUM() override;
+void BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char* name) override;
+
+void BindFragDataLocationEXT(GLuint program,
+ GLuint colorNumber,
+ const char* name) override;
+
+GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 77872e7..374cb26 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -885,4 +885,12 @@ virtual void ProgramPathFragmentInputGenCHROMIUM(GLuint program,
virtual GLenum GetGraphicsResetStatusKHR() = 0;
virtual void BlendBarrierKHR() = 0;
virtual void ApplyScreenSpaceAntialiasingCHROMIUM() = 0;
+virtual void BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char* name) = 0;
+virtual void BindFragDataLocationEXT(GLuint program,
+ GLuint colorNumber,
+ const char* name) = 0;
+virtual GLint GetFragDataIndexEXT(GLuint program, const char* name) = 0;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 5469525..489afa2 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -859,4 +859,12 @@ void ProgramPathFragmentInputGenCHROMIUM(GLuint program,
GLenum GetGraphicsResetStatusKHR() override;
void BlendBarrierKHR() override;
void ApplyScreenSpaceAntialiasingCHROMIUM() override;
+void BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char* name) override;
+void BindFragDataLocationEXT(GLuint program,
+ GLuint colorNumber,
+ const char* name) override;
+GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index 867652f..148f3af 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -1159,4 +1159,16 @@ GLenum GLES2InterfaceStub::GetGraphicsResetStatusKHR() {
}
void GLES2InterfaceStub::BlendBarrierKHR() {}
void GLES2InterfaceStub::ApplyScreenSpaceAntialiasingCHROMIUM() {}
+void GLES2InterfaceStub::BindFragDataLocationIndexedEXT(
+ GLuint /* program */,
+ GLuint /* colorNumber */,
+ GLuint /* index */,
+ const char* /* name */) {}
+void GLES2InterfaceStub::BindFragDataLocationEXT(GLuint /* program */,
+ GLuint /* colorNumber */,
+ const char* /* name */) {}
+GLint GLES2InterfaceStub::GetFragDataIndexEXT(GLuint /* program */,
+ const char* /* name */) {
+ return 0;
+}
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_IMPL_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 209215e..8347572 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -859,4 +859,12 @@ void ProgramPathFragmentInputGenCHROMIUM(GLuint program,
GLenum GetGraphicsResetStatusKHR() override;
void BlendBarrierKHR() override;
void ApplyScreenSpaceAntialiasingCHROMIUM() override;
+void BindFragDataLocationIndexedEXT(GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char* name) override;
+void BindFragDataLocationEXT(GLuint program,
+ GLuint colorNumber,
+ const char* name) override;
+GLint GetFragDataIndexEXT(GLuint program, const char* name) override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 77c6ab6..5f67456 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -2475,4 +2475,27 @@ void GLES2TraceImplementation::ApplyScreenSpaceAntialiasingCHROMIUM() {
gl_->ApplyScreenSpaceAntialiasingCHROMIUM();
}
+void GLES2TraceImplementation::BindFragDataLocationIndexedEXT(
+ GLuint program,
+ GLuint colorNumber,
+ GLuint index,
+ const char* name) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu",
+ "GLES2Trace::BindFragDataLocationIndexedEXT");
+ gl_->BindFragDataLocationIndexedEXT(program, colorNumber, index, name);
+}
+
+void GLES2TraceImplementation::BindFragDataLocationEXT(GLuint program,
+ GLuint colorNumber,
+ const char* name) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BindFragDataLocationEXT");
+ gl_->BindFragDataLocationEXT(program, colorNumber, name);
+}
+
+GLint GLES2TraceImplementation::GetFragDataIndexEXT(GLuint program,
+ const char* name) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetFragDataIndexEXT");
+ return gl_->GetFragDataIndexEXT(program, name);
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_IMPL_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc
index 939473a..d047b57 100644
--- a/gpu/command_buffer/client/program_info_manager.cc
+++ b/gpu/command_buffer/client/program_info_manager.cc
@@ -160,6 +160,19 @@ GLuint ProgramInfoManager::Program::GetUniformIndex(
return GL_INVALID_INDEX;
}
+GLint ProgramInfoManager::Program::GetFragDataIndex(
+ const std::string& name) const {
+ auto iter = frag_data_indices_.find(name);
+ if (iter == frag_data_indices_.end())
+ return -1;
+ return iter->second;
+}
+
+void ProgramInfoManager::Program::CacheFragDataIndex(const std::string& name,
+ GLint index) {
+ frag_data_indices_[name] = index;
+}
+
GLint ProgramInfoManager::Program::GetFragDataLocation(
const std::string& name) const {
base::hash_map<std::string, GLint>::const_iterator iter =
@@ -725,6 +738,31 @@ GLint ProgramInfoManager::GetUniformLocation(
return gl->GetUniformLocationHelper(program, name);
}
+GLint ProgramInfoManager::GetFragDataIndex(GLES2Implementation* gl,
+ GLuint program,
+ const char* name) {
+ // TODO(zmo): make FragData indexes part of the ProgramInfo that are
+ // fetched from the service side. See crbug.com/452104.
+ {
+ base::AutoLock auto_lock(lock_);
+ Program* info = GetProgramInfo(gl, program, kNone);
+ if (info) {
+ GLint possible_index = info->GetFragDataIndex(name);
+ if (possible_index != -1)
+ return possible_index;
+ }
+ }
+ GLint index = gl->GetFragDataIndexEXTHelper(program, name);
+ if (index != -1) {
+ base::AutoLock auto_lock(lock_);
+ Program* info = GetProgramInfo(gl, program, kNone);
+ if (info) {
+ info->CacheFragDataIndex(name, index);
+ }
+ }
+ return index;
+}
+
GLint ProgramInfoManager::GetFragDataLocation(
GLES2Implementation* gl, GLuint program, const char* name) {
// TODO(zmo): make FragData locations part of the ProgramInfo that are
diff --git a/gpu/command_buffer/client/program_info_manager.h b/gpu/command_buffer/client/program_info_manager.h
index fa74ea5..fbae19a 100644
--- a/gpu/command_buffer/client/program_info_manager.h
+++ b/gpu/command_buffer/client/program_info_manager.h
@@ -38,6 +38,10 @@ class GLES2_IMPL_EXPORT ProgramInfoManager {
GLint GetUniformLocation(
GLES2Implementation* gl, GLuint program, const char* name);
+ GLint GetFragDataIndex(GLES2Implementation* gl,
+ GLuint program,
+ const char* name);
+
GLint GetFragDataLocation(
GLES2Implementation* gl, GLuint program, const char* name);
@@ -166,6 +170,9 @@ class GLES2_IMPL_EXPORT ProgramInfoManager {
bool GetUniformsiv(
GLsizei count, const GLuint* indices, GLenum pname, GLint* params);
+ GLint GetFragDataIndex(const std::string& name) const;
+ void CacheFragDataIndex(const std::string& name, GLint index);
+
GLint GetFragDataLocation(const std::string& name) const;
void CacheFragDataLocation(const std::string& name, GLint loc);
@@ -232,6 +239,7 @@ class GLES2_IMPL_EXPORT ProgramInfoManager {
std::vector<UniformES3> uniforms_es3_;
base::hash_map<std::string, GLint> frag_data_locations_;
+ base::hash_map<std::string, GLint> frag_data_indices_;
};
Program* GetProgramInfo(