OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
983 // errors caused by GL calls that it was not responsible for issuing. | 983 // errors caused by GL calls that it was not responsible for issuing. |
984 void ClearRealGLErrors(); | 984 void ClearRealGLErrors(); |
985 | 985 |
986 // Checks if the current program and vertex attributes are valid for drawing. | 986 // Checks if the current program and vertex attributes are valid for drawing. |
987 bool IsDrawValid(GLuint max_vertex_accessed); | 987 bool IsDrawValid(GLuint max_vertex_accessed); |
988 | 988 |
989 // Returns true if attrib0 was simulated. | 989 // Returns true if attrib0 was simulated. |
990 bool SimulateAttrib0(GLuint max_vertex_accessed); | 990 bool SimulateAttrib0(GLuint max_vertex_accessed); |
991 void RestoreStateForSimulatedAttrib0(); | 991 void RestoreStateForSimulatedAttrib0(); |
992 | 992 |
993 void SetBlackTextureForNonRenderableTextures( | 993 // Returns true of textures were set. |
apatrick_chromium
2010/06/02 22:20:56
of -> if
| |
994 bool* has_non_renderable_textures); | 994 bool SetBlackTextureForNonRenderableTextures(); |
995 void RestoreStateForNonRenderableTextures(); | 995 void RestoreStateForNonRenderableTextures(); |
996 | 996 |
997 // Gets the buffer id for a given target. | 997 // Gets the buffer id for a given target. |
998 BufferManager::BufferInfo* GetBufferInfoForTarget(GLenum target) { | 998 BufferManager::BufferInfo* GetBufferInfoForTarget(GLenum target) { |
999 DCHECK(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER); | 999 DCHECK(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER); |
1000 BufferManager::BufferInfo* info = target == GL_ARRAY_BUFFER ? | 1000 BufferManager::BufferInfo* info = target == GL_ARRAY_BUFFER ? |
1001 bound_array_buffer_ : bound_element_array_buffer_; | 1001 bound_array_buffer_ : bound_element_array_buffer_; |
1002 return (info && !info->IsDeleted()) ? info : NULL; | 1002 return (info && !info->IsDeleted()) ? info : NULL; |
1003 } | 1003 } |
1004 | 1004 |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1822 | 1822 |
1823 // Update the info about the offscreen saved color texture in the parent. | 1823 // Update the info about the offscreen saved color texture in the parent. |
1824 // The reference to the parent is a weak pointer and will become null if the | 1824 // The reference to the parent is a weak pointer and will become null if the |
1825 // parent is later destroyed. | 1825 // parent is later destroyed. |
1826 GLuint service_id = offscreen_saved_color_texture_->id(); | 1826 GLuint service_id = offscreen_saved_color_texture_->id(); |
1827 | 1827 |
1828 TextureManager::TextureInfo* info = | 1828 TextureManager::TextureInfo* info = |
1829 parent_->texture_manager()->GetTextureInfo(service_id); | 1829 parent_->texture_manager()->GetTextureInfo(service_id); |
1830 DCHECK(info); | 1830 DCHECK(info); |
1831 | 1831 |
1832 info->SetLevelInfo(GL_TEXTURE_2D, | 1832 texture_manager()->SetLevelInfo( |
1833 0, // level | 1833 info, |
1834 GL_RGBA, | 1834 GL_TEXTURE_2D, |
1835 pending_offscreen_size_.width(), | 1835 0, // level |
1836 pending_offscreen_size_.height(), | 1836 GL_RGBA, |
1837 1, // depth | 1837 pending_offscreen_size_.width(), |
1838 0, // border | 1838 pending_offscreen_size_.height(), |
1839 GL_RGBA, | 1839 1, // depth |
1840 GL_UNSIGNED_BYTE); | 1840 0, // border |
1841 GL_RGBA, | |
1842 GL_UNSIGNED_BYTE); | |
1841 } | 1843 } |
1842 | 1844 |
1843 return true; | 1845 return true; |
1844 } | 1846 } |
1845 | 1847 |
1846 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { | 1848 void GLES2DecoderImpl::SetSwapBuffersCallback(Callback0::Type* callback) { |
1847 swap_buffers_callback_.reset(callback); | 1849 swap_buffers_callback_.reset(callback); |
1848 } | 1850 } |
1849 | 1851 |
1850 void GLES2DecoderImpl::Destroy() { | 1852 void GLES2DecoderImpl::Destroy() { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2157 if (vertex_attrib_manager_.Enable(index, true)) { | 2159 if (vertex_attrib_manager_.Enable(index, true)) { |
2158 glEnableVertexAttribArray(index); | 2160 glEnableVertexAttribArray(index); |
2159 } else { | 2161 } else { |
2160 SetGLError(GL_INVALID_VALUE, | 2162 SetGLError(GL_INVALID_VALUE, |
2161 "glEnableVertexAttribArray: index out of range"); | 2163 "glEnableVertexAttribArray: index out of range"); |
2162 } | 2164 } |
2163 } | 2165 } |
2164 | 2166 |
2165 void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) { | 2167 void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) { |
2166 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 2168 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
2167 if (!info || !info->MarkMipmapsGenerated()) { | 2169 if (!info || !texture_manager()->MarkMipmapsGenerated(info)) { |
2168 SetGLError(GL_INVALID_OPERATION, | 2170 SetGLError(GL_INVALID_OPERATION, |
2169 "glGenerateMipmaps: Can not generate mips for npot textures"); | 2171 "glGenerateMipmaps: Can not generate mips for npot textures"); |
2170 return; | 2172 return; |
2171 } | 2173 } |
2172 glGenerateMipmapEXT(target); | 2174 glGenerateMipmapEXT(target); |
2173 } | 2175 } |
2174 | 2176 |
2175 bool GLES2DecoderImpl::GetHelper( | 2177 bool GLES2DecoderImpl::GetHelper( |
2176 GLenum pname, GLint* params, GLsizei* num_written) { | 2178 GLenum pname, GLint* params, GLsizei* num_written) { |
2177 DCHECK(num_written); | 2179 DCHECK(num_written); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2577 if (ids == NULL) { | 2579 if (ids == NULL) { |
2578 return error::kOutOfBounds; | 2580 return error::kOutOfBounds; |
2579 } | 2581 } |
2580 DoRegisterSharedIds(namespace_id, n, ids); | 2582 DoRegisterSharedIds(namespace_id, n, ids); |
2581 return error::kNoError; | 2583 return error::kNoError; |
2582 } | 2584 } |
2583 | 2585 |
2584 void GLES2DecoderImpl::DoDrawArrays( | 2586 void GLES2DecoderImpl::DoDrawArrays( |
2585 GLenum mode, GLint first, GLsizei count) { | 2587 GLenum mode, GLint first, GLsizei count) { |
2586 if (IsDrawValid(first + count - 1)) { | 2588 if (IsDrawValid(first + count - 1)) { |
2587 bool has_non_renderable_textures; | |
2588 bool simulated_attrib_0 = SimulateAttrib0(first + count - 1); | 2589 bool simulated_attrib_0 = SimulateAttrib0(first + count - 1); |
2589 SetBlackTextureForNonRenderableTextures(&has_non_renderable_textures); | 2590 bool textures_set = SetBlackTextureForNonRenderableTextures(); |
2590 glDrawArrays(mode, first, count); | 2591 glDrawArrays(mode, first, count); |
2591 if (has_non_renderable_textures) { | 2592 if (textures_set) { |
2592 RestoreStateForNonRenderableTextures(); | 2593 RestoreStateForNonRenderableTextures(); |
2593 } | 2594 } |
2594 if (simulated_attrib_0) { | 2595 if (simulated_attrib_0) { |
2595 RestoreStateForSimulatedAttrib0(); | 2596 RestoreStateForSimulatedAttrib0(); |
2596 } | 2597 } |
2597 } | 2598 } |
2598 } | 2599 } |
2599 | 2600 |
2600 void GLES2DecoderImpl::DoFramebufferRenderbuffer( | 2601 void GLES2DecoderImpl::DoFramebufferRenderbuffer( |
2601 GLenum target, GLenum attachment, GLenum renderbuffertarget, | 2602 GLenum target, GLenum attachment, GLenum renderbuffertarget, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2693 info->Reset(); | 2694 info->Reset(); |
2694 } | 2695 } |
2695 }; | 2696 }; |
2696 | 2697 |
2697 void GLES2DecoderImpl::DoTexParameterf( | 2698 void GLES2DecoderImpl::DoTexParameterf( |
2698 GLenum target, GLenum pname, GLfloat param) { | 2699 GLenum target, GLenum pname, GLfloat param) { |
2699 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 2700 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
2700 if (!info) { | 2701 if (!info) { |
2701 SetGLError(GL_INVALID_VALUE, "glTexParameterf: unknown texture"); | 2702 SetGLError(GL_INVALID_VALUE, "glTexParameterf: unknown texture"); |
2702 } else { | 2703 } else { |
2703 info->SetParameter(pname, static_cast<GLint>(param)); | 2704 texture_manager()->SetParameter(info, pname, static_cast<GLint>(param)); |
2704 glTexParameterf(target, pname, param); | 2705 glTexParameterf(target, pname, param); |
2705 } | 2706 } |
2706 } | 2707 } |
2707 | 2708 |
2708 void GLES2DecoderImpl::DoTexParameteri( | 2709 void GLES2DecoderImpl::DoTexParameteri( |
2709 GLenum target, GLenum pname, GLint param) { | 2710 GLenum target, GLenum pname, GLint param) { |
2710 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 2711 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
2711 if (!info) { | 2712 if (!info) { |
2712 SetGLError(GL_INVALID_VALUE, "glTexParameteri: unknown texture"); | 2713 SetGLError(GL_INVALID_VALUE, "glTexParameteri: unknown texture"); |
2713 } else { | 2714 } else { |
2714 info->SetParameter(pname, param); | 2715 texture_manager()->SetParameter(info, pname, param); |
2715 glTexParameteri(target, pname, param); | 2716 glTexParameteri(target, pname, param); |
2716 } | 2717 } |
2717 } | 2718 } |
2718 | 2719 |
2719 void GLES2DecoderImpl::DoTexParameterfv( | 2720 void GLES2DecoderImpl::DoTexParameterfv( |
2720 GLenum target, GLenum pname, const GLfloat* params) { | 2721 GLenum target, GLenum pname, const GLfloat* params) { |
2721 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 2722 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
2722 if (!info) { | 2723 if (!info) { |
2723 SetGLError(GL_INVALID_VALUE, "glTexParameterfv: unknown texture"); | 2724 SetGLError(GL_INVALID_VALUE, "glTexParameterfv: unknown texture"); |
2724 } else { | 2725 } else { |
2725 info->SetParameter(pname, *reinterpret_cast<const GLint*>(params)); | 2726 texture_manager()->SetParameter( |
2727 info, pname, *reinterpret_cast<const GLint*>(params)); | |
2726 glTexParameterfv(target, pname, params); | 2728 glTexParameterfv(target, pname, params); |
2727 } | 2729 } |
2728 } | 2730 } |
2729 | 2731 |
2730 void GLES2DecoderImpl::DoTexParameteriv( | 2732 void GLES2DecoderImpl::DoTexParameteriv( |
2731 GLenum target, GLenum pname, const GLint* params) { | 2733 GLenum target, GLenum pname, const GLint* params) { |
2732 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 2734 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
2733 if (!info) { | 2735 if (!info) { |
2734 SetGLError(GL_INVALID_VALUE, "glTexParameteriv: unknown texture"); | 2736 SetGLError(GL_INVALID_VALUE, "glTexParameteriv: unknown texture"); |
2735 } else { | 2737 } else { |
2736 info->SetParameter(pname, *params); | 2738 texture_manager()->SetParameter(info, pname, *params); |
2737 glTexParameteriv(target, pname, params); | 2739 glTexParameteriv(target, pname, params); |
2738 } | 2740 } |
2739 } | 2741 } |
2740 | 2742 |
2741 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { | 2743 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { |
2742 if (!current_program_ || current_program_->IsDeleted()) { | 2744 if (!current_program_ || current_program_->IsDeleted()) { |
2743 // The program does not exist. | 2745 // The program does not exist. |
2744 SetGLError(GL_INVALID_OPERATION, | 2746 SetGLError(GL_INVALID_OPERATION, |
2745 (std::string(function_name) + ": no program in use").c_str()); | 2747 (std::string(function_name) + ": no program in use").c_str()); |
2746 return false; | 2748 return false; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2916 } | 2918 } |
2917 } | 2919 } |
2918 | 2920 |
2919 void GLES2DecoderImpl::ClearRealGLErrors() { | 2921 void GLES2DecoderImpl::ClearRealGLErrors() { |
2920 GLenum error; | 2922 GLenum error; |
2921 while ((error = glGetError()) != GL_NO_ERROR) { | 2923 while ((error = glGetError()) != GL_NO_ERROR) { |
2922 NOTREACHED() << "GL error " << error << " was unhandled."; | 2924 NOTREACHED() << "GL error " << error << " was unhandled."; |
2923 } | 2925 } |
2924 } | 2926 } |
2925 | 2927 |
2926 void GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures( | 2928 bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() { |
2927 bool* has_non_renderable_textures) { | |
2928 DCHECK(has_non_renderable_textures); | |
2929 DCHECK(current_program_); | 2929 DCHECK(current_program_); |
2930 DCHECK(!current_program_->IsDeleted()); | 2930 DCHECK(!current_program_->IsDeleted()); |
2931 *has_non_renderable_textures = false; | 2931 // Only check if there are some unrenderable textures. |
2932 if (!texture_manager()->HaveUnrenderableTextures()) { | |
2933 return false; | |
2934 } | |
2935 bool textures_set = false; | |
2932 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = | 2936 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = |
2933 current_program_->sampler_indices(); | 2937 current_program_->sampler_indices(); |
2934 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 2938 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
2935 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = | 2939 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = |
2936 current_program_->GetUniformInfo(sampler_indices[ii]); | 2940 current_program_->GetUniformInfo(sampler_indices[ii]); |
2937 DCHECK(uniform_info); | 2941 DCHECK(uniform_info); |
2938 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { | 2942 for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { |
2939 GLuint texture_unit_index = uniform_info->texture_units[jj]; | 2943 GLuint texture_unit_index = uniform_info->texture_units[jj]; |
2940 if (texture_unit_index < group_->max_texture_units()) { | 2944 if (texture_unit_index < group_->max_texture_units()) { |
2941 TextureUnit& texture_unit = texture_units_[texture_unit_index]; | 2945 TextureUnit& texture_unit = texture_units_[texture_unit_index]; |
2942 TextureManager::TextureInfo* texture_info = | 2946 TextureManager::TextureInfo* texture_info = |
2943 uniform_info->type == GL_SAMPLER_2D ? | 2947 uniform_info->type == GL_SAMPLER_2D ? |
2944 texture_unit.bound_texture_2d : | 2948 texture_unit.bound_texture_2d : |
2945 texture_unit.bound_texture_cube_map; | 2949 texture_unit.bound_texture_cube_map; |
2946 if (!texture_info || !texture_info->CanRender()) { | 2950 if (!texture_info || !texture_info->CanRender()) { |
2947 *has_non_renderable_textures = true; | 2951 textures_set = true; |
2948 glActiveTexture(GL_TEXTURE0 + texture_unit_index); | 2952 glActiveTexture(GL_TEXTURE0 + texture_unit_index); |
2949 glBindTexture( | 2953 glBindTexture( |
2950 uniform_info->type == GL_SAMPLER_2D ? GL_TEXTURE_2D : | 2954 uniform_info->type == GL_SAMPLER_2D ? GL_TEXTURE_2D : |
2951 GL_TEXTURE_CUBE_MAP, | 2955 GL_TEXTURE_CUBE_MAP, |
2952 uniform_info->type == GL_SAMPLER_2D ? black_2d_texture_id_ : | 2956 uniform_info->type == GL_SAMPLER_2D ? black_2d_texture_id_ : |
2953 black_cube_texture_id_); | 2957 black_cube_texture_id_); |
2954 } | 2958 } |
2955 } | 2959 } |
2956 // else: should this be an error? | 2960 // else: should this be an error? |
2957 } | 2961 } |
2958 } | 2962 } |
2963 return textures_set; | |
2959 } | 2964 } |
2960 | 2965 |
2961 void GLES2DecoderImpl::RestoreStateForNonRenderableTextures() { | 2966 void GLES2DecoderImpl::RestoreStateForNonRenderableTextures() { |
2962 DCHECK(current_program_); | 2967 DCHECK(current_program_); |
2963 DCHECK(!current_program_->IsDeleted()); | 2968 DCHECK(!current_program_->IsDeleted()); |
2964 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = | 2969 const ProgramManager::ProgramInfo::SamplerIndices& sampler_indices = |
2965 current_program_->sampler_indices(); | 2970 current_program_->sampler_indices(); |
2966 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { | 2971 for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { |
2967 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = | 2972 const ProgramManager::ProgramInfo::UniformInfo* uniform_info = |
2968 current_program_->GetUniformInfo(sampler_indices[ii]); | 2973 current_program_->GetUniformInfo(sampler_indices[ii]); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3119 | 3124 |
3120 GLuint max_vertex_accessed; | 3125 GLuint max_vertex_accessed; |
3121 if (!bound_element_array_buffer_->GetMaxValueForRange( | 3126 if (!bound_element_array_buffer_->GetMaxValueForRange( |
3122 offset, count, type, &max_vertex_accessed)) { | 3127 offset, count, type, &max_vertex_accessed)) { |
3123 SetGLError(GL_INVALID_OPERATION, | 3128 SetGLError(GL_INVALID_OPERATION, |
3124 "glDrawElements: range out of bounds for buffer"); | 3129 "glDrawElements: range out of bounds for buffer"); |
3125 return error::kNoError; | 3130 return error::kNoError; |
3126 } | 3131 } |
3127 | 3132 |
3128 if (IsDrawValid(max_vertex_accessed)) { | 3133 if (IsDrawValid(max_vertex_accessed)) { |
3129 bool has_non_renderable_textures; | |
3130 bool simulated_attrib_0 = SimulateAttrib0(max_vertex_accessed); | 3134 bool simulated_attrib_0 = SimulateAttrib0(max_vertex_accessed); |
3131 SetBlackTextureForNonRenderableTextures( | 3135 bool textures_set = SetBlackTextureForNonRenderableTextures(); |
3132 &has_non_renderable_textures); | |
3133 const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); | 3136 const GLvoid* indices = reinterpret_cast<const GLvoid*>(offset); |
3134 glDrawElements(mode, count, type, indices); | 3137 glDrawElements(mode, count, type, indices); |
3135 if (has_non_renderable_textures) { | 3138 if (textures_set) { |
3136 RestoreStateForNonRenderableTextures(); | 3139 RestoreStateForNonRenderableTextures(); |
3137 } | 3140 } |
3138 if (simulated_attrib_0) { | 3141 if (simulated_attrib_0) { |
3139 RestoreStateForSimulatedAttrib0(); | 3142 RestoreStateForSimulatedAttrib0(); |
3140 } | 3143 } |
3141 } | 3144 } |
3142 return error::kNoError; | 3145 return error::kNoError; |
3143 } | 3146 } |
3144 | 3147 |
3145 GLuint GLES2DecoderImpl::DoGetMaxValueInBuffer( | 3148 GLuint GLES2DecoderImpl::DoGetMaxValueInBuffer( |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4107 SetGLError(GL_INVALID_VALUE, | 4110 SetGLError(GL_INVALID_VALUE, |
4108 "glCompressedTexImage2D: unknown texture target"); | 4111 "glCompressedTexImage2D: unknown texture target"); |
4109 return error::kNoError; | 4112 return error::kNoError; |
4110 } | 4113 } |
4111 scoped_array<int8> zero; | 4114 scoped_array<int8> zero; |
4112 if (!data) { | 4115 if (!data) { |
4113 zero.reset(new int8[image_size]); | 4116 zero.reset(new int8[image_size]); |
4114 memset(zero.get(), 0, image_size); | 4117 memset(zero.get(), 0, image_size); |
4115 data = zero.get(); | 4118 data = zero.get(); |
4116 } | 4119 } |
4117 info->SetLevelInfo( | 4120 texture_manager()->SetLevelInfo( |
4118 target, level, internal_format, width, height, 1, border, 0, 0); | 4121 info, target, level, internal_format, width, height, 1, border, 0, 0); |
4119 glCompressedTexImage2D( | 4122 glCompressedTexImage2D( |
4120 target, level, internal_format, width, height, border, image_size, data); | 4123 target, level, internal_format, width, height, border, image_size, data); |
4121 return error::kNoError; | 4124 return error::kNoError; |
4122 } | 4125 } |
4123 | 4126 |
4124 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( | 4127 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( |
4125 uint32 immediate_data_size, const gles2::CompressedTexImage2D& c) { | 4128 uint32 immediate_data_size, const gles2::CompressedTexImage2D& c) { |
4126 GLenum target = static_cast<GLenum>(c.target); | 4129 GLenum target = static_cast<GLenum>(c.target); |
4127 GLint level = static_cast<GLint>(c.level); | 4130 GLint level = static_cast<GLint>(c.level); |
4128 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 4131 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4250 SetGLError(GL_INVALID_OPERATION, | 4253 SetGLError(GL_INVALID_OPERATION, |
4251 "glTexImage2D: unknown texture for target"); | 4254 "glTexImage2D: unknown texture for target"); |
4252 return error::kNoError; | 4255 return error::kNoError; |
4253 } | 4256 } |
4254 scoped_array<int8> zero; | 4257 scoped_array<int8> zero; |
4255 if (!pixels) { | 4258 if (!pixels) { |
4256 zero.reset(new int8[pixels_size]); | 4259 zero.reset(new int8[pixels_size]); |
4257 memset(zero.get(), 0, pixels_size); | 4260 memset(zero.get(), 0, pixels_size); |
4258 pixels = zero.get(); | 4261 pixels = zero.get(); |
4259 } | 4262 } |
4260 info->SetLevelInfo( | 4263 texture_manager()->SetLevelInfo(info, |
4261 target, level, internal_format, width, height, 1, border, format, type); | 4264 target, level, internal_format, width, height, 1, border, format, type); |
4262 glTexImage2D( | 4265 glTexImage2D( |
4263 target, level, internal_format, width, height, border, format, type, | 4266 target, level, internal_format, width, height, border, format, type, |
4264 pixels); | 4267 pixels); |
4265 return error::kNoError; | 4268 return error::kNoError; |
4266 } | 4269 } |
4267 | 4270 |
4268 error::Error GLES2DecoderImpl::HandleTexImage2D( | 4271 error::Error GLES2DecoderImpl::HandleTexImage2D( |
4269 uint32 immediate_data_size, const gles2::TexImage2D& c) { | 4272 uint32 immediate_data_size, const gles2::TexImage2D& c) { |
4270 GLenum target = static_cast<GLenum>(c.target); | 4273 GLenum target = static_cast<GLenum>(c.target); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4710 return error::kNoError; | 4713 return error::kNoError; |
4711 } | 4714 } |
4712 | 4715 |
4713 // Include the auto-generated part of this file. We split this because it means | 4716 // Include the auto-generated part of this file. We split this because it means |
4714 // we can easily edit the non-auto generated parts right here in this file | 4717 // we can easily edit the non-auto generated parts right here in this file |
4715 // instead of having to edit some template or the code generator. | 4718 // instead of having to edit some template or the code generator. |
4716 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 4719 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
4717 | 4720 |
4718 } // namespace gles2 | 4721 } // namespace gles2 |
4719 } // namespace gpu | 4722 } // namespace gpu |
OLD | NEW |