| OLD | NEW |
| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 }; | 487 }; |
| 488 | 488 |
| 489 | 489 |
| 490 // } // anonymous namespace. | 490 // } // anonymous namespace. |
| 491 | 491 |
| 492 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, | 492 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, |
| 493 uint32* service_texture_id) { | 493 uint32* service_texture_id) { |
| 494 return false; | 494 return false; |
| 495 } | 495 } |
| 496 | 496 |
| 497 GLES2Decoder::GLES2Decoder() | 497 GLES2Decoder::GLES2Decoder() : initialized_(false), debug_(false) {} |
| 498 : initialized_(false), | |
| 499 debug_(false), | |
| 500 log_commands_(false) { | |
| 501 } | |
| 502 | 498 |
| 503 GLES2Decoder::~GLES2Decoder() { | 499 GLES2Decoder::~GLES2Decoder() {} |
| 504 } | |
| 505 | 500 |
| 506 // This class implements GLES2Decoder so we don't have to expose all the GLES2 | 501 // This class implements GLES2Decoder so we don't have to expose all the GLES2 |
| 507 // cmd stuff to outside this class. | 502 // cmd stuff to outside this class. |
| 508 class GLES2DecoderImpl : public GLES2Decoder, | 503 class GLES2DecoderImpl : public GLES2Decoder, |
| 509 public FramebufferManager::TextureDetachObserver { | 504 public FramebufferManager::TextureDetachObserver { |
| 510 public: | 505 public: |
| 511 // Used by PrepForSetUniformByLocation to validate types. | 506 // Used by PrepForSetUniformByLocation to validate types. |
| 512 struct BaseUniformInfo { | 507 struct BaseUniformInfo { |
| 513 const GLenum* const valid_types; | 508 const GLenum* const valid_types; |
| 514 size_t num_valid_types; | 509 size_t num_valid_types; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 Program* CreateProgram( | 883 Program* CreateProgram( |
| 889 GLuint client_id, GLuint service_id) { | 884 GLuint client_id, GLuint service_id) { |
| 890 return program_manager()->CreateProgram(client_id, service_id); | 885 return program_manager()->CreateProgram(client_id, service_id); |
| 891 } | 886 } |
| 892 | 887 |
| 893 // Gets the program info for the given program. Returns NULL if none exists. | 888 // Gets the program info for the given program. Returns NULL if none exists. |
| 894 Program* GetProgram(GLuint client_id) { | 889 Program* GetProgram(GLuint client_id) { |
| 895 return program_manager()->GetProgram(client_id); | 890 return program_manager()->GetProgram(client_id); |
| 896 } | 891 } |
| 897 | 892 |
| 898 #if defined(NDEBUG) | |
| 899 void LogClientServiceMapping( | |
| 900 const char* /* function_name */, | |
| 901 GLuint /* client_id */, | |
| 902 GLuint /* service_id */) { | |
| 903 } | |
| 904 template<typename T> | |
| 905 void LogClientServiceForInfo( | |
| 906 T* /* info */, GLuint /* client_id */, const char* /* function_name */) { | |
| 907 } | |
| 908 #else | |
| 909 void LogClientServiceMapping( | |
| 910 const char* function_name, GLuint client_id, GLuint service_id) { | |
| 911 if (service_logging_) { | |
| 912 DLOG(INFO) << "[" << logger_.GetLogPrefix() << "] " << function_name | |
| 913 << ": client_id = " << client_id | |
| 914 << ", service_id = " << service_id; | |
| 915 } | |
| 916 } | |
| 917 template<typename T> | |
| 918 void LogClientServiceForInfo( | |
| 919 T* info, GLuint client_id, const char* function_name) { | |
| 920 if (info) { | |
| 921 LogClientServiceMapping(function_name, client_id, info->service_id()); | |
| 922 } | |
| 923 } | |
| 924 #endif | |
| 925 | |
| 926 // Gets the program info for the given program. If it's not a program | 893 // Gets the program info for the given program. If it's not a program |
| 927 // generates a GL error. Returns NULL if not program. | 894 // generates a GL error. Returns NULL if not program. |
| 928 Program* GetProgramInfoNotShader( | 895 Program* GetProgramInfoNotShader( |
| 929 GLuint client_id, const char* function_name) { | 896 GLuint client_id, const char* function_name) { |
| 930 Program* program = GetProgram(client_id); | 897 Program* program = GetProgram(client_id); |
| 931 if (!program) { | 898 if (!program) { |
| 932 if (GetShader(client_id)) { | 899 if (GetShader(client_id)) { |
| 933 LOCAL_SET_GL_ERROR( | 900 LOCAL_SET_GL_ERROR( |
| 934 GL_INVALID_OPERATION, function_name, "shader passed for program"); | 901 GL_INVALID_OPERATION, function_name, "shader passed for program"); |
| 935 } else { | 902 } else { |
| 936 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown program"); | 903 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown program"); |
| 937 } | 904 } |
| 938 } | 905 } |
| 939 LogClientServiceForInfo(program, client_id, function_name); | |
| 940 return program; | 906 return program; |
| 941 } | 907 } |
| 942 | 908 |
| 943 | 909 |
| 944 // Creates a Shader for the given shader. | 910 // Creates a Shader for the given shader. |
| 945 Shader* CreateShader( | 911 Shader* CreateShader( |
| 946 GLuint client_id, | 912 GLuint client_id, |
| 947 GLuint service_id, | 913 GLuint service_id, |
| 948 GLenum shader_type) { | 914 GLenum shader_type) { |
| 949 return shader_manager()->CreateShader( | 915 return shader_manager()->CreateShader( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 962 Shader* shader = GetShader(client_id); | 928 Shader* shader = GetShader(client_id); |
| 963 if (!shader) { | 929 if (!shader) { |
| 964 if (GetProgram(client_id)) { | 930 if (GetProgram(client_id)) { |
| 965 LOCAL_SET_GL_ERROR( | 931 LOCAL_SET_GL_ERROR( |
| 966 GL_INVALID_OPERATION, function_name, "program passed for shader"); | 932 GL_INVALID_OPERATION, function_name, "program passed for shader"); |
| 967 } else { | 933 } else { |
| 968 LOCAL_SET_GL_ERROR( | 934 LOCAL_SET_GL_ERROR( |
| 969 GL_INVALID_VALUE, function_name, "unknown shader"); | 935 GL_INVALID_VALUE, function_name, "unknown shader"); |
| 970 } | 936 } |
| 971 } | 937 } |
| 972 LogClientServiceForInfo(shader, client_id, function_name); | |
| 973 return shader; | 938 return shader; |
| 974 } | 939 } |
| 975 | 940 |
| 976 // Creates a buffer info for the given buffer. | 941 // Creates a buffer info for the given buffer. |
| 977 void CreateBuffer(GLuint client_id, GLuint service_id) { | 942 void CreateBuffer(GLuint client_id, GLuint service_id) { |
| 978 return buffer_manager()->CreateBuffer(client_id, service_id); | 943 return buffer_manager()->CreateBuffer(client_id, service_id); |
| 979 } | 944 } |
| 980 | 945 |
| 981 // Gets the buffer info for the given buffer. | 946 // Gets the buffer info for the given buffer. |
| 982 Buffer* GetBuffer(GLuint client_id) { | 947 Buffer* GetBuffer(GLuint client_id) { |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 // contexts, the assumptions on the availablity of extensions in WebGL | 1632 // contexts, the assumptions on the availablity of extensions in WebGL |
| 1668 // contexts may be broken. These flags override the shared state to preserve | 1633 // contexts may be broken. These flags override the shared state to preserve |
| 1669 // WebGL semantics. | 1634 // WebGL semantics. |
| 1670 bool force_webgl_glsl_validation_; | 1635 bool force_webgl_glsl_validation_; |
| 1671 bool derivatives_explicitly_enabled_; | 1636 bool derivatives_explicitly_enabled_; |
| 1672 bool frag_depth_explicitly_enabled_; | 1637 bool frag_depth_explicitly_enabled_; |
| 1673 bool draw_buffers_explicitly_enabled_; | 1638 bool draw_buffers_explicitly_enabled_; |
| 1674 | 1639 |
| 1675 bool compile_shader_always_succeeds_; | 1640 bool compile_shader_always_succeeds_; |
| 1676 | 1641 |
| 1677 // Log extra info. | |
| 1678 bool service_logging_; | |
| 1679 | |
| 1680 #if defined(OS_MACOSX) | 1642 #if defined(OS_MACOSX) |
| 1681 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; | 1643 typedef std::map<GLuint, CFTypeRef> TextureToIOSurfaceMap; |
| 1682 TextureToIOSurfaceMap texture_to_io_surface_map_; | 1644 TextureToIOSurfaceMap texture_to_io_surface_map_; |
| 1683 #endif | 1645 #endif |
| 1684 | 1646 |
| 1685 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 1647 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
| 1686 | 1648 |
| 1687 // Cached values of the currently assigned viewport dimensions. | 1649 // Cached values of the currently assigned viewport dimensions. |
| 1688 GLsizei viewport_max_width_; | 1650 GLsizei viewport_max_width_; |
| 1689 GLsizei viewport_max_height_; | 1651 GLsizei viewport_max_height_; |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 feature_info_(group_->feature_info()), | 2104 feature_info_(group_->feature_info()), |
| 2143 frame_number_(0), | 2105 frame_number_(0), |
| 2144 has_robustness_extension_(false), | 2106 has_robustness_extension_(false), |
| 2145 reset_status_(GL_NO_ERROR), | 2107 reset_status_(GL_NO_ERROR), |
| 2146 reset_by_robustness_extension_(false), | 2108 reset_by_robustness_extension_(false), |
| 2147 force_webgl_glsl_validation_(false), | 2109 force_webgl_glsl_validation_(false), |
| 2148 derivatives_explicitly_enabled_(false), | 2110 derivatives_explicitly_enabled_(false), |
| 2149 frag_depth_explicitly_enabled_(false), | 2111 frag_depth_explicitly_enabled_(false), |
| 2150 draw_buffers_explicitly_enabled_(false), | 2112 draw_buffers_explicitly_enabled_(false), |
| 2151 compile_shader_always_succeeds_(false), | 2113 compile_shader_always_succeeds_(false), |
| 2152 service_logging_(CommandLine::ForCurrentProcess()->HasSwitch( | |
| 2153 switches::kEnableGPUServiceLoggingGPU)), | |
| 2154 viewport_max_width_(0), | 2114 viewport_max_width_(0), |
| 2155 viewport_max_height_(0), | 2115 viewport_max_height_(0), |
| 2156 texture_state_(group_->feature_info() | 2116 texture_state_(group_->feature_info() |
| 2157 ->workarounds() | 2117 ->workarounds() |
| 2158 .texsubimage2d_faster_than_teximage2d), | 2118 .texsubimage2d_faster_than_teximage2d), |
| 2159 validation_texture_(0), | 2119 validation_texture_(0), |
| 2160 validation_fbo_multisample_(0), | 2120 validation_fbo_multisample_(0), |
| 2161 validation_fbo_(0) { | 2121 validation_fbo_(0) { |
| 2162 DCHECK(group); | 2122 DCHECK(group); |
| 2163 | 2123 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2194 | 2154 |
| 2195 set_initialized(); | 2155 set_initialized(); |
| 2196 gpu_tracer_ = GPUTracer::Create(); | 2156 gpu_tracer_ = GPUTracer::Create(); |
| 2197 gpu_state_tracer_ = GPUStateTracer::Create(&state_); | 2157 gpu_state_tracer_ = GPUStateTracer::Create(&state_); |
| 2198 | 2158 |
| 2199 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2159 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2200 switches::kEnableGPUDebugging)) { | 2160 switches::kEnableGPUDebugging)) { |
| 2201 set_debug(true); | 2161 set_debug(true); |
| 2202 } | 2162 } |
| 2203 | 2163 |
| 2204 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 2205 switches::kEnableGPUCommandLogging)) { | |
| 2206 set_log_commands(true); | |
| 2207 } | |
| 2208 | |
| 2209 compile_shader_always_succeeds_ = CommandLine::ForCurrentProcess()->HasSwitch( | 2164 compile_shader_always_succeeds_ = CommandLine::ForCurrentProcess()->HasSwitch( |
| 2210 switches::kCompileShaderAlwaysSucceeds); | 2165 switches::kCompileShaderAlwaysSucceeds); |
| 2211 | 2166 |
| 2212 | 2167 |
| 2213 // Take ownership of the context and surface. The surface can be replaced with | 2168 // Take ownership of the context and surface. The surface can be replaced with |
| 2214 // SetSurface. | 2169 // SetSurface. |
| 2215 context_ = context; | 2170 context_ = context; |
| 2216 surface_ = surface; | 2171 surface_ = surface; |
| 2217 | 2172 |
| 2218 if (!group_->Initialize(this, disallowed_features)) { | 2173 if (!group_->Initialize(this, disallowed_features)) { |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3472 | 3427 |
| 3473 // Decode command with its arguments, and call the corresponding GL function. | 3428 // Decode command with its arguments, and call the corresponding GL function. |
| 3474 // Note: args is a pointer to the command buffer. As such, it could be changed | 3429 // Note: args is a pointer to the command buffer. As such, it could be changed |
| 3475 // by a (malicious) client at any time, so if validation has to happen, it | 3430 // by a (malicious) client at any time, so if validation has to happen, it |
| 3476 // should operate on a copy of them. | 3431 // should operate on a copy of them. |
| 3477 error::Error GLES2DecoderImpl::DoCommand( | 3432 error::Error GLES2DecoderImpl::DoCommand( |
| 3478 unsigned int command, | 3433 unsigned int command, |
| 3479 unsigned int arg_count, | 3434 unsigned int arg_count, |
| 3480 const void* cmd_data) { | 3435 const void* cmd_data) { |
| 3481 error::Error result = error::kNoError; | 3436 error::Error result = error::kNoError; |
| 3482 if (log_commands()) { | |
| 3483 // TODO(notme): Change this to a LOG/VLOG that works in release. Tried | |
| 3484 // LOG(INFO), tried VLOG(1), no luck. | |
| 3485 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "]" << "cmd: " | |
| 3486 << GetCommandName(command); | |
| 3487 } | |
| 3488 unsigned int command_index = command - kStartPoint - 1; | 3437 unsigned int command_index = command - kStartPoint - 1; |
| 3489 if (command_index < arraysize(g_command_info)) { | 3438 if (command_index < arraysize(g_command_info)) { |
| 3490 const CommandInfo& info = g_command_info[command_index]; | 3439 const CommandInfo& info = g_command_info[command_index]; |
| 3491 unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); | 3440 unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count); |
| 3492 if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || | 3441 if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) || |
| 3493 (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { | 3442 (info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) { |
| 3494 uint32 immediate_data_size = | 3443 uint32 immediate_data_size = |
| 3495 (arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT | 3444 (arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT |
| 3496 switch (command) { | 3445 switch (command) { |
| 3497 #define GLES2_CMD_OP(name) \ | 3446 #define GLES2_CMD_OP(name) \ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 | 3537 |
| 3589 // It's a new id so make a buffer buffer for it. | 3538 // It's a new id so make a buffer buffer for it. |
| 3590 glGenBuffersARB(1, &service_id); | 3539 glGenBuffersARB(1, &service_id); |
| 3591 CreateBuffer(client_id, service_id); | 3540 CreateBuffer(client_id, service_id); |
| 3592 buffer = GetBuffer(client_id); | 3541 buffer = GetBuffer(client_id); |
| 3593 IdAllocatorInterface* id_allocator = | 3542 IdAllocatorInterface* id_allocator = |
| 3594 group_->GetIdAllocator(id_namespaces::kBuffers); | 3543 group_->GetIdAllocator(id_namespaces::kBuffers); |
| 3595 id_allocator->MarkAsUsed(client_id); | 3544 id_allocator->MarkAsUsed(client_id); |
| 3596 } | 3545 } |
| 3597 } | 3546 } |
| 3598 LogClientServiceForInfo(buffer, client_id, "glBindBuffer"); | |
| 3599 if (buffer) { | 3547 if (buffer) { |
| 3600 if (!buffer_manager()->SetTarget(buffer, target)) { | 3548 if (!buffer_manager()->SetTarget(buffer, target)) { |
| 3601 LOCAL_SET_GL_ERROR( | 3549 LOCAL_SET_GL_ERROR( |
| 3602 GL_INVALID_OPERATION, | 3550 GL_INVALID_OPERATION, |
| 3603 "glBindBuffer", "buffer bound to more than 1 target"); | 3551 "glBindBuffer", "buffer bound to more than 1 target"); |
| 3604 return; | 3552 return; |
| 3605 } | 3553 } |
| 3606 service_id = buffer->service_id(); | 3554 service_id = buffer->service_id(); |
| 3607 } | 3555 } |
| 3608 switch (target) { | 3556 switch (target) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3767 CreateFramebuffer(client_id, service_id); | 3715 CreateFramebuffer(client_id, service_id); |
| 3768 framebuffer = GetFramebuffer(client_id); | 3716 framebuffer = GetFramebuffer(client_id); |
| 3769 IdAllocatorInterface* id_allocator = | 3717 IdAllocatorInterface* id_allocator = |
| 3770 group_->GetIdAllocator(id_namespaces::kFramebuffers); | 3718 group_->GetIdAllocator(id_namespaces::kFramebuffers); |
| 3771 id_allocator->MarkAsUsed(client_id); | 3719 id_allocator->MarkAsUsed(client_id); |
| 3772 } else { | 3720 } else { |
| 3773 service_id = framebuffer->service_id(); | 3721 service_id = framebuffer->service_id(); |
| 3774 } | 3722 } |
| 3775 framebuffer->MarkAsValid(); | 3723 framebuffer->MarkAsValid(); |
| 3776 } | 3724 } |
| 3777 LogClientServiceForInfo(framebuffer, client_id, "glBindFramebuffer"); | |
| 3778 | 3725 |
| 3779 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT) { | 3726 if (target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER_EXT) { |
| 3780 framebuffer_state_.bound_draw_framebuffer = framebuffer; | 3727 framebuffer_state_.bound_draw_framebuffer = framebuffer; |
| 3781 } | 3728 } |
| 3782 if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT) { | 3729 if (target == GL_FRAMEBUFFER || target == GL_READ_FRAMEBUFFER_EXT) { |
| 3783 framebuffer_state_.bound_read_framebuffer = framebuffer; | 3730 framebuffer_state_.bound_read_framebuffer = framebuffer; |
| 3784 } | 3731 } |
| 3785 | 3732 |
| 3786 framebuffer_state_.clear_state_dirty = true; | 3733 framebuffer_state_.clear_state_dirty = true; |
| 3787 | 3734 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3813 CreateRenderbuffer(client_id, service_id); | 3760 CreateRenderbuffer(client_id, service_id); |
| 3814 renderbuffer = GetRenderbuffer(client_id); | 3761 renderbuffer = GetRenderbuffer(client_id); |
| 3815 IdAllocatorInterface* id_allocator = | 3762 IdAllocatorInterface* id_allocator = |
| 3816 group_->GetIdAllocator(id_namespaces::kRenderbuffers); | 3763 group_->GetIdAllocator(id_namespaces::kRenderbuffers); |
| 3817 id_allocator->MarkAsUsed(client_id); | 3764 id_allocator->MarkAsUsed(client_id); |
| 3818 } else { | 3765 } else { |
| 3819 service_id = renderbuffer->service_id(); | 3766 service_id = renderbuffer->service_id(); |
| 3820 } | 3767 } |
| 3821 renderbuffer->MarkAsValid(); | 3768 renderbuffer->MarkAsValid(); |
| 3822 } | 3769 } |
| 3823 LogClientServiceForInfo(renderbuffer, client_id, "glBindRenerbuffer"); | |
| 3824 state_.bound_renderbuffer = renderbuffer; | 3770 state_.bound_renderbuffer = renderbuffer; |
| 3825 glBindRenderbufferEXT(target, service_id); | 3771 glBindRenderbufferEXT(target, service_id); |
| 3826 } | 3772 } |
| 3827 | 3773 |
| 3828 void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { | 3774 void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) { |
| 3829 TextureRef* texture_ref = NULL; | 3775 TextureRef* texture_ref = NULL; |
| 3830 GLuint service_id = 0; | 3776 GLuint service_id = 0; |
| 3831 if (client_id != 0) { | 3777 if (client_id != 0) { |
| 3832 texture_ref = GetTexture(client_id); | 3778 texture_ref = GetTexture(client_id); |
| 3833 if (!texture_ref) { | 3779 if (!texture_ref) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3858 GL_INVALID_OPERATION, | 3804 GL_INVALID_OPERATION, |
| 3859 "glBindTexture", "texture bound to more than 1 target."); | 3805 "glBindTexture", "texture bound to more than 1 target."); |
| 3860 return; | 3806 return; |
| 3861 } | 3807 } |
| 3862 if (texture->IsStreamTexture() && target != GL_TEXTURE_EXTERNAL_OES) { | 3808 if (texture->IsStreamTexture() && target != GL_TEXTURE_EXTERNAL_OES) { |
| 3863 LOCAL_SET_GL_ERROR( | 3809 LOCAL_SET_GL_ERROR( |
| 3864 GL_INVALID_OPERATION, | 3810 GL_INVALID_OPERATION, |
| 3865 "glBindTexture", "illegal target for stream texture."); | 3811 "glBindTexture", "illegal target for stream texture."); |
| 3866 return; | 3812 return; |
| 3867 } | 3813 } |
| 3868 LogClientServiceForInfo(texture, client_id, "glBindTexture"); | |
| 3869 if (texture->target() == 0) { | 3814 if (texture->target() == 0) { |
| 3870 texture_manager()->SetTarget(texture_ref, target); | 3815 texture_manager()->SetTarget(texture_ref, target); |
| 3871 } | 3816 } |
| 3872 glBindTexture(target, texture->service_id()); | 3817 glBindTexture(target, texture->service_id()); |
| 3873 | 3818 |
| 3874 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; | 3819 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; |
| 3875 unit.bind_target = target; | 3820 unit.bind_target = target; |
| 3876 switch (target) { | 3821 switch (target) { |
| 3877 case GL_TEXTURE_2D: | 3822 case GL_TEXTURE_2D: |
| 3878 unit.bound_texture_2d = texture_ref; | 3823 unit.bound_texture_2d = texture_ref; |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5345 } | 5290 } |
| 5346 | 5291 |
| 5347 void GLES2DecoderImpl::DoLinkProgram(GLuint program_id) { | 5292 void GLES2DecoderImpl::DoLinkProgram(GLuint program_id) { |
| 5348 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram"); | 5293 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoLinkProgram"); |
| 5349 Program* program = GetProgramInfoNotShader( | 5294 Program* program = GetProgramInfoNotShader( |
| 5350 program_id, "glLinkProgram"); | 5295 program_id, "glLinkProgram"); |
| 5351 if (!program) { | 5296 if (!program) { |
| 5352 return; | 5297 return; |
| 5353 } | 5298 } |
| 5354 | 5299 |
| 5355 LogClientServiceForInfo(program, program_id, "glLinkProgram"); | |
| 5356 ShaderTranslator* vertex_translator = NULL; | 5300 ShaderTranslator* vertex_translator = NULL; |
| 5357 ShaderTranslator* fragment_translator = NULL; | 5301 ShaderTranslator* fragment_translator = NULL; |
| 5358 if (use_shader_translator_) { | 5302 if (use_shader_translator_) { |
| 5359 vertex_translator = vertex_translator_.get(); | 5303 vertex_translator = vertex_translator_.get(); |
| 5360 fragment_translator = fragment_translator_.get(); | 5304 fragment_translator = fragment_translator_.get(); |
| 5361 } | 5305 } |
| 5362 if (program->Link(shader_manager(), | 5306 if (program->Link(shader_manager(), |
| 5363 vertex_translator, | 5307 vertex_translator, |
| 5364 fragment_translator, | 5308 fragment_translator, |
| 5365 feature_info_.get(), | 5309 feature_info_.get(), |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5823 GL_INVALID_OPERATION, "glUseProgram", "program not linked"); | 5767 GL_INVALID_OPERATION, "glUseProgram", "program not linked"); |
| 5824 return; | 5768 return; |
| 5825 } | 5769 } |
| 5826 service_id = program->service_id(); | 5770 service_id = program->service_id(); |
| 5827 } | 5771 } |
| 5828 if (state_.current_program.get()) { | 5772 if (state_.current_program.get()) { |
| 5829 program_manager()->UnuseProgram(shader_manager(), | 5773 program_manager()->UnuseProgram(shader_manager(), |
| 5830 state_.current_program.get()); | 5774 state_.current_program.get()); |
| 5831 } | 5775 } |
| 5832 state_.current_program = program; | 5776 state_.current_program = program; |
| 5833 LogClientServiceMapping("glUseProgram", program_id, service_id); | |
| 5834 glUseProgram(service_id); | 5777 glUseProgram(service_id); |
| 5835 if (state_.current_program.get()) { | 5778 if (state_.current_program.get()) { |
| 5836 program_manager()->UseProgram(state_.current_program.get()); | 5779 program_manager()->UseProgram(state_.current_program.get()); |
| 5837 } | 5780 } |
| 5838 } | 5781 } |
| 5839 | 5782 |
| 5840 void GLES2DecoderImpl::RenderWarning( | 5783 void GLES2DecoderImpl::RenderWarning( |
| 5841 const char* filename, int line, const std::string& msg) { | 5784 const char* filename, int line, const std::string& msg) { |
| 5842 logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg); | 5785 logger_.LogMessage(filename, line, std::string("RENDER WARNING: ") + msg); |
| 5843 } | 5786 } |
| (...skipping 4653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10497 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10440 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10498 } | 10441 } |
| 10499 | 10442 |
| 10500 // Include the auto-generated part of this file. We split this because it means | 10443 // Include the auto-generated part of this file. We split this because it means |
| 10501 // we can easily edit the non-auto generated parts right here in this file | 10444 // we can easily edit the non-auto generated parts right here in this file |
| 10502 // instead of having to edit some template or the code generator. | 10445 // instead of having to edit some template or the code generator. |
| 10503 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 10446 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10504 | 10447 |
| 10505 } // namespace gles2 | 10448 } // namespace gles2 |
| 10506 } // namespace gpu | 10449 } // namespace gpu |
| OLD | NEW |