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> |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
16 #include "base/atomicops.h" | 16 #include "base/atomicops.h" |
17 #include "base/bind.h" | 17 #include "base/bind.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/debug/trace_event.h" | 19 #include "base/debug/trace_event.h" |
20 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
21 #include "base/mac/scoped_cftyperef.h" | 21 #include "base/mac/scoped_cftyperef.h" |
22 #endif | 22 #endif |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/memory/weak_ptr.h" | |
25 #include "base/string_number_conversions.h" | 24 #include "base/string_number_conversions.h" |
26 #include "build/build_config.h" | 25 #include "build/build_config.h" |
27 #define GLES2_GPU_SERVICE 1 | 26 #define GLES2_GPU_SERVICE 1 |
28 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
29 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 28 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
30 #include "gpu/command_buffer/common/id_allocator.h" | 29 #include "gpu/command_buffer/common/id_allocator.h" |
31 #include "gpu/command_buffer/service/buffer_manager.h" | 30 #include "gpu/command_buffer/service/buffer_manager.h" |
32 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 31 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
33 #include "gpu/command_buffer/service/context_group.h" | 32 #include "gpu/command_buffer/service/context_group.h" |
34 #include "gpu/command_buffer/service/feature_info.h" | 33 #include "gpu/command_buffer/service/feature_info.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 #if defined(OS_WIN) | 450 #if defined(OS_WIN) |
452 return testing_force_is_angle_ || | 451 return testing_force_is_angle_ || |
453 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2; | 452 gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2; |
454 #else | 453 #else |
455 return testing_force_is_angle_; | 454 return testing_force_is_angle_; |
456 #endif | 455 #endif |
457 } | 456 } |
458 | 457 |
459 // This class implements GLES2Decoder so we don't have to expose all the GLES2 | 458 // This class implements GLES2Decoder so we don't have to expose all the GLES2 |
460 // cmd stuff to outside this class. | 459 // cmd stuff to outside this class. |
461 class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, | 460 class GLES2DecoderImpl : public GLES2Decoder { |
462 public GLES2Decoder { | |
463 public: | 461 public: |
464 static const int kMaxLogMessages = 256; | 462 static const int kMaxLogMessages = 256; |
465 | 463 |
466 explicit GLES2DecoderImpl(ContextGroup* group); | 464 explicit GLES2DecoderImpl(ContextGroup* group); |
467 ~GLES2DecoderImpl(); | 465 ~GLES2DecoderImpl(); |
468 | 466 |
469 // Overridden from AsyncAPIInterface. | 467 // Overridden from AsyncAPIInterface. |
470 virtual Error DoCommand(unsigned int command, | 468 virtual Error DoCommand(unsigned int command, |
471 unsigned int arg_count, | 469 unsigned int arg_count, |
472 const void* args); | 470 const void* args); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 // Wrapper for TexSubImage2D. | 722 // Wrapper for TexSubImage2D. |
725 void DoTexSubImage2D( | 723 void DoTexSubImage2D( |
726 GLenum target, | 724 GLenum target, |
727 GLint level, | 725 GLint level, |
728 GLint xoffset, | 726 GLint xoffset, |
729 GLint yoffset, | 727 GLint yoffset, |
730 GLsizei width, | 728 GLsizei width, |
731 GLsizei height, | 729 GLsizei height, |
732 GLenum format, | 730 GLenum format, |
733 GLenum type, | 731 GLenum type, |
734 const void * data); | 732 const void* pixels, |
733 uint32 pixels_size); | |
735 | 734 |
736 // Wrapper for TexImageIOSurface2DCHROMIUM. | 735 // Wrapper for TexImageIOSurface2DCHROMIUM. |
737 void DoTexImageIOSurface2DCHROMIUM( | 736 void DoTexImageIOSurface2DCHROMIUM( |
738 GLenum target, | 737 GLenum target, |
739 GLsizei width, | 738 GLsizei width, |
740 GLsizei height, | 739 GLsizei height, |
741 GLuint io_surface_id, | 740 GLuint io_surface_id, |
742 GLuint plane); | 741 GLuint plane); |
743 | 742 |
744 void DoCopyTextureCHROMIUM( | 743 void DoCopyTextureCHROMIUM( |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1210 // cases (primcount is 0 for non-instanced). | 1209 // cases (primcount is 0 for non-instanced). |
1211 error::Error DoDrawArrays( | 1210 error::Error DoDrawArrays( |
1212 bool instanced, GLenum mode, GLint first, GLsizei count, | 1211 bool instanced, GLenum mode, GLint first, GLsizei count, |
1213 GLsizei primcount); | 1212 GLsizei primcount); |
1214 error::Error DoDrawElements( | 1213 error::Error DoDrawElements( |
1215 bool instanced, GLenum mode, GLsizei count, GLenum type, | 1214 bool instanced, GLenum mode, GLsizei count, GLenum type, |
1216 int32 offset, GLsizei primcount); | 1215 int32 offset, GLsizei primcount); |
1217 | 1216 |
1218 // Gets the buffer id for a given target. | 1217 // Gets the buffer id for a given target. |
1219 BufferManager::BufferInfo* GetBufferInfoForTarget(GLenum target) { | 1218 BufferManager::BufferInfo* GetBufferInfoForTarget(GLenum target) { |
1220 DCHECK(target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER); | 1219 BufferManager::BufferInfo* info = NULL; |
1221 BufferManager::BufferInfo* info = target == GL_ARRAY_BUFFER ? | 1220 switch(target) { |
1222 bound_array_buffer_ : bound_element_array_buffer_; | 1221 case GL_ARRAY_BUFFER: |
1222 info = bound_array_buffer_; | |
1223 break; | |
1224 case GL_ELEMENT_ARRAY_BUFFER: | |
1225 info = bound_element_array_buffer_; | |
1226 break; | |
1227 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM: | |
1228 info = bound_pixel_pack_transfer_buffer_; | |
1229 break; | |
1230 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: | |
1231 info = bound_pixel_unpack_transfer_buffer_; | |
1232 break; | |
1233 default: | |
1234 NOTREACHED(); | |
1235 return NULL; | |
1236 } | |
1223 return info; | 1237 return info; |
1224 } | 1238 } |
1225 | 1239 |
1226 // Gets the texture id for a given target. | 1240 // Gets the texture id for a given target. |
1227 TextureManager::TextureInfo* GetTextureInfoForTarget(GLenum target) { | 1241 TextureManager::TextureInfo* GetTextureInfoForTarget(GLenum target) { |
1228 TextureUnit& unit = texture_units_[active_texture_unit_]; | 1242 TextureUnit& unit = texture_units_[active_texture_unit_]; |
1229 TextureManager::TextureInfo* info = NULL; | 1243 TextureManager::TextureInfo* info = NULL; |
1230 switch (target) { | 1244 switch (target) { |
1231 case GL_TEXTURE_2D: | 1245 case GL_TEXTURE_2D: |
1232 info = unit.bound_texture_2d; | 1246 info = unit.bound_texture_2d; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1341 | 1355 |
1342 // The GL context this decoder renders to on behalf of the client. | 1356 // The GL context this decoder renders to on behalf of the client. |
1343 scoped_refptr<gfx::GLSurface> surface_; | 1357 scoped_refptr<gfx::GLSurface> surface_; |
1344 scoped_refptr<gfx::GLContext> context_; | 1358 scoped_refptr<gfx::GLContext> context_; |
1345 | 1359 |
1346 // The ContextGroup for this decoder uses to track resources. | 1360 // The ContextGroup for this decoder uses to track resources. |
1347 ContextGroup::Ref group_; | 1361 ContextGroup::Ref group_; |
1348 | 1362 |
1349 // A parent decoder can access this decoders saved offscreen frame buffer. | 1363 // A parent decoder can access this decoders saved offscreen frame buffer. |
1350 // The parent pointer is reset if the parent is destroyed. | 1364 // The parent pointer is reset if the parent is destroyed. |
1351 base::WeakPtr<GLES2DecoderImpl> parent_; | 1365 base::WeakPtr<CommonDecoder> parent_; |
1352 | 1366 |
1353 // Current width and height of the offscreen frame buffer. | 1367 // Current width and height of the offscreen frame buffer. |
1354 gfx::Size offscreen_size_; | 1368 gfx::Size offscreen_size_; |
1355 | 1369 |
1356 // Current GL error bits. | 1370 // Current GL error bits. |
1357 uint32 error_bits_; | 1371 uint32 error_bits_; |
1358 | 1372 |
1359 // Util to help with GL. | 1373 // Util to help with GL. |
1360 GLES2Util util_; | 1374 GLES2Util util_; |
1361 | 1375 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1532 typedef std::vector<GLES2DecoderImpl*> ChildList; | 1546 typedef std::vector<GLES2DecoderImpl*> ChildList; |
1533 ChildList children_; | 1547 ChildList children_; |
1534 | 1548 |
1535 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; | 1549 scoped_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
1536 | 1550 |
1537 // Cached values of the currently assigned viewport dimensions. | 1551 // Cached values of the currently assigned viewport dimensions. |
1538 GLint viewport_x_, viewport_y_; | 1552 GLint viewport_x_, viewport_y_; |
1539 GLsizei viewport_width_, viewport_height_; | 1553 GLsizei viewport_width_, viewport_height_; |
1540 GLsizei viewport_max_width_, viewport_max_height_; | 1554 GLsizei viewport_max_width_, viewport_max_height_; |
1541 | 1555 |
1556 // The currently bound pixel pack transfer buffer. | |
1557 BufferManager::BufferInfo::Ref bound_pixel_pack_transfer_buffer_; | |
1558 | |
1559 // The currently bound pixel unpack transfer buffer. | |
1560 BufferManager::BufferInfo::Ref bound_pixel_unpack_transfer_buffer_; | |
1561 | |
1542 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); | 1562 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
1543 }; | 1563 }; |
1544 | 1564 |
1545 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder) | 1565 ScopedGLErrorSuppressor::ScopedGLErrorSuppressor(GLES2DecoderImpl* decoder) |
1546 : decoder_(decoder) { | 1566 : decoder_(decoder) { |
1547 decoder_->CopyRealGLErrorsToWrapper(); | 1567 decoder_->CopyRealGLErrorsToWrapper(); |
1548 } | 1568 } |
1549 | 1569 |
1550 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { | 1570 ScopedGLErrorSuppressor::~ScopedGLErrorSuppressor() { |
1551 decoder_->ClearRealGLErrors(); | 1571 decoder_->ClearRealGLErrors(); |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2382 for (GLsizei ii = 0; ii < n; ++ii) { | 2402 for (GLsizei ii = 0; ii < n; ++ii) { |
2383 BufferManager::BufferInfo* buffer = GetBufferInfo(client_ids[ii]); | 2403 BufferManager::BufferInfo* buffer = GetBufferInfo(client_ids[ii]); |
2384 if (buffer && !buffer->IsDeleted()) { | 2404 if (buffer && !buffer->IsDeleted()) { |
2385 vertex_attrib_manager_->Unbind(buffer); | 2405 vertex_attrib_manager_->Unbind(buffer); |
2386 if (bound_array_buffer_ == buffer) { | 2406 if (bound_array_buffer_ == buffer) { |
2387 bound_array_buffer_ = NULL; | 2407 bound_array_buffer_ = NULL; |
2388 } | 2408 } |
2389 if (bound_element_array_buffer_ == buffer) { | 2409 if (bound_element_array_buffer_ == buffer) { |
2390 bound_element_array_buffer_ = NULL; | 2410 bound_element_array_buffer_ = NULL; |
2391 } | 2411 } |
2412 if (bound_pixel_pack_transfer_buffer_ == buffer) { | |
2413 bound_pixel_pack_transfer_buffer_ = NULL; | |
2414 } | |
2415 if (bound_pixel_unpack_transfer_buffer_ == buffer) { | |
2416 bound_pixel_unpack_transfer_buffer_ = NULL; | |
2417 } | |
2392 RemoveBufferInfo(client_ids[ii]); | 2418 RemoveBufferInfo(client_ids[ii]); |
2393 } | 2419 } |
2394 } | 2420 } |
2395 } | 2421 } |
2396 | 2422 |
2397 void GLES2DecoderImpl::DeleteFramebuffersHelper( | 2423 void GLES2DecoderImpl::DeleteFramebuffersHelper( |
2398 GLsizei n, const GLuint* client_ids) { | 2424 GLsizei n, const GLuint* client_ids) { |
2399 bool supports_seperate_framebuffer_binds = | 2425 bool supports_seperate_framebuffer_binds = |
2400 feature_info_->feature_flags().chromium_framebuffer_multisample; | 2426 feature_info_->feature_flags().chromium_framebuffer_multisample; |
2401 | 2427 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2665 return framebuffer->GetColorAttachmentFormat(); | 2691 return framebuffer->GetColorAttachmentFormat(); |
2666 } else if (offscreen_target_frame_buffer_.get()) { | 2692 } else if (offscreen_target_frame_buffer_.get()) { |
2667 return offscreen_target_color_format_; | 2693 return offscreen_target_color_format_; |
2668 } else { | 2694 } else { |
2669 return back_buffer_color_format_; | 2695 return back_buffer_color_format_; |
2670 } | 2696 } |
2671 } | 2697 } |
2672 | 2698 |
2673 void GLES2DecoderImpl::UpdateParentTextureInfo() { | 2699 void GLES2DecoderImpl::UpdateParentTextureInfo() { |
2674 if (parent_) { | 2700 if (parent_) { |
2701 GLES2DecoderImpl* parent_impl = static_cast<GLES2DecoderImpl*>( | |
2702 parent_.get()); | |
2675 // Update the info about the offscreen saved color texture in the parent. | 2703 // Update the info about the offscreen saved color texture in the parent. |
2676 // The reference to the parent is a weak pointer and will become null if the | 2704 // The reference to the parent is a weak pointer and will become null if the |
2677 // parent is later destroyed. | 2705 // parent is later destroyed. |
2678 TextureManager* parent_texture_manager = parent_->texture_manager(); | 2706 TextureManager* parent_texture_manager = parent_impl->texture_manager(); |
2679 parent_texture_manager->SetLevelInfo( | 2707 parent_texture_manager->SetLevelInfo( |
2680 offscreen_saved_color_texture_info_, | 2708 offscreen_saved_color_texture_info_, |
2681 GL_TEXTURE_2D, | 2709 GL_TEXTURE_2D, |
2682 0, // level | 2710 0, // level |
2683 GL_RGBA, | 2711 GL_RGBA, |
2684 offscreen_size_.width(), | 2712 offscreen_size_.width(), |
2685 offscreen_size_.height(), | 2713 offscreen_size_.height(), |
2686 1, // depth | 2714 1, // depth |
2687 0, // border | 2715 0, // border |
2688 GL_RGBA, | 2716 GL_RGBA, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2740 for (ChildList::iterator it = children.begin(); it != children.end(); ++it) | 2768 for (ChildList::iterator it = children.begin(); it != children.end(); ++it) |
2741 (*it)->SetParent(NULL, 0); | 2769 (*it)->SetParent(NULL, 0); |
2742 DCHECK(children_.empty()); | 2770 DCHECK(children_.empty()); |
2743 SetParent(NULL, 0); | 2771 SetParent(NULL, 0); |
2744 | 2772 |
2745 // Unbind everything. | 2773 // Unbind everything. |
2746 vertex_attrib_manager_.reset(); | 2774 vertex_attrib_manager_.reset(); |
2747 texture_units_.reset(); | 2775 texture_units_.reset(); |
2748 bound_array_buffer_ = NULL; | 2776 bound_array_buffer_ = NULL; |
2749 bound_element_array_buffer_ = NULL; | 2777 bound_element_array_buffer_ = NULL; |
2778 bound_pixel_pack_transfer_buffer_ = NULL; | |
2779 bound_pixel_unpack_transfer_buffer_ = NULL; | |
2750 current_query_ = NULL; | 2780 current_query_ = NULL; |
2751 current_program_ = NULL; | 2781 current_program_ = NULL; |
2752 bound_read_framebuffer_ = NULL; | 2782 bound_read_framebuffer_ = NULL; |
2753 bound_draw_framebuffer_ = NULL; | 2783 bound_draw_framebuffer_ = NULL; |
2754 bound_renderbuffer_ = NULL; | 2784 bound_renderbuffer_ = NULL; |
2755 | 2785 |
2756 if (have_context) { | 2786 if (have_context) { |
2757 if (copy_texture_CHROMIUM_.get()) { | 2787 if (copy_texture_CHROMIUM_.get()) { |
2758 copy_texture_CHROMIUM_->Destroy(); | 2788 copy_texture_CHROMIUM_->Destroy(); |
2759 copy_texture_CHROMIUM_.reset(); | 2789 copy_texture_CHROMIUM_.reset(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2855 | 2885 |
2856 bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent, | 2886 bool GLES2DecoderImpl::SetParent(GLES2Decoder* new_parent, |
2857 uint32 new_parent_texture_id) { | 2887 uint32 new_parent_texture_id) { |
2858 if (!offscreen_saved_color_texture_.get()) | 2888 if (!offscreen_saved_color_texture_.get()) |
2859 return false; | 2889 return false; |
2860 | 2890 |
2861 // Remove the saved frame buffer mapping from the parent decoder. The | 2891 // Remove the saved frame buffer mapping from the parent decoder. The |
2862 // parent pointer is a weak pointer so it will be null if the parent has | 2892 // parent pointer is a weak pointer so it will be null if the parent has |
2863 // already been destroyed. | 2893 // already been destroyed. |
2864 if (parent_) { | 2894 if (parent_) { |
2895 GLES2DecoderImpl* parent_impl = static_cast<GLES2DecoderImpl*>( | |
2896 parent_.get()); | |
2865 ChildList::iterator it = std::find( | 2897 ChildList::iterator it = std::find( |
2866 parent_->children_.begin(), | 2898 parent_impl->children_.begin(), |
2867 parent_->children_.end(), | 2899 parent_impl->children_.end(), |
2868 this); | 2900 this); |
2869 DCHECK(it != parent_->children_.end()); | 2901 DCHECK(it != parent_impl->children_.end()); |
2870 parent_->children_.erase(it); | 2902 parent_impl->children_.erase(it); |
2871 // First check the texture has been mapped into the parent. This might not | 2903 // First check the texture has been mapped into the parent. This might not |
2872 // be the case if initialization failed midway through. | 2904 // be the case if initialization failed midway through. |
2873 GLuint service_id = offscreen_saved_color_texture_->id(); | 2905 GLuint service_id = offscreen_saved_color_texture_->id(); |
2874 GLuint client_id = 0; | 2906 GLuint client_id = 0; |
2875 if (parent_->texture_manager()->GetClientId(service_id, &client_id)) { | 2907 if (parent_impl->texture_manager()->GetClientId(service_id, &client_id)) { |
2876 parent_->texture_manager()->RemoveTextureInfo(client_id); | 2908 parent_impl->texture_manager()->RemoveTextureInfo(client_id); |
2877 } | 2909 } |
2878 } | 2910 } |
2879 | 2911 |
2880 GLES2DecoderImpl* new_parent_impl = static_cast<GLES2DecoderImpl*>( | 2912 GLES2DecoderImpl* new_parent_impl = static_cast<GLES2DecoderImpl*>( |
2881 new_parent); | 2913 new_parent); |
2882 if (new_parent_impl) { | 2914 if (new_parent_impl) { |
2883 #ifndef NDEBUG | 2915 #ifndef NDEBUG |
2884 ChildList::iterator it = std::find( | 2916 ChildList::iterator it = std::find( |
2885 new_parent_impl->children_.begin(), | 2917 new_parent_impl->children_.begin(), |
2886 new_parent_impl->children_.end(), | 2918 new_parent_impl->children_.end(), |
(...skipping 10 matching lines...) Expand all Loading... | |
2897 new_parent_texture_id)) | 2929 new_parent_texture_id)) |
2898 new_parent_impl->texture_manager()->RemoveTextureInfo( | 2930 new_parent_impl->texture_manager()->RemoveTextureInfo( |
2899 new_parent_texture_id); | 2931 new_parent_texture_id); |
2900 | 2932 |
2901 offscreen_saved_color_texture_info_ = | 2933 offscreen_saved_color_texture_info_ = |
2902 new_parent_impl->CreateTextureInfo(new_parent_texture_id, service_id); | 2934 new_parent_impl->CreateTextureInfo(new_parent_texture_id, service_id); |
2903 offscreen_saved_color_texture_info_->SetNotOwned(); | 2935 offscreen_saved_color_texture_info_->SetNotOwned(); |
2904 new_parent_impl->texture_manager()-> | 2936 new_parent_impl->texture_manager()-> |
2905 SetInfoTarget(offscreen_saved_color_texture_info_, GL_TEXTURE_2D); | 2937 SetInfoTarget(offscreen_saved_color_texture_info_, GL_TEXTURE_2D); |
2906 | 2938 |
2907 parent_ = new_parent_impl->AsWeakPtr(); | 2939 parent_ = new_parent->AsWeakPtr(); |
2908 | 2940 |
2909 UpdateParentTextureInfo(); | 2941 UpdateParentTextureInfo(); |
2910 } else { | 2942 } else { |
2911 parent_.reset(); | 2943 parent_.reset(); |
2912 offscreen_saved_color_texture_info_ = NULL; | 2944 offscreen_saved_color_texture_info_ = NULL; |
2913 } | 2945 } |
2914 | 2946 |
2915 return true; | 2947 return true; |
2916 } | 2948 } |
2917 | 2949 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3228 if (!buffer_manager()->SetTarget(info, target)) { | 3260 if (!buffer_manager()->SetTarget(info, target)) { |
3229 SetGLError(GL_INVALID_OPERATION, | 3261 SetGLError(GL_INVALID_OPERATION, |
3230 "glBindBuffer: buffer bound to more than 1 target"); | 3262 "glBindBuffer: buffer bound to more than 1 target"); |
3231 return; | 3263 return; |
3232 } | 3264 } |
3233 service_id = info->service_id(); | 3265 service_id = info->service_id(); |
3234 } | 3266 } |
3235 switch (target) { | 3267 switch (target) { |
3236 case GL_ARRAY_BUFFER: | 3268 case GL_ARRAY_BUFFER: |
3237 bound_array_buffer_ = info; | 3269 bound_array_buffer_ = info; |
3270 glBindBuffer(target, service_id); | |
3238 break; | 3271 break; |
3239 case GL_ELEMENT_ARRAY_BUFFER: | 3272 case GL_ELEMENT_ARRAY_BUFFER: |
3240 bound_element_array_buffer_ = info; | 3273 bound_element_array_buffer_ = info; |
3274 glBindBuffer(target, service_id); | |
3275 break; | |
3276 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM: | |
3277 bound_pixel_pack_transfer_buffer_ = info; | |
3278 break; | |
3279 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: | |
3280 bound_pixel_unpack_transfer_buffer_ = info; | |
3241 break; | 3281 break; |
3242 default: | 3282 default: |
3243 NOTREACHED(); // Validation should prevent us getting here. | 3283 NOTREACHED(); // Validation should prevent us getting here. |
3244 break; | 3284 break; |
3245 } | 3285 } |
3246 glBindBuffer(target, service_id); | |
3247 } | 3286 } |
3248 | 3287 |
3249 bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() { | 3288 bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() { |
3250 return (GLES2Util::GetChannelsForFormat( | 3289 return (GLES2Util::GetChannelsForFormat( |
3251 GetBoundDrawFrameBufferInternalFormat()) & 0x0008) != 0; | 3290 GetBoundDrawFrameBufferInternalFormat()) & 0x0008) != 0; |
3252 } | 3291 } |
3253 | 3292 |
3254 bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() { | 3293 bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() { |
3255 FramebufferManager::FramebufferInfo* framebuffer = | 3294 FramebufferManager::FramebufferInfo* framebuffer = |
3256 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); | 3295 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3696 GLuint client_id = 0; | 3735 GLuint client_id = 0; |
3697 buffer_manager()->GetClientId( | 3736 buffer_manager()->GetClientId( |
3698 bound_element_array_buffer_->service_id(), | 3737 bound_element_array_buffer_->service_id(), |
3699 &client_id); | 3738 &client_id); |
3700 *params = client_id; | 3739 *params = client_id; |
3701 } else { | 3740 } else { |
3702 *params = 0; | 3741 *params = 0; |
3703 } | 3742 } |
3704 } | 3743 } |
3705 return true; | 3744 return true; |
3745 case GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM: | |
3746 *num_written = 1; | |
3747 if (params) { | |
3748 if (bound_pixel_pack_transfer_buffer_) { | |
3749 GLuint client_id = 0; | |
3750 buffer_manager()->GetClientId( | |
3751 bound_pixel_pack_transfer_buffer_->service_id(), | |
3752 &client_id); | |
3753 *params = client_id; | |
3754 } else { | |
3755 *params = 0; | |
3756 } | |
3757 } | |
3758 return true; | |
3759 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM: | |
3760 *num_written = 1; | |
3761 if (params) { | |
3762 if (bound_pixel_unpack_transfer_buffer_) { | |
greggman
2012/05/24 20:56:00
note to gman: revisit. Does this support tradition
| |
3763 GLuint client_id = 0; | |
3764 buffer_manager()->GetClientId( | |
3765 bound_pixel_unpack_transfer_buffer_->service_id(), | |
3766 &client_id); | |
3767 *params = client_id; | |
3768 } else { | |
3769 *params = 0; | |
3770 } | |
3771 } | |
3772 return true; | |
3706 case GL_FRAMEBUFFER_BINDING: | 3773 case GL_FRAMEBUFFER_BINDING: |
3707 // case GL_DRAW_FRAMEBUFFER_BINDING_EXT: (same as GL_FRAMEBUFFER_BINDING) | 3774 // case GL_DRAW_FRAMEBUFFER_BINDING_EXT: (same as GL_FRAMEBUFFER_BINDING) |
3708 *num_written = 1; | 3775 *num_written = 1; |
3709 if (params) { | 3776 if (params) { |
3710 FramebufferManager::FramebufferInfo* framebuffer = | 3777 FramebufferManager::FramebufferInfo* framebuffer = |
3711 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); | 3778 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); |
3712 if (framebuffer) { | 3779 if (framebuffer) { |
3713 GLuint client_id = 0; | 3780 GLuint client_id = 0; |
3714 framebuffer_manager()->GetClientId( | 3781 framebuffer_manager()->GetClientId( |
3715 framebuffer->service_id(), &client_id); | 3782 framebuffer->service_id(), &client_id); |
(...skipping 2892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6608 } | 6675 } |
6609 } | 6676 } |
6610 | 6677 |
6611 error::Error GLES2DecoderImpl::HandleBufferData( | 6678 error::Error GLES2DecoderImpl::HandleBufferData( |
6612 uint32 immediate_data_size, const gles2::BufferData& c) { | 6679 uint32 immediate_data_size, const gles2::BufferData& c) { |
6613 GLenum target = static_cast<GLenum>(c.target); | 6680 GLenum target = static_cast<GLenum>(c.target); |
6614 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 6681 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
6615 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 6682 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); |
6616 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 6683 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); |
6617 GLenum usage = static_cast<GLenum>(c.usage); | 6684 GLenum usage = static_cast<GLenum>(c.usage); |
6685 | |
6686 switch (target) { | |
6687 case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: | |
greggman
2012/05/24 20:56:00
style: indent
| |
6688 case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM: { | |
6689 if (!validators_->buffer_usage.IsValid(usage)) { | |
6690 SetGLError(GL_INVALID_ENUM, "glBufferData: usage GL_INVALID_ENUM"); | |
6691 return error::kNoError; | |
6692 } | |
6693 if (size < 0) { | |
6694 SetGLError(GL_INVALID_VALUE, "glBufferData: size < 0"); | |
6695 return error::kNoError; | |
6696 } | |
6697 BufferManager::BufferInfo* info = GetBufferInfoForTarget(target); | |
6698 if (!info) { | |
6699 SetGLError(GL_INVALID_VALUE, "glBufferData: unknown buffer"); | |
6700 return error::kNoError; | |
6701 } | |
6702 buffer_manager()->SetInfo( | |
6703 info, size, usage, this, data_shm_id, data_shm_offset); | |
6704 return error::kNoError; | |
6705 } break; | |
greggman
2012/05/24 20:56:00
style: break goes in case block
| |
6706 } | |
6707 | |
6618 const void* data = NULL; | 6708 const void* data = NULL; |
6619 if (data_shm_id != 0 || data_shm_offset != 0) { | 6709 if (data_shm_id != 0 || data_shm_offset != 0) { |
6620 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); | 6710 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); |
6621 if (!data) { | 6711 if (!data) { |
6622 return error::kOutOfBounds; | 6712 return error::kOutOfBounds; |
6623 } | 6713 } |
6624 } | 6714 } |
6625 DoBufferData(target, size, data, usage); | 6715 DoBufferData(target, size, data, usage); |
6626 return error::kNoError; | 6716 return error::kNoError; |
6627 } | 6717 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7007 GLenum type = static_cast<GLenum>(c.type); | 7097 GLenum type = static_cast<GLenum>(c.type); |
7008 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | 7098 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); |
7009 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | 7099 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); |
7010 uint32 pixels_size; | 7100 uint32 pixels_size; |
7011 if (!GLES2Util::ComputeImageDataSizes( | 7101 if (!GLES2Util::ComputeImageDataSizes( |
7012 width, height, format, type, unpack_alignment_, &pixels_size, NULL, | 7102 width, height, format, type, unpack_alignment_, &pixels_size, NULL, |
7013 NULL)) { | 7103 NULL)) { |
7014 return error::kOutOfBounds; | 7104 return error::kOutOfBounds; |
7015 } | 7105 } |
7016 const void* pixels = NULL; | 7106 const void* pixels = NULL; |
7017 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 7107 if (bound_pixel_unpack_transfer_buffer_) { |
7108 pixels = bound_pixel_unpack_transfer_buffer_->GetRange( | |
7109 pixels_shm_offset, pixels_size); | |
7110 if (!pixels) { | |
7111 return error::kOutOfBounds; | |
7112 } | |
7113 } else if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | |
7018 pixels = GetSharedMemoryAs<const void*>( | 7114 pixels = GetSharedMemoryAs<const void*>( |
7019 pixels_shm_id, pixels_shm_offset, pixels_size); | 7115 pixels_shm_id, pixels_shm_offset, pixels_size); |
7020 if (!pixels) { | 7116 if (!pixels) { |
7021 return error::kOutOfBounds; | 7117 return error::kOutOfBounds; |
7022 } | 7118 } |
7023 } | 7119 } |
7024 return DoTexImage2D( | 7120 return DoTexImage2D( |
7025 target, level, internal_format, width, height, border, format, type, | 7121 target, level, internal_format, width, height, border, format, type, |
7026 pixels, pixels_size); | 7122 pixels, pixels_size); |
7027 } | 7123 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7081 GL_INVALID_OPERATION, | 7177 GL_INVALID_OPERATION, |
7082 "glCompressedTexSubImage2D: format does not match internal format."); | 7178 "glCompressedTexSubImage2D: format does not match internal format."); |
7083 return; | 7179 return; |
7084 } | 7180 } |
7085 if (!info->ValidForTexture( | 7181 if (!info->ValidForTexture( |
7086 target, level, xoffset, yoffset, width, height, format, type)) { | 7182 target, level, xoffset, yoffset, width, height, format, type)) { |
7087 SetGLError(GL_INVALID_VALUE, | 7183 SetGLError(GL_INVALID_VALUE, |
7088 "glCompressedTexSubImage2D: bad dimensions."); | 7184 "glCompressedTexSubImage2D: bad dimensions."); |
7089 return; | 7185 return; |
7090 } | 7186 } |
7187 | |
7091 // Note: There is no need to deal with texture cleared tracking here | 7188 // Note: There is no need to deal with texture cleared tracking here |
7092 // because the validation above means you can only get here if the level | 7189 // because the validation above means you can only get here if the level |
7093 // is already a matching compressed format and in that case | 7190 // is already a matching compressed format and in that case |
7094 // CompressedTexImage2D already cleared the texture. | 7191 // CompressedTexImage2D already cleared the texture. |
7095 glCompressedTexSubImage2D( | 7192 glCompressedTexSubImage2D( |
7096 target, level, xoffset, yoffset, width, height, format, image_size, data); | 7193 target, level, xoffset, yoffset, width, height, format, image_size, data); |
7097 } | 7194 } |
7098 | 7195 |
7099 static void Clip( | 7196 static void Clip( |
7100 GLint start, GLint range, GLint sourceRange, | 7197 GLint start, GLint range, GLint sourceRange, |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7290 | 7387 |
7291 void GLES2DecoderImpl::DoTexSubImage2D( | 7388 void GLES2DecoderImpl::DoTexSubImage2D( |
7292 GLenum target, | 7389 GLenum target, |
7293 GLint level, | 7390 GLint level, |
7294 GLint xoffset, | 7391 GLint xoffset, |
7295 GLint yoffset, | 7392 GLint yoffset, |
7296 GLsizei width, | 7393 GLsizei width, |
7297 GLsizei height, | 7394 GLsizei height, |
7298 GLenum format, | 7395 GLenum format, |
7299 GLenum type, | 7396 GLenum type, |
7300 const void * data) { | 7397 const void* pixels, |
7398 uint32 pixels_size) { | |
greggman
2012/05/24 20:56:00
pixels_size doesn't appear to be used. Was there a
| |
7301 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); | 7399 TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
7302 if (!info) { | 7400 if (!info) { |
7303 SetGLError(GL_INVALID_OPERATION, | 7401 SetGLError(GL_INVALID_OPERATION, |
7304 "glTexSubImage2D: unknown texture for target"); | 7402 "glTexSubImage2D: unknown texture for target"); |
7305 return; | 7403 return; |
7306 } | 7404 } |
7307 GLenum current_type = 0; | 7405 GLenum current_type = 0; |
7308 GLenum internal_format = 0; | 7406 GLenum internal_format = 0; |
7309 if (!info->GetLevelType(target, level, ¤t_type, &internal_format)) { | 7407 if (!info->GetLevelType(target, level, ¤t_type, &internal_format)) { |
7310 SetGLError( | 7408 SetGLError( |
(...skipping 23 matching lines...) Expand all Loading... | |
7334 GLsizei tex_height = 0; | 7432 GLsizei tex_height = 0; |
7335 bool ok = info->GetLevelSize(target, level, &tex_width, &tex_height); | 7433 bool ok = info->GetLevelSize(target, level, &tex_width, &tex_height); |
7336 DCHECK(ok); | 7434 DCHECK(ok); |
7337 if (xoffset != 0 || yoffset != 0 || | 7435 if (xoffset != 0 || yoffset != 0 || |
7338 width != tex_width || height != tex_height) { | 7436 width != tex_width || height != tex_height) { |
7339 if (!texture_manager()->ClearTextureLevel(this, info, target, level)) { | 7437 if (!texture_manager()->ClearTextureLevel(this, info, target, level)) { |
7340 SetGLError(GL_OUT_OF_MEMORY, "glTexSubImage2D: dimensions too big"); | 7438 SetGLError(GL_OUT_OF_MEMORY, "glTexSubImage2D: dimensions too big"); |
7341 return; | 7439 return; |
7342 } | 7440 } |
7343 glTexSubImage2D( | 7441 glTexSubImage2D( |
7344 target, level, xoffset, yoffset, width, height, format, type, data); | 7442 target, level, xoffset, yoffset, width, height, format, type, pixels); |
7345 return; | 7443 return; |
7346 } | 7444 } |
7347 | 7445 |
7348 if (teximage2d_faster_than_texsubimage2d_ && !info->IsImmutable()) { | 7446 if (teximage2d_faster_than_texsubimage2d_ && !info->IsImmutable()) { |
7349 // NOTE: In OpenGL ES 2.0 border is always zero and format is always the | 7447 // NOTE: In OpenGL ES 2.0 border is always zero and format is always the |
7350 // same as internal_foramt. If that changes we'll need to look them up. | 7448 // same as internal_foramt. If that changes we'll need to look them up. |
7351 WrappedTexImage2D( | 7449 WrappedTexImage2D( |
7352 target, level, format, width, height, 0, format, type, data); | 7450 target, level, format, width, height, 0, format, type, pixels); |
7353 } else { | 7451 } else { |
7354 glTexSubImage2D( | 7452 glTexSubImage2D( |
7355 target, level, xoffset, yoffset, width, height, format, type, data); | 7453 target, level, xoffset, yoffset, width, height, format, type, pixels); |
7356 } | 7454 } |
7357 texture_manager()->SetLevelCleared(info, target, level); | 7455 texture_manager()->SetLevelCleared(info, target, level); |
7358 } | 7456 } |
7359 | 7457 |
7360 error::Error GLES2DecoderImpl::HandleTexSubImage2D( | 7458 error::Error GLES2DecoderImpl::HandleTexSubImage2D( |
7361 uint32 immediate_data_size, const gles2::TexSubImage2D& c) { | 7459 uint32 immediate_data_size, const gles2::TexSubImage2D& c) { |
7362 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D"); | 7460 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleTexSubImage2D"); |
7363 GLboolean internal = static_cast<GLboolean>(c.internal); | 7461 GLboolean internal = static_cast<GLboolean>(c.internal); |
7364 if (internal == GL_TRUE && tex_image_2d_failed_) | 7462 if (internal == GL_TRUE && tex_image_2d_failed_) |
7365 return error::kNoError; | 7463 return error::kNoError; |
7366 | 7464 |
7367 GLenum target = static_cast<GLenum>(c.target); | 7465 GLenum target = static_cast<GLenum>(c.target); |
7368 GLint level = static_cast<GLint>(c.level); | 7466 GLint level = static_cast<GLint>(c.level); |
7369 GLint xoffset = static_cast<GLint>(c.xoffset); | 7467 GLint xoffset = static_cast<GLint>(c.xoffset); |
7370 GLint yoffset = static_cast<GLint>(c.yoffset); | 7468 GLint yoffset = static_cast<GLint>(c.yoffset); |
7371 GLsizei width = static_cast<GLsizei>(c.width); | 7469 GLsizei width = static_cast<GLsizei>(c.width); |
7372 GLsizei height = static_cast<GLsizei>(c.height); | 7470 GLsizei height = static_cast<GLsizei>(c.height); |
7373 GLenum format = static_cast<GLenum>(c.format); | 7471 GLenum format = static_cast<GLenum>(c.format); |
7374 GLenum type = static_cast<GLenum>(c.type); | 7472 GLenum type = static_cast<GLenum>(c.type); |
7375 uint32 data_size; | 7473 uint32 data_size; |
7376 if (!GLES2Util::ComputeImageDataSizes( | 7474 if (!GLES2Util::ComputeImageDataSizes( |
7377 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { | 7475 width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) { |
7378 return error::kOutOfBounds; | 7476 return error::kOutOfBounds; |
7379 } | 7477 } |
7380 const void* pixels = GetSharedMemoryAs<const void*>( | |
7381 c.pixels_shm_id, c.pixels_shm_offset, data_size); | |
7382 if (!validators_->texture_target.IsValid(target)) { | 7478 if (!validators_->texture_target.IsValid(target)) { |
7383 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); | 7479 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: target GL_INVALID_ENUM"); |
7384 return error::kNoError; | 7480 return error::kNoError; |
7385 } | 7481 } |
7386 if (width < 0) { | 7482 if (width < 0) { |
7387 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); | 7483 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: width < 0"); |
7388 return error::kNoError; | 7484 return error::kNoError; |
7389 } | 7485 } |
7390 if (height < 0) { | 7486 if (height < 0) { |
7391 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: height < 0"); | 7487 SetGLError(GL_INVALID_VALUE, "glTexSubImage2D: height < 0"); |
7392 return error::kNoError; | 7488 return error::kNoError; |
7393 } | 7489 } |
7394 if (!validators_->texture_format.IsValid(format)) { | 7490 if (!validators_->texture_format.IsValid(format)) { |
7395 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: format GL_INVALID_ENUM"); | 7491 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: format GL_INVALID_ENUM"); |
7396 return error::kNoError; | 7492 return error::kNoError; |
7397 } | 7493 } |
7398 if (!validators_->pixel_type.IsValid(type)) { | 7494 if (!validators_->pixel_type.IsValid(type)) { |
7399 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); | 7495 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); |
7400 return error::kNoError; | 7496 return error::kNoError; |
7401 } | 7497 } |
7498 | |
7499 const void* pixels = NULL; | |
7500 if (bound_pixel_unpack_transfer_buffer_) { | |
7501 pixels = bound_pixel_unpack_transfer_buffer_->GetRange( | |
7502 c.pixels_shm_offset, data_size); | |
7503 } else { | |
7504 pixels = GetSharedMemoryAs<const void*>( | |
7505 c.pixels_shm_id, c.pixels_shm_offset, data_size); | |
7506 } | |
7402 if (pixels == NULL) { | 7507 if (pixels == NULL) { |
7403 return error::kOutOfBounds; | 7508 return error::kOutOfBounds; |
7404 } | 7509 } |
7405 DoTexSubImage2D( | 7510 DoTexSubImage2D( |
7406 target, level, xoffset, yoffset, width, height, format, type, pixels); | 7511 target, level, xoffset, yoffset, width, height, format, type, pixels, |
7512 data_size); | |
7407 return error::kNoError; | 7513 return error::kNoError; |
7408 } | 7514 } |
7409 | 7515 |
7410 error::Error GLES2DecoderImpl::HandleTexSubImage2DImmediate( | 7516 error::Error GLES2DecoderImpl::HandleTexSubImage2DImmediate( |
7411 uint32 immediate_data_size, const gles2::TexSubImage2DImmediate& c) { | 7517 uint32 immediate_data_size, const gles2::TexSubImage2DImmediate& c) { |
7412 GLboolean internal = static_cast<GLboolean>(c.internal); | 7518 GLboolean internal = static_cast<GLboolean>(c.internal); |
7413 if (internal == GL_TRUE && tex_image_2d_failed_) | 7519 if (internal == GL_TRUE && tex_image_2d_failed_) |
7414 return error::kNoError; | 7520 return error::kNoError; |
7415 | 7521 |
7416 GLenum target = static_cast<GLenum>(c.target); | 7522 GLenum target = static_cast<GLenum>(c.target); |
(...skipping 28 matching lines...) Expand all Loading... | |
7445 return error::kNoError; | 7551 return error::kNoError; |
7446 } | 7552 } |
7447 if (!validators_->pixel_type.IsValid(type)) { | 7553 if (!validators_->pixel_type.IsValid(type)) { |
7448 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); | 7554 SetGLError(GL_INVALID_ENUM, "glTexSubImage2D: type GL_INVALID_ENUM"); |
7449 return error::kNoError; | 7555 return error::kNoError; |
7450 } | 7556 } |
7451 if (pixels == NULL) { | 7557 if (pixels == NULL) { |
7452 return error::kOutOfBounds; | 7558 return error::kOutOfBounds; |
7453 } | 7559 } |
7454 DoTexSubImage2D( | 7560 DoTexSubImage2D( |
7455 target, level, xoffset, yoffset, width, height, format, type, pixels); | 7561 target, level, xoffset, yoffset, width, height, format, type, pixels, |
7562 data_size); | |
7456 return error::kNoError; | 7563 return error::kNoError; |
7457 } | 7564 } |
7458 | 7565 |
7459 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( | 7566 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( |
7460 uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { | 7567 uint32 immediate_data_size, const gles2::GetVertexAttribPointerv& c) { |
7461 GLuint index = static_cast<GLuint>(c.index); | 7568 GLuint index = static_cast<GLuint>(c.index); |
7462 GLenum pname = static_cast<GLenum>(c.pname); | 7569 GLenum pname = static_cast<GLenum>(c.pname); |
7463 typedef gles2::GetVertexAttribPointerv::Result Result; | 7570 typedef gles2::GetVertexAttribPointerv::Result Result; |
7464 Result* result = GetSharedMemoryAs<Result*>( | 7571 Result* result = GetSharedMemoryAs<Result*>( |
7465 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); | 7572 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8731 BindAndApplyTextureParameters(info); | 8838 BindAndApplyTextureParameters(info); |
8732 } | 8839 } |
8733 | 8840 |
8734 // Include the auto-generated part of this file. We split this because it means | 8841 // Include the auto-generated part of this file. We split this because it means |
8735 // we can easily edit the non-auto generated parts right here in this file | 8842 // we can easily edit the non-auto generated parts right here in this file |
8736 // instead of having to edit some template or the code generator. | 8843 // instead of having to edit some template or the code generator. |
8737 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 8844 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
8738 | 8845 |
8739 } // namespace gles2 | 8846 } // namespace gles2 |
8740 } // namespace gpu | 8847 } // namespace gpu |
OLD | NEW |