Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 5fb0fa8fc097f03deb0987b88f4020d69e2e8904..13b10c5ee8346f9d4d0f3130813261a37f61549a 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1170,6 +1170,10 @@ class GLES2DecoderImpl : public GLES2Decoder,
GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
const std::string& name_str);
+ error::Error GetFragDataLocationHelper(
+ GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
+ const std::string& name_str);
+
// Wrapper for glShaderSource.
void DoShaderSource(
GLuint client_id, GLsizei count, const char** data, const GLint* length);
@@ -8124,6 +8128,47 @@ error::Error GLES2DecoderImpl::HandleGetUniformLocation(
c.program, c.location_shm_id, c.location_shm_offset, name_str);
}
+error::Error GLES2DecoderImpl::GetFragDataLocationHelper(
+ GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset,
+ const std::string& name_str) {
+ GLint* location = GetSharedMemoryAs<GLint*>(
+ location_shm_id, location_shm_offset, sizeof(GLint));
+ if (!location) {
+ return error::kOutOfBounds;
+ }
+ // Require the client to init this incase the context is lost and we are no
+ // longer executing commands.
+ if (*location != -1) {
+ return error::kGenericError;
+ }
+ Program* program = GetProgramInfoNotShader(
+ client_id, "glGetFragDataLocation");
+ if (!program) {
+ return error::kNoError;
+ }
+ *location = glGetFragDataLocation(program->service_id(), name_str.c_str());
+ return error::kNoError;
+}
+
+error::Error GLES2DecoderImpl::HandleGetFragDataLocation(
+ uint32 immediate_data_size,
+ const void* cmd_data) {
+ if (!unsafe_es3_apis_enabled())
+ return error::kUnknownCommand;
+ const gles2::cmds::GetFragDataLocation& c =
+ *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data);
+ Bucket* bucket = GetBucket(c.name_bucket_id);
+ if (!bucket) {
+ return error::kInvalidArguments;
+ }
+ std::string name_str;
+ if (!bucket->GetAsString(&name_str)) {
+ return error::kInvalidArguments;
+ }
+ return GetFragDataLocationHelper(
+ c.program, c.location_shm_id, c.location_shm_offset, name_str);
+}
+
error::Error GLES2DecoderImpl::HandleGetString(uint32 immediate_data_size,
const void* cmd_data) {
const gles2::cmds::GetString& c =
« no previous file with comments | « gpu/command_buffer/service/common_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698