| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 GLsizei width, | 944 GLsizei width, |
| 945 GLsizei height); | 945 GLsizei height); |
| 946 | 946 |
| 947 // Wrapper for glCopyBufferSubData. | 947 // Wrapper for glCopyBufferSubData. |
| 948 void DoCopyBufferSubData(GLenum readtarget, | 948 void DoCopyBufferSubData(GLenum readtarget, |
| 949 GLenum writetarget, | 949 GLenum writetarget, |
| 950 GLintptr readoffset, | 950 GLintptr readoffset, |
| 951 GLintptr writeoffset, | 951 GLintptr writeoffset, |
| 952 GLsizeiptr size); | 952 GLsizeiptr size); |
| 953 | 953 |
| 954 void DoCopyTextureCHROMIUM(GLuint source_id, | 954 void DoCopyTextureCHROMIUM(GLenum target, |
| 955 GLuint source_id, |
| 955 GLint source_level, | 956 GLint source_level, |
| 956 GLuint dest_id, | 957 GLuint dest_id, |
| 957 GLint dest_level, | 958 GLint dest_level, |
| 958 GLenum internal_format, | 959 GLenum internal_format, |
| 959 GLenum dest_type, | 960 GLenum dest_type, |
| 960 GLboolean unpack_flip_y, | 961 GLboolean unpack_flip_y, |
| 961 GLboolean unpack_premultiply_alpha, | 962 GLboolean unpack_premultiply_alpha, |
| 962 GLboolean unpack_unmultiply_alpha); | 963 GLboolean unpack_unmultiply_alpha); |
| 963 | 964 |
| 964 void DoCopySubTextureCHROMIUM(GLuint source_id, | 965 void DoCopySubTextureCHROMIUM(GLenum target, |
| 966 GLuint source_id, |
| 965 GLint source_level, | 967 GLint source_level, |
| 966 GLuint dest_id, | 968 GLuint dest_id, |
| 967 GLint dest_level, | 969 GLint dest_level, |
| 968 GLint xoffset, | 970 GLint xoffset, |
| 969 GLint yoffset, | 971 GLint yoffset, |
| 970 GLint x, | 972 GLint x, |
| 971 GLint y, | 973 GLint y, |
| 972 GLsizei width, | 974 GLsizei width, |
| 973 GLsizei height, | 975 GLsizei height, |
| 974 GLboolean unpack_flip_y, | 976 GLboolean unpack_flip_y, |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 GLsizei depth, | 2014 GLsizei depth, |
| 2013 GLenum format, | 2015 GLenum format, |
| 2014 GLsizei size, | 2016 GLsizei size, |
| 2015 const GLvoid* data); | 2017 const GLvoid* data); |
| 2016 bool ValidateCompressedTexSubDimensions( | 2018 bool ValidateCompressedTexSubDimensions( |
| 2017 const char* function_name, | 2019 const char* function_name, |
| 2018 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, | 2020 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, |
| 2019 GLsizei width, GLsizei height, GLsizei depth, GLenum format, | 2021 GLsizei width, GLsizei height, GLsizei depth, GLenum format, |
| 2020 Texture* texture); | 2022 Texture* texture); |
| 2021 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, | 2023 bool ValidateCopyTextureCHROMIUMTextures(const char* function_name, |
| 2024 GLenum target, |
| 2022 TextureRef* source_texture_ref, | 2025 TextureRef* source_texture_ref, |
| 2023 TextureRef* dest_texture_ref); | 2026 TextureRef* dest_texture_ref); |
| 2024 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( | 2027 CopyTextureMethod ValidateCopyTextureCHROMIUMInternalFormats( |
| 2025 const char* function_name, | 2028 const char* function_name, |
| 2026 TextureRef* source_texture_ref, | 2029 TextureRef* source_texture_ref, |
| 2027 GLint source_level, | 2030 GLint source_level, |
| 2028 GLenum dest_internal_format); | 2031 GLenum dest_internal_format); |
| 2029 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, | 2032 bool ValidateCompressedCopyTextureCHROMIUM(const char* function_name, |
| 2030 TextureRef* source_texture_ref, | 2033 TextureRef* source_texture_ref, |
| 2031 TextureRef* dest_texture_ref); | 2034 TextureRef* dest_texture_ref); |
| (...skipping 14094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16126 glIsPathNV(service_id) == GL_TRUE; | 16129 glIsPathNV(service_id) == GL_TRUE; |
| 16127 } | 16130 } |
| 16128 | 16131 |
| 16129 bool GLES2DecoderImpl::DoIsSync(GLuint client_id) { | 16132 bool GLES2DecoderImpl::DoIsSync(GLuint client_id) { |
| 16130 GLsync service_sync = 0; | 16133 GLsync service_sync = 0; |
| 16131 return group_->GetSyncServiceId(client_id, &service_sync); | 16134 return group_->GetSyncServiceId(client_id, &service_sync); |
| 16132 } | 16135 } |
| 16133 | 16136 |
| 16134 bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUMTextures( | 16137 bool GLES2DecoderImpl::ValidateCopyTextureCHROMIUMTextures( |
| 16135 const char* function_name, | 16138 const char* function_name, |
| 16139 GLenum target, |
| 16136 TextureRef* source_texture_ref, | 16140 TextureRef* source_texture_ref, |
| 16137 TextureRef* dest_texture_ref) { | 16141 TextureRef* dest_texture_ref) { |
| 16138 if (!source_texture_ref || !dest_texture_ref) { | 16142 if (!source_texture_ref || !dest_texture_ref) { |
| 16139 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); | 16143 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "unknown texture id"); |
| 16140 return false; | 16144 return false; |
| 16141 } | 16145 } |
| 16142 | 16146 |
| 16143 Texture* source_texture = source_texture_ref->texture(); | 16147 Texture* source_texture = source_texture_ref->texture(); |
| 16144 Texture* dest_texture = dest_texture_ref->texture(); | 16148 Texture* dest_texture = dest_texture_ref->texture(); |
| 16145 if (source_texture == dest_texture) { | 16149 if (source_texture == dest_texture) { |
| 16146 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 16150 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 16147 "source and destination textures are the same"); | 16151 "source and destination textures are the same"); |
| 16148 return false; | 16152 return false; |
| 16149 } | 16153 } |
| 16150 | 16154 |
| 16155 if (dest_texture->target() != |
| 16156 GLES2Util::GLFaceTargetToTextureTarget(target)) { |
| 16157 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 16158 "target should be aligned with dest target"); |
| 16159 return false; |
| 16160 } |
| 16151 switch (dest_texture->target()) { | 16161 switch (dest_texture->target()) { |
| 16152 case GL_TEXTURE_2D: | 16162 case GL_TEXTURE_2D: |
| 16163 case GL_TEXTURE_CUBE_MAP: |
| 16153 case GL_TEXTURE_RECTANGLE_ARB: | 16164 case GL_TEXTURE_RECTANGLE_ARB: |
| 16154 break; | 16165 break; |
| 16155 default: | 16166 default: |
| 16156 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, | 16167 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, |
| 16157 "invalid dest texture target binding"); | 16168 "invalid dest texture target binding"); |
| 16158 return false; | 16169 return false; |
| 16159 } | 16170 } |
| 16160 | 16171 |
| 16161 switch (source_texture->target()) { | 16172 switch (source_texture->target()) { |
| 16162 case GL_TEXTURE_2D: | 16173 case GL_TEXTURE_2D: |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16325 if (!valid_format) { | 16336 if (!valid_format) { |
| 16326 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, | 16337 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, |
| 16327 "invalid internal format"); | 16338 "invalid internal format"); |
| 16328 return false; | 16339 return false; |
| 16329 } | 16340 } |
| 16330 | 16341 |
| 16331 return true; | 16342 return true; |
| 16332 } | 16343 } |
| 16333 | 16344 |
| 16334 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( | 16345 void GLES2DecoderImpl::DoCopyTextureCHROMIUM( |
| 16346 GLenum target, |
| 16335 GLuint source_id, | 16347 GLuint source_id, |
| 16336 GLint source_level, | 16348 GLint source_level, |
| 16337 GLuint dest_id, | 16349 GLuint dest_id, |
| 16338 GLint dest_level, | 16350 GLint dest_level, |
| 16339 GLenum internal_format, | 16351 GLenum internal_format, |
| 16340 GLenum dest_type, | 16352 GLenum dest_type, |
| 16341 GLboolean unpack_flip_y, | 16353 GLboolean unpack_flip_y, |
| 16342 GLboolean unpack_premultiply_alpha, | 16354 GLboolean unpack_premultiply_alpha, |
| 16343 GLboolean unpack_unmultiply_alpha) { | 16355 GLboolean unpack_unmultiply_alpha) { |
| 16344 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); | 16356 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopyTextureCHROMIUM"); |
| 16345 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; | 16357 static const char kFunctionName[] = "glCopyTextureCHROMIUM"; |
| 16346 | 16358 |
| 16347 TextureRef* source_texture_ref = GetTexture(source_id); | 16359 TextureRef* source_texture_ref = GetTexture(source_id); |
| 16348 TextureRef* dest_texture_ref = GetTexture(dest_id); | 16360 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 16349 | 16361 |
| 16350 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, | 16362 if (!ValidateCopyTextureCHROMIUMTextures( |
| 16351 dest_texture_ref)) { | 16363 kFunctionName, target, source_texture_ref, dest_texture_ref)) { |
| 16352 return; | 16364 return; |
| 16353 } | 16365 } |
| 16354 | 16366 |
| 16355 if (source_level < 0 || dest_level < 0 || | 16367 if (source_level < 0 || dest_level < 0 || |
| 16356 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { | 16368 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { |
| 16357 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16369 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16358 "source_level or dest_level out of range"); | 16370 "source_level or dest_level out of range"); |
| 16359 return; | 16371 return; |
| 16360 } | 16372 } |
| 16361 | 16373 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16525 | 16537 |
| 16526 copy_texture_CHROMIUM_->DoCopyTexture( | 16538 copy_texture_CHROMIUM_->DoCopyTexture( |
| 16527 this, source_target, source_texture->service_id(), source_level, | 16539 this, source_target, source_texture->service_id(), source_level, |
| 16528 source_internal_format, dest_target, dest_texture->service_id(), | 16540 source_internal_format, dest_target, dest_texture->service_id(), |
| 16529 dest_level, internal_format, source_width, source_height, | 16541 dest_level, internal_format, source_width, source_height, |
| 16530 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, | 16542 unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, |
| 16531 unpack_unmultiply_alpha == GL_TRUE, method); | 16543 unpack_unmultiply_alpha == GL_TRUE, method); |
| 16532 } | 16544 } |
| 16533 | 16545 |
| 16534 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( | 16546 void GLES2DecoderImpl::DoCopySubTextureCHROMIUM( |
| 16547 GLenum target, |
| 16535 GLuint source_id, | 16548 GLuint source_id, |
| 16536 GLint source_level, | 16549 GLint source_level, |
| 16537 GLuint dest_id, | 16550 GLuint dest_id, |
| 16538 GLint dest_level, | 16551 GLint dest_level, |
| 16539 GLint xoffset, | 16552 GLint xoffset, |
| 16540 GLint yoffset, | 16553 GLint yoffset, |
| 16541 GLint x, | 16554 GLint x, |
| 16542 GLint y, | 16555 GLint y, |
| 16543 GLsizei width, | 16556 GLsizei width, |
| 16544 GLsizei height, | 16557 GLsizei height, |
| 16545 GLboolean unpack_flip_y, | 16558 GLboolean unpack_flip_y, |
| 16546 GLboolean unpack_premultiply_alpha, | 16559 GLboolean unpack_premultiply_alpha, |
| 16547 GLboolean unpack_unmultiply_alpha) { | 16560 GLboolean unpack_unmultiply_alpha) { |
| 16548 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); | 16561 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCopySubTextureCHROMIUM"); |
| 16549 | 16562 |
| 16550 static const char kFunctionName[] = "glCopySubTextureCHROMIUM"; | 16563 static const char kFunctionName[] = "glCopySubTextureCHROMIUM"; |
| 16551 TextureRef* source_texture_ref = GetTexture(source_id); | 16564 TextureRef* source_texture_ref = GetTexture(source_id); |
| 16552 TextureRef* dest_texture_ref = GetTexture(dest_id); | 16565 TextureRef* dest_texture_ref = GetTexture(dest_id); |
| 16553 | 16566 |
| 16554 if (!ValidateCopyTextureCHROMIUMTextures(kFunctionName, source_texture_ref, | 16567 if (!ValidateCopyTextureCHROMIUMTextures( |
| 16555 dest_texture_ref)) { | 16568 kFunctionName, target, source_texture_ref, dest_texture_ref)) { |
| 16556 return; | 16569 return; |
| 16557 } | 16570 } |
| 16558 | 16571 |
| 16559 if (source_level < 0 || dest_level < 0 || | 16572 if (source_level < 0 || dest_level < 0 || |
| 16560 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { | 16573 (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { |
| 16561 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 16574 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 16562 "source_level or dest_level out of range"); | 16575 "source_level or dest_level out of range"); |
| 16563 return; | 16576 return; |
| 16564 } | 16577 } |
| 16565 | 16578 |
| (...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19172 } | 19185 } |
| 19173 | 19186 |
| 19174 // Include the auto-generated part of this file. We split this because it means | 19187 // Include the auto-generated part of this file. We split this because it means |
| 19175 // we can easily edit the non-auto generated parts right here in this file | 19188 // we can easily edit the non-auto generated parts right here in this file |
| 19176 // instead of having to edit some template or the code generator. | 19189 // instead of having to edit some template or the code generator. |
| 19177 #include "base/macros.h" | 19190 #include "base/macros.h" |
| 19178 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19191 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19179 | 19192 |
| 19180 } // namespace gles2 | 19193 } // namespace gles2 |
| 19181 } // namespace gpu | 19194 } // namespace gpu |
| OLD | NEW |