Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 #include "gpu/command_buffer/service/framebuffer_manager.h" | 41 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 42 #include "gpu/command_buffer/service/gl_utils.h" | 42 #include "gpu/command_buffer/service/gl_utils.h" |
| 43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 44 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 44 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| 45 #include "gpu/command_buffer/service/gpu_state_tracer.h" | 45 #include "gpu/command_buffer/service/gpu_state_tracer.h" |
| 46 #include "gpu/command_buffer/service/gpu_switches.h" | 46 #include "gpu/command_buffer/service/gpu_switches.h" |
| 47 #include "gpu/command_buffer/service/gpu_tracer.h" | 47 #include "gpu/command_buffer/service/gpu_tracer.h" |
| 48 #include "gpu/command_buffer/service/image_manager.h" | 48 #include "gpu/command_buffer/service/image_manager.h" |
| 49 #include "gpu/command_buffer/service/mailbox_manager.h" | 49 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 50 #include "gpu/command_buffer/service/memory_tracking.h" | 50 #include "gpu/command_buffer/service/memory_tracking.h" |
| 51 #include "gpu/command_buffer/service/path_manager.h" | |
| 51 #include "gpu/command_buffer/service/program_manager.h" | 52 #include "gpu/command_buffer/service/program_manager.h" |
| 52 #include "gpu/command_buffer/service/query_manager.h" | 53 #include "gpu/command_buffer/service/query_manager.h" |
| 53 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 54 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
| 54 #include "gpu/command_buffer/service/shader_manager.h" | 55 #include "gpu/command_buffer/service/shader_manager.h" |
| 55 #include "gpu/command_buffer/service/shader_translator.h" | 56 #include "gpu/command_buffer/service/shader_translator.h" |
| 56 #include "gpu/command_buffer/service/shader_translator_cache.h" | 57 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 57 #include "gpu/command_buffer/service/texture_manager.h" | 58 #include "gpu/command_buffer/service/texture_manager.h" |
| 58 #include "gpu/command_buffer/service/vertex_array_manager.h" | 59 #include "gpu/command_buffer/service/vertex_array_manager.h" |
| 59 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 60 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 60 #include "ui/gl/gl_bindings.h" | 61 #include "ui/gl/gl_bindings.h" |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 bool GenBuffersHelper(GLsizei n, const GLuint* client_ids); | 733 bool GenBuffersHelper(GLsizei n, const GLuint* client_ids); |
| 733 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids); | 734 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids); |
| 734 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids); | 735 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids); |
| 735 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids); | 736 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids); |
| 736 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids); | 737 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids); |
| 737 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); | 738 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); |
| 738 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); | 739 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); |
| 739 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); | 740 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); |
| 740 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); | 741 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); |
| 741 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); | 742 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); |
| 743 bool GenPathsCHROMIUMHelper(GLsizei range, const GLuint* client_ids); | |
| 744 void DeletePathsCHROMIUMHelper(GLuint path, GLsizei range); | |
| 742 | 745 |
| 743 // Helper for async upload token completion notification callback. | 746 // Helper for async upload token completion notification callback. |
| 744 base::Closure AsyncUploadTokenCompletionClosure(uint32 async_upload_token, | 747 base::Closure AsyncUploadTokenCompletionClosure(uint32 async_upload_token, |
| 745 uint32 sync_data_shm_id, | 748 uint32 sync_data_shm_id, |
| 746 uint32 sync_data_shm_offset); | 749 uint32 sync_data_shm_offset); |
| 747 | 750 |
| 748 | 751 |
| 749 | 752 |
| 750 // Workarounds | 753 // Workarounds |
| 751 void OnFboChanged() const; | 754 void OnFboChanged() const; |
| 752 void OnUseFramebuffer() const; | 755 void OnUseFramebuffer() const; |
| 753 | 756 |
| 754 // TODO(gman): Cache these pointers? | 757 // TODO(gman): Cache these pointers? |
| 755 BufferManager* buffer_manager() { | 758 BufferManager* buffer_manager() { |
| 756 return group_->buffer_manager(); | 759 return group_->buffer_manager(); |
| 757 } | 760 } |
| 758 | 761 |
| 759 RenderbufferManager* renderbuffer_manager() { | 762 RenderbufferManager* renderbuffer_manager() { |
| 760 return group_->renderbuffer_manager(); | 763 return group_->renderbuffer_manager(); |
| 761 } | 764 } |
| 762 | 765 |
| 763 FramebufferManager* framebuffer_manager() { | 766 FramebufferManager* framebuffer_manager() { |
| 764 return group_->framebuffer_manager(); | 767 return group_->framebuffer_manager(); |
| 765 } | 768 } |
| 766 | 769 |
| 770 PathManager* path_manager() { return group_->path_manager(); } | |
| 771 | |
| 767 ProgramManager* program_manager() { | 772 ProgramManager* program_manager() { |
| 768 return group_->program_manager(); | 773 return group_->program_manager(); |
| 769 } | 774 } |
| 770 | 775 |
| 771 ShaderManager* shader_manager() { | 776 ShaderManager* shader_manager() { |
| 772 return group_->shader_manager(); | 777 return group_->shader_manager(); |
| 773 } | 778 } |
| 774 | 779 |
| 775 ShaderTranslatorCache* shader_translator_cache() { | 780 ShaderTranslatorCache* shader_translator_cache() { |
| 776 return group_->shader_translator_cache(); | 781 return group_->shader_translator_cache(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 821 // Gets the texture info for the given texture. Returns NULL if none exists. | 826 // Gets the texture info for the given texture. Returns NULL if none exists. |
| 822 TextureRef* GetTexture(GLuint client_id) const { | 827 TextureRef* GetTexture(GLuint client_id) const { |
| 823 return texture_manager()->GetTexture(client_id); | 828 return texture_manager()->GetTexture(client_id); |
| 824 } | 829 } |
| 825 | 830 |
| 826 // Deletes the texture info for the given texture. | 831 // Deletes the texture info for the given texture. |
| 827 void RemoveTexture(GLuint client_id) { | 832 void RemoveTexture(GLuint client_id) { |
| 828 texture_manager()->RemoveTexture(client_id); | 833 texture_manager()->RemoveTexture(client_id); |
| 829 } | 834 } |
| 830 | 835 |
| 836 GLuint GetPath(GLuint client_id, error::Error* path_error); | |
| 837 | |
| 831 // Get the size (in pixels) of the currently bound frame buffer (either FBO | 838 // Get the size (in pixels) of the currently bound frame buffer (either FBO |
| 832 // or regular back buffer). | 839 // or regular back buffer). |
| 833 gfx::Size GetBoundReadFrameBufferSize(); | 840 gfx::Size GetBoundReadFrameBufferSize(); |
| 834 | 841 |
| 835 // Get the format of the currently bound frame buffer (either FBO or regular | 842 // Get the format of the currently bound frame buffer (either FBO or regular |
| 836 // back buffer) | 843 // back buffer) |
| 837 GLenum GetBoundReadFrameBufferTextureType(); | 844 GLenum GetBoundReadFrameBufferTextureType(); |
| 838 GLenum GetBoundReadFrameBufferInternalFormat(); | 845 GLenum GetBoundReadFrameBufferInternalFormat(); |
| 839 GLenum GetBoundDrawFrameBufferInternalFormat(); | 846 GLenum GetBoundDrawFrameBufferInternalFormat(); |
| 840 | 847 |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1621 if (!offscreen_target_frame_buffer_.get() && | 1628 if (!offscreen_target_frame_buffer_.get() && |
| 1622 !framebuffer_state_.bound_read_framebuffer.get() && | 1629 !framebuffer_state_.bound_read_framebuffer.get() && |
| 1623 !surface_->SetBackbufferAllocation(true)) | 1630 !surface_->SetBackbufferAllocation(true)) |
| 1624 return error::kLostContext; | 1631 return error::kLostContext; |
| 1625 return error::kNoError; | 1632 return error::kNoError; |
| 1626 } | 1633 } |
| 1627 | 1634 |
| 1628 void ProcessPendingReadPixels(); | 1635 void ProcessPendingReadPixels(); |
| 1629 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); | 1636 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); |
| 1630 | 1637 |
| 1638 error::Error PrepareInstancedPathCommand(uint32 num_paths, | |
| 1639 uint32 paths_shm_id, | |
| 1640 uint32 paths_shm_offset, | |
| 1641 GLuint path_base, | |
| 1642 GLenum transform_type, | |
| 1643 uint32 transforms_shm_id, | |
| 1644 uint32 transforms_shm_offset, | |
| 1645 GLuint** out_paths, | |
| 1646 const GLfloat** out_transforms); | |
| 1647 | |
| 1631 // Generate a member function prototype for each command in an automated and | 1648 // Generate a member function prototype for each command in an automated and |
| 1632 // typesafe way. | 1649 // typesafe way. |
| 1633 #define GLES2_CMD_OP(name) \ | 1650 #define GLES2_CMD_OP(name) \ |
| 1634 Error Handle ## name( \ | 1651 Error Handle ## name( \ |
| 1635 uint32 immediate_data_size, \ | 1652 uint32 immediate_data_size, \ |
| 1636 const cmds::name& args); \ | 1653 const cmds::name& args); \ |
| 1637 | 1654 |
| 1638 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 1655 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
| 1639 | 1656 |
| 1640 #undef GLES2_CMD_OP | 1657 #undef GLES2_CMD_OP |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2751 features().arb_texture_rectangle ? 1 : 0; | 2768 features().arb_texture_rectangle ? 1 : 0; |
| 2752 resources.OES_EGL_image_external = | 2769 resources.OES_EGL_image_external = |
| 2753 features().oes_egl_image_external ? 1 : 0; | 2770 features().oes_egl_image_external ? 1 : 0; |
| 2754 resources.EXT_draw_buffers = | 2771 resources.EXT_draw_buffers = |
| 2755 features().ext_draw_buffers ? 1 : 0; | 2772 features().ext_draw_buffers ? 1 : 0; |
| 2756 resources.EXT_frag_depth = | 2773 resources.EXT_frag_depth = |
| 2757 features().ext_frag_depth ? 1 : 0; | 2774 features().ext_frag_depth ? 1 : 0; |
| 2758 #if (ANGLE_SH_VERSION >= 123) | 2775 #if (ANGLE_SH_VERSION >= 123) |
| 2759 resources.EXT_shader_texture_lod = | 2776 resources.EXT_shader_texture_lod = |
| 2760 features().ext_shader_texture_lod ? 1 : 0; | 2777 features().ext_shader_texture_lod ? 1 : 0; |
| 2778 #if (ANGLE_SH_VERSION >= 124) | |
| 2779 if (features().chromium_path_rendering) { | |
| 2780 resources.CHROMIUM_path_rendering = 1; | |
| 2781 GLint value = 0; | |
| 2782 glGetIntegerv(GL_MAX_TEXTURE_COORDS, &value); | |
| 2783 resources.MaxTextureCoords = value; | |
| 2784 } | |
| 2785 #endif | |
| 2761 #endif | 2786 #endif |
| 2762 } | 2787 } |
| 2763 | 2788 |
| 2764 ShShaderSpec shader_spec = force_webgl_glsl_validation_ ? SH_WEBGL_SPEC | 2789 ShShaderSpec shader_spec = force_webgl_glsl_validation_ ? SH_WEBGL_SPEC |
| 2765 : SH_GLES2_SPEC; | 2790 : SH_GLES2_SPEC; |
| 2766 if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing) | 2791 if (shader_spec == SH_WEBGL_SPEC && features().enable_shader_name_hashing) |
| 2767 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 | 2792 #if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108 |
| 2768 resources.HashFunction = &CityHashForAngle; | 2793 resources.HashFunction = &CityHashForAngle; |
| 2769 #else | 2794 #else |
| 2770 resources.HashFunction = &CityHash64; | 2795 resources.HashFunction = &CityHash64; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2863 } | 2888 } |
| 2864 } | 2889 } |
| 2865 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); | 2890 scoped_ptr<GLuint[]> service_ids(new GLuint[n]); |
| 2866 glGenTextures(n, service_ids.get()); | 2891 glGenTextures(n, service_ids.get()); |
| 2867 for (GLsizei ii = 0; ii < n; ++ii) { | 2892 for (GLsizei ii = 0; ii < n; ++ii) { |
| 2868 CreateTexture(client_ids[ii], service_ids[ii]); | 2893 CreateTexture(client_ids[ii], service_ids[ii]); |
| 2869 } | 2894 } |
| 2870 return true; | 2895 return true; |
| 2871 } | 2896 } |
| 2872 | 2897 |
| 2898 bool GLES2DecoderImpl::GenPathsCHROMIUMHelper(GLsizei range, | |
| 2899 const GLuint* client_ids) { | |
| 2900 for (GLsizei ii = 0; ii < range; ++ii) { | |
| 2901 if (path_manager()->GetPath(client_ids[ii])) { | |
| 2902 return false; | |
| 2903 } | |
| 2904 } | |
| 2905 | |
| 2906 GLuint n = glGenPathsNV(range); | |
| 2907 for (GLsizei ii = 0; ii < range; ++ii) { | |
| 2908 path_manager()->CreatePath(client_ids[ii], n + ii); | |
| 2909 } | |
| 2910 return true; | |
| 2911 } | |
| 2912 | |
| 2913 void GLES2DecoderImpl::DeletePathsCHROMIUMHelper(GLuint path, GLsizei range) { | |
| 2914 path_manager()->RemovePaths(path, range); | |
| 2915 } | |
| 2916 | |
| 2873 void GLES2DecoderImpl::DeleteBuffersHelper( | 2917 void GLES2DecoderImpl::DeleteBuffersHelper( |
| 2874 GLsizei n, const GLuint* client_ids) { | 2918 GLsizei n, const GLuint* client_ids) { |
| 2875 for (GLsizei ii = 0; ii < n; ++ii) { | 2919 for (GLsizei ii = 0; ii < n; ++ii) { |
| 2876 Buffer* buffer = GetBuffer(client_ids[ii]); | 2920 Buffer* buffer = GetBuffer(client_ids[ii]); |
| 2877 if (buffer && !buffer->IsDeleted()) { | 2921 if (buffer && !buffer->IsDeleted()) { |
| 2878 state_.vertex_attrib_manager->Unbind(buffer); | 2922 state_.vertex_attrib_manager->Unbind(buffer); |
| 2879 if (state_.bound_array_buffer.get() == buffer) { | 2923 if (state_.bound_array_buffer.get() == buffer) { |
| 2880 state_.bound_array_buffer = NULL; | 2924 state_.bound_array_buffer = NULL; |
| 2881 } | 2925 } |
| 2882 RemoveBuffer(client_ids[ii]); | 2926 RemoveBuffer(client_ids[ii]); |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4335 if (params) { | 4379 if (params) { |
| 4336 params[0] = renderbuffer_manager()->max_samples(); | 4380 params[0] = renderbuffer_manager()->max_samples(); |
| 4337 } | 4381 } |
| 4338 return true; | 4382 return true; |
| 4339 case GL_MAX_RENDERBUFFER_SIZE: | 4383 case GL_MAX_RENDERBUFFER_SIZE: |
| 4340 *num_written = 1; | 4384 *num_written = 1; |
| 4341 if (params) { | 4385 if (params) { |
| 4342 params[0] = renderbuffer_manager()->max_renderbuffer_size(); | 4386 params[0] = renderbuffer_manager()->max_renderbuffer_size(); |
| 4343 } | 4387 } |
| 4344 return true; | 4388 return true; |
| 4389 case GL_MAX_TEXTURE_COORDS: | |
|
piman
2014/04/24 22:26:36
_CHROMIUM
piman
2014/04/24 22:26:36
can you DCHECK that the extension is present in th
| |
| 4390 *num_written = 1; | |
| 4391 if (params) { | |
| 4392 glGetIntegerv(GL_MAX_TEXTURE_COORDS, params); | |
| 4393 } | |
| 4394 return true; | |
| 4345 case GL_MAX_TEXTURE_SIZE: | 4395 case GL_MAX_TEXTURE_SIZE: |
| 4346 *num_written = 1; | 4396 *num_written = 1; |
| 4347 if (params) { | 4397 if (params) { |
| 4348 params[0] = texture_manager()->MaxSizeForTarget(GL_TEXTURE_2D); | 4398 params[0] = texture_manager()->MaxSizeForTarget(GL_TEXTURE_2D); |
| 4349 } | 4399 } |
| 4350 return true; | 4400 return true; |
| 4351 case GL_MAX_CUBE_MAP_TEXTURE_SIZE: | 4401 case GL_MAX_CUBE_MAP_TEXTURE_SIZE: |
| 4352 *num_written = 1; | 4402 *num_written = 1; |
| 4353 if (params) { | 4403 if (params) { |
| 4354 params[0] = texture_manager()->MaxSizeForTarget(GL_TEXTURE_CUBE_MAP); | 4404 params[0] = texture_manager()->MaxSizeForTarget(GL_TEXTURE_CUBE_MAP); |
| (...skipping 6423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10778 DoDidUseTexImageIfNeeded(texture, texture->target()); | 10828 DoDidUseTexImageIfNeeded(texture, texture->target()); |
| 10779 } | 10829 } |
| 10780 | 10830 |
| 10781 void GLES2DecoderImpl::OnOutOfMemoryError() { | 10831 void GLES2DecoderImpl::OnOutOfMemoryError() { |
| 10782 if (lose_context_when_out_of_memory_) { | 10832 if (lose_context_when_out_of_memory_) { |
| 10783 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); | 10833 group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 10784 LoseContext(GL_GUILTY_CONTEXT_RESET_ARB); | 10834 LoseContext(GL_GUILTY_CONTEXT_RESET_ARB); |
| 10785 } | 10835 } |
| 10786 } | 10836 } |
| 10787 | 10837 |
| 10838 GLuint GLES2DecoderImpl::GetPath(GLuint client_id, error::Error* path_error) { | |
| 10839 GLuint service_id = 0; | |
| 10840 // FIXME: currently we do not create paths if they are not present. | |
| 10841 if (!path_manager()->GetPath(client_id, &service_id)) { | |
| 10842 *path_error = error::kInvalidArguments; | |
| 10843 return 0; | |
| 10844 } | |
| 10845 return service_id; | |
| 10846 } | |
| 10847 | |
| 10848 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM( | |
|
piman
2014/04/24 22:26:36
We'll want unit tests for all these new functions,
| |
| 10849 uint32 immediate_data_size, | |
| 10850 const gles2::cmds::GenPathsCHROMIUM& c) { | |
| 10851 if (!features().chromium_path_rendering) { | |
| 10852 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGenPathsCHROMIUM", | |
| 10853 "function not available"); | |
| 10854 return error::kNoError; | |
| 10855 } | |
| 10856 | |
| 10857 GLsizei range = static_cast<GLsizei>(c.range); | |
| 10858 uint32 data_size; | |
| 10859 if (!SafeMultiplyUint32(range, sizeof(GLuint), &data_size)) { | |
| 10860 return error::kOutOfBounds; | |
| 10861 } | |
| 10862 GLuint* client_ids = GetSharedMemoryAs<GLuint*>( | |
| 10863 c.client_ids_shm_id, c.client_ids_shm_offset, data_size); | |
| 10864 if (client_ids == NULL) { | |
| 10865 return error::kOutOfBounds; | |
| 10866 } | |
| 10867 if (!GenPathsCHROMIUMHelper(range, client_ids)) { | |
| 10868 return error::kInvalidArguments; | |
| 10869 } | |
| 10870 return error::kNoError; | |
| 10871 } | |
| 10872 | |
| 10873 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM( | |
| 10874 uint32 immediate_data_size, | |
| 10875 const cmds::PathCommandsCHROMIUM& c) { | |
| 10876 if (!features().chromium_path_rendering) { | |
| 10877 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathCommandsCHROMIUM", | |
| 10878 "function not available"); | |
| 10879 return error::kNoError; | |
| 10880 } | |
| 10881 | |
| 10882 error::Error path_error = error::kNoError; | |
| 10883 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 10884 if (path_error != error::kNoError) { | |
| 10885 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathCommandsCHROMIUM", | |
| 10886 "invalid path name"); | |
| 10887 return error::kNoError; | |
| 10888 } | |
| 10889 | |
| 10890 GLsizei numCommands = static_cast<GLsizei>(c.numCommands); | |
|
piman
2014/04/24 22:26:36
nit: please use unix_style for local variables (he
| |
| 10891 uint32 commands_shm_id = static_cast<uint32>(c.commands_shm_id); | |
| 10892 uint32 commands_shm_offset = static_cast<uint32>(c.commands_shm_offset); | |
| 10893 | |
| 10894 const GLubyte* commands = NULL; | |
| 10895 if (commands_shm_id != 0 || commands_shm_offset != 0) { | |
| 10896 commands = GetSharedMemoryAs<const GLubyte*>( | |
| 10897 commands_shm_id, commands_shm_offset, numCommands); | |
| 10898 if (!commands) { | |
| 10899 return error::kOutOfBounds; | |
| 10900 } | |
| 10901 } | |
| 10902 | |
| 10903 GLenum coordType = static_cast<GLenum>(c.coordType); | |
| 10904 GLsizei numCoords = static_cast<GLsizei>(c.numCoords); | |
| 10905 uint32 coords_shm_id = static_cast<uint32>(c.coords_shm_id); | |
| 10906 uint32 coords_shm_offset = static_cast<uint32>(c.coords_shm_offset); | |
| 10907 uint32 coords_size = | |
| 10908 GLES2Util::GetGLTypeSizeForTexturesAndBuffers(coordType) * numCoords; | |
| 10909 | |
| 10910 const void* coords = NULL; | |
| 10911 if (coords_shm_id != 0 || coords_shm_offset != 0) { | |
| 10912 coords = GetSharedMemoryAs<const void*>( | |
| 10913 coords_shm_id, coords_shm_offset, coords_size); | |
| 10914 if (!coords) { | |
| 10915 return error::kOutOfBounds; | |
| 10916 } | |
| 10917 } | |
| 10918 | |
| 10919 glPathCommandsNV( | |
| 10920 service_id, numCommands, commands, numCoords, coordType, coords); | |
|
piman
2014/04/24 22:26:36
I would like us to validate the syntax of the comm
| |
| 10921 | |
| 10922 return error::kNoError; | |
| 10923 } | |
| 10924 | |
| 10925 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM( | |
| 10926 uint32 immediate_data_size, | |
| 10927 const gles2::cmds::PathParameterfCHROMIUM& c) { | |
| 10928 if (!features().chromium_path_rendering) { | |
| 10929 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathParameterfCHROMIUM", | |
| 10930 "function not available"); | |
| 10931 return error::kNoError; | |
| 10932 } | |
| 10933 | |
| 10934 error::Error path_error = error::kNoError; | |
| 10935 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 10936 if (path_error != error::kNoError) { | |
| 10937 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathParameterfCHROMIUM", | |
| 10938 "invalid path name"); | |
| 10939 return error::kNoError; | |
| 10940 } | |
| 10941 | |
| 10942 GLenum pname = static_cast<GLenum>(c.pname); | |
| 10943 GLfloat value = static_cast<GLfloat>(c.value); | |
| 10944 | |
| 10945 if (!validators_->path_parameter.IsValid(pname)) { | |
| 10946 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPathParameterfCHROMIUM", | |
| 10947 pname, "pname"); | |
| 10948 return error::kNoError; | |
| 10949 } | |
| 10950 | |
| 10951 // TODO: value not checked. | |
|
piman
2014/04/24 22:26:36
We need to.
| |
| 10952 | |
| 10953 glPathParameterfNV(service_id, pname, value); | |
| 10954 return error::kNoError; | |
| 10955 } | |
| 10956 | |
| 10957 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM( | |
| 10958 uint32 immediate_data_size, | |
| 10959 const gles2::cmds::PathParameteriCHROMIUM& c) { | |
| 10960 if (!features().chromium_path_rendering) { | |
| 10961 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathParameteriCHROMIUM", | |
| 10962 "function not available"); | |
| 10963 return error::kNoError; | |
| 10964 } | |
| 10965 | |
| 10966 error::Error path_error = error::kNoError; | |
| 10967 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 10968 if (path_error != error::kNoError) { | |
| 10969 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathParameteriCHROMIUM", | |
| 10970 "invalid path name"); | |
| 10971 return error::kNoError; | |
| 10972 } | |
| 10973 | |
| 10974 GLenum pname = static_cast<GLenum>(c.pname); | |
| 10975 GLint value = static_cast<GLint>(c.value); | |
| 10976 | |
| 10977 if (!validators_->path_parameter.IsValid(pname)) { | |
| 10978 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPathParameteriCHROMIUM", | |
| 10979 pname, "pname"); | |
| 10980 return error::kNoError; | |
| 10981 } | |
| 10982 | |
| 10983 // TODO: value not checked. | |
|
piman
2014/04/24 22:26:36
We need to.
| |
| 10984 | |
| 10985 glPathParameteriNV(service_id, pname, value); | |
| 10986 return error::kNoError; | |
| 10987 } | |
| 10988 | |
| 10989 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM( | |
| 10990 uint32 immediate_data_size, | |
| 10991 const gles2::cmds::StencilFillPathCHROMIUM& c) { | |
| 10992 if (!features().chromium_path_rendering) { | |
| 10993 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glStencilFillPathCHROMIUM", | |
| 10994 "function not available"); | |
| 10995 return error::kNoError; | |
| 10996 } | |
| 10997 error::Error path_error = error::kNoError; | |
| 10998 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 10999 if (path_error != error::kNoError) { | |
| 11000 return error::kNoError; | |
| 11001 } | |
| 11002 | |
| 11003 GLenum fillMode = static_cast<GLenum>(c.fillMode); | |
| 11004 if (!validators_->path_fill_mode.IsValid(fillMode)) { | |
| 11005 LOCAL_SET_GL_ERROR_INVALID_ENUM("glStencilFillPathCHROMIUM", | |
| 11006 fillMode, "fillMode"); | |
| 11007 return error::kNoError; | |
| 11008 } | |
| 11009 | |
| 11010 GLuint mask = static_cast<GLuint>(c.mask); | |
| 11011 ApplyDirtyState(); | |
| 11012 glStencilFillPathNV(service_id, fillMode, mask); | |
| 11013 return error::kNoError; | |
| 11014 } | |
| 11015 | |
| 11016 error::Error GLES2DecoderImpl::PrepareInstancedPathCommand( | |
| 11017 uint32 num_paths, | |
| 11018 uint32 paths_shm_id, | |
| 11019 uint32 paths_shm_offset, | |
| 11020 GLuint path_base, | |
| 11021 GLenum transform_type, | |
| 11022 uint32 transforms_shm_id, | |
| 11023 uint32 transforms_shm_offset, | |
| 11024 GLuint** out_paths, | |
| 11025 const GLfloat** out_transforms) { | |
| 11026 GLuint* paths = NULL; | |
| 11027 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
| 11028 paths = GetSharedMemoryAs<GLuint*>( | |
| 11029 paths_shm_id, paths_shm_offset, sizeof(GLuint) * num_paths); | |
| 11030 } | |
| 11031 if (!paths) { | |
| 11032 return error::kOutOfBounds; | |
| 11033 } | |
| 11034 | |
| 11035 uint32 num_transform_elements = | |
| 11036 GLES2Util::GetComponentCountForGLTransformType(transform_type) * | |
| 11037 num_paths; | |
| 11038 | |
| 11039 const GLfloat* transforms = NULL; | |
| 11040 if (transforms_shm_id != 0 || transforms_shm_offset != 0) { | |
| 11041 transforms = GetSharedMemoryAs<const GLfloat*>( | |
| 11042 transforms_shm_id, | |
| 11043 transforms_shm_offset, | |
| 11044 sizeof(GLfloat) * num_transform_elements); | |
| 11045 } | |
| 11046 if (!transforms) { | |
| 11047 return error::kOutOfBounds; | |
| 11048 } | |
| 11049 | |
| 11050 for (uint32_t i = 0; i < num_paths; ++i) { | |
| 11051 error::Error path_error; | |
| 11052 GLuint service_id = GetPath(paths[i] + path_base, &path_error); | |
| 11053 // Will use path 0 if the path is not found. This is in line | |
| 11054 // of the spec: missing paths will produce nothing, but does | |
| 11055 // not stop the instanced draw. | |
| 11056 paths[i] = service_id; | |
| 11057 } | |
| 11058 | |
| 11059 DCHECK((reinterpret_cast<uintptr_t>(paths) & 0x3) == 0); | |
| 11060 DCHECK((reinterpret_cast<uintptr_t>(transforms) & 0x3) == 0); | |
| 11061 | |
| 11062 *out_paths = paths; | |
| 11063 *out_transforms = transforms; | |
| 11064 return error::kNoError; | |
| 11065 } | |
| 11066 | |
| 11067 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM( | |
| 11068 uint32 immediate_data_size, | |
| 11069 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c) { | |
| 11070 if (!features().chromium_path_rendering) { | |
| 11071 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | |
| 11072 "glStencilFillPathInstancedCHROMIUM", | |
| 11073 "function not available"); | |
| 11074 return error::kNoError; | |
| 11075 } | |
| 11076 | |
| 11077 TRACE_EVENT0("gpu", | |
| 11078 "GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM"); | |
| 11079 | |
| 11080 GLsizei numPaths = static_cast<GLsizei>(c.numPaths); | |
| 11081 GLenum pathNameType = static_cast<GLenum>(c.pathNameType); | |
| 11082 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
| 11083 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
| 11084 GLuint pathBase = static_cast<GLuint>(c.pathBase); | |
| 11085 GLenum fillMode = static_cast<GLenum>(c.fillMode); | |
| 11086 GLuint mask = static_cast<GLuint>(c.mask); | |
| 11087 GLenum transformType = static_cast<GLenum>(c.transformType); | |
| 11088 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
| 11089 uint32 transforms_shm_offset = | |
| 11090 static_cast<uint32>(c.transformValues_shm_offset); | |
| 11091 | |
| 11092 if (numPaths < 0) { | |
| 11093 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | |
| 11094 "glCoverStrokePathInstancedCHROMIUM", | |
| 11095 "numPaths < 0"); | |
| 11096 return error::kNoError; | |
| 11097 } | |
| 11098 | |
| 11099 if (!validators_->path_name_type.IsValid(pathNameType)) { | |
| 11100 LOCAL_SET_GL_ERROR_INVALID_ENUM("glStencilFillPathInstancedCHROMIUM", | |
| 11101 pathNameType, "pathNameType"); | |
| 11102 return error::kNoError; | |
| 11103 } | |
| 11104 | |
| 11105 if (!validators_->path_fill_mode.IsValid(fillMode)) { | |
| 11106 LOCAL_SET_GL_ERROR_INVALID_ENUM("glStencilFillPathInstancedCHROMIUM", | |
| 11107 fillMode, "fillMode"); | |
| 11108 return error::kNoError; | |
| 11109 } | |
| 11110 | |
| 11111 | |
| 11112 if (!validators_->path_transform_type.IsValid(transformType)) { | |
| 11113 LOCAL_SET_GL_ERROR_INVALID_ENUM("glStencilFillPathInstancedCHROMIUM", | |
| 11114 transformType, "transformType"); | |
| 11115 return error::kNoError; | |
| 11116 } | |
| 11117 | |
| 11118 DCHECK(pathNameType == GL_UNSIGNED_INT); | |
| 11119 | |
| 11120 GLuint* paths; | |
| 11121 const GLfloat* transforms; | |
|
piman
2014/04/24 22:26:36
nit: there are paths in PrepareInstancedPathComman
| |
| 11122 | |
| 11123 error::Error prepare_error = | |
| 11124 PrepareInstancedPathCommand(static_cast<uint32_t>(numPaths), | |
| 11125 paths_shm_id, | |
| 11126 paths_shm_offset, | |
| 11127 pathBase, | |
| 11128 transformType, | |
| 11129 transforms_shm_id, | |
| 11130 transforms_shm_offset, | |
| 11131 &paths, | |
| 11132 &transforms); | |
| 11133 | |
| 11134 if (prepare_error != error::kNoError) { | |
| 11135 return prepare_error; | |
| 11136 } | |
| 11137 | |
| 11138 ApplyDirtyState(); | |
| 11139 glStencilFillPathInstancedNV(numPaths, | |
| 11140 GL_UNSIGNED_INT, | |
| 11141 paths, | |
| 11142 0, | |
| 11143 fillMode, | |
| 11144 mask, | |
| 11145 transformType, | |
| 11146 transforms); | |
| 11147 | |
| 11148 return error::kNoError; | |
| 11149 } | |
| 11150 | |
| 11151 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM( | |
| 11152 uint32 immediate_data_size, | |
| 11153 const gles2::cmds::StencilStrokePathCHROMIUM& c) { | |
| 11154 if (!features().chromium_path_rendering) { | |
| 11155 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glStencilStrokePathCHROMIUM", | |
| 11156 "function not available"); | |
| 11157 return error::kNoError; | |
| 11158 } | |
| 11159 | |
| 11160 error::Error path_error = error::kNoError; | |
| 11161 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 11162 if (path_error != error::kNoError) { | |
| 11163 return error::kNoError; | |
| 11164 } | |
| 11165 GLint reference = static_cast<GLint>(c.reference); | |
| 11166 GLuint mask = static_cast<GLuint>(c.mask); | |
| 11167 ApplyDirtyState(); | |
| 11168 glStencilStrokePathNV(service_id, reference, mask); | |
| 11169 return error::kNoError; | |
| 11170 } | |
| 11171 | |
| 11172 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM( | |
| 11173 uint32 immediate_data_size, | |
| 11174 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c) { | |
| 11175 if (!features().chromium_path_rendering) { | |
| 11176 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | |
| 11177 "glStencilStrokePathInstancedCHROMIUM", | |
| 11178 "function not available"); | |
| 11179 return error::kNoError; | |
| 11180 } | |
| 11181 | |
| 11182 TRACE_EVENT0("gpu", | |
| 11183 "GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM"); | |
| 11184 | |
| 11185 GLsizei numPaths = static_cast<GLsizei>(c.numPaths); | |
| 11186 GLenum pathNameType = static_cast<GLenum>(c.pathNameType); | |
| 11187 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
| 11188 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
| 11189 GLuint pathBase = static_cast<GLuint>(c.pathBase); | |
| 11190 GLuint ref = static_cast<GLuint>(c.ref); | |
| 11191 GLuint mask = static_cast<GLuint>(c.mask); | |
| 11192 GLenum transformType = static_cast<GLenum>(c.transformType); | |
| 11193 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
| 11194 uint32 transforms_shm_offset = | |
| 11195 static_cast<uint32>(c.transformValues_shm_offset); | |
| 11196 | |
| 11197 if (numPaths < 0) { | |
| 11198 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | |
| 11199 "glCoverStrokePathInstancedCHROMIUM", | |
| 11200 "numPaths < 0"); | |
| 11201 return error::kNoError; | |
| 11202 } | |
| 11203 | |
| 11204 if (!validators_->path_name_type.IsValid(pathNameType)) { | |
| 11205 LOCAL_SET_GL_ERROR_INVALID_ENUM("glStencilStrokePathInstancedCHROMIUM", | |
| 11206 pathNameType, "pathNameType"); | |
| 11207 return error::kNoError; | |
| 11208 } | |
| 11209 | |
| 11210 if (!validators_->path_transform_type.IsValid(transformType)) { | |
| 11211 LOCAL_SET_GL_ERROR_INVALID_ENUM("glStencilStrokePathInstancedCHROMIUM", | |
| 11212 transformType, "transformType"); | |
| 11213 return error::kNoError; | |
| 11214 } | |
| 11215 | |
| 11216 | |
| 11217 DCHECK(pathNameType == GL_UNSIGNED_INT); | |
| 11218 | |
| 11219 GLuint* paths; | |
| 11220 const GLfloat* transforms; | |
| 11221 | |
| 11222 error::Error prepare_error = | |
| 11223 PrepareInstancedPathCommand(static_cast<uint32_t>(numPaths), | |
| 11224 paths_shm_id, | |
| 11225 paths_shm_offset, | |
| 11226 pathBase, | |
| 11227 transformType, | |
| 11228 transforms_shm_id, | |
| 11229 transforms_shm_offset, | |
| 11230 &paths, | |
| 11231 &transforms); | |
| 11232 | |
| 11233 if (prepare_error != error::kNoError) { | |
| 11234 return prepare_error; | |
| 11235 } | |
| 11236 | |
| 11237 ApplyDirtyState(); | |
| 11238 glStencilStrokePathInstancedNV(numPaths, | |
| 11239 GL_UNSIGNED_INT, | |
| 11240 paths, | |
| 11241 0, | |
| 11242 ref, | |
| 11243 mask, | |
| 11244 transformType, | |
| 11245 transforms); | |
| 11246 | |
| 11247 return error::kNoError; | |
| 11248 } | |
| 11249 | |
| 11250 error::Error GLES2DecoderImpl::HandlePathTexGenCHROMIUM( | |
| 11251 uint32 immediate_data_size, | |
| 11252 const gles2::cmds::PathTexGenCHROMIUM& c) { | |
| 11253 if (!features().chromium_path_rendering) { | |
| 11254 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glPathTexGenCHROMIUM", | |
| 11255 "function not available"); | |
| 11256 return error::kNoError; | |
| 11257 } | |
| 11258 | |
| 11259 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePathTexGenCHROMIUM"); | |
| 11260 GLenum texCoordSet = static_cast<GLenum>(c.texCoordSet); | |
| 11261 GLenum genMode = static_cast<GLenum>(c.genMode); | |
| 11262 GLint components = static_cast<GLint>(c.components); | |
| 11263 uint32 buffer_shm_id = static_cast<uint32>(c.coeffs_shm_id); | |
| 11264 uint32 buffer_shm_offset = static_cast<uint32>(c.coeffs_shm_offset); | |
| 11265 | |
| 11266 if (!validators_->path_gen_mode.IsValid(genMode)) { | |
| 11267 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPathTexGenCHROMIUM", | |
| 11268 genMode, "genMode"); | |
| 11269 return error::kNoError; | |
| 11270 } | |
| 11271 | |
| 11272 if (components < 0 || components > 4) { | |
| 11273 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glPathTexGenCHROMIUM", | |
| 11274 "4 < components < 0"); | |
| 11275 return error::kNoError; | |
| 11276 } | |
| 11277 | |
| 11278 uint32 coeffs_size = | |
| 11279 sizeof(GLfloat) * components * (genMode == GL_EYE_LINEAR_CHROMIUM ? 4 : 3); | |
|
piman
2014/04/24 22:26:36
We'll want a safe multiply here. base::CheckedNume
| |
| 11280 | |
| 11281 if (coeffs_size < 0) { | |
|
piman
2014/04/24 22:26:36
This can't happen.
| |
| 11282 return error::kOutOfBounds; | |
| 11283 } | |
| 11284 const GLfloat* coeffs = NULL; | |
| 11285 if (buffer_shm_id != 0 || buffer_shm_offset != 0) { | |
| 11286 coeffs = GetSharedMemoryAs<const GLfloat*>( | |
| 11287 buffer_shm_id, buffer_shm_offset, coeffs_size); | |
| 11288 if (!coeffs) { | |
| 11289 return error::kOutOfBounds; | |
| 11290 } | |
| 11291 } | |
| 11292 glPathTexGenNV(texCoordSet, genMode, components, coeffs); | |
| 11293 return error::kNoError; | |
| 11294 } | |
| 11295 | |
| 11296 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM( | |
| 11297 uint32 immediate_data_size, | |
| 11298 const gles2::cmds::CoverFillPathCHROMIUM& c) { | |
| 11299 if (!features().chromium_path_rendering) { | |
| 11300 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCoverFillPathCHROMIUM", | |
| 11301 "function not available"); | |
| 11302 return error::kNoError; | |
| 11303 } | |
| 11304 | |
| 11305 GLenum coverMode = static_cast<GLenum>(c.coverMode); | |
| 11306 if (!validators_->path_cover_mode.IsValid(coverMode)) { | |
| 11307 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverFillPathCHROMIUM", | |
| 11308 coverMode, "coverMode"); | |
| 11309 return error::kNoError; | |
| 11310 } | |
| 11311 | |
| 11312 error::Error path_error = error::kNoError; | |
| 11313 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 11314 if (path_error != error::kNoError) { | |
| 11315 return error::kNoError; | |
| 11316 } | |
| 11317 | |
| 11318 ApplyDirtyState(); | |
| 11319 glCoverFillPathNV(service_id, coverMode); | |
| 11320 return error::kNoError; | |
| 11321 } | |
| 11322 | |
| 11323 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM( | |
| 11324 uint32 immediate_data_size, | |
| 11325 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c) { | |
| 11326 if (!features().chromium_path_rendering) { | |
| 11327 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCoverFillPathInstancedCHROMIUM", | |
| 11328 "function not available"); | |
| 11329 return error::kNoError; | |
| 11330 } | |
| 11331 | |
| 11332 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM"); | |
| 11333 | |
| 11334 GLsizei numPaths = static_cast<GLsizei>(c.numPaths); | |
| 11335 GLenum pathNameType = static_cast<GLenum>(c.pathNameType); | |
| 11336 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
| 11337 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
| 11338 GLuint pathBase = static_cast<GLuint>(c.pathBase); | |
| 11339 GLenum coverMode = static_cast<GLuint>(c.coverMode); | |
| 11340 GLenum transformType = static_cast<GLenum>(c.transformType); | |
| 11341 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
| 11342 uint32 transforms_shm_offset = | |
| 11343 static_cast<uint32>(c.transformValues_shm_offset); | |
| 11344 | |
| 11345 if (numPaths < 0) { | |
| 11346 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | |
| 11347 "glCoverStrokePathInstancedCHROMIUM", | |
| 11348 "numPaths < 0"); | |
| 11349 return error::kNoError; | |
| 11350 } | |
| 11351 | |
| 11352 if (!validators_->path_name_type.IsValid(pathNameType)) { | |
| 11353 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverFillPathInstancedCHROMIUM", | |
| 11354 pathNameType, "pathNameType"); | |
| 11355 return error::kNoError; | |
| 11356 } | |
| 11357 | |
| 11358 if (!validators_->path_cover_mode_instanced.IsValid(coverMode)) { | |
| 11359 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverFillPathInstancedCHROMIUM", | |
| 11360 coverMode, "coverMode"); | |
| 11361 return error::kNoError; | |
| 11362 } | |
| 11363 | |
| 11364 if (!validators_->path_transform_type.IsValid(transformType)) { | |
| 11365 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverFillPathInstancedCHROMIUM", | |
| 11366 transformType, "transformType"); | |
| 11367 return error::kNoError; | |
| 11368 } | |
| 11369 | |
| 11370 DCHECK(pathNameType == GL_UNSIGNED_INT); | |
| 11371 | |
| 11372 GLuint* paths; | |
| 11373 const GLfloat* transforms; | |
| 11374 | |
| 11375 error::Error prepare_error = | |
| 11376 PrepareInstancedPathCommand(static_cast<uint32_t>(numPaths), | |
| 11377 paths_shm_id, | |
| 11378 paths_shm_offset, | |
| 11379 pathBase, | |
| 11380 transformType, | |
| 11381 transforms_shm_id, | |
| 11382 transforms_shm_offset, | |
| 11383 &paths, | |
| 11384 &transforms); | |
| 11385 | |
| 11386 if (prepare_error != error::kNoError) { | |
| 11387 return prepare_error; | |
| 11388 } | |
| 11389 | |
| 11390 ApplyDirtyState(); | |
| 11391 glCoverFillPathInstancedNV(numPaths, | |
| 11392 GL_UNSIGNED_INT, | |
| 11393 paths, | |
| 11394 0, | |
| 11395 coverMode, | |
| 11396 transformType, | |
| 11397 transforms); | |
| 11398 | |
| 11399 return error::kNoError; | |
| 11400 } | |
| 11401 | |
| 11402 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM( | |
| 11403 uint32 immediate_data_size, | |
| 11404 const gles2::cmds::CoverStrokePathCHROMIUM& c) { | |
| 11405 if (!features().chromium_path_rendering) { | |
| 11406 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCoverStrokePathCHROMIUM", | |
| 11407 "function not available"); | |
| 11408 return error::kNoError; | |
| 11409 } | |
| 11410 error::Error path_error = error::kNoError; | |
| 11411 GLuint service_id = GetPath(static_cast<GLuint>(c.path), &path_error); | |
| 11412 if (path_error != error::kNoError) { | |
| 11413 return error::kNoError; | |
| 11414 } | |
| 11415 | |
| 11416 GLenum coverMode = static_cast<GLenum>(c.coverMode); | |
| 11417 if (!validators_->path_cover_mode.IsValid(coverMode)) { | |
| 11418 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverStrokePathCHROMIUM", | |
| 11419 coverMode, "coverMode"); | |
| 11420 return error::kNoError; | |
| 11421 } | |
| 11422 | |
| 11423 ApplyDirtyState(); | |
| 11424 glCoverStrokePathNV(service_id, coverMode); | |
| 11425 return error::kNoError; | |
| 11426 } | |
| 11427 | |
| 11428 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM( | |
| 11429 uint32 immediate_data_size, | |
| 11430 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c) { | |
| 11431 if (!features().chromium_path_rendering) { | |
| 11432 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | |
| 11433 "glCoverStrokePathInstancedCHROMIUM", | |
| 11434 "function not available"); | |
| 11435 return error::kNoError; | |
| 11436 } | |
| 11437 TRACE_EVENT0("gpu", | |
| 11438 "GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM"); | |
| 11439 | |
| 11440 GLsizei numPaths = static_cast<GLsizei>(c.numPaths); | |
| 11441 GLenum pathNameType = static_cast<GLenum>(c.pathNameType); | |
| 11442 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
| 11443 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
| 11444 GLuint pathBase = static_cast<GLuint>(c.pathBase); | |
| 11445 GLenum coverMode = static_cast<GLuint>(c.coverMode); | |
| 11446 GLenum transformType = static_cast<GLenum>(c.transformType); | |
| 11447 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
| 11448 uint32 transforms_shm_offset = | |
| 11449 static_cast<uint32>(c.transformValues_shm_offset); | |
| 11450 | |
| 11451 if (numPaths < 0) { | |
| 11452 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | |
| 11453 "glCoverStrokePathInstancedCHROMIUM", | |
| 11454 "numPaths < 0"); | |
| 11455 return error::kNoError; | |
| 11456 } | |
| 11457 | |
| 11458 if (!validators_->path_name_type.IsValid(pathNameType)) { | |
| 11459 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverStrokePathInstancedCHROMIUM", | |
| 11460 pathNameType, "pathNameType"); | |
| 11461 return error::kNoError; | |
| 11462 } | |
| 11463 | |
| 11464 if (!validators_->path_cover_mode_instanced.IsValid(coverMode)) { | |
| 11465 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverStrokePathInstancedCHROMIUM", | |
| 11466 coverMode, "coverMode"); | |
| 11467 return error::kNoError; | |
| 11468 } | |
| 11469 | |
| 11470 if (!validators_->path_transform_type.IsValid(transformType)) { | |
| 11471 LOCAL_SET_GL_ERROR_INVALID_ENUM("glCoverStrokePathInstancedCHROMIUM", | |
| 11472 transformType, "transformType"); | |
| 11473 return error::kNoError; | |
| 11474 } | |
| 11475 | |
| 11476 DCHECK(pathNameType == GL_UNSIGNED_INT); | |
| 11477 | |
| 11478 GLuint* paths; | |
| 11479 const GLfloat* transforms; | |
| 11480 | |
| 11481 error::Error prepare_error = | |
| 11482 PrepareInstancedPathCommand(static_cast<uint32_t>(numPaths), | |
| 11483 paths_shm_id, | |
| 11484 paths_shm_offset, | |
| 11485 pathBase, | |
| 11486 transformType, | |
| 11487 transforms_shm_id, | |
| 11488 transforms_shm_offset, | |
| 11489 &paths, | |
| 11490 &transforms); | |
| 11491 | |
| 11492 if (prepare_error != error::kNoError) { | |
| 11493 return prepare_error; | |
| 11494 } | |
| 11495 | |
| 11496 ApplyDirtyState(); | |
| 11497 glCoverStrokePathInstancedNV(numPaths, | |
| 11498 GL_UNSIGNED_INT, | |
| 11499 paths, | |
| 11500 0, | |
| 11501 coverMode, | |
| 11502 transformType, | |
| 11503 transforms); | |
| 11504 return error::kNoError; | |
| 11505 } | |
| 11506 | |
| 10788 // Include the auto-generated part of this file. We split this because it means | 11507 // Include the auto-generated part of this file. We split this because it means |
| 10789 // we can easily edit the non-auto generated parts right here in this file | 11508 // we can easily edit the non-auto generated parts right here in this file |
| 10790 // instead of having to edit some template or the code generator. | 11509 // instead of having to edit some template or the code generator. |
| 10791 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11510 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 10792 | 11511 |
| 10793 } // namespace gles2 | 11512 } // namespace gles2 |
| 10794 } // namespace gpu | 11513 } // namespace gpu |
| OLD | NEW |