| 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 <stddef.h> |
| 8 #include <stdint.h> |
| 7 #include <stdio.h> | 9 #include <stdio.h> |
| 8 | 10 |
| 9 #include <algorithm> | 11 #include <algorithm> |
| 10 #include <cmath> | 12 #include <cmath> |
| 11 #include <list> | 13 #include <list> |
| 12 #include <map> | 14 #include <map> |
| 13 #include <queue> | 15 #include <queue> |
| 14 | 16 |
| 15 #include "base/callback.h" | 17 #include "base/callback.h" |
| 16 #include "base/callback_helpers.h" | 18 #include "base/callback_helpers.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 PerformanceWarning(__FILE__, __LINE__, msg) | 223 PerformanceWarning(__FILE__, __LINE__, msg) |
| 222 #define LOCAL_RENDER_WARNING(msg) \ | 224 #define LOCAL_RENDER_WARNING(msg) \ |
| 223 RenderWarning(__FILE__, __LINE__, msg) | 225 RenderWarning(__FILE__, __LINE__, msg) |
| 224 | 226 |
| 225 // Check that certain assumptions the code makes are true. There are places in | 227 // Check that certain assumptions the code makes are true. There are places in |
| 226 // the code where shared memory is passed direclty to GL. Example, glUniformiv, | 228 // the code where shared memory is passed direclty to GL. Example, glUniformiv, |
| 227 // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe | 229 // glShaderSource. The command buffer code assumes GLint and GLsizei (and maybe |
| 228 // a few others) are 32bits. If they are not 32bits the code will have to change | 230 // a few others) are 32bits. If they are not 32bits the code will have to change |
| 229 // to call those GL functions with service side memory and then copy the results | 231 // to call those GL functions with service side memory and then copy the results |
| 230 // to shared memory, converting the sizes. | 232 // to shared memory, converting the sizes. |
| 231 static_assert(sizeof(GLint) == sizeof(uint32), // NOLINT | 233 static_assert(sizeof(GLint) == sizeof(uint32_t), // NOLINT |
| 232 "GLint should be the same size as uint32"); | 234 "GLint should be the same size as uint32_t"); |
| 233 static_assert(sizeof(GLsizei) == sizeof(uint32), // NOLINT | 235 static_assert(sizeof(GLsizei) == sizeof(uint32_t), // NOLINT |
| 234 "GLsizei should be the same size as uint32"); | 236 "GLsizei should be the same size as uint32_t"); |
| 235 static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT | 237 static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT |
| 236 "GLfloat should be the same size as float"); | 238 "GLfloat should be the same size as float"); |
| 237 | 239 |
| 238 // TODO(kbr): the use of this anonymous namespace core dumps the | 240 // TODO(kbr): the use of this anonymous namespace core dumps the |
| 239 // linker on Mac OS X 10.6 when the symbol ordering file is used | 241 // linker on Mac OS X 10.6 when the symbol ordering file is used |
| 240 // namespace { | 242 // namespace { |
| 241 | 243 |
| 242 // Returns the address of the first byte after a struct. | 244 // Returns the address of the first byte after a struct. |
| 243 template <typename T> | 245 template <typename T> |
| 244 const void* AddressAfterStruct(const T& pod) { | 246 const void* AddressAfterStruct(const T& pod) { |
| 245 return reinterpret_cast<const uint8*>(&pod) + sizeof(pod); | 247 return reinterpret_cast<const uint8_t*>(&pod) + sizeof(pod); |
| 246 } | 248 } |
| 247 | 249 |
| 248 // Returns the address of the frst byte after the struct or NULL if size > | 250 // Returns the address of the frst byte after the struct or NULL if size > |
| 249 // immediate_data_size. | 251 // immediate_data_size. |
| 250 template <typename RETURN_TYPE, typename COMMAND_TYPE> | 252 template <typename RETURN_TYPE, typename COMMAND_TYPE> |
| 251 RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod, | 253 RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod, |
| 252 uint32 size, | 254 uint32_t size, |
| 253 uint32 immediate_data_size) { | 255 uint32_t immediate_data_size) { |
| 254 return (size <= immediate_data_size) ? | 256 return (size <= immediate_data_size) ? |
| 255 static_cast<RETURN_TYPE>(const_cast<void*>(AddressAfterStruct(pod))) : | 257 static_cast<RETURN_TYPE>(const_cast<void*>(AddressAfterStruct(pod))) : |
| 256 NULL; | 258 NULL; |
| 257 } | 259 } |
| 258 | 260 |
| 259 // Computes the data size for certain gl commands like glUniform. | 261 // Computes the data size for certain gl commands like glUniform. |
| 260 bool ComputeDataSize( | 262 bool ComputeDataSize(GLuint count, |
| 261 GLuint count, | 263 size_t size, |
| 262 size_t size, | 264 unsigned int elements_per_unit, |
| 263 unsigned int elements_per_unit, | 265 uint32_t* dst) { |
| 264 uint32* dst) { | 266 uint32_t value; |
| 265 uint32 value; | |
| 266 if (!SafeMultiplyUint32(count, size, &value)) { | 267 if (!SafeMultiplyUint32(count, size, &value)) { |
| 267 return false; | 268 return false; |
| 268 } | 269 } |
| 269 if (!SafeMultiplyUint32(value, elements_per_unit, &value)) { | 270 if (!SafeMultiplyUint32(value, elements_per_unit, &value)) { |
| 270 return false; | 271 return false; |
| 271 } | 272 } |
| 272 *dst = value; | 273 *dst = value; |
| 273 return true; | 274 return true; |
| 274 } | 275 } |
| 275 | 276 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 std::vector<base::Closure> callbacks; | 494 std::vector<base::Closure> callbacks; |
| 494 scoped_ptr<gfx::GLFence> fence; | 495 scoped_ptr<gfx::GLFence> fence; |
| 495 }; | 496 }; |
| 496 | 497 |
| 497 // } // anonymous namespace. | 498 // } // anonymous namespace. |
| 498 | 499 |
| 499 // static | 500 // static |
| 500 const unsigned int GLES2Decoder::kDefaultStencilMask = | 501 const unsigned int GLES2Decoder::kDefaultStencilMask = |
| 501 static_cast<unsigned int>(-1); | 502 static_cast<unsigned int>(-1); |
| 502 | 503 |
| 503 bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id, | 504 bool GLES2Decoder::GetServiceTextureId(uint32_t client_texture_id, |
| 504 uint32* service_texture_id) { | 505 uint32_t* service_texture_id) { |
| 505 return false; | 506 return false; |
| 506 } | 507 } |
| 507 | 508 |
| 508 uint32 GLES2Decoder::GetAndClearBackbufferClearBitsForTest() { | 509 uint32_t GLES2Decoder::GetAndClearBackbufferClearBitsForTest() { |
| 509 return 0; | 510 return 0; |
| 510 } | 511 } |
| 511 | 512 |
| 512 GLES2Decoder::GLES2Decoder() | 513 GLES2Decoder::GLES2Decoder() |
| 513 : initialized_(false), | 514 : initialized_(false), |
| 514 debug_(false), | 515 debug_(false), |
| 515 log_commands_(false), | 516 log_commands_(false), |
| 516 unsafe_es3_apis_enabled_(false) { | 517 unsafe_es3_apis_enabled_(false) { |
| 517 } | 518 } |
| 518 | 519 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 548 | 549 |
| 549 // Overridden from AsyncAPIInterface. | 550 // Overridden from AsyncAPIInterface. |
| 550 const char* GetCommandName(unsigned int command_id) const override; | 551 const char* GetCommandName(unsigned int command_id) const override; |
| 551 | 552 |
| 552 // Overridden from GLES2Decoder. | 553 // Overridden from GLES2Decoder. |
| 553 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, | 554 bool Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
| 554 const scoped_refptr<gfx::GLContext>& context, | 555 const scoped_refptr<gfx::GLContext>& context, |
| 555 bool offscreen, | 556 bool offscreen, |
| 556 const gfx::Size& offscreen_size, | 557 const gfx::Size& offscreen_size, |
| 557 const DisallowedFeatures& disallowed_features, | 558 const DisallowedFeatures& disallowed_features, |
| 558 const std::vector<int32>& attribs) override; | 559 const std::vector<int32_t>& attribs) override; |
| 559 void Destroy(bool have_context) override; | 560 void Destroy(bool have_context) override; |
| 560 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; | 561 void SetSurface(const scoped_refptr<gfx::GLSurface>& surface) override; |
| 561 void ProduceFrontBuffer(const Mailbox& mailbox) override; | 562 void ProduceFrontBuffer(const Mailbox& mailbox) override; |
| 562 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; | 563 bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override; |
| 563 void UpdateParentTextureInfo(); | 564 void UpdateParentTextureInfo(); |
| 564 bool MakeCurrent() override; | 565 bool MakeCurrent() override; |
| 565 GLES2Util* GetGLES2Util() override { return &util_; } | 566 GLES2Util* GetGLES2Util() override { return &util_; } |
| 566 gfx::GLContext* GetGLContext() override { return context_.get(); } | 567 gfx::GLContext* GetGLContext() override { return context_.get(); } |
| 567 ContextGroup* GetContextGroup() override { return group_.get(); } | 568 ContextGroup* GetContextGroup() override { return group_.get(); } |
| 568 Capabilities GetCapabilities() override; | 569 Capabilities GetCapabilities() override; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 const ContextState* GetContextState() override { return &state_; } | 621 const ContextState* GetContextState() override { return &state_; } |
| 621 | 622 |
| 622 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; | 623 void SetShaderCacheCallback(const ShaderCacheCallback& callback) override; |
| 623 void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; | 624 void SetWaitSyncPointCallback(const WaitSyncPointCallback& callback) override; |
| 624 void SetFenceSyncReleaseCallback( | 625 void SetFenceSyncReleaseCallback( |
| 625 const FenceSyncReleaseCallback& callback) override; | 626 const FenceSyncReleaseCallback& callback) override; |
| 626 void SetWaitFenceSyncCallback(const WaitFenceSyncCallback& callback) override; | 627 void SetWaitFenceSyncCallback(const WaitFenceSyncCallback& callback) override; |
| 627 | 628 |
| 628 void SetIgnoreCachedStateForTest(bool ignore) override; | 629 void SetIgnoreCachedStateForTest(bool ignore) override; |
| 629 void SetForceShaderNameHashingForTest(bool force) override; | 630 void SetForceShaderNameHashingForTest(bool force) override; |
| 630 uint32 GetAndClearBackbufferClearBitsForTest() override; | 631 uint32_t GetAndClearBackbufferClearBitsForTest() override; |
| 631 void ProcessFinishedAsyncTransfers(); | 632 void ProcessFinishedAsyncTransfers(); |
| 632 | 633 |
| 633 bool GetServiceTextureId(uint32 client_texture_id, | 634 bool GetServiceTextureId(uint32_t client_texture_id, |
| 634 uint32* service_texture_id) override; | 635 uint32_t* service_texture_id) override; |
| 635 | 636 |
| 636 uint32 GetTextureUploadCount() override; | 637 uint32_t GetTextureUploadCount() override; |
| 637 base::TimeDelta GetTotalTextureUploadTime() override; | 638 base::TimeDelta GetTotalTextureUploadTime() override; |
| 638 base::TimeDelta GetTotalProcessingCommandsTime() override; | 639 base::TimeDelta GetTotalProcessingCommandsTime() override; |
| 639 void AddProcessingCommandsTime(base::TimeDelta) override; | 640 void AddProcessingCommandsTime(base::TimeDelta) override; |
| 640 | 641 |
| 641 // Restores the current state to the user's settings. | 642 // Restores the current state to the user's settings. |
| 642 void RestoreCurrentFramebufferBindings(); | 643 void RestoreCurrentFramebufferBindings(); |
| 643 | 644 |
| 644 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. | 645 // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. |
| 645 void ApplyDirtyState(); | 646 void ApplyDirtyState(); |
| 646 | 647 |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 | 1205 |
| 1205 error::Error DoBindFragDataLocationIndexed(GLuint program_id, | 1206 error::Error DoBindFragDataLocationIndexed(GLuint program_id, |
| 1206 GLuint colorName, | 1207 GLuint colorName, |
| 1207 GLuint index, | 1208 GLuint index, |
| 1208 const std::string& name); | 1209 const std::string& name); |
| 1209 | 1210 |
| 1210 void DoBindUniformLocationCHROMIUM(GLuint client_id, | 1211 void DoBindUniformLocationCHROMIUM(GLuint client_id, |
| 1211 GLint location, | 1212 GLint location, |
| 1212 const std::string& name); | 1213 const std::string& name); |
| 1213 | 1214 |
| 1214 error::Error GetAttribLocationHelper( | 1215 error::Error GetAttribLocationHelper(GLuint client_id, |
| 1215 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1216 uint32_t location_shm_id, |
| 1216 const std::string& name_str); | 1217 uint32_t location_shm_offset, |
| 1218 const std::string& name_str); |
| 1217 | 1219 |
| 1218 error::Error GetUniformLocationHelper( | 1220 error::Error GetUniformLocationHelper(GLuint client_id, |
| 1219 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1221 uint32_t location_shm_id, |
| 1220 const std::string& name_str); | 1222 uint32_t location_shm_offset, |
| 1223 const std::string& name_str); |
| 1221 | 1224 |
| 1222 error::Error GetFragDataLocationHelper( | 1225 error::Error GetFragDataLocationHelper(GLuint client_id, |
| 1223 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1226 uint32_t location_shm_id, |
| 1224 const std::string& name_str); | 1227 uint32_t location_shm_offset, |
| 1228 const std::string& name_str); |
| 1225 | 1229 |
| 1226 error::Error GetFragDataIndexHelper(GLuint program_id, | 1230 error::Error GetFragDataIndexHelper(GLuint program_id, |
| 1227 uint32 index_shm_id, | 1231 uint32_t index_shm_id, |
| 1228 uint32 index_shm_offset, | 1232 uint32_t index_shm_offset, |
| 1229 const std::string& name_str); | 1233 const std::string& name_str); |
| 1230 | 1234 |
| 1231 // Wrapper for glShaderSource. | 1235 // Wrapper for glShaderSource. |
| 1232 void DoShaderSource( | 1236 void DoShaderSource( |
| 1233 GLuint client_id, GLsizei count, const char** data, const GLint* length); | 1237 GLuint client_id, GLsizei count, const char** data, const GLint* length); |
| 1234 | 1238 |
| 1235 // Wrapper for glTransformFeedbackVaryings. | 1239 // Wrapper for glTransformFeedbackVaryings. |
| 1236 void DoTransformFeedbackVaryings( | 1240 void DoTransformFeedbackVaryings( |
| 1237 GLuint client_program_id, GLsizei count, const char* const* varyings, | 1241 GLuint client_program_id, GLsizei count, const char* const* varyings, |
| 1238 GLenum buffer_mode); | 1242 GLenum buffer_mode); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 const char* function_name, | 1706 const char* function_name, |
| 1703 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); | 1707 GLuint max_vertex_accessed, bool* simulated, GLsizei primcount); |
| 1704 void RestoreStateForSimulatedFixedAttribs(); | 1708 void RestoreStateForSimulatedFixedAttribs(); |
| 1705 | 1709 |
| 1706 // Handle DrawArrays and DrawElements for both instanced and non-instanced | 1710 // Handle DrawArrays and DrawElements for both instanced and non-instanced |
| 1707 // cases (primcount is always 1 for non-instanced). | 1711 // cases (primcount is always 1 for non-instanced). |
| 1708 error::Error DoDrawArrays( | 1712 error::Error DoDrawArrays( |
| 1709 const char* function_name, | 1713 const char* function_name, |
| 1710 bool instanced, GLenum mode, GLint first, GLsizei count, | 1714 bool instanced, GLenum mode, GLint first, GLsizei count, |
| 1711 GLsizei primcount); | 1715 GLsizei primcount); |
| 1712 error::Error DoDrawElements( | 1716 error::Error DoDrawElements(const char* function_name, |
| 1713 const char* function_name, | 1717 bool instanced, |
| 1714 bool instanced, GLenum mode, GLsizei count, GLenum type, | 1718 GLenum mode, |
| 1715 int32 offset, GLsizei primcount); | 1719 GLsizei count, |
| 1720 GLenum type, |
| 1721 int32_t offset, |
| 1722 GLsizei primcount); |
| 1716 | 1723 |
| 1717 GLenum GetBindTargetForSamplerType(GLenum type) { | 1724 GLenum GetBindTargetForSamplerType(GLenum type) { |
| 1718 DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || | 1725 DCHECK(type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE || |
| 1719 type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB); | 1726 type == GL_SAMPLER_EXTERNAL_OES || type == GL_SAMPLER_2D_RECT_ARB); |
| 1720 switch (type) { | 1727 switch (type) { |
| 1721 case GL_SAMPLER_2D: | 1728 case GL_SAMPLER_2D: |
| 1722 return GL_TEXTURE_2D; | 1729 return GL_TEXTURE_2D; |
| 1723 case GL_SAMPLER_CUBE: | 1730 case GL_SAMPLER_CUBE: |
| 1724 return GL_TEXTURE_CUBE_MAP; | 1731 return GL_TEXTURE_CUBE_MAP; |
| 1725 case GL_SAMPLER_EXTERNAL_OES: | 1732 case GL_SAMPLER_EXTERNAL_OES: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 } | 1770 } |
| 1764 return renderbuffer; | 1771 return renderbuffer; |
| 1765 } | 1772 } |
| 1766 | 1773 |
| 1767 // Validates the program and location for a glGetUniform call and returns | 1774 // Validates the program and location for a glGetUniform call and returns |
| 1768 // a SizeResult setup to receive the result. Returns true if glGetUniform | 1775 // a SizeResult setup to receive the result. Returns true if glGetUniform |
| 1769 // should be called. | 1776 // should be called. |
| 1770 template <class T> | 1777 template <class T> |
| 1771 bool GetUniformSetup(GLuint program, | 1778 bool GetUniformSetup(GLuint program, |
| 1772 GLint fake_location, | 1779 GLint fake_location, |
| 1773 uint32 shm_id, | 1780 uint32_t shm_id, |
| 1774 uint32 shm_offset, | 1781 uint32_t shm_offset, |
| 1775 error::Error* error, | 1782 error::Error* error, |
| 1776 GLint* real_location, | 1783 GLint* real_location, |
| 1777 GLuint* service_id, | 1784 GLuint* service_id, |
| 1778 SizedResult<T>** result, | 1785 SizedResult<T>** result, |
| 1779 GLenum* result_type, | 1786 GLenum* result_type, |
| 1780 GLsizei* result_size); | 1787 GLsizei* result_size); |
| 1781 | 1788 |
| 1782 bool WasContextLost() const override; | 1789 bool WasContextLost() const override; |
| 1783 bool WasContextLostByRobustnessExtension() const override; | 1790 bool WasContextLostByRobustnessExtension() const override; |
| 1784 void MarkContextLost(error::ContextLostReason reason) override; | 1791 void MarkContextLost(error::ContextLostReason reason) override; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 void ProcessPendingReadPixels(bool did_finish); | 1887 void ProcessPendingReadPixels(bool did_finish); |
| 1881 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); | 1888 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); |
| 1882 | 1889 |
| 1883 void DoBindFragmentInputLocationCHROMIUM(GLuint program_id, | 1890 void DoBindFragmentInputLocationCHROMIUM(GLuint program_id, |
| 1884 GLint location, | 1891 GLint location, |
| 1885 const std::string& name); | 1892 const std::string& name); |
| 1886 | 1893 |
| 1887 // Generate a member function prototype for each command in an automated and | 1894 // Generate a member function prototype for each command in an automated and |
| 1888 // typesafe way. | 1895 // typesafe way. |
| 1889 #define GLES2_CMD_OP(name) \ | 1896 #define GLES2_CMD_OP(name) \ |
| 1890 Error Handle##name(uint32 immediate_data_size, const void* data); | 1897 Error Handle##name(uint32_t immediate_data_size, const void* data); |
| 1891 | 1898 |
| 1892 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 1899 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
| 1893 | 1900 |
| 1894 #undef GLES2_CMD_OP | 1901 #undef GLES2_CMD_OP |
| 1895 | 1902 |
| 1896 // The GL context this decoder renders to on behalf of the client. | 1903 // The GL context this decoder renders to on behalf of the client. |
| 1897 scoped_refptr<gfx::GLSurface> surface_; | 1904 scoped_refptr<gfx::GLSurface> surface_; |
| 1898 scoped_refptr<gfx::GLContext> context_; | 1905 scoped_refptr<gfx::GLContext> context_; |
| 1899 | 1906 |
| 1900 // The ContextGroup for this decoder uses to track resources. | 1907 // The ContextGroup for this decoder uses to track resources. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 // Tracks read buffer and draw buffer for backbuffer, whether it's onscreen | 1983 // Tracks read buffer and draw buffer for backbuffer, whether it's onscreen |
| 1977 // or offscreen. | 1984 // or offscreen. |
| 1978 // TODO(zmo): when ES3 APIs are exposed to Nacl, make sure read_buffer_ | 1985 // TODO(zmo): when ES3 APIs are exposed to Nacl, make sure read_buffer_ |
| 1979 // setting is set correctly when SwapBuffers(). | 1986 // setting is set correctly when SwapBuffers(). |
| 1980 GLenum back_buffer_read_buffer_; | 1987 GLenum back_buffer_read_buffer_; |
| 1981 GLenum back_buffer_draw_buffer_; | 1988 GLenum back_buffer_draw_buffer_; |
| 1982 | 1989 |
| 1983 bool surfaceless_; | 1990 bool surfaceless_; |
| 1984 | 1991 |
| 1985 // Backbuffer attachments that are currently undefined. | 1992 // Backbuffer attachments that are currently undefined. |
| 1986 uint32 backbuffer_needs_clear_bits_; | 1993 uint32_t backbuffer_needs_clear_bits_; |
| 1987 | 1994 |
| 1988 // The current decoder error communicates the decoder error through command | 1995 // The current decoder error communicates the decoder error through command |
| 1989 // processing functions that do not return the error value. Should be set only | 1996 // processing functions that do not return the error value. Should be set only |
| 1990 // if not returning an error. | 1997 // if not returning an error. |
| 1991 error::Error current_decoder_error_; | 1998 error::Error current_decoder_error_; |
| 1992 | 1999 |
| 1993 scoped_refptr<ShaderTranslatorInterface> vertex_translator_; | 2000 scoped_refptr<ShaderTranslatorInterface> vertex_translator_; |
| 1994 scoped_refptr<ShaderTranslatorInterface> fragment_translator_; | 2001 scoped_refptr<ShaderTranslatorInterface> fragment_translator_; |
| 1995 | 2002 |
| 1996 DisallowedFeatures disallowed_features_; | 2003 DisallowedFeatures disallowed_features_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 bool gpu_debug_commands_; | 2066 bool gpu_debug_commands_; |
| 2060 | 2067 |
| 2061 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; | 2068 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
| 2062 | 2069 |
| 2063 // Used to validate multisample renderbuffers if needed | 2070 // Used to validate multisample renderbuffers if needed |
| 2064 GLuint validation_texture_; | 2071 GLuint validation_texture_; |
| 2065 GLuint validation_fbo_multisample_; | 2072 GLuint validation_fbo_multisample_; |
| 2066 GLuint validation_fbo_; | 2073 GLuint validation_fbo_; |
| 2067 | 2074 |
| 2068 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( | 2075 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( |
| 2069 uint32 immediate_data_size, | 2076 uint32_t immediate_data_size, |
| 2070 const void* data); | 2077 const void* data); |
| 2071 | 2078 |
| 2072 // A struct to hold info about each command. | 2079 // A struct to hold info about each command. |
| 2073 struct CommandInfo { | 2080 struct CommandInfo { |
| 2074 CmdHandler cmd_handler; | 2081 CmdHandler cmd_handler; |
| 2075 uint8 arg_flags; // How to handle the arguments for this command | 2082 uint8_t arg_flags; // How to handle the arguments for this command |
| 2076 uint8 cmd_flags; // How to handle this command | 2083 uint8_t cmd_flags; // How to handle this command |
| 2077 uint16 arg_count; // How many arguments are expected for this command. | 2084 uint16_t arg_count; // How many arguments are expected for this command. |
| 2078 }; | 2085 }; |
| 2079 | 2086 |
| 2080 // A table of CommandInfo for all the commands. | 2087 // A table of CommandInfo for all the commands. |
| 2081 static const CommandInfo command_info[kNumCommands - kStartPoint]; | 2088 static const CommandInfo command_info[kNumCommands - kStartPoint]; |
| 2082 | 2089 |
| 2083 bool force_shader_name_hashing_for_test; | 2090 bool force_shader_name_hashing_for_test; |
| 2084 | 2091 |
| 2085 GLfloat line_width_range_[2]; | 2092 GLfloat line_width_range_[2]; |
| 2086 | 2093 |
| 2087 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); | 2094 DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 bytes_allocated_ = 16u * 16u * 4u; | 2290 bytes_allocated_ = 16u * 16u * 4u; |
| 2284 memory_tracker_.TrackMemAlloc(bytes_allocated_); | 2291 memory_tracker_.TrackMemAlloc(bytes_allocated_); |
| 2285 } | 2292 } |
| 2286 | 2293 |
| 2287 bool BackTexture::AllocateStorage( | 2294 bool BackTexture::AllocateStorage( |
| 2288 const gfx::Size& size, GLenum format, bool zero) { | 2295 const gfx::Size& size, GLenum format, bool zero) { |
| 2289 DCHECK_NE(id_, 0u); | 2296 DCHECK_NE(id_, 0u); |
| 2290 ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage", | 2297 ScopedGLErrorSuppressor suppressor("BackTexture::AllocateStorage", |
| 2291 state_->GetErrorState()); | 2298 state_->GetErrorState()); |
| 2292 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); | 2299 ScopedTextureBinder binder(state_, id_, GL_TEXTURE_2D); |
| 2293 uint32 image_size = 0; | 2300 uint32_t image_size = 0; |
| 2294 GLES2Util::ComputeImageDataSizes( | 2301 GLES2Util::ComputeImageDataSizes( |
| 2295 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, | 2302 size.width(), size.height(), 1, format, GL_UNSIGNED_BYTE, 8, &image_size, |
| 2296 NULL, NULL); | 2303 NULL, NULL); |
| 2297 | 2304 |
| 2298 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { | 2305 if (!memory_tracker_.EnsureGPUMemoryAvailable(image_size)) { |
| 2299 return false; | 2306 return false; |
| 2300 } | 2307 } |
| 2301 | 2308 |
| 2302 scoped_ptr<char[]> zero_data; | 2309 scoped_ptr<char[]> zero_data; |
| 2303 if (zero) { | 2310 if (zero) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 } | 2388 } |
| 2382 | 2389 |
| 2383 bool BackRenderbuffer::AllocateStorage(const FeatureInfo* feature_info, | 2390 bool BackRenderbuffer::AllocateStorage(const FeatureInfo* feature_info, |
| 2384 const gfx::Size& size, | 2391 const gfx::Size& size, |
| 2385 GLenum format, | 2392 GLenum format, |
| 2386 GLsizei samples) { | 2393 GLsizei samples) { |
| 2387 ScopedGLErrorSuppressor suppressor( | 2394 ScopedGLErrorSuppressor suppressor( |
| 2388 "BackRenderbuffer::AllocateStorage", state_->GetErrorState()); | 2395 "BackRenderbuffer::AllocateStorage", state_->GetErrorState()); |
| 2389 ScopedRenderBufferBinder binder(state_, id_); | 2396 ScopedRenderBufferBinder binder(state_, id_); |
| 2390 | 2397 |
| 2391 uint32 estimated_size = 0; | 2398 uint32_t estimated_size = 0; |
| 2392 if (!renderbuffer_manager_->ComputeEstimatedRenderbufferSize( | 2399 if (!renderbuffer_manager_->ComputeEstimatedRenderbufferSize( |
| 2393 size.width(), size.height(), samples, format, &estimated_size)) { | 2400 size.width(), size.height(), samples, format, &estimated_size)) { |
| 2394 return false; | 2401 return false; |
| 2395 } | 2402 } |
| 2396 | 2403 |
| 2397 if (!memory_tracker_.EnsureGPUMemoryAvailable(estimated_size)) { | 2404 if (!memory_tracker_.EnsureGPUMemoryAvailable(estimated_size)) { |
| 2398 return false; | 2405 return false; |
| 2399 } | 2406 } |
| 2400 | 2407 |
| 2401 if (samples <= 1) { | 2408 if (samples <= 1) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2563 validation_texture_(0), | 2570 validation_texture_(0), |
| 2564 validation_fbo_multisample_(0), | 2571 validation_fbo_multisample_(0), |
| 2565 validation_fbo_(0), | 2572 validation_fbo_(0), |
| 2566 force_shader_name_hashing_for_test(false) { | 2573 force_shader_name_hashing_for_test(false) { |
| 2567 DCHECK(group); | 2574 DCHECK(group); |
| 2568 } | 2575 } |
| 2569 | 2576 |
| 2570 GLES2DecoderImpl::~GLES2DecoderImpl() { | 2577 GLES2DecoderImpl::~GLES2DecoderImpl() { |
| 2571 } | 2578 } |
| 2572 | 2579 |
| 2573 bool GLES2DecoderImpl::Initialize( | 2580 bool GLES2DecoderImpl::Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
| 2574 const scoped_refptr<gfx::GLSurface>& surface, | 2581 const scoped_refptr<gfx::GLContext>& context, |
| 2575 const scoped_refptr<gfx::GLContext>& context, | 2582 bool offscreen, |
| 2576 bool offscreen, | 2583 const gfx::Size& offscreen_size, |
| 2577 const gfx::Size& offscreen_size, | 2584 const DisallowedFeatures& disallowed_features, |
| 2578 const DisallowedFeatures& disallowed_features, | 2585 const std::vector<int32_t>& attribs) { |
| 2579 const std::vector<int32>& attribs) { | |
| 2580 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); | 2586 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); |
| 2581 DCHECK(context->IsCurrent(surface.get())); | 2587 DCHECK(context->IsCurrent(surface.get())); |
| 2582 DCHECK(!context_.get()); | 2588 DCHECK(!context_.get()); |
| 2583 DCHECK(!offscreen || !offscreen_size.IsEmpty()); | 2589 DCHECK(!offscreen || !offscreen_size.IsEmpty()); |
| 2584 | 2590 |
| 2585 ContextCreationAttribHelper attrib_parser; | 2591 ContextCreationAttribHelper attrib_parser; |
| 2586 if (!attrib_parser.Parse(attribs)) | 2592 if (!attrib_parser.Parse(attribs)) |
| 2587 return false; | 2593 return false; |
| 2588 | 2594 |
| 2589 surfaceless_ = surface->IsSurfaceless() && !offscreen; | 2595 surfaceless_ = surface->IsSurfaceless() && !offscreen; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 glEnableVertexAttribArray(0); | 2699 glEnableVertexAttribArray(0); |
| 2694 } | 2700 } |
| 2695 glGenBuffersARB(1, &attrib_0_buffer_id_); | 2701 glGenBuffersARB(1, &attrib_0_buffer_id_); |
| 2696 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); | 2702 glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); |
| 2697 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); | 2703 glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); |
| 2698 glBindBuffer(GL_ARRAY_BUFFER, 0); | 2704 glBindBuffer(GL_ARRAY_BUFFER, 0); |
| 2699 glGenBuffersARB(1, &fixed_attrib_buffer_id_); | 2705 glGenBuffersARB(1, &fixed_attrib_buffer_id_); |
| 2700 | 2706 |
| 2701 state_.texture_units.resize(group_->max_texture_units()); | 2707 state_.texture_units.resize(group_->max_texture_units()); |
| 2702 state_.sampler_units.resize(group_->max_texture_units()); | 2708 state_.sampler_units.resize(group_->max_texture_units()); |
| 2703 for (uint32 tt = 0; tt < state_.texture_units.size(); ++tt) { | 2709 for (uint32_t tt = 0; tt < state_.texture_units.size(); ++tt) { |
| 2704 glActiveTexture(GL_TEXTURE0 + tt); | 2710 glActiveTexture(GL_TEXTURE0 + tt); |
| 2705 // We want the last bind to be 2D. | 2711 // We want the last bind to be 2D. |
| 2706 TextureRef* ref; | 2712 TextureRef* ref; |
| 2707 if (features().oes_egl_image_external) { | 2713 if (features().oes_egl_image_external) { |
| 2708 ref = texture_manager()->GetDefaultTextureInfo( | 2714 ref = texture_manager()->GetDefaultTextureInfo( |
| 2709 GL_TEXTURE_EXTERNAL_OES); | 2715 GL_TEXTURE_EXTERNAL_OES); |
| 2710 state_.texture_units[tt].bound_texture_external_oes = ref; | 2716 state_.texture_units[tt].bound_texture_external_oes = ref; |
| 2711 glBindTexture(GL_TEXTURE_EXTERNAL_OES, ref ? ref->service_id() : 0); | 2717 glBindTexture(GL_TEXTURE_EXTERNAL_OES, ref ? ref->service_id() : 0); |
| 2712 } | 2718 } |
| 2713 if (features().arb_texture_rectangle) { | 2719 if (features().arb_texture_rectangle) { |
| (...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3964 void GLES2DecoderImpl::SetFenceSyncReleaseCallback( | 3970 void GLES2DecoderImpl::SetFenceSyncReleaseCallback( |
| 3965 const FenceSyncReleaseCallback& callback) { | 3971 const FenceSyncReleaseCallback& callback) { |
| 3966 fence_sync_release_callback_ = callback; | 3972 fence_sync_release_callback_ = callback; |
| 3967 } | 3973 } |
| 3968 | 3974 |
| 3969 void GLES2DecoderImpl::SetWaitFenceSyncCallback( | 3975 void GLES2DecoderImpl::SetWaitFenceSyncCallback( |
| 3970 const WaitFenceSyncCallback& callback) { | 3976 const WaitFenceSyncCallback& callback) { |
| 3971 wait_fence_sync_callback_ = callback; | 3977 wait_fence_sync_callback_ = callback; |
| 3972 } | 3978 } |
| 3973 | 3979 |
| 3974 bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, | 3980 bool GLES2DecoderImpl::GetServiceTextureId(uint32_t client_texture_id, |
| 3975 uint32* service_texture_id) { | 3981 uint32_t* service_texture_id) { |
| 3976 TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); | 3982 TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); |
| 3977 if (texture_ref) { | 3983 if (texture_ref) { |
| 3978 *service_texture_id = texture_ref->service_id(); | 3984 *service_texture_id = texture_ref->service_id(); |
| 3979 return true; | 3985 return true; |
| 3980 } | 3986 } |
| 3981 return false; | 3987 return false; |
| 3982 } | 3988 } |
| 3983 | 3989 |
| 3984 uint32 GLES2DecoderImpl::GetTextureUploadCount() { | 3990 uint32_t GLES2DecoderImpl::GetTextureUploadCount() { |
| 3985 return texture_state_.texture_upload_count; | 3991 return texture_state_.texture_upload_count; |
| 3986 } | 3992 } |
| 3987 | 3993 |
| 3988 base::TimeDelta GLES2DecoderImpl::GetTotalTextureUploadTime() { | 3994 base::TimeDelta GLES2DecoderImpl::GetTotalTextureUploadTime() { |
| 3989 return texture_state_.total_texture_upload_time; | 3995 return texture_state_.total_texture_upload_time; |
| 3990 } | 3996 } |
| 3991 | 3997 |
| 3992 base::TimeDelta GLES2DecoderImpl::GetTotalProcessingCommandsTime() { | 3998 base::TimeDelta GLES2DecoderImpl::GetTotalProcessingCommandsTime() { |
| 3993 return total_processing_commands_time_; | 3999 return total_processing_commands_time_; |
| 3994 } | 4000 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4295 if (offscreen_resolved_frame_buffer_.get()) | 4301 if (offscreen_resolved_frame_buffer_.get()) |
| 4296 offscreen_resolved_frame_buffer_->Destroy(); | 4302 offscreen_resolved_frame_buffer_->Destroy(); |
| 4297 if (offscreen_resolved_color_texture_.get()) | 4303 if (offscreen_resolved_color_texture_.get()) |
| 4298 offscreen_resolved_color_texture_->Destroy(); | 4304 offscreen_resolved_color_texture_->Destroy(); |
| 4299 offscreen_resolved_color_texture_.reset(); | 4305 offscreen_resolved_color_texture_.reset(); |
| 4300 offscreen_resolved_frame_buffer_.reset(); | 4306 offscreen_resolved_frame_buffer_.reset(); |
| 4301 | 4307 |
| 4302 return true; | 4308 return true; |
| 4303 } | 4309 } |
| 4304 | 4310 |
| 4305 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(uint32 immediate_data_size, | 4311 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( |
| 4306 const void* cmd_data) { | 4312 uint32_t immediate_data_size, |
| 4313 const void* cmd_data) { |
| 4307 const gles2::cmds::ResizeCHROMIUM& c = | 4314 const gles2::cmds::ResizeCHROMIUM& c = |
| 4308 *static_cast<const gles2::cmds::ResizeCHROMIUM*>(cmd_data); | 4315 *static_cast<const gles2::cmds::ResizeCHROMIUM*>(cmd_data); |
| 4309 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) | 4316 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) |
| 4310 return error::kDeferCommandUntilLater; | 4317 return error::kDeferCommandUntilLater; |
| 4311 | 4318 |
| 4312 GLuint width = static_cast<GLuint>(c.width); | 4319 GLuint width = static_cast<GLuint>(c.width); |
| 4313 GLuint height = static_cast<GLuint>(c.height); | 4320 GLuint height = static_cast<GLuint>(c.height); |
| 4314 GLfloat scale_factor = c.scale_factor; | 4321 GLfloat scale_factor = c.scale_factor; |
| 4315 GLboolean has_alpha = c.alpha; | 4322 GLboolean has_alpha = c.alpha; |
| 4316 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); | 4323 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4412 bool doing_gpu_trace = false; | 4419 bool doing_gpu_trace = false; |
| 4413 if (DebugImpl && gpu_trace_commands_) { | 4420 if (DebugImpl && gpu_trace_commands_) { |
| 4414 if (CMD_FLAG_GET_TRACE_LEVEL(info.cmd_flags) <= gpu_trace_level_) { | 4421 if (CMD_FLAG_GET_TRACE_LEVEL(info.cmd_flags) <= gpu_trace_level_) { |
| 4415 doing_gpu_trace = true; | 4422 doing_gpu_trace = true; |
| 4416 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_decoder"), | 4423 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_decoder"), |
| 4417 GetCommandName(command), | 4424 GetCommandName(command), |
| 4418 kTraceDecoder); | 4425 kTraceDecoder); |
| 4419 } | 4426 } |
| 4420 } | 4427 } |
| 4421 | 4428 |
| 4422 uint32 immediate_data_size = (arg_count - info_arg_count) * | 4429 uint32_t immediate_data_size = (arg_count - info_arg_count) * |
| 4423 sizeof(CommandBufferEntry); // NOLINT | 4430 sizeof(CommandBufferEntry); // NOLINT |
| 4424 | 4431 |
| 4425 result = (this->*info.cmd_handler)(immediate_data_size, cmd_data); | 4432 result = (this->*info.cmd_handler)(immediate_data_size, cmd_data); |
| 4426 | 4433 |
| 4427 if (DebugImpl && doing_gpu_trace) | 4434 if (DebugImpl && doing_gpu_trace) |
| 4428 gpu_tracer_->End(kTraceDecoder); | 4435 gpu_tracer_->End(kTraceDecoder); |
| 4429 | 4436 |
| 4430 if (DebugImpl && debug()) { | 4437 if (DebugImpl && debug()) { |
| 4431 GLenum error; | 4438 GLenum error; |
| 4432 while ((error = glGetError()) != GL_NO_ERROR) { | 4439 while ((error = glGetError()) != GL_NO_ERROR) { |
| 4433 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "] " | 4440 LOG(ERROR) << "[" << logger_.GetLogPrefix() << "] " |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4707 RestoreTextureUnitBindings(state_.active_texture_unit); | 4714 RestoreTextureUnitBindings(state_.active_texture_unit); |
| 4708 } | 4715 } |
| 4709 } | 4716 } |
| 4710 | 4717 |
| 4711 void GLES2DecoderImpl::ClearAllAttributes() const { | 4718 void GLES2DecoderImpl::ClearAllAttributes() const { |
| 4712 // Must use native VAO 0, as RestoreAllAttributes can't fully restore | 4719 // Must use native VAO 0, as RestoreAllAttributes can't fully restore |
| 4713 // other VAOs. | 4720 // other VAOs. |
| 4714 if (feature_info_->feature_flags().native_vertex_array_object) | 4721 if (feature_info_->feature_flags().native_vertex_array_object) |
| 4715 glBindVertexArrayOES(0); | 4722 glBindVertexArrayOES(0); |
| 4716 | 4723 |
| 4717 for (uint32 i = 0; i < group_->max_vertex_attribs(); ++i) { | 4724 for (uint32_t i = 0; i < group_->max_vertex_attribs(); ++i) { |
| 4718 if (i != 0) // Never disable attribute 0 | 4725 if (i != 0) // Never disable attribute 0 |
| 4719 glDisableVertexAttribArray(i); | 4726 glDisableVertexAttribArray(i); |
| 4720 if (features().angle_instanced_arrays) | 4727 if (features().angle_instanced_arrays) |
| 4721 glVertexAttribDivisorANGLE(i, 0); | 4728 glVertexAttribDivisorANGLE(i, 0); |
| 4722 } | 4729 } |
| 4723 } | 4730 } |
| 4724 | 4731 |
| 4725 void GLES2DecoderImpl::RestoreAllAttributes() const { | 4732 void GLES2DecoderImpl::RestoreAllAttributes() const { |
| 4726 state_.RestoreVertexAttribs(); | 4733 state_.RestoreVertexAttribs(); |
| 4727 } | 4734 } |
| 4728 | 4735 |
| 4729 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { | 4736 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { |
| 4730 state_.SetIgnoreCachedStateForTest(ignore); | 4737 state_.SetIgnoreCachedStateForTest(ignore); |
| 4731 } | 4738 } |
| 4732 | 4739 |
| 4733 void GLES2DecoderImpl::SetForceShaderNameHashingForTest(bool force) { | 4740 void GLES2DecoderImpl::SetForceShaderNameHashingForTest(bool force) { |
| 4734 force_shader_name_hashing_for_test = force; | 4741 force_shader_name_hashing_for_test = force; |
| 4735 } | 4742 } |
| 4736 | 4743 |
| 4737 // Added specifically for testing backbuffer_needs_clear_bits unittests. | 4744 // Added specifically for testing backbuffer_needs_clear_bits unittests. |
| 4738 uint32 GLES2DecoderImpl::GetAndClearBackbufferClearBitsForTest() { | 4745 uint32_t GLES2DecoderImpl::GetAndClearBackbufferClearBitsForTest() { |
| 4739 uint32 clear_bits = backbuffer_needs_clear_bits_; | 4746 uint32_t clear_bits = backbuffer_needs_clear_bits_; |
| 4740 backbuffer_needs_clear_bits_ = 0; | 4747 backbuffer_needs_clear_bits_ = 0; |
| 4741 return clear_bits; | 4748 return clear_bits; |
| 4742 } | 4749 } |
| 4743 | 4750 |
| 4744 void GLES2DecoderImpl::OnFboChanged() const { | 4751 void GLES2DecoderImpl::OnFboChanged() const { |
| 4745 if (workarounds().restore_scissor_on_fbo_change) | 4752 if (workarounds().restore_scissor_on_fbo_change) |
| 4746 state_.fbo_binding_for_scissor_workaround_dirty = true; | 4753 state_.fbo_binding_for_scissor_workaround_dirty = true; |
| 4747 | 4754 |
| 4748 if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { | 4755 if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) { |
| 4749 GLint bound_fbo_unsigned = -1; | 4756 GLint bound_fbo_unsigned = -1; |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5689 // therefore, we may not find the hashed attribute name. | 5696 // therefore, we may not find the hashed attribute name. |
| 5690 // glBindAttribLocation call with original name is useless. | 5697 // glBindAttribLocation call with original name is useless. |
| 5691 // So instead, we should simply cache the binding, and then call | 5698 // So instead, we should simply cache the binding, and then call |
| 5692 // Program::ExecuteBindAttribLocationCalls() right before link. | 5699 // Program::ExecuteBindAttribLocationCalls() right before link. |
| 5693 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); | 5700 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); |
| 5694 // TODO(zmo): Get rid of the following glBindAttribLocation call. | 5701 // TODO(zmo): Get rid of the following glBindAttribLocation call. |
| 5695 glBindAttribLocation(program->service_id(), index, name.c_str()); | 5702 glBindAttribLocation(program->service_id(), index, name.c_str()); |
| 5696 } | 5703 } |
| 5697 | 5704 |
| 5698 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( | 5705 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( |
| 5699 uint32 immediate_data_size, | 5706 uint32_t immediate_data_size, |
| 5700 const void* cmd_data) { | 5707 const void* cmd_data) { |
| 5701 const gles2::cmds::BindAttribLocationBucket& c = | 5708 const gles2::cmds::BindAttribLocationBucket& c = |
| 5702 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); | 5709 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); |
| 5703 GLuint program = static_cast<GLuint>(c.program); | 5710 GLuint program = static_cast<GLuint>(c.program); |
| 5704 GLuint index = static_cast<GLuint>(c.index); | 5711 GLuint index = static_cast<GLuint>(c.index); |
| 5705 Bucket* bucket = GetBucket(c.name_bucket_id); | 5712 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 5706 if (!bucket || bucket->size() == 0) { | 5713 if (!bucket || bucket->size() == 0) { |
| 5707 return error::kInvalidArguments; | 5714 return error::kInvalidArguments; |
| 5708 } | 5715 } |
| 5709 std::string name_str; | 5716 std::string name_str; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 5733 } | 5740 } |
| 5734 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); | 5741 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); |
| 5735 if (!program) { | 5742 if (!program) { |
| 5736 return error::kNoError; | 5743 return error::kNoError; |
| 5737 } | 5744 } |
| 5738 program->SetProgramOutputLocationBinding(name, colorName); | 5745 program->SetProgramOutputLocationBinding(name, colorName); |
| 5739 return error::kNoError; | 5746 return error::kNoError; |
| 5740 } | 5747 } |
| 5741 | 5748 |
| 5742 error::Error GLES2DecoderImpl::HandleBindFragDataLocationEXTBucket( | 5749 error::Error GLES2DecoderImpl::HandleBindFragDataLocationEXTBucket( |
| 5743 uint32 immediate_data_size, | 5750 uint32_t immediate_data_size, |
| 5744 const void* cmd_data) { | 5751 const void* cmd_data) { |
| 5745 if (!features().ext_blend_func_extended) { | 5752 if (!features().ext_blend_func_extended) { |
| 5746 return error::kUnknownCommand; | 5753 return error::kUnknownCommand; |
| 5747 } | 5754 } |
| 5748 const gles2::cmds::BindFragDataLocationEXTBucket& c = | 5755 const gles2::cmds::BindFragDataLocationEXTBucket& c = |
| 5749 *static_cast<const gles2::cmds::BindFragDataLocationEXTBucket*>(cmd_data); | 5756 *static_cast<const gles2::cmds::BindFragDataLocationEXTBucket*>(cmd_data); |
| 5750 GLuint program = static_cast<GLuint>(c.program); | 5757 GLuint program = static_cast<GLuint>(c.program); |
| 5751 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); | 5758 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); |
| 5752 Bucket* bucket = GetBucket(c.name_bucket_id); | 5759 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 5753 if (!bucket || bucket->size() == 0) { | 5760 if (!bucket || bucket->size() == 0) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5786 } | 5793 } |
| 5787 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); | 5794 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); |
| 5788 if (!program) { | 5795 if (!program) { |
| 5789 return error::kNoError; | 5796 return error::kNoError; |
| 5790 } | 5797 } |
| 5791 program->SetProgramOutputLocationIndexedBinding(name, colorName, index); | 5798 program->SetProgramOutputLocationIndexedBinding(name, colorName, index); |
| 5792 return error::kNoError; | 5799 return error::kNoError; |
| 5793 } | 5800 } |
| 5794 | 5801 |
| 5795 error::Error GLES2DecoderImpl::HandleBindFragDataLocationIndexedEXTBucket( | 5802 error::Error GLES2DecoderImpl::HandleBindFragDataLocationIndexedEXTBucket( |
| 5796 uint32 immediate_data_size, | 5803 uint32_t immediate_data_size, |
| 5797 const void* cmd_data) { | 5804 const void* cmd_data) { |
| 5798 if (!features().ext_blend_func_extended) { | 5805 if (!features().ext_blend_func_extended) { |
| 5799 return error::kUnknownCommand; | 5806 return error::kUnknownCommand; |
| 5800 } | 5807 } |
| 5801 const gles2::cmds::BindFragDataLocationIndexedEXTBucket& c = | 5808 const gles2::cmds::BindFragDataLocationIndexedEXTBucket& c = |
| 5802 *static_cast<const gles2::cmds::BindFragDataLocationIndexedEXTBucket*>( | 5809 *static_cast<const gles2::cmds::BindFragDataLocationIndexedEXTBucket*>( |
| 5803 cmd_data); | 5810 cmd_data); |
| 5804 GLuint program = static_cast<GLuint>(c.program); | 5811 GLuint program = static_cast<GLuint>(c.program); |
| 5805 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); | 5812 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); |
| 5806 GLuint index = static_cast<GLuint>(c.index); | 5813 GLuint index = static_cast<GLuint>(c.index); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5823 GL_INVALID_VALUE, | 5830 GL_INVALID_VALUE, |
| 5824 "glBindUniformLocationCHROMIUM", "Invalid character"); | 5831 "glBindUniformLocationCHROMIUM", "Invalid character"); |
| 5825 return; | 5832 return; |
| 5826 } | 5833 } |
| 5827 if (ProgramManager::HasBuiltInPrefix(name)) { | 5834 if (ProgramManager::HasBuiltInPrefix(name)) { |
| 5828 LOCAL_SET_GL_ERROR( | 5835 LOCAL_SET_GL_ERROR( |
| 5829 GL_INVALID_OPERATION, | 5836 GL_INVALID_OPERATION, |
| 5830 "glBindUniformLocationCHROMIUM", "reserved prefix"); | 5837 "glBindUniformLocationCHROMIUM", "reserved prefix"); |
| 5831 return; | 5838 return; |
| 5832 } | 5839 } |
| 5833 if (location < 0 || static_cast<uint32>(location) >= | 5840 if (location < 0 || |
| 5834 (group_->max_fragment_uniform_vectors() + | 5841 static_cast<uint32_t>(location) >= |
| 5835 group_->max_vertex_uniform_vectors()) * 4) { | 5842 (group_->max_fragment_uniform_vectors() + |
| 5843 group_->max_vertex_uniform_vectors()) * |
| 5844 4) { |
| 5836 LOCAL_SET_GL_ERROR( | 5845 LOCAL_SET_GL_ERROR( |
| 5837 GL_INVALID_VALUE, | 5846 GL_INVALID_VALUE, |
| 5838 "glBindUniformLocationCHROMIUM", "location out of range"); | 5847 "glBindUniformLocationCHROMIUM", "location out of range"); |
| 5839 return; | 5848 return; |
| 5840 } | 5849 } |
| 5841 Program* program = GetProgramInfoNotShader( | 5850 Program* program = GetProgramInfoNotShader( |
| 5842 program_id, "glBindUniformLocationCHROMIUM"); | 5851 program_id, "glBindUniformLocationCHROMIUM"); |
| 5843 if (!program) { | 5852 if (!program) { |
| 5844 return; | 5853 return; |
| 5845 } | 5854 } |
| 5846 if (!program->SetUniformLocationBinding(name, location)) { | 5855 if (!program->SetUniformLocationBinding(name, location)) { |
| 5847 LOCAL_SET_GL_ERROR( | 5856 LOCAL_SET_GL_ERROR( |
| 5848 GL_INVALID_VALUE, | 5857 GL_INVALID_VALUE, |
| 5849 "glBindUniformLocationCHROMIUM", "location out of range"); | 5858 "glBindUniformLocationCHROMIUM", "location out of range"); |
| 5850 } | 5859 } |
| 5851 } | 5860 } |
| 5852 | 5861 |
| 5853 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( | 5862 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( |
| 5854 uint32 immediate_data_size, | 5863 uint32_t immediate_data_size, |
| 5855 const void* cmd_data) { | 5864 const void* cmd_data) { |
| 5856 const gles2::cmds::BindUniformLocationCHROMIUMBucket& c = | 5865 const gles2::cmds::BindUniformLocationCHROMIUMBucket& c = |
| 5857 *static_cast<const gles2::cmds::BindUniformLocationCHROMIUMBucket*>( | 5866 *static_cast<const gles2::cmds::BindUniformLocationCHROMIUMBucket*>( |
| 5858 cmd_data); | 5867 cmd_data); |
| 5859 GLuint program = static_cast<GLuint>(c.program); | 5868 GLuint program = static_cast<GLuint>(c.program); |
| 5860 GLint location = static_cast<GLint>(c.location); | 5869 GLint location = static_cast<GLint>(c.location); |
| 5861 Bucket* bucket = GetBucket(c.name_bucket_id); | 5870 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 5862 if (!bucket || bucket->size() == 0) { | 5871 if (!bucket || bucket->size() == 0) { |
| 5863 return error::kInvalidArguments; | 5872 return error::kInvalidArguments; |
| 5864 } | 5873 } |
| 5865 std::string name_str; | 5874 std::string name_str; |
| 5866 if (!bucket->GetAsString(&name_str)) { | 5875 if (!bucket->GetAsString(&name_str)) { |
| 5867 return error::kInvalidArguments; | 5876 return error::kInvalidArguments; |
| 5868 } | 5877 } |
| 5869 DoBindUniformLocationCHROMIUM(program, location, name_str); | 5878 DoBindUniformLocationCHROMIUM(program, location, name_str); |
| 5870 return error::kNoError; | 5879 return error::kNoError; |
| 5871 } | 5880 } |
| 5872 | 5881 |
| 5873 error::Error GLES2DecoderImpl::HandleDeleteShader(uint32 immediate_data_size, | 5882 error::Error GLES2DecoderImpl::HandleDeleteShader(uint32_t immediate_data_size, |
| 5874 const void* cmd_data) { | 5883 const void* cmd_data) { |
| 5875 const gles2::cmds::DeleteShader& c = | 5884 const gles2::cmds::DeleteShader& c = |
| 5876 *static_cast<const gles2::cmds::DeleteShader*>(cmd_data); | 5885 *static_cast<const gles2::cmds::DeleteShader*>(cmd_data); |
| 5877 GLuint client_id = c.shader; | 5886 GLuint client_id = c.shader; |
| 5878 if (client_id) { | 5887 if (client_id) { |
| 5879 Shader* shader = GetShader(client_id); | 5888 Shader* shader = GetShader(client_id); |
| 5880 if (shader) { | 5889 if (shader) { |
| 5881 if (!shader->IsDeleted()) { | 5890 if (!shader->IsDeleted()) { |
| 5882 shader_manager()->Delete(shader); | 5891 shader_manager()->Delete(shader); |
| 5883 } | 5892 } |
| 5884 } else { | 5893 } else { |
| 5885 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader"); | 5894 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader"); |
| 5886 } | 5895 } |
| 5887 } | 5896 } |
| 5888 return error::kNoError; | 5897 return error::kNoError; |
| 5889 } | 5898 } |
| 5890 | 5899 |
| 5891 error::Error GLES2DecoderImpl::HandleDeleteProgram(uint32 immediate_data_size, | 5900 error::Error GLES2DecoderImpl::HandleDeleteProgram(uint32_t immediate_data_size, |
| 5892 const void* cmd_data) { | 5901 const void* cmd_data) { |
| 5893 const gles2::cmds::DeleteProgram& c = | 5902 const gles2::cmds::DeleteProgram& c = |
| 5894 *static_cast<const gles2::cmds::DeleteProgram*>(cmd_data); | 5903 *static_cast<const gles2::cmds::DeleteProgram*>(cmd_data); |
| 5895 GLuint client_id = c.program; | 5904 GLuint client_id = c.program; |
| 5896 if (client_id) { | 5905 if (client_id) { |
| 5897 Program* program = GetProgram(client_id); | 5906 Program* program = GetProgram(client_id); |
| 5898 if (program) { | 5907 if (program) { |
| 5899 if (!program->IsDeleted()) { | 5908 if (!program->IsDeleted()) { |
| 5900 program_manager()->MarkAsDeleted(shader_manager(), program); | 5909 program_manager()->MarkAsDeleted(shader_manager(), program); |
| 5901 } | 5910 } |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6534 } | 6543 } |
| 6535 | 6544 |
| 6536 if (width > renderbuffer_manager()->max_renderbuffer_size() || | 6545 if (width > renderbuffer_manager()->max_renderbuffer_size() || |
| 6537 height > renderbuffer_manager()->max_renderbuffer_size()) { | 6546 height > renderbuffer_manager()->max_renderbuffer_size()) { |
| 6538 LOCAL_SET_GL_ERROR( | 6547 LOCAL_SET_GL_ERROR( |
| 6539 GL_INVALID_VALUE, | 6548 GL_INVALID_VALUE, |
| 6540 "glRenderbufferStorageMultisample", "dimensions too large"); | 6549 "glRenderbufferStorageMultisample", "dimensions too large"); |
| 6541 return false; | 6550 return false; |
| 6542 } | 6551 } |
| 6543 | 6552 |
| 6544 uint32 estimated_size = 0; | 6553 uint32_t estimated_size = 0; |
| 6545 if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize( | 6554 if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize( |
| 6546 width, height, samples, internalformat, &estimated_size)) { | 6555 width, height, samples, internalformat, &estimated_size)) { |
| 6547 LOCAL_SET_GL_ERROR( | 6556 LOCAL_SET_GL_ERROR( |
| 6548 GL_OUT_OF_MEMORY, | 6557 GL_OUT_OF_MEMORY, |
| 6549 "glRenderbufferStorageMultisample", "dimensions too large"); | 6558 "glRenderbufferStorageMultisample", "dimensions too large"); |
| 6550 return false; | 6559 return false; |
| 6551 } | 6560 } |
| 6552 | 6561 |
| 6553 if (!EnsureGPUMemoryAvailable(estimated_size)) { | 6562 if (!EnsureGPUMemoryAvailable(estimated_size)) { |
| 6554 LOCAL_SET_GL_ERROR( | 6563 LOCAL_SET_GL_ERROR( |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6761 return; | 6770 return; |
| 6762 } | 6771 } |
| 6763 | 6772 |
| 6764 if (width > renderbuffer_manager()->max_renderbuffer_size() || | 6773 if (width > renderbuffer_manager()->max_renderbuffer_size() || |
| 6765 height > renderbuffer_manager()->max_renderbuffer_size()) { | 6774 height > renderbuffer_manager()->max_renderbuffer_size()) { |
| 6766 LOCAL_SET_GL_ERROR( | 6775 LOCAL_SET_GL_ERROR( |
| 6767 GL_INVALID_VALUE, "glRenderbufferStorage", "dimensions too large"); | 6776 GL_INVALID_VALUE, "glRenderbufferStorage", "dimensions too large"); |
| 6768 return; | 6777 return; |
| 6769 } | 6778 } |
| 6770 | 6779 |
| 6771 uint32 estimated_size = 0; | 6780 uint32_t estimated_size = 0; |
| 6772 if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize( | 6781 if (!renderbuffer_manager()->ComputeEstimatedRenderbufferSize( |
| 6773 width, height, 1, internalformat, &estimated_size)) { | 6782 width, height, 1, internalformat, &estimated_size)) { |
| 6774 LOCAL_SET_GL_ERROR( | 6783 LOCAL_SET_GL_ERROR( |
| 6775 GL_OUT_OF_MEMORY, "glRenderbufferStorage", "dimensions too large"); | 6784 GL_OUT_OF_MEMORY, "glRenderbufferStorage", "dimensions too large"); |
| 6776 return; | 6785 return; |
| 6777 } | 6786 } |
| 6778 | 6787 |
| 6779 if (!EnsureGPUMemoryAvailable(estimated_size)) { | 6788 if (!EnsureGPUMemoryAvailable(estimated_size)) { |
| 6780 LOCAL_SET_GL_ERROR( | 6789 LOCAL_SET_GL_ERROR( |
| 6781 GL_OUT_OF_MEMORY, "glRenderbufferStorage", "out of memory"); | 6790 GL_OUT_OF_MEMORY, "glRenderbufferStorage", "out of memory"); |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7760 bool attrib_0_used = | 7769 bool attrib_0_used = |
| 7761 state_.current_program->GetAttribInfoByLocation(0) != NULL; | 7770 state_.current_program->GetAttribInfoByLocation(0) != NULL; |
| 7762 if (attrib->enabled() && attrib_0_used) { | 7771 if (attrib->enabled() && attrib_0_used) { |
| 7763 return true; | 7772 return true; |
| 7764 } | 7773 } |
| 7765 | 7774 |
| 7766 // Make a buffer with a single repeated vec4 value enough to | 7775 // Make a buffer with a single repeated vec4 value enough to |
| 7767 // simulate the constant value that is supposed to be here. | 7776 // simulate the constant value that is supposed to be here. |
| 7768 // This is required to emulate GLES2 on GL. | 7777 // This is required to emulate GLES2 on GL. |
| 7769 GLuint num_vertices = max_vertex_accessed + 1; | 7778 GLuint num_vertices = max_vertex_accessed + 1; |
| 7770 uint32 size_needed = 0; | 7779 uint32_t size_needed = 0; |
| 7771 | 7780 |
| 7772 if (num_vertices == 0 || | 7781 if (num_vertices == 0 || |
| 7773 !SafeMultiplyUint32(num_vertices, sizeof(Vec4f), &size_needed) || | 7782 !SafeMultiplyUint32(num_vertices, sizeof(Vec4f), &size_needed) || |
| 7774 size_needed > 0x7FFFFFFFU) { | 7783 size_needed > 0x7FFFFFFFU) { |
| 7775 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 7784 LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
| 7776 return false; | 7785 return false; |
| 7777 } | 7786 } |
| 7778 | 7787 |
| 7779 LOCAL_PERFORMANCE_WARNING( | 7788 LOCAL_PERFORMANCE_WARNING( |
| 7780 "Attribute 0 is disabled. This has signficant performance penalty"); | 7789 "Attribute 0 is disabled. This has signficant performance penalty"); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7887 max_vertex_accessed); | 7896 max_vertex_accessed); |
| 7888 GLuint num_vertices = max_accessed + 1; | 7897 GLuint num_vertices = max_accessed + 1; |
| 7889 if (num_vertices == 0) { | 7898 if (num_vertices == 0) { |
| 7890 LOCAL_SET_GL_ERROR( | 7899 LOCAL_SET_GL_ERROR( |
| 7891 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 7900 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
| 7892 return false; | 7901 return false; |
| 7893 } | 7902 } |
| 7894 if (attrib_info && | 7903 if (attrib_info && |
| 7895 attrib->CanAccess(max_accessed) && | 7904 attrib->CanAccess(max_accessed) && |
| 7896 attrib->type() == GL_FIXED) { | 7905 attrib->type() == GL_FIXED) { |
| 7897 uint32 elements_used = 0; | 7906 uint32_t elements_used = 0; |
| 7898 if (!SafeMultiplyUint32(num_vertices, attrib->size(), &elements_used) || | 7907 if (!SafeMultiplyUint32(num_vertices, attrib->size(), &elements_used) || |
| 7899 !SafeAddUint32(elements_needed, elements_used, &elements_needed)) { | 7908 !SafeAddUint32(elements_needed, elements_used, &elements_needed)) { |
| 7900 LOCAL_SET_GL_ERROR( | 7909 LOCAL_SET_GL_ERROR( |
| 7901 GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); | 7910 GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); |
| 7902 return false; | 7911 return false; |
| 7903 } | 7912 } |
| 7904 } | 7913 } |
| 7905 } | 7914 } |
| 7906 | 7915 |
| 7907 const uint32 kSizeOfFloat = sizeof(float); // NOLINT | 7916 const uint32_t kSizeOfFloat = sizeof(float); // NOLINT |
| 7908 uint32 size_needed = 0; | 7917 uint32_t size_needed = 0; |
| 7909 if (!SafeMultiplyUint32(elements_needed, kSizeOfFloat, &size_needed) || | 7918 if (!SafeMultiplyUint32(elements_needed, kSizeOfFloat, &size_needed) || |
| 7910 size_needed > 0x7FFFFFFFU) { | 7919 size_needed > 0x7FFFFFFFU) { |
| 7911 LOCAL_SET_GL_ERROR( | 7920 LOCAL_SET_GL_ERROR( |
| 7912 GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); | 7921 GL_OUT_OF_MEMORY, function_name, "simulating GL_FIXED attribs"); |
| 7913 return false; | 7922 return false; |
| 7914 } | 7923 } |
| 7915 | 7924 |
| 7916 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); | 7925 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(function_name); |
| 7917 | 7926 |
| 7918 glBindBuffer(GL_ARRAY_BUFFER, fixed_attrib_buffer_id_); | 7927 glBindBuffer(GL_ARRAY_BUFFER, fixed_attrib_buffer_id_); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 7938 GLuint num_vertices = max_accessed + 1; | 7947 GLuint num_vertices = max_accessed + 1; |
| 7939 if (num_vertices == 0) { | 7948 if (num_vertices == 0) { |
| 7940 LOCAL_SET_GL_ERROR( | 7949 LOCAL_SET_GL_ERROR( |
| 7941 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); | 7950 GL_OUT_OF_MEMORY, function_name, "Simulating attrib 0"); |
| 7942 return false; | 7951 return false; |
| 7943 } | 7952 } |
| 7944 if (attrib_info && | 7953 if (attrib_info && |
| 7945 attrib->CanAccess(max_accessed) && | 7954 attrib->CanAccess(max_accessed) && |
| 7946 attrib->type() == GL_FIXED) { | 7955 attrib->type() == GL_FIXED) { |
| 7947 int num_elements = attrib->size() * num_vertices; | 7956 int num_elements = attrib->size() * num_vertices; |
| 7948 const int src_size = num_elements * sizeof(int32); | 7957 const int src_size = num_elements * sizeof(int32_t); |
| 7949 const int dst_size = num_elements * sizeof(float); | 7958 const int dst_size = num_elements * sizeof(float); |
| 7950 scoped_ptr<float[]> data(new float[num_elements]); | 7959 scoped_ptr<float[]> data(new float[num_elements]); |
| 7951 const int32* src = reinterpret_cast<const int32 *>( | 7960 const int32_t* src = reinterpret_cast<const int32_t*>( |
| 7952 attrib->buffer()->GetRange(attrib->offset(), src_size)); | 7961 attrib->buffer()->GetRange(attrib->offset(), src_size)); |
| 7953 const int32* end = src + num_elements; | 7962 const int32_t* end = src + num_elements; |
| 7954 float* dst = data.get(); | 7963 float* dst = data.get(); |
| 7955 while (src != end) { | 7964 while (src != end) { |
| 7956 *dst++ = static_cast<float>(*src++) / 65536.0f; | 7965 *dst++ = static_cast<float>(*src++) / 65536.0f; |
| 7957 } | 7966 } |
| 7958 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); | 7967 glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get()); |
| 7959 glVertexAttribPointer( | 7968 glVertexAttribPointer( |
| 7960 attrib->index(), attrib->size(), GL_FLOAT, false, 0, | 7969 attrib->index(), attrib->size(), GL_FLOAT, false, 0, |
| 7961 reinterpret_cast<GLvoid*>(offset)); | 7970 reinterpret_cast<GLvoid*>(offset)); |
| 7962 offset += dst_size; | 7971 offset += dst_size; |
| 7963 } | 7972 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8045 // We don't have to restore attrib 0 generic data at the end of this | 8054 // We don't have to restore attrib 0 generic data at the end of this |
| 8046 // function even if it is simulated. This is because we will simulate | 8055 // function even if it is simulated. This is because we will simulate |
| 8047 // it in each draw call, and attrib 0 generic data queries use cached | 8056 // it in each draw call, and attrib 0 generic data queries use cached |
| 8048 // values instead of passing down to the underlying driver. | 8057 // values instead of passing down to the underlying driver. |
| 8049 RestoreStateForAttrib(0, false); | 8058 RestoreStateForAttrib(0, false); |
| 8050 } | 8059 } |
| 8051 } | 8060 } |
| 8052 return error::kNoError; | 8061 return error::kNoError; |
| 8053 } | 8062 } |
| 8054 | 8063 |
| 8055 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32 immediate_data_size, | 8064 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32_t immediate_data_size, |
| 8056 const void* cmd_data) { | 8065 const void* cmd_data) { |
| 8057 // TODO(zmo): crbug.com/481184 | 8066 // TODO(zmo): crbug.com/481184 |
| 8058 // On Desktop GL with versions lower than 4.3, we need to emulate | 8067 // On Desktop GL with versions lower than 4.3, we need to emulate |
| 8059 // GL_PRIMITIVE_RESTART_FIXED_INDEX using glPrimitiveRestartIndex(). | 8068 // GL_PRIMITIVE_RESTART_FIXED_INDEX using glPrimitiveRestartIndex(). |
| 8060 const cmds::DrawArrays& c = *static_cast<const cmds::DrawArrays*>(cmd_data); | 8069 const cmds::DrawArrays& c = *static_cast<const cmds::DrawArrays*>(cmd_data); |
| 8061 return DoDrawArrays("glDrawArrays", | 8070 return DoDrawArrays("glDrawArrays", |
| 8062 false, | 8071 false, |
| 8063 static_cast<GLenum>(c.mode), | 8072 static_cast<GLenum>(c.mode), |
| 8064 static_cast<GLint>(c.first), | 8073 static_cast<GLint>(c.first), |
| 8065 static_cast<GLsizei>(c.count), | 8074 static_cast<GLsizei>(c.count), |
| 8066 1); | 8075 1); |
| 8067 } | 8076 } |
| 8068 | 8077 |
| 8069 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( | 8078 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( |
| 8070 uint32 immediate_data_size, | 8079 uint32_t immediate_data_size, |
| 8071 const void* cmd_data) { | 8080 const void* cmd_data) { |
| 8072 const gles2::cmds::DrawArraysInstancedANGLE& c = | 8081 const gles2::cmds::DrawArraysInstancedANGLE& c = |
| 8073 *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); | 8082 *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); |
| 8074 if (!features().angle_instanced_arrays) | 8083 if (!features().angle_instanced_arrays) |
| 8075 return error::kUnknownCommand; | 8084 return error::kUnknownCommand; |
| 8076 | 8085 |
| 8077 return DoDrawArrays("glDrawArraysIntancedANGLE", | 8086 return DoDrawArrays("glDrawArraysIntancedANGLE", |
| 8078 true, | 8087 true, |
| 8079 static_cast<GLenum>(c.mode), | 8088 static_cast<GLenum>(c.mode), |
| 8080 static_cast<GLint>(c.first), | 8089 static_cast<GLint>(c.first), |
| 8081 static_cast<GLsizei>(c.count), | 8090 static_cast<GLsizei>(c.count), |
| 8082 static_cast<GLsizei>(c.primcount)); | 8091 static_cast<GLsizei>(c.primcount)); |
| 8083 } | 8092 } |
| 8084 | 8093 |
| 8085 error::Error GLES2DecoderImpl::DoDrawElements( | 8094 error::Error GLES2DecoderImpl::DoDrawElements(const char* function_name, |
| 8086 const char* function_name, | 8095 bool instanced, |
| 8087 bool instanced, | 8096 GLenum mode, |
| 8088 GLenum mode, | 8097 GLsizei count, |
| 8089 GLsizei count, | 8098 GLenum type, |
| 8090 GLenum type, | 8099 int32_t offset, |
| 8091 int32 offset, | 8100 GLsizei primcount) { |
| 8092 GLsizei primcount) { | |
| 8093 error::Error error = WillAccessBoundFramebufferForDraw(); | 8101 error::Error error = WillAccessBoundFramebufferForDraw(); |
| 8094 if (error != error::kNoError) | 8102 if (error != error::kNoError) |
| 8095 return error; | 8103 return error; |
| 8096 if (!state_.vertex_attrib_manager->element_array_buffer()) { | 8104 if (!state_.vertex_attrib_manager->element_array_buffer()) { |
| 8097 LOCAL_SET_GL_ERROR( | 8105 LOCAL_SET_GL_ERROR( |
| 8098 GL_INVALID_OPERATION, function_name, "No element array buffer bound"); | 8106 GL_INVALID_OPERATION, function_name, "No element array buffer bound"); |
| 8099 return error::kNoError; | 8107 return error::kNoError; |
| 8100 } | 8108 } |
| 8101 | 8109 |
| 8102 if (count < 0) { | 8110 if (count < 0) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8187 // We don't have to restore attrib 0 generic data at the end of this | 8195 // We don't have to restore attrib 0 generic data at the end of this |
| 8188 // function even if it is simulated. This is because we will simulate | 8196 // function even if it is simulated. This is because we will simulate |
| 8189 // it in each draw call, and attrib 0 generic data queries use cached | 8197 // it in each draw call, and attrib 0 generic data queries use cached |
| 8190 // values instead of passing down to the underlying driver. | 8198 // values instead of passing down to the underlying driver. |
| 8191 RestoreStateForAttrib(0, false); | 8199 RestoreStateForAttrib(0, false); |
| 8192 } | 8200 } |
| 8193 } | 8201 } |
| 8194 return error::kNoError; | 8202 return error::kNoError; |
| 8195 } | 8203 } |
| 8196 | 8204 |
| 8197 error::Error GLES2DecoderImpl::HandleDrawElements(uint32 immediate_data_size, | 8205 error::Error GLES2DecoderImpl::HandleDrawElements(uint32_t immediate_data_size, |
| 8198 const void* cmd_data) { | 8206 const void* cmd_data) { |
| 8199 // TODO(zmo): crbug.com/481184 | 8207 // TODO(zmo): crbug.com/481184 |
| 8200 // On Desktop GL with versions lower than 4.3, we need to emulate | 8208 // On Desktop GL with versions lower than 4.3, we need to emulate |
| 8201 // GL_PRIMITIVE_RESTART_FIXED_INDEX using glPrimitiveRestartIndex(). | 8209 // GL_PRIMITIVE_RESTART_FIXED_INDEX using glPrimitiveRestartIndex(). |
| 8202 const gles2::cmds::DrawElements& c = | 8210 const gles2::cmds::DrawElements& c = |
| 8203 *static_cast<const gles2::cmds::DrawElements*>(cmd_data); | 8211 *static_cast<const gles2::cmds::DrawElements*>(cmd_data); |
| 8204 return DoDrawElements("glDrawElements", | 8212 return DoDrawElements("glDrawElements", false, static_cast<GLenum>(c.mode), |
| 8205 false, | |
| 8206 static_cast<GLenum>(c.mode), | |
| 8207 static_cast<GLsizei>(c.count), | 8213 static_cast<GLsizei>(c.count), |
| 8208 static_cast<GLenum>(c.type), | 8214 static_cast<GLenum>(c.type), |
| 8209 static_cast<int32>(c.index_offset), | 8215 static_cast<int32_t>(c.index_offset), 1); |
| 8210 1); | |
| 8211 } | 8216 } |
| 8212 | 8217 |
| 8213 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( | 8218 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( |
| 8214 uint32 immediate_data_size, | 8219 uint32_t immediate_data_size, |
| 8215 const void* cmd_data) { | 8220 const void* cmd_data) { |
| 8216 const gles2::cmds::DrawElementsInstancedANGLE& c = | 8221 const gles2::cmds::DrawElementsInstancedANGLE& c = |
| 8217 *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); | 8222 *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); |
| 8218 if (!features().angle_instanced_arrays) | 8223 if (!features().angle_instanced_arrays) |
| 8219 return error::kUnknownCommand; | 8224 return error::kUnknownCommand; |
| 8220 | 8225 |
| 8221 return DoDrawElements("glDrawElementsInstancedANGLE", | 8226 return DoDrawElements( |
| 8222 true, | 8227 "glDrawElementsInstancedANGLE", true, static_cast<GLenum>(c.mode), |
| 8223 static_cast<GLenum>(c.mode), | 8228 static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type), |
| 8224 static_cast<GLsizei>(c.count), | 8229 static_cast<int32_t>(c.index_offset), static_cast<GLsizei>(c.primcount)); |
| 8225 static_cast<GLenum>(c.type), | |
| 8226 static_cast<int32>(c.index_offset), | |
| 8227 static_cast<GLsizei>(c.primcount)); | |
| 8228 } | 8230 } |
| 8229 | 8231 |
| 8230 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( | 8232 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( |
| 8231 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { | 8233 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { |
| 8232 GLuint max_vertex_accessed = 0; | 8234 GLuint max_vertex_accessed = 0; |
| 8233 Buffer* buffer = GetBuffer(buffer_id); | 8235 Buffer* buffer = GetBuffer(buffer_id); |
| 8234 if (!buffer) { | 8236 if (!buffer) { |
| 8235 // TODO(gman): Should this be a GL error or a command buffer error? | 8237 // TODO(gman): Should this be a GL error or a command buffer error? |
| 8236 LOCAL_SET_GL_ERROR( | 8238 LOCAL_SET_GL_ERROR( |
| 8237 GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer"); | 8239 GL_INVALID_VALUE, "GetMaxValueInBufferCHROMIUM", "unknown buffer"); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8332 *params = shader->translated_source().size(); | 8334 *params = shader->translated_source().size(); |
| 8333 if (*params) | 8335 if (*params) |
| 8334 ++(*params); | 8336 ++(*params); |
| 8335 return; | 8337 return; |
| 8336 default: | 8338 default: |
| 8337 break; | 8339 break; |
| 8338 } | 8340 } |
| 8339 glGetShaderiv(shader->service_id(), pname, params); | 8341 glGetShaderiv(shader->service_id(), pname, params); |
| 8340 } | 8342 } |
| 8341 | 8343 |
| 8342 error::Error GLES2DecoderImpl::HandleGetShaderSource(uint32 immediate_data_size, | 8344 error::Error GLES2DecoderImpl::HandleGetShaderSource( |
| 8343 const void* cmd_data) { | 8345 uint32_t immediate_data_size, |
| 8346 const void* cmd_data) { |
| 8344 const gles2::cmds::GetShaderSource& c = | 8347 const gles2::cmds::GetShaderSource& c = |
| 8345 *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); | 8348 *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); |
| 8346 GLuint shader_id = c.shader; | 8349 GLuint shader_id = c.shader; |
| 8347 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 8350 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); |
| 8348 Bucket* bucket = CreateBucket(bucket_id); | 8351 Bucket* bucket = CreateBucket(bucket_id); |
| 8349 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); | 8352 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); |
| 8350 if (!shader || shader->source().empty()) { | 8353 if (!shader || shader->source().empty()) { |
| 8351 bucket->SetSize(0); | 8354 bucket->SetSize(0); |
| 8352 return error::kNoError; | 8355 return error::kNoError; |
| 8353 } | 8356 } |
| 8354 bucket->SetFromString(shader->source().c_str()); | 8357 bucket->SetFromString(shader->source().c_str()); |
| 8355 return error::kNoError; | 8358 return error::kNoError; |
| 8356 } | 8359 } |
| 8357 | 8360 |
| 8358 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( | 8361 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( |
| 8359 uint32 immediate_data_size, | 8362 uint32_t immediate_data_size, |
| 8360 const void* cmd_data) { | 8363 const void* cmd_data) { |
| 8361 const gles2::cmds::GetTranslatedShaderSourceANGLE& c = | 8364 const gles2::cmds::GetTranslatedShaderSourceANGLE& c = |
| 8362 *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( | 8365 *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( |
| 8363 cmd_data); | 8366 cmd_data); |
| 8364 GLuint shader_id = c.shader; | 8367 GLuint shader_id = c.shader; |
| 8365 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 8368 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); |
| 8366 Bucket* bucket = CreateBucket(bucket_id); | 8369 Bucket* bucket = CreateBucket(bucket_id); |
| 8367 Shader* shader = GetShaderInfoNotProgram( | 8370 Shader* shader = GetShaderInfoNotProgram( |
| 8368 shader_id, "glGetTranslatedShaderSourceANGLE"); | 8371 shader_id, "glGetTranslatedShaderSourceANGLE"); |
| 8369 if (!shader) { | 8372 if (!shader) { |
| 8370 bucket->SetSize(0); | 8373 bucket->SetSize(0); |
| 8371 return error::kNoError; | 8374 return error::kNoError; |
| 8372 } | 8375 } |
| 8373 | 8376 |
| 8374 // Make sure translator has been utilized in compile. | 8377 // Make sure translator has been utilized in compile. |
| 8375 shader->DoCompile(); | 8378 shader->DoCompile(); |
| 8376 | 8379 |
| 8377 bucket->SetFromString(shader->translated_source().c_str()); | 8380 bucket->SetFromString(shader->translated_source().c_str()); |
| 8378 return error::kNoError; | 8381 return error::kNoError; |
| 8379 } | 8382 } |
| 8380 | 8383 |
| 8381 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( | 8384 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( |
| 8382 uint32 immediate_data_size, | 8385 uint32_t immediate_data_size, |
| 8383 const void* cmd_data) { | 8386 const void* cmd_data) { |
| 8384 const gles2::cmds::GetProgramInfoLog& c = | 8387 const gles2::cmds::GetProgramInfoLog& c = |
| 8385 *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); | 8388 *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); |
| 8386 GLuint program_id = c.program; | 8389 GLuint program_id = c.program; |
| 8387 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 8390 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); |
| 8388 Bucket* bucket = CreateBucket(bucket_id); | 8391 Bucket* bucket = CreateBucket(bucket_id); |
| 8389 Program* program = GetProgramInfoNotShader( | 8392 Program* program = GetProgramInfoNotShader( |
| 8390 program_id, "glGetProgramInfoLog"); | 8393 program_id, "glGetProgramInfoLog"); |
| 8391 if (!program || !program->log_info()) { | 8394 if (!program || !program->log_info()) { |
| 8392 bucket->SetFromString(""); | 8395 bucket->SetFromString(""); |
| 8393 return error::kNoError; | 8396 return error::kNoError; |
| 8394 } | 8397 } |
| 8395 bucket->SetFromString(program->log_info()->c_str()); | 8398 bucket->SetFromString(program->log_info()->c_str()); |
| 8396 return error::kNoError; | 8399 return error::kNoError; |
| 8397 } | 8400 } |
| 8398 | 8401 |
| 8399 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( | 8402 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( |
| 8400 uint32 immediate_data_size, | 8403 uint32_t immediate_data_size, |
| 8401 const void* cmd_data) { | 8404 const void* cmd_data) { |
| 8402 const gles2::cmds::GetShaderInfoLog& c = | 8405 const gles2::cmds::GetShaderInfoLog& c = |
| 8403 *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); | 8406 *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); |
| 8404 GLuint shader_id = c.shader; | 8407 GLuint shader_id = c.shader; |
| 8405 uint32 bucket_id = static_cast<uint32>(c.bucket_id); | 8408 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); |
| 8406 Bucket* bucket = CreateBucket(bucket_id); | 8409 Bucket* bucket = CreateBucket(bucket_id); |
| 8407 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); | 8410 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); |
| 8408 if (!shader) { | 8411 if (!shader) { |
| 8409 bucket->SetFromString(""); | 8412 bucket->SetFromString(""); |
| 8410 return error::kNoError; | 8413 return error::kNoError; |
| 8411 } | 8414 } |
| 8412 | 8415 |
| 8413 // Shader must be compiled in order to get the info log. | 8416 // Shader must be compiled in order to get the info log. |
| 8414 shader->DoCompile(); | 8417 shader->DoCompile(); |
| 8415 | 8418 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8739 } | 8742 } |
| 8740 } | 8743 } |
| 8741 | 8744 |
| 8742 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const GLuint* v) { | 8745 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const GLuint* v) { |
| 8743 if (SetVertexAttribValue("glVertexAttribI4uiv", index, v)) { | 8746 if (SetVertexAttribValue("glVertexAttribI4uiv", index, v)) { |
| 8744 glVertexAttribI4uiv(index, v); | 8747 glVertexAttribI4uiv(index, v); |
| 8745 } | 8748 } |
| 8746 } | 8749 } |
| 8747 | 8750 |
| 8748 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( | 8751 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( |
| 8749 uint32 immediate_data_size, | 8752 uint32_t immediate_data_size, |
| 8750 const void* cmd_data) { | 8753 const void* cmd_data) { |
| 8751 if (!unsafe_es3_apis_enabled()) | 8754 if (!unsafe_es3_apis_enabled()) |
| 8752 return error::kUnknownCommand; | 8755 return error::kUnknownCommand; |
| 8753 const gles2::cmds::VertexAttribIPointer& c = | 8756 const gles2::cmds::VertexAttribIPointer& c = |
| 8754 *static_cast<const gles2::cmds::VertexAttribIPointer*>(cmd_data); | 8757 *static_cast<const gles2::cmds::VertexAttribIPointer*>(cmd_data); |
| 8755 | 8758 |
| 8756 if (!state_.bound_array_buffer.get() || | 8759 if (!state_.bound_array_buffer.get() || |
| 8757 state_.bound_array_buffer->IsDeleted()) { | 8760 state_.bound_array_buffer->IsDeleted()) { |
| 8758 if (state_.vertex_attrib_manager.get() == | 8761 if (state_.vertex_attrib_manager.get() == |
| 8759 state_.default_vertex_attrib_manager.get()) { | 8762 state_.default_vertex_attrib_manager.get()) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8827 GL_FALSE, | 8830 GL_FALSE, |
| 8828 stride, | 8831 stride, |
| 8829 stride != 0 ? stride : component_size * size, | 8832 stride != 0 ? stride : component_size * size, |
| 8830 offset, | 8833 offset, |
| 8831 GL_TRUE); | 8834 GL_TRUE); |
| 8832 glVertexAttribIPointer(indx, size, type, stride, ptr); | 8835 glVertexAttribIPointer(indx, size, type, stride, ptr); |
| 8833 return error::kNoError; | 8836 return error::kNoError; |
| 8834 } | 8837 } |
| 8835 | 8838 |
| 8836 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( | 8839 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( |
| 8837 uint32 immediate_data_size, | 8840 uint32_t immediate_data_size, |
| 8838 const void* cmd_data) { | 8841 const void* cmd_data) { |
| 8839 const gles2::cmds::VertexAttribPointer& c = | 8842 const gles2::cmds::VertexAttribPointer& c = |
| 8840 *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); | 8843 *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); |
| 8841 | 8844 |
| 8842 if (!state_.bound_array_buffer.get() || | 8845 if (!state_.bound_array_buffer.get() || |
| 8843 state_.bound_array_buffer->IsDeleted()) { | 8846 state_.bound_array_buffer->IsDeleted()) { |
| 8844 if (state_.vertex_attrib_manager.get() == | 8847 if (state_.vertex_attrib_manager.get() == |
| 8845 state_.default_vertex_attrib_manager.get()) { | 8848 state_.default_vertex_attrib_manager.get()) { |
| 8846 LOCAL_SET_GL_ERROR( | 8849 LOCAL_SET_GL_ERROR( |
| 8847 GL_INVALID_VALUE, "glVertexAttribPointer", "no array buffer bound"); | 8850 GL_INVALID_VALUE, "glVertexAttribPointer", "no array buffer bound"); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8932 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, | 8935 void GLES2DecoderImpl::DoViewport(GLint x, GLint y, GLsizei width, |
| 8933 GLsizei height) { | 8936 GLsizei height) { |
| 8934 state_.viewport_x = x; | 8937 state_.viewport_x = x; |
| 8935 state_.viewport_y = y; | 8938 state_.viewport_y = y; |
| 8936 state_.viewport_width = std::min(width, viewport_max_width_); | 8939 state_.viewport_width = std::min(width, viewport_max_width_); |
| 8937 state_.viewport_height = std::min(height, viewport_max_height_); | 8940 state_.viewport_height = std::min(height, viewport_max_height_); |
| 8938 glViewport(x, y, width, height); | 8941 glViewport(x, y, width, height); |
| 8939 } | 8942 } |
| 8940 | 8943 |
| 8941 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( | 8944 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( |
| 8942 uint32 immediate_data_size, | 8945 uint32_t immediate_data_size, |
| 8943 const void* cmd_data) { | 8946 const void* cmd_data) { |
| 8944 const gles2::cmds::VertexAttribDivisorANGLE& c = | 8947 const gles2::cmds::VertexAttribDivisorANGLE& c = |
| 8945 *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); | 8948 *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); |
| 8946 if (!features().angle_instanced_arrays) | 8949 if (!features().angle_instanced_arrays) |
| 8947 return error::kUnknownCommand; | 8950 return error::kUnknownCommand; |
| 8948 | 8951 |
| 8949 GLuint index = c.index; | 8952 GLuint index = c.index; |
| 8950 GLuint divisor = c.divisor; | 8953 GLuint divisor = c.divisor; |
| 8951 if (index >= group_->max_vertex_attribs()) { | 8954 if (index >= group_->max_vertex_attribs()) { |
| 8952 LOCAL_SET_GL_ERROR( | 8955 LOCAL_SET_GL_ERROR( |
| 8953 GL_INVALID_VALUE, | 8956 GL_INVALID_VALUE, |
| 8954 "glVertexAttribDivisorANGLE", "index out of range"); | 8957 "glVertexAttribDivisorANGLE", "index out of range"); |
| 8955 return error::kNoError; | 8958 return error::kNoError; |
| 8956 } | 8959 } |
| 8957 | 8960 |
| 8958 state_.vertex_attrib_manager->SetDivisor( | 8961 state_.vertex_attrib_manager->SetDivisor( |
| 8959 index, | 8962 index, |
| 8960 divisor); | 8963 divisor); |
| 8961 glVertexAttribDivisorANGLE(index, divisor); | 8964 glVertexAttribDivisorANGLE(index, divisor); |
| 8962 return error::kNoError; | 8965 return error::kNoError; |
| 8963 } | 8966 } |
| 8964 | 8967 |
| 8965 template <typename pixel_data_type> | 8968 template <typename pixel_data_type> |
| 8966 static void WriteAlphaData( | 8969 static void WriteAlphaData(void* pixels, |
| 8967 void* pixels, uint32 row_count, uint32 channel_count, | 8970 uint32_t row_count, |
| 8968 uint32 alpha_channel_index, uint32 unpadded_row_size, | 8971 uint32_t channel_count, |
| 8969 uint32 padded_row_size, pixel_data_type alpha_value) { | 8972 uint32_t alpha_channel_index, |
| 8973 uint32_t unpadded_row_size, |
| 8974 uint32_t padded_row_size, |
| 8975 pixel_data_type alpha_value) { |
| 8970 DCHECK_GT(channel_count, 0U); | 8976 DCHECK_GT(channel_count, 0U); |
| 8971 DCHECK_EQ(unpadded_row_size % sizeof(pixel_data_type), 0U); | 8977 DCHECK_EQ(unpadded_row_size % sizeof(pixel_data_type), 0U); |
| 8972 uint32 unpadded_row_size_in_elements = | 8978 uint32_t unpadded_row_size_in_elements = |
| 8973 unpadded_row_size / sizeof(pixel_data_type); | 8979 unpadded_row_size / sizeof(pixel_data_type); |
| 8974 DCHECK_EQ(padded_row_size % sizeof(pixel_data_type), 0U); | 8980 DCHECK_EQ(padded_row_size % sizeof(pixel_data_type), 0U); |
| 8975 uint32 padded_row_size_in_elements = | 8981 uint32_t padded_row_size_in_elements = |
| 8976 padded_row_size / sizeof(pixel_data_type); | 8982 padded_row_size / sizeof(pixel_data_type); |
| 8977 pixel_data_type* dst = | 8983 pixel_data_type* dst = |
| 8978 static_cast<pixel_data_type*>(pixels) + alpha_channel_index; | 8984 static_cast<pixel_data_type*>(pixels) + alpha_channel_index; |
| 8979 for (uint32 yy = 0; yy < row_count; ++yy) { | 8985 for (uint32_t yy = 0; yy < row_count; ++yy) { |
| 8980 pixel_data_type* end = dst + unpadded_row_size_in_elements; | 8986 pixel_data_type* end = dst + unpadded_row_size_in_elements; |
| 8981 for (pixel_data_type* d = dst; d < end; d += channel_count) { | 8987 for (pixel_data_type* d = dst; d < end; d += channel_count) { |
| 8982 *d = alpha_value; | 8988 *d = alpha_value; |
| 8983 } | 8989 } |
| 8984 dst += padded_row_size_in_elements; | 8990 dst += padded_row_size_in_elements; |
| 8985 } | 8991 } |
| 8986 } | 8992 } |
| 8987 | 8993 |
| 8988 void GLES2DecoderImpl::FinishReadPixels( | 8994 void GLES2DecoderImpl::FinishReadPixels( |
| 8989 const cmds::ReadPixels& c, | 8995 const cmds::ReadPixels& c, |
| 8990 GLuint buffer) { | 8996 GLuint buffer) { |
| 8991 TRACE_EVENT0("gpu", "GLES2DecoderImpl::FinishReadPixels"); | 8997 TRACE_EVENT0("gpu", "GLES2DecoderImpl::FinishReadPixels"); |
| 8992 GLsizei width = c.width; | 8998 GLsizei width = c.width; |
| 8993 GLsizei height = c.height; | 8999 GLsizei height = c.height; |
| 8994 GLenum format = c.format; | 9000 GLenum format = c.format; |
| 8995 GLenum type = c.type; | 9001 GLenum type = c.type; |
| 8996 typedef cmds::ReadPixels::Result Result; | 9002 typedef cmds::ReadPixels::Result Result; |
| 8997 uint32 pixels_size; | 9003 uint32_t pixels_size; |
| 8998 Result* result = NULL; | 9004 Result* result = NULL; |
| 8999 if (c.result_shm_id != 0) { | 9005 if (c.result_shm_id != 0) { |
| 9000 result = GetSharedMemoryAs<Result*>( | 9006 result = GetSharedMemoryAs<Result*>( |
| 9001 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 9007 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 9002 if (!result) { | 9008 if (!result) { |
| 9003 if (buffer != 0) { | 9009 if (buffer != 0) { |
| 9004 glDeleteBuffersARB(1, &buffer); | 9010 glDeleteBuffersARB(1, &buffer); |
| 9005 } | 9011 } |
| 9006 return; | 9012 return; |
| 9007 } | 9013 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 9037 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, | 9043 glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, |
| 9038 GetServiceId(state_.bound_pixel_pack_buffer.get())); | 9044 GetServiceId(state_.bound_pixel_pack_buffer.get())); |
| 9039 glDeleteBuffersARB(1, &buffer); | 9045 glDeleteBuffersARB(1, &buffer); |
| 9040 } | 9046 } |
| 9041 | 9047 |
| 9042 if (result != NULL) { | 9048 if (result != NULL) { |
| 9043 *result = true; | 9049 *result = true; |
| 9044 } | 9050 } |
| 9045 | 9051 |
| 9046 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); | 9052 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
| 9047 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 9053 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 9048 if ((channels_exist & 0x0008) == 0 && | 9054 if ((channels_exist & 0x0008) == 0 && |
| 9049 workarounds().clear_alpha_in_readpixels) { | 9055 workarounds().clear_alpha_in_readpixels) { |
| 9050 // Set the alpha to 255 because some drivers are buggy in this regard. | 9056 // Set the alpha to 255 because some drivers are buggy in this regard. |
| 9051 uint32 temp_size; | 9057 uint32_t temp_size; |
| 9052 | 9058 |
| 9053 uint32 unpadded_row_size; | 9059 uint32_t unpadded_row_size; |
| 9054 uint32 padded_row_size; | 9060 uint32_t padded_row_size; |
| 9055 if (!GLES2Util::ComputeImageDataSizes( | 9061 if (!GLES2Util::ComputeImageDataSizes( |
| 9056 width, 2, 1, format, type, state_.pack_alignment, &temp_size, | 9062 width, 2, 1, format, type, state_.pack_alignment, &temp_size, |
| 9057 &unpadded_row_size, &padded_row_size)) { | 9063 &unpadded_row_size, &padded_row_size)) { |
| 9058 return; | 9064 return; |
| 9059 } | 9065 } |
| 9060 | 9066 |
| 9061 uint32 channel_count = 0; | 9067 uint32_t channel_count = 0; |
| 9062 uint32 alpha_channel = 0; | 9068 uint32_t alpha_channel = 0; |
| 9063 switch (format) { | 9069 switch (format) { |
| 9064 case GL_RGBA: | 9070 case GL_RGBA: |
| 9065 case GL_BGRA_EXT: | 9071 case GL_BGRA_EXT: |
| 9066 channel_count = 4; | 9072 channel_count = 4; |
| 9067 alpha_channel = 3; | 9073 alpha_channel = 3; |
| 9068 break; | 9074 break; |
| 9069 case GL_ALPHA: | 9075 case GL_ALPHA: |
| 9070 channel_count = 1; | 9076 channel_count = 1; |
| 9071 alpha_channel = 0; | 9077 alpha_channel = 0; |
| 9072 break; | 9078 break; |
| 9073 } | 9079 } |
| 9074 | 9080 |
| 9075 if (channel_count > 0) { | 9081 if (channel_count > 0) { |
| 9076 switch (type) { | 9082 switch (type) { |
| 9077 case GL_UNSIGNED_BYTE: | 9083 case GL_UNSIGNED_BYTE: |
| 9078 WriteAlphaData<uint8>( | 9084 WriteAlphaData<uint8_t>(pixels, height, channel_count, alpha_channel, |
| 9079 pixels, height, channel_count, alpha_channel, unpadded_row_size, | 9085 unpadded_row_size, padded_row_size, 0xFF); |
| 9080 padded_row_size, 0xFF); | |
| 9081 break; | 9086 break; |
| 9082 case GL_FLOAT: | 9087 case GL_FLOAT: |
| 9083 WriteAlphaData<float>( | 9088 WriteAlphaData<float>( |
| 9084 pixels, height, channel_count, alpha_channel, unpadded_row_size, | 9089 pixels, height, channel_count, alpha_channel, unpadded_row_size, |
| 9085 padded_row_size, 1.0f); | 9090 padded_row_size, 1.0f); |
| 9086 break; | 9091 break; |
| 9087 case GL_HALF_FLOAT: | 9092 case GL_HALF_FLOAT: |
| 9088 WriteAlphaData<uint16>( | 9093 WriteAlphaData<uint16_t>(pixels, height, channel_count, alpha_channel, |
| 9089 pixels, height, channel_count, alpha_channel, unpadded_row_size, | 9094 unpadded_row_size, padded_row_size, 0x3C00); |
| 9090 padded_row_size, 0x3C00); | |
| 9091 break; | 9095 break; |
| 9092 } | 9096 } |
| 9093 } | 9097 } |
| 9094 } | 9098 } |
| 9095 } | 9099 } |
| 9096 | 9100 |
| 9097 error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size, | 9101 error::Error GLES2DecoderImpl::HandleReadPixels(uint32_t immediate_data_size, |
| 9098 const void* cmd_data) { | 9102 const void* cmd_data) { |
| 9099 const gles2::cmds::ReadPixels& c = | 9103 const gles2::cmds::ReadPixels& c = |
| 9100 *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); | 9104 *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); |
| 9101 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); | 9105 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); |
| 9102 error::Error fbo_error = WillAccessBoundFramebufferForRead(); | 9106 error::Error fbo_error = WillAccessBoundFramebufferForRead(); |
| 9103 if (fbo_error != error::kNoError) | 9107 if (fbo_error != error::kNoError) |
| 9104 return fbo_error; | 9108 return fbo_error; |
| 9105 GLint x = c.x; | 9109 GLint x = c.x; |
| 9106 GLint y = c.y; | 9110 GLint y = c.y; |
| 9107 GLsizei width = c.width; | 9111 GLsizei width = c.width; |
| 9108 GLsizei height = c.height; | 9112 GLsizei height = c.height; |
| 9109 GLenum format = c.format; | 9113 GLenum format = c.format; |
| 9110 GLenum type = c.type; | 9114 GLenum type = c.type; |
| 9111 GLboolean async = static_cast<GLboolean>(c.async); | 9115 GLboolean async = static_cast<GLboolean>(c.async); |
| 9112 if (width < 0 || height < 0) { | 9116 if (width < 0 || height < 0) { |
| 9113 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", "dimensions < 0"); | 9117 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glReadPixels", "dimensions < 0"); |
| 9114 return error::kNoError; | 9118 return error::kNoError; |
| 9115 } | 9119 } |
| 9116 typedef cmds::ReadPixels::Result Result; | 9120 typedef cmds::ReadPixels::Result Result; |
| 9117 uint32 pixels_size = 0; | 9121 uint32_t pixels_size = 0; |
| 9118 if (c.pixels_shm_id == 0) { | 9122 if (c.pixels_shm_id == 0) { |
| 9119 PixelStoreParams params = state_.GetPackParams(); | 9123 PixelStoreParams params = state_.GetPackParams(); |
| 9120 if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1, format, type, | 9124 if (!GLES2Util::ComputeImageDataSizesES3(width, height, 1, format, type, |
| 9121 params, &pixels_size, nullptr, nullptr, nullptr)) { | 9125 params, &pixels_size, nullptr, nullptr, nullptr)) { |
| 9122 return error::kOutOfBounds; | 9126 return error::kOutOfBounds; |
| 9123 } | 9127 } |
| 9124 } else { | 9128 } else { |
| 9125 // When reading into client buffer, we actually set pack parameters to 0 | 9129 // When reading into client buffer, we actually set pack parameters to 0 |
| 9126 // (except for alignment) before calling glReadPixels. This makes sure we | 9130 // (except for alignment) before calling glReadPixels. This makes sure we |
| 9127 // only send back meaningful pixel data to the command buffer client side, | 9131 // only send back meaningful pixel data to the command buffer client side, |
| 9128 // and the client side will take the responsibility to take the pixels and | 9132 // and the client side will take the responsibility to take the pixels and |
| 9129 // write to the client buffer according to the full ES3 pack parameters. | 9133 // write to the client buffer according to the full ES3 pack parameters. |
| 9130 if (!GLES2Util::ComputeImageDataSizes(width, height, 1, format, type, | 9134 if (!GLES2Util::ComputeImageDataSizes(width, height, 1, format, type, |
| 9131 state_.pack_alignment, &pixels_size, nullptr, nullptr)) { | 9135 state_.pack_alignment, &pixels_size, nullptr, nullptr)) { |
| 9132 return error::kOutOfBounds; | 9136 return error::kOutOfBounds; |
| 9133 } | 9137 } |
| 9134 } | 9138 } |
| 9135 | 9139 |
| 9136 void* pixels = nullptr; | 9140 void* pixels = nullptr; |
| 9137 Buffer* buffer = state_.bound_pixel_pack_buffer.get(); | 9141 Buffer* buffer = state_.bound_pixel_pack_buffer.get(); |
| 9138 if (c.pixels_shm_id == 0) { | 9142 if (c.pixels_shm_id == 0) { |
| 9139 if (buffer) { | 9143 if (buffer) { |
| 9140 if (buffer->GetMappedRange()) { | 9144 if (buffer->GetMappedRange()) { |
| 9141 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", | 9145 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", |
| 9142 "pixel pack buffer should not be mapped to client memory"); | 9146 "pixel pack buffer should not be mapped to client memory"); |
| 9143 return error::kNoError; | 9147 return error::kNoError; |
| 9144 } | 9148 } |
| 9145 uint32 size = 0; | 9149 uint32_t size = 0; |
| 9146 if (!SafeAddUint32(pixels_size, c.pixels_shm_offset, &size)) { | 9150 if (!SafeAddUint32(pixels_size, c.pixels_shm_offset, &size)) { |
| 9147 LOCAL_SET_GL_ERROR( | 9151 LOCAL_SET_GL_ERROR( |
| 9148 GL_INVALID_VALUE, "glReadPixels", "size + offset overflow"); | 9152 GL_INVALID_VALUE, "glReadPixels", "size + offset overflow"); |
| 9149 return error::kNoError; | 9153 return error::kNoError; |
| 9150 } | 9154 } |
| 9151 if (static_cast<uint32>(buffer->size()) < size) { | 9155 if (static_cast<uint32_t>(buffer->size()) < size) { |
| 9152 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", | 9156 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", |
| 9153 "pixel pack buffer is not large enough"); | 9157 "pixel pack buffer is not large enough"); |
| 9154 return error::kNoError; | 9158 return error::kNoError; |
| 9155 } | 9159 } |
| 9156 pixels = reinterpret_cast<void *>(c.pixels_shm_offset); | 9160 pixels = reinterpret_cast<void *>(c.pixels_shm_offset); |
| 9157 } else { | 9161 } else { |
| 9158 return error::kInvalidArguments; | 9162 return error::kInvalidArguments; |
| 9159 } | 9163 } |
| 9160 } else { | 9164 } else { |
| 9161 if (buffer) { | 9165 if (buffer) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9280 "format and type incompatible with the current read framebuffer"); | 9284 "format and type incompatible with the current read framebuffer"); |
| 9281 return error::kNoError; | 9285 return error::kNoError; |
| 9282 } | 9286 } |
| 9283 if (width == 0 || height == 0) { | 9287 if (width == 0 || height == 0) { |
| 9284 return error::kNoError; | 9288 return error::kNoError; |
| 9285 } | 9289 } |
| 9286 | 9290 |
| 9287 // Get the size of the current fbo or backbuffer. | 9291 // Get the size of the current fbo or backbuffer. |
| 9288 gfx::Size max_size = GetBoundReadFrameBufferSize(); | 9292 gfx::Size max_size = GetBoundReadFrameBufferSize(); |
| 9289 | 9293 |
| 9290 int32 max_x; | 9294 int32_t max_x; |
| 9291 int32 max_y; | 9295 int32_t max_y; |
| 9292 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { | 9296 if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y)) { |
| 9293 LOCAL_SET_GL_ERROR( | 9297 LOCAL_SET_GL_ERROR( |
| 9294 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 9298 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
| 9295 return error::kNoError; | 9299 return error::kNoError; |
| 9296 } | 9300 } |
| 9297 | 9301 |
| 9298 if (!CheckBoundFramebuffersValid("glReadPixels")) { | 9302 if (!CheckBoundFramebuffersValid("glReadPixels")) { |
| 9299 return error::kNoError; | 9303 return error::kNoError; |
| 9300 } | 9304 } |
| 9301 | 9305 |
| 9302 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); | 9306 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glReadPixels"); |
| 9303 | 9307 |
| 9304 ScopedResolvedFrameBufferBinder binder(this, false, true); | 9308 ScopedResolvedFrameBufferBinder binder(this, false, true); |
| 9305 | 9309 |
| 9306 if (x < 0 || y < 0 || max_x > max_size.width() || max_y > max_size.height()) { | 9310 if (x < 0 || y < 0 || max_x > max_size.width() || max_y > max_size.height()) { |
| 9307 // TODO(yunchao): need to handle the out-of-bounds case for reading pixels | 9311 // TODO(yunchao): need to handle the out-of-bounds case for reading pixels |
| 9308 // into PIXEL_PACK buffer. | 9312 // into PIXEL_PACK buffer. |
| 9309 if (c.pixels_shm_id == 0) { | 9313 if (c.pixels_shm_id == 0) { |
| 9310 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", | 9314 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glReadPixels", |
| 9311 "read pixels out of bounds into PIXEL_PACK buffer"); | 9315 "read pixels out of bounds into PIXEL_PACK buffer"); |
| 9312 return error::kNoError; | 9316 return error::kNoError; |
| 9313 } | 9317 } |
| 9314 // The user requested an out of range area. Get the results 1 line | 9318 // The user requested an out of range area. Get the results 1 line |
| 9315 // at a time. | 9319 // at a time. |
| 9316 uint32 temp_size; | 9320 uint32_t temp_size; |
| 9317 uint32 unpadded_row_size; | 9321 uint32_t unpadded_row_size; |
| 9318 uint32 padded_row_size; | 9322 uint32_t padded_row_size; |
| 9319 if (!GLES2Util::ComputeImageDataSizes( | 9323 if (!GLES2Util::ComputeImageDataSizes( |
| 9320 width, 2, 1, format, type, state_.pack_alignment, &temp_size, | 9324 width, 2, 1, format, type, state_.pack_alignment, &temp_size, |
| 9321 &unpadded_row_size, &padded_row_size)) { | 9325 &unpadded_row_size, &padded_row_size)) { |
| 9322 LOCAL_SET_GL_ERROR( | 9326 LOCAL_SET_GL_ERROR( |
| 9323 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 9327 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
| 9324 return error::kNoError; | 9328 return error::kNoError; |
| 9325 } | 9329 } |
| 9326 | 9330 |
| 9327 GLint dest_x_offset = std::max(-x, 0); | 9331 GLint dest_x_offset = std::max(-x, 0); |
| 9328 uint32 dest_row_offset; | 9332 uint32_t dest_row_offset; |
| 9329 if (!GLES2Util::ComputeImageDataSizes( | 9333 if (!GLES2Util::ComputeImageDataSizes( |
| 9330 dest_x_offset, 1, 1, format, type, state_.pack_alignment, | 9334 dest_x_offset, 1, 1, format, type, state_.pack_alignment, |
| 9331 &dest_row_offset, NULL, NULL)) { | 9335 &dest_row_offset, NULL, NULL)) { |
| 9332 LOCAL_SET_GL_ERROR( | 9336 LOCAL_SET_GL_ERROR( |
| 9333 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); | 9337 GL_INVALID_VALUE, "glReadPixels", "dimensions out of range"); |
| 9334 return error::kNoError; | 9338 return error::kNoError; |
| 9335 } | 9339 } |
| 9336 | 9340 |
| 9337 // Copy each row into the larger dest rect. | 9341 // Copy each row into the larger dest rect. |
| 9338 int8* dst = static_cast<int8*>(pixels); | 9342 int8_t* dst = static_cast<int8_t*>(pixels); |
| 9339 GLint read_x = std::max(0, x); | 9343 GLint read_x = std::max(0, x); |
| 9340 GLint read_end_x = std::max(0, std::min(max_size.width(), max_x)); | 9344 GLint read_end_x = std::max(0, std::min(max_size.width(), max_x)); |
| 9341 GLint read_width = read_end_x - read_x; | 9345 GLint read_width = read_end_x - read_x; |
| 9342 for (GLint yy = 0; yy < height; ++yy) { | 9346 for (GLint yy = 0; yy < height; ++yy) { |
| 9343 GLint ry = y + yy; | 9347 GLint ry = y + yy; |
| 9344 | 9348 |
| 9345 // Clear the row. | 9349 // Clear the row. |
| 9346 memset(dst, 0, unpadded_row_size); | 9350 memset(dst, 0, unpadded_row_size); |
| 9347 | 9351 |
| 9348 // If the row is in range, copy it. | 9352 // If the row is in range, copy it. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9392 if (result != NULL) { | 9396 if (result != NULL) { |
| 9393 *result = true; | 9397 *result = true; |
| 9394 } | 9398 } |
| 9395 FinishReadPixels(c, 0); | 9399 FinishReadPixels(c, 0); |
| 9396 } | 9400 } |
| 9397 } | 9401 } |
| 9398 | 9402 |
| 9399 return error::kNoError; | 9403 return error::kNoError; |
| 9400 } | 9404 } |
| 9401 | 9405 |
| 9402 error::Error GLES2DecoderImpl::HandlePixelStorei(uint32 immediate_data_size, | 9406 error::Error GLES2DecoderImpl::HandlePixelStorei(uint32_t immediate_data_size, |
| 9403 const void* cmd_data) { | 9407 const void* cmd_data) { |
| 9404 const gles2::cmds::PixelStorei& c = | 9408 const gles2::cmds::PixelStorei& c = |
| 9405 *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); | 9409 *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); |
| 9406 GLenum pname = c.pname; | 9410 GLenum pname = c.pname; |
| 9407 GLint param = c.param; | 9411 GLint param = c.param; |
| 9408 if (!validators_->pixel_store.IsValid(pname)) { | 9412 if (!validators_->pixel_store.IsValid(pname)) { |
| 9409 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); | 9413 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); |
| 9410 return error::kNoError; | 9414 return error::kNoError; |
| 9411 } | 9415 } |
| 9412 switch (pname) { | 9416 switch (pname) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9492 break; | 9496 break; |
| 9493 default: | 9497 default: |
| 9494 // Validation should have prevented us from getting here. | 9498 // Validation should have prevented us from getting here. |
| 9495 NOTREACHED(); | 9499 NOTREACHED(); |
| 9496 break; | 9500 break; |
| 9497 } | 9501 } |
| 9498 return error::kNoError; | 9502 return error::kNoError; |
| 9499 } | 9503 } |
| 9500 | 9504 |
| 9501 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( | 9505 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
| 9502 uint32 immediate_data_size, | 9506 uint32_t immediate_data_size, |
| 9503 const void* cmd_data) { | 9507 const void* cmd_data) { |
| 9504 const gles2::cmds::PostSubBufferCHROMIUM& c = | 9508 const gles2::cmds::PostSubBufferCHROMIUM& c = |
| 9505 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); | 9509 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); |
| 9506 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); | 9510 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); |
| 9507 { | 9511 { |
| 9508 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); | 9512 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); |
| 9509 } | 9513 } |
| 9510 if (!supports_post_sub_buffer_) { | 9514 if (!supports_post_sub_buffer_) { |
| 9511 LOCAL_SET_GL_ERROR( | 9515 LOCAL_SET_GL_ERROR( |
| 9512 GL_INVALID_OPERATION, | 9516 GL_INVALID_OPERATION, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 9529 base::Bind(&GLES2DecoderImpl::FinishSwapBuffers, | 9533 base::Bind(&GLES2DecoderImpl::FinishSwapBuffers, |
| 9530 base::AsWeakPtr(this))); | 9534 base::AsWeakPtr(this))); |
| 9531 } else { | 9535 } else { |
| 9532 FinishSwapBuffers(surface_->PostSubBuffer(c.x, c.y, c.width, c.height)); | 9536 FinishSwapBuffers(surface_->PostSubBuffer(c.x, c.y, c.width, c.height)); |
| 9533 } | 9537 } |
| 9534 | 9538 |
| 9535 return error::kNoError; | 9539 return error::kNoError; |
| 9536 } | 9540 } |
| 9537 | 9541 |
| 9538 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( | 9542 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( |
| 9539 uint32 immediate_data_size, | 9543 uint32_t immediate_data_size, |
| 9540 const void* cmd_data) { | 9544 const void* cmd_data) { |
| 9541 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = | 9545 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = |
| 9542 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); | 9546 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); |
| 9543 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); | 9547 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); |
| 9544 if (!ref) { | 9548 if (!ref) { |
| 9545 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, | 9549 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, |
| 9546 "glScheduleOverlayPlaneCHROMIUM", | 9550 "glScheduleOverlayPlaneCHROMIUM", |
| 9547 "unknown texture"); | 9551 "unknown texture"); |
| 9548 return error::kNoError; | 9552 return error::kNoError; |
| 9549 } | 9553 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 9574 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), | 9578 gfx::Rect(c.bounds_x, c.bounds_y, c.bounds_width, c.bounds_height), |
| 9575 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { | 9579 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { |
| 9576 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 9580 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
| 9577 "glScheduleOverlayPlaneCHROMIUM", | 9581 "glScheduleOverlayPlaneCHROMIUM", |
| 9578 "failed to schedule overlay"); | 9582 "failed to schedule overlay"); |
| 9579 } | 9583 } |
| 9580 return error::kNoError; | 9584 return error::kNoError; |
| 9581 } | 9585 } |
| 9582 | 9586 |
| 9583 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( | 9587 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( |
| 9584 uint32 immediate_data_size, | 9588 uint32_t immediate_data_size, |
| 9585 const void* cmd_data) { | 9589 const void* cmd_data) { |
| 9586 const gles2::cmds::ScheduleCALayerCHROMIUM& c = | 9590 const gles2::cmds::ScheduleCALayerCHROMIUM& c = |
| 9587 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); | 9591 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); |
| 9588 gl::GLImage* image = nullptr; | 9592 gl::GLImage* image = nullptr; |
| 9589 if (c.contents_texture_id) { | 9593 if (c.contents_texture_id) { |
| 9590 TextureRef* ref = texture_manager()->GetTexture(c.contents_texture_id); | 9594 TextureRef* ref = texture_manager()->GetTexture(c.contents_texture_id); |
| 9591 if (!ref) { | 9595 if (!ref) { |
| 9592 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", | 9596 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", |
| 9593 "unknown texture"); | 9597 "unknown texture"); |
| 9594 return error::kNoError; | 9598 return error::kNoError; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 9619 c.background_color, c.edge_aa_mask, | 9623 c.background_color, c.edge_aa_mask, |
| 9620 bounds_rect, c.is_clipped ? true : false, | 9624 bounds_rect, c.is_clipped ? true : false, |
| 9621 clip_rect, transform)) { | 9625 clip_rect, transform)) { |
| 9622 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", | 9626 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", |
| 9623 "failed to schedule CALayer"); | 9627 "failed to schedule CALayer"); |
| 9624 } | 9628 } |
| 9625 return error::kNoError; | 9629 return error::kNoError; |
| 9626 } | 9630 } |
| 9627 | 9631 |
| 9628 error::Error GLES2DecoderImpl::GetAttribLocationHelper( | 9632 error::Error GLES2DecoderImpl::GetAttribLocationHelper( |
| 9629 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 9633 GLuint client_id, |
| 9634 uint32_t location_shm_id, |
| 9635 uint32_t location_shm_offset, |
| 9630 const std::string& name_str) { | 9636 const std::string& name_str) { |
| 9631 if (!StringIsValidForGLES(name_str)) { | 9637 if (!StringIsValidForGLES(name_str)) { |
| 9632 LOCAL_SET_GL_ERROR( | 9638 LOCAL_SET_GL_ERROR( |
| 9633 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); | 9639 GL_INVALID_VALUE, "glGetAttribLocation", "Invalid character"); |
| 9634 return error::kNoError; | 9640 return error::kNoError; |
| 9635 } | 9641 } |
| 9636 Program* program = GetProgramInfoNotShader( | 9642 Program* program = GetProgramInfoNotShader( |
| 9637 client_id, "glGetAttribLocation"); | 9643 client_id, "glGetAttribLocation"); |
| 9638 if (!program) { | 9644 if (!program) { |
| 9639 return error::kNoError; | 9645 return error::kNoError; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 9650 } | 9656 } |
| 9651 // Check that the client initialized the result. | 9657 // Check that the client initialized the result. |
| 9652 if (*location != -1) { | 9658 if (*location != -1) { |
| 9653 return error::kInvalidArguments; | 9659 return error::kInvalidArguments; |
| 9654 } | 9660 } |
| 9655 *location = program->GetAttribLocation(name_str); | 9661 *location = program->GetAttribLocation(name_str); |
| 9656 return error::kNoError; | 9662 return error::kNoError; |
| 9657 } | 9663 } |
| 9658 | 9664 |
| 9659 error::Error GLES2DecoderImpl::HandleGetAttribLocation( | 9665 error::Error GLES2DecoderImpl::HandleGetAttribLocation( |
| 9660 uint32 immediate_data_size, | 9666 uint32_t immediate_data_size, |
| 9661 const void* cmd_data) { | 9667 const void* cmd_data) { |
| 9662 const gles2::cmds::GetAttribLocation& c = | 9668 const gles2::cmds::GetAttribLocation& c = |
| 9663 *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); | 9669 *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); |
| 9664 Bucket* bucket = GetBucket(c.name_bucket_id); | 9670 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 9665 if (!bucket) { | 9671 if (!bucket) { |
| 9666 return error::kInvalidArguments; | 9672 return error::kInvalidArguments; |
| 9667 } | 9673 } |
| 9668 std::string name_str; | 9674 std::string name_str; |
| 9669 if (!bucket->GetAsString(&name_str)) { | 9675 if (!bucket->GetAsString(&name_str)) { |
| 9670 return error::kInvalidArguments; | 9676 return error::kInvalidArguments; |
| 9671 } | 9677 } |
| 9672 return GetAttribLocationHelper( | 9678 return GetAttribLocationHelper( |
| 9673 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 9679 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 9674 } | 9680 } |
| 9675 | 9681 |
| 9676 error::Error GLES2DecoderImpl::GetUniformLocationHelper( | 9682 error::Error GLES2DecoderImpl::GetUniformLocationHelper( |
| 9677 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 9683 GLuint client_id, |
| 9684 uint32_t location_shm_id, |
| 9685 uint32_t location_shm_offset, |
| 9678 const std::string& name_str) { | 9686 const std::string& name_str) { |
| 9679 if (!StringIsValidForGLES(name_str)) { | 9687 if (!StringIsValidForGLES(name_str)) { |
| 9680 LOCAL_SET_GL_ERROR( | 9688 LOCAL_SET_GL_ERROR( |
| 9681 GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character"); | 9689 GL_INVALID_VALUE, "glGetUniformLocation", "Invalid character"); |
| 9682 return error::kNoError; | 9690 return error::kNoError; |
| 9683 } | 9691 } |
| 9684 Program* program = GetProgramInfoNotShader( | 9692 Program* program = GetProgramInfoNotShader( |
| 9685 client_id, "glGetUniformLocation"); | 9693 client_id, "glGetUniformLocation"); |
| 9686 if (!program) { | 9694 if (!program) { |
| 9687 return error::kNoError; | 9695 return error::kNoError; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 9698 } | 9706 } |
| 9699 // Check that the client initialized the result. | 9707 // Check that the client initialized the result. |
| 9700 if (*location != -1) { | 9708 if (*location != -1) { |
| 9701 return error::kInvalidArguments; | 9709 return error::kInvalidArguments; |
| 9702 } | 9710 } |
| 9703 *location = program->GetUniformFakeLocation(name_str); | 9711 *location = program->GetUniformFakeLocation(name_str); |
| 9704 return error::kNoError; | 9712 return error::kNoError; |
| 9705 } | 9713 } |
| 9706 | 9714 |
| 9707 error::Error GLES2DecoderImpl::HandleGetUniformLocation( | 9715 error::Error GLES2DecoderImpl::HandleGetUniformLocation( |
| 9708 uint32 immediate_data_size, | 9716 uint32_t immediate_data_size, |
| 9709 const void* cmd_data) { | 9717 const void* cmd_data) { |
| 9710 const gles2::cmds::GetUniformLocation& c = | 9718 const gles2::cmds::GetUniformLocation& c = |
| 9711 *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); | 9719 *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); |
| 9712 Bucket* bucket = GetBucket(c.name_bucket_id); | 9720 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 9713 if (!bucket) { | 9721 if (!bucket) { |
| 9714 return error::kInvalidArguments; | 9722 return error::kInvalidArguments; |
| 9715 } | 9723 } |
| 9716 std::string name_str; | 9724 std::string name_str; |
| 9717 if (!bucket->GetAsString(&name_str)) { | 9725 if (!bucket->GetAsString(&name_str)) { |
| 9718 return error::kInvalidArguments; | 9726 return error::kInvalidArguments; |
| 9719 } | 9727 } |
| 9720 return GetUniformLocationHelper( | 9728 return GetUniformLocationHelper( |
| 9721 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 9729 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 9722 } | 9730 } |
| 9723 | 9731 |
| 9724 error::Error GLES2DecoderImpl::HandleGetUniformIndices( | 9732 error::Error GLES2DecoderImpl::HandleGetUniformIndices( |
| 9725 uint32 immediate_data_size, | 9733 uint32_t immediate_data_size, |
| 9726 const void* cmd_data) { | 9734 const void* cmd_data) { |
| 9727 if (!unsafe_es3_apis_enabled()) | 9735 if (!unsafe_es3_apis_enabled()) |
| 9728 return error::kUnknownCommand; | 9736 return error::kUnknownCommand; |
| 9729 const gles2::cmds::GetUniformIndices& c = | 9737 const gles2::cmds::GetUniformIndices& c = |
| 9730 *static_cast<const gles2::cmds::GetUniformIndices*>(cmd_data); | 9738 *static_cast<const gles2::cmds::GetUniformIndices*>(cmd_data); |
| 9731 Bucket* bucket = GetBucket(c.names_bucket_id); | 9739 Bucket* bucket = GetBucket(c.names_bucket_id); |
| 9732 if (!bucket) { | 9740 if (!bucket) { |
| 9733 return error::kInvalidArguments; | 9741 return error::kInvalidArguments; |
| 9734 } | 9742 } |
| 9735 GLsizei count = 0; | 9743 GLsizei count = 0; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9767 GLenum error = glGetError(); | 9775 GLenum error = glGetError(); |
| 9768 if (error == GL_NO_ERROR) { | 9776 if (error == GL_NO_ERROR) { |
| 9769 result->SetNumResults(count); | 9777 result->SetNumResults(count); |
| 9770 } else { | 9778 } else { |
| 9771 LOCAL_SET_GL_ERROR(error, "GetUniformIndices", ""); | 9779 LOCAL_SET_GL_ERROR(error, "GetUniformIndices", ""); |
| 9772 } | 9780 } |
| 9773 return error::kNoError; | 9781 return error::kNoError; |
| 9774 } | 9782 } |
| 9775 | 9783 |
| 9776 error::Error GLES2DecoderImpl::GetFragDataLocationHelper( | 9784 error::Error GLES2DecoderImpl::GetFragDataLocationHelper( |
| 9777 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 9785 GLuint client_id, |
| 9786 uint32_t location_shm_id, |
| 9787 uint32_t location_shm_offset, |
| 9778 const std::string& name_str) { | 9788 const std::string& name_str) { |
| 9779 const char kFunctionName[] = "glGetFragDataLocation"; | 9789 const char kFunctionName[] = "glGetFragDataLocation"; |
| 9780 GLint* location = GetSharedMemoryAs<GLint*>( | 9790 GLint* location = GetSharedMemoryAs<GLint*>( |
| 9781 location_shm_id, location_shm_offset, sizeof(GLint)); | 9791 location_shm_id, location_shm_offset, sizeof(GLint)); |
| 9782 if (!location) { | 9792 if (!location) { |
| 9783 return error::kOutOfBounds; | 9793 return error::kOutOfBounds; |
| 9784 } | 9794 } |
| 9785 // Check that the client initialized the result. | 9795 // Check that the client initialized the result. |
| 9786 if (*location != -1) { | 9796 if (*location != -1) { |
| 9787 return error::kInvalidArguments; | 9797 return error::kInvalidArguments; |
| 9788 } | 9798 } |
| 9789 Program* program = GetProgramInfoNotShader(client_id, kFunctionName); | 9799 Program* program = GetProgramInfoNotShader(client_id, kFunctionName); |
| 9790 if (!program) { | 9800 if (!program) { |
| 9791 return error::kNoError; | 9801 return error::kNoError; |
| 9792 } | 9802 } |
| 9793 if (!program->IsValid()) { | 9803 if (!program->IsValid()) { |
| 9794 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 9804 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 9795 "program not linked"); | 9805 "program not linked"); |
| 9796 return error::kNoError; | 9806 return error::kNoError; |
| 9797 } | 9807 } |
| 9798 | 9808 |
| 9799 *location = program->GetFragDataLocation(name_str); | 9809 *location = program->GetFragDataLocation(name_str); |
| 9800 return error::kNoError; | 9810 return error::kNoError; |
| 9801 } | 9811 } |
| 9802 | 9812 |
| 9803 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( | 9813 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( |
| 9804 uint32 immediate_data_size, | 9814 uint32_t immediate_data_size, |
| 9805 const void* cmd_data) { | 9815 const void* cmd_data) { |
| 9806 if (!unsafe_es3_apis_enabled()) | 9816 if (!unsafe_es3_apis_enabled()) |
| 9807 return error::kUnknownCommand; | 9817 return error::kUnknownCommand; |
| 9808 const gles2::cmds::GetFragDataLocation& c = | 9818 const gles2::cmds::GetFragDataLocation& c = |
| 9809 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); | 9819 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); |
| 9810 Bucket* bucket = GetBucket(c.name_bucket_id); | 9820 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 9811 if (!bucket) { | 9821 if (!bucket) { |
| 9812 return error::kInvalidArguments; | 9822 return error::kInvalidArguments; |
| 9813 } | 9823 } |
| 9814 std::string name_str; | 9824 std::string name_str; |
| 9815 if (!bucket->GetAsString(&name_str)) { | 9825 if (!bucket->GetAsString(&name_str)) { |
| 9816 return error::kInvalidArguments; | 9826 return error::kInvalidArguments; |
| 9817 } | 9827 } |
| 9818 return GetFragDataLocationHelper( | 9828 return GetFragDataLocationHelper( |
| 9819 c.program, c.location_shm_id, c.location_shm_offset, name_str); | 9829 c.program, c.location_shm_id, c.location_shm_offset, name_str); |
| 9820 } | 9830 } |
| 9821 | 9831 |
| 9822 error::Error GLES2DecoderImpl::GetFragDataIndexHelper( | 9832 error::Error GLES2DecoderImpl::GetFragDataIndexHelper( |
| 9823 GLuint program_id, | 9833 GLuint program_id, |
| 9824 uint32 index_shm_id, | 9834 uint32_t index_shm_id, |
| 9825 uint32 index_shm_offset, | 9835 uint32_t index_shm_offset, |
| 9826 const std::string& name_str) { | 9836 const std::string& name_str) { |
| 9827 const char kFunctionName[] = "glGetFragDataIndexEXT"; | 9837 const char kFunctionName[] = "glGetFragDataIndexEXT"; |
| 9828 GLint* index = | 9838 GLint* index = |
| 9829 GetSharedMemoryAs<GLint*>(index_shm_id, index_shm_offset, sizeof(GLint)); | 9839 GetSharedMemoryAs<GLint*>(index_shm_id, index_shm_offset, sizeof(GLint)); |
| 9830 if (!index) { | 9840 if (!index) { |
| 9831 return error::kOutOfBounds; | 9841 return error::kOutOfBounds; |
| 9832 } | 9842 } |
| 9833 // Check that the client initialized the result. | 9843 // Check that the client initialized the result. |
| 9834 if (*index != -1) { | 9844 if (*index != -1) { |
| 9835 return error::kInvalidArguments; | 9845 return error::kInvalidArguments; |
| 9836 } | 9846 } |
| 9837 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); | 9847 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); |
| 9838 if (!program) { | 9848 if (!program) { |
| 9839 return error::kNoError; | 9849 return error::kNoError; |
| 9840 } | 9850 } |
| 9841 if (!program->IsValid()) { | 9851 if (!program->IsValid()) { |
| 9842 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 9852 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 9843 "program not linked"); | 9853 "program not linked"); |
| 9844 return error::kNoError; | 9854 return error::kNoError; |
| 9845 } | 9855 } |
| 9846 | 9856 |
| 9847 *index = program->GetFragDataIndex(name_str); | 9857 *index = program->GetFragDataIndex(name_str); |
| 9848 return error::kNoError; | 9858 return error::kNoError; |
| 9849 } | 9859 } |
| 9850 | 9860 |
| 9851 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT( | 9861 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT( |
| 9852 uint32 immediate_data_size, | 9862 uint32_t immediate_data_size, |
| 9853 const void* cmd_data) { | 9863 const void* cmd_data) { |
| 9854 if (!features().ext_blend_func_extended) { | 9864 if (!features().ext_blend_func_extended) { |
| 9855 return error::kUnknownCommand; | 9865 return error::kUnknownCommand; |
| 9856 } | 9866 } |
| 9857 const gles2::cmds::GetFragDataIndexEXT& c = | 9867 const gles2::cmds::GetFragDataIndexEXT& c = |
| 9858 *static_cast<const gles2::cmds::GetFragDataIndexEXT*>(cmd_data); | 9868 *static_cast<const gles2::cmds::GetFragDataIndexEXT*>(cmd_data); |
| 9859 Bucket* bucket = GetBucket(c.name_bucket_id); | 9869 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 9860 if (!bucket) { | 9870 if (!bucket) { |
| 9861 return error::kInvalidArguments; | 9871 return error::kInvalidArguments; |
| 9862 } | 9872 } |
| 9863 std::string name_str; | 9873 std::string name_str; |
| 9864 if (!bucket->GetAsString(&name_str)) { | 9874 if (!bucket->GetAsString(&name_str)) { |
| 9865 return error::kInvalidArguments; | 9875 return error::kInvalidArguments; |
| 9866 } | 9876 } |
| 9867 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, | 9877 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, |
| 9868 name_str); | 9878 name_str); |
| 9869 } | 9879 } |
| 9870 | 9880 |
| 9871 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( | 9881 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( |
| 9872 uint32 immediate_data_size, const void* cmd_data) { | 9882 uint32_t immediate_data_size, |
| 9883 const void* cmd_data) { |
| 9873 if (!unsafe_es3_apis_enabled()) | 9884 if (!unsafe_es3_apis_enabled()) |
| 9874 return error::kUnknownCommand; | 9885 return error::kUnknownCommand; |
| 9875 const gles2::cmds::GetUniformBlockIndex& c = | 9886 const gles2::cmds::GetUniformBlockIndex& c = |
| 9876 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); | 9887 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); |
| 9877 Bucket* bucket = GetBucket(c.name_bucket_id); | 9888 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 9878 if (!bucket) { | 9889 if (!bucket) { |
| 9879 return error::kInvalidArguments; | 9890 return error::kInvalidArguments; |
| 9880 } | 9891 } |
| 9881 std::string name_str; | 9892 std::string name_str; |
| 9882 if (!bucket->GetAsString(&name_str)) { | 9893 if (!bucket->GetAsString(&name_str)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 9893 } | 9904 } |
| 9894 Program* program = GetProgramInfoNotShader( | 9905 Program* program = GetProgramInfoNotShader( |
| 9895 c.program, "glGetUniformBlockIndex"); | 9906 c.program, "glGetUniformBlockIndex"); |
| 9896 if (!program) { | 9907 if (!program) { |
| 9897 return error::kNoError; | 9908 return error::kNoError; |
| 9898 } | 9909 } |
| 9899 *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str()); | 9910 *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str()); |
| 9900 return error::kNoError; | 9911 return error::kNoError; |
| 9901 } | 9912 } |
| 9902 | 9913 |
| 9903 error::Error GLES2DecoderImpl::HandleGetString(uint32 immediate_data_size, | 9914 error::Error GLES2DecoderImpl::HandleGetString(uint32_t immediate_data_size, |
| 9904 const void* cmd_data) { | 9915 const void* cmd_data) { |
| 9905 const gles2::cmds::GetString& c = | 9916 const gles2::cmds::GetString& c = |
| 9906 *static_cast<const gles2::cmds::GetString*>(cmd_data); | 9917 *static_cast<const gles2::cmds::GetString*>(cmd_data); |
| 9907 GLenum name = static_cast<GLenum>(c.name); | 9918 GLenum name = static_cast<GLenum>(c.name); |
| 9908 if (!validators_->string_type.IsValid(name)) { | 9919 if (!validators_->string_type.IsValid(name)) { |
| 9909 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); | 9920 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); |
| 9910 return error::kNoError; | 9921 return error::kNoError; |
| 9911 } | 9922 } |
| 9912 | 9923 |
| 9913 const char* str = nullptr; | 9924 const char* str = nullptr; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9979 break; | 9990 break; |
| 9980 default: | 9991 default: |
| 9981 str = reinterpret_cast<const char*>(glGetString(name)); | 9992 str = reinterpret_cast<const char*>(glGetString(name)); |
| 9982 break; | 9993 break; |
| 9983 } | 9994 } |
| 9984 Bucket* bucket = CreateBucket(c.bucket_id); | 9995 Bucket* bucket = CreateBucket(c.bucket_id); |
| 9985 bucket->SetFromString(str); | 9996 bucket->SetFromString(str); |
| 9986 return error::kNoError; | 9997 return error::kNoError; |
| 9987 } | 9998 } |
| 9988 | 9999 |
| 9989 error::Error GLES2DecoderImpl::HandleBufferData(uint32 immediate_data_size, | 10000 error::Error GLES2DecoderImpl::HandleBufferData(uint32_t immediate_data_size, |
| 9990 const void* cmd_data) { | 10001 const void* cmd_data) { |
| 9991 const gles2::cmds::BufferData& c = | 10002 const gles2::cmds::BufferData& c = |
| 9992 *static_cast<const gles2::cmds::BufferData*>(cmd_data); | 10003 *static_cast<const gles2::cmds::BufferData*>(cmd_data); |
| 9993 GLenum target = static_cast<GLenum>(c.target); | 10004 GLenum target = static_cast<GLenum>(c.target); |
| 9994 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 10005 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 9995 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 10006 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); |
| 9996 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 10007 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); |
| 9997 GLenum usage = static_cast<GLenum>(c.usage); | 10008 GLenum usage = static_cast<GLenum>(c.usage); |
| 9998 const void* data = NULL; | 10009 const void* data = NULL; |
| 9999 if (data_shm_id != 0 || data_shm_offset != 0) { | 10010 if (data_shm_id != 0 || data_shm_offset != 0) { |
| 10000 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); | 10011 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); |
| 10001 if (!data) { | 10012 if (!data) { |
| 10002 return error::kOutOfBounds; | 10013 return error::kOutOfBounds; |
| 10003 } | 10014 } |
| 10004 } | 10015 } |
| 10005 buffer_manager()->ValidateAndDoBufferData(&state_, target, size, data, usage); | 10016 buffer_manager()->ValidateAndDoBufferData(&state_, target, size, data, usage); |
| 10006 return error::kNoError; | 10017 return error::kNoError; |
| 10007 } | 10018 } |
| 10008 | 10019 |
| 10009 void GLES2DecoderImpl::DoBufferSubData( | 10020 void GLES2DecoderImpl::DoBufferSubData( |
| 10010 GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { | 10021 GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data) { |
| 10011 // Just delegate it. Some validation is actually done before this. | 10022 // Just delegate it. Some validation is actually done before this. |
| 10012 buffer_manager()->ValidateAndDoBufferSubData( | 10023 buffer_manager()->ValidateAndDoBufferSubData( |
| 10013 &state_, target, offset, size, data); | 10024 &state_, target, offset, size, data); |
| 10014 } | 10025 } |
| 10015 | 10026 |
| 10016 bool GLES2DecoderImpl::ClearLevel(Texture* texture, | 10027 bool GLES2DecoderImpl::ClearLevel(Texture* texture, |
| 10017 unsigned target, | 10028 unsigned target, |
| 10018 int level, | 10029 int level, |
| 10019 unsigned format, | 10030 unsigned format, |
| 10020 unsigned type, | 10031 unsigned type, |
| 10021 int xoffset, | 10032 int xoffset, |
| 10022 int yoffset, | 10033 int yoffset, |
| 10023 int width, | 10034 int width, |
| 10024 int height) { | 10035 int height) { |
| 10025 uint32 channels = GLES2Util::GetChannelsForFormat(format); | 10036 uint32_t channels = GLES2Util::GetChannelsForFormat(format); |
| 10026 if ((feature_info_->feature_flags().angle_depth_texture || | 10037 if ((feature_info_->feature_flags().angle_depth_texture || |
| 10027 feature_info_->IsES3Enabled()) | 10038 feature_info_->IsES3Enabled()) |
| 10028 && (channels & GLES2Util::kDepth) != 0) { | 10039 && (channels & GLES2Util::kDepth) != 0) { |
| 10029 // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D | 10040 // It's a depth format and ANGLE doesn't allow texImage2D or texSubImage2D |
| 10030 // on depth formats. | 10041 // on depth formats. |
| 10031 GLuint fb = 0; | 10042 GLuint fb = 0; |
| 10032 glGenFramebuffersEXT(1, &fb); | 10043 glGenFramebuffersEXT(1, &fb); |
| 10033 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); | 10044 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); |
| 10034 | 10045 |
| 10035 bool have_stencil = (channels & GLES2Util::kStencil) != 0; | 10046 bool have_stencil = (channels & GLES2Util::kStencil) != 0; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 10056 | 10067 |
| 10057 glDeleteFramebuffersEXT(1, &fb); | 10068 glDeleteFramebuffersEXT(1, &fb); |
| 10058 Framebuffer* framebuffer = | 10069 Framebuffer* framebuffer = |
| 10059 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); | 10070 GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); |
| 10060 GLuint fb_service_id = | 10071 GLuint fb_service_id = |
| 10061 framebuffer ? framebuffer->service_id() : GetBackbufferServiceId(); | 10072 framebuffer ? framebuffer->service_id() : GetBackbufferServiceId(); |
| 10062 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id); | 10073 glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id); |
| 10063 return true; | 10074 return true; |
| 10064 } | 10075 } |
| 10065 | 10076 |
| 10066 static const uint32 kMaxZeroSize = 1024 * 1024 * 4; | 10077 static const uint32_t kMaxZeroSize = 1024 * 1024 * 4; |
| 10067 | 10078 |
| 10068 uint32 size; | 10079 uint32_t size; |
| 10069 uint32 padded_row_size; | 10080 uint32_t padded_row_size; |
| 10070 if (!GLES2Util::ComputeImageDataSizes( | 10081 if (!GLES2Util::ComputeImageDataSizes( |
| 10071 width, height, 1, format, type, state_.unpack_alignment, &size, | 10082 width, height, 1, format, type, state_.unpack_alignment, &size, |
| 10072 NULL, &padded_row_size)) { | 10083 NULL, &padded_row_size)) { |
| 10073 return false; | 10084 return false; |
| 10074 } | 10085 } |
| 10075 | 10086 |
| 10076 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel", "size", size); | 10087 TRACE_EVENT1("gpu", "GLES2DecoderImpl::ClearLevel", "size", size); |
| 10077 | 10088 |
| 10078 int tile_height; | 10089 int tile_height; |
| 10079 | 10090 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10564 if (!EnsureGPUMemoryAvailable(image_size)) { | 10575 if (!EnsureGPUMemoryAvailable(image_size)) { |
| 10565 LOCAL_SET_GL_ERROR( | 10576 LOCAL_SET_GL_ERROR( |
| 10566 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); | 10577 GL_OUT_OF_MEMORY, "glCompressedTexImage2D", "out of memory"); |
| 10567 return error::kNoError; | 10578 return error::kNoError; |
| 10568 } | 10579 } |
| 10569 | 10580 |
| 10570 if (texture->IsAttachedToFramebuffer()) { | 10581 if (texture->IsAttachedToFramebuffer()) { |
| 10571 framebuffer_state_.clear_state_dirty = true; | 10582 framebuffer_state_.clear_state_dirty = true; |
| 10572 } | 10583 } |
| 10573 | 10584 |
| 10574 scoped_ptr<int8[]> zero; | 10585 scoped_ptr<int8_t[]> zero; |
| 10575 if (!data) { | 10586 if (!data) { |
| 10576 zero.reset(new int8[image_size]); | 10587 zero.reset(new int8_t[image_size]); |
| 10577 memset(zero.get(), 0, image_size); | 10588 memset(zero.get(), 0, image_size); |
| 10578 data = zero.get(); | 10589 data = zero.get(); |
| 10579 } | 10590 } |
| 10580 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); | 10591 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage2D"); |
| 10581 glCompressedTexImage2D( | 10592 glCompressedTexImage2D( |
| 10582 target, level, internal_format, width, height, border, image_size, data); | 10593 target, level, internal_format, width, height, border, image_size, data); |
| 10583 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); | 10594 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage2D"); |
| 10584 if (error == GL_NO_ERROR) { | 10595 if (error == GL_NO_ERROR) { |
| 10585 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, | 10596 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, |
| 10586 width, height, 1, border, 0, 0, | 10597 width, height, 1, border, 0, 0, |
| 10587 gfx::Rect(width, height)); | 10598 gfx::Rect(width, height)); |
| 10588 } | 10599 } |
| 10589 | 10600 |
| 10590 // This may be a slow command. Exit command processing to allow for | 10601 // This may be a slow command. Exit command processing to allow for |
| 10591 // context preemption and GPU watchdog checks. | 10602 // context preemption and GPU watchdog checks. |
| 10592 ExitCommandProcessingEarly(); | 10603 ExitCommandProcessingEarly(); |
| 10593 return error::kNoError; | 10604 return error::kNoError; |
| 10594 } | 10605 } |
| 10595 | 10606 |
| 10596 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( | 10607 error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( |
| 10597 uint32 immediate_data_size, | 10608 uint32_t immediate_data_size, |
| 10598 const void* cmd_data) { | 10609 const void* cmd_data) { |
| 10599 const gles2::cmds::CompressedTexImage2D& c = | 10610 const gles2::cmds::CompressedTexImage2D& c = |
| 10600 *static_cast<const gles2::cmds::CompressedTexImage2D*>(cmd_data); | 10611 *static_cast<const gles2::cmds::CompressedTexImage2D*>(cmd_data); |
| 10601 GLenum target = static_cast<GLenum>(c.target); | 10612 GLenum target = static_cast<GLenum>(c.target); |
| 10602 GLint level = static_cast<GLint>(c.level); | 10613 GLint level = static_cast<GLint>(c.level); |
| 10603 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 10614 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 10604 GLsizei width = static_cast<GLsizei>(c.width); | 10615 GLsizei width = static_cast<GLsizei>(c.width); |
| 10605 GLsizei height = static_cast<GLsizei>(c.height); | 10616 GLsizei height = static_cast<GLsizei>(c.height); |
| 10606 GLint border = static_cast<GLint>(c.border); | 10617 GLint border = static_cast<GLint>(c.border); |
| 10607 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 10618 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 10608 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 10619 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); |
| 10609 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 10620 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); |
| 10610 const void* data = NULL; | 10621 const void* data = NULL; |
| 10611 if (data_shm_id != 0 || data_shm_offset != 0) { | 10622 if (data_shm_id != 0 || data_shm_offset != 0) { |
| 10612 data = GetSharedMemoryAs<const void*>( | 10623 data = GetSharedMemoryAs<const void*>( |
| 10613 data_shm_id, data_shm_offset, image_size); | 10624 data_shm_id, data_shm_offset, image_size); |
| 10614 if (!data) { | 10625 if (!data) { |
| 10615 return error::kOutOfBounds; | 10626 return error::kOutOfBounds; |
| 10616 } | 10627 } |
| 10617 } | 10628 } |
| 10618 return DoCompressedTexImage2D( | 10629 return DoCompressedTexImage2D( |
| 10619 target, level, internal_format, width, height, border, image_size, data); | 10630 target, level, internal_format, width, height, border, image_size, data); |
| 10620 } | 10631 } |
| 10621 | 10632 |
| 10622 error::Error GLES2DecoderImpl::HandleCompressedTexImage2DBucket( | 10633 error::Error GLES2DecoderImpl::HandleCompressedTexImage2DBucket( |
| 10623 uint32 immediate_data_size, | 10634 uint32_t immediate_data_size, |
| 10624 const void* cmd_data) { | 10635 const void* cmd_data) { |
| 10625 const gles2::cmds::CompressedTexImage2DBucket& c = | 10636 const gles2::cmds::CompressedTexImage2DBucket& c = |
| 10626 *static_cast<const gles2::cmds::CompressedTexImage2DBucket*>(cmd_data); | 10637 *static_cast<const gles2::cmds::CompressedTexImage2DBucket*>(cmd_data); |
| 10627 GLenum target = static_cast<GLenum>(c.target); | 10638 GLenum target = static_cast<GLenum>(c.target); |
| 10628 GLint level = static_cast<GLint>(c.level); | 10639 GLint level = static_cast<GLint>(c.level); |
| 10629 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 10640 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 10630 GLsizei width = static_cast<GLsizei>(c.width); | 10641 GLsizei width = static_cast<GLsizei>(c.width); |
| 10631 GLsizei height = static_cast<GLsizei>(c.height); | 10642 GLsizei height = static_cast<GLsizei>(c.height); |
| 10632 GLint border = static_cast<GLint>(c.border); | 10643 GLint border = static_cast<GLint>(c.border); |
| 10633 Bucket* bucket = GetBucket(c.bucket_id); | 10644 Bucket* bucket = GetBucket(c.bucket_id); |
| 10634 if (!bucket) { | 10645 if (!bucket) { |
| 10635 return error::kInvalidArguments; | 10646 return error::kInvalidArguments; |
| 10636 } | 10647 } |
| 10637 uint32 data_size = bucket->size(); | 10648 uint32_t data_size = bucket->size(); |
| 10638 GLsizei imageSize = data_size; | 10649 GLsizei imageSize = data_size; |
| 10639 const void* data = bucket->GetData(0, data_size); | 10650 const void* data = bucket->GetData(0, data_size); |
| 10640 if (!data) { | 10651 if (!data) { |
| 10641 return error::kInvalidArguments; | 10652 return error::kInvalidArguments; |
| 10642 } | 10653 } |
| 10643 return DoCompressedTexImage2D( | 10654 return DoCompressedTexImage2D( |
| 10644 target, level, internal_format, width, height, border, | 10655 target, level, internal_format, width, height, border, |
| 10645 imageSize, data); | 10656 imageSize, data); |
| 10646 } | 10657 } |
| 10647 | 10658 |
| 10648 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DBucket( | 10659 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2DBucket( |
| 10649 uint32 immediate_data_size, | 10660 uint32_t immediate_data_size, |
| 10650 const void* cmd_data) { | 10661 const void* cmd_data) { |
| 10651 const gles2::cmds::CompressedTexSubImage2DBucket& c = | 10662 const gles2::cmds::CompressedTexSubImage2DBucket& c = |
| 10652 *static_cast<const gles2::cmds::CompressedTexSubImage2DBucket*>(cmd_data); | 10663 *static_cast<const gles2::cmds::CompressedTexSubImage2DBucket*>(cmd_data); |
| 10653 GLenum target = static_cast<GLenum>(c.target); | 10664 GLenum target = static_cast<GLenum>(c.target); |
| 10654 GLint level = static_cast<GLint>(c.level); | 10665 GLint level = static_cast<GLint>(c.level); |
| 10655 GLint xoffset = static_cast<GLint>(c.xoffset); | 10666 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 10656 GLint yoffset = static_cast<GLint>(c.yoffset); | 10667 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 10657 GLsizei width = static_cast<GLsizei>(c.width); | 10668 GLsizei width = static_cast<GLsizei>(c.width); |
| 10658 GLsizei height = static_cast<GLsizei>(c.height); | 10669 GLsizei height = static_cast<GLsizei>(c.height); |
| 10659 GLenum format = static_cast<GLenum>(c.format); | 10670 GLenum format = static_cast<GLenum>(c.format); |
| 10660 Bucket* bucket = GetBucket(c.bucket_id); | 10671 Bucket* bucket = GetBucket(c.bucket_id); |
| 10661 if (!bucket) { | 10672 if (!bucket) { |
| 10662 return error::kInvalidArguments; | 10673 return error::kInvalidArguments; |
| 10663 } | 10674 } |
| 10664 uint32 data_size = bucket->size(); | 10675 uint32_t data_size = bucket->size(); |
| 10665 GLsizei imageSize = data_size; | 10676 GLsizei imageSize = data_size; |
| 10666 const void* data = bucket->GetData(0, data_size); | 10677 const void* data = bucket->GetData(0, data_size); |
| 10667 if (!data) { | 10678 if (!data) { |
| 10668 return error::kInvalidArguments; | 10679 return error::kInvalidArguments; |
| 10669 } | 10680 } |
| 10670 if (!validators_->texture_target.IsValid(target)) { | 10681 if (!validators_->texture_target.IsValid(target)) { |
| 10671 LOCAL_SET_GL_ERROR( | 10682 LOCAL_SET_GL_ERROR( |
| 10672 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target"); | 10683 GL_INVALID_ENUM, "glCompressedTexSubImage2D", "target"); |
| 10673 return error::kNoError; | 10684 return error::kNoError; |
| 10674 } | 10685 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10751 if (!EnsureGPUMemoryAvailable(image_size)) { | 10762 if (!EnsureGPUMemoryAvailable(image_size)) { |
| 10752 LOCAL_SET_GL_ERROR( | 10763 LOCAL_SET_GL_ERROR( |
| 10753 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); | 10764 GL_OUT_OF_MEMORY, "glCompressedTexImage3D", "out of memory"); |
| 10754 return error::kNoError; | 10765 return error::kNoError; |
| 10755 } | 10766 } |
| 10756 | 10767 |
| 10757 if (texture->IsAttachedToFramebuffer()) { | 10768 if (texture->IsAttachedToFramebuffer()) { |
| 10758 framebuffer_state_.clear_state_dirty = true; | 10769 framebuffer_state_.clear_state_dirty = true; |
| 10759 } | 10770 } |
| 10760 | 10771 |
| 10761 scoped_ptr<int8[]> zero; | 10772 scoped_ptr<int8_t[]> zero; |
| 10762 if (!data) { | 10773 if (!data) { |
| 10763 zero.reset(new int8[image_size]); | 10774 zero.reset(new int8_t[image_size]); |
| 10764 memset(zero.get(), 0, image_size); | 10775 memset(zero.get(), 0, image_size); |
| 10765 data = zero.get(); | 10776 data = zero.get(); |
| 10766 } | 10777 } |
| 10767 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); | 10778 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glCompressedTexImage3D"); |
| 10768 glCompressedTexImage3D(target, level, internal_format, width, height, depth, | 10779 glCompressedTexImage3D(target, level, internal_format, width, height, depth, |
| 10769 border, image_size, data); | 10780 border, image_size, data); |
| 10770 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); | 10781 GLenum error = LOCAL_PEEK_GL_ERROR("glCompressedTexImage3D"); |
| 10771 if (error == GL_NO_ERROR) { | 10782 if (error == GL_NO_ERROR) { |
| 10772 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, | 10783 texture_manager()->SetLevelInfo(texture_ref, target, level, internal_format, |
| 10773 width, height, depth, border, 0, 0, | 10784 width, height, depth, border, 0, 0, |
| 10774 gfx::Rect(width, height)); | 10785 gfx::Rect(width, height)); |
| 10775 } | 10786 } |
| 10776 | 10787 |
| 10777 // This may be a slow command. Exit command processing to allow for | 10788 // This may be a slow command. Exit command processing to allow for |
| 10778 // context preemption and GPU watchdog checks. | 10789 // context preemption and GPU watchdog checks. |
| 10779 ExitCommandProcessingEarly(); | 10790 ExitCommandProcessingEarly(); |
| 10780 return error::kNoError; | 10791 return error::kNoError; |
| 10781 } | 10792 } |
| 10782 | 10793 |
| 10783 error::Error GLES2DecoderImpl::HandleCompressedTexImage3D( | 10794 error::Error GLES2DecoderImpl::HandleCompressedTexImage3D( |
| 10784 uint32 immediate_data_size, const void* cmd_data) { | 10795 uint32_t immediate_data_size, |
| 10796 const void* cmd_data) { |
| 10785 if (!unsafe_es3_apis_enabled()) | 10797 if (!unsafe_es3_apis_enabled()) |
| 10786 return error::kUnknownCommand; | 10798 return error::kUnknownCommand; |
| 10787 | 10799 |
| 10788 const gles2::cmds::CompressedTexImage3D& c = | 10800 const gles2::cmds::CompressedTexImage3D& c = |
| 10789 *static_cast<const gles2::cmds::CompressedTexImage3D*>(cmd_data); | 10801 *static_cast<const gles2::cmds::CompressedTexImage3D*>(cmd_data); |
| 10790 GLenum target = static_cast<GLenum>(c.target); | 10802 GLenum target = static_cast<GLenum>(c.target); |
| 10791 GLint level = static_cast<GLint>(c.level); | 10803 GLint level = static_cast<GLint>(c.level); |
| 10792 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 10804 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 10793 GLsizei width = static_cast<GLsizei>(c.width); | 10805 GLsizei width = static_cast<GLsizei>(c.width); |
| 10794 GLsizei height = static_cast<GLsizei>(c.height); | 10806 GLsizei height = static_cast<GLsizei>(c.height); |
| 10795 GLsizei depth = static_cast<GLsizei>(c.depth); | 10807 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 10796 GLint border = static_cast<GLint>(c.border); | 10808 GLint border = static_cast<GLint>(c.border); |
| 10797 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | 10809 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 10798 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | 10810 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); |
| 10799 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | 10811 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); |
| 10800 const void* data = NULL; | 10812 const void* data = NULL; |
| 10801 if (data_shm_id != 0 || data_shm_offset != 0) { | 10813 if (data_shm_id != 0 || data_shm_offset != 0) { |
| 10802 data = GetSharedMemoryAs<const void*>( | 10814 data = GetSharedMemoryAs<const void*>( |
| 10803 data_shm_id, data_shm_offset, image_size); | 10815 data_shm_id, data_shm_offset, image_size); |
| 10804 if (!data) { | 10816 if (!data) { |
| 10805 return error::kOutOfBounds; | 10817 return error::kOutOfBounds; |
| 10806 } | 10818 } |
| 10807 } | 10819 } |
| 10808 return DoCompressedTexImage3D(target, level, internal_format, width, height, | 10820 return DoCompressedTexImage3D(target, level, internal_format, width, height, |
| 10809 depth, border, image_size, data); | 10821 depth, border, image_size, data); |
| 10810 } | 10822 } |
| 10811 | 10823 |
| 10812 error::Error GLES2DecoderImpl::HandleCompressedTexImage3DBucket( | 10824 error::Error GLES2DecoderImpl::HandleCompressedTexImage3DBucket( |
| 10813 uint32 immediate_data_size, const void* cmd_data) { | 10825 uint32_t immediate_data_size, |
| 10826 const void* cmd_data) { |
| 10814 if (!unsafe_es3_apis_enabled()) | 10827 if (!unsafe_es3_apis_enabled()) |
| 10815 return error::kUnknownCommand; | 10828 return error::kUnknownCommand; |
| 10816 | 10829 |
| 10817 const gles2::cmds::CompressedTexImage3DBucket& c = | 10830 const gles2::cmds::CompressedTexImage3DBucket& c = |
| 10818 *static_cast<const gles2::cmds::CompressedTexImage3DBucket*>(cmd_data); | 10831 *static_cast<const gles2::cmds::CompressedTexImage3DBucket*>(cmd_data); |
| 10819 GLenum target = static_cast<GLenum>(c.target); | 10832 GLenum target = static_cast<GLenum>(c.target); |
| 10820 GLint level = static_cast<GLint>(c.level); | 10833 GLint level = static_cast<GLint>(c.level); |
| 10821 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 10834 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 10822 GLsizei width = static_cast<GLsizei>(c.width); | 10835 GLsizei width = static_cast<GLsizei>(c.width); |
| 10823 GLsizei height = static_cast<GLsizei>(c.height); | 10836 GLsizei height = static_cast<GLsizei>(c.height); |
| 10824 GLsizei depth = static_cast<GLsizei>(c.depth); | 10837 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 10825 GLint border = static_cast<GLint>(c.border); | 10838 GLint border = static_cast<GLint>(c.border); |
| 10826 Bucket* bucket = GetBucket(c.bucket_id); | 10839 Bucket* bucket = GetBucket(c.bucket_id); |
| 10827 if (!bucket) { | 10840 if (!bucket) { |
| 10828 return error::kInvalidArguments; | 10841 return error::kInvalidArguments; |
| 10829 } | 10842 } |
| 10830 uint32 data_size = bucket->size(); | 10843 uint32_t data_size = bucket->size(); |
| 10831 GLsizei imageSize = data_size; | 10844 GLsizei imageSize = data_size; |
| 10832 const void* data = bucket->GetData(0, data_size); | 10845 const void* data = bucket->GetData(0, data_size); |
| 10833 if (!data) { | 10846 if (!data) { |
| 10834 return error::kInvalidArguments; | 10847 return error::kInvalidArguments; |
| 10835 } | 10848 } |
| 10836 return DoCompressedTexImage3D(target, level, internal_format, width, height, | 10849 return DoCompressedTexImage3D(target, level, internal_format, width, height, |
| 10837 depth, border, imageSize, data); | 10850 depth, border, imageSize, data); |
| 10838 } | 10851 } |
| 10839 | 10852 |
| 10840 void GLES2DecoderImpl::DoCompressedTexSubImage3D( | 10853 void GLES2DecoderImpl::DoCompressedTexSubImage3D( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10903 glCompressedTexSubImage3D( | 10916 glCompressedTexSubImage3D( |
| 10904 target, level, xoffset, yoffset, zoffset, width, height, depth, format, | 10917 target, level, xoffset, yoffset, zoffset, width, height, depth, format, |
| 10905 image_size, data); | 10918 image_size, data); |
| 10906 | 10919 |
| 10907 // This may be a slow command. Exit command processing to allow for | 10920 // This may be a slow command. Exit command processing to allow for |
| 10908 // context preemption and GPU watchdog checks. | 10921 // context preemption and GPU watchdog checks. |
| 10909 ExitCommandProcessingEarly(); | 10922 ExitCommandProcessingEarly(); |
| 10910 } | 10923 } |
| 10911 | 10924 |
| 10912 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage3DBucket( | 10925 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage3DBucket( |
| 10913 uint32 immediate_data_size, const void* cmd_data) { | 10926 uint32_t immediate_data_size, |
| 10927 const void* cmd_data) { |
| 10914 if (!unsafe_es3_apis_enabled()) | 10928 if (!unsafe_es3_apis_enabled()) |
| 10915 return error::kUnknownCommand; | 10929 return error::kUnknownCommand; |
| 10916 const gles2::cmds::CompressedTexSubImage3DBucket& c = | 10930 const gles2::cmds::CompressedTexSubImage3DBucket& c = |
| 10917 *static_cast<const gles2::cmds::CompressedTexSubImage3DBucket*>(cmd_data); | 10931 *static_cast<const gles2::cmds::CompressedTexSubImage3DBucket*>(cmd_data); |
| 10918 GLenum target = static_cast<GLenum>(c.target); | 10932 GLenum target = static_cast<GLenum>(c.target); |
| 10919 GLint level = static_cast<GLint>(c.level); | 10933 GLint level = static_cast<GLint>(c.level); |
| 10920 GLint xoffset = static_cast<GLint>(c.xoffset); | 10934 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 10921 GLint yoffset = static_cast<GLint>(c.yoffset); | 10935 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 10922 GLint zoffset = static_cast<GLint>(c.zoffset); | 10936 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 10923 GLsizei width = static_cast<GLsizei>(c.width); | 10937 GLsizei width = static_cast<GLsizei>(c.width); |
| 10924 GLsizei height = static_cast<GLsizei>(c.height); | 10938 GLsizei height = static_cast<GLsizei>(c.height); |
| 10925 GLsizei depth = static_cast<GLsizei>(c.depth); | 10939 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 10926 GLenum format = static_cast<GLenum>(c.format); | 10940 GLenum format = static_cast<GLenum>(c.format); |
| 10927 Bucket* bucket = GetBucket(c.bucket_id); | 10941 Bucket* bucket = GetBucket(c.bucket_id); |
| 10928 if (!bucket) { | 10942 if (!bucket) { |
| 10929 return error::kInvalidArguments; | 10943 return error::kInvalidArguments; |
| 10930 } | 10944 } |
| 10931 uint32 data_size = bucket->size(); | 10945 uint32_t data_size = bucket->size(); |
| 10932 GLsizei image_size = data_size; | 10946 GLsizei image_size = data_size; |
| 10933 const void* data = bucket->GetData(0, data_size); | 10947 const void* data = bucket->GetData(0, data_size); |
| 10934 if (!data) { | 10948 if (!data) { |
| 10935 return error::kInvalidArguments; | 10949 return error::kInvalidArguments; |
| 10936 } | 10950 } |
| 10937 DoCompressedTexSubImage3D( | 10951 DoCompressedTexSubImage3D( |
| 10938 target, level, xoffset, yoffset, zoffset, width, height, depth, format, | 10952 target, level, xoffset, yoffset, zoffset, width, height, depth, format, |
| 10939 image_size, data); | 10953 image_size, data); |
| 10940 return error::kNoError; | 10954 return error::kNoError; |
| 10941 } | 10955 } |
| 10942 | 10956 |
| 10943 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32 immediate_data_size, | 10957 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, |
| 10944 const void* cmd_data) { | 10958 const void* cmd_data) { |
| 10945 const gles2::cmds::TexImage2D& c = | 10959 const gles2::cmds::TexImage2D& c = |
| 10946 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); | 10960 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); |
| 10947 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", | 10961 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", |
| 10948 "width", c.width, "height", c.height); | 10962 "width", c.width, "height", c.height); |
| 10949 // Set as failed for now, but if it successed, this will be set to not failed. | 10963 // Set as failed for now, but if it successed, this will be set to not failed. |
| 10950 texture_state_.tex_image_failed = true; | 10964 texture_state_.tex_image_failed = true; |
| 10951 GLenum target = static_cast<GLenum>(c.target); | 10965 GLenum target = static_cast<GLenum>(c.target); |
| 10952 GLint level = static_cast<GLint>(c.level); | 10966 GLint level = static_cast<GLint>(c.level); |
| 10953 // TODO(kloveless): Change TexImage2D command to use unsigned integer | 10967 // TODO(kloveless): Change TexImage2D command to use unsigned integer |
| 10954 // for internalformat. | 10968 // for internalformat. |
| 10955 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 10969 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 10956 GLsizei width = static_cast<GLsizei>(c.width); | 10970 GLsizei width = static_cast<GLsizei>(c.width); |
| 10957 GLsizei height = static_cast<GLsizei>(c.height); | 10971 GLsizei height = static_cast<GLsizei>(c.height); |
| 10958 GLint border = static_cast<GLint>(c.border); | 10972 GLint border = static_cast<GLint>(c.border); |
| 10959 GLenum format = static_cast<GLenum>(c.format); | 10973 GLenum format = static_cast<GLenum>(c.format); |
| 10960 GLenum type = static_cast<GLenum>(c.type); | 10974 GLenum type = static_cast<GLenum>(c.type); |
| 10961 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | 10975 uint32_t pixels_shm_id = static_cast<uint32_t>(c.pixels_shm_id); |
| 10962 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | 10976 uint32_t pixels_shm_offset = static_cast<uint32_t>(c.pixels_shm_offset); |
| 10963 uint32 pixels_size; | 10977 uint32_t pixels_size; |
| 10964 if (!GLES2Util::ComputeImageDataSizes( | 10978 if (!GLES2Util::ComputeImageDataSizes( |
| 10965 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, | 10979 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, |
| 10966 NULL, NULL)) { | 10980 NULL, NULL)) { |
| 10967 return error::kOutOfBounds; | 10981 return error::kOutOfBounds; |
| 10968 } | 10982 } |
| 10969 const void* pixels = NULL; | 10983 const void* pixels = NULL; |
| 10970 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 10984 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { |
| 10971 pixels = GetSharedMemoryAs<const void*>( | 10985 pixels = GetSharedMemoryAs<const void*>( |
| 10972 pixels_shm_id, pixels_shm_offset, pixels_size); | 10986 pixels_shm_id, pixels_shm_offset, pixels_size); |
| 10973 if (!pixels) { | 10987 if (!pixels) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 10989 pixels, pixels_size, TextureManager::DoTexImageArguments::kTexImage2D }; | 11003 pixels, pixels_size, TextureManager::DoTexImageArguments::kTexImage2D }; |
| 10990 texture_manager()->ValidateAndDoTexImage( | 11004 texture_manager()->ValidateAndDoTexImage( |
| 10991 &texture_state_, &state_, &framebuffer_state_, "glTexImage2D", args); | 11005 &texture_state_, &state_, &framebuffer_state_, "glTexImage2D", args); |
| 10992 | 11006 |
| 10993 // This may be a slow command. Exit command processing to allow for | 11007 // This may be a slow command. Exit command processing to allow for |
| 10994 // context preemption and GPU watchdog checks. | 11008 // context preemption and GPU watchdog checks. |
| 10995 ExitCommandProcessingEarly(); | 11009 ExitCommandProcessingEarly(); |
| 10996 return error::kNoError; | 11010 return error::kNoError; |
| 10997 } | 11011 } |
| 10998 | 11012 |
| 10999 error::Error GLES2DecoderImpl::HandleTexImage3D(uint32 immediate_data_size, | 11013 error::Error GLES2DecoderImpl::HandleTexImage3D(uint32_t immediate_data_size, |
| 11000 const void* cmd_data) { | 11014 const void* cmd_data) { |
| 11001 if (!unsafe_es3_apis_enabled()) | 11015 if (!unsafe_es3_apis_enabled()) |
| 11002 return error::kUnknownCommand; | 11016 return error::kUnknownCommand; |
| 11003 | 11017 |
| 11004 const gles2::cmds::TexImage3D& c = | 11018 const gles2::cmds::TexImage3D& c = |
| 11005 *static_cast<const gles2::cmds::TexImage3D*>(cmd_data); | 11019 *static_cast<const gles2::cmds::TexImage3D*>(cmd_data); |
| 11006 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D", | 11020 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D", |
| 11007 "widthXheight", c.width * c.height, "depth", c.depth); | 11021 "widthXheight", c.width * c.height, "depth", c.depth); |
| 11008 // Set as failed for now, but if it successed, this will be set to not failed. | 11022 // Set as failed for now, but if it successed, this will be set to not failed. |
| 11009 texture_state_.tex_image_failed = true; | 11023 texture_state_.tex_image_failed = true; |
| 11010 GLenum target = static_cast<GLenum>(c.target); | 11024 GLenum target = static_cast<GLenum>(c.target); |
| 11011 GLint level = static_cast<GLint>(c.level); | 11025 GLint level = static_cast<GLint>(c.level); |
| 11012 GLenum internal_format = static_cast<GLenum>(c.internalformat); | 11026 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 11013 GLsizei width = static_cast<GLsizei>(c.width); | 11027 GLsizei width = static_cast<GLsizei>(c.width); |
| 11014 GLsizei height = static_cast<GLsizei>(c.height); | 11028 GLsizei height = static_cast<GLsizei>(c.height); |
| 11015 GLsizei depth = static_cast<GLsizei>(c.depth); | 11029 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 11016 GLint border = static_cast<GLint>(c.border); | 11030 GLint border = static_cast<GLint>(c.border); |
| 11017 GLenum format = static_cast<GLenum>(c.format); | 11031 GLenum format = static_cast<GLenum>(c.format); |
| 11018 GLenum type = static_cast<GLenum>(c.type); | 11032 GLenum type = static_cast<GLenum>(c.type); |
| 11019 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | 11033 uint32_t pixels_shm_id = static_cast<uint32_t>(c.pixels_shm_id); |
| 11020 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | 11034 uint32_t pixels_shm_offset = static_cast<uint32_t>(c.pixels_shm_offset); |
| 11021 uint32 pixels_size; | 11035 uint32_t pixels_size; |
| 11022 if (!GLES2Util::ComputeImageDataSizes( | 11036 if (!GLES2Util::ComputeImageDataSizes( |
| 11023 width, height, depth, format, type, state_.unpack_alignment, &pixels_size, | 11037 width, height, depth, format, type, state_.unpack_alignment, &pixels_size, |
| 11024 NULL, NULL)) { | 11038 NULL, NULL)) { |
| 11025 return error::kOutOfBounds; | 11039 return error::kOutOfBounds; |
| 11026 } | 11040 } |
| 11027 const void* pixels = NULL; | 11041 const void* pixels = NULL; |
| 11028 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { | 11042 if (pixels_shm_id != 0 || pixels_shm_offset != 0) { |
| 11029 pixels = GetSharedMemoryAs<const void*>( | 11043 pixels = GetSharedMemoryAs<const void*>( |
| 11030 pixels_shm_id, pixels_shm_offset, pixels_size); | 11044 pixels_shm_id, pixels_shm_offset, pixels_size); |
| 11031 if (!pixels) { | 11045 if (!pixels) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11158 } | 11172 } |
| 11159 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || | 11173 if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || |
| 11160 border != 0) { | 11174 border != 0) { |
| 11161 LOCAL_SET_GL_ERROR( | 11175 LOCAL_SET_GL_ERROR( |
| 11162 GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range"); | 11176 GL_INVALID_VALUE, "glCopyTexImage2D", "dimensions out of range"); |
| 11163 return; | 11177 return; |
| 11164 } | 11178 } |
| 11165 | 11179 |
| 11166 // Check we have compatible formats. | 11180 // Check we have compatible formats. |
| 11167 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); | 11181 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
| 11168 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 11182 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 11169 uint32 channels_needed = GLES2Util::GetChannelsForFormat(internal_format); | 11183 uint32_t channels_needed = GLES2Util::GetChannelsForFormat(internal_format); |
| 11170 | 11184 |
| 11171 if ((channels_needed & channels_exist) != channels_needed) { | 11185 if ((channels_needed & channels_exist) != channels_needed) { |
| 11172 LOCAL_SET_GL_ERROR( | 11186 LOCAL_SET_GL_ERROR( |
| 11173 GL_INVALID_OPERATION, "glCopyTexImage2D", "incompatible format"); | 11187 GL_INVALID_OPERATION, "glCopyTexImage2D", "incompatible format"); |
| 11174 return; | 11188 return; |
| 11175 } | 11189 } |
| 11176 | 11190 |
| 11177 if (feature_info_->IsES3Enabled()) { | 11191 if (feature_info_->IsES3Enabled()) { |
| 11178 GLint color_encoding = GetColorEncodingFromInternalFormat(read_format); | 11192 GLint color_encoding = GetColorEncodingFromInternalFormat(read_format); |
| 11179 if (color_encoding != GetColorEncodingFromInternalFormat(internal_format) || | 11193 if (color_encoding != GetColorEncodingFromInternalFormat(internal_format) || |
| 11180 GLES2Util::IsFloatFormat(internal_format) || | 11194 GLES2Util::IsFloatFormat(internal_format) || |
| 11181 (GLES2Util::IsSignedIntegerFormat(internal_format) != | 11195 (GLES2Util::IsSignedIntegerFormat(internal_format) != |
| 11182 GLES2Util::IsSignedIntegerFormat(read_format)) || | 11196 GLES2Util::IsSignedIntegerFormat(read_format)) || |
| 11183 (GLES2Util::IsUnsignedIntegerFormat(internal_format) != | 11197 (GLES2Util::IsUnsignedIntegerFormat(internal_format) != |
| 11184 GLES2Util::IsUnsignedIntegerFormat(read_format))) { | 11198 GLES2Util::IsUnsignedIntegerFormat(read_format))) { |
| 11185 LOCAL_SET_GL_ERROR( | 11199 LOCAL_SET_GL_ERROR( |
| 11186 GL_INVALID_OPERATION, "glCopyTexImage2D", "incompatible format"); | 11200 GL_INVALID_OPERATION, "glCopyTexImage2D", "incompatible format"); |
| 11187 return; | 11201 return; |
| 11188 } | 11202 } |
| 11189 } | 11203 } |
| 11190 | 11204 |
| 11191 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { | 11205 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { |
| 11192 LOCAL_SET_GL_ERROR( | 11206 LOCAL_SET_GL_ERROR( |
| 11193 GL_INVALID_OPERATION, | 11207 GL_INVALID_OPERATION, |
| 11194 "glCopyTexImage2D", "can not be used with depth or stencil textures"); | 11208 "glCopyTexImage2D", "can not be used with depth or stencil textures"); |
| 11195 return; | 11209 return; |
| 11196 } | 11210 } |
| 11197 | 11211 |
| 11198 uint32 pixels_size = 0; | 11212 uint32_t pixels_size = 0; |
| 11199 GLenum format = TextureManager::ExtractFormatFromStorageFormat( | 11213 GLenum format = TextureManager::ExtractFormatFromStorageFormat( |
| 11200 internal_format); | 11214 internal_format); |
| 11201 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); | 11215 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); |
| 11202 // Only target image size is validated here. | 11216 // Only target image size is validated here. |
| 11203 if (!GLES2Util::ComputeImageDataSizes( | 11217 if (!GLES2Util::ComputeImageDataSizes( |
| 11204 width, height, 1, format, type, | 11218 width, height, 1, format, type, |
| 11205 state_.unpack_alignment, &pixels_size, NULL, NULL)) { | 11219 state_.unpack_alignment, &pixels_size, NULL, NULL)) { |
| 11206 LOCAL_SET_GL_ERROR( | 11220 LOCAL_SET_GL_ERROR( |
| 11207 GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too large"); | 11221 GL_OUT_OF_MEMORY, "glCopyTexImage2D", "dimensions too large"); |
| 11208 return; | 11222 return; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11302 if (!texture->GetLevelType(target, level, &type, &format) || | 11316 if (!texture->GetLevelType(target, level, &type, &format) || |
| 11303 !texture->ValidForTexture( | 11317 !texture->ValidForTexture( |
| 11304 target, level, xoffset, yoffset, 0, width, height, 1)) { | 11318 target, level, xoffset, yoffset, 0, width, height, 1)) { |
| 11305 LOCAL_SET_GL_ERROR( | 11319 LOCAL_SET_GL_ERROR( |
| 11306 GL_INVALID_VALUE, "glCopyTexSubImage2D", "bad dimensions."); | 11320 GL_INVALID_VALUE, "glCopyTexSubImage2D", "bad dimensions."); |
| 11307 return; | 11321 return; |
| 11308 } | 11322 } |
| 11309 | 11323 |
| 11310 // Check we have compatible formats. | 11324 // Check we have compatible formats. |
| 11311 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); | 11325 GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
| 11312 uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); | 11326 uint32_t channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| 11313 uint32 channels_needed = GLES2Util::GetChannelsForFormat(format); | 11327 uint32_t channels_needed = GLES2Util::GetChannelsForFormat(format); |
| 11314 | 11328 |
| 11315 if (!channels_needed || | 11329 if (!channels_needed || |
| 11316 (channels_needed & channels_exist) != channels_needed) { | 11330 (channels_needed & channels_exist) != channels_needed) { |
| 11317 LOCAL_SET_GL_ERROR( | 11331 LOCAL_SET_GL_ERROR( |
| 11318 GL_INVALID_OPERATION, "glCopyTexSubImage2D", "incompatible format"); | 11332 GL_INVALID_OPERATION, "glCopyTexSubImage2D", "incompatible format"); |
| 11319 return; | 11333 return; |
| 11320 } | 11334 } |
| 11321 | 11335 |
| 11322 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { | 11336 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { |
| 11323 LOCAL_SET_GL_ERROR( | 11337 LOCAL_SET_GL_ERROR( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11372 } else { | 11386 } else { |
| 11373 // Write all pixels in below. | 11387 // Write all pixels in below. |
| 11374 texture_manager()->SetLevelCleared(texture_ref, target, level, true); | 11388 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 11375 } | 11389 } |
| 11376 | 11390 |
| 11377 if (copyX != x || | 11391 if (copyX != x || |
| 11378 copyY != y || | 11392 copyY != y || |
| 11379 copyWidth != width || | 11393 copyWidth != width || |
| 11380 copyHeight != height) { | 11394 copyHeight != height) { |
| 11381 // some part was clipped so clear the sub rect. | 11395 // some part was clipped so clear the sub rect. |
| 11382 uint32 pixels_size = 0; | 11396 uint32_t pixels_size = 0; |
| 11383 if (!GLES2Util::ComputeImageDataSizes( | 11397 if (!GLES2Util::ComputeImageDataSizes( |
| 11384 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, | 11398 width, height, 1, format, type, state_.unpack_alignment, &pixels_size, |
| 11385 NULL, NULL)) { | 11399 NULL, NULL)) { |
| 11386 LOCAL_SET_GL_ERROR( | 11400 LOCAL_SET_GL_ERROR( |
| 11387 GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large"); | 11401 GL_INVALID_VALUE, "glCopyTexSubImage2D", "dimensions too large"); |
| 11388 return; | 11402 return; |
| 11389 } | 11403 } |
| 11390 scoped_ptr<char[]> zero(new char[pixels_size]); | 11404 scoped_ptr<char[]> zero(new char[pixels_size]); |
| 11391 memset(zero.get(), 0, pixels_size); | 11405 memset(zero.get(), 0, pixels_size); |
| 11392 glTexSubImage2D( | 11406 glTexSubImage2D( |
| 11393 target, level, xoffset, yoffset, width, height, | 11407 target, level, xoffset, yoffset, width, height, |
| 11394 format, type, zero.get()); | 11408 format, type, zero.get()); |
| 11395 } | 11409 } |
| 11396 | 11410 |
| 11397 if (copyHeight > 0 && copyWidth > 0) { | 11411 if (copyHeight > 0 && copyWidth > 0) { |
| 11398 GLint dx = copyX - x; | 11412 GLint dx = copyX - x; |
| 11399 GLint dy = copyY - y; | 11413 GLint dy = copyY - y; |
| 11400 GLint destX = xoffset + dx; | 11414 GLint destX = xoffset + dx; |
| 11401 GLint destY = yoffset + dy; | 11415 GLint destY = yoffset + dy; |
| 11402 glCopyTexSubImage2D(target, level, | 11416 glCopyTexSubImage2D(target, level, |
| 11403 destX, destY, copyX, copyY, | 11417 destX, destY, copyX, copyY, |
| 11404 copyWidth, copyHeight); | 11418 copyWidth, copyHeight); |
| 11405 } | 11419 } |
| 11406 | 11420 |
| 11407 // This may be a slow command. Exit command processing to allow for | 11421 // This may be a slow command. Exit command processing to allow for |
| 11408 // context preemption and GPU watchdog checks. | 11422 // context preemption and GPU watchdog checks. |
| 11409 ExitCommandProcessingEarly(); | 11423 ExitCommandProcessingEarly(); |
| 11410 } | 11424 } |
| 11411 | 11425 |
| 11412 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32 immediate_data_size, | 11426 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, |
| 11413 const void* cmd_data) { | 11427 const void* cmd_data) { |
| 11414 const gles2::cmds::TexSubImage2D& c = | 11428 const gles2::cmds::TexSubImage2D& c = |
| 11415 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); | 11429 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); |
| 11416 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", | 11430 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", |
| 11417 "width", c.width, "height", c.height); | 11431 "width", c.width, "height", c.height); |
| 11418 GLboolean internal = static_cast<GLboolean>(c.internal); | 11432 GLboolean internal = static_cast<GLboolean>(c.internal); |
| 11419 if (internal == GL_TRUE && texture_state_.tex_image_failed) | 11433 if (internal == GL_TRUE && texture_state_.tex_image_failed) |
| 11420 return error::kNoError; | 11434 return error::kNoError; |
| 11421 | 11435 |
| 11422 GLenum target = static_cast<GLenum>(c.target); | 11436 GLenum target = static_cast<GLenum>(c.target); |
| 11423 GLint level = static_cast<GLint>(c.level); | 11437 GLint level = static_cast<GLint>(c.level); |
| 11424 GLint xoffset = static_cast<GLint>(c.xoffset); | 11438 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 11425 GLint yoffset = static_cast<GLint>(c.yoffset); | 11439 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 11426 GLsizei width = static_cast<GLsizei>(c.width); | 11440 GLsizei width = static_cast<GLsizei>(c.width); |
| 11427 GLsizei height = static_cast<GLsizei>(c.height); | 11441 GLsizei height = static_cast<GLsizei>(c.height); |
| 11428 GLenum format = static_cast<GLenum>(c.format); | 11442 GLenum format = static_cast<GLenum>(c.format); |
| 11429 GLenum type = static_cast<GLenum>(c.type); | 11443 GLenum type = static_cast<GLenum>(c.type); |
| 11430 uint32 data_size; | 11444 uint32_t data_size; |
| 11431 if (!GLES2Util::ComputeImageDataSizes( | 11445 if (!GLES2Util::ComputeImageDataSizes( |
| 11432 width, height, 1, format, type, state_.unpack_alignment, &data_size, | 11446 width, height, 1, format, type, state_.unpack_alignment, &data_size, |
| 11433 NULL, NULL)) { | 11447 NULL, NULL)) { |
| 11434 return error::kOutOfBounds; | 11448 return error::kOutOfBounds; |
| 11435 } | 11449 } |
| 11436 | 11450 |
| 11437 const void* pixels = GetSharedMemoryAs<const void*>( | 11451 const void* pixels = GetSharedMemoryAs<const void*>( |
| 11438 c.pixels_shm_id, c.pixels_shm_offset, data_size); | 11452 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
| 11439 if (!pixels) | 11453 if (!pixels) |
| 11440 return error::kOutOfBounds; | 11454 return error::kOutOfBounds; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11481 // image is cleared. | 11495 // image is cleared. |
| 11482 texture_manager()->SetLevelCleared(texture_ref, target, level, true); | 11496 texture_manager()->SetLevelCleared(texture_ref, target, level, true); |
| 11483 } | 11497 } |
| 11484 | 11498 |
| 11485 // This may be a slow command. Exit command processing to allow for | 11499 // This may be a slow command. Exit command processing to allow for |
| 11486 // context preemption and GPU watchdog checks. | 11500 // context preemption and GPU watchdog checks. |
| 11487 ExitCommandProcessingEarly(); | 11501 ExitCommandProcessingEarly(); |
| 11488 return error::kNoError; | 11502 return error::kNoError; |
| 11489 } | 11503 } |
| 11490 | 11504 |
| 11491 error::Error GLES2DecoderImpl::HandleTexSubImage3D(uint32 immediate_data_size, | 11505 error::Error GLES2DecoderImpl::HandleTexSubImage3D(uint32_t immediate_data_size, |
| 11492 const void* cmd_data) { | 11506 const void* cmd_data) { |
| 11493 if (!unsafe_es3_apis_enabled()) | 11507 if (!unsafe_es3_apis_enabled()) |
| 11494 return error::kUnknownCommand; | 11508 return error::kUnknownCommand; |
| 11495 | 11509 |
| 11496 const gles2::cmds::TexSubImage3D& c = | 11510 const gles2::cmds::TexSubImage3D& c = |
| 11497 *static_cast<const gles2::cmds::TexSubImage3D*>(cmd_data); | 11511 *static_cast<const gles2::cmds::TexSubImage3D*>(cmd_data); |
| 11498 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D", | 11512 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D", |
| 11499 "widthXheight", c.width * c.height, "depth", c.depth); | 11513 "widthXheight", c.width * c.height, "depth", c.depth); |
| 11500 GLboolean internal = static_cast<GLboolean>(c.internal); | 11514 GLboolean internal = static_cast<GLboolean>(c.internal); |
| 11501 if (internal == GL_TRUE && texture_state_.tex_image_failed) | 11515 if (internal == GL_TRUE && texture_state_.tex_image_failed) |
| 11502 return error::kNoError; | 11516 return error::kNoError; |
| 11503 | 11517 |
| 11504 GLenum target = static_cast<GLenum>(c.target); | 11518 GLenum target = static_cast<GLenum>(c.target); |
| 11505 GLint level = static_cast<GLint>(c.level); | 11519 GLint level = static_cast<GLint>(c.level); |
| 11506 GLint xoffset = static_cast<GLint>(c.xoffset); | 11520 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 11507 GLint yoffset = static_cast<GLint>(c.yoffset); | 11521 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 11508 GLint zoffset = static_cast<GLint>(c.zoffset); | 11522 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 11509 GLsizei width = static_cast<GLsizei>(c.width); | 11523 GLsizei width = static_cast<GLsizei>(c.width); |
| 11510 GLsizei height = static_cast<GLsizei>(c.height); | 11524 GLsizei height = static_cast<GLsizei>(c.height); |
| 11511 GLsizei depth = static_cast<GLsizei>(c.depth); | 11525 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 11512 GLenum format = static_cast<GLenum>(c.format); | 11526 GLenum format = static_cast<GLenum>(c.format); |
| 11513 GLenum type = static_cast<GLenum>(c.type); | 11527 GLenum type = static_cast<GLenum>(c.type); |
| 11514 uint32 data_size; | 11528 uint32_t data_size; |
| 11515 if (!GLES2Util::ComputeImageDataSizes( | 11529 if (!GLES2Util::ComputeImageDataSizes( |
| 11516 width, height, depth, format, type, state_.unpack_alignment, &data_size, | 11530 width, height, depth, format, type, state_.unpack_alignment, &data_size, |
| 11517 NULL, NULL)) { | 11531 NULL, NULL)) { |
| 11518 return error::kOutOfBounds; | 11532 return error::kOutOfBounds; |
| 11519 } | 11533 } |
| 11520 const void* pixels = GetSharedMemoryAs<const void*>( | 11534 const void* pixels = GetSharedMemoryAs<const void*>( |
| 11521 c.pixels_shm_id, c.pixels_shm_offset, data_size); | 11535 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
| 11522 return DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, | 11536 return DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, |
| 11523 height, depth, format, type, pixels); | 11537 height, depth, format, type, pixels); |
| 11524 } | 11538 } |
| 11525 | 11539 |
| 11526 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( | 11540 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( |
| 11527 uint32 immediate_data_size, | 11541 uint32_t immediate_data_size, |
| 11528 const void* cmd_data) { | 11542 const void* cmd_data) { |
| 11529 const gles2::cmds::GetVertexAttribPointerv& c = | 11543 const gles2::cmds::GetVertexAttribPointerv& c = |
| 11530 *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); | 11544 *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); |
| 11531 GLuint index = static_cast<GLuint>(c.index); | 11545 GLuint index = static_cast<GLuint>(c.index); |
| 11532 GLenum pname = static_cast<GLenum>(c.pname); | 11546 GLenum pname = static_cast<GLenum>(c.pname); |
| 11533 typedef cmds::GetVertexAttribPointerv::Result Result; | 11547 typedef cmds::GetVertexAttribPointerv::Result Result; |
| 11534 Result* result = GetSharedMemoryAs<Result*>( | 11548 Result* result = GetSharedMemoryAs<Result*>( |
| 11535 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); | 11549 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); |
| 11536 if (!result) { | 11550 if (!result) { |
| 11537 return error::kOutOfBounds; | 11551 return error::kOutOfBounds; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 11552 } | 11566 } |
| 11553 result->SetNumResults(1); | 11567 result->SetNumResults(1); |
| 11554 *result->GetData() = | 11568 *result->GetData() = |
| 11555 state_.vertex_attrib_manager->GetVertexAttrib(index)->offset(); | 11569 state_.vertex_attrib_manager->GetVertexAttrib(index)->offset(); |
| 11556 return error::kNoError; | 11570 return error::kNoError; |
| 11557 } | 11571 } |
| 11558 | 11572 |
| 11559 template <class T> | 11573 template <class T> |
| 11560 bool GLES2DecoderImpl::GetUniformSetup(GLuint program_id, | 11574 bool GLES2DecoderImpl::GetUniformSetup(GLuint program_id, |
| 11561 GLint fake_location, | 11575 GLint fake_location, |
| 11562 uint32 shm_id, | 11576 uint32_t shm_id, |
| 11563 uint32 shm_offset, | 11577 uint32_t shm_offset, |
| 11564 error::Error* error, | 11578 error::Error* error, |
| 11565 GLint* real_location, | 11579 GLint* real_location, |
| 11566 GLuint* service_id, | 11580 GLuint* service_id, |
| 11567 SizedResult<T>** result_pointer, | 11581 SizedResult<T>** result_pointer, |
| 11568 GLenum* result_type, | 11582 GLenum* result_type, |
| 11569 GLsizei* result_size) { | 11583 GLsizei* result_size) { |
| 11570 DCHECK(error); | 11584 DCHECK(error); |
| 11571 DCHECK(service_id); | 11585 DCHECK(service_id); |
| 11572 DCHECK(result_pointer); | 11586 DCHECK(result_pointer); |
| 11573 DCHECK(result_type); | 11587 DCHECK(result_type); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 11600 const Program::UniformInfo* uniform_info = | 11614 const Program::UniformInfo* uniform_info = |
| 11601 program->GetUniformInfoByFakeLocation( | 11615 program->GetUniformInfoByFakeLocation( |
| 11602 fake_location, real_location, &array_index); | 11616 fake_location, real_location, &array_index); |
| 11603 if (!uniform_info) { | 11617 if (!uniform_info) { |
| 11604 // No such location. | 11618 // No such location. |
| 11605 LOCAL_SET_GL_ERROR( | 11619 LOCAL_SET_GL_ERROR( |
| 11606 GL_INVALID_OPERATION, "glGetUniform", "unknown location"); | 11620 GL_INVALID_OPERATION, "glGetUniform", "unknown location"); |
| 11607 return false; | 11621 return false; |
| 11608 } | 11622 } |
| 11609 GLenum type = uniform_info->type; | 11623 GLenum type = uniform_info->type; |
| 11610 uint32 num_elements = GLES2Util::GetElementCountForUniformType(type); | 11624 uint32_t num_elements = GLES2Util::GetElementCountForUniformType(type); |
| 11611 if (num_elements == 0) { | 11625 if (num_elements == 0) { |
| 11612 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetUniform", "unknown type"); | 11626 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glGetUniform", "unknown type"); |
| 11613 return false; | 11627 return false; |
| 11614 } | 11628 } |
| 11615 result = GetSharedMemoryAs<SizedResult<T>*>( | 11629 result = GetSharedMemoryAs<SizedResult<T>*>( |
| 11616 shm_id, shm_offset, SizedResult<T>::ComputeSize(num_elements)); | 11630 shm_id, shm_offset, SizedResult<T>::ComputeSize(num_elements)); |
| 11617 if (!result) { | 11631 if (!result) { |
| 11618 *error = error::kOutOfBounds; | 11632 *error = error::kOutOfBounds; |
| 11619 return false; | 11633 return false; |
| 11620 } | 11634 } |
| 11621 result->SetNumResults(num_elements); | 11635 result->SetNumResults(num_elements); |
| 11622 *result_size = num_elements * sizeof(T); | 11636 *result_size = num_elements * sizeof(T); |
| 11623 *result_type = type; | 11637 *result_type = type; |
| 11624 return true; | 11638 return true; |
| 11625 } | 11639 } |
| 11626 | 11640 |
| 11627 error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32 immediate_data_size, | 11641 error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32_t immediate_data_size, |
| 11628 const void* cmd_data) { | 11642 const void* cmd_data) { |
| 11629 const gles2::cmds::GetUniformiv& c = | 11643 const gles2::cmds::GetUniformiv& c = |
| 11630 *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); | 11644 *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); |
| 11631 GLuint program = c.program; | 11645 GLuint program = c.program; |
| 11632 GLint fake_location = c.location; | 11646 GLint fake_location = c.location; |
| 11633 GLuint service_id; | 11647 GLuint service_id; |
| 11634 GLenum result_type; | 11648 GLenum result_type; |
| 11635 GLsizei result_size; | 11649 GLsizei result_size; |
| 11636 GLint real_location = -1; | 11650 GLint real_location = -1; |
| 11637 Error error; | 11651 Error error; |
| 11638 cmds::GetUniformiv::Result* result; | 11652 cmds::GetUniformiv::Result* result; |
| 11639 if (GetUniformSetup<GLint>(program, fake_location, c.params_shm_id, | 11653 if (GetUniformSetup<GLint>(program, fake_location, c.params_shm_id, |
| 11640 c.params_shm_offset, &error, &real_location, | 11654 c.params_shm_offset, &error, &real_location, |
| 11641 &service_id, &result, &result_type, | 11655 &service_id, &result, &result_type, |
| 11642 &result_size)) { | 11656 &result_size)) { |
| 11643 glGetUniformiv( | 11657 glGetUniformiv( |
| 11644 service_id, real_location, result->GetData()); | 11658 service_id, real_location, result->GetData()); |
| 11645 } | 11659 } |
| 11646 return error; | 11660 return error; |
| 11647 } | 11661 } |
| 11648 | 11662 |
| 11649 error::Error GLES2DecoderImpl::HandleGetUniformuiv(uint32 immediate_data_size, | 11663 error::Error GLES2DecoderImpl::HandleGetUniformuiv(uint32_t immediate_data_size, |
| 11650 const void* cmd_data) { | 11664 const void* cmd_data) { |
| 11651 if (!unsafe_es3_apis_enabled()) | 11665 if (!unsafe_es3_apis_enabled()) |
| 11652 return error::kUnknownCommand; | 11666 return error::kUnknownCommand; |
| 11653 | 11667 |
| 11654 const gles2::cmds::GetUniformuiv& c = | 11668 const gles2::cmds::GetUniformuiv& c = |
| 11655 *static_cast<const gles2::cmds::GetUniformuiv*>(cmd_data); | 11669 *static_cast<const gles2::cmds::GetUniformuiv*>(cmd_data); |
| 11656 GLuint program = c.program; | 11670 GLuint program = c.program; |
| 11657 GLint fake_location = c.location; | 11671 GLint fake_location = c.location; |
| 11658 GLuint service_id; | 11672 GLuint service_id; |
| 11659 GLenum result_type; | 11673 GLenum result_type; |
| 11660 GLsizei result_size; | 11674 GLsizei result_size; |
| 11661 GLint real_location = -1; | 11675 GLint real_location = -1; |
| 11662 Error error; | 11676 Error error; |
| 11663 cmds::GetUniformuiv::Result* result; | 11677 cmds::GetUniformuiv::Result* result; |
| 11664 if (GetUniformSetup<GLuint>(program, fake_location, c.params_shm_id, | 11678 if (GetUniformSetup<GLuint>(program, fake_location, c.params_shm_id, |
| 11665 c.params_shm_offset, &error, &real_location, | 11679 c.params_shm_offset, &error, &real_location, |
| 11666 &service_id, &result, &result_type, | 11680 &service_id, &result, &result_type, |
| 11667 &result_size)) { | 11681 &result_size)) { |
| 11668 glGetUniformuiv( | 11682 glGetUniformuiv( |
| 11669 service_id, real_location, result->GetData()); | 11683 service_id, real_location, result->GetData()); |
| 11670 } | 11684 } |
| 11671 return error; | 11685 return error; |
| 11672 } | 11686 } |
| 11673 | 11687 |
| 11674 error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32 immediate_data_size, | 11688 error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32_t immediate_data_size, |
| 11675 const void* cmd_data) { | 11689 const void* cmd_data) { |
| 11676 const gles2::cmds::GetUniformfv& c = | 11690 const gles2::cmds::GetUniformfv& c = |
| 11677 *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); | 11691 *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); |
| 11678 GLuint program = c.program; | 11692 GLuint program = c.program; |
| 11679 GLint fake_location = c.location; | 11693 GLint fake_location = c.location; |
| 11680 GLuint service_id; | 11694 GLuint service_id; |
| 11681 GLint real_location = -1; | 11695 GLint real_location = -1; |
| 11682 Error error; | 11696 Error error; |
| 11683 cmds::GetUniformfv::Result* result; | 11697 cmds::GetUniformfv::Result* result; |
| 11684 GLenum result_type; | 11698 GLenum result_type; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 11697 dst[ii] = (temp[ii] != 0); | 11711 dst[ii] = (temp[ii] != 0); |
| 11698 } | 11712 } |
| 11699 } else { | 11713 } else { |
| 11700 glGetUniformfv(service_id, real_location, result->GetData()); | 11714 glGetUniformfv(service_id, real_location, result->GetData()); |
| 11701 } | 11715 } |
| 11702 } | 11716 } |
| 11703 return error; | 11717 return error; |
| 11704 } | 11718 } |
| 11705 | 11719 |
| 11706 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( | 11720 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( |
| 11707 uint32 immediate_data_size, | 11721 uint32_t immediate_data_size, |
| 11708 const void* cmd_data) { | 11722 const void* cmd_data) { |
| 11709 const gles2::cmds::GetShaderPrecisionFormat& c = | 11723 const gles2::cmds::GetShaderPrecisionFormat& c = |
| 11710 *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); | 11724 *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); |
| 11711 GLenum shader_type = static_cast<GLenum>(c.shadertype); | 11725 GLenum shader_type = static_cast<GLenum>(c.shadertype); |
| 11712 GLenum precision_type = static_cast<GLenum>(c.precisiontype); | 11726 GLenum precision_type = static_cast<GLenum>(c.precisiontype); |
| 11713 typedef cmds::GetShaderPrecisionFormat::Result Result; | 11727 typedef cmds::GetShaderPrecisionFormat::Result Result; |
| 11714 Result* result = GetSharedMemoryAs<Result*>( | 11728 Result* result = GetSharedMemoryAs<Result*>( |
| 11715 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 11729 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 11716 if (!result) { | 11730 if (!result) { |
| 11717 return error::kOutOfBounds; | 11731 return error::kOutOfBounds; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 11738 GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); | 11752 GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); |
| 11739 | 11753 |
| 11740 result->min_range = range[0]; | 11754 result->min_range = range[0]; |
| 11741 result->max_range = range[1]; | 11755 result->max_range = range[1]; |
| 11742 result->precision = precision; | 11756 result->precision = precision; |
| 11743 | 11757 |
| 11744 return error::kNoError; | 11758 return error::kNoError; |
| 11745 } | 11759 } |
| 11746 | 11760 |
| 11747 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( | 11761 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( |
| 11748 uint32 immediate_data_size, | 11762 uint32_t immediate_data_size, |
| 11749 const void* cmd_data) { | 11763 const void* cmd_data) { |
| 11750 const gles2::cmds::GetAttachedShaders& c = | 11764 const gles2::cmds::GetAttachedShaders& c = |
| 11751 *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); | 11765 *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); |
| 11752 uint32 result_size = c.result_size; | 11766 uint32_t result_size = c.result_size; |
| 11753 GLuint program_id = static_cast<GLuint>(c.program); | 11767 GLuint program_id = static_cast<GLuint>(c.program); |
| 11754 Program* program = GetProgramInfoNotShader( | 11768 Program* program = GetProgramInfoNotShader( |
| 11755 program_id, "glGetAttachedShaders"); | 11769 program_id, "glGetAttachedShaders"); |
| 11756 if (!program) { | 11770 if (!program) { |
| 11757 return error::kNoError; | 11771 return error::kNoError; |
| 11758 } | 11772 } |
| 11759 typedef cmds::GetAttachedShaders::Result Result; | 11773 typedef cmds::GetAttachedShaders::Result Result; |
| 11760 uint32 max_count = Result::ComputeMaxResults(result_size); | 11774 uint32_t max_count = Result::ComputeMaxResults(result_size); |
| 11761 Result* result = GetSharedMemoryAs<Result*>( | 11775 Result* result = GetSharedMemoryAs<Result*>( |
| 11762 c.result_shm_id, c.result_shm_offset, Result::ComputeSize(max_count)); | 11776 c.result_shm_id, c.result_shm_offset, Result::ComputeSize(max_count)); |
| 11763 if (!result) { | 11777 if (!result) { |
| 11764 return error::kOutOfBounds; | 11778 return error::kOutOfBounds; |
| 11765 } | 11779 } |
| 11766 // Check that the client initialized the result. | 11780 // Check that the client initialized the result. |
| 11767 if (result->size != 0) { | 11781 if (result->size != 0) { |
| 11768 return error::kInvalidArguments; | 11782 return error::kInvalidArguments; |
| 11769 } | 11783 } |
| 11770 GLsizei count = 0; | 11784 GLsizei count = 0; |
| 11771 glGetAttachedShaders( | 11785 glGetAttachedShaders( |
| 11772 program->service_id(), max_count, &count, result->GetData()); | 11786 program->service_id(), max_count, &count, result->GetData()); |
| 11773 for (GLsizei ii = 0; ii < count; ++ii) { | 11787 for (GLsizei ii = 0; ii < count; ++ii) { |
| 11774 if (!shader_manager()->GetClientId(result->GetData()[ii], | 11788 if (!shader_manager()->GetClientId(result->GetData()[ii], |
| 11775 &result->GetData()[ii])) { | 11789 &result->GetData()[ii])) { |
| 11776 NOTREACHED(); | 11790 NOTREACHED(); |
| 11777 return error::kGenericError; | 11791 return error::kGenericError; |
| 11778 } | 11792 } |
| 11779 } | 11793 } |
| 11780 result->SetNumResults(count); | 11794 result->SetNumResults(count); |
| 11781 return error::kNoError; | 11795 return error::kNoError; |
| 11782 } | 11796 } |
| 11783 | 11797 |
| 11784 error::Error GLES2DecoderImpl::HandleGetActiveUniform( | 11798 error::Error GLES2DecoderImpl::HandleGetActiveUniform( |
| 11785 uint32 immediate_data_size, | 11799 uint32_t immediate_data_size, |
| 11786 const void* cmd_data) { | 11800 const void* cmd_data) { |
| 11787 const gles2::cmds::GetActiveUniform& c = | 11801 const gles2::cmds::GetActiveUniform& c = |
| 11788 *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); | 11802 *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); |
| 11789 GLuint program_id = c.program; | 11803 GLuint program_id = c.program; |
| 11790 GLuint index = c.index; | 11804 GLuint index = c.index; |
| 11791 uint32 name_bucket_id = c.name_bucket_id; | 11805 uint32_t name_bucket_id = c.name_bucket_id; |
| 11792 typedef cmds::GetActiveUniform::Result Result; | 11806 typedef cmds::GetActiveUniform::Result Result; |
| 11793 Result* result = GetSharedMemoryAs<Result*>( | 11807 Result* result = GetSharedMemoryAs<Result*>( |
| 11794 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 11808 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 11795 if (!result) { | 11809 if (!result) { |
| 11796 return error::kOutOfBounds; | 11810 return error::kOutOfBounds; |
| 11797 } | 11811 } |
| 11798 // Check that the client initialized the result. | 11812 // Check that the client initialized the result. |
| 11799 if (result->success != 0) { | 11813 if (result->success != 0) { |
| 11800 return error::kInvalidArguments; | 11814 return error::kInvalidArguments; |
| 11801 } | 11815 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 11813 } | 11827 } |
| 11814 result->success = 1; // true. | 11828 result->success = 1; // true. |
| 11815 result->size = uniform_info->size; | 11829 result->size = uniform_info->size; |
| 11816 result->type = uniform_info->type; | 11830 result->type = uniform_info->type; |
| 11817 Bucket* bucket = CreateBucket(name_bucket_id); | 11831 Bucket* bucket = CreateBucket(name_bucket_id); |
| 11818 bucket->SetFromString(uniform_info->name.c_str()); | 11832 bucket->SetFromString(uniform_info->name.c_str()); |
| 11819 return error::kNoError; | 11833 return error::kNoError; |
| 11820 } | 11834 } |
| 11821 | 11835 |
| 11822 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv( | 11836 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv( |
| 11823 uint32 immediate_data_size, const void* cmd_data) { | 11837 uint32_t immediate_data_size, |
| 11838 const void* cmd_data) { |
| 11824 if (!unsafe_es3_apis_enabled()) | 11839 if (!unsafe_es3_apis_enabled()) |
| 11825 return error::kUnknownCommand; | 11840 return error::kUnknownCommand; |
| 11826 const gles2::cmds::GetActiveUniformBlockiv& c = | 11841 const gles2::cmds::GetActiveUniformBlockiv& c = |
| 11827 *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); | 11842 *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); |
| 11828 GLuint program_id = c.program; | 11843 GLuint program_id = c.program; |
| 11829 GLuint index = static_cast<GLuint>(c.index); | 11844 GLuint index = static_cast<GLuint>(c.index); |
| 11830 GLenum pname = static_cast<GLenum>(c.pname); | 11845 GLenum pname = static_cast<GLenum>(c.pname); |
| 11831 Program* program = GetProgramInfoNotShader( | 11846 Program* program = GetProgramInfoNotShader( |
| 11832 program_id, "glGetActiveUniformBlockiv"); | 11847 program_id, "glGetActiveUniformBlockiv"); |
| 11833 if (!program) { | 11848 if (!program) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11870 GLenum error = glGetError(); | 11885 GLenum error = glGetError(); |
| 11871 if (error == GL_NO_ERROR) { | 11886 if (error == GL_NO_ERROR) { |
| 11872 result->SetNumResults(num_values); | 11887 result->SetNumResults(num_values); |
| 11873 } else { | 11888 } else { |
| 11874 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); | 11889 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); |
| 11875 } | 11890 } |
| 11876 return error::kNoError; | 11891 return error::kNoError; |
| 11877 } | 11892 } |
| 11878 | 11893 |
| 11879 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName( | 11894 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName( |
| 11880 uint32 immediate_data_size, const void* cmd_data) { | 11895 uint32_t immediate_data_size, |
| 11896 const void* cmd_data) { |
| 11881 if (!unsafe_es3_apis_enabled()) | 11897 if (!unsafe_es3_apis_enabled()) |
| 11882 return error::kUnknownCommand; | 11898 return error::kUnknownCommand; |
| 11883 const gles2::cmds::GetActiveUniformBlockName& c = | 11899 const gles2::cmds::GetActiveUniformBlockName& c = |
| 11884 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); | 11900 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); |
| 11885 GLuint program_id = c.program; | 11901 GLuint program_id = c.program; |
| 11886 GLuint index = c.index; | 11902 GLuint index = c.index; |
| 11887 uint32 name_bucket_id = c.name_bucket_id; | 11903 uint32_t name_bucket_id = c.name_bucket_id; |
| 11888 typedef cmds::GetActiveUniformBlockName::Result Result; | 11904 typedef cmds::GetActiveUniformBlockName::Result Result; |
| 11889 Result* result = GetSharedMemoryAs<Result*>( | 11905 Result* result = GetSharedMemoryAs<Result*>( |
| 11890 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 11906 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 11891 if (!result) { | 11907 if (!result) { |
| 11892 return error::kOutOfBounds; | 11908 return error::kOutOfBounds; |
| 11893 } | 11909 } |
| 11894 // Check that the client initialized the result. | 11910 // Check that the client initialized the result. |
| 11895 if (*result != 0) { | 11911 if (*result != 0) { |
| 11896 return error::kInvalidArguments; | 11912 return error::kInvalidArguments; |
| 11897 } | 11913 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 11923 } | 11939 } |
| 11924 *result = 1; | 11940 *result = 1; |
| 11925 Bucket* bucket = CreateBucket(name_bucket_id); | 11941 Bucket* bucket = CreateBucket(name_bucket_id); |
| 11926 DCHECK_GT(buf_size, length); | 11942 DCHECK_GT(buf_size, length); |
| 11927 DCHECK_EQ(0, buffer[length]); | 11943 DCHECK_EQ(0, buffer[length]); |
| 11928 bucket->SetFromString(&buffer[0]); | 11944 bucket->SetFromString(&buffer[0]); |
| 11929 return error::kNoError; | 11945 return error::kNoError; |
| 11930 } | 11946 } |
| 11931 | 11947 |
| 11932 error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( | 11948 error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( |
| 11933 uint32 immediate_data_size, const void* cmd_data) { | 11949 uint32_t immediate_data_size, |
| 11950 const void* cmd_data) { |
| 11934 if (!unsafe_es3_apis_enabled()) | 11951 if (!unsafe_es3_apis_enabled()) |
| 11935 return error::kUnknownCommand; | 11952 return error::kUnknownCommand; |
| 11936 const gles2::cmds::GetActiveUniformsiv& c = | 11953 const gles2::cmds::GetActiveUniformsiv& c = |
| 11937 *static_cast<const gles2::cmds::GetActiveUniformsiv*>(cmd_data); | 11954 *static_cast<const gles2::cmds::GetActiveUniformsiv*>(cmd_data); |
| 11938 GLuint program_id = c.program; | 11955 GLuint program_id = c.program; |
| 11939 GLenum pname = static_cast<GLenum>(c.pname); | 11956 GLenum pname = static_cast<GLenum>(c.pname); |
| 11940 Bucket* bucket = GetBucket(c.indices_bucket_id); | 11957 Bucket* bucket = GetBucket(c.indices_bucket_id); |
| 11941 if (!bucket) { | 11958 if (!bucket) { |
| 11942 return error::kInvalidArguments; | 11959 return error::kInvalidArguments; |
| 11943 } | 11960 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11975 glGetActiveUniformsiv(service_id, count, indices, pname, params); | 11992 glGetActiveUniformsiv(service_id, count, indices, pname, params); |
| 11976 GLenum error = glGetError(); | 11993 GLenum error = glGetError(); |
| 11977 if (error == GL_NO_ERROR) { | 11994 if (error == GL_NO_ERROR) { |
| 11978 result->SetNumResults(count); | 11995 result->SetNumResults(count); |
| 11979 } else { | 11996 } else { |
| 11980 LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", ""); | 11997 LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", ""); |
| 11981 } | 11998 } |
| 11982 return error::kNoError; | 11999 return error::kNoError; |
| 11983 } | 12000 } |
| 11984 | 12001 |
| 11985 error::Error GLES2DecoderImpl::HandleGetActiveAttrib(uint32 immediate_data_size, | 12002 error::Error GLES2DecoderImpl::HandleGetActiveAttrib( |
| 11986 const void* cmd_data) { | 12003 uint32_t immediate_data_size, |
| 12004 const void* cmd_data) { |
| 11987 const gles2::cmds::GetActiveAttrib& c = | 12005 const gles2::cmds::GetActiveAttrib& c = |
| 11988 *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); | 12006 *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); |
| 11989 GLuint program_id = c.program; | 12007 GLuint program_id = c.program; |
| 11990 GLuint index = c.index; | 12008 GLuint index = c.index; |
| 11991 uint32 name_bucket_id = c.name_bucket_id; | 12009 uint32_t name_bucket_id = c.name_bucket_id; |
| 11992 typedef cmds::GetActiveAttrib::Result Result; | 12010 typedef cmds::GetActiveAttrib::Result Result; |
| 11993 Result* result = GetSharedMemoryAs<Result*>( | 12011 Result* result = GetSharedMemoryAs<Result*>( |
| 11994 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 12012 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 11995 if (!result) { | 12013 if (!result) { |
| 11996 return error::kOutOfBounds; | 12014 return error::kOutOfBounds; |
| 11997 } | 12015 } |
| 11998 // Check that the client initialized the result. | 12016 // Check that the client initialized the result. |
| 11999 if (result->success != 0) { | 12017 if (result->success != 0) { |
| 12000 return error::kInvalidArguments; | 12018 return error::kInvalidArguments; |
| 12001 } | 12019 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 12012 return error::kNoError; | 12030 return error::kNoError; |
| 12013 } | 12031 } |
| 12014 result->success = 1; // true. | 12032 result->success = 1; // true. |
| 12015 result->size = attrib_info->size; | 12033 result->size = attrib_info->size; |
| 12016 result->type = attrib_info->type; | 12034 result->type = attrib_info->type; |
| 12017 Bucket* bucket = CreateBucket(name_bucket_id); | 12035 Bucket* bucket = CreateBucket(name_bucket_id); |
| 12018 bucket->SetFromString(attrib_info->name.c_str()); | 12036 bucket->SetFromString(attrib_info->name.c_str()); |
| 12019 return error::kNoError; | 12037 return error::kNoError; |
| 12020 } | 12038 } |
| 12021 | 12039 |
| 12022 error::Error GLES2DecoderImpl::HandleShaderBinary(uint32 immediate_data_size, | 12040 error::Error GLES2DecoderImpl::HandleShaderBinary(uint32_t immediate_data_size, |
| 12023 const void* cmd_data) { | 12041 const void* cmd_data) { |
| 12024 #if 1 // No binary shader support. | 12042 #if 1 // No binary shader support. |
| 12025 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); | 12043 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); |
| 12026 return error::kNoError; | 12044 return error::kNoError; |
| 12027 #else | 12045 #else |
| 12028 GLsizei n = static_cast<GLsizei>(c.n); | 12046 GLsizei n = static_cast<GLsizei>(c.n); |
| 12029 if (n < 0) { | 12047 if (n < 0) { |
| 12030 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); | 12048 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); |
| 12031 return error::kNoError; | 12049 return error::kNoError; |
| 12032 } | 12050 } |
| 12033 GLsizei length = static_cast<GLsizei>(c.length); | 12051 GLsizei length = static_cast<GLsizei>(c.length); |
| 12034 if (length < 0) { | 12052 if (length < 0) { |
| 12035 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "length < 0"); | 12053 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "length < 0"); |
| 12036 return error::kNoError; | 12054 return error::kNoError; |
| 12037 } | 12055 } |
| 12038 uint32 data_size; | 12056 uint32_t data_size; |
| 12039 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 12057 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
| 12040 return error::kOutOfBounds; | 12058 return error::kOutOfBounds; |
| 12041 } | 12059 } |
| 12042 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( | 12060 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( |
| 12043 c.shaders_shm_id, c.shaders_shm_offset, data_size); | 12061 c.shaders_shm_id, c.shaders_shm_offset, data_size); |
| 12044 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); | 12062 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); |
| 12045 const void* binary = GetSharedMemoryAs<const void*>( | 12063 const void* binary = GetSharedMemoryAs<const void*>( |
| 12046 c.binary_shm_id, c.binary_shm_offset, length); | 12064 c.binary_shm_id, c.binary_shm_offset, length); |
| 12047 if (shaders == NULL || binary == NULL) { | 12065 if (shaders == NULL || binary == NULL) { |
| 12048 return error::kOutOfBounds; | 12066 return error::kOutOfBounds; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12201 } else { | 12219 } else { |
| 12202 FinishSwapBuffers(surface_->CommitOverlayPlanes()); | 12220 FinishSwapBuffers(surface_->CommitOverlayPlanes()); |
| 12203 } | 12221 } |
| 12204 } | 12222 } |
| 12205 | 12223 |
| 12206 void GLES2DecoderImpl::DoSwapInterval(int interval) { | 12224 void GLES2DecoderImpl::DoSwapInterval(int interval) { |
| 12207 context_->SetSwapInterval(interval); | 12225 context_->SetSwapInterval(interval); |
| 12208 } | 12226 } |
| 12209 | 12227 |
| 12210 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( | 12228 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( |
| 12211 uint32 immediate_data_size, | 12229 uint32_t immediate_data_size, |
| 12212 const void* cmd_data) { | 12230 const void* cmd_data) { |
| 12213 const gles2::cmds::EnableFeatureCHROMIUM& c = | 12231 const gles2::cmds::EnableFeatureCHROMIUM& c = |
| 12214 *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); | 12232 *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); |
| 12215 Bucket* bucket = GetBucket(c.bucket_id); | 12233 Bucket* bucket = GetBucket(c.bucket_id); |
| 12216 if (!bucket || bucket->size() == 0) { | 12234 if (!bucket || bucket->size() == 0) { |
| 12217 return error::kInvalidArguments; | 12235 return error::kInvalidArguments; |
| 12218 } | 12236 } |
| 12219 typedef cmds::EnableFeatureCHROMIUM::Result Result; | 12237 typedef cmds::EnableFeatureCHROMIUM::Result Result; |
| 12220 Result* result = GetSharedMemoryAs<Result*>( | 12238 Result* result = GetSharedMemoryAs<Result*>( |
| 12221 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 12239 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 12248 const_cast<Validators*>(validators_)->vertex_attrib_type.AddValue(GL_FIXED); | 12266 const_cast<Validators*>(validators_)->vertex_attrib_type.AddValue(GL_FIXED); |
| 12249 } else { | 12267 } else { |
| 12250 return error::kNoError; | 12268 return error::kNoError; |
| 12251 } | 12269 } |
| 12252 | 12270 |
| 12253 *result = 1; // true. | 12271 *result = 1; // true. |
| 12254 return error::kNoError; | 12272 return error::kNoError; |
| 12255 } | 12273 } |
| 12256 | 12274 |
| 12257 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( | 12275 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( |
| 12258 uint32 immediate_data_size, | 12276 uint32_t immediate_data_size, |
| 12259 const void* cmd_data) { | 12277 const void* cmd_data) { |
| 12260 const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = | 12278 const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = |
| 12261 *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( | 12279 *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( |
| 12262 cmd_data); | 12280 cmd_data); |
| 12263 Bucket* bucket = CreateBucket(c.bucket_id); | 12281 Bucket* bucket = CreateBucket(c.bucket_id); |
| 12264 scoped_refptr<FeatureInfo> info(new FeatureInfo()); | 12282 scoped_refptr<FeatureInfo> info(new FeatureInfo()); |
| 12265 info->Initialize(feature_info_->context_type(), disallowed_features_); | 12283 info->Initialize(feature_info_->context_type(), disallowed_features_); |
| 12266 bucket->SetFromString(info->extensions().c_str()); | 12284 bucket->SetFromString(info->extensions().c_str()); |
| 12267 return error::kNoError; | 12285 return error::kNoError; |
| 12268 } | 12286 } |
| 12269 | 12287 |
| 12270 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( | 12288 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( |
| 12271 uint32 immediate_data_size, | 12289 uint32_t immediate_data_size, |
| 12272 const void* cmd_data) { | 12290 const void* cmd_data) { |
| 12273 const gles2::cmds::RequestExtensionCHROMIUM& c = | 12291 const gles2::cmds::RequestExtensionCHROMIUM& c = |
| 12274 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); | 12292 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); |
| 12275 Bucket* bucket = GetBucket(c.bucket_id); | 12293 Bucket* bucket = GetBucket(c.bucket_id); |
| 12276 if (!bucket || bucket->size() == 0) { | 12294 if (!bucket || bucket->size() == 0) { |
| 12277 return error::kInvalidArguments; | 12295 return error::kInvalidArguments; |
| 12278 } | 12296 } |
| 12279 std::string feature_str; | 12297 std::string feature_str; |
| 12280 if (!bucket->GetAsString(&feature_str)) { | 12298 if (!bucket->GetAsString(&feature_str)) { |
| 12281 return error::kInvalidArguments; | 12299 return error::kInvalidArguments; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 12306 shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; | 12324 shader_texture_lod_explicitly_enabled_ |= desire_shader_texture_lod; |
| 12307 InitializeShaderTranslator(); | 12325 InitializeShaderTranslator(); |
| 12308 } | 12326 } |
| 12309 | 12327 |
| 12310 UpdateCapabilities(); | 12328 UpdateCapabilities(); |
| 12311 | 12329 |
| 12312 return error::kNoError; | 12330 return error::kNoError; |
| 12313 } | 12331 } |
| 12314 | 12332 |
| 12315 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( | 12333 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( |
| 12316 uint32 immediate_data_size, | 12334 uint32_t immediate_data_size, |
| 12317 const void* cmd_data) { | 12335 const void* cmd_data) { |
| 12318 const gles2::cmds::GetProgramInfoCHROMIUM& c = | 12336 const gles2::cmds::GetProgramInfoCHROMIUM& c = |
| 12319 *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); | 12337 *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); |
| 12320 GLuint program_id = static_cast<GLuint>(c.program); | 12338 GLuint program_id = static_cast<GLuint>(c.program); |
| 12321 uint32 bucket_id = c.bucket_id; | 12339 uint32_t bucket_id = c.bucket_id; |
| 12322 Bucket* bucket = CreateBucket(bucket_id); | 12340 Bucket* bucket = CreateBucket(bucket_id); |
| 12323 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. | 12341 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. |
| 12324 Program* program = NULL; | 12342 Program* program = NULL; |
| 12325 program = GetProgram(program_id); | 12343 program = GetProgram(program_id); |
| 12326 if (!program || !program->IsValid()) { | 12344 if (!program || !program->IsValid()) { |
| 12327 return error::kNoError; | 12345 return error::kNoError; |
| 12328 } | 12346 } |
| 12329 program->GetProgramInfo(program_manager(), bucket); | 12347 program->GetProgramInfo(program_manager(), bucket); |
| 12330 return error::kNoError; | 12348 return error::kNoError; |
| 12331 } | 12349 } |
| 12332 | 12350 |
| 12333 error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM( | 12351 error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM( |
| 12334 uint32 immediate_data_size, const void* cmd_data) { | 12352 uint32_t immediate_data_size, |
| 12353 const void* cmd_data) { |
| 12335 if (!unsafe_es3_apis_enabled()) | 12354 if (!unsafe_es3_apis_enabled()) |
| 12336 return error::kUnknownCommand; | 12355 return error::kUnknownCommand; |
| 12337 const gles2::cmds::GetUniformBlocksCHROMIUM& c = | 12356 const gles2::cmds::GetUniformBlocksCHROMIUM& c = |
| 12338 *static_cast<const gles2::cmds::GetUniformBlocksCHROMIUM*>(cmd_data); | 12357 *static_cast<const gles2::cmds::GetUniformBlocksCHROMIUM*>(cmd_data); |
| 12339 GLuint program_id = static_cast<GLuint>(c.program); | 12358 GLuint program_id = static_cast<GLuint>(c.program); |
| 12340 uint32 bucket_id = c.bucket_id; | 12359 uint32_t bucket_id = c.bucket_id; |
| 12341 Bucket* bucket = CreateBucket(bucket_id); | 12360 Bucket* bucket = CreateBucket(bucket_id); |
| 12342 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail. | 12361 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail. |
| 12343 Program* program = NULL; | 12362 Program* program = NULL; |
| 12344 program = GetProgram(program_id); | 12363 program = GetProgram(program_id); |
| 12345 if (!program || !program->IsValid()) { | 12364 if (!program || !program->IsValid()) { |
| 12346 return error::kNoError; | 12365 return error::kNoError; |
| 12347 } | 12366 } |
| 12348 program->GetUniformBlocks(bucket); | 12367 program->GetUniformBlocks(bucket); |
| 12349 return error::kNoError; | 12368 return error::kNoError; |
| 12350 } | 12369 } |
| 12351 | 12370 |
| 12352 error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM( | 12371 error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM( |
| 12353 uint32 immediate_data_size, const void* cmd_data) { | 12372 uint32_t immediate_data_size, |
| 12373 const void* cmd_data) { |
| 12354 if (!unsafe_es3_apis_enabled()) | 12374 if (!unsafe_es3_apis_enabled()) |
| 12355 return error::kUnknownCommand; | 12375 return error::kUnknownCommand; |
| 12356 const gles2::cmds::GetUniformsES3CHROMIUM& c = | 12376 const gles2::cmds::GetUniformsES3CHROMIUM& c = |
| 12357 *static_cast<const gles2::cmds::GetUniformsES3CHROMIUM*>(cmd_data); | 12377 *static_cast<const gles2::cmds::GetUniformsES3CHROMIUM*>(cmd_data); |
| 12358 GLuint program_id = static_cast<GLuint>(c.program); | 12378 GLuint program_id = static_cast<GLuint>(c.program); |
| 12359 uint32 bucket_id = c.bucket_id; | 12379 uint32_t bucket_id = c.bucket_id; |
| 12360 Bucket* bucket = CreateBucket(bucket_id); | 12380 Bucket* bucket = CreateBucket(bucket_id); |
| 12361 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail. | 12381 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail. |
| 12362 Program* program = NULL; | 12382 Program* program = NULL; |
| 12363 program = GetProgram(program_id); | 12383 program = GetProgram(program_id); |
| 12364 if (!program || !program->IsValid()) { | 12384 if (!program || !program->IsValid()) { |
| 12365 return error::kNoError; | 12385 return error::kNoError; |
| 12366 } | 12386 } |
| 12367 program->GetUniformsES3(bucket); | 12387 program->GetUniformsES3(bucket); |
| 12368 return error::kNoError; | 12388 return error::kNoError; |
| 12369 } | 12389 } |
| 12370 | 12390 |
| 12371 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying( | 12391 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying( |
| 12372 uint32 immediate_data_size, | 12392 uint32_t immediate_data_size, |
| 12373 const void* cmd_data) { | 12393 const void* cmd_data) { |
| 12374 if (!unsafe_es3_apis_enabled()) | 12394 if (!unsafe_es3_apis_enabled()) |
| 12375 return error::kUnknownCommand; | 12395 return error::kUnknownCommand; |
| 12376 const gles2::cmds::GetTransformFeedbackVarying& c = | 12396 const gles2::cmds::GetTransformFeedbackVarying& c = |
| 12377 *static_cast<const gles2::cmds::GetTransformFeedbackVarying*>(cmd_data); | 12397 *static_cast<const gles2::cmds::GetTransformFeedbackVarying*>(cmd_data); |
| 12378 GLuint program_id = c.program; | 12398 GLuint program_id = c.program; |
| 12379 GLuint index = c.index; | 12399 GLuint index = c.index; |
| 12380 uint32 name_bucket_id = c.name_bucket_id; | 12400 uint32_t name_bucket_id = c.name_bucket_id; |
| 12381 typedef cmds::GetTransformFeedbackVarying::Result Result; | 12401 typedef cmds::GetTransformFeedbackVarying::Result Result; |
| 12382 Result* result = GetSharedMemoryAs<Result*>( | 12402 Result* result = GetSharedMemoryAs<Result*>( |
| 12383 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | 12403 c.result_shm_id, c.result_shm_offset, sizeof(*result)); |
| 12384 if (!result) { | 12404 if (!result) { |
| 12385 return error::kOutOfBounds; | 12405 return error::kOutOfBounds; |
| 12386 } | 12406 } |
| 12387 // Check that the client initialized the result. | 12407 // Check that the client initialized the result. |
| 12388 if (result->success != 0) { | 12408 if (result->success != 0) { |
| 12389 return error::kInvalidArguments; | 12409 return error::kInvalidArguments; |
| 12390 } | 12410 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 12421 result->size = static_cast<int32_t>(size); | 12441 result->size = static_cast<int32_t>(size); |
| 12422 result->type = static_cast<uint32_t>(type); | 12442 result->type = static_cast<uint32_t>(type); |
| 12423 Bucket* bucket = CreateBucket(name_bucket_id); | 12443 Bucket* bucket = CreateBucket(name_bucket_id); |
| 12424 DCHECK(length >= 0 && length < max_length); | 12444 DCHECK(length >= 0 && length < max_length); |
| 12425 buffer[length] = '\0'; // Just to be safe. | 12445 buffer[length] = '\0'; // Just to be safe. |
| 12426 bucket->SetFromString(&buffer[0]); | 12446 bucket->SetFromString(&buffer[0]); |
| 12427 return error::kNoError; | 12447 return error::kNoError; |
| 12428 } | 12448 } |
| 12429 | 12449 |
| 12430 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM( | 12450 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM( |
| 12431 uint32 immediate_data_size, const void* cmd_data) { | 12451 uint32_t immediate_data_size, |
| 12452 const void* cmd_data) { |
| 12432 if (!unsafe_es3_apis_enabled()) | 12453 if (!unsafe_es3_apis_enabled()) |
| 12433 return error::kUnknownCommand; | 12454 return error::kUnknownCommand; |
| 12434 const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c = | 12455 const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c = |
| 12435 *static_cast<const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>( | 12456 *static_cast<const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>( |
| 12436 cmd_data); | 12457 cmd_data); |
| 12437 GLuint program_id = static_cast<GLuint>(c.program); | 12458 GLuint program_id = static_cast<GLuint>(c.program); |
| 12438 uint32 bucket_id = c.bucket_id; | 12459 uint32_t bucket_id = c.bucket_id; |
| 12439 Bucket* bucket = CreateBucket(bucket_id); | 12460 Bucket* bucket = CreateBucket(bucket_id); |
| 12440 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail. | 12461 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail. |
| 12441 Program* program = NULL; | 12462 Program* program = NULL; |
| 12442 program = GetProgram(program_id); | 12463 program = GetProgram(program_id); |
| 12443 if (!program || !program->IsValid()) { | 12464 if (!program || !program->IsValid()) { |
| 12444 return error::kNoError; | 12465 return error::kNoError; |
| 12445 } | 12466 } |
| 12446 program->GetTransformFeedbackVaryings(bucket); | 12467 program->GetTransformFeedbackVaryings(bucket); |
| 12447 return error::kNoError; | 12468 return error::kNoError; |
| 12448 } | 12469 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12522 NOTREACHED(); | 12543 NOTREACHED(); |
| 12523 return false; | 12544 return false; |
| 12524 } | 12545 } |
| 12525 reset_by_robustness_extension_ = true; | 12546 reset_by_robustness_extension_ = true; |
| 12526 return true; | 12547 return true; |
| 12527 } | 12548 } |
| 12528 return false; | 12549 return false; |
| 12529 } | 12550 } |
| 12530 | 12551 |
| 12531 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( | 12552 error::Error GLES2DecoderImpl::HandleInsertSyncPointCHROMIUM( |
| 12532 uint32 immediate_data_size, | 12553 uint32_t immediate_data_size, |
| 12533 const void* cmd_data) { | 12554 const void* cmd_data) { |
| 12534 return error::kUnknownCommand; | 12555 return error::kUnknownCommand; |
| 12535 } | 12556 } |
| 12536 | 12557 |
| 12537 error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( | 12558 error::Error GLES2DecoderImpl::HandleWaitSyncPointCHROMIUM( |
| 12538 uint32 immediate_data_size, | 12559 uint32_t immediate_data_size, |
| 12539 const void* cmd_data) { | 12560 const void* cmd_data) { |
| 12540 const gles2::cmds::WaitSyncPointCHROMIUM& c = | 12561 const gles2::cmds::WaitSyncPointCHROMIUM& c = |
| 12541 *static_cast<const gles2::cmds::WaitSyncPointCHROMIUM*>(cmd_data); | 12562 *static_cast<const gles2::cmds::WaitSyncPointCHROMIUM*>(cmd_data); |
| 12542 uint32 sync_point = c.sync_point; | 12563 uint32_t sync_point = c.sync_point; |
| 12543 if (wait_sync_point_callback_.is_null()) | 12564 if (wait_sync_point_callback_.is_null()) |
| 12544 return error::kNoError; | 12565 return error::kNoError; |
| 12545 | 12566 |
| 12546 return wait_sync_point_callback_.Run(sync_point) ? | 12567 return wait_sync_point_callback_.Run(sync_point) ? |
| 12547 error::kNoError : error::kDeferCommandUntilLater; | 12568 error::kNoError : error::kDeferCommandUntilLater; |
| 12548 } | 12569 } |
| 12549 | 12570 |
| 12550 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( | 12571 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( |
| 12551 uint32 immediate_data_size, | 12572 uint32_t immediate_data_size, |
| 12552 const void* cmd_data) { | 12573 const void* cmd_data) { |
| 12553 const gles2::cmds::InsertFenceSyncCHROMIUM& c = | 12574 const gles2::cmds::InsertFenceSyncCHROMIUM& c = |
| 12554 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); | 12575 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); |
| 12555 | 12576 |
| 12556 const uint64_t release_count = c.release_count(); | 12577 const uint64_t release_count = c.release_count(); |
| 12557 if (!fence_sync_release_callback_.is_null()) | 12578 if (!fence_sync_release_callback_.is_null()) |
| 12558 fence_sync_release_callback_.Run(release_count); | 12579 fence_sync_release_callback_.Run(release_count); |
| 12559 return error::kNoError; | 12580 return error::kNoError; |
| 12560 } | 12581 } |
| 12561 | 12582 |
| 12562 error::Error GLES2DecoderImpl::HandleGenSyncTokenCHROMIUMImmediate( | 12583 error::Error GLES2DecoderImpl::HandleGenSyncTokenCHROMIUMImmediate( |
| 12563 uint32 immediate_data_size, | 12584 uint32_t immediate_data_size, |
| 12564 const void* cmd_data) { | 12585 const void* cmd_data) { |
| 12565 return error::kUnknownCommand; | 12586 return error::kUnknownCommand; |
| 12566 } | 12587 } |
| 12567 | 12588 |
| 12568 error::Error GLES2DecoderImpl::HandleGenUnverifiedSyncTokenCHROMIUMImmediate( | 12589 error::Error GLES2DecoderImpl::HandleGenUnverifiedSyncTokenCHROMIUMImmediate( |
| 12569 uint32 immediate_data_size, | 12590 uint32_t immediate_data_size, |
| 12570 const void* cmd_data) { | 12591 const void* cmd_data) { |
| 12571 return error::kUnknownCommand; | 12592 return error::kUnknownCommand; |
| 12572 } | 12593 } |
| 12573 | 12594 |
| 12574 error::Error GLES2DecoderImpl::HandleVerifySyncTokensCHROMIUMImmediate( | 12595 error::Error GLES2DecoderImpl::HandleVerifySyncTokensCHROMIUMImmediate( |
| 12575 uint32 immediate_data_size, | 12596 uint32_t immediate_data_size, |
| 12576 const void* cmd_data) { | 12597 const void* cmd_data) { |
| 12577 return error::kUnknownCommand; | 12598 return error::kUnknownCommand; |
| 12578 } | 12599 } |
| 12579 | 12600 |
| 12580 error::Error GLES2DecoderImpl::HandleWaitSyncTokenCHROMIUM( | 12601 error::Error GLES2DecoderImpl::HandleWaitSyncTokenCHROMIUM( |
| 12581 uint32 immediate_data_size, | 12602 uint32_t immediate_data_size, |
| 12582 const void* cmd_data) { | 12603 const void* cmd_data) { |
| 12583 const gles2::cmds::WaitSyncTokenCHROMIUM& c = | 12604 const gles2::cmds::WaitSyncTokenCHROMIUM& c = |
| 12584 *static_cast<const gles2::cmds::WaitSyncTokenCHROMIUM*>(cmd_data); | 12605 *static_cast<const gles2::cmds::WaitSyncTokenCHROMIUM*>(cmd_data); |
| 12585 | 12606 |
| 12586 const gpu::CommandBufferNamespace kMinNamespaceId = | 12607 const gpu::CommandBufferNamespace kMinNamespaceId = |
| 12587 gpu::CommandBufferNamespace::INVALID; | 12608 gpu::CommandBufferNamespace::INVALID; |
| 12588 const gpu::CommandBufferNamespace kMaxNamespaceId = | 12609 const gpu::CommandBufferNamespace kMaxNamespaceId = |
| 12589 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; | 12610 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; |
| 12590 | 12611 |
| 12591 const gpu::CommandBufferNamespace namespace_id = | 12612 const gpu::CommandBufferNamespace namespace_id = |
| 12592 ((c.namespace_id >= static_cast<int32_t>(kMinNamespaceId)) && | 12613 ((c.namespace_id >= static_cast<int32_t>(kMinNamespaceId)) && |
| 12593 (c.namespace_id < static_cast<int32_t>(kMaxNamespaceId))) | 12614 (c.namespace_id < static_cast<int32_t>(kMaxNamespaceId))) |
| 12594 ? static_cast<gpu::CommandBufferNamespace>(c.namespace_id) | 12615 ? static_cast<gpu::CommandBufferNamespace>(c.namespace_id) |
| 12595 : gpu::CommandBufferNamespace::INVALID; | 12616 : gpu::CommandBufferNamespace::INVALID; |
| 12596 const uint64_t command_buffer_id = c.command_buffer_id(); | 12617 const uint64_t command_buffer_id = c.command_buffer_id(); |
| 12597 const uint64_t release = c.release_count(); | 12618 const uint64_t release = c.release_count(); |
| 12598 if (wait_fence_sync_callback_.is_null()) | 12619 if (wait_fence_sync_callback_.is_null()) |
| 12599 return error::kNoError; | 12620 return error::kNoError; |
| 12600 | 12621 |
| 12601 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release) | 12622 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release) |
| 12602 ? error::kNoError | 12623 ? error::kNoError |
| 12603 : error::kDeferCommandUntilLater; | 12624 : error::kDeferCommandUntilLater; |
| 12604 } | 12625 } |
| 12605 | 12626 |
| 12606 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( | 12627 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( |
| 12607 uint32 immediate_data_size, | 12628 uint32_t immediate_data_size, |
| 12608 const void* cmd_data) { | 12629 const void* cmd_data) { |
| 12609 if (surface_->DeferDraws()) | 12630 if (surface_->DeferDraws()) |
| 12610 return error::kDeferCommandUntilLater; | 12631 return error::kDeferCommandUntilLater; |
| 12611 if (!surface_->SetBackbufferAllocation(false)) | 12632 if (!surface_->SetBackbufferAllocation(false)) |
| 12612 return error::kLostContext; | 12633 return error::kLostContext; |
| 12613 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; | 12634 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; |
| 12614 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; | 12635 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; |
| 12615 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; | 12636 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; |
| 12616 return error::kNoError; | 12637 return error::kNoError; |
| 12617 } | 12638 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12674 bool GLES2DecoderImpl::HasMoreIdleWork() const { | 12695 bool GLES2DecoderImpl::HasMoreIdleWork() const { |
| 12675 return !pending_readpixel_fences_.empty() || | 12696 return !pending_readpixel_fences_.empty() || |
| 12676 gpu_tracer_->HasTracesToProcess(); | 12697 gpu_tracer_->HasTracesToProcess(); |
| 12677 } | 12698 } |
| 12678 | 12699 |
| 12679 void GLES2DecoderImpl::PerformIdleWork() { | 12700 void GLES2DecoderImpl::PerformIdleWork() { |
| 12680 gpu_tracer_->ProcessTraces(); | 12701 gpu_tracer_->ProcessTraces(); |
| 12681 ProcessPendingReadPixels(false); | 12702 ProcessPendingReadPixels(false); |
| 12682 } | 12703 } |
| 12683 | 12704 |
| 12684 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32 immediate_data_size, | 12705 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32_t immediate_data_size, |
| 12685 const void* cmd_data) { | 12706 const void* cmd_data) { |
| 12686 const gles2::cmds::BeginQueryEXT& c = | 12707 const gles2::cmds::BeginQueryEXT& c = |
| 12687 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); | 12708 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); |
| 12688 GLenum target = static_cast<GLenum>(c.target); | 12709 GLenum target = static_cast<GLenum>(c.target); |
| 12689 GLuint client_id = static_cast<GLuint>(c.id); | 12710 GLuint client_id = static_cast<GLuint>(c.id); |
| 12690 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 12711 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); |
| 12691 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 12712 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset); |
| 12692 | 12713 |
| 12693 switch (target) { | 12714 switch (target) { |
| 12694 case GL_COMMANDS_ISSUED_CHROMIUM: | 12715 case GL_COMMANDS_ISSUED_CHROMIUM: |
| 12695 case GL_LATENCY_QUERY_CHROMIUM: | 12716 case GL_LATENCY_QUERY_CHROMIUM: |
| 12696 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: | 12717 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: |
| 12697 case GL_GET_ERROR_QUERY_CHROMIUM: | 12718 case GL_GET_ERROR_QUERY_CHROMIUM: |
| 12698 break; | 12719 break; |
| 12699 case GL_COMMANDS_COMPLETED_CHROMIUM: | 12720 case GL_COMMANDS_COMPLETED_CHROMIUM: |
| 12700 if (!features().chromium_sync_query) { | 12721 if (!features().chromium_sync_query) { |
| 12701 LOCAL_SET_GL_ERROR( | 12722 LOCAL_SET_GL_ERROR( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12767 return error::kInvalidArguments; | 12788 return error::kInvalidArguments; |
| 12768 } | 12789 } |
| 12769 | 12790 |
| 12770 if (!query_manager_->BeginQuery(query)) { | 12791 if (!query_manager_->BeginQuery(query)) { |
| 12771 return error::kOutOfBounds; | 12792 return error::kOutOfBounds; |
| 12772 } | 12793 } |
| 12773 | 12794 |
| 12774 return error::kNoError; | 12795 return error::kNoError; |
| 12775 } | 12796 } |
| 12776 | 12797 |
| 12777 error::Error GLES2DecoderImpl::HandleEndQueryEXT(uint32 immediate_data_size, | 12798 error::Error GLES2DecoderImpl::HandleEndQueryEXT(uint32_t immediate_data_size, |
| 12778 const void* cmd_data) { | 12799 const void* cmd_data) { |
| 12779 const gles2::cmds::EndQueryEXT& c = | 12800 const gles2::cmds::EndQueryEXT& c = |
| 12780 *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); | 12801 *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); |
| 12781 GLenum target = static_cast<GLenum>(c.target); | 12802 GLenum target = static_cast<GLenum>(c.target); |
| 12782 uint32 submit_count = static_cast<GLuint>(c.submit_count); | 12803 uint32_t submit_count = static_cast<GLuint>(c.submit_count); |
| 12783 | 12804 |
| 12784 QueryManager::Query* query = query_manager_->GetActiveQuery(target); | 12805 QueryManager::Query* query = query_manager_->GetActiveQuery(target); |
| 12785 if (!query) { | 12806 if (!query) { |
| 12786 LOCAL_SET_GL_ERROR( | 12807 LOCAL_SET_GL_ERROR( |
| 12787 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); | 12808 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); |
| 12788 return error::kNoError; | 12809 return error::kNoError; |
| 12789 } | 12810 } |
| 12790 | 12811 |
| 12791 if (!query_manager_->EndQuery(query, submit_count)) { | 12812 if (!query_manager_->EndQuery(query, submit_count)) { |
| 12792 return error::kOutOfBounds; | 12813 return error::kOutOfBounds; |
| 12793 } | 12814 } |
| 12794 | 12815 |
| 12795 query_manager_->ProcessPendingTransferQueries(); | 12816 query_manager_->ProcessPendingTransferQueries(); |
| 12796 | 12817 |
| 12797 return error::kNoError; | 12818 return error::kNoError; |
| 12798 } | 12819 } |
| 12799 | 12820 |
| 12800 error::Error GLES2DecoderImpl::HandleQueryCounterEXT(uint32 immediate_data_size, | 12821 error::Error GLES2DecoderImpl::HandleQueryCounterEXT( |
| 12801 const void* cmd_data) { | 12822 uint32_t immediate_data_size, |
| 12823 const void* cmd_data) { |
| 12802 const gles2::cmds::QueryCounterEXT& c = | 12824 const gles2::cmds::QueryCounterEXT& c = |
| 12803 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data); | 12825 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data); |
| 12804 GLuint client_id = static_cast<GLuint>(c.id); | 12826 GLuint client_id = static_cast<GLuint>(c.id); |
| 12805 GLenum target = static_cast<GLenum>(c.target); | 12827 GLenum target = static_cast<GLenum>(c.target); |
| 12806 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 12828 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); |
| 12807 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 12829 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset); |
| 12808 uint32 submit_count = static_cast<GLuint>(c.submit_count); | 12830 uint32_t submit_count = static_cast<GLuint>(c.submit_count); |
| 12809 | 12831 |
| 12810 switch (target) { | 12832 switch (target) { |
| 12811 case GL_TIMESTAMP: | 12833 case GL_TIMESTAMP: |
| 12812 if (!query_manager_->GPUTimingAvailable()) { | 12834 if (!query_manager_->GPUTimingAvailable()) { |
| 12813 LOCAL_SET_GL_ERROR( | 12835 LOCAL_SET_GL_ERROR( |
| 12814 GL_INVALID_OPERATION, "glQueryCounterEXT", | 12836 GL_INVALID_OPERATION, "glQueryCounterEXT", |
| 12815 "not enabled for timing queries"); | 12837 "not enabled for timing queries"); |
| 12816 return error::kNoError; | 12838 return error::kNoError; |
| 12817 } | 12839 } |
| 12818 break; | 12840 break; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 12835 target, client_id, sync_shm_id, sync_shm_offset); | 12857 target, client_id, sync_shm_id, sync_shm_offset); |
| 12836 } | 12858 } |
| 12837 if (!query_manager_->QueryCounter(query, submit_count)) { | 12859 if (!query_manager_->QueryCounter(query, submit_count)) { |
| 12838 return error::kOutOfBounds; | 12860 return error::kOutOfBounds; |
| 12839 } | 12861 } |
| 12840 | 12862 |
| 12841 return error::kNoError; | 12863 return error::kNoError; |
| 12842 } | 12864 } |
| 12843 | 12865 |
| 12844 error::Error GLES2DecoderImpl::HandleSetDisjointValueSyncCHROMIUM( | 12866 error::Error GLES2DecoderImpl::HandleSetDisjointValueSyncCHROMIUM( |
| 12845 uint32 immediate_data_size, const void* cmd_data) { | 12867 uint32_t immediate_data_size, |
| 12868 const void* cmd_data) { |
| 12846 const gles2::cmds::SetDisjointValueSyncCHROMIUM& c = | 12869 const gles2::cmds::SetDisjointValueSyncCHROMIUM& c = |
| 12847 *static_cast<const gles2::cmds::SetDisjointValueSyncCHROMIUM*>(cmd_data); | 12870 *static_cast<const gles2::cmds::SetDisjointValueSyncCHROMIUM*>(cmd_data); |
| 12848 int32 sync_shm_id = static_cast<int32>(c.sync_data_shm_id); | 12871 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); |
| 12849 uint32 sync_shm_offset = static_cast<uint32>(c.sync_data_shm_offset); | 12872 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset); |
| 12850 | 12873 |
| 12851 query_manager_->SetDisjointSync(sync_shm_id, sync_shm_offset); | 12874 query_manager_->SetDisjointSync(sync_shm_id, sync_shm_offset); |
| 12852 return error::kNoError; | 12875 return error::kNoError; |
| 12853 } | 12876 } |
| 12854 | 12877 |
| 12855 bool GLES2DecoderImpl::GenVertexArraysOESHelper( | 12878 bool GLES2DecoderImpl::GenVertexArraysOESHelper( |
| 12856 GLsizei n, const GLuint* client_ids) { | 12879 GLsizei n, const GLuint* client_ids) { |
| 12857 for (GLsizei ii = 0; ii < n; ++ii) { | 12880 for (GLsizei ii = 0; ii < n; ++ii) { |
| 12858 if (GetVertexAttribManager(client_ids[ii])) { | 12881 if (GetVertexAttribManager(client_ids[ii])) { |
| 12859 return false; | 12882 return false; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12917 } else { | 12940 } else { |
| 12918 GLuint service_id = vao->service_id(); | 12941 GLuint service_id = vao->service_id(); |
| 12919 glBindVertexArrayOES(service_id); | 12942 glBindVertexArrayOES(service_id); |
| 12920 } | 12943 } |
| 12921 } | 12944 } |
| 12922 } | 12945 } |
| 12923 | 12946 |
| 12924 // Used when OES_vertex_array_object isn't natively supported | 12947 // Used when OES_vertex_array_object isn't natively supported |
| 12925 void GLES2DecoderImpl::EmulateVertexArrayState() { | 12948 void GLES2DecoderImpl::EmulateVertexArrayState() { |
| 12926 // Setup the Vertex attribute state | 12949 // Setup the Vertex attribute state |
| 12927 for (uint32 vv = 0; vv < group_->max_vertex_attribs(); ++vv) { | 12950 for (uint32_t vv = 0; vv < group_->max_vertex_attribs(); ++vv) { |
| 12928 RestoreStateForAttrib(vv, true); | 12951 RestoreStateForAttrib(vv, true); |
| 12929 } | 12952 } |
| 12930 | 12953 |
| 12931 // Setup the element buffer | 12954 // Setup the element buffer |
| 12932 Buffer* element_array_buffer = | 12955 Buffer* element_array_buffer = |
| 12933 state_.vertex_attrib_manager->element_array_buffer(); | 12956 state_.vertex_attrib_manager->element_array_buffer(); |
| 12934 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, | 12957 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, |
| 12935 element_array_buffer ? element_array_buffer->service_id() : 0); | 12958 element_array_buffer ? element_array_buffer->service_id() : 0); |
| 12936 } | 12959 } |
| 12937 | 12960 |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13912 return; | 13935 return; |
| 13913 } | 13936 } |
| 13914 | 13937 |
| 13915 GLenum format = TextureManager::ExtractFormatFromStorageFormat( | 13938 GLenum format = TextureManager::ExtractFormatFromStorageFormat( |
| 13916 internal_format); | 13939 internal_format); |
| 13917 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); | 13940 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); |
| 13918 | 13941 |
| 13919 { | 13942 { |
| 13920 GLsizei level_width = width; | 13943 GLsizei level_width = width; |
| 13921 GLsizei level_height = height; | 13944 GLsizei level_height = height; |
| 13922 uint32 estimated_size = 0; | 13945 uint32_t estimated_size = 0; |
| 13923 for (int ii = 0; ii < levels; ++ii) { | 13946 for (int ii = 0; ii < levels; ++ii) { |
| 13924 uint32 level_size = 0; | 13947 uint32_t level_size = 0; |
| 13925 if (!GLES2Util::ComputeImageDataSizes( | 13948 if (!GLES2Util::ComputeImageDataSizes( |
| 13926 level_width, level_height, 1, format, type, state_.unpack_alignment, | 13949 level_width, level_height, 1, format, type, state_.unpack_alignment, |
| 13927 &estimated_size, NULL, NULL) || | 13950 &estimated_size, NULL, NULL) || |
| 13928 !SafeAddUint32(estimated_size, level_size, &estimated_size)) { | 13951 !SafeAddUint32(estimated_size, level_size, &estimated_size)) { |
| 13929 LOCAL_SET_GL_ERROR( | 13952 LOCAL_SET_GL_ERROR( |
| 13930 GL_OUT_OF_MEMORY, "glTexStorage2DEXT", "dimensions too large"); | 13953 GL_OUT_OF_MEMORY, "glTexStorage2DEXT", "dimensions too large"); |
| 13931 return; | 13954 return; |
| 13932 } | 13955 } |
| 13933 level_width = std::max(1, level_width >> 1); | 13956 level_width = std::max(1, level_width >> 1); |
| 13934 level_height = std::max(1, level_height >> 1); | 13957 level_height = std::max(1, level_height >> 1); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 13963 format, type, gfx::Rect()); | 13986 format, type, gfx::Rect()); |
| 13964 } | 13987 } |
| 13965 level_width = std::max(1, level_width >> 1); | 13988 level_width = std::max(1, level_width >> 1); |
| 13966 level_height = std::max(1, level_height >> 1); | 13989 level_height = std::max(1, level_height >> 1); |
| 13967 } | 13990 } |
| 13968 texture->SetImmutable(true); | 13991 texture->SetImmutable(true); |
| 13969 } | 13992 } |
| 13970 } | 13993 } |
| 13971 | 13994 |
| 13972 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( | 13995 error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM( |
| 13973 uint32 immediate_data_size, | 13996 uint32_t immediate_data_size, |
| 13974 const void* cmd_data) { | 13997 const void* cmd_data) { |
| 13975 return error::kUnknownCommand; | 13998 return error::kUnknownCommand; |
| 13976 } | 13999 } |
| 13977 | 14000 |
| 13978 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, | 14001 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, |
| 13979 const GLbyte* data) { | 14002 const GLbyte* data) { |
| 13980 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", | 14003 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", |
| 13981 "context", logger_.GetLogPrefix(), | 14004 "context", logger_.GetLogPrefix(), |
| 13982 "mailbox[0]", static_cast<unsigned char>(data[0])); | 14005 "mailbox[0]", static_cast<unsigned char>(data[0])); |
| 13983 | 14006 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14338 image->ReleaseTexImage(target); | 14361 image->ReleaseTexImage(target); |
| 14339 texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, | 14362 texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, |
| 14340 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); | 14363 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); |
| 14341 } | 14364 } |
| 14342 | 14365 |
| 14343 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr, | 14366 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr, |
| 14344 Texture::UNBOUND); | 14367 Texture::UNBOUND); |
| 14345 } | 14368 } |
| 14346 | 14369 |
| 14347 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( | 14370 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( |
| 14348 uint32 immediate_data_size, | 14371 uint32_t immediate_data_size, |
| 14349 const void* cmd_data) { | 14372 const void* cmd_data) { |
| 14350 const gles2::cmds::TraceBeginCHROMIUM& c = | 14373 const gles2::cmds::TraceBeginCHROMIUM& c = |
| 14351 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); | 14374 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); |
| 14352 Bucket* category_bucket = GetBucket(c.category_bucket_id); | 14375 Bucket* category_bucket = GetBucket(c.category_bucket_id); |
| 14353 Bucket* name_bucket = GetBucket(c.name_bucket_id); | 14376 Bucket* name_bucket = GetBucket(c.name_bucket_id); |
| 14354 if (!category_bucket || category_bucket->size() == 0 || | 14377 if (!category_bucket || category_bucket->size() == 0 || |
| 14355 !name_bucket || name_bucket->size() == 0) { | 14378 !name_bucket || name_bucket->size() == 0) { |
| 14356 return error::kInvalidArguments; | 14379 return error::kInvalidArguments; |
| 14357 } | 14380 } |
| 14358 | 14381 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14852 *out_transform_type = transform_type; | 14875 *out_transform_type = transform_type; |
| 14853 return true; | 14876 return true; |
| 14854 } | 14877 } |
| 14855 template <typename Cmd> | 14878 template <typename Cmd> |
| 14856 bool GetPathNameData(const Cmd& cmd, | 14879 bool GetPathNameData(const Cmd& cmd, |
| 14857 GLuint num_paths, | 14880 GLuint num_paths, |
| 14858 GLenum path_name_type, | 14881 GLenum path_name_type, |
| 14859 PathNameBuffer* out_buffer) { | 14882 PathNameBuffer* out_buffer) { |
| 14860 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | 14883 DCHECK(validators_->path_name_type.IsValid(path_name_type)); |
| 14861 GLuint path_base = static_cast<GLuint>(cmd.pathBase); | 14884 GLuint path_base = static_cast<GLuint>(cmd.pathBase); |
| 14862 uint32 shm_id = static_cast<uint32>(cmd.paths_shm_id); | 14885 uint32_t shm_id = static_cast<uint32_t>(cmd.paths_shm_id); |
| 14863 uint32 shm_offset = static_cast<uint32>(cmd.paths_shm_offset); | 14886 uint32_t shm_offset = static_cast<uint32_t>(cmd.paths_shm_offset); |
| 14864 if (shm_id == 0 && shm_offset == 0) { | 14887 if (shm_id == 0 && shm_offset == 0) { |
| 14865 error_ = error::kOutOfBounds; | 14888 error_ = error::kOutOfBounds; |
| 14866 return false; | 14889 return false; |
| 14867 } | 14890 } |
| 14868 switch (path_name_type) { | 14891 switch (path_name_type) { |
| 14869 case GL_BYTE: | 14892 case GL_BYTE: |
| 14870 return GetPathNameDataImpl<GLbyte>(num_paths, path_base, shm_id, | 14893 return GetPathNameDataImpl<GLbyte>(num_paths, path_base, shm_id, |
| 14871 shm_offset, out_buffer); | 14894 shm_offset, out_buffer); |
| 14872 case GL_UNSIGNED_BYTE: | 14895 case GL_UNSIGNED_BYTE: |
| 14873 return GetPathNameDataImpl<GLubyte>(num_paths, path_base, shm_id, | 14896 return GetPathNameDataImpl<GLubyte>(num_paths, path_base, shm_id, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 14893 } | 14916 } |
| 14894 template <typename Cmd> | 14917 template <typename Cmd> |
| 14895 bool GetTransforms(const Cmd& cmd, | 14918 bool GetTransforms(const Cmd& cmd, |
| 14896 GLuint num_paths, | 14919 GLuint num_paths, |
| 14897 GLenum transform_type, | 14920 GLenum transform_type, |
| 14898 const GLfloat** out_transforms) { | 14921 const GLfloat** out_transforms) { |
| 14899 if (transform_type == GL_NONE) { | 14922 if (transform_type == GL_NONE) { |
| 14900 *out_transforms = nullptr; | 14923 *out_transforms = nullptr; |
| 14901 return true; | 14924 return true; |
| 14902 } | 14925 } |
| 14903 uint32 transforms_shm_id = static_cast<uint32>(cmd.transformValues_shm_id); | 14926 uint32_t transforms_shm_id = |
| 14904 uint32 transforms_shm_offset = | 14927 static_cast<uint32_t>(cmd.transformValues_shm_id); |
| 14905 static_cast<uint32>(cmd.transformValues_shm_offset); | 14928 uint32_t transforms_shm_offset = |
| 14906 uint32 transforms_component_count = | 14929 static_cast<uint32_t>(cmd.transformValues_shm_offset); |
| 14930 uint32_t transforms_component_count = |
| 14907 GLES2Util::GetComponentCountForGLTransformType(transform_type); | 14931 GLES2Util::GetComponentCountForGLTransformType(transform_type); |
| 14908 // Below multiplication will not overflow. | 14932 // Below multiplication will not overflow. |
| 14909 DCHECK(transforms_component_count <= 12); | 14933 DCHECK(transforms_component_count <= 12); |
| 14910 uint32 one_transform_size = sizeof(GLfloat) * transforms_component_count; | 14934 uint32_t one_transform_size = sizeof(GLfloat) * transforms_component_count; |
| 14911 uint32 transforms_size = 0; | 14935 uint32_t transforms_size = 0; |
| 14912 if (!SafeMultiplyUint32(one_transform_size, num_paths, &transforms_size)) { | 14936 if (!SafeMultiplyUint32(one_transform_size, num_paths, &transforms_size)) { |
| 14913 error_ = error::kOutOfBounds; | 14937 error_ = error::kOutOfBounds; |
| 14914 return false; | 14938 return false; |
| 14915 } | 14939 } |
| 14916 const GLfloat* transforms = nullptr; | 14940 const GLfloat* transforms = nullptr; |
| 14917 if (transforms_shm_id != 0 || transforms_shm_offset != 0) | 14941 if (transforms_shm_id != 0 || transforms_shm_offset != 0) |
| 14918 transforms = decoder_->GetSharedMemoryAs<const GLfloat*>( | 14942 transforms = decoder_->GetSharedMemoryAs<const GLfloat*>( |
| 14919 transforms_shm_id, transforms_shm_offset, transforms_size); | 14943 transforms_shm_id, transforms_shm_offset, transforms_size); |
| 14920 if (!transforms) { | 14944 if (!transforms) { |
| 14921 error_ = error::kOutOfBounds; | 14945 error_ = error::kOutOfBounds; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 14933 return false; | 14957 return false; |
| 14934 } | 14958 } |
| 14935 *out_cover_mode = cover_mode; | 14959 *out_cover_mode = cover_mode; |
| 14936 return true; | 14960 return true; |
| 14937 } | 14961 } |
| 14938 | 14962 |
| 14939 private: | 14963 private: |
| 14940 template <typename T> | 14964 template <typename T> |
| 14941 bool GetPathNameDataImpl(GLuint num_paths, | 14965 bool GetPathNameDataImpl(GLuint num_paths, |
| 14942 GLuint path_base, | 14966 GLuint path_base, |
| 14943 uint32 shm_id, | 14967 uint32_t shm_id, |
| 14944 uint32 shm_offset, | 14968 uint32_t shm_offset, |
| 14945 PathNameBuffer* out_buffer) { | 14969 PathNameBuffer* out_buffer) { |
| 14946 uint32 paths_size = 0; | 14970 uint32_t paths_size = 0; |
| 14947 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { | 14971 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { |
| 14948 error_ = error::kOutOfBounds; | 14972 error_ = error::kOutOfBounds; |
| 14949 return false; | 14973 return false; |
| 14950 } | 14974 } |
| 14951 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); | 14975 T* paths = decoder_->GetSharedMemoryAs<T*>(shm_id, shm_offset, paths_size); |
| 14952 if (!paths) { | 14976 if (!paths) { |
| 14953 error_ = error::kOutOfBounds; | 14977 error_ = error::kOutOfBounds; |
| 14954 return false; | 14978 return false; |
| 14955 } | 14979 } |
| 14956 GLuint* result_paths = out_buffer->AllocateOrAdopt(num_paths, paths); | 14980 GLuint* result_paths = out_buffer->AllocateOrAdopt(num_paths, paths); |
| 14957 bool has_paths = false; | 14981 bool has_paths = false; |
| 14958 for (GLuint i = 0; i < num_paths; ++i) { | 14982 for (GLuint i = 0; i < num_paths; ++i) { |
| 14959 GLuint service_id = 0; | 14983 GLuint service_id = 0; |
| 14960 // The below addition is ok even with over- and underflows. | 14984 // The below addition is ok even with over- and underflows. |
| 14961 // There is no difference if client passes: | 14985 // There is no difference if client passes: |
| 14962 // * base==4, T=GLbyte, paths[0]==0xfa (-6) | 14986 // * base==4, T=GLbyte, paths[0]==0xfa (-6) |
| 14963 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff | 14987 // * base==0xffffffff, T=GLuint, paths[0]==0xffffffff |
| 14964 // * base==0, T=GLuint, paths[0]==0xfffffffe | 14988 // * base==0, T=GLuint, paths[0]==0xfffffffe |
| 14965 // For the all the cases, the interpretation is that | 14989 // For the all the cases, the interpretation is that |
| 14966 // client intends to use the path 0xfffffffe. | 14990 // client intends to use the path 0xfffffffe. |
| 14967 // The client_id verification is only done after the addition. | 14991 // The client_id verification is only done after the addition. |
| 14968 uint32 client_id = path_base + paths[i]; | 14992 uint32_t client_id = path_base + paths[i]; |
| 14969 if (decoder_->path_manager()->GetPath(client_id, &service_id)) | 14993 if (decoder_->path_manager()->GetPath(client_id, &service_id)) |
| 14970 has_paths = true; | 14994 has_paths = true; |
| 14971 // Will use path 0 if the path is not found. This is in line | 14995 // Will use path 0 if the path is not found. This is in line |
| 14972 // of the spec: missing paths will produce nothing, let | 14996 // of the spec: missing paths will produce nothing, let |
| 14973 // the instanced draw continue. | 14997 // the instanced draw continue. |
| 14974 result_paths[i] = service_id; | 14998 result_paths[i] = service_id; |
| 14975 } | 14999 } |
| 14976 return has_paths; | 15000 return has_paths; |
| 14977 } | 15001 } |
| 14978 GLES2DecoderImpl* decoder_; | 15002 GLES2DecoderImpl* decoder_; |
| 14979 ErrorState* error_state_; | 15003 ErrorState* error_state_; |
| 14980 const Validators* validators_; | 15004 const Validators* validators_; |
| 14981 const char* function_name_; | 15005 const char* function_name_; |
| 14982 error::Error error_; | 15006 error::Error error_; |
| 14983 }; | 15007 }; |
| 14984 | 15008 |
| 14985 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM( | 15009 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM( |
| 14986 uint32 immediate_data_size, | 15010 uint32_t immediate_data_size, |
| 14987 const void* cmd_data) { | 15011 const void* cmd_data) { |
| 14988 const gles2::cmds::GenPathsCHROMIUM& c = | 15012 const gles2::cmds::GenPathsCHROMIUM& c = |
| 14989 *static_cast<const gles2::cmds::GenPathsCHROMIUM*>(cmd_data); | 15013 *static_cast<const gles2::cmds::GenPathsCHROMIUM*>(cmd_data); |
| 14990 if (!features().chromium_path_rendering) | 15014 if (!features().chromium_path_rendering) |
| 14991 return error::kUnknownCommand; | 15015 return error::kUnknownCommand; |
| 14992 | 15016 |
| 14993 PathCommandValidatorContext v(this, "glGenPathsCHROMIUM"); | 15017 PathCommandValidatorContext v(this, "glGenPathsCHROMIUM"); |
| 14994 GLsizei range = 0; | 15018 GLsizei range = 0; |
| 14995 if (!v.GetPathRange(c, &range)) | 15019 if (!v.GetPathRange(c, &range)) |
| 14996 return v.error(); | 15020 return v.error(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 15026 GLuint first_client_id = c.first_client_id; | 15050 GLuint first_client_id = c.first_client_id; |
| 15027 // first_client_id can be 0, because non-existing path ids are skipped. | 15051 // first_client_id can be 0, because non-existing path ids are skipped. |
| 15028 | 15052 |
| 15029 if (!DeletePathsCHROMIUMHelper(first_client_id, range)) | 15053 if (!DeletePathsCHROMIUMHelper(first_client_id, range)) |
| 15030 return error::kInvalidArguments; | 15054 return error::kInvalidArguments; |
| 15031 | 15055 |
| 15032 return error::kNoError; | 15056 return error::kNoError; |
| 15033 } | 15057 } |
| 15034 | 15058 |
| 15035 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM( | 15059 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM( |
| 15036 uint32 immediate_data_size, | 15060 uint32_t immediate_data_size, |
| 15037 const void* cmd_data) { | 15061 const void* cmd_data) { |
| 15038 static const char kFunctionName[] = "glPathCommandsCHROMIUM"; | 15062 static const char kFunctionName[] = "glPathCommandsCHROMIUM"; |
| 15039 const gles2::cmds::PathCommandsCHROMIUM& c = | 15063 const gles2::cmds::PathCommandsCHROMIUM& c = |
| 15040 *static_cast<const gles2::cmds::PathCommandsCHROMIUM*>(cmd_data); | 15064 *static_cast<const gles2::cmds::PathCommandsCHROMIUM*>(cmd_data); |
| 15041 if (!features().chromium_path_rendering) | 15065 if (!features().chromium_path_rendering) |
| 15042 return error::kUnknownCommand; | 15066 return error::kUnknownCommand; |
| 15043 | 15067 |
| 15044 GLuint service_id = 0; | 15068 GLuint service_id = 0; |
| 15045 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { | 15069 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { |
| 15046 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 15070 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 15047 "invalid path name"); | 15071 "invalid path name"); |
| 15048 return error::kNoError; | 15072 return error::kNoError; |
| 15049 } | 15073 } |
| 15050 | 15074 |
| 15051 GLsizei num_commands = static_cast<GLsizei>(c.numCommands); | 15075 GLsizei num_commands = static_cast<GLsizei>(c.numCommands); |
| 15052 if (num_commands < 0) { | 15076 if (num_commands < 0) { |
| 15053 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCommands < 0"); | 15077 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCommands < 0"); |
| 15054 return error::kNoError; | 15078 return error::kNoError; |
| 15055 } | 15079 } |
| 15056 | 15080 |
| 15057 GLsizei num_coords = static_cast<uint32>(c.numCoords); | 15081 GLsizei num_coords = static_cast<uint32_t>(c.numCoords); |
| 15058 if (num_coords < 0) { | 15082 if (num_coords < 0) { |
| 15059 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); | 15083 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numCoords < 0"); |
| 15060 return error::kNoError; | 15084 return error::kNoError; |
| 15061 } | 15085 } |
| 15062 | 15086 |
| 15063 GLenum coord_type = static_cast<uint32>(c.coordType); | 15087 GLenum coord_type = static_cast<uint32_t>(c.coordType); |
| 15064 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { | 15088 if (!validators_->path_coord_type.IsValid(static_cast<GLint>(coord_type))) { |
| 15065 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); | 15089 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName, "invalid coordType"); |
| 15066 return error::kNoError; | 15090 return error::kNoError; |
| 15067 } | 15091 } |
| 15068 | 15092 |
| 15069 const GLubyte* commands = NULL; | 15093 const GLubyte* commands = NULL; |
| 15070 base::CheckedNumeric<GLsizei> num_coords_expected = 0; | 15094 base::CheckedNumeric<GLsizei> num_coords_expected = 0; |
| 15071 | 15095 |
| 15072 if (num_commands > 0) { | 15096 if (num_commands > 0) { |
| 15073 uint32 commands_shm_id = static_cast<uint32>(c.commands_shm_id); | 15097 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); |
| 15074 uint32 commands_shm_offset = static_cast<uint32>(c.commands_shm_offset); | 15098 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); |
| 15075 if (commands_shm_id != 0 || commands_shm_offset != 0) | 15099 if (commands_shm_id != 0 || commands_shm_offset != 0) |
| 15076 commands = GetSharedMemoryAs<const GLubyte*>( | 15100 commands = GetSharedMemoryAs<const GLubyte*>( |
| 15077 commands_shm_id, commands_shm_offset, num_commands); | 15101 commands_shm_id, commands_shm_offset, num_commands); |
| 15078 | 15102 |
| 15079 if (!commands) | 15103 if (!commands) |
| 15080 return error::kOutOfBounds; | 15104 return error::kOutOfBounds; |
| 15081 | 15105 |
| 15082 for (GLsizei i = 0; i < num_commands; ++i) { | 15106 for (GLsizei i = 0; i < num_commands; ++i) { |
| 15083 switch (commands[i]) { | 15107 switch (commands[i]) { |
| 15084 case GL_CLOSE_PATH_CHROMIUM: | 15108 case GL_CLOSE_PATH_CHROMIUM: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 15108 if (!num_coords_expected.IsValid() || | 15132 if (!num_coords_expected.IsValid() || |
| 15109 num_coords != num_coords_expected.ValueOrDie()) { | 15133 num_coords != num_coords_expected.ValueOrDie()) { |
| 15110 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 15134 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 15111 "numCoords does not match commands"); | 15135 "numCoords does not match commands"); |
| 15112 return error::kNoError; | 15136 return error::kNoError; |
| 15113 } | 15137 } |
| 15114 | 15138 |
| 15115 const void* coords = NULL; | 15139 const void* coords = NULL; |
| 15116 | 15140 |
| 15117 if (num_coords > 0) { | 15141 if (num_coords > 0) { |
| 15118 uint32 coords_size = 0; | 15142 uint32_t coords_size = 0; |
| 15119 uint32 coord_type_size = | 15143 uint32_t coord_type_size = |
| 15120 GLES2Util::GetGLTypeSizeForPathCoordType(coord_type); | 15144 GLES2Util::GetGLTypeSizeForPathCoordType(coord_type); |
| 15121 if (!SafeMultiplyUint32(num_coords, coord_type_size, &coords_size)) | 15145 if (!SafeMultiplyUint32(num_coords, coord_type_size, &coords_size)) |
| 15122 return error::kOutOfBounds; | 15146 return error::kOutOfBounds; |
| 15123 | 15147 |
| 15124 uint32 coords_shm_id = static_cast<uint32>(c.coords_shm_id); | 15148 uint32_t coords_shm_id = static_cast<uint32_t>(c.coords_shm_id); |
| 15125 uint32 coords_shm_offset = static_cast<uint32>(c.coords_shm_offset); | 15149 uint32_t coords_shm_offset = static_cast<uint32_t>(c.coords_shm_offset); |
| 15126 if (coords_shm_id != 0 || coords_shm_offset != 0) | 15150 if (coords_shm_id != 0 || coords_shm_offset != 0) |
| 15127 coords = GetSharedMemoryAs<const void*>(coords_shm_id, coords_shm_offset, | 15151 coords = GetSharedMemoryAs<const void*>(coords_shm_id, coords_shm_offset, |
| 15128 coords_size); | 15152 coords_size); |
| 15129 | 15153 |
| 15130 if (!coords) | 15154 if (!coords) |
| 15131 return error::kOutOfBounds; | 15155 return error::kOutOfBounds; |
| 15132 } | 15156 } |
| 15133 | 15157 |
| 15134 glPathCommandsNV(service_id, num_commands, commands, num_coords, coord_type, | 15158 glPathCommandsNV(service_id, num_commands, commands, num_coords, coord_type, |
| 15135 coords); | 15159 coords); |
| 15136 | 15160 |
| 15137 return error::kNoError; | 15161 return error::kNoError; |
| 15138 } | 15162 } |
| 15139 | 15163 |
| 15140 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM( | 15164 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM( |
| 15141 uint32 immediate_data_size, | 15165 uint32_t immediate_data_size, |
| 15142 const void* cmd_data) { | 15166 const void* cmd_data) { |
| 15143 static const char kFunctionName[] = "glPathParameterfCHROMIUM"; | 15167 static const char kFunctionName[] = "glPathParameterfCHROMIUM"; |
| 15144 const gles2::cmds::PathParameterfCHROMIUM& c = | 15168 const gles2::cmds::PathParameterfCHROMIUM& c = |
| 15145 *static_cast<const gles2::cmds::PathParameterfCHROMIUM*>(cmd_data); | 15169 *static_cast<const gles2::cmds::PathParameterfCHROMIUM*>(cmd_data); |
| 15146 if (!features().chromium_path_rendering) | 15170 if (!features().chromium_path_rendering) |
| 15147 return error::kUnknownCommand; | 15171 return error::kUnknownCommand; |
| 15148 | 15172 |
| 15149 GLuint service_id = 0; | 15173 GLuint service_id = 0; |
| 15150 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { | 15174 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { |
| 15151 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 15175 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15183 if (hasValueError) { | 15207 if (hasValueError) { |
| 15184 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); | 15208 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); |
| 15185 return error::kNoError; | 15209 return error::kNoError; |
| 15186 } | 15210 } |
| 15187 | 15211 |
| 15188 glPathParameterfNV(service_id, pname, value); | 15212 glPathParameterfNV(service_id, pname, value); |
| 15189 return error::kNoError; | 15213 return error::kNoError; |
| 15190 } | 15214 } |
| 15191 | 15215 |
| 15192 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM( | 15216 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM( |
| 15193 uint32 immediate_data_size, | 15217 uint32_t immediate_data_size, |
| 15194 const void* cmd_data) { | 15218 const void* cmd_data) { |
| 15195 static const char kFunctionName[] = "glPathParameteriCHROMIUM"; | 15219 static const char kFunctionName[] = "glPathParameteriCHROMIUM"; |
| 15196 const gles2::cmds::PathParameteriCHROMIUM& c = | 15220 const gles2::cmds::PathParameteriCHROMIUM& c = |
| 15197 *static_cast<const gles2::cmds::PathParameteriCHROMIUM*>(cmd_data); | 15221 *static_cast<const gles2::cmds::PathParameteriCHROMIUM*>(cmd_data); |
| 15198 if (!features().chromium_path_rendering) | 15222 if (!features().chromium_path_rendering) |
| 15199 return error::kUnknownCommand; | 15223 return error::kUnknownCommand; |
| 15200 | 15224 |
| 15201 GLuint service_id = 0; | 15225 GLuint service_id = 0; |
| 15202 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { | 15226 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { |
| 15203 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 15227 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 15233 if (hasValueError) { | 15257 if (hasValueError) { |
| 15234 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); | 15258 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); |
| 15235 return error::kNoError; | 15259 return error::kNoError; |
| 15236 } | 15260 } |
| 15237 | 15261 |
| 15238 glPathParameteriNV(service_id, pname, value); | 15262 glPathParameteriNV(service_id, pname, value); |
| 15239 return error::kNoError; | 15263 return error::kNoError; |
| 15240 } | 15264 } |
| 15241 | 15265 |
| 15242 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM( | 15266 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM( |
| 15243 uint32 immediate_data_size, | 15267 uint32_t immediate_data_size, |
| 15244 const void* cmd_data) { | 15268 const void* cmd_data) { |
| 15245 const gles2::cmds::StencilFillPathCHROMIUM& c = | 15269 const gles2::cmds::StencilFillPathCHROMIUM& c = |
| 15246 *static_cast<const gles2::cmds::StencilFillPathCHROMIUM*>(cmd_data); | 15270 *static_cast<const gles2::cmds::StencilFillPathCHROMIUM*>(cmd_data); |
| 15247 if (!features().chromium_path_rendering) | 15271 if (!features().chromium_path_rendering) |
| 15248 return error::kUnknownCommand; | 15272 return error::kUnknownCommand; |
| 15249 PathCommandValidatorContext v(this, "glStencilFillPathCHROMIUM"); | 15273 PathCommandValidatorContext v(this, "glStencilFillPathCHROMIUM"); |
| 15250 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; | 15274 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; |
| 15251 GLuint mask = 0; | 15275 GLuint mask = 0; |
| 15252 if (!v.GetFillModeAndMask(c, &fill_mode, &mask)) | 15276 if (!v.GetFillModeAndMask(c, &fill_mode, &mask)) |
| 15253 return v.error(); | 15277 return v.error(); |
| 15254 GLuint service_id = 0; | 15278 GLuint service_id = 0; |
| 15255 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { | 15279 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { |
| 15256 // "If /path/ does not name an existing path object, the command does | 15280 // "If /path/ does not name an existing path object, the command does |
| 15257 // nothing (and no error is generated)." | 15281 // nothing (and no error is generated)." |
| 15258 // This holds for other rendering functions, too. | 15282 // This holds for other rendering functions, too. |
| 15259 return error::kNoError; | 15283 return error::kNoError; |
| 15260 } | 15284 } |
| 15261 ApplyDirtyState(); | 15285 ApplyDirtyState(); |
| 15262 glStencilFillPathNV(service_id, fill_mode, mask); | 15286 glStencilFillPathNV(service_id, fill_mode, mask); |
| 15263 return error::kNoError; | 15287 return error::kNoError; |
| 15264 } | 15288 } |
| 15265 | 15289 |
| 15266 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM( | 15290 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM( |
| 15267 uint32 immediate_data_size, | 15291 uint32_t immediate_data_size, |
| 15268 const void* cmd_data) { | 15292 const void* cmd_data) { |
| 15269 const gles2::cmds::StencilStrokePathCHROMIUM& c = | 15293 const gles2::cmds::StencilStrokePathCHROMIUM& c = |
| 15270 *static_cast<const gles2::cmds::StencilStrokePathCHROMIUM*>(cmd_data); | 15294 *static_cast<const gles2::cmds::StencilStrokePathCHROMIUM*>(cmd_data); |
| 15271 if (!features().chromium_path_rendering) | 15295 if (!features().chromium_path_rendering) |
| 15272 return error::kUnknownCommand; | 15296 return error::kUnknownCommand; |
| 15273 | 15297 |
| 15274 GLuint service_id = 0; | 15298 GLuint service_id = 0; |
| 15275 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { | 15299 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { |
| 15276 return error::kNoError; | 15300 return error::kNoError; |
| 15277 } | 15301 } |
| 15278 GLint reference = static_cast<GLint>(c.reference); | 15302 GLint reference = static_cast<GLint>(c.reference); |
| 15279 GLuint mask = static_cast<GLuint>(c.mask); | 15303 GLuint mask = static_cast<GLuint>(c.mask); |
| 15280 ApplyDirtyState(); | 15304 ApplyDirtyState(); |
| 15281 glStencilStrokePathNV(service_id, reference, mask); | 15305 glStencilStrokePathNV(service_id, reference, mask); |
| 15282 return error::kNoError; | 15306 return error::kNoError; |
| 15283 } | 15307 } |
| 15284 | 15308 |
| 15285 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM( | 15309 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM( |
| 15286 uint32 immediate_data_size, | 15310 uint32_t immediate_data_size, |
| 15287 const void* cmd_data) { | 15311 const void* cmd_data) { |
| 15288 const gles2::cmds::CoverFillPathCHROMIUM& c = | 15312 const gles2::cmds::CoverFillPathCHROMIUM& c = |
| 15289 *static_cast<const gles2::cmds::CoverFillPathCHROMIUM*>(cmd_data); | 15313 *static_cast<const gles2::cmds::CoverFillPathCHROMIUM*>(cmd_data); |
| 15290 if (!features().chromium_path_rendering) | 15314 if (!features().chromium_path_rendering) |
| 15291 return error::kUnknownCommand; | 15315 return error::kUnknownCommand; |
| 15292 | 15316 |
| 15293 PathCommandValidatorContext v(this, "glCoverFillPathCHROMIUM"); | 15317 PathCommandValidatorContext v(this, "glCoverFillPathCHROMIUM"); |
| 15294 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; | 15318 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; |
| 15295 if (!v.GetCoverMode(c, &cover_mode)) | 15319 if (!v.GetCoverMode(c, &cover_mode)) |
| 15296 return v.error(); | 15320 return v.error(); |
| 15297 | 15321 |
| 15298 GLuint service_id = 0; | 15322 GLuint service_id = 0; |
| 15299 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) | 15323 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) |
| 15300 return error::kNoError; | 15324 return error::kNoError; |
| 15301 | 15325 |
| 15302 ApplyDirtyState(); | 15326 ApplyDirtyState(); |
| 15303 glCoverFillPathNV(service_id, cover_mode); | 15327 glCoverFillPathNV(service_id, cover_mode); |
| 15304 return error::kNoError; | 15328 return error::kNoError; |
| 15305 } | 15329 } |
| 15306 | 15330 |
| 15307 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM( | 15331 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM( |
| 15308 uint32 immediate_data_size, | 15332 uint32_t immediate_data_size, |
| 15309 const void* cmd_data) { | 15333 const void* cmd_data) { |
| 15310 const gles2::cmds::CoverStrokePathCHROMIUM& c = | 15334 const gles2::cmds::CoverStrokePathCHROMIUM& c = |
| 15311 *static_cast<const gles2::cmds::CoverStrokePathCHROMIUM*>(cmd_data); | 15335 *static_cast<const gles2::cmds::CoverStrokePathCHROMIUM*>(cmd_data); |
| 15312 if (!features().chromium_path_rendering) | 15336 if (!features().chromium_path_rendering) |
| 15313 return error::kUnknownCommand; | 15337 return error::kUnknownCommand; |
| 15314 | 15338 |
| 15315 PathCommandValidatorContext v(this, "glCoverStrokePathCHROMIUM"); | 15339 PathCommandValidatorContext v(this, "glCoverStrokePathCHROMIUM"); |
| 15316 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; | 15340 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; |
| 15317 if (!v.GetCoverMode(c, &cover_mode)) | 15341 if (!v.GetCoverMode(c, &cover_mode)) |
| 15318 return v.error(); | 15342 return v.error(); |
| 15319 | 15343 |
| 15320 GLuint service_id = 0; | 15344 GLuint service_id = 0; |
| 15321 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) | 15345 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) |
| 15322 return error::kNoError; | 15346 return error::kNoError; |
| 15323 | 15347 |
| 15324 ApplyDirtyState(); | 15348 ApplyDirtyState(); |
| 15325 glCoverStrokePathNV(service_id, cover_mode); | 15349 glCoverStrokePathNV(service_id, cover_mode); |
| 15326 return error::kNoError; | 15350 return error::kNoError; |
| 15327 } | 15351 } |
| 15328 | 15352 |
| 15329 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathCHROMIUM( | 15353 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathCHROMIUM( |
| 15330 uint32 immediate_data_size, | 15354 uint32_t immediate_data_size, |
| 15331 const void* cmd_data) { | 15355 const void* cmd_data) { |
| 15332 const gles2::cmds::StencilThenCoverFillPathCHROMIUM& c = | 15356 const gles2::cmds::StencilThenCoverFillPathCHROMIUM& c = |
| 15333 *static_cast<const gles2::cmds::StencilThenCoverFillPathCHROMIUM*>( | 15357 *static_cast<const gles2::cmds::StencilThenCoverFillPathCHROMIUM*>( |
| 15334 cmd_data); | 15358 cmd_data); |
| 15335 if (!features().chromium_path_rendering) | 15359 if (!features().chromium_path_rendering) |
| 15336 return error::kUnknownCommand; | 15360 return error::kUnknownCommand; |
| 15337 | 15361 |
| 15338 PathCommandValidatorContext v(this, "glStencilThenCoverFillPathCHROMIUM"); | 15362 PathCommandValidatorContext v(this, "glStencilThenCoverFillPathCHROMIUM"); |
| 15339 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; | 15363 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; |
| 15340 GLuint mask = 0; | 15364 GLuint mask = 0; |
| 15341 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; | 15365 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; |
| 15342 if (!v.GetFillModeAndMask(c, &fill_mode, &mask) || | 15366 if (!v.GetFillModeAndMask(c, &fill_mode, &mask) || |
| 15343 !v.GetCoverMode(c, &cover_mode)) | 15367 !v.GetCoverMode(c, &cover_mode)) |
| 15344 return v.error(); | 15368 return v.error(); |
| 15345 | 15369 |
| 15346 GLuint service_id = 0; | 15370 GLuint service_id = 0; |
| 15347 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) | 15371 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) |
| 15348 return error::kNoError; | 15372 return error::kNoError; |
| 15349 | 15373 |
| 15350 ApplyDirtyState(); | 15374 ApplyDirtyState(); |
| 15351 glStencilThenCoverFillPathNV(service_id, fill_mode, mask, cover_mode); | 15375 glStencilThenCoverFillPathNV(service_id, fill_mode, mask, cover_mode); |
| 15352 return error::kNoError; | 15376 return error::kNoError; |
| 15353 } | 15377 } |
| 15354 | 15378 |
| 15355 error::Error GLES2DecoderImpl::HandleStencilThenCoverStrokePathCHROMIUM( | 15379 error::Error GLES2DecoderImpl::HandleStencilThenCoverStrokePathCHROMIUM( |
| 15356 uint32 immediate_data_size, | 15380 uint32_t immediate_data_size, |
| 15357 const void* cmd_data) { | 15381 const void* cmd_data) { |
| 15358 const gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c = | 15382 const gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c = |
| 15359 *static_cast<const gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>( | 15383 *static_cast<const gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>( |
| 15360 cmd_data); | 15384 cmd_data); |
| 15361 if (!features().chromium_path_rendering) | 15385 if (!features().chromium_path_rendering) |
| 15362 return error::kUnknownCommand; | 15386 return error::kUnknownCommand; |
| 15363 | 15387 |
| 15364 PathCommandValidatorContext v(this, "glStencilThenCoverStrokePathCHROMIUM"); | 15388 PathCommandValidatorContext v(this, "glStencilThenCoverStrokePathCHROMIUM"); |
| 15365 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; | 15389 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; |
| 15366 if (!v.GetCoverMode(c, &cover_mode)) | 15390 if (!v.GetCoverMode(c, &cover_mode)) |
| 15367 return v.error(); | 15391 return v.error(); |
| 15368 | 15392 |
| 15369 GLuint service_id = 0; | 15393 GLuint service_id = 0; |
| 15370 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) | 15394 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) |
| 15371 return error::kNoError; | 15395 return error::kNoError; |
| 15372 | 15396 |
| 15373 GLint reference = static_cast<GLint>(c.reference); | 15397 GLint reference = static_cast<GLint>(c.reference); |
| 15374 GLuint mask = static_cast<GLuint>(c.mask); | 15398 GLuint mask = static_cast<GLuint>(c.mask); |
| 15375 ApplyDirtyState(); | 15399 ApplyDirtyState(); |
| 15376 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode); | 15400 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode); |
| 15377 return error::kNoError; | 15401 return error::kNoError; |
| 15378 } | 15402 } |
| 15379 | 15403 |
| 15380 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM( | 15404 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM( |
| 15381 uint32 immediate_data_size, | 15405 uint32_t immediate_data_size, |
| 15382 const void* cmd_data) { | 15406 const void* cmd_data) { |
| 15383 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c = | 15407 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c = |
| 15384 *static_cast<const gles2::cmds::StencilFillPathInstancedCHROMIUM*>( | 15408 *static_cast<const gles2::cmds::StencilFillPathInstancedCHROMIUM*>( |
| 15385 cmd_data); | 15409 cmd_data); |
| 15386 if (!features().chromium_path_rendering) | 15410 if (!features().chromium_path_rendering) |
| 15387 return error::kUnknownCommand; | 15411 return error::kUnknownCommand; |
| 15388 | 15412 |
| 15389 PathCommandValidatorContext v(this, "glStencilFillPathInstancedCHROMIUM"); | 15413 PathCommandValidatorContext v(this, "glStencilFillPathInstancedCHROMIUM"); |
| 15390 GLuint num_paths = 0; | 15414 GLuint num_paths = 0; |
| 15391 GLenum path_name_type = GL_NONE; | 15415 GLenum path_name_type = GL_NONE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 15408 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15432 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
| 15409 return v.error(); | 15433 return v.error(); |
| 15410 | 15434 |
| 15411 ApplyDirtyState(); | 15435 ApplyDirtyState(); |
| 15412 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), | 15436 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), |
| 15413 0, fill_mode, mask, transform_type, transforms); | 15437 0, fill_mode, mask, transform_type, transforms); |
| 15414 return error::kNoError; | 15438 return error::kNoError; |
| 15415 } | 15439 } |
| 15416 | 15440 |
| 15417 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM( | 15441 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM( |
| 15418 uint32 immediate_data_size, | 15442 uint32_t immediate_data_size, |
| 15419 const void* cmd_data) { | 15443 const void* cmd_data) { |
| 15420 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c = | 15444 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c = |
| 15421 *static_cast<const gles2::cmds::StencilStrokePathInstancedCHROMIUM*>( | 15445 *static_cast<const gles2::cmds::StencilStrokePathInstancedCHROMIUM*>( |
| 15422 cmd_data); | 15446 cmd_data); |
| 15423 if (!features().chromium_path_rendering) | 15447 if (!features().chromium_path_rendering) |
| 15424 return error::kUnknownCommand; | 15448 return error::kUnknownCommand; |
| 15425 | 15449 |
| 15426 PathCommandValidatorContext v(this, "glStencilStrokePathInstancedCHROMIUM"); | 15450 PathCommandValidatorContext v(this, "glStencilStrokePathInstancedCHROMIUM"); |
| 15427 GLuint num_paths = 0; | 15451 GLuint num_paths = 0; |
| 15428 GLenum path_name_type = GL_NONE; | 15452 GLenum path_name_type = GL_NONE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 15445 GLint reference = static_cast<GLint>(c.reference); | 15469 GLint reference = static_cast<GLint>(c.reference); |
| 15446 GLuint mask = static_cast<GLuint>(c.mask); | 15470 GLuint mask = static_cast<GLuint>(c.mask); |
| 15447 ApplyDirtyState(); | 15471 ApplyDirtyState(); |
| 15448 glStencilStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), | 15472 glStencilStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), |
| 15449 0, reference, mask, transform_type, | 15473 0, reference, mask, transform_type, |
| 15450 transforms); | 15474 transforms); |
| 15451 return error::kNoError; | 15475 return error::kNoError; |
| 15452 } | 15476 } |
| 15453 | 15477 |
| 15454 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM( | 15478 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM( |
| 15455 uint32 immediate_data_size, | 15479 uint32_t immediate_data_size, |
| 15456 const void* cmd_data) { | 15480 const void* cmd_data) { |
| 15457 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c = | 15481 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c = |
| 15458 *static_cast<const gles2::cmds::CoverFillPathInstancedCHROMIUM*>( | 15482 *static_cast<const gles2::cmds::CoverFillPathInstancedCHROMIUM*>( |
| 15459 cmd_data); | 15483 cmd_data); |
| 15460 if (!features().chromium_path_rendering) | 15484 if (!features().chromium_path_rendering) |
| 15461 return error::kUnknownCommand; | 15485 return error::kUnknownCommand; |
| 15462 | 15486 |
| 15463 PathCommandValidatorContext v(this, "glCoverFillPathInstancedCHROMIUM"); | 15487 PathCommandValidatorContext v(this, "glCoverFillPathInstancedCHROMIUM"); |
| 15464 GLuint num_paths = 0; | 15488 GLuint num_paths = 0; |
| 15465 GLenum path_name_type = GL_NONE; | 15489 GLenum path_name_type = GL_NONE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 15481 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15505 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
| 15482 return v.error(); | 15506 return v.error(); |
| 15483 | 15507 |
| 15484 ApplyDirtyState(); | 15508 ApplyDirtyState(); |
| 15485 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), 0, | 15509 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), 0, |
| 15486 cover_mode, transform_type, transforms); | 15510 cover_mode, transform_type, transforms); |
| 15487 return error::kNoError; | 15511 return error::kNoError; |
| 15488 } | 15512 } |
| 15489 | 15513 |
| 15490 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM( | 15514 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM( |
| 15491 uint32 immediate_data_size, | 15515 uint32_t immediate_data_size, |
| 15492 const void* cmd_data) { | 15516 const void* cmd_data) { |
| 15493 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c = | 15517 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c = |
| 15494 *static_cast<const gles2::cmds::CoverStrokePathInstancedCHROMIUM*>( | 15518 *static_cast<const gles2::cmds::CoverStrokePathInstancedCHROMIUM*>( |
| 15495 cmd_data); | 15519 cmd_data); |
| 15496 if (!features().chromium_path_rendering) | 15520 if (!features().chromium_path_rendering) |
| 15497 return error::kUnknownCommand; | 15521 return error::kUnknownCommand; |
| 15498 | 15522 |
| 15499 PathCommandValidatorContext v(this, "glCoverStrokePathInstancedCHROMIUM"); | 15523 PathCommandValidatorContext v(this, "glCoverStrokePathInstancedCHROMIUM"); |
| 15500 GLuint num_paths = 0; | 15524 GLuint num_paths = 0; |
| 15501 GLenum path_name_type = GL_NONE; | 15525 GLenum path_name_type = GL_NONE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 15517 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) | 15541 if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) |
| 15518 return v.error(); | 15542 return v.error(); |
| 15519 | 15543 |
| 15520 ApplyDirtyState(); | 15544 ApplyDirtyState(); |
| 15521 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), | 15545 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.path_names(), |
| 15522 0, cover_mode, transform_type, transforms); | 15546 0, cover_mode, transform_type, transforms); |
| 15523 return error::kNoError; | 15547 return error::kNoError; |
| 15524 } | 15548 } |
| 15525 | 15549 |
| 15526 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM( | 15550 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM( |
| 15527 uint32 immediate_data_size, | 15551 uint32_t immediate_data_size, |
| 15528 const void* cmd_data) { | 15552 const void* cmd_data) { |
| 15529 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c = | 15553 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c = |
| 15530 *static_cast< | 15554 *static_cast< |
| 15531 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM*>( | 15555 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM*>( |
| 15532 cmd_data); | 15556 cmd_data); |
| 15533 if (!features().chromium_path_rendering) | 15557 if (!features().chromium_path_rendering) |
| 15534 return error::kUnknownCommand; | 15558 return error::kUnknownCommand; |
| 15535 PathCommandValidatorContext v(this, | 15559 PathCommandValidatorContext v(this, |
| 15536 "glStencilThenCoverFillPathInstancedCHROMIUM"); | 15560 "glStencilThenCoverFillPathInstancedCHROMIUM"); |
| 15537 GLuint num_paths = 0; | 15561 GLuint num_paths = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 15559 | 15583 |
| 15560 ApplyDirtyState(); | 15584 ApplyDirtyState(); |
| 15561 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, | 15585 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, |
| 15562 paths.path_names(), 0, fill_mode, mask, | 15586 paths.path_names(), 0, fill_mode, mask, |
| 15563 cover_mode, transform_type, transforms); | 15587 cover_mode, transform_type, transforms); |
| 15564 return error::kNoError; | 15588 return error::kNoError; |
| 15565 } | 15589 } |
| 15566 | 15590 |
| 15567 error::Error | 15591 error::Error |
| 15568 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( | 15592 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( |
| 15569 uint32 immediate_data_size, | 15593 uint32_t immediate_data_size, |
| 15570 const void* cmd_data) { | 15594 const void* cmd_data) { |
| 15571 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = | 15595 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = |
| 15572 *static_cast< | 15596 *static_cast< |
| 15573 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM*>( | 15597 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM*>( |
| 15574 cmd_data); | 15598 cmd_data); |
| 15575 if (!features().chromium_path_rendering) | 15599 if (!features().chromium_path_rendering) |
| 15576 return error::kUnknownCommand; | 15600 return error::kUnknownCommand; |
| 15577 PathCommandValidatorContext v(this, | 15601 PathCommandValidatorContext v(this, |
| 15578 "glStencilThenCoverStrokeInstancedCHROMIUM"); | 15602 "glStencilThenCoverStrokeInstancedCHROMIUM"); |
| 15579 GLuint num_paths = 0; | 15603 GLuint num_paths = 0; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15617 if (ProgramManager::HasBuiltInPrefix(name)) { | 15641 if (ProgramManager::HasBuiltInPrefix(name)) { |
| 15618 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "reserved prefix"); | 15642 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "reserved prefix"); |
| 15619 return; | 15643 return; |
| 15620 } | 15644 } |
| 15621 Program* program = GetProgram(program_id); | 15645 Program* program = GetProgram(program_id); |
| 15622 if (!program || program->IsDeleted()) { | 15646 if (!program || program->IsDeleted()) { |
| 15623 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "invalid program"); | 15647 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "invalid program"); |
| 15624 return; | 15648 return; |
| 15625 } | 15649 } |
| 15626 if (location < 0 || | 15650 if (location < 0 || |
| 15627 static_cast<uint32>(location) >= group_->max_varying_vectors() * 4) { | 15651 static_cast<uint32_t>(location) >= group_->max_varying_vectors() * 4) { |
| 15628 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 15652 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
| 15629 "location out of range"); | 15653 "location out of range"); |
| 15630 return; | 15654 return; |
| 15631 } | 15655 } |
| 15632 | 15656 |
| 15633 program->SetFragmentInputLocationBinding(name, location); | 15657 program->SetFragmentInputLocationBinding(name, location); |
| 15634 } | 15658 } |
| 15635 | 15659 |
| 15636 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( | 15660 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( |
| 15637 uint32 immediate_data_size, | 15661 uint32_t immediate_data_size, |
| 15638 const void* cmd_data) { | 15662 const void* cmd_data) { |
| 15639 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = | 15663 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = |
| 15640 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( | 15664 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( |
| 15641 cmd_data); | 15665 cmd_data); |
| 15642 if (!features().chromium_path_rendering) { | 15666 if (!features().chromium_path_rendering) { |
| 15643 return error::kUnknownCommand; | 15667 return error::kUnknownCommand; |
| 15644 } | 15668 } |
| 15645 | 15669 |
| 15646 GLuint program = static_cast<GLuint>(c.program); | 15670 GLuint program = static_cast<GLuint>(c.program); |
| 15647 GLint location = static_cast<GLint>(c.location); | 15671 GLint location = static_cast<GLint>(c.location); |
| 15648 Bucket* bucket = GetBucket(c.name_bucket_id); | 15672 Bucket* bucket = GetBucket(c.name_bucket_id); |
| 15649 if (!bucket || bucket->size() == 0) { | 15673 if (!bucket || bucket->size() == 0) { |
| 15650 return error::kInvalidArguments; | 15674 return error::kInvalidArguments; |
| 15651 } | 15675 } |
| 15652 std::string name_str; | 15676 std::string name_str; |
| 15653 if (!bucket->GetAsString(&name_str)) { | 15677 if (!bucket->GetAsString(&name_str)) { |
| 15654 return error::kInvalidArguments; | 15678 return error::kInvalidArguments; |
| 15655 } | 15679 } |
| 15656 DoBindFragmentInputLocationCHROMIUM(program, location, name_str); | 15680 DoBindFragmentInputLocationCHROMIUM(program, location, name_str); |
| 15657 return error::kNoError; | 15681 return error::kNoError; |
| 15658 } | 15682 } |
| 15659 | 15683 |
| 15660 error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM( | 15684 error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM( |
| 15661 uint32 immediate_data_size, | 15685 uint32_t immediate_data_size, |
| 15662 const void* cmd_data) { | 15686 const void* cmd_data) { |
| 15663 static const char kFunctionName[] = "glProgramPathFragmentInputGenCHROMIUM"; | 15687 static const char kFunctionName[] = "glProgramPathFragmentInputGenCHROMIUM"; |
| 15664 const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c = | 15688 const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c = |
| 15665 *static_cast<const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>( | 15689 *static_cast<const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>( |
| 15666 cmd_data); | 15690 cmd_data); |
| 15667 if (!features().chromium_path_rendering) { | 15691 if (!features().chromium_path_rendering) { |
| 15668 return error::kUnknownCommand; | 15692 return error::kUnknownCommand; |
| 15669 } | 15693 } |
| 15670 | 15694 |
| 15671 GLint program_id = static_cast<GLint>(c.program); | 15695 GLint program_id = static_cast<GLint>(c.program); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15731 "fragment input type is not single-precision " | 15755 "fragment input type is not single-precision " |
| 15732 "floating-point scalar or vector"); | 15756 "floating-point scalar or vector"); |
| 15733 return error::kNoError; | 15757 return error::kNoError; |
| 15734 } | 15758 } |
| 15735 | 15759 |
| 15736 if (components_needed != components) { | 15760 if (components_needed != components) { |
| 15737 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 15761 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 15738 "components does not match fragment input type"); | 15762 "components does not match fragment input type"); |
| 15739 return error::kNoError; | 15763 return error::kNoError; |
| 15740 } | 15764 } |
| 15741 uint32 coeffs_per_component = | 15765 uint32_t coeffs_per_component = |
| 15742 GLES2Util::GetCoefficientCountForGLPathFragmentInputGenMode(gen_mode); | 15766 GLES2Util::GetCoefficientCountForGLPathFragmentInputGenMode(gen_mode); |
| 15743 // The multiplication below will not overflow. | 15767 // The multiplication below will not overflow. |
| 15744 DCHECK(coeffs_per_component > 0 && coeffs_per_component <= 4); | 15768 DCHECK(coeffs_per_component > 0 && coeffs_per_component <= 4); |
| 15745 DCHECK(components > 0 && components <= 4); | 15769 DCHECK(components > 0 && components <= 4); |
| 15746 uint32 coeffs_size = sizeof(GLfloat) * coeffs_per_component * components; | 15770 uint32_t coeffs_size = sizeof(GLfloat) * coeffs_per_component * components; |
| 15747 | 15771 |
| 15748 uint32 coeffs_shm_id = static_cast<uint32>(c.coeffs_shm_id); | 15772 uint32_t coeffs_shm_id = static_cast<uint32_t>(c.coeffs_shm_id); |
| 15749 uint32 coeffs_shm_offset = static_cast<uint32>(c.coeffs_shm_offset); | 15773 uint32_t coeffs_shm_offset = static_cast<uint32_t>(c.coeffs_shm_offset); |
| 15750 | 15774 |
| 15751 if (coeffs_shm_id != 0 || coeffs_shm_offset != 0) { | 15775 if (coeffs_shm_id != 0 || coeffs_shm_offset != 0) { |
| 15752 coeffs = GetSharedMemoryAs<const GLfloat*>( | 15776 coeffs = GetSharedMemoryAs<const GLfloat*>( |
| 15753 coeffs_shm_id, coeffs_shm_offset, coeffs_size); | 15777 coeffs_shm_id, coeffs_shm_offset, coeffs_size); |
| 15754 } | 15778 } |
| 15755 | 15779 |
| 15756 if (!coeffs) { | 15780 if (!coeffs) { |
| 15757 return error::kOutOfBounds; | 15781 return error::kOutOfBounds; |
| 15758 } | 15782 } |
| 15759 } | 15783 } |
| 15760 glProgramPathFragmentInputGenNV(program->service_id(), real_location, | 15784 glProgramPathFragmentInputGenNV(program->service_id(), real_location, |
| 15761 gen_mode, components, coeffs); | 15785 gen_mode, components, coeffs); |
| 15762 return error::kNoError; | 15786 return error::kNoError; |
| 15763 } | 15787 } |
| 15764 | 15788 |
| 15765 // Include the auto-generated part of this file. We split this because it means | 15789 // Include the auto-generated part of this file. We split this because it means |
| 15766 // we can easily edit the non-auto generated parts right here in this file | 15790 // we can easily edit the non-auto generated parts right here in this file |
| 15767 // instead of having to edit some template or the code generator. | 15791 // instead of having to edit some template or the code generator. |
| 15792 #include "base/macros.h" |
| 15768 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15793 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15769 | 15794 |
| 15770 } // namespace gles2 | 15795 } // namespace gles2 |
| 15771 } // namespace gpu | 15796 } // namespace gpu |
| OLD | NEW |