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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 659903002: Add subscribeUniform extension pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 API Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "gpu/command_buffer/service/image_manager.h" 49 #include "gpu/command_buffer/service/image_manager.h"
50 #include "gpu/command_buffer/service/mailbox_manager.h" 50 #include "gpu/command_buffer/service/mailbox_manager.h"
51 #include "gpu/command_buffer/service/memory_tracking.h" 51 #include "gpu/command_buffer/service/memory_tracking.h"
52 #include "gpu/command_buffer/service/program_manager.h" 52 #include "gpu/command_buffer/service/program_manager.h"
53 #include "gpu/command_buffer/service/query_manager.h" 53 #include "gpu/command_buffer/service/query_manager.h"
54 #include "gpu/command_buffer/service/renderbuffer_manager.h" 54 #include "gpu/command_buffer/service/renderbuffer_manager.h"
55 #include "gpu/command_buffer/service/shader_manager.h" 55 #include "gpu/command_buffer/service/shader_manager.h"
56 #include "gpu/command_buffer/service/shader_translator.h" 56 #include "gpu/command_buffer/service/shader_translator.h"
57 #include "gpu/command_buffer/service/shader_translator_cache.h" 57 #include "gpu/command_buffer/service/shader_translator_cache.h"
58 #include "gpu/command_buffer/service/texture_manager.h" 58 #include "gpu/command_buffer/service/texture_manager.h"
59 #include "gpu/command_buffer/service/uniform_subscription_manager.h"
59 #include "gpu/command_buffer/service/vertex_array_manager.h" 60 #include "gpu/command_buffer/service/vertex_array_manager.h"
60 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 61 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
61 #include "third_party/smhasher/src/City.h" 62 #include "third_party/smhasher/src/City.h"
62 #include "ui/gl/gl_fence.h" 63 #include "ui/gl/gl_fence.h"
63 #include "ui/gl/gl_image.h" 64 #include "ui/gl/gl_image.h"
64 #include "ui/gl/gl_implementation.h" 65 #include "ui/gl/gl_implementation.h"
65 #include "ui/gl/gl_surface.h" 66 #include "ui/gl/gl_surface.h"
66 67
67 #if defined(OS_MACOSX) 68 #if defined(OS_MACOSX)
68 #include <IOSurface/IOSurfaceAPI.h> 69 #include <IOSurface/IOSurfaceAPI.h>
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 TextureManager* texture_manager() { 790 TextureManager* texture_manager() {
790 return group_->texture_manager(); 791 return group_->texture_manager();
791 } 792 }
792 793
793 MailboxManager* mailbox_manager() { 794 MailboxManager* mailbox_manager() {
794 return group_->mailbox_manager(); 795 return group_->mailbox_manager();
795 } 796 }
796 797
797 ImageManager* image_manager() { return image_manager_.get(); } 798 ImageManager* image_manager() { return image_manager_.get(); }
798 799
800 UniformSubscriptionManager* uniform_subscription_manager() {
801 return uniform_subscription_manager_.get();
802 }
803
799 VertexArrayManager* vertex_array_manager() { 804 VertexArrayManager* vertex_array_manager() {
800 return vertex_array_manager_.get(); 805 return vertex_array_manager_.get();
801 } 806 }
802 807
803 MemoryTracker* memory_tracker() { 808 MemoryTracker* memory_tracker() {
804 return group_->memory_tracker(); 809 return group_->memory_tracker();
805 } 810 }
806 811
807 bool EnsureGPUMemoryAvailable(size_t estimated_size) { 812 bool EnsureGPUMemoryAvailable(size_t estimated_size) {
808 MemoryTracker* tracker = memory_tracker(); 813 MemoryTracker* tracker = memory_tracker();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key); 956 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key);
952 void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, 957 void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target,
953 const GLbyte* key); 958 const GLbyte* key);
954 void ProduceTextureRef(std::string func_name, TextureRef* texture_ref, 959 void ProduceTextureRef(std::string func_name, TextureRef* texture_ref,
955 GLenum target, const GLbyte* data); 960 GLenum target, const GLbyte* data);
956 961
957 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); 962 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key);
958 void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key, 963 void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key,
959 GLuint client_id); 964 GLuint client_id);
960 965
966 void DoSubscribeUniformCHROMIUM(GLint locaton, GLenum target);
967 void DoPopulateSubscribedUniformsCHROMIUM();
968
961 void DoBindTexImage2DCHROMIUM( 969 void DoBindTexImage2DCHROMIUM(
962 GLenum target, 970 GLenum target,
963 GLint image_id); 971 GLint image_id);
964 void DoReleaseTexImage2DCHROMIUM( 972 void DoReleaseTexImage2DCHROMIUM(
965 GLenum target, 973 GLenum target,
966 GLint image_id); 974 GLint image_id);
967 975
968 void DoTraceEndCHROMIUM(void); 976 void DoTraceEndCHROMIUM(void);
969 977
970 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); 978 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 // -1. If the current program is not valid generates the appropriate GL 1208 // -1. If the current program is not valid generates the appropriate GL
1201 // error. Returns true if the current program is in a usable state and 1209 // error. Returns true if the current program is in a usable state and
1202 // location is not -1. 1210 // location is not -1.
1203 bool CheckCurrentProgramForUniform(GLint location, const char* function_name); 1211 bool CheckCurrentProgramForUniform(GLint location, const char* function_name);
1204 1212
1205 // Checks if the current program samples a texture that is also the color 1213 // Checks if the current program samples a texture that is also the color
1206 // image of the current bound framebuffer, i.e., the source and destination 1214 // image of the current bound framebuffer, i.e., the source and destination
1207 // of the draw operation are the same. 1215 // of the draw operation are the same.
1208 bool CheckDrawingFeedbackLoops(); 1216 bool CheckDrawingFeedbackLoops();
1209 1217
1218 // Checks if |api_type| is valid for the given uniform
1219 // If the api type is not valid generates the appropriate GL
1220 // error. Returns true if |api_type| is valid for the uniform
1221 bool CheckUniformForApiType(const Program::UniformInfo* info,
1222 const char* function_name,
1223 Program::UniformApiType api_type);
1224
1210 // Gets the type of a uniform for a location in the current program. Sets GL 1225 // Gets the type of a uniform for a location in the current program. Sets GL
1211 // errors if the current program is not valid. Returns true if the current 1226 // errors if the current program is not valid. Returns true if the current
1212 // program is valid and the location exists. Adjusts count so it 1227 // program is valid and the location exists. Adjusts count so it
1213 // does not overflow the uniform. 1228 // does not overflow the uniform.
1214 bool PrepForSetUniformByLocation(GLint fake_location, 1229 bool PrepForSetUniformByLocation(GLint fake_location,
1215 const char* function_name, 1230 const char* function_name,
1216 Program::UniformApiType api_type, 1231 Program::UniformApiType api_type,
1217 GLint* real_location, 1232 GLint* real_location,
1218 GLenum* type, 1233 GLenum* type,
1219 GLsizei* count); 1234 GLsizei* count);
1220 1235
1236 // Populate subscribed uniforms for program specified by |client_id|
1237 void PopulateSubscribedUniforms(GLuint client_id);
1238
1221 // Gets the service id for any simulated backbuffer fbo. 1239 // Gets the service id for any simulated backbuffer fbo.
1222 GLuint GetBackbufferServiceId() const; 1240 GLuint GetBackbufferServiceId() const;
1223 1241
1224 // Helper for glGetBooleanv, glGetFloatv and glGetIntegerv 1242 // Helper for glGetBooleanv, glGetFloatv and glGetIntegerv
1225 bool GetHelper(GLenum pname, GLint* params, GLsizei* num_written); 1243 bool GetHelper(GLenum pname, GLint* params, GLsizei* num_written);
1226 1244
1227 // Helper for glGetVertexAttrib 1245 // Helper for glGetVertexAttrib
1228 void GetVertexAttribHelper( 1246 void GetVertexAttribHelper(
1229 const VertexAttrib* attrib, GLenum pname, GLint* param); 1247 const VertexAttrib* attrib, GLenum pname, GLint* param);
1230 1248
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 GLint level, GLsizei width, GLsizei height, GLenum format); 1608 GLint level, GLsizei width, GLsizei height, GLenum format);
1591 bool ValidateCompressedTexFuncData( 1609 bool ValidateCompressedTexFuncData(
1592 const char* function_name, 1610 const char* function_name,
1593 GLsizei width, GLsizei height, GLenum format, size_t size); 1611 GLsizei width, GLsizei height, GLenum format, size_t size);
1594 bool ValidateCompressedTexSubDimensions( 1612 bool ValidateCompressedTexSubDimensions(
1595 const char* function_name, 1613 const char* function_name,
1596 GLenum target, GLint level, GLint xoffset, GLint yoffset, 1614 GLenum target, GLint level, GLint xoffset, GLint yoffset,
1597 GLsizei width, GLsizei height, GLenum format, 1615 GLsizei width, GLsizei height, GLenum format,
1598 Texture* texture); 1616 Texture* texture);
1599 1617
1618 bool ValidateSubscribeUniform(GLint fake_location, GLenum target);
1619
1600 void RenderWarning(const char* filename, int line, const std::string& msg); 1620 void RenderWarning(const char* filename, int line, const std::string& msg);
1601 void PerformanceWarning( 1621 void PerformanceWarning(
1602 const char* filename, int line, const std::string& msg); 1622 const char* filename, int line, const std::string& msg);
1603 1623
1604 const FeatureInfo::FeatureFlags& features() const { 1624 const FeatureInfo::FeatureFlags& features() const {
1605 return feature_info_->feature_flags(); 1625 return feature_info_->feature_flags();
1606 } 1626 }
1607 1627
1608 const FeatureInfo::Workarounds& workarounds() const { 1628 const FeatureInfo::Workarounds& workarounds() const {
1609 return feature_info_->workarounds(); 1629 return feature_info_->workarounds();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_; 1746 scoped_ptr<BackFramebuffer> offscreen_resolved_frame_buffer_;
1727 scoped_ptr<BackTexture> offscreen_resolved_color_texture_; 1747 scoped_ptr<BackTexture> offscreen_resolved_color_texture_;
1728 GLenum offscreen_saved_color_format_; 1748 GLenum offscreen_saved_color_format_;
1729 1749
1730 scoped_ptr<QueryManager> query_manager_; 1750 scoped_ptr<QueryManager> query_manager_;
1731 1751
1732 scoped_ptr<VertexArrayManager> vertex_array_manager_; 1752 scoped_ptr<VertexArrayManager> vertex_array_manager_;
1733 1753
1734 scoped_ptr<ImageManager> image_manager_; 1754 scoped_ptr<ImageManager> image_manager_;
1735 1755
1756 scoped_ptr<UniformSubscriptionManager> uniform_subscription_manager_;
1757
1736 base::Callback<void(gfx::Size, float)> resize_callback_; 1758 base::Callback<void(gfx::Size, float)> resize_callback_;
1737 1759
1738 WaitSyncPointCallback wait_sync_point_callback_; 1760 WaitSyncPointCallback wait_sync_point_callback_;
1739 1761
1740 ShaderCacheCallback shader_cache_callback_; 1762 ShaderCacheCallback shader_cache_callback_;
1741 1763
1742 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_; 1764 scoped_ptr<AsyncPixelTransferManager> async_pixel_transfer_manager_;
1743 1765
1744 // The format of the back buffer_ 1766 // The format of the back buffer_
1745 GLenum back_buffer_color_format_; 1767 GLenum back_buffer_color_format_;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 group_->max_vertex_attribs(), 2461 group_->max_vertex_attribs(),
2440 feature_info_->workarounds().init_vertex_attributes); 2462 feature_info_->workarounds().init_vertex_attributes);
2441 2463
2442 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call 2464 // vertex_attrib_manager is set to default_vertex_attrib_manager by this call
2443 DoBindVertexArrayOES(0); 2465 DoBindVertexArrayOES(0);
2444 2466
2445 query_manager_.reset(new QueryManager(this, feature_info_.get())); 2467 query_manager_.reset(new QueryManager(this, feature_info_.get()));
2446 2468
2447 image_manager_.reset(new ImageManager); 2469 image_manager_.reset(new ImageManager);
2448 2470
2471 uniform_subscription_manager_.reset(new UniformSubscriptionManager);
2472
2449 util_.set_num_compressed_texture_formats( 2473 util_.set_num_compressed_texture_formats(
2450 validators_->compressed_texture_format.GetValues().size()); 2474 validators_->compressed_texture_format.GetValues().size());
2451 2475
2452 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { 2476 if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
2453 // We have to enable vertex array 0 on OpenGL or it won't render. Note that 2477 // We have to enable vertex array 0 on OpenGL or it won't render. Note that
2454 // OpenGL ES 2.0 does not have this issue. 2478 // OpenGL ES 2.0 does not have this issue.
2455 glEnableVertexAttribArray(0); 2479 glEnableVertexAttribArray(0);
2456 } 2480 }
2457 glGenBuffersARB(1, &attrib_0_buffer_id_); 2481 glGenBuffersARB(1, &attrib_0_buffer_id_);
2458 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); 2482 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_);
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 if (vertex_array_manager_ .get()) { 3547 if (vertex_array_manager_ .get()) {
3524 vertex_array_manager_->Destroy(have_context); 3548 vertex_array_manager_->Destroy(have_context);
3525 vertex_array_manager_.reset(); 3549 vertex_array_manager_.reset();
3526 } 3550 }
3527 3551
3528 if (image_manager_.get()) { 3552 if (image_manager_.get()) {
3529 image_manager_->Destroy(have_context); 3553 image_manager_->Destroy(have_context);
3530 image_manager_.reset(); 3554 image_manager_.reset();
3531 } 3555 }
3532 3556
3557 if (uniform_subscription_manager_.get()) {
3558 uniform_subscription_manager_->Destroy(have_context);
3559 uniform_subscription_manager_.reset();
3560 }
3561
3533 offscreen_target_frame_buffer_.reset(); 3562 offscreen_target_frame_buffer_.reset();
3534 offscreen_target_color_texture_.reset(); 3563 offscreen_target_color_texture_.reset();
3535 offscreen_target_color_render_buffer_.reset(); 3564 offscreen_target_color_render_buffer_.reset();
3536 offscreen_target_depth_render_buffer_.reset(); 3565 offscreen_target_depth_render_buffer_.reset();
3537 offscreen_target_stencil_render_buffer_.reset(); 3566 offscreen_target_stencil_render_buffer_.reset();
3538 offscreen_saved_frame_buffer_.reset(); 3567 offscreen_saved_frame_buffer_.reset();
3539 offscreen_saved_color_texture_.reset(); 3568 offscreen_saved_color_texture_.reset();
3540 offscreen_resolved_frame_buffer_.reset(); 3569 offscreen_resolved_frame_buffer_.reset();
3541 offscreen_resolved_color_texture_.reset(); 3570 offscreen_resolved_color_texture_.reset();
3542 3571
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
5748 } 5777 }
5749 5778
5750 bool GLES2DecoderImpl::CheckCurrentProgramForUniform( 5779 bool GLES2DecoderImpl::CheckCurrentProgramForUniform(
5751 GLint location, const char* function_name) { 5780 GLint location, const char* function_name) {
5752 if (!CheckCurrentProgram(function_name)) { 5781 if (!CheckCurrentProgram(function_name)) {
5753 return false; 5782 return false;
5754 } 5783 }
5755 return location != -1; 5784 return location != -1;
5756 } 5785 }
5757 5786
5787
5758 bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() { 5788 bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() {
5759 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); 5789 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
5760 if (!framebuffer) 5790 if (!framebuffer)
5761 return false; 5791 return false;
5762 const Framebuffer::Attachment* attachment = 5792 const Framebuffer::Attachment* attachment =
5763 framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0); 5793 framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0);
5764 if (!attachment) 5794 if (!attachment)
5765 return false; 5795 return false;
5766 5796
5767 DCHECK(state_.current_program.get()); 5797 DCHECK(state_.current_program.get());
(...skipping 12 matching lines...) Expand all
5780 TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; 5810 TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
5781 TextureRef* texture_ref = 5811 TextureRef* texture_ref =
5782 texture_unit.GetInfoForSamplerType(GL_SAMPLER_2D).get(); 5812 texture_unit.GetInfoForSamplerType(GL_SAMPLER_2D).get();
5783 if (attachment->IsTexture(texture_ref)) 5813 if (attachment->IsTexture(texture_ref))
5784 return true; 5814 return true;
5785 } 5815 }
5786 } 5816 }
5787 return false; 5817 return false;
5788 } 5818 }
5789 5819
5820 bool GLES2DecoderImpl::CheckUniformForApiType(
5821 const Program::UniformInfo* info,
5822 const char* function_name,
5823 Program::UniformApiType api_type) {
5824 DCHECK(info);
5825 if ((api_type & info->accepts_api_type) == 0) {
5826 LOCAL_SET_GL_ERROR(
5827 GL_INVALID_OPERATION, function_name, "wrong uniform function for type");
5828 return false;
5829 }
5830 return true;
5831 }
5832
5790 bool GLES2DecoderImpl::PrepForSetUniformByLocation( 5833 bool GLES2DecoderImpl::PrepForSetUniformByLocation(
5791 GLint fake_location, 5834 GLint fake_location,
5792 const char* function_name, 5835 const char* function_name,
5793 Program::UniformApiType api_type, 5836 Program::UniformApiType api_type,
5794 GLint* real_location, 5837 GLint* real_location,
5795 GLenum* type, 5838 GLenum* type,
5796 GLsizei* count) { 5839 GLsizei* count) {
5797 DCHECK(type); 5840 DCHECK(type);
5798 DCHECK(count); 5841 DCHECK(count);
5799 DCHECK(real_location); 5842 DCHECK(real_location);
5800 5843
5801 if (!CheckCurrentProgramForUniform(fake_location, function_name)) { 5844 if (!CheckCurrentProgramForUniform(fake_location, function_name)) {
5802 return false; 5845 return false;
5803 } 5846 }
5804 GLint array_index = -1; 5847 GLint array_index = -1;
5805 const Program::UniformInfo* info = 5848 const Program::UniformInfo* info =
5806 state_.current_program->GetUniformInfoByFakeLocation( 5849 state_.current_program->GetUniformInfoByFakeLocation(
5807 fake_location, real_location, &array_index); 5850 fake_location, real_location, &array_index);
5808 if (!info) { 5851 if (!info) {
5809 LOCAL_SET_GL_ERROR( 5852 LOCAL_SET_GL_ERROR(
5810 GL_INVALID_OPERATION, function_name, "unknown location"); 5853 GL_INVALID_OPERATION, function_name, "unknown location");
5811 return false; 5854 return false;
5812 } 5855 }
5813 5856 if (!CheckUniformForApiType(info, function_name, api_type)) {
5814 if ((api_type & info->accepts_api_type) == 0) {
5815 LOCAL_SET_GL_ERROR(
5816 GL_INVALID_OPERATION, function_name,
5817 "wrong uniform function for type");
5818 return false; 5857 return false;
5819 } 5858 }
5820 if (*count > 1 && !info->is_array) { 5859 if (*count > 1 && !info->is_array) {
5821 LOCAL_SET_GL_ERROR( 5860 LOCAL_SET_GL_ERROR(
5822 GL_INVALID_OPERATION, function_name, "count > 1 for non-array"); 5861 GL_INVALID_OPERATION, function_name, "count > 1 for non-array");
5823 return false; 5862 return false;
5824 } 5863 }
5825 *count = std::min(info->size - array_index, *count); 5864 *count = std::min(info->size - array_index, *count);
5826 if (*count <= 0) { 5865 if (*count <= 0) {
5827 return false; 5866 return false;
5828 } 5867 }
5829 *type = info->type; 5868 *type = info->type;
5830 return true; 5869 return true;
5831 } 5870 }
5832 5871
5872 void GLES2DecoderImpl::PopulateSubscribedUniforms(GLuint client_id) {
5873 const UniformSubscriptionManager::ProgramSubscriptions*
5874 program_subscriptions =
5875 uniform_subscription_manager()->SubscriptionsForProgram(client_id);
5876 if (program_subscriptions) {
5877 // TODO(orglofch)
5878 }
5879 }
5880
5833 void GLES2DecoderImpl::DoUniform1i(GLint fake_location, GLint v0) { 5881 void GLES2DecoderImpl::DoUniform1i(GLint fake_location, GLint v0) {
5834 GLenum type = 0; 5882 GLenum type = 0;
5835 GLsizei count = 1; 5883 GLsizei count = 1;
5836 GLint real_location = -1; 5884 GLint real_location = -1;
5837 if (!PrepForSetUniformByLocation(fake_location, 5885 if (!PrepForSetUniformByLocation(fake_location,
5838 "glUniform1i", 5886 "glUniform1i",
5839 Program::kUniform1i, 5887 Program::kUniform1i,
5840 &real_location, 5888 &real_location,
5841 &type, 5889 &type,
5842 &count)) { 5890 &count)) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
6083 program_manager()->UnuseProgram(shader_manager(), 6131 program_manager()->UnuseProgram(shader_manager(),
6084 state_.current_program.get()); 6132 state_.current_program.get());
6085 } 6133 }
6086 state_.current_program = program; 6134 state_.current_program = program;
6087 LogClientServiceMapping("glUseProgram", program_id, service_id); 6135 LogClientServiceMapping("glUseProgram", program_id, service_id);
6088 glUseProgram(service_id); 6136 glUseProgram(service_id);
6089 if (state_.current_program.get()) { 6137 if (state_.current_program.get()) {
6090 program_manager()->UseProgram(state_.current_program.get()); 6138 program_manager()->UseProgram(state_.current_program.get());
6091 if (workarounds().clear_uniforms_before_first_program_use) 6139 if (workarounds().clear_uniforms_before_first_program_use)
6092 program_manager()->ClearUniforms(program); 6140 program_manager()->ClearUniforms(program);
6141 PopulateSubscribedUniforms(program_id);
piman 2014/10/21 20:00:41 I think we'd want to populate the uniforms only on
orglofch 2014/10/22 23:10:21 Done. I added needs_update_subscriptions_ flag to
6093 } 6142 }
6094 } 6143 }
6095 6144
6096 void GLES2DecoderImpl::RenderWarning( 6145 void GLES2DecoderImpl::RenderWarning(
6097 const char* filename, int line, const std::string& msg) { 6146 const char* filename, int line, const std::string& msg) {
6098 logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg); 6147 logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg);
6099 } 6148 }
6100 6149
6101 void GLES2DecoderImpl::PerformanceWarning( 6150 void GLES2DecoderImpl::PerformanceWarning(
6102 const char* filename, int line, const std::string& msg) { 6151 const char* filename, int line, const std::string& msg) {
(...skipping 4578 matching lines...) Expand 10 before | Expand all | Expand 10 after
10681 if (texture->target() != target) { 10730 if (texture->target() != target) {
10682 LOCAL_SET_GL_ERROR( 10731 LOCAL_SET_GL_ERROR(
10683 GL_INVALID_OPERATION, 10732 GL_INVALID_OPERATION,
10684 "glCreateAndConsumeTextureCHROMIUM", "invalid target"); 10733 "glCreateAndConsumeTextureCHROMIUM", "invalid target");
10685 return; 10734 return;
10686 } 10735 }
10687 10736
10688 texture_ref = texture_manager()->Consume(client_id, texture); 10737 texture_ref = texture_manager()->Consume(client_id, texture);
10689 } 10738 }
10690 10739
10740 bool GLES2DecoderImpl::ValidateSubscribeUniform(GLint fake_location,
10741 GLenum target) {
10742 if (!CheckCurrentProgramForUniform(fake_location,
10743 "glSubscribeUniformCHROMIUM")) {
10744 return false;
10745 }
10746 GLint array_index = -1;
10747 GLint real_location = -1;
10748 const Program::UniformInfo* info =
10749 state_.current_program->GetUniformInfoByFakeLocation(
10750 fake_location, &real_location, &array_index);
10751 if (!info) {
10752 LOCAL_SET_GL_ERROR(
10753 GL_INVALID_OPERATION, "glSubscribeUniformCHROMIUM", "unknown location");
10754 return false;
10755 }
10756 if (!CheckUniformForApiType(
10757 info,
10758 "glSubscribeUniformCHROMIUM",
10759 uniform_subscription_manager()->ApiTypeForTarget(target))) {
10760 return false;
10761 }
10762 return true;
10763 }
10764
10765 void GLES2DecoderImpl::DoSubscribeUniformCHROMIUM(GLint location,
10766 GLenum target) {
10767 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoSubscribeUniformCHROMIUM");
10768 if (!ValidateSubscribeUniform(location, target)) {
10769 return;
10770 }
10771 GLuint client_id;
10772 program_manager()->GetClientId(state_.current_program.get()->service_id(),
10773 &client_id);
10774 uniform_subscription_manager()->AddSubscription(client_id, location, target);
10775 }
10776
10777 void GLES2DecoderImpl::DoPopulateSubscribedUniformsCHROMIUM() {
10778 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoPopulateSubscribedUniformsCHROMIUM");
10779 uniform_subscription_manager()->ActivateUniformSubscriptionState();
10780 // Defer population of other programs until calls to DoUseProgram
10781 if (state_.current_program.get()) {
10782 GLuint client_id;
10783 program_manager()->GetClientId(state_.current_program.get()->service_id(),
10784 &client_id);
10785 PopulateSubscribedUniforms(client_id);
10786 }
10787 }
10788
10691 void GLES2DecoderImpl::DoInsertEventMarkerEXT( 10789 void GLES2DecoderImpl::DoInsertEventMarkerEXT(
10692 GLsizei length, const GLchar* marker) { 10790 GLsizei length, const GLchar* marker) {
10693 if (!marker) { 10791 if (!marker) {
10694 marker = ""; 10792 marker = "";
10695 } 10793 }
10696 debug_marker_manager_.SetMarker( 10794 debug_marker_manager_.SetMarker(
10697 length ? std::string(marker, length) : std::string(marker)); 10795 length ? std::string(marker, length) : std::string(marker));
10698 } 10796 }
10699 10797
10700 void GLES2DecoderImpl::DoPushGroupMarkerEXT( 10798 void GLES2DecoderImpl::DoPushGroupMarkerEXT(
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
11243 } 11341 }
11244 } 11342 }
11245 11343
11246 // Include the auto-generated part of this file. We split this because it means 11344 // Include the auto-generated part of this file. We split this because it means
11247 // we can easily edit the non-auto generated parts right here in this file 11345 // we can easily edit the non-auto generated parts right here in this file
11248 // instead of having to edit some template or the code generator. 11346 // instead of having to edit some template or the code generator.
11249 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11347 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11250 11348
11251 } // namespace gles2 11349 } // namespace gles2
11252 } // namespace gpu 11350 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698