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 20c4da8efce5dea9ded6e230dde087e69c9cf0b9..2068044949d79e5b83003a3d7f092d356c53c9bd 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -56,6 +56,7 @@ |
#include "gpu/command_buffer/service/shader_translator.h" |
#include "gpu/command_buffer/service/shader_translator_cache.h" |
#include "gpu/command_buffer/service/texture_manager.h" |
+#include "gpu/command_buffer/service/uniform_subscription_manager.h" |
#include "gpu/command_buffer/service/vertex_array_manager.h" |
#include "gpu/command_buffer/service/vertex_attrib_manager.h" |
#include "third_party/smhasher/src/City.h" |
@@ -796,6 +797,13 @@ class GLES2DecoderImpl : public GLES2Decoder, |
ImageManager* image_manager() { return image_manager_.get(); } |
+ UniformSubscriptionManager* uniform_subscription_manager() { |
+ return uniform_subscription_manager_.get(); |
+ } |
+ |
+ // Populate uniforms the program is currently subscribed too |
+ void PopulateUniformSubscriptions(); |
piman
2014/10/16 02:39:18
When is this called?
orglofch
2014/10/21 04:19:38
It wasn't it was meant as a placeholder. Updated i
|
+ |
VertexArrayManager* vertex_array_manager() { |
return vertex_array_manager_.get(); |
} |
@@ -958,6 +966,8 @@ class GLES2DecoderImpl : public GLES2Decoder, |
void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key, |
GLuint client_id); |
+ void DoSubscribeUniformCHROMIUM(GLenum target, const GLchar* name); |
+ |
void DoBindTexImage2DCHROMIUM( |
GLenum target, |
GLint image_id); |
@@ -1727,6 +1737,8 @@ class GLES2DecoderImpl : public GLES2Decoder, |
scoped_ptr<ImageManager> image_manager_; |
+ scoped_ptr<UniformSubscriptionManager> uniform_subscription_manager_; |
+ |
base::Callback<void(gfx::Size, float)> resize_callback_; |
WaitSyncPointCallback wait_sync_point_callback_; |
@@ -2440,6 +2452,8 @@ bool GLES2DecoderImpl::Initialize( |
image_manager_.reset(new ImageManager); |
+ uniform_subscription_manager_.reset(new UniformSubscriptionManager); |
+ |
util_.set_num_compressed_texture_formats( |
validators_->compressed_texture_format.GetValues().size()); |
@@ -3533,6 +3547,11 @@ void GLES2DecoderImpl::Destroy(bool have_context) { |
image_manager_.reset(); |
} |
+ if (uniform_subscription_manager_.get()) { |
+ uniform_subscription_manager_->Destroy(have_context); |
+ uniform_subscription_manager_.reset(); |
+ } |
+ |
offscreen_target_frame_buffer_.reset(); |
offscreen_target_color_texture_.reset(); |
offscreen_target_color_render_buffer_.reset(); |
@@ -9313,6 +9332,23 @@ error::Error GLES2DecoderImpl::HandleShaderBinary(uint32 immediate_data_size, |
#endif |
} |
+void GLES2DecoderImpl::PopulateUniformSubscriptions() { |
+ const UniformSubscriptionManager::SubscriptionMap& subscriptions = |
+ uniform_subscription_manager()->subscriptions(); |
+ for (UniformSubscriptionManager::SubscriptionMap::const_iterator it = |
+ subscriptions.begin(); |
+ it != subscriptions.end(); |
+ ++it) { |
+ if (state_.current_program.get()) { |
piman
2014/10/16 02:39:18
This is a loop invariant. Early out instead?
orglofch
2014/10/21 04:19:38
Acknowledged. No longer in the API.
|
+ GLint location = |
+ state_.current_program.get()->GetUniformFakeLocation(it->second); |
piman
2014/10/16 02:39:18
This seems pretty costly to do string parsing and
orglofch
2014/10/21 04:19:38
Acknowledged. No longer in the API.
|
+ if (location != -1) { |
+ // TODO(orglofch): Populate uniform based on it->first type |
+ } |
+ } |
+ } |
+} |
+ |
void GLES2DecoderImpl::DoSwapBuffers() { |
bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
@@ -10634,6 +10670,30 @@ void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target, |
texture_ref = texture_manager()->Consume(client_id, texture); |
} |
+error::Error GLES2DecoderImpl::HandleSubscribeUniformCHROMIUM( |
+ uint32_t immediate_data_size, |
+ const void* cmd_data) { |
+ const gles2::cmds::SubscribeUniformCHROMIUM& c = |
+ *static_cast<const gles2::cmds::SubscribeUniformCHROMIUM*>(cmd_data); |
+ GLenum target = static_cast<GLenum>(c.target); |
piman
2014/10/16 02:39:18
Where do we validate target against valid values?
orglofch
2014/10/21 04:19:38
Done. Added to build_gles2_cmd_buffer.py.
|
+ Bucket* bucket = GetBucket(c.bucket_id); |
+ if (!bucket || bucket->size() == 0) { |
+ return error::kInvalidArguments; |
+ } |
+ std::string name_str; |
+ if (!bucket->GetAsString(&name_str)) { |
+ return error::kInvalidArguments; |
+ } |
+ DoSubscribeUniformCHROMIUM(target, name_str.c_str()); |
+ return error::kNoError; |
+} |
+ |
+void GLES2DecoderImpl::DoSubscribeUniformCHROMIUM(GLenum target, |
+ const GLchar* name) { |
+ TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoSubscribeUniformCHROMIUM"); |
+ uniform_subscription_manager()->AddSubscription(target, name); |
piman
2014/10/16 02:39:18
How do you remove entries?
orglofch
2014/10/21 04:19:38
There is no method for removing entries, is there
piman
2014/10/21 20:00:40
In the previous API, the entries were not linked t
orglofch
2014/10/22 23:10:21
Done. I've added an unsubscribe call to API.
|
+} |
+ |
void GLES2DecoderImpl::DoInsertEventMarkerEXT( |
GLsizei length, const GLchar* marker) { |
if (!marker) { |