Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(864)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2275203002: Make command buffer commands and immediate data volatile (Closed)
Patch Set: std::copy->const_cast+memcpy Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 535
536 GLES2Decoder::~GLES2Decoder() { 536 GLES2Decoder::~GLES2Decoder() {
537 } 537 }
538 538
539 void GLES2Decoder::BeginDecoding() {} 539 void GLES2Decoder::BeginDecoding() {}
540 540
541 void GLES2Decoder::EndDecoding() {} 541 void GLES2Decoder::EndDecoding() {}
542 542
543 error::Error GLES2Decoder::DoCommand(unsigned int command, 543 error::Error GLES2Decoder::DoCommand(unsigned int command,
544 unsigned int arg_count, 544 unsigned int arg_count,
545 const void* cmd_data) { 545 const volatile void* cmd_data) {
546 return DoCommands(1, cmd_data, arg_count + 1, 0); 546 return DoCommands(1, cmd_data, arg_count + 1, 0);
547 } 547 }
548 548
549 // This class implements GLES2Decoder so we don't have to expose all the GLES2 549 // This class implements GLES2Decoder so we don't have to expose all the GLES2
550 // cmd stuff to outside this class. 550 // cmd stuff to outside this class.
551 class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { 551 class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
552 public: 552 public:
553 explicit GLES2DecoderImpl(ContextGroup* group); 553 explicit GLES2DecoderImpl(ContextGroup* group);
554 ~GLES2DecoderImpl() override; 554 ~GLES2DecoderImpl() override;
555 555
556 error::Error DoCommands(unsigned int num_commands, 556 error::Error DoCommands(unsigned int num_commands,
557 const void* buffer, 557 const volatile void* buffer,
558 int num_entries, 558 int num_entries,
559 int* entries_processed) override; 559 int* entries_processed) override;
560 560
561 template <bool DebugImpl> 561 template <bool DebugImpl>
562 error::Error DoCommandsImpl(unsigned int num_commands, 562 error::Error DoCommandsImpl(unsigned int num_commands,
563 const void* buffer, 563 const volatile void* buffer,
564 int num_entries, 564 int num_entries,
565 int* entries_processed); 565 int* entries_processed);
566 566
567 // Overridden from AsyncAPIInterface. 567 // Overridden from AsyncAPIInterface.
568 const char* GetCommandName(unsigned int command_id) const override; 568 const char* GetCommandName(unsigned int command_id) const override;
569 569
570 // Overridden from GLES2Decoder. 570 // Overridden from GLES2Decoder.
571 bool Initialize(const scoped_refptr<gl::GLSurface>& surface, 571 bool Initialize(const scoped_refptr<gl::GLSurface>& surface,
572 const scoped_refptr<gl::GLContext>& context, 572 const scoped_refptr<gl::GLContext>& context,
573 bool offscreen, 573 bool offscreen,
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 kBindBufferRange 728 kBindBufferRange
729 }; 729 };
730 730
731 // Initialize or re-initialize the shader translator. 731 // Initialize or re-initialize the shader translator.
732 bool InitializeShaderTranslator(); 732 bool InitializeShaderTranslator();
733 733
734 void UpdateCapabilities(); 734 void UpdateCapabilities();
735 735
736 // Helpers for the glGen and glDelete functions. 736 // Helpers for the glGen and glDelete functions.
737 bool GenTexturesHelper(GLsizei n, const GLuint* client_ids); 737 bool GenTexturesHelper(GLsizei n, const GLuint* client_ids);
738 void DeleteTexturesHelper(GLsizei n, const GLuint* client_ids); 738 void DeleteTexturesHelper(GLsizei n, const volatile GLuint* client_ids);
739 bool GenBuffersHelper(GLsizei n, const GLuint* client_ids); 739 bool GenBuffersHelper(GLsizei n, const GLuint* client_ids);
740 void DeleteBuffersHelper(GLsizei n, const GLuint* client_ids); 740 void DeleteBuffersHelper(GLsizei n, const volatile GLuint* client_ids);
741 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids); 741 bool GenFramebuffersHelper(GLsizei n, const GLuint* client_ids);
742 void DeleteFramebuffersHelper(GLsizei n, const GLuint* client_ids); 742 void DeleteFramebuffersHelper(GLsizei n, const volatile GLuint* client_ids);
743 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids); 743 bool GenRenderbuffersHelper(GLsizei n, const GLuint* client_ids);
744 void DeleteRenderbuffersHelper(GLsizei n, const GLuint* client_ids); 744 void DeleteRenderbuffersHelper(GLsizei n, const volatile GLuint* client_ids);
745 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids); 745 bool GenQueriesEXTHelper(GLsizei n, const GLuint* client_ids);
746 void DeleteQueriesEXTHelper(GLsizei n, const GLuint* client_ids); 746 void DeleteQueriesEXTHelper(GLsizei n, const volatile GLuint* client_ids);
747 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); 747 bool GenVertexArraysOESHelper(GLsizei n, const GLuint* client_ids);
748 void DeleteVertexArraysOESHelper(GLsizei n, const GLuint* client_ids); 748 void DeleteVertexArraysOESHelper(GLsizei n,
749 const volatile GLuint* client_ids);
749 bool GenPathsCHROMIUMHelper(GLuint first_client_id, GLsizei range); 750 bool GenPathsCHROMIUMHelper(GLuint first_client_id, GLsizei range);
750 bool DeletePathsCHROMIUMHelper(GLuint first_client_id, GLsizei range); 751 bool DeletePathsCHROMIUMHelper(GLuint first_client_id, GLsizei range);
751 bool GenSamplersHelper(GLsizei n, const GLuint* client_ids); 752 bool GenSamplersHelper(GLsizei n, const GLuint* client_ids);
752 void DeleteSamplersHelper(GLsizei n, const GLuint* client_ids); 753 void DeleteSamplersHelper(GLsizei n, const volatile GLuint* client_ids);
753 bool GenTransformFeedbacksHelper(GLsizei n, const GLuint* client_ids); 754 bool GenTransformFeedbacksHelper(GLsizei n, const GLuint* client_ids);
754 void DeleteTransformFeedbacksHelper(GLsizei n, const GLuint* client_ids); 755 void DeleteTransformFeedbacksHelper(GLsizei n,
756 const volatile GLuint* client_ids);
755 void DeleteSyncHelper(GLuint sync); 757 void DeleteSyncHelper(GLuint sync);
756 758
757 // Workarounds 759 // Workarounds
758 void OnFboChanged() const; 760 void OnFboChanged() const;
759 void OnUseFramebuffer() const; 761 void OnUseFramebuffer() const;
760 762
761 error::ContextLostReason GetContextLostReasonFromResetStatus( 763 error::ContextLostReason GetContextLostReasonFromResetStatus(
762 GLenum reset_status) const; 764 GLenum reset_status) const;
763 765
764 // TODO(gman): Cache these pointers? 766 // TODO(gman): Cache these pointers?
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 GLsizei height); 1048 GLsizei height);
1047 1049
1048 // Wrapper for TexStorage3D. 1050 // Wrapper for TexStorage3D.
1049 void DoTexStorage3D(GLenum target, 1051 void DoTexStorage3D(GLenum target,
1050 GLsizei levels, 1052 GLsizei levels,
1051 GLenum internal_format, 1053 GLenum internal_format,
1052 GLsizei width, 1054 GLsizei width,
1053 GLsizei height, 1055 GLsizei height,
1054 GLsizei depth); 1056 GLsizei depth);
1055 1057
1056 void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key); 1058 void DoProduceTextureCHROMIUM(GLenum target, const volatile GLbyte* key);
1057 void DoProduceTextureDirectCHROMIUM(GLuint texture, GLenum target, 1059 void DoProduceTextureDirectCHROMIUM(GLuint texture,
1058 const GLbyte* key); 1060 GLenum target,
1061 const volatile GLbyte* key);
1059 void ProduceTextureRef(const char* func_name, 1062 void ProduceTextureRef(const char* func_name,
1060 bool clear, 1063 bool clear,
1061 TextureRef* texture_ref, 1064 TextureRef* texture_ref,
1062 GLenum target, 1065 GLenum target,
1063 const GLbyte* data); 1066 const volatile GLbyte* data);
1064 1067
1065 void EnsureTextureForClientId(GLenum target, GLuint client_id); 1068 void EnsureTextureForClientId(GLenum target, GLuint client_id);
1066 void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key); 1069 void DoConsumeTextureCHROMIUM(GLenum target, const volatile GLbyte* key);
1067 void DoCreateAndConsumeTextureINTERNAL(GLenum target, 1070 void DoCreateAndConsumeTextureINTERNAL(GLenum target,
1068 GLuint client_id, 1071 GLuint client_id,
1069 const GLbyte* key); 1072 const volatile GLbyte* key);
1070 void DoApplyScreenSpaceAntialiasingCHROMIUM(); 1073 void DoApplyScreenSpaceAntialiasingCHROMIUM();
1071 1074
1072 void DoBindTexImage2DCHROMIUM( 1075 void DoBindTexImage2DCHROMIUM(
1073 GLenum target, 1076 GLenum target,
1074 GLint image_id); 1077 GLint image_id);
1075 void DoReleaseTexImage2DCHROMIUM( 1078 void DoReleaseTexImage2DCHROMIUM(
1076 GLenum target, 1079 GLenum target,
1077 GLint image_id); 1080 GLint image_id);
1078 1081
1079 void DoTraceEndCHROMIUM(void); 1082 void DoTraceEndCHROMIUM(void);
1080 1083
1081 void DoDrawBuffersEXT(GLsizei count, const GLenum* bufs); 1084 void DoDrawBuffersEXT(GLsizei count, const volatile GLenum* bufs);
1082 1085
1083 void DoLoseContextCHROMIUM(GLenum current, GLenum other); 1086 void DoLoseContextCHROMIUM(GLenum current, GLenum other);
1084 1087
1085 void DoFlushDriverCachesCHROMIUM(void); 1088 void DoFlushDriverCachesCHROMIUM(void);
1086 1089
1087 void DoMatrixLoadfCHROMIUM(GLenum matrix_mode, const GLfloat* matrix); 1090 void DoMatrixLoadfCHROMIUM(GLenum matrix_mode,
1091 const volatile GLfloat* matrix);
1088 void DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode); 1092 void DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode);
1089 void DoScheduleCALayerInUseQueryCHROMIUM(GLsizei count, 1093 void DoScheduleCALayerInUseQueryCHROMIUM(GLsizei count,
1090 const GLuint* textures); 1094 const volatile GLuint* textures);
1091 1095
1092 // Creates a Program for the given program. 1096 // Creates a Program for the given program.
1093 Program* CreateProgram(GLuint client_id, GLuint service_id) { 1097 Program* CreateProgram(GLuint client_id, GLuint service_id) {
1094 return program_manager()->CreateProgram(client_id, service_id); 1098 return program_manager()->CreateProgram(client_id, service_id);
1095 } 1099 }
1096 1100
1097 // Gets the program info for the given program. Returns NULL if none exists. 1101 // Gets the program info for the given program. Returns NULL if none exists.
1098 Program* GetProgram(GLuint client_id) { 1102 Program* GetProgram(GLuint client_id) {
1099 return program_manager()->GetProgram(client_id); 1103 return program_manager()->GetProgram(client_id);
1100 } 1104 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1487
1484 // Wrapper for glBufferSubData. 1488 // Wrapper for glBufferSubData.
1485 void DoBufferSubData( 1489 void DoBufferSubData(
1486 GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); 1490 GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data);
1487 1491
1488 // Wrapper for glCheckFramebufferStatus 1492 // Wrapper for glCheckFramebufferStatus
1489 GLenum DoCheckFramebufferStatus(GLenum target); 1493 GLenum DoCheckFramebufferStatus(GLenum target);
1490 1494
1491 // Wrapper for glClear*() 1495 // Wrapper for glClear*()
1492 error::Error DoClear(GLbitfield mask); 1496 error::Error DoClear(GLbitfield mask);
1493 void DoClearBufferiv( 1497 void DoClearBufferiv(GLenum buffer,
1494 GLenum buffer, GLint drawbuffer, const GLint* value); 1498 GLint drawbuffer,
1495 void DoClearBufferuiv( 1499 const volatile GLint* value);
1496 GLenum buffer, GLint drawbuffer, const GLuint* value); 1500 void DoClearBufferuiv(GLenum buffer,
1497 void DoClearBufferfv( 1501 GLint drawbuffer,
1498 GLenum buffer, GLint drawbuffer, const GLfloat* value); 1502 const volatile GLuint* value);
1503 void DoClearBufferfv(GLenum buffer,
1504 GLint drawbuffer,
1505 const volatile GLfloat* value);
1499 void DoClearBufferfi( 1506 void DoClearBufferfi(
1500 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); 1507 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
1501 1508
1502 // Wrappers for various state. 1509 // Wrappers for various state.
1503 void DoDepthRangef(GLclampf znear, GLclampf zfar); 1510 void DoDepthRangef(GLclampf znear, GLclampf zfar);
1504 void DoSampleCoverage(GLclampf value, GLboolean invert); 1511 void DoSampleCoverage(GLclampf value, GLboolean invert);
1505 1512
1506 // Wrapper for glCompileShader. 1513 // Wrapper for glCompileShader.
1507 void DoCompileShader(GLuint shader); 1514 void DoCompileShader(GLuint shader);
1508 1515
1509 // Wrapper for glDetachShader 1516 // Wrapper for glDetachShader
1510 void DoDetachShader(GLuint client_program_id, GLint client_shader_id); 1517 void DoDetachShader(GLuint client_program_id, GLint client_shader_id);
1511 1518
1512 // Wrapper for glDisable 1519 // Wrapper for glDisable
1513 void DoDisable(GLenum cap); 1520 void DoDisable(GLenum cap);
1514 1521
1515 // Wrapper for glDisableVertexAttribArray. 1522 // Wrapper for glDisableVertexAttribArray.
1516 void DoDisableVertexAttribArray(GLuint index); 1523 void DoDisableVertexAttribArray(GLuint index);
1517 1524
1518 // Wrapper for glDiscardFramebufferEXT, since we need to track undefined 1525 // Wrapper for glDiscardFramebufferEXT, since we need to track undefined
1519 // attachments. 1526 // attachments.
1520 void DoDiscardFramebufferEXT( 1527 void DoDiscardFramebufferEXT(GLenum target,
1521 GLenum target, GLsizei count, const GLenum* attachments); 1528 GLsizei count,
1529 const volatile GLenum* attachments);
1522 1530
1523 void DoInvalidateFramebuffer( 1531 void DoInvalidateFramebuffer(GLenum target,
1524 GLenum target, GLsizei count, const GLenum* attachments); 1532 GLsizei count,
1525 void DoInvalidateSubFramebuffer( 1533 const volatile GLenum* attachments);
1526 GLenum target, GLsizei count, const GLenum* attachments, 1534 void DoInvalidateSubFramebuffer(GLenum target,
1527 GLint x, GLint y, GLsizei width, GLsizei height); 1535 GLsizei count,
1536 const volatile GLenum* attachments,
1537 GLint x,
1538 GLint y,
1539 GLsizei width,
1540 GLsizei height);
1528 1541
1529 // Helper for DoDiscardFramebufferEXT, DoInvalidate{Sub}Framebuffer. 1542 // Helper for DoDiscardFramebufferEXT, DoInvalidate{Sub}Framebuffer.
1530 void InvalidateFramebufferImpl( 1543 void InvalidateFramebufferImpl(GLenum target,
1531 GLenum target, GLsizei count, const GLenum* attachments, 1544 GLsizei count,
1532 GLint x, GLint y, GLsizei width, GLsizei height, 1545 const volatile GLenum* attachments,
1533 const char* function_name, FramebufferOperation op); 1546 GLint x,
1547 GLint y,
1548 GLsizei width,
1549 GLsizei height,
1550 const char* function_name,
1551 FramebufferOperation op);
1534 1552
1535 // Wrapper for glEnable 1553 // Wrapper for glEnable
1536 void DoEnable(GLenum cap); 1554 void DoEnable(GLenum cap);
1537 1555
1538 // Wrapper for glEnableVertexAttribArray. 1556 // Wrapper for glEnableVertexAttribArray.
1539 void DoEnableVertexAttribArray(GLuint index); 1557 void DoEnableVertexAttribArray(GLuint index);
1540 1558
1541 // Wrapper for glFinish. 1559 // Wrapper for glFinish.
1542 void DoFinish(); 1560 void DoFinish();
1543 1561
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 // buffers under memory pressure 1717 // buffers under memory pressure
1700 bool VerifyMultisampleRenderbufferIntegrity( 1718 bool VerifyMultisampleRenderbufferIntegrity(
1701 GLuint renderbuffer, GLenum format); 1719 GLuint renderbuffer, GLenum format);
1702 1720
1703 // Wrapper for glReleaseShaderCompiler. 1721 // Wrapper for glReleaseShaderCompiler.
1704 void DoReleaseShaderCompiler() { } 1722 void DoReleaseShaderCompiler() { }
1705 1723
1706 // Wrappers for glSamplerParameter functions. 1724 // Wrappers for glSamplerParameter functions.
1707 void DoSamplerParameterf(GLuint client_id, GLenum pname, GLfloat param); 1725 void DoSamplerParameterf(GLuint client_id, GLenum pname, GLfloat param);
1708 void DoSamplerParameteri(GLuint client_id, GLenum pname, GLint param); 1726 void DoSamplerParameteri(GLuint client_id, GLenum pname, GLint param);
1709 void DoSamplerParameterfv( 1727 void DoSamplerParameterfv(GLuint client_id,
1710 GLuint client_id, GLenum pname, const GLfloat* params); 1728 GLenum pname,
1711 void DoSamplerParameteriv( 1729 const volatile GLfloat* params);
1712 GLuint client_id, GLenum pname, const GLint* params); 1730 void DoSamplerParameteriv(GLuint client_id,
1731 GLenum pname,
1732 const volatile GLint* params);
1713 1733
1714 // Wrappers for glTexParameter functions. 1734 // Wrappers for glTexParameter functions.
1715 void DoTexParameterf(GLenum target, GLenum pname, GLfloat param); 1735 void DoTexParameterf(GLenum target, GLenum pname, GLfloat param);
1716 void DoTexParameteri(GLenum target, GLenum pname, GLint param); 1736 void DoTexParameteri(GLenum target, GLenum pname, GLint param);
1717 void DoTexParameterfv(GLenum target, GLenum pname, const GLfloat* params); 1737 void DoTexParameterfv(GLenum target,
1718 void DoTexParameteriv(GLenum target, GLenum pname, const GLint* params); 1738 GLenum pname,
1739 const volatile GLfloat* params);
1740 void DoTexParameteriv(GLenum target,
1741 GLenum pname,
1742 const volatile GLint* params);
1719 1743
1720 // Wrappers for glUniform1i and glUniform1iv as according to the GLES2 1744 // Wrappers for glUniform1i and glUniform1iv as according to the GLES2
1721 // spec only these 2 functions can be used to set sampler uniforms. 1745 // spec only these 2 functions can be used to set sampler uniforms.
1722 void DoUniform1i(GLint fake_location, GLint v0); 1746 void DoUniform1i(GLint fake_location, GLint v0);
1723 void DoUniform1iv(GLint fake_location, GLsizei count, const GLint* value); 1747 void DoUniform1iv(GLint fake_location,
1724 void DoUniform2iv(GLint fake_location, GLsizei count, const GLint* value); 1748 GLsizei count,
1725 void DoUniform3iv(GLint fake_location, GLsizei count, const GLint* value); 1749 const volatile GLint* value);
1726 void DoUniform4iv(GLint fake_location, GLsizei count, const GLint* value); 1750 void DoUniform2iv(GLint fake_location,
1751 GLsizei count,
1752 const volatile GLint* value);
1753 void DoUniform3iv(GLint fake_location,
1754 GLsizei count,
1755 const volatile GLint* value);
1756 void DoUniform4iv(GLint fake_location,
1757 GLsizei count,
1758 const volatile GLint* value);
1727 1759
1728 void DoUniform1ui(GLint fake_location, GLuint v0); 1760 void DoUniform1ui(GLint fake_location, GLuint v0);
1729 void DoUniform1uiv(GLint fake_location, GLsizei count, const GLuint* value); 1761 void DoUniform1uiv(GLint fake_location,
1730 void DoUniform2uiv(GLint fake_location, GLsizei count, const GLuint* value); 1762 GLsizei count,
1731 void DoUniform3uiv(GLint fake_location, GLsizei count, const GLuint* value); 1763 const volatile GLuint* value);
1732 void DoUniform4uiv(GLint fake_location, GLsizei count, const GLuint* value); 1764 void DoUniform2uiv(GLint fake_location,
1765 GLsizei count,
1766 const volatile GLuint* value);
1767 void DoUniform3uiv(GLint fake_location,
1768 GLsizei count,
1769 const volatile GLuint* value);
1770 void DoUniform4uiv(GLint fake_location,
1771 GLsizei count,
1772 const volatile GLuint* value);
1733 1773
1734 // Wrappers for glUniformfv because some drivers don't correctly accept 1774 // Wrappers for glUniformfv because some drivers don't correctly accept
1735 // bool uniforms. 1775 // bool uniforms.
1736 void DoUniform1fv(GLint fake_location, GLsizei count, const GLfloat* value); 1776 void DoUniform1fv(GLint fake_location,
1737 void DoUniform2fv(GLint fake_location, GLsizei count, const GLfloat* value); 1777 GLsizei count,
1738 void DoUniform3fv(GLint fake_location, GLsizei count, const GLfloat* value); 1778 const volatile GLfloat* value);
1739 void DoUniform4fv(GLint fake_location, GLsizei count, const GLfloat* value); 1779 void DoUniform2fv(GLint fake_location,
1780 GLsizei count,
1781 const volatile GLfloat* value);
1782 void DoUniform3fv(GLint fake_location,
1783 GLsizei count,
1784 const volatile GLfloat* value);
1785 void DoUniform4fv(GLint fake_location,
1786 GLsizei count,
1787 const volatile GLfloat* value);
1740 1788
1741 void DoUniformMatrix2fv( 1789 void DoUniformMatrix2fv(GLint fake_location,
1742 GLint fake_location, GLsizei count, GLboolean transpose, 1790 GLsizei count,
1743 const GLfloat* value); 1791 GLboolean transpose,
1744 void DoUniformMatrix3fv( 1792 const volatile GLfloat* value);
1745 GLint fake_location, GLsizei count, GLboolean transpose, 1793 void DoUniformMatrix3fv(GLint fake_location,
1746 const GLfloat* value); 1794 GLsizei count,
1747 void DoUniformMatrix4fv( 1795 GLboolean transpose,
1748 GLint fake_location, GLsizei count, GLboolean transpose, 1796 const volatile GLfloat* value);
1749 const GLfloat* value); 1797 void DoUniformMatrix4fv(GLint fake_location,
1798 GLsizei count,
1799 GLboolean transpose,
1800 const volatile GLfloat* value);
1750 void DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( 1801 void DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
1751 GLint fake_location, 1802 GLint fake_location,
1752 GLboolean transpose, 1803 GLboolean transpose,
1753 const GLfloat* default_value); 1804 const volatile GLfloat* default_value);
1754 void DoUniformMatrix2x3fv( 1805 void DoUniformMatrix2x3fv(GLint fake_location,
1755 GLint fake_location, GLsizei count, GLboolean transpose, 1806 GLsizei count,
1756 const GLfloat* value); 1807 GLboolean transpose,
1757 void DoUniformMatrix2x4fv( 1808 const volatile GLfloat* value);
1758 GLint fake_location, GLsizei count, GLboolean transpose, 1809 void DoUniformMatrix2x4fv(GLint fake_location,
1759 const GLfloat* value); 1810 GLsizei count,
1760 void DoUniformMatrix3x2fv( 1811 GLboolean transpose,
1761 GLint fake_location, GLsizei count, GLboolean transpose, 1812 const volatile GLfloat* value);
1762 const GLfloat* value); 1813 void DoUniformMatrix3x2fv(GLint fake_location,
1763 void DoUniformMatrix3x4fv( 1814 GLsizei count,
1764 GLint fake_location, GLsizei count, GLboolean transpose, 1815 GLboolean transpose,
1765 const GLfloat* value); 1816 const volatile GLfloat* value);
1766 void DoUniformMatrix4x2fv( 1817 void DoUniformMatrix3x4fv(GLint fake_location,
1767 GLint fake_location, GLsizei count, GLboolean transpose, 1818 GLsizei count,
1768 const GLfloat* value); 1819 GLboolean transpose,
1769 void DoUniformMatrix4x3fv( 1820 const volatile GLfloat* value);
1770 GLint fake_location, GLsizei count, GLboolean transpose, 1821 void DoUniformMatrix4x2fv(GLint fake_location,
1771 const GLfloat* value); 1822 GLsizei count,
1823 GLboolean transpose,
1824 const volatile GLfloat* value);
1825 void DoUniformMatrix4x3fv(GLint fake_location,
1826 GLsizei count,
1827 GLboolean transpose,
1828 const volatile GLfloat* value);
1772 1829
1773 template <typename T> 1830 template <typename T>
1774 bool SetVertexAttribValue( 1831 bool SetVertexAttribValue(
1775 const char* function_name, GLuint index, const T* value); 1832 const char* function_name, GLuint index, const T* value);
1776 1833
1777 // Wrappers for glVertexAttrib?? 1834 // Wrappers for glVertexAttrib??
1778 void DoVertexAttrib1f(GLuint index, GLfloat v0); 1835 void DoVertexAttrib1f(GLuint index, GLfloat v0);
1779 void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1); 1836 void DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1);
1780 void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2); 1837 void DoVertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2);
1781 void DoVertexAttrib4f( 1838 void DoVertexAttrib4f(
1782 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); 1839 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
1783 void DoVertexAttrib1fv(GLuint index, const GLfloat* v); 1840 void DoVertexAttrib1fv(GLuint index, const volatile GLfloat* v);
1784 void DoVertexAttrib2fv(GLuint index, const GLfloat* v); 1841 void DoVertexAttrib2fv(GLuint index, const volatile GLfloat* v);
1785 void DoVertexAttrib3fv(GLuint index, const GLfloat* v); 1842 void DoVertexAttrib3fv(GLuint index, const volatile GLfloat* v);
1786 void DoVertexAttrib4fv(GLuint index, const GLfloat* v); 1843 void DoVertexAttrib4fv(GLuint index, const volatile GLfloat* v);
1787 void DoVertexAttribI4i(GLuint index, GLint v0, GLint v1, GLint v2, GLint v3); 1844 void DoVertexAttribI4i(GLuint index, GLint v0, GLint v1, GLint v2, GLint v3);
1788 void DoVertexAttribI4iv(GLuint index, const GLint* v); 1845 void DoVertexAttribI4iv(GLuint index, const volatile GLint* v);
1789 void DoVertexAttribI4ui( 1846 void DoVertexAttribI4ui(
1790 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3); 1847 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1791 void DoVertexAttribI4uiv(GLuint index, const GLuint* v); 1848 void DoVertexAttribI4uiv(GLuint index, const volatile GLuint* v);
1792 1849
1793 // Wrapper for glViewport 1850 // Wrapper for glViewport
1794 void DoViewport(GLint x, GLint y, GLsizei width, GLsizei height); 1851 void DoViewport(GLint x, GLint y, GLsizei width, GLsizei height);
1795 1852
1796 // Wrapper for glUseProgram 1853 // Wrapper for glUseProgram
1797 void DoUseProgram(GLuint program); 1854 void DoUseProgram(GLuint program);
1798 1855
1799 // Wrapper for glValidateProgram. 1856 // Wrapper for glValidateProgram.
1800 void DoValidateProgram(GLuint program_client_id); 1857 void DoValidateProgram(GLuint program_client_id);
1801 1858
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 void ClearScheduleCALayerState(); 2127 void ClearScheduleCALayerState();
2071 2128
2072 // Helper method to call glClear workaround. 2129 // Helper method to call glClear workaround.
2073 void ClearFramebufferForWorkaround(GLbitfield mask); 2130 void ClearFramebufferForWorkaround(GLbitfield mask);
2074 2131
2075 bool InitializeCopyTexImageBlitter(const char* function_name); 2132 bool InitializeCopyTexImageBlitter(const char* function_name);
2076 bool InitializeCopyTextureCHROMIUM(const char* function_name); 2133 bool InitializeCopyTextureCHROMIUM(const char* function_name);
2077 // Generate a member function prototype for each command in an automated and 2134 // Generate a member function prototype for each command in an automated and
2078 // typesafe way. 2135 // typesafe way.
2079 #define GLES2_CMD_OP(name) \ 2136 #define GLES2_CMD_OP(name) \
2080 Error Handle##name(uint32_t immediate_data_size, const void* data); 2137 Error Handle##name(uint32_t immediate_data_size, const volatile void* data);
2081 2138
2082 GLES2_COMMAND_LIST(GLES2_CMD_OP) 2139 GLES2_COMMAND_LIST(GLES2_CMD_OP)
2083 2140
2084 #undef GLES2_CMD_OP 2141 #undef GLES2_CMD_OP
2085 2142
2086 // The GL context this decoder renders to on behalf of the client. 2143 // The GL context this decoder renders to on behalf of the client.
2087 scoped_refptr<gl::GLSurface> surface_; 2144 scoped_refptr<gl::GLSurface> surface_;
2088 scoped_refptr<gl::GLContext> context_; 2145 scoped_refptr<gl::GLContext> context_;
2089 2146
2090 // The ContextGroup for this decoder uses to track resources. 2147 // The ContextGroup for this decoder uses to track resources.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 // get rescheduled. 2349 // get rescheduled.
2293 std::vector<std::unique_ptr<gl::GLFence>> deschedule_until_finished_fences_; 2350 std::vector<std::unique_ptr<gl::GLFence>> deschedule_until_finished_fences_;
2294 2351
2295 // Used to validate multisample renderbuffers if needed 2352 // Used to validate multisample renderbuffers if needed
2296 GLuint validation_texture_; 2353 GLuint validation_texture_;
2297 GLuint validation_fbo_multisample_; 2354 GLuint validation_fbo_multisample_;
2298 GLuint validation_fbo_; 2355 GLuint validation_fbo_;
2299 2356
2300 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)( 2357 typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)(
2301 uint32_t immediate_data_size, 2358 uint32_t immediate_data_size,
2302 const void* data); 2359 const volatile void* data);
2303 2360
2304 // A struct to hold info about each command. 2361 // A struct to hold info about each command.
2305 struct CommandInfo { 2362 struct CommandInfo {
2306 CmdHandler cmd_handler; 2363 CmdHandler cmd_handler;
2307 uint8_t arg_flags; // How to handle the arguments for this command 2364 uint8_t arg_flags; // How to handle the arguments for this command
2308 uint8_t cmd_flags; // How to handle this command 2365 uint8_t cmd_flags; // How to handle this command
2309 uint16_t arg_count; // How many arguments are expected for this command. 2366 uint16_t arg_count; // How many arguments are expected for this command.
2310 }; 2367 };
2311 2368
2312 // A table of CommandInfo for all the commands. 2369 // A table of CommandInfo for all the commands.
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 GLsizei range) { 3929 GLsizei range) {
3873 GLuint last_client_id; 3930 GLuint last_client_id;
3874 if (!SafeAddUint32(first_client_id, range - 1, &last_client_id)) 3931 if (!SafeAddUint32(first_client_id, range - 1, &last_client_id))
3875 return false; 3932 return false;
3876 3933
3877 path_manager()->RemovePaths(first_client_id, last_client_id); 3934 path_manager()->RemovePaths(first_client_id, last_client_id);
3878 return true; 3935 return true;
3879 } 3936 }
3880 3937
3881 void GLES2DecoderImpl::DeleteBuffersHelper(GLsizei n, 3938 void GLES2DecoderImpl::DeleteBuffersHelper(GLsizei n,
3882 const GLuint* client_ids) { 3939 const volatile GLuint* client_ids) {
3883 for (GLsizei ii = 0; ii < n; ++ii) { 3940 for (GLsizei ii = 0; ii < n; ++ii) {
3884 GLuint client_id = client_ids[ii]; 3941 GLuint client_id = client_ids[ii];
3885 Buffer* buffer = GetBuffer(client_id); 3942 Buffer* buffer = GetBuffer(client_id);
3886 if (buffer && !buffer->IsDeleted()) { 3943 if (buffer && !buffer->IsDeleted()) {
3887 buffer->RemoveMappedRange(); 3944 buffer->RemoveMappedRange();
3888 state_.RemoveBoundBuffer(buffer); 3945 state_.RemoveBoundBuffer(buffer);
3889 transform_feedback_manager_->RemoveBoundBuffer(buffer); 3946 transform_feedback_manager_->RemoveBoundBuffer(buffer);
3890 RemoveBuffer(client_id); 3947 RemoveBuffer(client_id);
3891 } 3948 }
3892 } 3949 }
3893 } 3950 }
3894 3951
3895 void GLES2DecoderImpl::DeleteFramebuffersHelper(GLsizei n, 3952 void GLES2DecoderImpl::DeleteFramebuffersHelper(
3896 const GLuint* client_ids) { 3953 GLsizei n,
3954 const volatile GLuint* client_ids) {
3897 bool supports_separate_framebuffer_binds = 3955 bool supports_separate_framebuffer_binds =
3898 features().chromium_framebuffer_multisample; 3956 features().chromium_framebuffer_multisample;
3899 3957
3900 for (GLsizei ii = 0; ii < n; ++ii) { 3958 for (GLsizei ii = 0; ii < n; ++ii) {
3901 GLuint client_id = client_ids[ii]; 3959 GLuint client_id = client_ids[ii];
3902 Framebuffer* framebuffer = GetFramebuffer(client_id); 3960 Framebuffer* framebuffer = GetFramebuffer(client_id);
3903 if (framebuffer && !framebuffer->IsDeleted()) { 3961 if (framebuffer && !framebuffer->IsDeleted()) {
3904 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { 3962 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
3905 GLenum target = supports_separate_framebuffer_binds ? 3963 GLenum target = supports_separate_framebuffer_binds ?
3906 GL_DRAW_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; 3964 GL_DRAW_FRAMEBUFFER_EXT : GL_FRAMEBUFFER;
(...skipping 11 matching lines...) Expand all
3918 GLenum target = supports_separate_framebuffer_binds ? 3976 GLenum target = supports_separate_framebuffer_binds ?
3919 GL_READ_FRAMEBUFFER_EXT : GL_FRAMEBUFFER; 3977 GL_READ_FRAMEBUFFER_EXT : GL_FRAMEBUFFER;
3920 glBindFramebufferEXT(target, GetBackbufferServiceId()); 3978 glBindFramebufferEXT(target, GetBackbufferServiceId());
3921 } 3979 }
3922 OnFboChanged(); 3980 OnFboChanged();
3923 RemoveFramebuffer(client_id); 3981 RemoveFramebuffer(client_id);
3924 } 3982 }
3925 } 3983 }
3926 } 3984 }
3927 3985
3928 void GLES2DecoderImpl::DeleteRenderbuffersHelper(GLsizei n, 3986 void GLES2DecoderImpl::DeleteRenderbuffersHelper(
3929 const GLuint* client_ids) { 3987 GLsizei n,
3988 const volatile GLuint* client_ids) {
3930 bool supports_separate_framebuffer_binds = 3989 bool supports_separate_framebuffer_binds =
3931 features().chromium_framebuffer_multisample; 3990 features().chromium_framebuffer_multisample;
3932 for (GLsizei ii = 0; ii < n; ++ii) { 3991 for (GLsizei ii = 0; ii < n; ++ii) {
3933 GLuint client_id = client_ids[ii]; 3992 GLuint client_id = client_ids[ii];
3934 Renderbuffer* renderbuffer = GetRenderbuffer(client_id); 3993 Renderbuffer* renderbuffer = GetRenderbuffer(client_id);
3935 if (renderbuffer && !renderbuffer->IsDeleted()) { 3994 if (renderbuffer && !renderbuffer->IsDeleted()) {
3936 if (state_.bound_renderbuffer.get() == renderbuffer) { 3995 if (state_.bound_renderbuffer.get() == renderbuffer) {
3937 state_.bound_renderbuffer = NULL; 3996 state_.bound_renderbuffer = NULL;
3938 } 3997 }
3939 // Unbind from current framebuffers. 3998 // Unbind from current framebuffers.
(...skipping 12 matching lines...) Expand all
3952 ->UnbindRenderbuffer(GL_FRAMEBUFFER, renderbuffer); 4011 ->UnbindRenderbuffer(GL_FRAMEBUFFER, renderbuffer);
3953 } 4012 }
3954 } 4013 }
3955 framebuffer_state_.clear_state_dirty = true; 4014 framebuffer_state_.clear_state_dirty = true;
3956 RemoveRenderbuffer(client_id); 4015 RemoveRenderbuffer(client_id);
3957 } 4016 }
3958 } 4017 }
3959 } 4018 }
3960 4019
3961 void GLES2DecoderImpl::DeleteTexturesHelper(GLsizei n, 4020 void GLES2DecoderImpl::DeleteTexturesHelper(GLsizei n,
3962 const GLuint* client_ids) { 4021 const volatile GLuint* client_ids) {
3963 bool supports_separate_framebuffer_binds = 4022 bool supports_separate_framebuffer_binds =
3964 features().chromium_framebuffer_multisample; 4023 features().chromium_framebuffer_multisample;
3965 for (GLsizei ii = 0; ii < n; ++ii) { 4024 for (GLsizei ii = 0; ii < n; ++ii) {
3966 GLuint client_id = client_ids[ii]; 4025 GLuint client_id = client_ids[ii];
3967 TextureRef* texture_ref = GetTexture(client_id); 4026 TextureRef* texture_ref = GetTexture(client_id);
3968 if (texture_ref) { 4027 if (texture_ref) {
3969 Texture* texture = texture_ref->texture(); 4028 Texture* texture = texture_ref->texture();
3970 if (texture->IsAttachedToFramebuffer()) { 4029 if (texture->IsAttachedToFramebuffer()) {
3971 framebuffer_state_.clear_state_dirty = true; 4030 framebuffer_state_.clear_state_dirty = true;
3972 } 4031 }
(...skipping 15 matching lines...) Expand all
3988 framebuffer_state_.bound_draw_framebuffer 4047 framebuffer_state_.bound_draw_framebuffer
3989 ->UnbindTexture(GL_FRAMEBUFFER, texture_ref); 4048 ->UnbindTexture(GL_FRAMEBUFFER, texture_ref);
3990 } 4049 }
3991 } 4050 }
3992 RemoveTexture(client_id); 4051 RemoveTexture(client_id);
3993 } 4052 }
3994 } 4053 }
3995 } 4054 }
3996 4055
3997 void GLES2DecoderImpl::DeleteSamplersHelper(GLsizei n, 4056 void GLES2DecoderImpl::DeleteSamplersHelper(GLsizei n,
3998 const GLuint* client_ids) { 4057 const volatile GLuint* client_ids) {
3999 for (GLsizei ii = 0; ii < n; ++ii) { 4058 for (GLsizei ii = 0; ii < n; ++ii) {
4000 GLuint client_id = client_ids[ii]; 4059 GLuint client_id = client_ids[ii];
4001 Sampler* sampler = GetSampler(client_id); 4060 Sampler* sampler = GetSampler(client_id);
4002 if (sampler && !sampler->IsDeleted()) { 4061 if (sampler && !sampler->IsDeleted()) {
4003 // Unbind from current sampler units. 4062 // Unbind from current sampler units.
4004 state_.UnbindSampler(sampler); 4063 state_.UnbindSampler(sampler);
4005 4064
4006 RemoveSampler(client_id); 4065 RemoveSampler(client_id);
4007 } 4066 }
4008 } 4067 }
4009 } 4068 }
4010 4069
4011 void GLES2DecoderImpl::DeleteTransformFeedbacksHelper( 4070 void GLES2DecoderImpl::DeleteTransformFeedbacksHelper(
4012 GLsizei n, 4071 GLsizei n,
4013 const GLuint* client_ids) { 4072 const volatile GLuint* client_ids) {
4014 for (GLsizei ii = 0; ii < n; ++ii) { 4073 for (GLsizei ii = 0; ii < n; ++ii) {
4015 GLuint client_id = client_ids[ii]; 4074 GLuint client_id = client_ids[ii];
4016 TransformFeedback* transform_feedback = GetTransformFeedback(client_id); 4075 TransformFeedback* transform_feedback = GetTransformFeedback(client_id);
4017 if (transform_feedback) { 4076 if (transform_feedback) {
4018 if (transform_feedback->active()) { 4077 if (transform_feedback->active()) {
4019 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glDeleteTransformFeedbacks", 4078 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glDeleteTransformFeedbacks",
4020 "Deleting transform feedback is active"); 4079 "Deleting transform feedback is active");
4021 return; 4080 return;
4022 } 4081 }
4023 if (state_.bound_transform_feedback.get() == transform_feedback) { 4082 if (state_.bound_transform_feedback.get() == transform_feedback) {
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 if (offscreen_resolved_color_texture_.get()) 4976 if (offscreen_resolved_color_texture_.get())
4918 offscreen_resolved_color_texture_->Destroy(); 4977 offscreen_resolved_color_texture_->Destroy();
4919 offscreen_resolved_color_texture_.reset(); 4978 offscreen_resolved_color_texture_.reset();
4920 offscreen_resolved_frame_buffer_.reset(); 4979 offscreen_resolved_frame_buffer_.reset();
4921 4980
4922 return true; 4981 return true;
4923 } 4982 }
4924 4983
4925 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM( 4984 error::Error GLES2DecoderImpl::HandleResizeCHROMIUM(
4926 uint32_t immediate_data_size, 4985 uint32_t immediate_data_size,
4927 const void* cmd_data) { 4986 const volatile void* cmd_data) {
4928 const gles2::cmds::ResizeCHROMIUM& c = 4987 const volatile gles2::cmds::ResizeCHROMIUM& c =
4929 *static_cast<const gles2::cmds::ResizeCHROMIUM*>(cmd_data); 4988 *static_cast<const volatile gles2::cmds::ResizeCHROMIUM*>(cmd_data);
4930 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws()) 4989 if (!offscreen_target_frame_buffer_.get() && surface_->DeferDraws())
4931 return error::kDeferCommandUntilLater; 4990 return error::kDeferCommandUntilLater;
4932 4991
4933 GLuint width = static_cast<GLuint>(c.width); 4992 GLuint width = static_cast<GLuint>(c.width);
4934 GLuint height = static_cast<GLuint>(c.height); 4993 GLuint height = static_cast<GLuint>(c.height);
4935 GLfloat scale_factor = c.scale_factor; 4994 GLfloat scale_factor = c.scale_factor;
4936 GLboolean has_alpha = c.alpha; 4995 GLboolean has_alpha = c.alpha;
4937 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height); 4996 TRACE_EVENT2("gpu", "glResizeChromium", "width", width, "height", height);
4938 4997
4939 width = std::max(1U, width); 4998 width = std::max(1U, width);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4981 } 5040 }
4982 5041
4983 // Decode multiple commands, and call the corresponding GL functions. 5042 // Decode multiple commands, and call the corresponding GL functions.
4984 // NOTE: 'buffer' is a pointer to the command buffer. As such, it could be 5043 // NOTE: 'buffer' is a pointer to the command buffer. As such, it could be
4985 // changed by a (malicious) client at any time, so if validation has to happen, 5044 // changed by a (malicious) client at any time, so if validation has to happen,
4986 // it should operate on a copy of them. 5045 // it should operate on a copy of them.
4987 // NOTE: This is duplicating code from AsyncAPIInterface::DoCommands() in the 5046 // NOTE: This is duplicating code from AsyncAPIInterface::DoCommands() in the
4988 // interest of performance in this critical execution loop. 5047 // interest of performance in this critical execution loop.
4989 template <bool DebugImpl> 5048 template <bool DebugImpl>
4990 error::Error GLES2DecoderImpl::DoCommandsImpl(unsigned int num_commands, 5049 error::Error GLES2DecoderImpl::DoCommandsImpl(unsigned int num_commands,
4991 const void* buffer, 5050 const volatile void* buffer,
4992 int num_entries, 5051 int num_entries,
4993 int* entries_processed) { 5052 int* entries_processed) {
4994 commands_to_process_ = num_commands; 5053 commands_to_process_ = num_commands;
4995 error::Error result = error::kNoError; 5054 error::Error result = error::kNoError;
4996 const CommandBufferEntry* cmd_data = 5055 const volatile CommandBufferEntry* cmd_data =
4997 static_cast<const CommandBufferEntry*>(buffer); 5056 static_cast<const volatile CommandBufferEntry*>(buffer);
4998 int process_pos = 0; 5057 int process_pos = 0;
4999 unsigned int command = 0; 5058 unsigned int command = 0;
5000 5059
5001 while (process_pos < num_entries && result == error::kNoError && 5060 while (process_pos < num_entries && result == error::kNoError &&
5002 commands_to_process_--) { 5061 commands_to_process_--) {
5003 const unsigned int size = cmd_data->value_header.size; 5062 const unsigned int size = cmd_data->value_header.size;
5004 command = cmd_data->value_header.command; 5063 command = cmd_data->value_header.command;
5005 5064
5006 if (size == 0) { 5065 if (size == 0) {
5007 result = error::kInvalidSize; 5066 result = error::kInvalidSize;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 5135
5077 if (error::IsError(result)) { 5136 if (error::IsError(result)) {
5078 LOG(ERROR) << "Error: " << result << " for Command " 5137 LOG(ERROR) << "Error: " << result << " for Command "
5079 << GetCommandName(command); 5138 << GetCommandName(command);
5080 } 5139 }
5081 5140
5082 return result; 5141 return result;
5083 } 5142 }
5084 5143
5085 error::Error GLES2DecoderImpl::DoCommands(unsigned int num_commands, 5144 error::Error GLES2DecoderImpl::DoCommands(unsigned int num_commands,
5086 const void* buffer, 5145 const volatile void* buffer,
5087 int num_entries, 5146 int num_entries,
5088 int* entries_processed) { 5147 int* entries_processed) {
5089 if (gpu_debug_commands_) { 5148 if (gpu_debug_commands_) {
5090 return DoCommandsImpl<true>( 5149 return DoCommandsImpl<true>(
5091 num_commands, buffer, num_entries, entries_processed); 5150 num_commands, buffer, num_entries, entries_processed);
5092 } else { 5151 } else {
5093 return DoCommandsImpl<false>( 5152 return DoCommandsImpl<false>(
5094 num_commands, buffer, num_entries, entries_processed); 5153 num_commands, buffer, num_entries, entries_processed);
5095 } 5154 }
5096 } 5155 }
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
5696 if (index != 0 || gl_version_info().BehavesLikeGLES()) { 5755 if (index != 0 || gl_version_info().BehavesLikeGLES()) {
5697 glDisableVertexAttribArray(index); 5756 glDisableVertexAttribArray(index);
5698 } 5757 }
5699 } else { 5758 } else {
5700 LOCAL_SET_GL_ERROR( 5759 LOCAL_SET_GL_ERROR(
5701 GL_INVALID_VALUE, 5760 GL_INVALID_VALUE,
5702 "glDisableVertexAttribArray", "index out of range"); 5761 "glDisableVertexAttribArray", "index out of range");
5703 } 5762 }
5704 } 5763 }
5705 5764
5706 void GLES2DecoderImpl::InvalidateFramebufferImpl(GLenum target, 5765 void GLES2DecoderImpl::InvalidateFramebufferImpl(
5707 GLsizei count, 5766 GLenum target,
5708 const GLenum* attachments, 5767 GLsizei count,
5709 GLint x, 5768 const volatile GLenum* attachments,
5710 GLint y, 5769 GLint x,
5711 GLsizei width, 5770 GLint y,
5712 GLsizei height, 5771 GLsizei width,
5713 const char* function_name, 5772 GLsizei height,
5714 FramebufferOperation op) { 5773 const char* function_name,
5774 FramebufferOperation op) {
5715 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); 5775 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
5716 5776
5717 // Because of performance issues, no-op if the format of the attachment is 5777 // Because of performance issues, no-op if the format of the attachment is
5718 // DEPTH_STENCIL and only one part is intended to be invalidated. 5778 // DEPTH_STENCIL and only one part is intended to be invalidated.
5719 bool has_depth_stencil_format = framebuffer && 5779 bool has_depth_stencil_format = framebuffer &&
5720 framebuffer->HasDepthStencilFormatAttachment(); 5780 framebuffer->HasDepthStencilFormatAttachment();
5721 bool invalidate_depth = false; 5781 bool invalidate_depth = false;
5722 bool invalidate_stencil = false; 5782 bool invalidate_stencil = false;
5723 std::unique_ptr<GLenum[]> validated_attachments(new GLenum[count]); 5783 std::unique_ptr<GLenum[]> validated_attachments(new GLenum[count]);
5724 GLsizei validated_count = 0; 5784 GLsizei validated_count = 0;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
5859 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; 5919 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT;
5860 break; 5920 break;
5861 default: 5921 default:
5862 NOTREACHED(); 5922 NOTREACHED();
5863 break; 5923 break;
5864 } 5924 }
5865 } 5925 }
5866 } 5926 }
5867 } 5927 }
5868 5928
5869 void GLES2DecoderImpl::DoDiscardFramebufferEXT(GLenum target, 5929 void GLES2DecoderImpl::DoDiscardFramebufferEXT(
5870 GLsizei count, 5930 GLenum target,
5871 const GLenum* attachments) { 5931 GLsizei count,
5932 const volatile GLenum* attachments) {
5872 if (workarounds().disable_discard_framebuffer) 5933 if (workarounds().disable_discard_framebuffer)
5873 return; 5934 return;
5874 5935
5875 const GLsizei kWidthNotUsed = 1; 5936 const GLsizei kWidthNotUsed = 1;
5876 const GLsizei kHeightNotUsed = 1; 5937 const GLsizei kHeightNotUsed = 1;
5877 InvalidateFramebufferImpl( 5938 InvalidateFramebufferImpl(
5878 target, count, attachments, 0, 0, kWidthNotUsed, kHeightNotUsed, 5939 target, count, attachments, 0, 0, kWidthNotUsed, kHeightNotUsed,
5879 "glDiscardFramebufferEXT", kFramebufferDiscard); 5940 "glDiscardFramebufferEXT", kFramebufferDiscard);
5880 } 5941 }
5881 5942
5882 void GLES2DecoderImpl::DoInvalidateFramebuffer( 5943 void GLES2DecoderImpl::DoInvalidateFramebuffer(
5883 GLenum target, GLsizei count, const GLenum* attachments) { 5944 GLenum target,
5945 GLsizei count,
5946 const volatile GLenum* attachments) {
5884 const GLsizei kWidthNotUsed = 1; 5947 const GLsizei kWidthNotUsed = 1;
5885 const GLsizei kHeightNotUsed = 1; 5948 const GLsizei kHeightNotUsed = 1;
5886 InvalidateFramebufferImpl( 5949 InvalidateFramebufferImpl(
5887 target, count, attachments, 0, 0, kWidthNotUsed, kHeightNotUsed, 5950 target, count, attachments, 0, 0, kWidthNotUsed, kHeightNotUsed,
5888 "glInvalidateFramebuffer", kFramebufferInvalidate); 5951 "glInvalidateFramebuffer", kFramebufferInvalidate);
5889 } 5952 }
5890 5953
5891 void GLES2DecoderImpl::DoInvalidateSubFramebuffer( 5954 void GLES2DecoderImpl::DoInvalidateSubFramebuffer(
5892 GLenum target, GLsizei count, const GLenum* attachments, 5955 GLenum target,
5893 GLint x, GLint y, GLsizei width, GLsizei height) { 5956 GLsizei count,
5957 const volatile GLenum* attachments,
5958 GLint x,
5959 GLint y,
5960 GLsizei width,
5961 GLsizei height) {
5894 InvalidateFramebufferImpl( 5962 InvalidateFramebufferImpl(
5895 target, count, attachments, x, y, width, height, 5963 target, count, attachments, x, y, width, height,
5896 "glInvalidateSubFramebuffer", kFramebufferInvalidateSub); 5964 "glInvalidateSubFramebuffer", kFramebufferInvalidateSub);
5897 } 5965 }
5898 5966
5899 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { 5967 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) {
5900 if (state_.vertex_attrib_manager->Enable(index, true)) { 5968 if (state_.vertex_attrib_manager->Enable(index, true)) {
5901 glEnableVertexAttribArray(index); 5969 glEnableVertexAttribArray(index);
5902 } else { 5970 } else {
5903 LOCAL_SET_GL_ERROR( 5971 LOCAL_SET_GL_ERROR(
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
6692 // glBindAttribLocation call with original name is useless. 6760 // glBindAttribLocation call with original name is useless.
6693 // So instead, we should simply cache the binding, and then call 6761 // So instead, we should simply cache the binding, and then call
6694 // Program::ExecuteBindAttribLocationCalls() right before link. 6762 // Program::ExecuteBindAttribLocationCalls() right before link.
6695 program->SetAttribLocationBinding(name, static_cast<GLint>(index)); 6763 program->SetAttribLocationBinding(name, static_cast<GLint>(index));
6696 // TODO(zmo): Get rid of the following glBindAttribLocation call. 6764 // TODO(zmo): Get rid of the following glBindAttribLocation call.
6697 glBindAttribLocation(program->service_id(), index, name.c_str()); 6765 glBindAttribLocation(program->service_id(), index, name.c_str());
6698 } 6766 }
6699 6767
6700 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket( 6768 error::Error GLES2DecoderImpl::HandleBindAttribLocationBucket(
6701 uint32_t immediate_data_size, 6769 uint32_t immediate_data_size,
6702 const void* cmd_data) { 6770 const volatile void* cmd_data) {
6703 const gles2::cmds::BindAttribLocationBucket& c = 6771 const volatile gles2::cmds::BindAttribLocationBucket& c =
6704 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); 6772 *static_cast<const volatile gles2::cmds::BindAttribLocationBucket*>(
6773 cmd_data);
6705 GLuint program = static_cast<GLuint>(c.program); 6774 GLuint program = static_cast<GLuint>(c.program);
6706 GLuint index = static_cast<GLuint>(c.index); 6775 GLuint index = static_cast<GLuint>(c.index);
6707 Bucket* bucket = GetBucket(c.name_bucket_id); 6776 Bucket* bucket = GetBucket(c.name_bucket_id);
6708 if (!bucket || bucket->size() == 0) { 6777 if (!bucket || bucket->size() == 0) {
6709 return error::kInvalidArguments; 6778 return error::kInvalidArguments;
6710 } 6779 }
6711 std::string name_str; 6780 std::string name_str;
6712 if (!bucket->GetAsString(&name_str)) { 6781 if (!bucket->GetAsString(&name_str)) {
6713 return error::kInvalidArguments; 6782 return error::kInvalidArguments;
6714 } 6783 }
(...skipping 21 matching lines...) Expand all
6736 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); 6805 Program* program = GetProgramInfoNotShader(program_id, kFunctionName);
6737 if (!program) { 6806 if (!program) {
6738 return error::kNoError; 6807 return error::kNoError;
6739 } 6808 }
6740 program->SetProgramOutputLocationBinding(name, colorName); 6809 program->SetProgramOutputLocationBinding(name, colorName);
6741 return error::kNoError; 6810 return error::kNoError;
6742 } 6811 }
6743 6812
6744 error::Error GLES2DecoderImpl::HandleBindFragDataLocationEXTBucket( 6813 error::Error GLES2DecoderImpl::HandleBindFragDataLocationEXTBucket(
6745 uint32_t immediate_data_size, 6814 uint32_t immediate_data_size,
6746 const void* cmd_data) { 6815 const volatile void* cmd_data) {
6747 if (!features().ext_blend_func_extended) { 6816 if (!features().ext_blend_func_extended) {
6748 return error::kUnknownCommand; 6817 return error::kUnknownCommand;
6749 } 6818 }
6750 const gles2::cmds::BindFragDataLocationEXTBucket& c = 6819 const volatile gles2::cmds::BindFragDataLocationEXTBucket& c =
6751 *static_cast<const gles2::cmds::BindFragDataLocationEXTBucket*>(cmd_data); 6820 *static_cast<const volatile gles2::cmds::BindFragDataLocationEXTBucket*>(
6821 cmd_data);
6752 GLuint program = static_cast<GLuint>(c.program); 6822 GLuint program = static_cast<GLuint>(c.program);
6753 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); 6823 GLuint colorNumber = static_cast<GLuint>(c.colorNumber);
6754 Bucket* bucket = GetBucket(c.name_bucket_id); 6824 Bucket* bucket = GetBucket(c.name_bucket_id);
6755 if (!bucket || bucket->size() == 0) { 6825 if (!bucket || bucket->size() == 0) {
6756 return error::kInvalidArguments; 6826 return error::kInvalidArguments;
6757 } 6827 }
6758 std::string name_str; 6828 std::string name_str;
6759 if (!bucket->GetAsString(&name_str)) { 6829 if (!bucket->GetAsString(&name_str)) {
6760 return error::kInvalidArguments; 6830 return error::kInvalidArguments;
6761 } 6831 }
(...skipping 27 matching lines...) Expand all
6789 Program* program = GetProgramInfoNotShader(program_id, kFunctionName); 6859 Program* program = GetProgramInfoNotShader(program_id, kFunctionName);
6790 if (!program) { 6860 if (!program) {
6791 return error::kNoError; 6861 return error::kNoError;
6792 } 6862 }
6793 program->SetProgramOutputLocationIndexedBinding(name, colorName, index); 6863 program->SetProgramOutputLocationIndexedBinding(name, colorName, index);
6794 return error::kNoError; 6864 return error::kNoError;
6795 } 6865 }
6796 6866
6797 error::Error GLES2DecoderImpl::HandleBindFragDataLocationIndexedEXTBucket( 6867 error::Error GLES2DecoderImpl::HandleBindFragDataLocationIndexedEXTBucket(
6798 uint32_t immediate_data_size, 6868 uint32_t immediate_data_size,
6799 const void* cmd_data) { 6869 const volatile void* cmd_data) {
6800 if (!features().ext_blend_func_extended) { 6870 if (!features().ext_blend_func_extended) {
6801 return error::kUnknownCommand; 6871 return error::kUnknownCommand;
6802 } 6872 }
6803 const gles2::cmds::BindFragDataLocationIndexedEXTBucket& c = 6873 const volatile gles2::cmds::BindFragDataLocationIndexedEXTBucket& c =
6804 *static_cast<const gles2::cmds::BindFragDataLocationIndexedEXTBucket*>( 6874 *static_cast<
6875 const volatile gles2::cmds::BindFragDataLocationIndexedEXTBucket*>(
6805 cmd_data); 6876 cmd_data);
6806 GLuint program = static_cast<GLuint>(c.program); 6877 GLuint program = static_cast<GLuint>(c.program);
6807 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); 6878 GLuint colorNumber = static_cast<GLuint>(c.colorNumber);
6808 GLuint index = static_cast<GLuint>(c.index); 6879 GLuint index = static_cast<GLuint>(c.index);
6809 Bucket* bucket = GetBucket(c.name_bucket_id); 6880 Bucket* bucket = GetBucket(c.name_bucket_id);
6810 if (!bucket || bucket->size() == 0) { 6881 if (!bucket || bucket->size() == 0) {
6811 return error::kInvalidArguments; 6882 return error::kInvalidArguments;
6812 } 6883 }
6813 std::string name_str; 6884 std::string name_str;
6814 if (!bucket->GetAsString(&name_str)) { 6885 if (!bucket->GetAsString(&name_str)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
6849 } 6920 }
6850 if (!program->SetUniformLocationBinding(name, location)) { 6921 if (!program->SetUniformLocationBinding(name, location)) {
6851 LOCAL_SET_GL_ERROR( 6922 LOCAL_SET_GL_ERROR(
6852 GL_INVALID_VALUE, 6923 GL_INVALID_VALUE,
6853 "glBindUniformLocationCHROMIUM", "location out of range"); 6924 "glBindUniformLocationCHROMIUM", "location out of range");
6854 } 6925 }
6855 } 6926 }
6856 6927
6857 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket( 6928 error::Error GLES2DecoderImpl::HandleBindUniformLocationCHROMIUMBucket(
6858 uint32_t immediate_data_size, 6929 uint32_t immediate_data_size,
6859 const void* cmd_data) { 6930 const volatile void* cmd_data) {
6860 const gles2::cmds::BindUniformLocationCHROMIUMBucket& c = 6931 const volatile gles2::cmds::BindUniformLocationCHROMIUMBucket& c =
6861 *static_cast<const gles2::cmds::BindUniformLocationCHROMIUMBucket*>( 6932 *static_cast<
6933 const volatile gles2::cmds::BindUniformLocationCHROMIUMBucket*>(
6862 cmd_data); 6934 cmd_data);
6863 GLuint program = static_cast<GLuint>(c.program); 6935 GLuint program = static_cast<GLuint>(c.program);
6864 GLint location = static_cast<GLint>(c.location); 6936 GLint location = static_cast<GLint>(c.location);
6865 Bucket* bucket = GetBucket(c.name_bucket_id); 6937 Bucket* bucket = GetBucket(c.name_bucket_id);
6866 if (!bucket || bucket->size() == 0) { 6938 if (!bucket || bucket->size() == 0) {
6867 return error::kInvalidArguments; 6939 return error::kInvalidArguments;
6868 } 6940 }
6869 std::string name_str; 6941 std::string name_str;
6870 if (!bucket->GetAsString(&name_str)) { 6942 if (!bucket->GetAsString(&name_str)) {
6871 return error::kInvalidArguments; 6943 return error::kInvalidArguments;
6872 } 6944 }
6873 DoBindUniformLocationCHROMIUM(program, location, name_str); 6945 DoBindUniformLocationCHROMIUM(program, location, name_str);
6874 return error::kNoError; 6946 return error::kNoError;
6875 } 6947 }
6876 6948
6877 error::Error GLES2DecoderImpl::HandleDeleteShader(uint32_t immediate_data_size, 6949 error::Error GLES2DecoderImpl::HandleDeleteShader(
6878 const void* cmd_data) { 6950 uint32_t immediate_data_size,
6879 const gles2::cmds::DeleteShader& c = 6951 const volatile void* cmd_data) {
6880 *static_cast<const gles2::cmds::DeleteShader*>(cmd_data); 6952 const volatile gles2::cmds::DeleteShader& c =
6953 *static_cast<const volatile gles2::cmds::DeleteShader*>(cmd_data);
6881 GLuint client_id = c.shader; 6954 GLuint client_id = c.shader;
6882 if (client_id) { 6955 if (client_id) {
6883 Shader* shader = GetShader(client_id); 6956 Shader* shader = GetShader(client_id);
6884 if (shader) { 6957 if (shader) {
6885 if (!shader->IsDeleted()) { 6958 if (!shader->IsDeleted()) {
6886 shader_manager()->Delete(shader); 6959 shader_manager()->Delete(shader);
6887 } 6960 }
6888 } else { 6961 } else {
6889 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader"); 6962 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glDeleteShader", "unknown shader");
6890 } 6963 }
6891 } 6964 }
6892 return error::kNoError; 6965 return error::kNoError;
6893 } 6966 }
6894 6967
6895 error::Error GLES2DecoderImpl::HandleDeleteProgram(uint32_t immediate_data_size, 6968 error::Error GLES2DecoderImpl::HandleDeleteProgram(
6896 const void* cmd_data) { 6969 uint32_t immediate_data_size,
6897 const gles2::cmds::DeleteProgram& c = 6970 const volatile void* cmd_data) {
6898 *static_cast<const gles2::cmds::DeleteProgram*>(cmd_data); 6971 const volatile gles2::cmds::DeleteProgram& c =
6972 *static_cast<const volatile gles2::cmds::DeleteProgram*>(cmd_data);
6899 GLuint client_id = c.program; 6973 GLuint client_id = c.program;
6900 if (client_id) { 6974 if (client_id) {
6901 Program* program = GetProgram(client_id); 6975 Program* program = GetProgram(client_id);
6902 if (program) { 6976 if (program) {
6903 if (!program->IsDeleted()) { 6977 if (!program->IsDeleted()) {
6904 program_manager()->MarkAsDeleted(shader_manager(), program); 6978 program_manager()->MarkAsDeleted(shader_manager(), program);
6905 } 6979 }
6906 } else { 6980 } else {
6907 LOCAL_SET_GL_ERROR( 6981 LOCAL_SET_GL_ERROR(
6908 GL_INVALID_VALUE, "glDeleteProgram", "unknown program"); 6982 GL_INVALID_VALUE, "glDeleteProgram", "unknown program");
(...skipping 22 matching lines...) Expand all
6931 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 7005 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
6932 "can't be called on integer buffers"); 7006 "can't be called on integer buffers");
6933 return error::kNoError; 7007 return error::kNoError;
6934 } 7008 }
6935 } 7009 }
6936 glClear(mask); 7010 glClear(mask);
6937 } 7011 }
6938 return error::kNoError; 7012 return error::kNoError;
6939 } 7013 }
6940 7014
6941 void GLES2DecoderImpl::DoClearBufferiv( 7015 void GLES2DecoderImpl::DoClearBufferiv(GLenum buffer,
6942 GLenum buffer, GLint drawbuffer, const GLint* value) { 7016 GLint drawbuffer,
7017 const volatile GLint* value) {
6943 const char* func_name = "glClearBufferiv"; 7018 const char* func_name = "glClearBufferiv";
6944 if (!CheckBoundDrawFramebufferValid(func_name)) 7019 if (!CheckBoundDrawFramebufferValid(func_name))
6945 return; 7020 return;
6946 ApplyDirtyState(); 7021 ApplyDirtyState();
6947 7022
6948 if (buffer == GL_COLOR) { 7023 if (buffer == GL_COLOR) {
6949 if (drawbuffer < 0 || 7024 if (drawbuffer < 0 ||
6950 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { 7025 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) {
6951 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); 7026 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer");
6952 return; 7027 return;
6953 } 7028 }
6954 GLenum internal_format = 7029 GLenum internal_format =
6955 GetBoundColorDrawBufferInternalFormat(drawbuffer); 7030 GetBoundColorDrawBufferInternalFormat(drawbuffer);
6956 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) { 7031 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) {
6957 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 7032 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
6958 "can only be called on signed integer buffers"); 7033 "can only be called on signed integer buffers");
6959 return; 7034 return;
6960 } 7035 }
6961 } else { 7036 } else {
6962 DCHECK(buffer == GL_STENCIL); 7037 DCHECK(buffer == GL_STENCIL);
6963 if (drawbuffer != 0) { 7038 if (drawbuffer != 0) {
6964 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); 7039 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer");
6965 return; 7040 return;
6966 } 7041 }
6967 if (!BoundFramebufferHasStencilAttachment()) { 7042 if (!BoundFramebufferHasStencilAttachment()) {
6968 return; 7043 return;
6969 } 7044 }
6970 } 7045 }
6971 MarkDrawBufferAsCleared(buffer, drawbuffer); 7046 MarkDrawBufferAsCleared(buffer, drawbuffer);
6972 glClearBufferiv(buffer, drawbuffer, value); 7047 glClearBufferiv(buffer, drawbuffer, const_cast<const GLint*>(value));
6973 } 7048 }
6974 7049
6975 void GLES2DecoderImpl::DoClearBufferuiv( 7050 void GLES2DecoderImpl::DoClearBufferuiv(GLenum buffer,
6976 GLenum buffer, GLint drawbuffer, const GLuint* value) { 7051 GLint drawbuffer,
7052 const volatile GLuint* value) {
6977 const char* func_name = "glClearBufferuiv"; 7053 const char* func_name = "glClearBufferuiv";
6978 if (!CheckBoundDrawFramebufferValid(func_name)) 7054 if (!CheckBoundDrawFramebufferValid(func_name))
6979 return; 7055 return;
6980 ApplyDirtyState(); 7056 ApplyDirtyState();
6981 7057
6982 if (drawbuffer < 0 || 7058 if (drawbuffer < 0 ||
6983 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { 7059 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) {
6984 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); 7060 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer");
6985 return; 7061 return;
6986 } 7062 }
6987 GLenum internal_format = 7063 GLenum internal_format =
6988 GetBoundColorDrawBufferInternalFormat(drawbuffer); 7064 GetBoundColorDrawBufferInternalFormat(drawbuffer);
6989 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) { 7065 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) {
6990 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 7066 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
6991 "can only be called on unsigned integer buffers"); 7067 "can only be called on unsigned integer buffers");
6992 return; 7068 return;
6993 } 7069 }
6994 MarkDrawBufferAsCleared(buffer, drawbuffer); 7070 MarkDrawBufferAsCleared(buffer, drawbuffer);
6995 glClearBufferuiv(buffer, drawbuffer, value); 7071 glClearBufferuiv(buffer, drawbuffer, const_cast<const GLuint*>(value));
6996 } 7072 }
6997 7073
6998 void GLES2DecoderImpl::DoClearBufferfv( 7074 void GLES2DecoderImpl::DoClearBufferfv(GLenum buffer,
6999 GLenum buffer, GLint drawbuffer, const GLfloat* value) { 7075 GLint drawbuffer,
7076 const volatile GLfloat* value) {
7000 const char* func_name = "glClearBufferfv"; 7077 const char* func_name = "glClearBufferfv";
7001 if (!CheckBoundDrawFramebufferValid(func_name)) 7078 if (!CheckBoundDrawFramebufferValid(func_name))
7002 return; 7079 return;
7003 ApplyDirtyState(); 7080 ApplyDirtyState();
7004 7081
7005 if (buffer == GL_COLOR) { 7082 if (buffer == GL_COLOR) {
7006 if (drawbuffer < 0 || 7083 if (drawbuffer < 0 ||
7007 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { 7084 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) {
7008 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); 7085 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer");
7009 return; 7086 return;
7010 } 7087 }
7011 GLenum internal_format = 7088 GLenum internal_format =
7012 GetBoundColorDrawBufferInternalFormat(drawbuffer); 7089 GetBoundColorDrawBufferInternalFormat(drawbuffer);
7013 if (GLES2Util::IsIntegerFormat(internal_format)) { 7090 if (GLES2Util::IsIntegerFormat(internal_format)) {
7014 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, 7091 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name,
7015 "can only be called on float buffers"); 7092 "can only be called on float buffers");
7016 return; 7093 return;
7017 } 7094 }
7018 } else { 7095 } else {
7019 DCHECK(buffer == GL_DEPTH); 7096 DCHECK(buffer == GL_DEPTH);
7020 if (drawbuffer != 0) { 7097 if (drawbuffer != 0) {
7021 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer"); 7098 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, "invalid drawBuffer");
7022 return; 7099 return;
7023 } 7100 }
7024 if (!BoundFramebufferHasDepthAttachment()) { 7101 if (!BoundFramebufferHasDepthAttachment()) {
7025 return; 7102 return;
7026 } 7103 }
7027 } 7104 }
7028 MarkDrawBufferAsCleared(buffer, drawbuffer); 7105 MarkDrawBufferAsCleared(buffer, drawbuffer);
7029 glClearBufferfv(buffer, drawbuffer, value); 7106 glClearBufferfv(buffer, drawbuffer, const_cast<const GLfloat*>(value));
7030 } 7107 }
7031 7108
7032 void GLES2DecoderImpl::DoClearBufferfi( 7109 void GLES2DecoderImpl::DoClearBufferfi(
7033 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { 7110 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) {
7034 const char* func_name = "glClearBufferfi"; 7111 const char* func_name = "glClearBufferfi";
7035 if (!CheckBoundDrawFramebufferValid(func_name)) 7112 if (!CheckBoundDrawFramebufferValid(func_name))
7036 return; 7113 return;
7037 ApplyDirtyState(); 7114 ApplyDirtyState();
7038 7115
7039 if (drawbuffer != 0) { 7116 if (drawbuffer != 0) {
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
7994 Sampler* sampler = GetSampler(client_id); 8071 Sampler* sampler = GetSampler(client_id);
7995 if (!sampler) { 8072 if (!sampler) {
7996 LOCAL_SET_GL_ERROR( 8073 LOCAL_SET_GL_ERROR(
7997 GL_INVALID_VALUE, "glSamplerParameteri", "unknown sampler"); 8074 GL_INVALID_VALUE, "glSamplerParameteri", "unknown sampler");
7998 return; 8075 return;
7999 } 8076 }
8000 sampler_manager()->SetParameteri( 8077 sampler_manager()->SetParameteri(
8001 "glSamplerParameteri", GetErrorState(), sampler, pname, param); 8078 "glSamplerParameteri", GetErrorState(), sampler, pname, param);
8002 } 8079 }
8003 8080
8004 void GLES2DecoderImpl::DoSamplerParameterfv( 8081 void GLES2DecoderImpl::DoSamplerParameterfv(GLuint client_id,
8005 GLuint client_id, GLenum pname, const GLfloat* params) { 8082 GLenum pname,
8083 const volatile GLfloat* params) {
8006 DCHECK(params); 8084 DCHECK(params);
8007 Sampler* sampler = GetSampler(client_id); 8085 Sampler* sampler = GetSampler(client_id);
8008 if (!sampler) { 8086 if (!sampler) {
8009 LOCAL_SET_GL_ERROR( 8087 LOCAL_SET_GL_ERROR(
8010 GL_INVALID_VALUE, "glSamplerParameterfv", "unknown sampler"); 8088 GL_INVALID_VALUE, "glSamplerParameterfv", "unknown sampler");
8011 return; 8089 return;
8012 } 8090 }
8013 sampler_manager()->SetParameterf( 8091 sampler_manager()->SetParameterf(
8014 "glSamplerParameterfv", GetErrorState(), sampler, pname, params[0]); 8092 "glSamplerParameterfv", GetErrorState(), sampler, pname, params[0]);
8015 } 8093 }
8016 8094
8017 void GLES2DecoderImpl::DoSamplerParameteriv( 8095 void GLES2DecoderImpl::DoSamplerParameteriv(GLuint client_id,
8018 GLuint client_id, GLenum pname, const GLint* params) { 8096 GLenum pname,
8097 const volatile GLint* params) {
8019 DCHECK(params); 8098 DCHECK(params);
8020 Sampler* sampler = GetSampler(client_id); 8099 Sampler* sampler = GetSampler(client_id);
8021 if (!sampler) { 8100 if (!sampler) {
8022 LOCAL_SET_GL_ERROR( 8101 LOCAL_SET_GL_ERROR(
8023 GL_INVALID_VALUE, "glSamplerParameteriv", "unknown sampler"); 8102 GL_INVALID_VALUE, "glSamplerParameteriv", "unknown sampler");
8024 return; 8103 return;
8025 } 8104 }
8026 sampler_manager()->SetParameteri( 8105 sampler_manager()->SetParameteri(
8027 "glSamplerParameteriv", GetErrorState(), sampler, pname, params[0]); 8106 "glSamplerParameteriv", GetErrorState(), sampler, pname, params[0]);
8028 } 8107 }
(...skipping 17 matching lines...) Expand all
8046 &state_, target); 8125 &state_, target);
8047 if (!texture) { 8126 if (!texture) {
8048 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameteri", "unknown texture"); 8127 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameteri", "unknown texture");
8049 return; 8128 return;
8050 } 8129 }
8051 8130
8052 texture_manager()->SetParameteri( 8131 texture_manager()->SetParameteri(
8053 "glTexParameteri", GetErrorState(), texture, pname, param); 8132 "glTexParameteri", GetErrorState(), texture, pname, param);
8054 } 8133 }
8055 8134
8056 void GLES2DecoderImpl::DoTexParameterfv( 8135 void GLES2DecoderImpl::DoTexParameterfv(GLenum target,
8057 GLenum target, GLenum pname, const GLfloat* params) { 8136 GLenum pname,
8137 const volatile GLfloat* params) {
8058 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 8138 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
8059 &state_, target); 8139 &state_, target);
8060 if (!texture) { 8140 if (!texture) {
8061 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); 8141 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture");
8062 return; 8142 return;
8063 } 8143 }
8064 8144
8065 texture_manager()->SetParameterf( 8145 texture_manager()->SetParameterf(
8066 "glTexParameterfv", GetErrorState(), texture, pname, *params); 8146 "glTexParameterfv", GetErrorState(), texture, pname, *params);
8067 } 8147 }
8068 8148
8069 void GLES2DecoderImpl::DoTexParameteriv( 8149 void GLES2DecoderImpl::DoTexParameteriv(GLenum target,
8070 GLenum target, GLenum pname, const GLint* params) { 8150 GLenum pname,
8151 const volatile GLint* params) {
8071 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 8152 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
8072 &state_, target); 8153 &state_, target);
8073 if (!texture) { 8154 if (!texture) {
8074 LOCAL_SET_GL_ERROR( 8155 LOCAL_SET_GL_ERROR(
8075 GL_INVALID_VALUE, "glTexParameteriv", "unknown texture"); 8156 GL_INVALID_VALUE, "glTexParameteriv", "unknown texture");
8076 return; 8157 return;
8077 } 8158 }
8078 8159
8079 texture_manager()->SetParameteri( 8160 texture_manager()->SetParameteri(
8080 "glTexParameteriv", GetErrorState(), texture, pname, *params); 8161 "glTexParameteriv", GetErrorState(), texture, pname, *params);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
8247 state_.texture_units.size(), fake_location, 1, &v0)) { 8328 state_.texture_units.size(), fake_location, 1, &v0)) {
8248 LOCAL_SET_GL_ERROR( 8329 LOCAL_SET_GL_ERROR(
8249 GL_INVALID_VALUE, "glUniform1i", "texture unit out of range"); 8330 GL_INVALID_VALUE, "glUniform1i", "texture unit out of range");
8250 return; 8331 return;
8251 } 8332 }
8252 glUniform1i(real_location, v0); 8333 glUniform1i(real_location, v0);
8253 } 8334 }
8254 8335
8255 void GLES2DecoderImpl::DoUniform1iv(GLint fake_location, 8336 void GLES2DecoderImpl::DoUniform1iv(GLint fake_location,
8256 GLsizei count, 8337 GLsizei count,
8257 const GLint* values) { 8338 const volatile GLint* values) {
8258 GLenum type = 0; 8339 GLenum type = 0;
8259 GLint real_location = -1; 8340 GLint real_location = -1;
8260 if (!PrepForSetUniformByLocation(fake_location, 8341 if (!PrepForSetUniformByLocation(fake_location,
8261 "glUniform1iv", 8342 "glUniform1iv",
8262 Program::kUniform1i, 8343 Program::kUniform1i,
8263 &real_location, 8344 &real_location,
8264 &type, 8345 &type,
8265 &count)) { 8346 &count)) {
8266 return; 8347 return;
8267 } 8348 }
8268 auto values_copy = base::MakeUnique<GLint[]>(count); 8349 auto values_copy = base::MakeUnique<GLint[]>(count);
8269 GLint* safe_values = values_copy.get(); 8350 GLint* safe_values = values_copy.get();
8270 std::copy(values, values + count, safe_values); 8351 std::copy(values, values + count, safe_values);
8271 if (type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB || 8352 if (type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB ||
8272 type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES) { 8353 type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES) {
8273 if (!state_.current_program->SetSamplers( 8354 if (!state_.current_program->SetSamplers(
8274 state_.texture_units.size(), fake_location, count, safe_values)) { 8355 state_.texture_units.size(), fake_location, count, safe_values)) {
8275 LOCAL_SET_GL_ERROR( 8356 LOCAL_SET_GL_ERROR(
8276 GL_INVALID_VALUE, "glUniform1iv", "texture unit out of range"); 8357 GL_INVALID_VALUE, "glUniform1iv", "texture unit out of range");
8277 return; 8358 return;
8278 } 8359 }
8279 } 8360 }
8280 glUniform1iv(real_location, count, safe_values); 8361 glUniform1iv(real_location, count, safe_values);
8281 } 8362 }
8282 8363
8283 void GLES2DecoderImpl::DoUniform1uiv( 8364 void GLES2DecoderImpl::DoUniform1uiv(GLint fake_location,
8284 GLint fake_location, GLsizei count, const GLuint *value) { 8365 GLsizei count,
8366 const volatile GLuint* value) {
8285 GLenum type = 0; 8367 GLenum type = 0;
8286 GLint real_location = -1; 8368 GLint real_location = -1;
8287 if (!PrepForSetUniformByLocation(fake_location, 8369 if (!PrepForSetUniformByLocation(fake_location,
8288 "glUniform1uiv", 8370 "glUniform1uiv",
8289 Program::kUniform1ui, 8371 Program::kUniform1ui,
8290 &real_location, 8372 &real_location,
8291 &type, 8373 &type,
8292 &count)) { 8374 &count)) {
8293 return; 8375 return;
8294 } 8376 }
8295 glUniform1uiv(real_location, count, value); 8377 glUniform1uiv(real_location, count, const_cast<const GLuint*>(value));
8296 } 8378 }
8297 8379
8298 void GLES2DecoderImpl::DoUniform1fv( 8380 void GLES2DecoderImpl::DoUniform1fv(GLint fake_location,
8299 GLint fake_location, GLsizei count, const GLfloat* value) { 8381 GLsizei count,
8382 const volatile GLfloat* value) {
8300 GLenum type = 0; 8383 GLenum type = 0;
8301 GLint real_location = -1; 8384 GLint real_location = -1;
8302 if (!PrepForSetUniformByLocation(fake_location, 8385 if (!PrepForSetUniformByLocation(fake_location,
8303 "glUniform1fv", 8386 "glUniform1fv",
8304 Program::kUniform1f, 8387 Program::kUniform1f,
8305 &real_location, 8388 &real_location,
8306 &type, 8389 &type,
8307 &count)) { 8390 &count)) {
8308 return; 8391 return;
8309 } 8392 }
8310 if (type == GL_BOOL) { 8393 if (type == GL_BOOL) {
8311 std::unique_ptr<GLint[]> temp(new GLint[count]); 8394 std::unique_ptr<GLint[]> temp(new GLint[count]);
8312 for (GLsizei ii = 0; ii < count; ++ii) { 8395 for (GLsizei ii = 0; ii < count; ++ii) {
8313 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); 8396 temp[ii] = static_cast<GLint>(value[ii] != 0.0f);
8314 } 8397 }
8315 glUniform1iv(real_location, count, temp.get()); 8398 glUniform1iv(real_location, count, temp.get());
8316 } else { 8399 } else {
8317 glUniform1fv(real_location, count, value); 8400 glUniform1fv(real_location, count, const_cast<const GLfloat*>(value));
8318 } 8401 }
8319 } 8402 }
8320 8403
8321 void GLES2DecoderImpl::DoUniform2fv( 8404 void GLES2DecoderImpl::DoUniform2fv(GLint fake_location,
8322 GLint fake_location, GLsizei count, const GLfloat* value) { 8405 GLsizei count,
8406 const volatile GLfloat* value) {
8323 GLenum type = 0; 8407 GLenum type = 0;
8324 GLint real_location = -1; 8408 GLint real_location = -1;
8325 if (!PrepForSetUniformByLocation(fake_location, 8409 if (!PrepForSetUniformByLocation(fake_location,
8326 "glUniform2fv", 8410 "glUniform2fv",
8327 Program::kUniform2f, 8411 Program::kUniform2f,
8328 &real_location, 8412 &real_location,
8329 &type, 8413 &type,
8330 &count)) { 8414 &count)) {
8331 return; 8415 return;
8332 } 8416 }
8333 if (type == GL_BOOL_VEC2) { 8417 if (type == GL_BOOL_VEC2) {
8334 GLsizei num_values = count * 2; 8418 GLsizei num_values = count * 2;
8335 std::unique_ptr<GLint[]> temp(new GLint[num_values]); 8419 std::unique_ptr<GLint[]> temp(new GLint[num_values]);
8336 for (GLsizei ii = 0; ii < num_values; ++ii) { 8420 for (GLsizei ii = 0; ii < num_values; ++ii) {
8337 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); 8421 temp[ii] = static_cast<GLint>(value[ii] != 0.0f);
8338 } 8422 }
8339 glUniform2iv(real_location, count, temp.get()); 8423 glUniform2iv(real_location, count, temp.get());
8340 } else { 8424 } else {
8341 glUniform2fv(real_location, count, value); 8425 glUniform2fv(real_location, count, const_cast<const GLfloat*>(value));
8342 } 8426 }
8343 } 8427 }
8344 8428
8345 void GLES2DecoderImpl::DoUniform3fv( 8429 void GLES2DecoderImpl::DoUniform3fv(GLint fake_location,
8346 GLint fake_location, GLsizei count, const GLfloat* value) { 8430 GLsizei count,
8431 const volatile GLfloat* value) {
8347 GLenum type = 0; 8432 GLenum type = 0;
8348 GLint real_location = -1; 8433 GLint real_location = -1;
8349 if (!PrepForSetUniformByLocation(fake_location, 8434 if (!PrepForSetUniformByLocation(fake_location,
8350 "glUniform3fv", 8435 "glUniform3fv",
8351 Program::kUniform3f, 8436 Program::kUniform3f,
8352 &real_location, 8437 &real_location,
8353 &type, 8438 &type,
8354 &count)) { 8439 &count)) {
8355 return; 8440 return;
8356 } 8441 }
8357 if (type == GL_BOOL_VEC3) { 8442 if (type == GL_BOOL_VEC3) {
8358 GLsizei num_values = count * 3; 8443 GLsizei num_values = count * 3;
8359 std::unique_ptr<GLint[]> temp(new GLint[num_values]); 8444 std::unique_ptr<GLint[]> temp(new GLint[num_values]);
8360 for (GLsizei ii = 0; ii < num_values; ++ii) { 8445 for (GLsizei ii = 0; ii < num_values; ++ii) {
8361 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); 8446 temp[ii] = static_cast<GLint>(value[ii] != 0.0f);
8362 } 8447 }
8363 glUniform3iv(real_location, count, temp.get()); 8448 glUniform3iv(real_location, count, temp.get());
8364 } else { 8449 } else {
8365 glUniform3fv(real_location, count, value); 8450 glUniform3fv(real_location, count, const_cast<const GLfloat*>(value));
8366 } 8451 }
8367 } 8452 }
8368 8453
8369 void GLES2DecoderImpl::DoUniform4fv( 8454 void GLES2DecoderImpl::DoUniform4fv(GLint fake_location,
8370 GLint fake_location, GLsizei count, const GLfloat* value) { 8455 GLsizei count,
8456 const volatile GLfloat* value) {
8371 GLenum type = 0; 8457 GLenum type = 0;
8372 GLint real_location = -1; 8458 GLint real_location = -1;
8373 if (!PrepForSetUniformByLocation(fake_location, 8459 if (!PrepForSetUniformByLocation(fake_location,
8374 "glUniform4fv", 8460 "glUniform4fv",
8375 Program::kUniform4f, 8461 Program::kUniform4f,
8376 &real_location, 8462 &real_location,
8377 &type, 8463 &type,
8378 &count)) { 8464 &count)) {
8379 return; 8465 return;
8380 } 8466 }
8381 if (type == GL_BOOL_VEC4) { 8467 if (type == GL_BOOL_VEC4) {
8382 GLsizei num_values = count * 4; 8468 GLsizei num_values = count * 4;
8383 std::unique_ptr<GLint[]> temp(new GLint[num_values]); 8469 std::unique_ptr<GLint[]> temp(new GLint[num_values]);
8384 for (GLsizei ii = 0; ii < num_values; ++ii) { 8470 for (GLsizei ii = 0; ii < num_values; ++ii) {
8385 temp[ii] = static_cast<GLint>(value[ii] != 0.0f); 8471 temp[ii] = static_cast<GLint>(value[ii] != 0.0f);
8386 } 8472 }
8387 glUniform4iv(real_location, count, temp.get()); 8473 glUniform4iv(real_location, count, temp.get());
8388 } else { 8474 } else {
8389 glUniform4fv(real_location, count, value); 8475 glUniform4fv(real_location, count, const_cast<const GLfloat*>(value));
8390 } 8476 }
8391 } 8477 }
8392 8478
8393 void GLES2DecoderImpl::DoUniform2iv( 8479 void GLES2DecoderImpl::DoUniform2iv(GLint fake_location,
8394 GLint fake_location, GLsizei count, const GLint* value) { 8480 GLsizei count,
8481 const volatile GLint* value) {
8395 GLenum type = 0; 8482 GLenum type = 0;
8396 GLint real_location = -1; 8483 GLint real_location = -1;
8397 if (!PrepForSetUniformByLocation(fake_location, 8484 if (!PrepForSetUniformByLocation(fake_location,
8398 "glUniform2iv", 8485 "glUniform2iv",
8399 Program::kUniform2i, 8486 Program::kUniform2i,
8400 &real_location, 8487 &real_location,
8401 &type, 8488 &type,
8402 &count)) { 8489 &count)) {
8403 return; 8490 return;
8404 } 8491 }
8405 glUniform2iv(real_location, count, value); 8492 glUniform2iv(real_location, count, const_cast<const GLint*>(value));
8406 } 8493 }
8407 8494
8408 void GLES2DecoderImpl::DoUniform2uiv( 8495 void GLES2DecoderImpl::DoUniform2uiv(GLint fake_location,
8409 GLint fake_location, GLsizei count, const GLuint* value) { 8496 GLsizei count,
8497 const volatile GLuint* value) {
8410 GLenum type = 0; 8498 GLenum type = 0;
8411 GLint real_location = -1; 8499 GLint real_location = -1;
8412 if (!PrepForSetUniformByLocation(fake_location, 8500 if (!PrepForSetUniformByLocation(fake_location,
8413 "glUniform2uiv", 8501 "glUniform2uiv",
8414 Program::kUniform2ui, 8502 Program::kUniform2ui,
8415 &real_location, 8503 &real_location,
8416 &type, 8504 &type,
8417 &count)) { 8505 &count)) {
8418 return; 8506 return;
8419 } 8507 }
8420 glUniform2uiv(real_location, count, value); 8508 glUniform2uiv(real_location, count, const_cast<const GLuint*>(value));
8421 } 8509 }
8422 8510
8423 void GLES2DecoderImpl::DoUniform3iv( 8511 void GLES2DecoderImpl::DoUniform3iv(GLint fake_location,
8424 GLint fake_location, GLsizei count, const GLint* value) { 8512 GLsizei count,
8513 const volatile GLint* value) {
8425 GLenum type = 0; 8514 GLenum type = 0;
8426 GLint real_location = -1; 8515 GLint real_location = -1;
8427 if (!PrepForSetUniformByLocation(fake_location, 8516 if (!PrepForSetUniformByLocation(fake_location,
8428 "glUniform3iv", 8517 "glUniform3iv",
8429 Program::kUniform3i, 8518 Program::kUniform3i,
8430 &real_location, 8519 &real_location,
8431 &type, 8520 &type,
8432 &count)) { 8521 &count)) {
8433 return; 8522 return;
8434 } 8523 }
8435 glUniform3iv(real_location, count, value); 8524 glUniform3iv(real_location, count, const_cast<const GLint*>(value));
8436 } 8525 }
8437 8526
8438 void GLES2DecoderImpl::DoUniform3uiv( 8527 void GLES2DecoderImpl::DoUniform3uiv(GLint fake_location,
8439 GLint fake_location, GLsizei count, const GLuint* value) { 8528 GLsizei count,
8529 const volatile GLuint* value) {
8440 GLenum type = 0; 8530 GLenum type = 0;
8441 GLint real_location = -1; 8531 GLint real_location = -1;
8442 if (!PrepForSetUniformByLocation(fake_location, 8532 if (!PrepForSetUniformByLocation(fake_location,
8443 "glUniform3uiv", 8533 "glUniform3uiv",
8444 Program::kUniform3ui, 8534 Program::kUniform3ui,
8445 &real_location, 8535 &real_location,
8446 &type, 8536 &type,
8447 &count)) { 8537 &count)) {
8448 return; 8538 return;
8449 } 8539 }
8450 glUniform3uiv(real_location, count, value); 8540 glUniform3uiv(real_location, count, const_cast<const GLuint*>(value));
8451 } 8541 }
8452 8542
8453 void GLES2DecoderImpl::DoUniform4iv( 8543 void GLES2DecoderImpl::DoUniform4iv(GLint fake_location,
8454 GLint fake_location, GLsizei count, const GLint* value) { 8544 GLsizei count,
8545 const volatile GLint* value) {
8455 GLenum type = 0; 8546 GLenum type = 0;
8456 GLint real_location = -1; 8547 GLint real_location = -1;
8457 if (!PrepForSetUniformByLocation(fake_location, 8548 if (!PrepForSetUniformByLocation(fake_location,
8458 "glUniform4iv", 8549 "glUniform4iv",
8459 Program::kUniform4i, 8550 Program::kUniform4i,
8460 &real_location, 8551 &real_location,
8461 &type, 8552 &type,
8462 &count)) { 8553 &count)) {
8463 return; 8554 return;
8464 } 8555 }
8465 glUniform4iv(real_location, count, value); 8556 glUniform4iv(real_location, count, const_cast<const GLint*>(value));
8466 } 8557 }
8467 8558
8468 void GLES2DecoderImpl::DoUniform4uiv( 8559 void GLES2DecoderImpl::DoUniform4uiv(GLint fake_location,
8469 GLint fake_location, GLsizei count, const GLuint* value) { 8560 GLsizei count,
8561 const volatile GLuint* value) {
8470 GLenum type = 0; 8562 GLenum type = 0;
8471 GLint real_location = -1; 8563 GLint real_location = -1;
8472 if (!PrepForSetUniformByLocation(fake_location, 8564 if (!PrepForSetUniformByLocation(fake_location,
8473 "glUniform4uiv", 8565 "glUniform4uiv",
8474 Program::kUniform4ui, 8566 Program::kUniform4ui,
8475 &real_location, 8567 &real_location,
8476 &type, 8568 &type,
8477 &count)) { 8569 &count)) {
8478 return; 8570 return;
8479 } 8571 }
8480 glUniform4uiv(real_location, count, value); 8572 glUniform4uiv(real_location, count, const_cast<const GLuint*>(value));
8481 } 8573 }
8482 8574
8483 void GLES2DecoderImpl::DoUniformMatrix2fv( 8575 void GLES2DecoderImpl::DoUniformMatrix2fv(GLint fake_location,
8484 GLint fake_location, GLsizei count, GLboolean transpose, 8576 GLsizei count,
8485 const GLfloat* value) { 8577 GLboolean transpose,
8578 const volatile GLfloat* value) {
8486 GLenum type = 0; 8579 GLenum type = 0;
8487 GLint real_location = -1; 8580 GLint real_location = -1;
8488 if (transpose && !unsafe_es3_apis_enabled()) { 8581 if (transpose && !unsafe_es3_apis_enabled()) {
8489 LOCAL_SET_GL_ERROR( 8582 LOCAL_SET_GL_ERROR(
8490 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose not FALSE"); 8583 GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose not FALSE");
8491 return; 8584 return;
8492 } 8585 }
8493 if (!PrepForSetUniformByLocation(fake_location, 8586 if (!PrepForSetUniformByLocation(fake_location,
8494 "glUniformMatrix2fv", 8587 "glUniformMatrix2fv",
8495 Program::kUniformMatrix2f, 8588 Program::kUniformMatrix2f,
8496 &real_location, 8589 &real_location,
8497 &type, 8590 &type,
8498 &count)) { 8591 &count)) {
8499 return; 8592 return;
8500 } 8593 }
8501 glUniformMatrix2fv(real_location, count, transpose, value); 8594 glUniformMatrix2fv(real_location, count, transpose,
8595 const_cast<const GLfloat*>(value));
8502 } 8596 }
8503 8597
8504 void GLES2DecoderImpl::DoUniformMatrix3fv( 8598 void GLES2DecoderImpl::DoUniformMatrix3fv(GLint fake_location,
8505 GLint fake_location, GLsizei count, GLboolean transpose, 8599 GLsizei count,
8506 const GLfloat* value) { 8600 GLboolean transpose,
8601 const volatile GLfloat* value) {
8507 GLenum type = 0; 8602 GLenum type = 0;
8508 GLint real_location = -1; 8603 GLint real_location = -1;
8509 if (transpose && !unsafe_es3_apis_enabled()) { 8604 if (transpose && !unsafe_es3_apis_enabled()) {
8510 LOCAL_SET_GL_ERROR( 8605 LOCAL_SET_GL_ERROR(
8511 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose not FALSE"); 8606 GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose not FALSE");
8512 return; 8607 return;
8513 } 8608 }
8514 if (!PrepForSetUniformByLocation(fake_location, 8609 if (!PrepForSetUniformByLocation(fake_location,
8515 "glUniformMatrix3fv", 8610 "glUniformMatrix3fv",
8516 Program::kUniformMatrix3f, 8611 Program::kUniformMatrix3f,
8517 &real_location, 8612 &real_location,
8518 &type, 8613 &type,
8519 &count)) { 8614 &count)) {
8520 return; 8615 return;
8521 } 8616 }
8522 glUniformMatrix3fv(real_location, count, transpose, value); 8617 glUniformMatrix3fv(real_location, count, transpose,
8618 const_cast<const GLfloat*>(value));
8523 } 8619 }
8524 8620
8525 void GLES2DecoderImpl::DoUniformMatrix4fv( 8621 void GLES2DecoderImpl::DoUniformMatrix4fv(GLint fake_location,
8526 GLint fake_location, GLsizei count, GLboolean transpose, 8622 GLsizei count,
8527 const GLfloat* value) { 8623 GLboolean transpose,
8624 const volatile GLfloat* value) {
8528 GLenum type = 0; 8625 GLenum type = 0;
8529 GLint real_location = -1; 8626 GLint real_location = -1;
8530 if (transpose && !unsafe_es3_apis_enabled()) { 8627 if (transpose && !unsafe_es3_apis_enabled()) {
8531 LOCAL_SET_GL_ERROR( 8628 LOCAL_SET_GL_ERROR(
8532 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose not FALSE"); 8629 GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose not FALSE");
8533 return; 8630 return;
8534 } 8631 }
8535 if (!PrepForSetUniformByLocation(fake_location, 8632 if (!PrepForSetUniformByLocation(fake_location,
8536 "glUniformMatrix4fv", 8633 "glUniformMatrix4fv",
8537 Program::kUniformMatrix4f, 8634 Program::kUniformMatrix4f,
8538 &real_location, 8635 &real_location,
8539 &type, 8636 &type,
8540 &count)) { 8637 &count)) {
8541 return; 8638 return;
8542 } 8639 }
8543 glUniformMatrix4fv(real_location, count, transpose, value); 8640 glUniformMatrix4fv(real_location, count, transpose,
8641 const_cast<const GLfloat*>(value));
8544 } 8642 }
8545 8643
8546 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM( 8644 void GLES2DecoderImpl::DoUniformMatrix4fvStreamTextureMatrixCHROMIUM(
8547 GLint fake_location, 8645 GLint fake_location,
8548 GLboolean transpose, 8646 GLboolean transpose,
8549 const GLfloat* transform) { 8647 const volatile GLfloat* transform) {
8550 float gl_matrix[16]; 8648 float gl_matrix[16];
8551 8649
8552 // This refers to the bound external texture on the active unit. 8650 // This refers to the bound external texture on the active unit.
8553 TextureUnit& unit = state_.texture_units[state_.active_texture_unit]; 8651 TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
8554 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) { 8652 if (TextureRef* texture_ref = unit.bound_texture_external_oes.get()) {
8555 if (GLStreamTextureImage* image = 8653 if (GLStreamTextureImage* image =
8556 texture_ref->texture()->GetLevelStreamTextureImage( 8654 texture_ref->texture()->GetLevelStreamTextureImage(
8557 GL_TEXTURE_EXTERNAL_OES, 0)) { 8655 GL_TEXTURE_EXTERNAL_OES, 0)) {
8558 gfx::Transform st_transform(gfx::Transform::kSkipInitialization); 8656 gfx::Transform st_transform(gfx::Transform::kSkipInitialization);
8559 gfx::Transform pre_transform(gfx::Transform::kSkipInitialization); 8657 gfx::Transform pre_transform(gfx::Transform::kSkipInitialization);
8560 image->GetTextureMatrix(gl_matrix); 8658 image->GetTextureMatrix(gl_matrix);
8561 st_transform.matrix().setColMajorf(gl_matrix); 8659 st_transform.matrix().setColMajorf(gl_matrix);
8562 pre_transform.matrix().setColMajorf(transform); 8660 // const_cast is safe, because setColMajorf only does a memcpy.
8661 // TODO(piman): can we remove this assumption without having to introduce
8662 // an extra copy?
8663 pre_transform.matrix().setColMajorf(
8664 const_cast<const GLfloat*>(transform));
8563 gfx::Transform(pre_transform, st_transform) 8665 gfx::Transform(pre_transform, st_transform)
8564 .matrix() 8666 .matrix()
8565 .asColMajorf(gl_matrix); 8667 .asColMajorf(gl_matrix);
8566 } else { 8668 } else {
8567 // Missing stream texture. Treat matrix as identity. 8669 // Missing stream texture. Treat matrix as identity.
8568 memcpy(gl_matrix, transform, sizeof(gl_matrix)); 8670 memcpy(gl_matrix, const_cast<const GLfloat*>(transform),
8671 sizeof(gl_matrix));
8569 } 8672 }
8570 } else { 8673 } else {
8571 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 8674 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
8572 "DoUniformMatrix4vStreamTextureMatrix", 8675 "DoUniformMatrix4vStreamTextureMatrix",
8573 "no texture bound"); 8676 "no texture bound");
8574 return; 8677 return;
8575 } 8678 }
8576 8679
8577 GLenum type = 0; 8680 GLenum type = 0;
8578 GLint real_location = -1; 8681 GLint real_location = -1;
8579 GLsizei count = 1; 8682 GLsizei count = 1;
8580 if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", 8683 if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv",
8581 Program::kUniformMatrix4f, &real_location, 8684 Program::kUniformMatrix4f, &real_location,
8582 &type, &count)) { 8685 &type, &count)) {
8583 return; 8686 return;
8584 } 8687 }
8585 8688
8586 glUniformMatrix4fv(real_location, count, transpose, gl_matrix); 8689 glUniformMatrix4fv(real_location, count, transpose, gl_matrix);
8587 } 8690 }
8588 8691
8589 void GLES2DecoderImpl::DoUniformMatrix2x3fv( 8692 void GLES2DecoderImpl::DoUniformMatrix2x3fv(GLint fake_location,
8590 GLint fake_location, GLsizei count, GLboolean transpose, 8693 GLsizei count,
8591 const GLfloat* value) { 8694 GLboolean transpose,
8695 const volatile GLfloat* value) {
8592 GLenum type = 0; 8696 GLenum type = 0;
8593 GLint real_location = -1; 8697 GLint real_location = -1;
8594 if (!PrepForSetUniformByLocation(fake_location, 8698 if (!PrepForSetUniformByLocation(fake_location,
8595 "glUniformMatrix2x3fv", 8699 "glUniformMatrix2x3fv",
8596 Program::kUniformMatrix2x3f, 8700 Program::kUniformMatrix2x3f,
8597 &real_location, 8701 &real_location,
8598 &type, 8702 &type,
8599 &count)) { 8703 &count)) {
8600 return; 8704 return;
8601 } 8705 }
8602 glUniformMatrix2x3fv(real_location, count, transpose, value); 8706 glUniformMatrix2x3fv(real_location, count, transpose,
8707 const_cast<const GLfloat*>(value));
8603 } 8708 }
8604 8709
8605 void GLES2DecoderImpl::DoUniformMatrix2x4fv( 8710 void GLES2DecoderImpl::DoUniformMatrix2x4fv(GLint fake_location,
8606 GLint fake_location, GLsizei count, GLboolean transpose, 8711 GLsizei count,
8607 const GLfloat* value) { 8712 GLboolean transpose,
8713 const volatile GLfloat* value) {
8608 GLenum type = 0; 8714 GLenum type = 0;
8609 GLint real_location = -1; 8715 GLint real_location = -1;
8610 if (!PrepForSetUniformByLocation(fake_location, 8716 if (!PrepForSetUniformByLocation(fake_location,
8611 "glUniformMatrix2x4fv", 8717 "glUniformMatrix2x4fv",
8612 Program::kUniformMatrix2x4f, 8718 Program::kUniformMatrix2x4f,
8613 &real_location, 8719 &real_location,
8614 &type, 8720 &type,
8615 &count)) { 8721 &count)) {
8616 return; 8722 return;
8617 } 8723 }
8618 glUniformMatrix2x4fv(real_location, count, transpose, value); 8724 glUniformMatrix2x4fv(real_location, count, transpose,
8725 const_cast<const GLfloat*>(value));
8619 } 8726 }
8620 8727
8621 void GLES2DecoderImpl::DoUniformMatrix3x2fv( 8728 void GLES2DecoderImpl::DoUniformMatrix3x2fv(GLint fake_location,
8622 GLint fake_location, GLsizei count, GLboolean transpose, 8729 GLsizei count,
8623 const GLfloat* value) { 8730 GLboolean transpose,
8731 const volatile GLfloat* value) {
8624 GLenum type = 0; 8732 GLenum type = 0;
8625 GLint real_location = -1; 8733 GLint real_location = -1;
8626 if (!PrepForSetUniformByLocation(fake_location, 8734 if (!PrepForSetUniformByLocation(fake_location,
8627 "glUniformMatrix3x2fv", 8735 "glUniformMatrix3x2fv",
8628 Program::kUniformMatrix3x2f, 8736 Program::kUniformMatrix3x2f,
8629 &real_location, 8737 &real_location,
8630 &type, 8738 &type,
8631 &count)) { 8739 &count)) {
8632 return; 8740 return;
8633 } 8741 }
8634 glUniformMatrix3x2fv(real_location, count, transpose, value); 8742 glUniformMatrix3x2fv(real_location, count, transpose,
8743 const_cast<const GLfloat*>(value));
8635 } 8744 }
8636 8745
8637 void GLES2DecoderImpl::DoUniformMatrix3x4fv( 8746 void GLES2DecoderImpl::DoUniformMatrix3x4fv(GLint fake_location,
8638 GLint fake_location, GLsizei count, GLboolean transpose, 8747 GLsizei count,
8639 const GLfloat* value) { 8748 GLboolean transpose,
8749 const volatile GLfloat* value) {
8640 GLenum type = 0; 8750 GLenum type = 0;
8641 GLint real_location = -1; 8751 GLint real_location = -1;
8642 if (!PrepForSetUniformByLocation(fake_location, 8752 if (!PrepForSetUniformByLocation(fake_location,
8643 "glUniformMatrix3x4fv", 8753 "glUniformMatrix3x4fv",
8644 Program::kUniformMatrix3x4f, 8754 Program::kUniformMatrix3x4f,
8645 &real_location, 8755 &real_location,
8646 &type, 8756 &type,
8647 &count)) { 8757 &count)) {
8648 return; 8758 return;
8649 } 8759 }
8650 glUniformMatrix3x4fv(real_location, count, transpose, value); 8760 glUniformMatrix3x4fv(real_location, count, transpose,
8761 const_cast<const GLfloat*>(value));
8651 } 8762 }
8652 8763
8653 void GLES2DecoderImpl::DoUniformMatrix4x2fv( 8764 void GLES2DecoderImpl::DoUniformMatrix4x2fv(GLint fake_location,
8654 GLint fake_location, GLsizei count, GLboolean transpose, 8765 GLsizei count,
8655 const GLfloat* value) { 8766 GLboolean transpose,
8767 const volatile GLfloat* value) {
8656 GLenum type = 0; 8768 GLenum type = 0;
8657 GLint real_location = -1; 8769 GLint real_location = -1;
8658 if (!PrepForSetUniformByLocation(fake_location, 8770 if (!PrepForSetUniformByLocation(fake_location,
8659 "glUniformMatrix4x2fv", 8771 "glUniformMatrix4x2fv",
8660 Program::kUniformMatrix4x2f, 8772 Program::kUniformMatrix4x2f,
8661 &real_location, 8773 &real_location,
8662 &type, 8774 &type,
8663 &count)) { 8775 &count)) {
8664 return; 8776 return;
8665 } 8777 }
8666 glUniformMatrix4x2fv(real_location, count, transpose, value); 8778 glUniformMatrix4x2fv(real_location, count, transpose,
8779 const_cast<const GLfloat*>(value));
8667 } 8780 }
8668 8781
8669 void GLES2DecoderImpl::DoUniformMatrix4x3fv( 8782 void GLES2DecoderImpl::DoUniformMatrix4x3fv(GLint fake_location,
8670 GLint fake_location, GLsizei count, GLboolean transpose, 8783 GLsizei count,
8671 const GLfloat* value) { 8784 GLboolean transpose,
8785 const volatile GLfloat* value) {
8672 GLenum type = 0; 8786 GLenum type = 0;
8673 GLint real_location = -1; 8787 GLint real_location = -1;
8674 if (!PrepForSetUniformByLocation(fake_location, 8788 if (!PrepForSetUniformByLocation(fake_location,
8675 "glUniformMatrix4x3fv", 8789 "glUniformMatrix4x3fv",
8676 Program::kUniformMatrix4x3f, 8790 Program::kUniformMatrix4x3f,
8677 &real_location, 8791 &real_location,
8678 &type, 8792 &type,
8679 &count)) { 8793 &count)) {
8680 return; 8794 return;
8681 } 8795 }
8682 glUniformMatrix4x3fv(real_location, count, transpose, value); 8796 glUniformMatrix4x3fv(real_location, count, transpose,
8797 const_cast<const GLfloat*>(value));
8683 } 8798 }
8684 8799
8685 void GLES2DecoderImpl::DoUseProgram(GLuint program_id) { 8800 void GLES2DecoderImpl::DoUseProgram(GLuint program_id) {
8686 const char* function_name = "glUseProgram"; 8801 const char* function_name = "glUseProgram";
8687 GLuint service_id = 0; 8802 GLuint service_id = 0;
8688 Program* program = nullptr; 8803 Program* program = nullptr;
8689 if (program_id) { 8804 if (program_id) {
8690 program = GetProgramInfoNotShader(program_id, function_name); 8805 program = GetProgramInfoNotShader(program_id, function_name);
8691 if (!program) { 8806 if (!program) {
8692 return; 8807 return;
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
9277 // function even if it is simulated. This is because we will simulate 9392 // function even if it is simulated. This is because we will simulate
9278 // it in each draw call, and attrib 0 generic data queries use cached 9393 // it in each draw call, and attrib 0 generic data queries use cached
9279 // values instead of passing down to the underlying driver. 9394 // values instead of passing down to the underlying driver.
9280 RestoreStateForAttrib(0, false); 9395 RestoreStateForAttrib(0, false);
9281 } 9396 }
9282 } 9397 }
9283 return error::kNoError; 9398 return error::kNoError;
9284 } 9399 }
9285 9400
9286 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32_t immediate_data_size, 9401 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32_t immediate_data_size,
9287 const void* cmd_data) { 9402 const volatile void* cmd_data) {
9288 const cmds::DrawArrays& c = *static_cast<const cmds::DrawArrays*>(cmd_data); 9403 const volatile cmds::DrawArrays& c =
9404 *static_cast<const volatile cmds::DrawArrays*>(cmd_data);
9289 return DoDrawArrays("glDrawArrays", 9405 return DoDrawArrays("glDrawArrays",
9290 false, 9406 false,
9291 static_cast<GLenum>(c.mode), 9407 static_cast<GLenum>(c.mode),
9292 static_cast<GLint>(c.first), 9408 static_cast<GLint>(c.first),
9293 static_cast<GLsizei>(c.count), 9409 static_cast<GLsizei>(c.count),
9294 1); 9410 1);
9295 } 9411 }
9296 9412
9297 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( 9413 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE(
9298 uint32_t immediate_data_size, 9414 uint32_t immediate_data_size,
9299 const void* cmd_data) { 9415 const volatile void* cmd_data) {
9300 const gles2::cmds::DrawArraysInstancedANGLE& c = 9416 const volatile gles2::cmds::DrawArraysInstancedANGLE& c =
9301 *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); 9417 *static_cast<const volatile gles2::cmds::DrawArraysInstancedANGLE*>(
9418 cmd_data);
9302 if (!features().angle_instanced_arrays) 9419 if (!features().angle_instanced_arrays)
9303 return error::kUnknownCommand; 9420 return error::kUnknownCommand;
9304 9421
9305 return DoDrawArrays("glDrawArraysIntancedANGLE", 9422 return DoDrawArrays("glDrawArraysIntancedANGLE",
9306 true, 9423 true,
9307 static_cast<GLenum>(c.mode), 9424 static_cast<GLenum>(c.mode),
9308 static_cast<GLint>(c.first), 9425 static_cast<GLint>(c.first),
9309 static_cast<GLsizei>(c.count), 9426 static_cast<GLsizei>(c.count),
9310 static_cast<GLsizei>(c.primcount)); 9427 static_cast<GLsizei>(c.primcount));
9311 } 9428 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
9444 // We don't have to restore attrib 0 generic data at the end of this 9561 // We don't have to restore attrib 0 generic data at the end of this
9445 // function even if it is simulated. This is because we will simulate 9562 // function even if it is simulated. This is because we will simulate
9446 // it in each draw call, and attrib 0 generic data queries use cached 9563 // it in each draw call, and attrib 0 generic data queries use cached
9447 // values instead of passing down to the underlying driver. 9564 // values instead of passing down to the underlying driver.
9448 RestoreStateForAttrib(0, false); 9565 RestoreStateForAttrib(0, false);
9449 } 9566 }
9450 } 9567 }
9451 return error::kNoError; 9568 return error::kNoError;
9452 } 9569 }
9453 9570
9454 error::Error GLES2DecoderImpl::HandleDrawElements(uint32_t immediate_data_size, 9571 error::Error GLES2DecoderImpl::HandleDrawElements(
9455 const void* cmd_data) { 9572 uint32_t immediate_data_size,
9456 const gles2::cmds::DrawElements& c = 9573 const volatile void* cmd_data) {
9457 *static_cast<const gles2::cmds::DrawElements*>(cmd_data); 9574 const volatile gles2::cmds::DrawElements& c =
9575 *static_cast<const volatile gles2::cmds::DrawElements*>(cmd_data);
9458 return DoDrawElements("glDrawElements", false, static_cast<GLenum>(c.mode), 9576 return DoDrawElements("glDrawElements", false, static_cast<GLenum>(c.mode),
9459 static_cast<GLsizei>(c.count), 9577 static_cast<GLsizei>(c.count),
9460 static_cast<GLenum>(c.type), 9578 static_cast<GLenum>(c.type),
9461 static_cast<int32_t>(c.index_offset), 1); 9579 static_cast<int32_t>(c.index_offset), 1);
9462 } 9580 }
9463 9581
9464 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( 9582 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE(
9465 uint32_t immediate_data_size, 9583 uint32_t immediate_data_size,
9466 const void* cmd_data) { 9584 const volatile void* cmd_data) {
9467 const gles2::cmds::DrawElementsInstancedANGLE& c = 9585 const volatile gles2::cmds::DrawElementsInstancedANGLE& c =
9468 *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); 9586 *static_cast<const volatile gles2::cmds::DrawElementsInstancedANGLE*>(
9587 cmd_data);
9469 if (!features().angle_instanced_arrays) 9588 if (!features().angle_instanced_arrays)
9470 return error::kUnknownCommand; 9589 return error::kUnknownCommand;
9471 9590
9472 return DoDrawElements( 9591 return DoDrawElements(
9473 "glDrawElementsInstancedANGLE", true, static_cast<GLenum>(c.mode), 9592 "glDrawElementsInstancedANGLE", true, static_cast<GLenum>(c.mode),
9474 static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type), 9593 static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type),
9475 static_cast<int32_t>(c.index_offset), static_cast<GLsizei>(c.primcount)); 9594 static_cast<int32_t>(c.index_offset), static_cast<GLsizei>(c.primcount));
9476 } 9595 }
9477 9596
9478 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( 9597 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
9595 ++(*params); 9714 ++(*params);
9596 return; 9715 return;
9597 default: 9716 default:
9598 break; 9717 break;
9599 } 9718 }
9600 glGetShaderiv(shader->service_id(), pname, params); 9719 glGetShaderiv(shader->service_id(), pname, params);
9601 } 9720 }
9602 9721
9603 error::Error GLES2DecoderImpl::HandleGetShaderSource( 9722 error::Error GLES2DecoderImpl::HandleGetShaderSource(
9604 uint32_t immediate_data_size, 9723 uint32_t immediate_data_size,
9605 const void* cmd_data) { 9724 const volatile void* cmd_data) {
9606 const gles2::cmds::GetShaderSource& c = 9725 const volatile gles2::cmds::GetShaderSource& c =
9607 *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); 9726 *static_cast<const volatile gles2::cmds::GetShaderSource*>(cmd_data);
9608 GLuint shader_id = c.shader; 9727 GLuint shader_id = c.shader;
9609 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9728 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9610 Bucket* bucket = CreateBucket(bucket_id); 9729 Bucket* bucket = CreateBucket(bucket_id);
9611 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); 9730 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource");
9612 if (!shader || shader->source().empty()) { 9731 if (!shader || shader->source().empty()) {
9613 bucket->SetSize(0); 9732 bucket->SetSize(0);
9614 return error::kNoError; 9733 return error::kNoError;
9615 } 9734 }
9616 bucket->SetFromString(shader->source().c_str()); 9735 bucket->SetFromString(shader->source().c_str());
9617 return error::kNoError; 9736 return error::kNoError;
9618 } 9737 }
9619 9738
9620 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( 9739 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE(
9621 uint32_t immediate_data_size, 9740 uint32_t immediate_data_size,
9622 const void* cmd_data) { 9741 const volatile void* cmd_data) {
9623 const gles2::cmds::GetTranslatedShaderSourceANGLE& c = 9742 const volatile gles2::cmds::GetTranslatedShaderSourceANGLE& c =
9624 *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( 9743 *static_cast<const volatile gles2::cmds::GetTranslatedShaderSourceANGLE*>(
9625 cmd_data); 9744 cmd_data);
9626 GLuint shader_id = c.shader; 9745 GLuint shader_id = c.shader;
9627 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9746 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9628 Bucket* bucket = CreateBucket(bucket_id); 9747 Bucket* bucket = CreateBucket(bucket_id);
9629 Shader* shader = GetShaderInfoNotProgram( 9748 Shader* shader = GetShaderInfoNotProgram(
9630 shader_id, "glGetTranslatedShaderSourceANGLE"); 9749 shader_id, "glGetTranslatedShaderSourceANGLE");
9631 if (!shader) { 9750 if (!shader) {
9632 bucket->SetSize(0); 9751 bucket->SetSize(0);
9633 return error::kNoError; 9752 return error::kNoError;
9634 } 9753 }
9635 9754
9636 // Make sure translator has been utilized in compile. 9755 // Make sure translator has been utilized in compile.
9637 shader->DoCompile(); 9756 shader->DoCompile();
9638 9757
9639 bucket->SetFromString(shader->translated_source().c_str()); 9758 bucket->SetFromString(shader->translated_source().c_str());
9640 return error::kNoError; 9759 return error::kNoError;
9641 } 9760 }
9642 9761
9643 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( 9762 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog(
9644 uint32_t immediate_data_size, 9763 uint32_t immediate_data_size,
9645 const void* cmd_data) { 9764 const volatile void* cmd_data) {
9646 const gles2::cmds::GetProgramInfoLog& c = 9765 const volatile gles2::cmds::GetProgramInfoLog& c =
9647 *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); 9766 *static_cast<const volatile gles2::cmds::GetProgramInfoLog*>(cmd_data);
9648 GLuint program_id = c.program; 9767 GLuint program_id = c.program;
9649 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9768 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9650 Bucket* bucket = CreateBucket(bucket_id); 9769 Bucket* bucket = CreateBucket(bucket_id);
9651 Program* program = GetProgramInfoNotShader( 9770 Program* program = GetProgramInfoNotShader(
9652 program_id, "glGetProgramInfoLog"); 9771 program_id, "glGetProgramInfoLog");
9653 if (!program || !program->log_info()) { 9772 if (!program || !program->log_info()) {
9654 bucket->SetFromString(""); 9773 bucket->SetFromString("");
9655 return error::kNoError; 9774 return error::kNoError;
9656 } 9775 }
9657 bucket->SetFromString(program->log_info()->c_str()); 9776 bucket->SetFromString(program->log_info()->c_str());
9658 return error::kNoError; 9777 return error::kNoError;
9659 } 9778 }
9660 9779
9661 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( 9780 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog(
9662 uint32_t immediate_data_size, 9781 uint32_t immediate_data_size,
9663 const void* cmd_data) { 9782 const volatile void* cmd_data) {
9664 const gles2::cmds::GetShaderInfoLog& c = 9783 const volatile gles2::cmds::GetShaderInfoLog& c =
9665 *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); 9784 *static_cast<const volatile gles2::cmds::GetShaderInfoLog*>(cmd_data);
9666 GLuint shader_id = c.shader; 9785 GLuint shader_id = c.shader;
9667 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9786 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9668 Bucket* bucket = CreateBucket(bucket_id); 9787 Bucket* bucket = CreateBucket(bucket_id);
9669 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); 9788 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog");
9670 if (!shader) { 9789 if (!shader) {
9671 bucket->SetFromString(""); 9790 bucket->SetFromString("");
9672 return error::kNoError; 9791 return error::kNoError;
9673 } 9792 }
9674 9793
9675 // Shader must be compiled in order to get the info log. 9794 // Shader must be compiled in order to get the info log.
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
9996 void GLES2DecoderImpl::DoVertexAttrib4f( 10115 void GLES2DecoderImpl::DoVertexAttrib4f(
9997 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { 10116 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) {
9998 GLfloat v[4] = { v0, v1, v2, v3, }; 10117 GLfloat v[4] = { v0, v1, v2, v3, };
9999 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) { 10118 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) {
10000 state_.SetGenericVertexAttribBaseType( 10119 state_.SetGenericVertexAttribBaseType(
10001 index, SHADER_VARIABLE_FLOAT); 10120 index, SHADER_VARIABLE_FLOAT);
10002 glVertexAttrib4f(index, v0, v1, v2, v3); 10121 glVertexAttrib4f(index, v0, v1, v2, v3);
10003 } 10122 }
10004 } 10123 }
10005 10124
10006 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { 10125 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index,
10126 const volatile GLfloat* v) {
10007 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, }; 10127 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, };
10008 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) { 10128 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) {
10009 state_.SetGenericVertexAttribBaseType( 10129 state_.SetGenericVertexAttribBaseType(
10010 index, SHADER_VARIABLE_FLOAT); 10130 index, SHADER_VARIABLE_FLOAT);
10011 glVertexAttrib1fv(index, t); 10131 glVertexAttrib1fv(index, t);
10012 } 10132 }
10013 } 10133 }
10014 10134
10015 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { 10135 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index,
10136 const volatile GLfloat* v) {
10016 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, }; 10137 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, };
10017 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) { 10138 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) {
10018 state_.SetGenericVertexAttribBaseType( 10139 state_.SetGenericVertexAttribBaseType(
10019 index, SHADER_VARIABLE_FLOAT); 10140 index, SHADER_VARIABLE_FLOAT);
10020 glVertexAttrib2fv(index, t); 10141 glVertexAttrib2fv(index, t);
10021 } 10142 }
10022 } 10143 }
10023 10144
10024 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { 10145 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index,
10146 const volatile GLfloat* v) {
10025 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, }; 10147 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, };
10026 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) { 10148 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) {
10027 state_.SetGenericVertexAttribBaseType( 10149 state_.SetGenericVertexAttribBaseType(
10028 index, SHADER_VARIABLE_FLOAT); 10150 index, SHADER_VARIABLE_FLOAT);
10029 glVertexAttrib3fv(index, t); 10151 glVertexAttrib3fv(index, t);
10030 } 10152 }
10031 } 10153 }
10032 10154
10033 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { 10155 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index,
10156 const volatile GLfloat* v) {
10034 GLfloat t[4] = {v[0], v[1], v[2], v[3]}; 10157 GLfloat t[4] = {v[0], v[1], v[2], v[3]};
10035 if (SetVertexAttribValue("glVertexAttrib4fv", index, t)) { 10158 if (SetVertexAttribValue("glVertexAttrib4fv", index, t)) {
10036 state_.SetGenericVertexAttribBaseType( 10159 state_.SetGenericVertexAttribBaseType(
10037 index, SHADER_VARIABLE_FLOAT); 10160 index, SHADER_VARIABLE_FLOAT);
10038 glVertexAttrib4fv(index, t); 10161 glVertexAttrib4fv(index, t);
10039 } 10162 }
10040 } 10163 }
10041 10164
10042 void GLES2DecoderImpl::DoVertexAttribI4i( 10165 void GLES2DecoderImpl::DoVertexAttribI4i(
10043 GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) { 10166 GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) {
10044 GLint v[4] = { v0, v1, v2, v3 }; 10167 GLint v[4] = { v0, v1, v2, v3 };
10045 if (SetVertexAttribValue("glVertexAttribI4i", index, v)) { 10168 if (SetVertexAttribValue("glVertexAttribI4i", index, v)) {
10046 state_.SetGenericVertexAttribBaseType( 10169 state_.SetGenericVertexAttribBaseType(
10047 index, SHADER_VARIABLE_INT); 10170 index, SHADER_VARIABLE_INT);
10048 glVertexAttribI4i(index, v0, v1, v2, v3); 10171 glVertexAttribI4i(index, v0, v1, v2, v3);
10049 } 10172 }
10050 } 10173 }
10051 10174
10052 void GLES2DecoderImpl::DoVertexAttribI4iv(GLuint index, const GLint* v) { 10175 void GLES2DecoderImpl::DoVertexAttribI4iv(GLuint index,
10176 const volatile GLint* v) {
10053 GLint t[4] = {v[0], v[1], v[2], v[3]}; 10177 GLint t[4] = {v[0], v[1], v[2], v[3]};
10054 if (SetVertexAttribValue("glVertexAttribI4iv", index, t)) { 10178 if (SetVertexAttribValue("glVertexAttribI4iv", index, t)) {
10055 state_.SetGenericVertexAttribBaseType( 10179 state_.SetGenericVertexAttribBaseType(
10056 index, SHADER_VARIABLE_INT); 10180 index, SHADER_VARIABLE_INT);
10057 glVertexAttribI4iv(index, t); 10181 glVertexAttribI4iv(index, t);
10058 } 10182 }
10059 } 10183 }
10060 10184
10061 void GLES2DecoderImpl::DoVertexAttribI4ui( 10185 void GLES2DecoderImpl::DoVertexAttribI4ui(
10062 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { 10186 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) {
10063 GLuint v[4] = { v0, v1, v2, v3 }; 10187 GLuint v[4] = { v0, v1, v2, v3 };
10064 if (SetVertexAttribValue("glVertexAttribI4ui", index, v)) { 10188 if (SetVertexAttribValue("glVertexAttribI4ui", index, v)) {
10065 state_.SetGenericVertexAttribBaseType( 10189 state_.SetGenericVertexAttribBaseType(
10066 index, SHADER_VARIABLE_UINT); 10190 index, SHADER_VARIABLE_UINT);
10067 glVertexAttribI4ui(index, v0, v1, v2, v3); 10191 glVertexAttribI4ui(index, v0, v1, v2, v3);
10068 } 10192 }
10069 } 10193 }
10070 10194
10071 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const GLuint* v) { 10195 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index,
10196 const volatile GLuint* v) {
10072 GLuint t[4] = {v[0], v[1], v[2], v[3]}; 10197 GLuint t[4] = {v[0], v[1], v[2], v[3]};
10073 if (SetVertexAttribValue("glVertexAttribI4uiv", index, t)) { 10198 if (SetVertexAttribValue("glVertexAttribI4uiv", index, t)) {
10074 state_.SetGenericVertexAttribBaseType( 10199 state_.SetGenericVertexAttribBaseType(
10075 index, SHADER_VARIABLE_UINT); 10200 index, SHADER_VARIABLE_UINT);
10076 glVertexAttribI4uiv(index, t); 10201 glVertexAttribI4uiv(index, t);
10077 } 10202 }
10078 } 10203 }
10079 10204
10080 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( 10205 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer(
10081 uint32_t immediate_data_size, 10206 uint32_t immediate_data_size,
10082 const void* cmd_data) { 10207 const volatile void* cmd_data) {
10083 if (!unsafe_es3_apis_enabled()) 10208 if (!unsafe_es3_apis_enabled())
10084 return error::kUnknownCommand; 10209 return error::kUnknownCommand;
10085 const gles2::cmds::VertexAttribIPointer& c = 10210 const volatile gles2::cmds::VertexAttribIPointer& c =
10086 *static_cast<const gles2::cmds::VertexAttribIPointer*>(cmd_data); 10211 *static_cast<const volatile gles2::cmds::VertexAttribIPointer*>(cmd_data);
10087 GLuint indx = c.indx; 10212 GLuint indx = c.indx;
10088 GLint size = c.size; 10213 GLint size = c.size;
10089 GLenum type = c.type; 10214 GLenum type = c.type;
10090 GLsizei stride = c.stride; 10215 GLsizei stride = c.stride;
10091 GLsizei offset = c.offset; 10216 GLsizei offset = c.offset;
10092 10217
10093 if (!state_.bound_array_buffer.get() || 10218 if (!state_.bound_array_buffer.get() ||
10094 state_.bound_array_buffer->IsDeleted()) { 10219 state_.bound_array_buffer->IsDeleted()) {
10095 if (state_.vertex_attrib_manager.get() == 10220 if (state_.vertex_attrib_manager.get() ==
10096 state_.default_vertex_attrib_manager.get()) { 10221 state_.default_vertex_attrib_manager.get()) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
10166 stride, 10291 stride,
10167 stride != 0 ? stride : group_size, 10292 stride != 0 ? stride : group_size,
10168 offset, 10293 offset,
10169 GL_TRUE); 10294 GL_TRUE);
10170 glVertexAttribIPointer(indx, size, type, stride, ptr); 10295 glVertexAttribIPointer(indx, size, type, stride, ptr);
10171 return error::kNoError; 10296 return error::kNoError;
10172 } 10297 }
10173 10298
10174 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( 10299 error::Error GLES2DecoderImpl::HandleVertexAttribPointer(
10175 uint32_t immediate_data_size, 10300 uint32_t immediate_data_size,
10176 const void* cmd_data) { 10301 const volatile void* cmd_data) {
10177 const gles2::cmds::VertexAttribPointer& c = 10302 const volatile gles2::cmds::VertexAttribPointer& c =
10178 *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); 10303 *static_cast<const volatile gles2::cmds::VertexAttribPointer*>(cmd_data);
10179 GLuint indx = c.indx; 10304 GLuint indx = c.indx;
10180 GLint size = c.size; 10305 GLint size = c.size;
10181 GLenum type = c.type; 10306 GLenum type = c.type;
10182 GLboolean normalized = static_cast<GLboolean>(c.normalized); 10307 GLboolean normalized = static_cast<GLboolean>(c.normalized);
10183 GLsizei stride = c.stride; 10308 GLsizei stride = c.stride;
10184 GLsizei offset = c.offset; 10309 GLsizei offset = c.offset;
10185 10310
10186 if (!state_.bound_array_buffer.get() || 10311 if (!state_.bound_array_buffer.get() ||
10187 state_.bound_array_buffer->IsDeleted()) { 10312 state_.bound_array_buffer->IsDeleted()) {
10188 if (state_.vertex_attrib_manager.get() == 10313 if (state_.vertex_attrib_manager.get() ==
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
10274 GLsizei height) { 10399 GLsizei height) {
10275 state_.viewport_x = x; 10400 state_.viewport_x = x;
10276 state_.viewport_y = y; 10401 state_.viewport_y = y;
10277 state_.viewport_width = std::min(width, viewport_max_width_); 10402 state_.viewport_width = std::min(width, viewport_max_width_);
10278 state_.viewport_height = std::min(height, viewport_max_height_); 10403 state_.viewport_height = std::min(height, viewport_max_height_);
10279 glViewport(x, y, width, height); 10404 glViewport(x, y, width, height);
10280 } 10405 }
10281 10406
10282 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( 10407 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE(
10283 uint32_t immediate_data_size, 10408 uint32_t immediate_data_size,
10284 const void* cmd_data) { 10409 const volatile void* cmd_data) {
10285 const gles2::cmds::VertexAttribDivisorANGLE& c = 10410 const volatile gles2::cmds::VertexAttribDivisorANGLE& c =
10286 *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); 10411 *static_cast<const volatile gles2::cmds::VertexAttribDivisorANGLE*>(
10412 cmd_data);
10287 if (!features().angle_instanced_arrays) 10413 if (!features().angle_instanced_arrays)
10288 return error::kUnknownCommand; 10414 return error::kUnknownCommand;
10289 10415
10290 GLuint index = c.index; 10416 GLuint index = c.index;
10291 GLuint divisor = c.divisor; 10417 GLuint divisor = c.divisor;
10292 if (index >= group_->max_vertex_attribs()) { 10418 if (index >= group_->max_vertex_attribs()) {
10293 LOCAL_SET_GL_ERROR( 10419 LOCAL_SET_GL_ERROR(
10294 GL_INVALID_VALUE, 10420 GL_INVALID_VALUE,
10295 "glVertexAttribDivisorANGLE", "index out of range"); 10421 "glVertexAttribDivisorANGLE", "index out of range");
10296 return error::kNoError; 10422 return error::kNoError;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
10432 case GL_HALF_FLOAT: 10558 case GL_HALF_FLOAT:
10433 WriteAlphaData<uint16_t>(pixels, height, channel_count, alpha_channel, 10559 WriteAlphaData<uint16_t>(pixels, height, channel_count, alpha_channel,
10434 unpadded_row_size, padded_row_size, 0x3C00); 10560 unpadded_row_size, padded_row_size, 0x3C00);
10435 break; 10561 break;
10436 } 10562 }
10437 } 10563 }
10438 } 10564 }
10439 } 10565 }
10440 10566
10441 error::Error GLES2DecoderImpl::HandleReadPixels(uint32_t immediate_data_size, 10567 error::Error GLES2DecoderImpl::HandleReadPixels(uint32_t immediate_data_size,
10442 const void* cmd_data) { 10568 const volatile void* cmd_data) {
10443 const gles2::cmds::ReadPixels& c = 10569 const volatile gles2::cmds::ReadPixels& c =
10444 *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); 10570 *static_cast<const volatile gles2::cmds::ReadPixels*>(cmd_data);
10445 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); 10571 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels");
10446 error::Error fbo_error = WillAccessBoundFramebufferForRead(); 10572 error::Error fbo_error = WillAccessBoundFramebufferForRead();
10447 if (fbo_error != error::kNoError) 10573 if (fbo_error != error::kNoError)
10448 return fbo_error; 10574 return fbo_error;
10449 GLint x = c.x; 10575 GLint x = c.x;
10450 GLint y = c.y; 10576 GLint y = c.y;
10451 GLsizei width = c.width; 10577 GLsizei width = c.width;
10452 GLsizei height = c.height; 10578 GLsizei height = c.height;
10453 GLenum format = c.format; 10579 GLenum format = c.format;
10454 GLenum type = c.type; 10580 GLenum type = c.type;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
10772 } 10898 }
10773 FinishReadPixels(width, height, format, type, pixels_shm_id, 10899 FinishReadPixels(width, height, format, type, pixels_shm_id,
10774 pixels_shm_offset, result_shm_id, result_shm_offset, 10900 pixels_shm_offset, result_shm_id, result_shm_offset,
10775 state_.pack_alignment, read_format, 0); 10901 state_.pack_alignment, read_format, 0);
10776 } 10902 }
10777 } 10903 }
10778 10904
10779 return error::kNoError; 10905 return error::kNoError;
10780 } 10906 }
10781 10907
10782 error::Error GLES2DecoderImpl::HandlePixelStorei(uint32_t immediate_data_size, 10908 error::Error GLES2DecoderImpl::HandlePixelStorei(
10783 const void* cmd_data) { 10909 uint32_t immediate_data_size,
10784 const gles2::cmds::PixelStorei& c = 10910 const volatile void* cmd_data) {
10785 *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); 10911 const volatile gles2::cmds::PixelStorei& c =
10912 *static_cast<const volatile gles2::cmds::PixelStorei*>(cmd_data);
10786 GLenum pname = c.pname; 10913 GLenum pname = c.pname;
10787 GLint param = c.param; 10914 GLint param = c.param;
10788 if (!validators_->pixel_store.IsValid(pname)) { 10915 if (!validators_->pixel_store.IsValid(pname)) {
10789 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); 10916 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname");
10790 return error::kNoError; 10917 return error::kNoError;
10791 } 10918 }
10792 switch (pname) { 10919 switch (pname) {
10793 case GL_PACK_ALIGNMENT: 10920 case GL_PACK_ALIGNMENT:
10794 case GL_UNPACK_ALIGNMENT: 10921 case GL_UNPACK_ALIGNMENT:
10795 if (!validators_->pixel_store_alignment.IsValid(param)) { 10922 if (!validators_->pixel_store_alignment.IsValid(param)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
10855 default: 10982 default:
10856 // Validation should have prevented us from getting here. 10983 // Validation should have prevented us from getting here.
10857 NOTREACHED(); 10984 NOTREACHED();
10858 break; 10985 break;
10859 } 10986 }
10860 return error::kNoError; 10987 return error::kNoError;
10861 } 10988 }
10862 10989
10863 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( 10990 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
10864 uint32_t immediate_data_size, 10991 uint32_t immediate_data_size,
10865 const void* cmd_data) { 10992 const volatile void* cmd_data) {
10866 const gles2::cmds::PostSubBufferCHROMIUM& c = 10993 const volatile gles2::cmds::PostSubBufferCHROMIUM& c =
10867 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); 10994 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>(
10995 cmd_data);
10868 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); 10996 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
10869 { 10997 {
10870 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); 10998 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame");
10871 } 10999 }
10872 if (!supports_post_sub_buffer_) { 11000 if (!supports_post_sub_buffer_) {
10873 LOCAL_SET_GL_ERROR( 11001 LOCAL_SET_GL_ERROR(
10874 GL_INVALID_OPERATION, 11002 GL_INVALID_OPERATION,
10875 "glPostSubBufferCHROMIUM", "command not supported by surface"); 11003 "glPostSubBufferCHROMIUM", "command not supported by surface");
10876 return error::kNoError; 11004 return error::kNoError;
10877 } 11005 }
(...skipping 17 matching lines...) Expand all
10895 base::AsWeakPtr(this))); 11023 base::AsWeakPtr(this)));
10896 } else { 11024 } else {
10897 FinishSwapBuffers(surface_->PostSubBuffer(c.x, c.y, c.width, c.height)); 11025 FinishSwapBuffers(surface_->PostSubBuffer(c.x, c.y, c.width, c.height));
10898 } 11026 }
10899 11027
10900 return error::kNoError; 11028 return error::kNoError;
10901 } 11029 }
10902 11030
10903 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( 11031 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM(
10904 uint32_t immediate_data_size, 11032 uint32_t immediate_data_size,
10905 const void* cmd_data) { 11033 const volatile void* cmd_data) {
10906 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = 11034 const volatile gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c =
10907 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); 11035 *static_cast<const volatile gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(
11036 cmd_data);
10908 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); 11037 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id);
10909 if (!ref) { 11038 if (!ref) {
10910 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, 11039 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
10911 "glScheduleOverlayPlaneCHROMIUM", 11040 "glScheduleOverlayPlaneCHROMIUM",
10912 "unknown texture"); 11041 "unknown texture");
10913 return error::kNoError; 11042 return error::kNoError;
10914 } 11043 }
10915 Texture::ImageState image_state; 11044 Texture::ImageState image_state;
10916 gl::GLImage* image = 11045 gl::GLImage* image =
10917 ref->texture()->GetLevelImage(ref->texture()->target(), 0, &image_state); 11046 ref->texture()->GetLevelImage(ref->texture()->target(), 0, &image_state);
(...skipping 18 matching lines...) Expand all
10936 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) { 11065 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) {
10937 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 11066 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
10938 "glScheduleOverlayPlaneCHROMIUM", 11067 "glScheduleOverlayPlaneCHROMIUM",
10939 "failed to schedule overlay"); 11068 "failed to schedule overlay");
10940 } 11069 }
10941 return error::kNoError; 11070 return error::kNoError;
10942 } 11071 }
10943 11072
10944 error::Error GLES2DecoderImpl::HandleScheduleCALayerSharedStateCHROMIUM( 11073 error::Error GLES2DecoderImpl::HandleScheduleCALayerSharedStateCHROMIUM(
10945 uint32_t immediate_data_size, 11074 uint32_t immediate_data_size,
10946 const void* cmd_data) { 11075 const volatile void* cmd_data) {
10947 const gles2::cmds::ScheduleCALayerSharedStateCHROMIUM& c = 11076 const volatile gles2::cmds::ScheduleCALayerSharedStateCHROMIUM& c =
10948 *static_cast<const gles2::cmds::ScheduleCALayerSharedStateCHROMIUM*>( 11077 *static_cast<
11078 const volatile gles2::cmds::ScheduleCALayerSharedStateCHROMIUM*>(
10949 cmd_data); 11079 cmd_data);
10950 11080
10951 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset, 11081 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset,
10952 20 * sizeof(GLfloat)); 11082 20 * sizeof(GLfloat));
10953 if (!mem) { 11083 if (!mem) {
10954 return error::kOutOfBounds; 11084 return error::kOutOfBounds;
10955 } 11085 }
10956 gfx::RectF clip_rect(mem[0], mem[1], mem[2], mem[3]); 11086 gfx::RectF clip_rect(mem[0], mem[1], mem[2], mem[3]);
10957 gfx::Transform transform(mem[4], mem[8], mem[12], mem[16], 11087 gfx::Transform transform(mem[4], mem[8], mem[12], mem[16],
10958 mem[5], mem[9], mem[13], mem[17], 11088 mem[5], mem[9], mem[13], mem[17],
10959 mem[6], mem[10], mem[14], mem[18], 11089 mem[6], mem[10], mem[14], mem[18],
10960 mem[7], mem[11], mem[15], mem[19]); 11090 mem[7], mem[11], mem[15], mem[19]);
10961 ca_layer_shared_state_.reset(new CALayerSharedState); 11091 ca_layer_shared_state_.reset(new CALayerSharedState);
10962 ca_layer_shared_state_->opacity = c.opacity; 11092 ca_layer_shared_state_->opacity = c.opacity;
10963 ca_layer_shared_state_->is_clipped = c.is_clipped ? true : false; 11093 ca_layer_shared_state_->is_clipped = c.is_clipped ? true : false;
10964 ca_layer_shared_state_->clip_rect = gfx::ToEnclosingRect(clip_rect); 11094 ca_layer_shared_state_->clip_rect = gfx::ToEnclosingRect(clip_rect);
10965 ca_layer_shared_state_->sorting_context_id = c.sorting_context_id; 11095 ca_layer_shared_state_->sorting_context_id = c.sorting_context_id;
10966 ca_layer_shared_state_->transform = transform; 11096 ca_layer_shared_state_->transform = transform;
10967 return error::kNoError; 11097 return error::kNoError;
10968 } 11098 }
10969 11099
10970 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( 11100 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM(
10971 uint32_t immediate_data_size, 11101 uint32_t immediate_data_size,
10972 const void* cmd_data) { 11102 const volatile void* cmd_data) {
10973 const gles2::cmds::ScheduleCALayerCHROMIUM& c = 11103 const volatile gles2::cmds::ScheduleCALayerCHROMIUM& c =
10974 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); 11104 *static_cast<const volatile gles2::cmds::ScheduleCALayerCHROMIUM*>(
11105 cmd_data);
10975 GLuint filter = c.filter; 11106 GLuint filter = c.filter;
10976 if (filter != GL_NEAREST && filter != GL_LINEAR) { 11107 if (filter != GL_NEAREST && filter != GL_LINEAR) {
10977 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", 11108 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM",
10978 "invalid filter"); 11109 "invalid filter");
10979 return error::kNoError; 11110 return error::kNoError;
10980 } 11111 }
10981 11112
10982 if (!ca_layer_shared_state_) { 11113 if (!ca_layer_shared_state_) {
10983 LOCAL_SET_GL_ERROR( 11114 LOCAL_SET_GL_ERROR(
10984 GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", 11115 GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
11021 ca_layer_shared_state_->opacity, filter); 11152 ca_layer_shared_state_->opacity, filter);
11022 if (!surface_->ScheduleCALayer(params)) { 11153 if (!surface_->ScheduleCALayer(params)) {
11023 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", 11154 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
11024 "failed to schedule CALayer"); 11155 "failed to schedule CALayer");
11025 } 11156 }
11026 return error::kNoError; 11157 return error::kNoError;
11027 } 11158 }
11028 11159
11029 void GLES2DecoderImpl::DoScheduleCALayerInUseQueryCHROMIUM( 11160 void GLES2DecoderImpl::DoScheduleCALayerInUseQueryCHROMIUM(
11030 GLsizei count, 11161 GLsizei count,
11031 const GLuint* textures) { 11162 const volatile GLuint* textures) {
11032 std::vector<gl::GLSurface::CALayerInUseQuery> queries; 11163 std::vector<gl::GLSurface::CALayerInUseQuery> queries;
11033 queries.reserve(count); 11164 queries.reserve(count);
11034 for (GLsizei i = 0; i < count; ++i) { 11165 for (GLsizei i = 0; i < count; ++i) {
11035 gl::GLImage* image = nullptr; 11166 gl::GLImage* image = nullptr;
11036 GLuint texture_id = textures[i]; 11167 GLuint texture_id = textures[i];
11037 if (texture_id) { 11168 if (texture_id) {
11038 TextureRef* ref = texture_manager()->GetTexture(texture_id); 11169 TextureRef* ref = texture_manager()->GetTexture(texture_id);
11039 if (!ref) { 11170 if (!ref) {
11040 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, 11171 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
11041 "glScheduleCALayerInUseQueryCHROMIUM", 11172 "glScheduleCALayerInUseQueryCHROMIUM",
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
11083 // Check that the client initialized the result. 11214 // Check that the client initialized the result.
11084 if (*location != -1) { 11215 if (*location != -1) {
11085 return error::kInvalidArguments; 11216 return error::kInvalidArguments;
11086 } 11217 }
11087 *location = program->GetAttribLocation(name_str); 11218 *location = program->GetAttribLocation(name_str);
11088 return error::kNoError; 11219 return error::kNoError;
11089 } 11220 }
11090 11221
11091 error::Error GLES2DecoderImpl::HandleGetAttribLocation( 11222 error::Error GLES2DecoderImpl::HandleGetAttribLocation(
11092 uint32_t immediate_data_size, 11223 uint32_t immediate_data_size,
11093 const void* cmd_data) { 11224 const volatile void* cmd_data) {
11094 const gles2::cmds::GetAttribLocation& c = 11225 const volatile gles2::cmds::GetAttribLocation& c =
11095 *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); 11226 *static_cast<const volatile gles2::cmds::GetAttribLocation*>(cmd_data);
11096 Bucket* bucket = GetBucket(c.name_bucket_id); 11227 Bucket* bucket = GetBucket(c.name_bucket_id);
11097 if (!bucket) { 11228 if (!bucket) {
11098 return error::kInvalidArguments; 11229 return error::kInvalidArguments;
11099 } 11230 }
11100 std::string name_str; 11231 std::string name_str;
11101 if (!bucket->GetAsString(&name_str)) { 11232 if (!bucket->GetAsString(&name_str)) {
11102 return error::kInvalidArguments; 11233 return error::kInvalidArguments;
11103 } 11234 }
11104 return GetAttribLocationHelper( 11235 return GetAttribLocationHelper(
11105 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11236 c.program, c.location_shm_id, c.location_shm_offset, name_str);
(...skipping 27 matching lines...) Expand all
11133 // Check that the client initialized the result. 11264 // Check that the client initialized the result.
11134 if (*location != -1) { 11265 if (*location != -1) {
11135 return error::kInvalidArguments; 11266 return error::kInvalidArguments;
11136 } 11267 }
11137 *location = program->GetUniformFakeLocation(name_str); 11268 *location = program->GetUniformFakeLocation(name_str);
11138 return error::kNoError; 11269 return error::kNoError;
11139 } 11270 }
11140 11271
11141 error::Error GLES2DecoderImpl::HandleGetUniformLocation( 11272 error::Error GLES2DecoderImpl::HandleGetUniformLocation(
11142 uint32_t immediate_data_size, 11273 uint32_t immediate_data_size,
11143 const void* cmd_data) { 11274 const volatile void* cmd_data) {
11144 const gles2::cmds::GetUniformLocation& c = 11275 const volatile gles2::cmds::GetUniformLocation& c =
11145 *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); 11276 *static_cast<const volatile gles2::cmds::GetUniformLocation*>(cmd_data);
11146 Bucket* bucket = GetBucket(c.name_bucket_id); 11277 Bucket* bucket = GetBucket(c.name_bucket_id);
11147 if (!bucket) { 11278 if (!bucket) {
11148 return error::kInvalidArguments; 11279 return error::kInvalidArguments;
11149 } 11280 }
11150 std::string name_str; 11281 std::string name_str;
11151 if (!bucket->GetAsString(&name_str)) { 11282 if (!bucket->GetAsString(&name_str)) {
11152 return error::kInvalidArguments; 11283 return error::kInvalidArguments;
11153 } 11284 }
11154 return GetUniformLocationHelper( 11285 return GetUniformLocationHelper(
11155 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11286 c.program, c.location_shm_id, c.location_shm_offset, name_str);
11156 } 11287 }
11157 11288
11158 error::Error GLES2DecoderImpl::HandleGetUniformIndices( 11289 error::Error GLES2DecoderImpl::HandleGetUniformIndices(
11159 uint32_t immediate_data_size, 11290 uint32_t immediate_data_size,
11160 const void* cmd_data) { 11291 const volatile void* cmd_data) {
11161 if (!unsafe_es3_apis_enabled()) 11292 if (!unsafe_es3_apis_enabled())
11162 return error::kUnknownCommand; 11293 return error::kUnknownCommand;
11163 const gles2::cmds::GetUniformIndices& c = 11294 const volatile gles2::cmds::GetUniformIndices& c =
11164 *static_cast<const gles2::cmds::GetUniformIndices*>(cmd_data); 11295 *static_cast<const volatile gles2::cmds::GetUniformIndices*>(cmd_data);
11165 Bucket* bucket = GetBucket(c.names_bucket_id); 11296 Bucket* bucket = GetBucket(c.names_bucket_id);
11166 if (!bucket) { 11297 if (!bucket) {
11167 return error::kInvalidArguments; 11298 return error::kInvalidArguments;
11168 } 11299 }
11169 GLsizei count = 0; 11300 GLsizei count = 0;
11170 std::vector<char*> names; 11301 std::vector<char*> names;
11171 std::vector<GLint> len; 11302 std::vector<GLint> len;
11172 if (!bucket->GetAsStrings(&count, &names, &len) || count <= 0) { 11303 if (!bucket->GetAsStrings(&count, &names, &len) || count <= 0) {
11173 return error::kInvalidArguments; 11304 return error::kInvalidArguments;
11174 } 11305 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
11231 "program not linked"); 11362 "program not linked");
11232 return error::kNoError; 11363 return error::kNoError;
11233 } 11364 }
11234 11365
11235 *location = program->GetFragDataLocation(name_str); 11366 *location = program->GetFragDataLocation(name_str);
11236 return error::kNoError; 11367 return error::kNoError;
11237 } 11368 }
11238 11369
11239 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( 11370 error::Error GLES2DecoderImpl::HandleGetFragDataLocation(
11240 uint32_t immediate_data_size, 11371 uint32_t immediate_data_size,
11241 const void* cmd_data) { 11372 const volatile void* cmd_data) {
11242 if (!unsafe_es3_apis_enabled()) 11373 if (!unsafe_es3_apis_enabled())
11243 return error::kUnknownCommand; 11374 return error::kUnknownCommand;
11244 const gles2::cmds::GetFragDataLocation& c = 11375 const volatile gles2::cmds::GetFragDataLocation& c =
11245 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); 11376 *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data);
11246 Bucket* bucket = GetBucket(c.name_bucket_id); 11377 Bucket* bucket = GetBucket(c.name_bucket_id);
11247 if (!bucket) { 11378 if (!bucket) {
11248 return error::kInvalidArguments; 11379 return error::kInvalidArguments;
11249 } 11380 }
11250 std::string name_str; 11381 std::string name_str;
11251 if (!bucket->GetAsString(&name_str)) { 11382 if (!bucket->GetAsString(&name_str)) {
11252 return error::kInvalidArguments; 11383 return error::kInvalidArguments;
11253 } 11384 }
11254 return GetFragDataLocationHelper( 11385 return GetFragDataLocationHelper(
11255 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11386 c.program, c.location_shm_id, c.location_shm_offset, name_str);
(...skipping 23 matching lines...) Expand all
11279 "program not linked"); 11410 "program not linked");
11280 return error::kNoError; 11411 return error::kNoError;
11281 } 11412 }
11282 11413
11283 *index = program->GetFragDataIndex(name_str); 11414 *index = program->GetFragDataIndex(name_str);
11284 return error::kNoError; 11415 return error::kNoError;
11285 } 11416 }
11286 11417
11287 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT( 11418 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT(
11288 uint32_t immediate_data_size, 11419 uint32_t immediate_data_size,
11289 const void* cmd_data) { 11420 const volatile void* cmd_data) {
11290 if (!features().ext_blend_func_extended) { 11421 if (!features().ext_blend_func_extended) {
11291 return error::kUnknownCommand; 11422 return error::kUnknownCommand;
11292 } 11423 }
11293 const gles2::cmds::GetFragDataIndexEXT& c = 11424 const volatile gles2::cmds::GetFragDataIndexEXT& c =
11294 *static_cast<const gles2::cmds::GetFragDataIndexEXT*>(cmd_data); 11425 *static_cast<const volatile gles2::cmds::GetFragDataIndexEXT*>(cmd_data);
11295 Bucket* bucket = GetBucket(c.name_bucket_id); 11426 Bucket* bucket = GetBucket(c.name_bucket_id);
11296 if (!bucket) { 11427 if (!bucket) {
11297 return error::kInvalidArguments; 11428 return error::kInvalidArguments;
11298 } 11429 }
11299 std::string name_str; 11430 std::string name_str;
11300 if (!bucket->GetAsString(&name_str)) { 11431 if (!bucket->GetAsString(&name_str)) {
11301 return error::kInvalidArguments; 11432 return error::kInvalidArguments;
11302 } 11433 }
11303 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, 11434 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset,
11304 name_str); 11435 name_str);
11305 } 11436 }
11306 11437
11307 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( 11438 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex(
11308 uint32_t immediate_data_size, 11439 uint32_t immediate_data_size,
11309 const void* cmd_data) { 11440 const volatile void* cmd_data) {
11310 if (!unsafe_es3_apis_enabled()) 11441 if (!unsafe_es3_apis_enabled())
11311 return error::kUnknownCommand; 11442 return error::kUnknownCommand;
11312 const gles2::cmds::GetUniformBlockIndex& c = 11443 const volatile gles2::cmds::GetUniformBlockIndex& c =
11313 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); 11444 *static_cast<const volatile gles2::cmds::GetUniformBlockIndex*>(cmd_data);
11314 Bucket* bucket = GetBucket(c.name_bucket_id); 11445 Bucket* bucket = GetBucket(c.name_bucket_id);
11315 if (!bucket) { 11446 if (!bucket) {
11316 return error::kInvalidArguments; 11447 return error::kInvalidArguments;
11317 } 11448 }
11318 std::string name_str; 11449 std::string name_str;
11319 if (!bucket->GetAsString(&name_str)) { 11450 if (!bucket->GetAsString(&name_str)) {
11320 return error::kInvalidArguments; 11451 return error::kInvalidArguments;
11321 } 11452 }
11322 GLuint* index = GetSharedMemoryAs<GLuint*>( 11453 GLuint* index = GetSharedMemoryAs<GLuint*>(
11323 c.index_shm_id, c.index_shm_offset, sizeof(GLuint)); 11454 c.index_shm_id, c.index_shm_offset, sizeof(GLuint));
11324 if (!index) { 11455 if (!index) {
11325 return error::kOutOfBounds; 11456 return error::kOutOfBounds;
11326 } 11457 }
11327 // Check that the client initialized the result. 11458 // Check that the client initialized the result.
11328 if (*index != GL_INVALID_INDEX) { 11459 if (*index != GL_INVALID_INDEX) {
11329 return error::kInvalidArguments; 11460 return error::kInvalidArguments;
11330 } 11461 }
11331 Program* program = GetProgramInfoNotShader( 11462 Program* program = GetProgramInfoNotShader(
11332 c.program, "glGetUniformBlockIndex"); 11463 c.program, "glGetUniformBlockIndex");
11333 if (!program) { 11464 if (!program) {
11334 return error::kNoError; 11465 return error::kNoError;
11335 } 11466 }
11336 *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str()); 11467 *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str());
11337 return error::kNoError; 11468 return error::kNoError;
11338 } 11469 }
11339 11470
11340 error::Error GLES2DecoderImpl::HandleGetString(uint32_t immediate_data_size, 11471 error::Error GLES2DecoderImpl::HandleGetString(uint32_t immediate_data_size,
11341 const void* cmd_data) { 11472 const volatile void* cmd_data) {
11342 const gles2::cmds::GetString& c = 11473 const volatile gles2::cmds::GetString& c =
11343 *static_cast<const gles2::cmds::GetString*>(cmd_data); 11474 *static_cast<const volatile gles2::cmds::GetString*>(cmd_data);
11344 GLenum name = static_cast<GLenum>(c.name); 11475 GLenum name = static_cast<GLenum>(c.name);
11345 if (!validators_->string_type.IsValid(name)) { 11476 if (!validators_->string_type.IsValid(name)) {
11346 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); 11477 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name");
11347 return error::kNoError; 11478 return error::kNoError;
11348 } 11479 }
11349 11480
11350 const char* str = nullptr; 11481 const char* str = nullptr;
11351 std::string extensions; 11482 std::string extensions;
11352 switch (name) { 11483 switch (name) {
11353 case GL_VERSION: 11484 case GL_VERSION:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
11417 default: 11548 default:
11418 str = reinterpret_cast<const char*>(glGetString(name)); 11549 str = reinterpret_cast<const char*>(glGetString(name));
11419 break; 11550 break;
11420 } 11551 }
11421 Bucket* bucket = CreateBucket(c.bucket_id); 11552 Bucket* bucket = CreateBucket(c.bucket_id);
11422 bucket->SetFromString(str); 11553 bucket->SetFromString(str);
11423 return error::kNoError; 11554 return error::kNoError;
11424 } 11555 }
11425 11556
11426 error::Error GLES2DecoderImpl::HandleBufferData(uint32_t immediate_data_size, 11557 error::Error GLES2DecoderImpl::HandleBufferData(uint32_t immediate_data_size,
11427 const void* cmd_data) { 11558 const volatile void* cmd_data) {
11428 const gles2::cmds::BufferData& c = 11559 const volatile gles2::cmds::BufferData& c =
11429 *static_cast<const gles2::cmds::BufferData*>(cmd_data); 11560 *static_cast<const volatile gles2::cmds::BufferData*>(cmd_data);
11430 GLenum target = static_cast<GLenum>(c.target); 11561 GLenum target = static_cast<GLenum>(c.target);
11431 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); 11562 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
11432 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); 11563 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id);
11433 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); 11564 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset);
11434 GLenum usage = static_cast<GLenum>(c.usage); 11565 GLenum usage = static_cast<GLenum>(c.usage);
11435 const void* data = NULL; 11566 const void* data = NULL;
11436 if (data_shm_id != 0 || data_shm_offset != 0) { 11567 if (data_shm_id != 0 || data_shm_offset != 0) {
11437 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); 11568 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size);
11438 if (!data) { 11569 if (!data) {
11439 return error::kOutOfBounds; 11570 return error::kOutOfBounds;
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
12557 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, 12688 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
12558 height, depth, format, image_size, data); 12689 height, depth, format, image_size, data);
12559 } 12690 }
12560 12691
12561 // This may be a slow command. Exit command processing to allow for 12692 // This may be a slow command. Exit command processing to allow for
12562 // context preemption and GPU watchdog checks. 12693 // context preemption and GPU watchdog checks.
12563 ExitCommandProcessingEarly(); 12694 ExitCommandProcessingEarly();
12564 } 12695 }
12565 12696
12566 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, 12697 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size,
12567 const void* cmd_data) { 12698 const volatile void* cmd_data) {
12568 const gles2::cmds::TexImage2D& c = 12699 const volatile gles2::cmds::TexImage2D& c =
12569 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); 12700 *static_cast<const volatile gles2::cmds::TexImage2D*>(cmd_data);
12570 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", 12701 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D",
12571 "width", c.width, "height", c.height); 12702 "width", c.width, "height", c.height);
12572 // Set as failed for now, but if it successed, this will be set to not failed. 12703 // Set as failed for now, but if it successed, this will be set to not failed.
12573 texture_state_.tex_image_failed = true; 12704 texture_state_.tex_image_failed = true;
12574 GLenum target = static_cast<GLenum>(c.target); 12705 GLenum target = static_cast<GLenum>(c.target);
12575 GLint level = static_cast<GLint>(c.level); 12706 GLint level = static_cast<GLint>(c.level);
12576 GLint internal_format = static_cast<GLint>(c.internalformat); 12707 GLint internal_format = static_cast<GLint>(c.internalformat);
12577 GLsizei width = static_cast<GLsizei>(c.width); 12708 GLsizei width = static_cast<GLsizei>(c.width);
12578 GLsizei height = static_cast<GLsizei>(c.height); 12709 GLsizei height = static_cast<GLsizei>(c.height);
12579 GLint border = static_cast<GLint>(c.border); 12710 GLint border = static_cast<GLint>(c.border);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
12643 texture_manager()->ValidateAndDoTexImage( 12774 texture_manager()->ValidateAndDoTexImage(
12644 &texture_state_, &state_, &framebuffer_state_, "glTexImage2D", args); 12775 &texture_state_, &state_, &framebuffer_state_, "glTexImage2D", args);
12645 12776
12646 // This may be a slow command. Exit command processing to allow for 12777 // This may be a slow command. Exit command processing to allow for
12647 // context preemption and GPU watchdog checks. 12778 // context preemption and GPU watchdog checks.
12648 ExitCommandProcessingEarly(); 12779 ExitCommandProcessingEarly();
12649 return error::kNoError; 12780 return error::kNoError;
12650 } 12781 }
12651 12782
12652 error::Error GLES2DecoderImpl::HandleTexImage3D(uint32_t immediate_data_size, 12783 error::Error GLES2DecoderImpl::HandleTexImage3D(uint32_t immediate_data_size,
12653 const void* cmd_data) { 12784 const volatile void* cmd_data) {
12654 if (!unsafe_es3_apis_enabled()) 12785 if (!unsafe_es3_apis_enabled())
12655 return error::kUnknownCommand; 12786 return error::kUnknownCommand;
12656 12787
12657 const gles2::cmds::TexImage3D& c = 12788 const volatile gles2::cmds::TexImage3D& c =
12658 *static_cast<const gles2::cmds::TexImage3D*>(cmd_data); 12789 *static_cast<const volatile gles2::cmds::TexImage3D*>(cmd_data);
12659 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D", 12790 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D",
12660 "widthXheight", c.width * c.height, "depth", c.depth); 12791 "widthXheight", c.width * c.height, "depth", c.depth);
12661 // Set as failed for now, but if it successed, this will be set to not failed. 12792 // Set as failed for now, but if it successed, this will be set to not failed.
12662 texture_state_.tex_image_failed = true; 12793 texture_state_.tex_image_failed = true;
12663 GLenum target = static_cast<GLenum>(c.target); 12794 GLenum target = static_cast<GLenum>(c.target);
12664 GLint level = static_cast<GLint>(c.level); 12795 GLint level = static_cast<GLint>(c.level);
12665 GLint internal_format = static_cast<GLint>(c.internalformat); 12796 GLint internal_format = static_cast<GLint>(c.internalformat);
12666 GLsizei width = static_cast<GLsizei>(c.width); 12797 GLsizei width = static_cast<GLsizei>(c.width);
12667 GLsizei height = static_cast<GLsizei>(c.height); 12798 GLsizei height = static_cast<GLsizei>(c.height);
12668 GLsizei depth = static_cast<GLsizei>(c.depth); 12799 GLsizei depth = static_cast<GLsizei>(c.depth);
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
13316 glCopyTexSubImage3D(target, level, destX, destY, zoffset, 13447 glCopyTexSubImage3D(target, level, destX, destY, zoffset,
13317 copyX, copyY, copyWidth, copyHeight); 13448 copyX, copyY, copyWidth, copyHeight);
13318 } 13449 }
13319 } 13450 }
13320 13451
13321 // This may be a slow command. Exit command processing to allow for 13452 // This may be a slow command. Exit command processing to allow for
13322 // context preemption and GPU watchdog checks. 13453 // context preemption and GPU watchdog checks.
13323 ExitCommandProcessingEarly(); 13454 ExitCommandProcessingEarly();
13324 } 13455 }
13325 13456
13326 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, 13457 error::Error GLES2DecoderImpl::HandleTexSubImage2D(
13327 const void* cmd_data) { 13458 uint32_t immediate_data_size,
13328 const gles2::cmds::TexSubImage2D& c = 13459 const volatile void* cmd_data) {
13329 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); 13460 const volatile gles2::cmds::TexSubImage2D& c =
13461 *static_cast<const volatile gles2::cmds::TexSubImage2D*>(cmd_data);
13330 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", 13462 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D",
13331 "width", c.width, "height", c.height); 13463 "width", c.width, "height", c.height);
13332 GLboolean internal = static_cast<GLboolean>(c.internal); 13464 GLboolean internal = static_cast<GLboolean>(c.internal);
13333 if (internal == GL_TRUE && texture_state_.tex_image_failed) 13465 if (internal == GL_TRUE && texture_state_.tex_image_failed)
13334 return error::kNoError; 13466 return error::kNoError;
13335 13467
13336 GLenum target = static_cast<GLenum>(c.target); 13468 GLenum target = static_cast<GLenum>(c.target);
13337 GLint level = static_cast<GLint>(c.level); 13469 GLint level = static_cast<GLint>(c.level);
13338 GLint xoffset = static_cast<GLint>(c.xoffset); 13470 GLint xoffset = static_cast<GLint>(c.xoffset);
13339 GLint yoffset = static_cast<GLint>(c.yoffset); 13471 GLint yoffset = static_cast<GLint>(c.yoffset);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
13394 texture_manager()->ValidateAndDoTexSubImage(this, &texture_state_, &state_, 13526 texture_manager()->ValidateAndDoTexSubImage(this, &texture_state_, &state_,
13395 &framebuffer_state_, 13527 &framebuffer_state_,
13396 "glTexSubImage2D", args); 13528 "glTexSubImage2D", args);
13397 13529
13398 // This may be a slow command. Exit command processing to allow for 13530 // This may be a slow command. Exit command processing to allow for
13399 // context preemption and GPU watchdog checks. 13531 // context preemption and GPU watchdog checks.
13400 ExitCommandProcessingEarly(); 13532 ExitCommandProcessingEarly();
13401 return error::kNoError; 13533 return error::kNoError;
13402 } 13534 }
13403 13535
13404 error::Error GLES2DecoderImpl::HandleTexSubImage3D(uint32_t immediate_data_size, 13536 error::Error GLES2DecoderImpl::HandleTexSubImage3D(
13405 const void* cmd_data) { 13537 uint32_t immediate_data_size,
13538 const volatile void* cmd_data) {
13406 if (!unsafe_es3_apis_enabled()) 13539 if (!unsafe_es3_apis_enabled())
13407 return error::kUnknownCommand; 13540 return error::kUnknownCommand;
13408 13541
13409 const gles2::cmds::TexSubImage3D& c = 13542 const volatile gles2::cmds::TexSubImage3D& c =
13410 *static_cast<const gles2::cmds::TexSubImage3D*>(cmd_data); 13543 *static_cast<const volatile gles2::cmds::TexSubImage3D*>(cmd_data);
13411 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D", 13544 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D",
13412 "widthXheight", c.width * c.height, "depth", c.depth); 13545 "widthXheight", c.width * c.height, "depth", c.depth);
13413 GLboolean internal = static_cast<GLboolean>(c.internal); 13546 GLboolean internal = static_cast<GLboolean>(c.internal);
13414 if (internal == GL_TRUE && texture_state_.tex_image_failed) 13547 if (internal == GL_TRUE && texture_state_.tex_image_failed)
13415 return error::kNoError; 13548 return error::kNoError;
13416 13549
13417 GLenum target = static_cast<GLenum>(c.target); 13550 GLenum target = static_cast<GLenum>(c.target);
13418 GLint level = static_cast<GLint>(c.level); 13551 GLint level = static_cast<GLint>(c.level);
13419 GLint xoffset = static_cast<GLint>(c.xoffset); 13552 GLint xoffset = static_cast<GLint>(c.xoffset);
13420 GLint yoffset = static_cast<GLint>(c.yoffset); 13553 GLint yoffset = static_cast<GLint>(c.yoffset);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
13479 "glTexSubImage3D", args); 13612 "glTexSubImage3D", args);
13480 13613
13481 // This may be a slow command. Exit command processing to allow for 13614 // This may be a slow command. Exit command processing to allow for
13482 // context preemption and GPU watchdog checks. 13615 // context preemption and GPU watchdog checks.
13483 ExitCommandProcessingEarly(); 13616 ExitCommandProcessingEarly();
13484 return error::kNoError; 13617 return error::kNoError;
13485 } 13618 }
13486 13619
13487 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( 13620 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv(
13488 uint32_t immediate_data_size, 13621 uint32_t immediate_data_size,
13489 const void* cmd_data) { 13622 const volatile void* cmd_data) {
13490 const gles2::cmds::GetVertexAttribPointerv& c = 13623 const volatile gles2::cmds::GetVertexAttribPointerv& c =
13491 *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); 13624 *static_cast<const volatile gles2::cmds::GetVertexAttribPointerv*>(
13625 cmd_data);
13492 GLuint index = static_cast<GLuint>(c.index); 13626 GLuint index = static_cast<GLuint>(c.index);
13493 GLenum pname = static_cast<GLenum>(c.pname); 13627 GLenum pname = static_cast<GLenum>(c.pname);
13494 typedef cmds::GetVertexAttribPointerv::Result Result; 13628 typedef cmds::GetVertexAttribPointerv::Result Result;
13495 Result* result = GetSharedMemoryAs<Result*>( 13629 Result* result = GetSharedMemoryAs<Result*>(
13496 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); 13630 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1));
13497 if (!result) { 13631 if (!result) {
13498 return error::kOutOfBounds; 13632 return error::kOutOfBounds;
13499 } 13633 }
13500 // Check that the client initialized the result. 13634 // Check that the client initialized the result.
13501 if (result->size != 0) { 13635 if (result->size != 0) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
13578 if (!result) { 13712 if (!result) {
13579 *error = error::kOutOfBounds; 13713 *error = error::kOutOfBounds;
13580 return false; 13714 return false;
13581 } 13715 }
13582 result->SetNumResults(num_elements); 13716 result->SetNumResults(num_elements);
13583 *result_size = num_elements * sizeof(T); 13717 *result_size = num_elements * sizeof(T);
13584 *result_type = type; 13718 *result_type = type;
13585 return true; 13719 return true;
13586 } 13720 }
13587 13721
13588 error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32_t immediate_data_size, 13722 error::Error GLES2DecoderImpl::HandleGetUniformiv(
13589 const void* cmd_data) { 13723 uint32_t immediate_data_size,
13590 const gles2::cmds::GetUniformiv& c = 13724 const volatile void* cmd_data) {
13591 *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); 13725 const volatile gles2::cmds::GetUniformiv& c =
13726 *static_cast<const volatile gles2::cmds::GetUniformiv*>(cmd_data);
13592 GLuint program = c.program; 13727 GLuint program = c.program;
13593 GLint fake_location = c.location; 13728 GLint fake_location = c.location;
13594 GLuint service_id; 13729 GLuint service_id;
13595 GLenum result_type; 13730 GLenum result_type;
13596 GLsizei result_size; 13731 GLsizei result_size;
13597 GLint real_location = -1; 13732 GLint real_location = -1;
13598 Error error; 13733 Error error;
13599 cmds::GetUniformiv::Result* result; 13734 cmds::GetUniformiv::Result* result;
13600 if (GetUniformSetup<GLint>(program, fake_location, c.params_shm_id, 13735 if (GetUniformSetup<GLint>(program, fake_location, c.params_shm_id,
13601 c.params_shm_offset, &error, &real_location, 13736 c.params_shm_offset, &error, &real_location,
13602 &service_id, &result, &result_type, 13737 &service_id, &result, &result_type,
13603 &result_size)) { 13738 &result_size)) {
13604 glGetUniformiv( 13739 glGetUniformiv(
13605 service_id, real_location, result->GetData()); 13740 service_id, real_location, result->GetData());
13606 } 13741 }
13607 return error; 13742 return error;
13608 } 13743 }
13609 13744
13610 error::Error GLES2DecoderImpl::HandleGetUniformuiv(uint32_t immediate_data_size, 13745 error::Error GLES2DecoderImpl::HandleGetUniformuiv(
13611 const void* cmd_data) { 13746 uint32_t immediate_data_size,
13747 const volatile void* cmd_data) {
13612 if (!unsafe_es3_apis_enabled()) 13748 if (!unsafe_es3_apis_enabled())
13613 return error::kUnknownCommand; 13749 return error::kUnknownCommand;
13614 13750
13615 const gles2::cmds::GetUniformuiv& c = 13751 const volatile gles2::cmds::GetUniformuiv& c =
13616 *static_cast<const gles2::cmds::GetUniformuiv*>(cmd_data); 13752 *static_cast<const volatile gles2::cmds::GetUniformuiv*>(cmd_data);
13617 GLuint program = c.program; 13753 GLuint program = c.program;
13618 GLint fake_location = c.location; 13754 GLint fake_location = c.location;
13619 GLuint service_id; 13755 GLuint service_id;
13620 GLenum result_type; 13756 GLenum result_type;
13621 GLsizei result_size; 13757 GLsizei result_size;
13622 GLint real_location = -1; 13758 GLint real_location = -1;
13623 Error error; 13759 Error error;
13624 cmds::GetUniformuiv::Result* result; 13760 cmds::GetUniformuiv::Result* result;
13625 if (GetUniformSetup<GLuint>(program, fake_location, c.params_shm_id, 13761 if (GetUniformSetup<GLuint>(program, fake_location, c.params_shm_id,
13626 c.params_shm_offset, &error, &real_location, 13762 c.params_shm_offset, &error, &real_location,
13627 &service_id, &result, &result_type, 13763 &service_id, &result, &result_type,
13628 &result_size)) { 13764 &result_size)) {
13629 glGetUniformuiv( 13765 glGetUniformuiv(
13630 service_id, real_location, result->GetData()); 13766 service_id, real_location, result->GetData());
13631 } 13767 }
13632 return error; 13768 return error;
13633 } 13769 }
13634 13770
13635 error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32_t immediate_data_size, 13771 error::Error GLES2DecoderImpl::HandleGetUniformfv(
13636 const void* cmd_data) { 13772 uint32_t immediate_data_size,
13637 const gles2::cmds::GetUniformfv& c = 13773 const volatile void* cmd_data) {
13638 *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); 13774 const volatile gles2::cmds::GetUniformfv& c =
13775 *static_cast<const volatile gles2::cmds::GetUniformfv*>(cmd_data);
13639 GLuint program = c.program; 13776 GLuint program = c.program;
13640 GLint fake_location = c.location; 13777 GLint fake_location = c.location;
13641 GLuint service_id; 13778 GLuint service_id;
13642 GLint real_location = -1; 13779 GLint real_location = -1;
13643 Error error; 13780 Error error;
13644 cmds::GetUniformfv::Result* result; 13781 cmds::GetUniformfv::Result* result;
13645 GLenum result_type; 13782 GLenum result_type;
13646 GLsizei result_size; 13783 GLsizei result_size;
13647 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, 13784 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id,
13648 c.params_shm_offset, &error, &real_location, 13785 c.params_shm_offset, &error, &real_location,
(...skipping 10 matching lines...) Expand all
13659 } 13796 }
13660 } else { 13797 } else {
13661 glGetUniformfv(service_id, real_location, result->GetData()); 13798 glGetUniformfv(service_id, real_location, result->GetData());
13662 } 13799 }
13663 } 13800 }
13664 return error; 13801 return error;
13665 } 13802 }
13666 13803
13667 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( 13804 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat(
13668 uint32_t immediate_data_size, 13805 uint32_t immediate_data_size,
13669 const void* cmd_data) { 13806 const volatile void* cmd_data) {
13670 const gles2::cmds::GetShaderPrecisionFormat& c = 13807 const volatile gles2::cmds::GetShaderPrecisionFormat& c =
13671 *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); 13808 *static_cast<const volatile gles2::cmds::GetShaderPrecisionFormat*>(
13809 cmd_data);
13672 GLenum shader_type = static_cast<GLenum>(c.shadertype); 13810 GLenum shader_type = static_cast<GLenum>(c.shadertype);
13673 GLenum precision_type = static_cast<GLenum>(c.precisiontype); 13811 GLenum precision_type = static_cast<GLenum>(c.precisiontype);
13674 typedef cmds::GetShaderPrecisionFormat::Result Result; 13812 typedef cmds::GetShaderPrecisionFormat::Result Result;
13675 Result* result = GetSharedMemoryAs<Result*>( 13813 Result* result = GetSharedMemoryAs<Result*>(
13676 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 13814 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13677 if (!result) { 13815 if (!result) {
13678 return error::kOutOfBounds; 13816 return error::kOutOfBounds;
13679 } 13817 }
13680 // Check that the client initialized the result. 13818 // Check that the client initialized the result.
13681 if (result->success != 0) { 13819 if (result->success != 0) {
(...skipping 19 matching lines...) Expand all
13701 13839
13702 result->min_range = range[0]; 13840 result->min_range = range[0];
13703 result->max_range = range[1]; 13841 result->max_range = range[1];
13704 result->precision = precision; 13842 result->precision = precision;
13705 13843
13706 return error::kNoError; 13844 return error::kNoError;
13707 } 13845 }
13708 13846
13709 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( 13847 error::Error GLES2DecoderImpl::HandleGetAttachedShaders(
13710 uint32_t immediate_data_size, 13848 uint32_t immediate_data_size,
13711 const void* cmd_data) { 13849 const volatile void* cmd_data) {
13712 const gles2::cmds::GetAttachedShaders& c = 13850 const volatile gles2::cmds::GetAttachedShaders& c =
13713 *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); 13851 *static_cast<const volatile gles2::cmds::GetAttachedShaders*>(cmd_data);
13714 uint32_t result_size = c.result_size; 13852 uint32_t result_size = c.result_size;
13715 GLuint program_id = static_cast<GLuint>(c.program); 13853 GLuint program_id = static_cast<GLuint>(c.program);
13716 Program* program = GetProgramInfoNotShader( 13854 Program* program = GetProgramInfoNotShader(
13717 program_id, "glGetAttachedShaders"); 13855 program_id, "glGetAttachedShaders");
13718 if (!program) { 13856 if (!program) {
13719 return error::kNoError; 13857 return error::kNoError;
13720 } 13858 }
13721 typedef cmds::GetAttachedShaders::Result Result; 13859 typedef cmds::GetAttachedShaders::Result Result;
13722 uint32_t max_count = Result::ComputeMaxResults(result_size); 13860 uint32_t max_count = Result::ComputeMaxResults(result_size);
13723 Result* result = GetSharedMemoryAs<Result*>( 13861 Result* result = GetSharedMemoryAs<Result*>(
(...skipping 14 matching lines...) Expand all
13738 NOTREACHED(); 13876 NOTREACHED();
13739 return error::kGenericError; 13877 return error::kGenericError;
13740 } 13878 }
13741 } 13879 }
13742 result->SetNumResults(count); 13880 result->SetNumResults(count);
13743 return error::kNoError; 13881 return error::kNoError;
13744 } 13882 }
13745 13883
13746 error::Error GLES2DecoderImpl::HandleGetActiveUniform( 13884 error::Error GLES2DecoderImpl::HandleGetActiveUniform(
13747 uint32_t immediate_data_size, 13885 uint32_t immediate_data_size,
13748 const void* cmd_data) { 13886 const volatile void* cmd_data) {
13749 const gles2::cmds::GetActiveUniform& c = 13887 const volatile gles2::cmds::GetActiveUniform& c =
13750 *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); 13888 *static_cast<const volatile gles2::cmds::GetActiveUniform*>(cmd_data);
13751 GLuint program_id = c.program; 13889 GLuint program_id = c.program;
13752 GLuint index = c.index; 13890 GLuint index = c.index;
13753 uint32_t name_bucket_id = c.name_bucket_id; 13891 uint32_t name_bucket_id = c.name_bucket_id;
13754 typedef cmds::GetActiveUniform::Result Result; 13892 typedef cmds::GetActiveUniform::Result Result;
13755 Result* result = GetSharedMemoryAs<Result*>( 13893 Result* result = GetSharedMemoryAs<Result*>(
13756 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 13894 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13757 if (!result) { 13895 if (!result) {
13758 return error::kOutOfBounds; 13896 return error::kOutOfBounds;
13759 } 13897 }
13760 // Check that the client initialized the result. 13898 // Check that the client initialized the result.
(...skipping 15 matching lines...) Expand all
13776 result->success = 1; // true. 13914 result->success = 1; // true.
13777 result->size = uniform_info->size; 13915 result->size = uniform_info->size;
13778 result->type = uniform_info->type; 13916 result->type = uniform_info->type;
13779 Bucket* bucket = CreateBucket(name_bucket_id); 13917 Bucket* bucket = CreateBucket(name_bucket_id);
13780 bucket->SetFromString(uniform_info->name.c_str()); 13918 bucket->SetFromString(uniform_info->name.c_str());
13781 return error::kNoError; 13919 return error::kNoError;
13782 } 13920 }
13783 13921
13784 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv( 13922 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv(
13785 uint32_t immediate_data_size, 13923 uint32_t immediate_data_size,
13786 const void* cmd_data) { 13924 const volatile void* cmd_data) {
13787 if (!unsafe_es3_apis_enabled()) 13925 if (!unsafe_es3_apis_enabled())
13788 return error::kUnknownCommand; 13926 return error::kUnknownCommand;
13789 const gles2::cmds::GetActiveUniformBlockiv& c = 13927 const volatile gles2::cmds::GetActiveUniformBlockiv& c =
13790 *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); 13928 *static_cast<const volatile gles2::cmds::GetActiveUniformBlockiv*>(
13929 cmd_data);
13791 GLuint program_id = c.program; 13930 GLuint program_id = c.program;
13792 GLuint index = static_cast<GLuint>(c.index); 13931 GLuint index = static_cast<GLuint>(c.index);
13793 GLenum pname = static_cast<GLenum>(c.pname); 13932 GLenum pname = static_cast<GLenum>(c.pname);
13794 Program* program = GetProgramInfoNotShader( 13933 Program* program = GetProgramInfoNotShader(
13795 program_id, "glGetActiveUniformBlockiv"); 13934 program_id, "glGetActiveUniformBlockiv");
13796 if (!program) { 13935 if (!program) {
13797 return error::kNoError; 13936 return error::kNoError;
13798 } 13937 }
13799 GLuint service_id = program->service_id(); 13938 GLuint service_id = program->service_id();
13800 GLint link_status = GL_FALSE; 13939 GLint link_status = GL_FALSE;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
13834 if (error == GL_NO_ERROR) { 13973 if (error == GL_NO_ERROR) {
13835 result->SetNumResults(num_values); 13974 result->SetNumResults(num_values);
13836 } else { 13975 } else {
13837 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); 13976 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", "");
13838 } 13977 }
13839 return error::kNoError; 13978 return error::kNoError;
13840 } 13979 }
13841 13980
13842 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName( 13981 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName(
13843 uint32_t immediate_data_size, 13982 uint32_t immediate_data_size,
13844 const void* cmd_data) { 13983 const volatile void* cmd_data) {
13845 if (!unsafe_es3_apis_enabled()) 13984 if (!unsafe_es3_apis_enabled())
13846 return error::kUnknownCommand; 13985 return error::kUnknownCommand;
13847 const gles2::cmds::GetActiveUniformBlockName& c = 13986 const volatile gles2::cmds::GetActiveUniformBlockName& c =
13848 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); 13987 *static_cast<const volatile gles2::cmds::GetActiveUniformBlockName*>(
13988 cmd_data);
13849 GLuint program_id = c.program; 13989 GLuint program_id = c.program;
13850 GLuint index = c.index; 13990 GLuint index = c.index;
13851 uint32_t name_bucket_id = c.name_bucket_id; 13991 uint32_t name_bucket_id = c.name_bucket_id;
13852 typedef cmds::GetActiveUniformBlockName::Result Result; 13992 typedef cmds::GetActiveUniformBlockName::Result Result;
13853 Result* result = GetSharedMemoryAs<Result*>( 13993 Result* result = GetSharedMemoryAs<Result*>(
13854 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 13994 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13855 if (!result) { 13995 if (!result) {
13856 return error::kOutOfBounds; 13996 return error::kOutOfBounds;
13857 } 13997 }
13858 // Check that the client initialized the result. 13998 // Check that the client initialized the result.
(...skipping 29 matching lines...) Expand all
13888 *result = 1; 14028 *result = 1;
13889 Bucket* bucket = CreateBucket(name_bucket_id); 14029 Bucket* bucket = CreateBucket(name_bucket_id);
13890 DCHECK_GT(buf_size, length); 14030 DCHECK_GT(buf_size, length);
13891 DCHECK_EQ(0, buffer[length]); 14031 DCHECK_EQ(0, buffer[length]);
13892 bucket->SetFromString(&buffer[0]); 14032 bucket->SetFromString(&buffer[0]);
13893 return error::kNoError; 14033 return error::kNoError;
13894 } 14034 }
13895 14035
13896 error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( 14036 error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv(
13897 uint32_t immediate_data_size, 14037 uint32_t immediate_data_size,
13898 const void* cmd_data) { 14038 const volatile void* cmd_data) {
13899 if (!unsafe_es3_apis_enabled()) 14039 if (!unsafe_es3_apis_enabled())
13900 return error::kUnknownCommand; 14040 return error::kUnknownCommand;
13901 const gles2::cmds::GetActiveUniformsiv& c = 14041 const volatile gles2::cmds::GetActiveUniformsiv& c =
13902 *static_cast<const gles2::cmds::GetActiveUniformsiv*>(cmd_data); 14042 *static_cast<const volatile gles2::cmds::GetActiveUniformsiv*>(cmd_data);
13903 GLuint program_id = c.program; 14043 GLuint program_id = c.program;
13904 GLenum pname = static_cast<GLenum>(c.pname); 14044 GLenum pname = static_cast<GLenum>(c.pname);
13905 Bucket* bucket = GetBucket(c.indices_bucket_id); 14045 Bucket* bucket = GetBucket(c.indices_bucket_id);
13906 if (!bucket) { 14046 if (!bucket) {
13907 return error::kInvalidArguments; 14047 return error::kInvalidArguments;
13908 } 14048 }
13909 if (!validators_->uniform_parameter.IsValid(pname)) { 14049 if (!validators_->uniform_parameter.IsValid(pname)) {
13910 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetActiveUniformsiv", pname, "pname"); 14050 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetActiveUniformsiv", pname, "pname");
13911 return error::kNoError; 14051 return error::kNoError;
13912 } 14052 }
(...skipping 29 matching lines...) Expand all
13942 if (error == GL_NO_ERROR) { 14082 if (error == GL_NO_ERROR) {
13943 result->SetNumResults(count); 14083 result->SetNumResults(count);
13944 } else { 14084 } else {
13945 LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", ""); 14085 LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", "");
13946 } 14086 }
13947 return error::kNoError; 14087 return error::kNoError;
13948 } 14088 }
13949 14089
13950 error::Error GLES2DecoderImpl::HandleGetActiveAttrib( 14090 error::Error GLES2DecoderImpl::HandleGetActiveAttrib(
13951 uint32_t immediate_data_size, 14091 uint32_t immediate_data_size,
13952 const void* cmd_data) { 14092 const volatile void* cmd_data) {
13953 const gles2::cmds::GetActiveAttrib& c = 14093 const volatile gles2::cmds::GetActiveAttrib& c =
13954 *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); 14094 *static_cast<const volatile gles2::cmds::GetActiveAttrib*>(cmd_data);
13955 GLuint program_id = c.program; 14095 GLuint program_id = c.program;
13956 GLuint index = c.index; 14096 GLuint index = c.index;
13957 uint32_t name_bucket_id = c.name_bucket_id; 14097 uint32_t name_bucket_id = c.name_bucket_id;
13958 typedef cmds::GetActiveAttrib::Result Result; 14098 typedef cmds::GetActiveAttrib::Result Result;
13959 Result* result = GetSharedMemoryAs<Result*>( 14099 Result* result = GetSharedMemoryAs<Result*>(
13960 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 14100 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13961 if (!result) { 14101 if (!result) {
13962 return error::kOutOfBounds; 14102 return error::kOutOfBounds;
13963 } 14103 }
13964 // Check that the client initialized the result. 14104 // Check that the client initialized the result.
(...skipping 13 matching lines...) Expand all
13978 return error::kNoError; 14118 return error::kNoError;
13979 } 14119 }
13980 result->success = 1; // true. 14120 result->success = 1; // true.
13981 result->size = attrib_info->size; 14121 result->size = attrib_info->size;
13982 result->type = attrib_info->type; 14122 result->type = attrib_info->type;
13983 Bucket* bucket = CreateBucket(name_bucket_id); 14123 Bucket* bucket = CreateBucket(name_bucket_id);
13984 bucket->SetFromString(attrib_info->name.c_str()); 14124 bucket->SetFromString(attrib_info->name.c_str());
13985 return error::kNoError; 14125 return error::kNoError;
13986 } 14126 }
13987 14127
13988 error::Error GLES2DecoderImpl::HandleShaderBinary(uint32_t immediate_data_size, 14128 error::Error GLES2DecoderImpl::HandleShaderBinary(
13989 const void* cmd_data) { 14129 uint32_t immediate_data_size,
14130 const volatile void* cmd_data) {
13990 #if 1 // No binary shader support. 14131 #if 1 // No binary shader support.
13991 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); 14132 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported");
13992 return error::kNoError; 14133 return error::kNoError;
13993 #else 14134 #else
13994 GLsizei n = static_cast<GLsizei>(c.n); 14135 GLsizei n = static_cast<GLsizei>(c.n);
13995 if (n < 0) { 14136 if (n < 0) {
13996 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); 14137 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0");
13997 return error::kNoError; 14138 return error::kNoError;
13998 } 14139 }
13999 GLsizei length = static_cast<GLsizei>(c.length); 14140 GLsizei length = static_cast<GLsizei>(c.length);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
14183 FinishSwapBuffers(surface_->CommitOverlayPlanes()); 14324 FinishSwapBuffers(surface_->CommitOverlayPlanes());
14184 } 14325 }
14185 } 14326 }
14186 14327
14187 void GLES2DecoderImpl::DoSwapInterval(int interval) { 14328 void GLES2DecoderImpl::DoSwapInterval(int interval) {
14188 context_->SetSwapInterval(interval); 14329 context_->SetSwapInterval(interval);
14189 } 14330 }
14190 14331
14191 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( 14332 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM(
14192 uint32_t immediate_data_size, 14333 uint32_t immediate_data_size,
14193 const void* cmd_data) { 14334 const volatile void* cmd_data) {
14194 const gles2::cmds::EnableFeatureCHROMIUM& c = 14335 const volatile gles2::cmds::EnableFeatureCHROMIUM& c =
14195 *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); 14336 *static_cast<const volatile gles2::cmds::EnableFeatureCHROMIUM*>(
14337 cmd_data);
14196 Bucket* bucket = GetBucket(c.bucket_id); 14338 Bucket* bucket = GetBucket(c.bucket_id);
14197 if (!bucket || bucket->size() == 0) { 14339 if (!bucket || bucket->size() == 0) {
14198 return error::kInvalidArguments; 14340 return error::kInvalidArguments;
14199 } 14341 }
14200 typedef cmds::EnableFeatureCHROMIUM::Result Result; 14342 typedef cmds::EnableFeatureCHROMIUM::Result Result;
14201 Result* result = GetSharedMemoryAs<Result*>( 14343 Result* result = GetSharedMemoryAs<Result*>(
14202 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 14344 c.result_shm_id, c.result_shm_offset, sizeof(*result));
14203 if (!result) { 14345 if (!result) {
14204 return error::kOutOfBounds; 14346 return error::kOutOfBounds;
14205 } 14347 }
(...skipping 24 matching lines...) Expand all
14230 } else { 14372 } else {
14231 return error::kNoError; 14373 return error::kNoError;
14232 } 14374 }
14233 14375
14234 *result = 1; // true. 14376 *result = 1; // true.
14235 return error::kNoError; 14377 return error::kNoError;
14236 } 14378 }
14237 14379
14238 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( 14380 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM(
14239 uint32_t immediate_data_size, 14381 uint32_t immediate_data_size,
14240 const void* cmd_data) { 14382 const volatile void* cmd_data) {
14241 const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = 14383 const volatile gles2::cmds::GetRequestableExtensionsCHROMIUM& c =
14242 *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( 14384 *static_cast<
14385 const volatile gles2::cmds::GetRequestableExtensionsCHROMIUM*>(
14243 cmd_data); 14386 cmd_data);
14244 Bucket* bucket = CreateBucket(c.bucket_id); 14387 Bucket* bucket = CreateBucket(c.bucket_id);
14245 scoped_refptr<FeatureInfo> info(new FeatureInfo(workarounds())); 14388 scoped_refptr<FeatureInfo> info(new FeatureInfo(workarounds()));
14246 DisallowedFeatures disallowed_features = feature_info_->disallowed_features(); 14389 DisallowedFeatures disallowed_features = feature_info_->disallowed_features();
14247 disallowed_features.AllowExtensions(); 14390 disallowed_features.AllowExtensions();
14248 info->Initialize(feature_info_->context_type(), disallowed_features); 14391 info->Initialize(feature_info_->context_type(), disallowed_features);
14249 bucket->SetFromString(info->extensions().c_str()); 14392 bucket->SetFromString(info->extensions().c_str());
14250 return error::kNoError; 14393 return error::kNoError;
14251 } 14394 }
14252 14395
14253 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( 14396 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM(
14254 uint32_t immediate_data_size, 14397 uint32_t immediate_data_size,
14255 const void* cmd_data) { 14398 const volatile void* cmd_data) {
14256 const gles2::cmds::RequestExtensionCHROMIUM& c = 14399 const volatile gles2::cmds::RequestExtensionCHROMIUM& c =
14257 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); 14400 *static_cast<const volatile gles2::cmds::RequestExtensionCHROMIUM*>(
14401 cmd_data);
14258 Bucket* bucket = GetBucket(c.bucket_id); 14402 Bucket* bucket = GetBucket(c.bucket_id);
14259 if (!bucket || bucket->size() == 0) { 14403 if (!bucket || bucket->size() == 0) {
14260 return error::kInvalidArguments; 14404 return error::kInvalidArguments;
14261 } 14405 }
14262 std::string feature_str; 14406 std::string feature_str;
14263 if (!bucket->GetAsString(&feature_str)) { 14407 if (!bucket->GetAsString(&feature_str)) {
14264 return error::kInvalidArguments; 14408 return error::kInvalidArguments;
14265 } 14409 }
14266 feature_str = feature_str + " "; 14410 feature_str = feature_str + " ";
14267 14411
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
14309 feature_info_->EnableOESTextureHalfFloatLinear(); 14453 feature_info_->EnableOESTextureHalfFloatLinear();
14310 } 14454 }
14311 14455
14312 UpdateCapabilities(); 14456 UpdateCapabilities();
14313 14457
14314 return error::kNoError; 14458 return error::kNoError;
14315 } 14459 }
14316 14460
14317 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( 14461 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM(
14318 uint32_t immediate_data_size, 14462 uint32_t immediate_data_size,
14319 const void* cmd_data) { 14463 const volatile void* cmd_data) {
14320 const gles2::cmds::GetProgramInfoCHROMIUM& c = 14464 const volatile gles2::cmds::GetProgramInfoCHROMIUM& c =
14321 *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); 14465 *static_cast<const volatile gles2::cmds::GetProgramInfoCHROMIUM*>(
14466 cmd_data);
14322 GLuint program_id = static_cast<GLuint>(c.program); 14467 GLuint program_id = static_cast<GLuint>(c.program);
14323 uint32_t bucket_id = c.bucket_id; 14468 uint32_t bucket_id = c.bucket_id;
14324 Bucket* bucket = CreateBucket(bucket_id); 14469 Bucket* bucket = CreateBucket(bucket_id);
14325 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. 14470 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail.
14326 Program* program = NULL; 14471 Program* program = NULL;
14327 program = GetProgram(program_id); 14472 program = GetProgram(program_id);
14328 if (!program || !program->IsValid()) { 14473 if (!program || !program->IsValid()) {
14329 return error::kNoError; 14474 return error::kNoError;
14330 } 14475 }
14331 program->GetProgramInfo(program_manager(), bucket); 14476 program->GetProgramInfo(program_manager(), bucket);
14332 return error::kNoError; 14477 return error::kNoError;
14333 } 14478 }
14334 14479
14335 error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM( 14480 error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM(
14336 uint32_t immediate_data_size, 14481 uint32_t immediate_data_size,
14337 const void* cmd_data) { 14482 const volatile void* cmd_data) {
14338 if (!unsafe_es3_apis_enabled()) 14483 if (!unsafe_es3_apis_enabled())
14339 return error::kUnknownCommand; 14484 return error::kUnknownCommand;
14340 const gles2::cmds::GetUniformBlocksCHROMIUM& c = 14485 const volatile gles2::cmds::GetUniformBlocksCHROMIUM& c =
14341 *static_cast<const gles2::cmds::GetUniformBlocksCHROMIUM*>(cmd_data); 14486 *static_cast<const volatile gles2::cmds::GetUniformBlocksCHROMIUM*>(
14487 cmd_data);
14342 GLuint program_id = static_cast<GLuint>(c.program); 14488 GLuint program_id = static_cast<GLuint>(c.program);
14343 uint32_t bucket_id = c.bucket_id; 14489 uint32_t bucket_id = c.bucket_id;
14344 Bucket* bucket = CreateBucket(bucket_id); 14490 Bucket* bucket = CreateBucket(bucket_id);
14345 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail. 14491 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail.
14346 Program* program = NULL; 14492 Program* program = NULL;
14347 program = GetProgram(program_id); 14493 program = GetProgram(program_id);
14348 if (!program || !program->IsValid()) { 14494 if (!program || !program->IsValid()) {
14349 return error::kNoError; 14495 return error::kNoError;
14350 } 14496 }
14351 program->GetUniformBlocks(bucket); 14497 program->GetUniformBlocks(bucket);
14352 return error::kNoError; 14498 return error::kNoError;
14353 } 14499 }
14354 14500
14355 error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM( 14501 error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM(
14356 uint32_t immediate_data_size, 14502 uint32_t immediate_data_size,
14357 const void* cmd_data) { 14503 const volatile void* cmd_data) {
14358 if (!unsafe_es3_apis_enabled()) 14504 if (!unsafe_es3_apis_enabled())
14359 return error::kUnknownCommand; 14505 return error::kUnknownCommand;
14360 const gles2::cmds::GetUniformsES3CHROMIUM& c = 14506 const volatile gles2::cmds::GetUniformsES3CHROMIUM& c =
14361 *static_cast<const gles2::cmds::GetUniformsES3CHROMIUM*>(cmd_data); 14507 *static_cast<const volatile gles2::cmds::GetUniformsES3CHROMIUM*>(
14508 cmd_data);
14362 GLuint program_id = static_cast<GLuint>(c.program); 14509 GLuint program_id = static_cast<GLuint>(c.program);
14363 uint32_t bucket_id = c.bucket_id; 14510 uint32_t bucket_id = c.bucket_id;
14364 Bucket* bucket = CreateBucket(bucket_id); 14511 Bucket* bucket = CreateBucket(bucket_id);
14365 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail. 14512 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail.
14366 Program* program = NULL; 14513 Program* program = NULL;
14367 program = GetProgram(program_id); 14514 program = GetProgram(program_id);
14368 if (!program || !program->IsValid()) { 14515 if (!program || !program->IsValid()) {
14369 return error::kNoError; 14516 return error::kNoError;
14370 } 14517 }
14371 program->GetUniformsES3(bucket); 14518 program->GetUniformsES3(bucket);
14372 return error::kNoError; 14519 return error::kNoError;
14373 } 14520 }
14374 14521
14375 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying( 14522 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying(
14376 uint32_t immediate_data_size, 14523 uint32_t immediate_data_size,
14377 const void* cmd_data) { 14524 const volatile void* cmd_data) {
14378 if (!unsafe_es3_apis_enabled()) 14525 if (!unsafe_es3_apis_enabled())
14379 return error::kUnknownCommand; 14526 return error::kUnknownCommand;
14380 const gles2::cmds::GetTransformFeedbackVarying& c = 14527 const volatile gles2::cmds::GetTransformFeedbackVarying& c =
14381 *static_cast<const gles2::cmds::GetTransformFeedbackVarying*>(cmd_data); 14528 *static_cast<const volatile gles2::cmds::GetTransformFeedbackVarying*>(
14529 cmd_data);
14382 GLuint program_id = c.program; 14530 GLuint program_id = c.program;
14383 GLuint index = c.index; 14531 GLuint index = c.index;
14384 uint32_t name_bucket_id = c.name_bucket_id; 14532 uint32_t name_bucket_id = c.name_bucket_id;
14385 typedef cmds::GetTransformFeedbackVarying::Result Result; 14533 typedef cmds::GetTransformFeedbackVarying::Result Result;
14386 Result* result = GetSharedMemoryAs<Result*>( 14534 Result* result = GetSharedMemoryAs<Result*>(
14387 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 14535 c.result_shm_id, c.result_shm_offset, sizeof(*result));
14388 if (!result) { 14536 if (!result) {
14389 return error::kOutOfBounds; 14537 return error::kOutOfBounds;
14390 } 14538 }
14391 // Check that the client initialized the result. 14539 // Check that the client initialized the result.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
14426 result->type = static_cast<uint32_t>(type); 14574 result->type = static_cast<uint32_t>(type);
14427 Bucket* bucket = CreateBucket(name_bucket_id); 14575 Bucket* bucket = CreateBucket(name_bucket_id);
14428 DCHECK(length >= 0 && length < max_length); 14576 DCHECK(length >= 0 && length < max_length);
14429 buffer[length] = '\0'; // Just to be safe. 14577 buffer[length] = '\0'; // Just to be safe.
14430 bucket->SetFromString(&buffer[0]); 14578 bucket->SetFromString(&buffer[0]);
14431 return error::kNoError; 14579 return error::kNoError;
14432 } 14580 }
14433 14581
14434 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM( 14582 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM(
14435 uint32_t immediate_data_size, 14583 uint32_t immediate_data_size,
14436 const void* cmd_data) { 14584 const volatile void* cmd_data) {
14437 if (!unsafe_es3_apis_enabled()) 14585 if (!unsafe_es3_apis_enabled())
14438 return error::kUnknownCommand; 14586 return error::kUnknownCommand;
14439 const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c = 14587 const volatile gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c =
14440 *static_cast<const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>( 14588 *static_cast<
14589 const volatile gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>(
14441 cmd_data); 14590 cmd_data);
14442 GLuint program_id = static_cast<GLuint>(c.program); 14591 GLuint program_id = static_cast<GLuint>(c.program);
14443 uint32_t bucket_id = c.bucket_id; 14592 uint32_t bucket_id = c.bucket_id;
14444 Bucket* bucket = CreateBucket(bucket_id); 14593 Bucket* bucket = CreateBucket(bucket_id);
14445 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail. 14594 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail.
14446 Program* program = NULL; 14595 Program* program = NULL;
14447 program = GetProgram(program_id); 14596 program = GetProgram(program_id);
14448 if (!program || !program->IsValid()) { 14597 if (!program || !program->IsValid()) {
14449 return error::kNoError; 14598 return error::kNoError;
14450 } 14599 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
14532 return false; 14681 return false;
14533 } 14682 }
14534 reset_by_robustness_extension_ = true; 14683 reset_by_robustness_extension_ = true;
14535 return true; 14684 return true;
14536 } 14685 }
14537 return false; 14686 return false;
14538 } 14687 }
14539 14688
14540 error::Error GLES2DecoderImpl::HandleDescheduleUntilFinishedCHROMIUM( 14689 error::Error GLES2DecoderImpl::HandleDescheduleUntilFinishedCHROMIUM(
14541 uint32_t immediate_data_size, 14690 uint32_t immediate_data_size,
14542 const void* cmd_data) { 14691 const volatile void* cmd_data) {
14543 if (deschedule_until_finished_callback_.is_null() || 14692 if (deschedule_until_finished_callback_.is_null() ||
14544 reschedule_after_finished_callback_.is_null()) { 14693 reschedule_after_finished_callback_.is_null()) {
14545 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 14694 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
14546 "glDescheduleUntilFinishedCHROMIUM", 14695 "glDescheduleUntilFinishedCHROMIUM",
14547 "Not fully implemented."); 14696 "Not fully implemented.");
14548 return error::kNoError; 14697 return error::kNoError;
14549 } 14698 }
14550 14699
14551 std::unique_ptr<gl::GLFence> fence(gl::GLFence::Create()); 14700 std::unique_ptr<gl::GLFence> fence(gl::GLFence::Create());
14552 deschedule_until_finished_fences_.push_back(std::move(fence)); 14701 deschedule_until_finished_fences_.push_back(std::move(fence));
14553 14702
14554 if (deschedule_until_finished_fences_.size() == 1) 14703 if (deschedule_until_finished_fences_.size() == 1)
14555 return error::kNoError; 14704 return error::kNoError;
14556 14705
14557 DCHECK_EQ(2u, deschedule_until_finished_fences_.size()); 14706 DCHECK_EQ(2u, deschedule_until_finished_fences_.size());
14558 if (deschedule_until_finished_fences_[0]->HasCompleted()) { 14707 if (deschedule_until_finished_fences_[0]->HasCompleted()) {
14559 deschedule_until_finished_fences_.erase( 14708 deschedule_until_finished_fences_.erase(
14560 deschedule_until_finished_fences_.begin()); 14709 deschedule_until_finished_fences_.begin());
14561 return error::kNoError; 14710 return error::kNoError;
14562 } 14711 }
14563 14712
14564 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::DescheduleUntilFinished", 14713 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::DescheduleUntilFinished",
14565 this); 14714 this);
14566 deschedule_until_finished_callback_.Run(); 14715 deschedule_until_finished_callback_.Run();
14567 return error::kDeferLaterCommands; 14716 return error::kDeferLaterCommands;
14568 } 14717 }
14569 14718
14570 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( 14719 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM(
14571 uint32_t immediate_data_size, 14720 uint32_t immediate_data_size,
14572 const void* cmd_data) { 14721 const volatile void* cmd_data) {
14573 const gles2::cmds::InsertFenceSyncCHROMIUM& c = 14722 const volatile gles2::cmds::InsertFenceSyncCHROMIUM& c =
14574 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); 14723 *static_cast<const volatile gles2::cmds::InsertFenceSyncCHROMIUM*>(
14724 cmd_data);
14575 14725
14576 const uint64_t release_count = c.release_count(); 14726 const uint64_t release_count = c.release_count();
14577 if (!fence_sync_release_callback_.is_null()) 14727 if (!fence_sync_release_callback_.is_null())
14578 fence_sync_release_callback_.Run(release_count); 14728 fence_sync_release_callback_.Run(release_count);
14579 return error::kNoError; 14729 return error::kNoError;
14580 } 14730 }
14581 14731
14582 error::Error GLES2DecoderImpl::HandleWaitSyncTokenCHROMIUM( 14732 error::Error GLES2DecoderImpl::HandleWaitSyncTokenCHROMIUM(
14583 uint32_t immediate_data_size, 14733 uint32_t immediate_data_size,
14584 const void* cmd_data) { 14734 const volatile void* cmd_data) {
14585 const gles2::cmds::WaitSyncTokenCHROMIUM& c = 14735 const volatile gles2::cmds::WaitSyncTokenCHROMIUM& c =
14586 *static_cast<const gles2::cmds::WaitSyncTokenCHROMIUM*>(cmd_data); 14736 *static_cast<const volatile gles2::cmds::WaitSyncTokenCHROMIUM*>(
14737 cmd_data);
14587 14738
14588 const gpu::CommandBufferNamespace kMinNamespaceId = 14739 const gpu::CommandBufferNamespace kMinNamespaceId =
14589 gpu::CommandBufferNamespace::INVALID; 14740 gpu::CommandBufferNamespace::INVALID;
14590 const gpu::CommandBufferNamespace kMaxNamespaceId = 14741 const gpu::CommandBufferNamespace kMaxNamespaceId =
14591 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; 14742 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES;
14592 14743
14593 gpu::CommandBufferNamespace namespace_id = 14744 gpu::CommandBufferNamespace namespace_id =
14594 static_cast<gpu::CommandBufferNamespace>(c.namespace_id); 14745 static_cast<gpu::CommandBufferNamespace>(c.namespace_id);
14595 if ((namespace_id < static_cast<int32_t>(kMinNamespaceId)) || 14746 if ((namespace_id < static_cast<int32_t>(kMinNamespaceId)) ||
14596 (namespace_id >= static_cast<int32_t>(kMaxNamespaceId))) { 14747 (namespace_id >= static_cast<int32_t>(kMaxNamespaceId))) {
14597 namespace_id = gpu::CommandBufferNamespace::INVALID; 14748 namespace_id = gpu::CommandBufferNamespace::INVALID;
14598 } 14749 }
14599 const CommandBufferId command_buffer_id = 14750 const CommandBufferId command_buffer_id =
14600 CommandBufferId::FromUnsafeValue(c.command_buffer_id()); 14751 CommandBufferId::FromUnsafeValue(c.command_buffer_id());
14601 const uint64_t release = c.release_count(); 14752 const uint64_t release = c.release_count();
14602 if (wait_fence_sync_callback_.is_null()) 14753 if (wait_fence_sync_callback_.is_null())
14603 return error::kNoError; 14754 return error::kNoError;
14604 14755
14605 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release) 14756 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release)
14606 ? error::kNoError 14757 ? error::kNoError
14607 : error::kDeferCommandUntilLater; 14758 : error::kDeferCommandUntilLater;
14608 } 14759 }
14609 14760
14610 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( 14761 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM(
14611 uint32_t immediate_data_size, 14762 uint32_t immediate_data_size,
14612 const void* cmd_data) { 14763 const volatile void* cmd_data) {
14613 if (surface_->DeferDraws()) 14764 if (surface_->DeferDraws())
14614 return error::kDeferCommandUntilLater; 14765 return error::kDeferCommandUntilLater;
14615 if (!surface_->SetBackbufferAllocation(false)) 14766 if (!surface_->SetBackbufferAllocation(false))
14616 return error::kLostContext; 14767 return error::kLostContext;
14617 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; 14768 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT;
14618 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; 14769 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT;
14619 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; 14770 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT;
14620 return error::kNoError; 14771 return error::kNoError;
14621 } 14772 }
14622 14773
14623 bool GLES2DecoderImpl::GenQueriesEXTHelper( 14774 bool GLES2DecoderImpl::GenQueriesEXTHelper(
14624 GLsizei n, const GLuint* client_ids) { 14775 GLsizei n, const GLuint* client_ids) {
14625 for (GLsizei ii = 0; ii < n; ++ii) { 14776 for (GLsizei ii = 0; ii < n; ++ii) {
14626 if (query_manager_->IsValidQuery(client_ids[ii])) { 14777 if (query_manager_->IsValidQuery(client_ids[ii])) {
14627 return false; 14778 return false;
14628 } 14779 }
14629 } 14780 }
14630 query_manager_->GenQueries(n, client_ids); 14781 query_manager_->GenQueries(n, client_ids);
14631 return true; 14782 return true;
14632 } 14783 }
14633 14784
14634 void GLES2DecoderImpl::DeleteQueriesEXTHelper(GLsizei n, 14785 void GLES2DecoderImpl::DeleteQueriesEXTHelper(
14635 const GLuint* client_ids) { 14786 GLsizei n,
14787 const volatile GLuint* client_ids) {
14636 for (GLsizei ii = 0; ii < n; ++ii) { 14788 for (GLsizei ii = 0; ii < n; ++ii) {
14637 GLuint client_id = client_ids[ii]; 14789 GLuint client_id = client_ids[ii];
14638 query_manager_->RemoveQuery(client_id); 14790 query_manager_->RemoveQuery(client_id);
14639 } 14791 }
14640 } 14792 }
14641 14793
14642 bool GLES2DecoderImpl::HasPendingQueries() const { 14794 bool GLES2DecoderImpl::HasPendingQueries() const {
14643 return query_manager_.get() && query_manager_->HavePendingQueries(); 14795 return query_manager_.get() && query_manager_->HavePendingQueries();
14644 } 14796 }
14645 14797
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
14702 } 14854 }
14703 14855
14704 bool GLES2DecoderImpl::HasPollingWork() const { 14856 bool GLES2DecoderImpl::HasPollingWork() const {
14705 return deschedule_until_finished_fences_.size() >= 2; 14857 return deschedule_until_finished_fences_.size() >= 2;
14706 } 14858 }
14707 14859
14708 void GLES2DecoderImpl::PerformPollingWork() { 14860 void GLES2DecoderImpl::PerformPollingWork() {
14709 ProcessDescheduleUntilFinished(); 14861 ProcessDescheduleUntilFinished();
14710 } 14862 }
14711 14863
14712 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32_t immediate_data_size, 14864 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(
14713 const void* cmd_data) { 14865 uint32_t immediate_data_size,
14714 const gles2::cmds::BeginQueryEXT& c = 14866 const volatile void* cmd_data) {
14715 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); 14867 const volatile gles2::cmds::BeginQueryEXT& c =
14868 *static_cast<const volatile gles2::cmds::BeginQueryEXT*>(cmd_data);
14716 GLenum target = static_cast<GLenum>(c.target); 14869 GLenum target = static_cast<GLenum>(c.target);
14717 GLuint client_id = static_cast<GLuint>(c.id); 14870 GLuint client_id = static_cast<GLuint>(c.id);
14718 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); 14871 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id);
14719 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset); 14872 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset);
14720 14873
14721 switch (target) { 14874 switch (target) {
14722 case GL_COMMANDS_ISSUED_CHROMIUM: 14875 case GL_COMMANDS_ISSUED_CHROMIUM:
14723 case GL_LATENCY_QUERY_CHROMIUM: 14876 case GL_LATENCY_QUERY_CHROMIUM:
14724 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: 14877 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
14725 case GL_GET_ERROR_QUERY_CHROMIUM: 14878 case GL_GET_ERROR_QUERY_CHROMIUM:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
14795 return error::kInvalidArguments; 14948 return error::kInvalidArguments;
14796 } 14949 }
14797 14950
14798 if (!query_manager_->BeginQuery(query)) { 14951 if (!query_manager_->BeginQuery(query)) {
14799 return error::kOutOfBounds; 14952 return error::kOutOfBounds;
14800 } 14953 }
14801 14954
14802 return error::kNoError; 14955 return error::kNoError;
14803 } 14956 }
14804 14957
14805 error::Error GLES2DecoderImpl::HandleEndQueryEXT(uint32_t immediate_data_size, 14958 error::Error GLES2DecoderImpl::HandleEndQueryEXT(
14806 const void* cmd_data) { 14959 uint32_t immediate_data_size,
14807 const gles2::cmds::EndQueryEXT& c = 14960 const volatile void* cmd_data) {
14808 *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); 14961 const volatile gles2::cmds::EndQueryEXT& c =
14962 *static_cast<const volatile gles2::cmds::EndQueryEXT*>(cmd_data);
14809 GLenum target = static_cast<GLenum>(c.target); 14963 GLenum target = static_cast<GLenum>(c.target);
14810 uint32_t submit_count = static_cast<GLuint>(c.submit_count); 14964 uint32_t submit_count = static_cast<GLuint>(c.submit_count);
14811 14965
14812 QueryManager::Query* query = query_manager_->GetActiveQuery(target); 14966 QueryManager::Query* query = query_manager_->GetActiveQuery(target);
14813 if (!query) { 14967 if (!query) {
14814 LOCAL_SET_GL_ERROR( 14968 LOCAL_SET_GL_ERROR(
14815 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); 14969 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query");
14816 return error::kNoError; 14970 return error::kNoError;
14817 } 14971 }
14818 14972
14819 if (!query_manager_->EndQuery(query, submit_count)) { 14973 if (!query_manager_->EndQuery(query, submit_count)) {
14820 return error::kOutOfBounds; 14974 return error::kOutOfBounds;
14821 } 14975 }
14822 14976
14823 query_manager_->ProcessPendingTransferQueries(); 14977 query_manager_->ProcessPendingTransferQueries();
14824 14978
14825 return error::kNoError; 14979 return error::kNoError;
14826 } 14980 }
14827 14981
14828 error::Error GLES2DecoderImpl::HandleQueryCounterEXT( 14982 error::Error GLES2DecoderImpl::HandleQueryCounterEXT(
14829 uint32_t immediate_data_size, 14983 uint32_t immediate_data_size,
14830 const void* cmd_data) { 14984 const volatile void* cmd_data) {
14831 const gles2::cmds::QueryCounterEXT& c = 14985 const volatile gles2::cmds::QueryCounterEXT& c =
14832 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data); 14986 *static_cast<const volatile gles2::cmds::QueryCounterEXT*>(cmd_data);
14833 GLuint client_id = static_cast<GLuint>(c.id); 14987 GLuint client_id = static_cast<GLuint>(c.id);
14834 GLenum target = static_cast<GLenum>(c.target); 14988 GLenum target = static_cast<GLenum>(c.target);
14835 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); 14989 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id);
14836 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset); 14990 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset);
14837 uint32_t submit_count = static_cast<GLuint>(c.submit_count); 14991 uint32_t submit_count = static_cast<GLuint>(c.submit_count);
14838 14992
14839 switch (target) { 14993 switch (target) {
14840 case GL_TIMESTAMP: 14994 case GL_TIMESTAMP:
14841 if (!query_manager_->GPUTimingAvailable()) { 14995 if (!query_manager_->GPUTimingAvailable()) {
14842 LOCAL_SET_GL_ERROR( 14996 LOCAL_SET_GL_ERROR(
(...skipping 22 matching lines...) Expand all
14865 } 15019 }
14866 if (!query_manager_->QueryCounter(query, submit_count)) { 15020 if (!query_manager_->QueryCounter(query, submit_count)) {
14867 return error::kOutOfBounds; 15021 return error::kOutOfBounds;
14868 } 15022 }
14869 15023
14870 return error::kNoError; 15024 return error::kNoError;
14871 } 15025 }
14872 15026
14873 error::Error GLES2DecoderImpl::HandleSetDisjointValueSyncCHROMIUM( 15027 error::Error GLES2DecoderImpl::HandleSetDisjointValueSyncCHROMIUM(
14874 uint32_t immediate_data_size, 15028 uint32_t immediate_data_size,
14875 const void* cmd_data) { 15029 const volatile void* cmd_data) {
14876 const gles2::cmds::SetDisjointValueSyncCHROMIUM& c = 15030 const volatile gles2::cmds::SetDisjointValueSyncCHROMIUM& c =
14877 *static_cast<const gles2::cmds::SetDisjointValueSyncCHROMIUM*>(cmd_data); 15031 *static_cast<const volatile gles2::cmds::SetDisjointValueSyncCHROMIUM*>(
15032 cmd_data);
14878 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); 15033 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id);
14879 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset); 15034 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset);
14880 15035
14881 return query_manager_->SetDisjointSync(sync_shm_id, sync_shm_offset); 15036 return query_manager_->SetDisjointSync(sync_shm_id, sync_shm_offset);
14882 } 15037 }
14883 15038
14884 bool GLES2DecoderImpl::GenVertexArraysOESHelper( 15039 bool GLES2DecoderImpl::GenVertexArraysOESHelper(
14885 GLsizei n, const GLuint* client_ids) { 15040 GLsizei n, const GLuint* client_ids) {
14886 for (GLsizei ii = 0; ii < n; ++ii) { 15041 for (GLsizei ii = 0; ii < n; ++ii) {
14887 if (GetVertexAttribManager(client_ids[ii])) { 15042 if (GetVertexAttribManager(client_ids[ii])) {
(...skipping 11 matching lines...) Expand all
14899 15054
14900 glGenVertexArraysOES(n, service_ids.get()); 15055 glGenVertexArraysOES(n, service_ids.get());
14901 for (GLsizei ii = 0; ii < n; ++ii) { 15056 for (GLsizei ii = 0; ii < n; ++ii) {
14902 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); 15057 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true);
14903 } 15058 }
14904 } 15059 }
14905 15060
14906 return true; 15061 return true;
14907 } 15062 }
14908 15063
14909 void GLES2DecoderImpl::DeleteVertexArraysOESHelper(GLsizei n, 15064 void GLES2DecoderImpl::DeleteVertexArraysOESHelper(
14910 const GLuint* client_ids) { 15065 GLsizei n,
15066 const volatile GLuint* client_ids) {
14911 for (GLsizei ii = 0; ii < n; ++ii) { 15067 for (GLsizei ii = 0; ii < n; ++ii) {
14912 GLuint client_id = client_ids[ii]; 15068 GLuint client_id = client_ids[ii];
14913 VertexAttribManager* vao = GetVertexAttribManager(client_id); 15069 VertexAttribManager* vao = GetVertexAttribManager(client_id);
14914 if (vao && !vao->IsDeleted()) { 15070 if (vao && !vao->IsDeleted()) {
14915 if (state_.vertex_attrib_manager.get() == vao) { 15071 if (state_.vertex_attrib_manager.get() == vao) {
14916 DoBindVertexArrayOES(0); 15072 DoBindVertexArrayOES(0);
14917 } 15073 }
14918 RemoveVertexAttribManager(client_id); 15074 RemoveVertexAttribManager(client_id);
14919 } 15075 }
14920 } 15076 }
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
15797 GLsizei width, 15953 GLsizei width,
15798 GLsizei height, 15954 GLsizei height,
15799 GLsizei depth) { 15955 GLsizei depth) {
15800 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage3D", 15956 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage3D",
15801 "widthXheight", width * height, "depth", depth); 15957 "widthXheight", width * height, "depth", depth);
15802 TexStorageImpl(target, levels, internal_format, width, height, depth, 15958 TexStorageImpl(target, levels, internal_format, width, height, depth,
15803 ContextState::k3D, "glTexStorage3D"); 15959 ContextState::k3D, "glTexStorage3D");
15804 } 15960 }
15805 15961
15806 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, 15962 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
15807 const GLbyte* data) { 15963 const volatile GLbyte* data) {
15808 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", 15964 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM",
15809 "context", logger_.GetLogPrefix(), 15965 "context", logger_.GetLogPrefix(),
15810 "mailbox[0]", static_cast<unsigned char>(data[0])); 15966 "mailbox[0]", static_cast<unsigned char>(data[0]));
15811 15967
15812 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( 15968 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
15813 &state_, target); 15969 &state_, target);
15814 ProduceTextureRef("glProduceTextureCHROMIUM", false, texture_ref, target, 15970 ProduceTextureRef("glProduceTextureCHROMIUM", false, texture_ref, target,
15815 data); 15971 data);
15816 } 15972 }
15817 15973
15818 void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(GLuint client_id, 15974 void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(
15819 GLenum target, const GLbyte* data) { 15975 GLuint client_id,
15976 GLenum target,
15977 const volatile GLbyte* data) {
15820 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM", 15978 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM",
15821 "context", logger_.GetLogPrefix(), 15979 "context", logger_.GetLogPrefix(),
15822 "mailbox[0]", static_cast<unsigned char>(data[0])); 15980 "mailbox[0]", static_cast<unsigned char>(data[0]));
15823 15981
15824 ProduceTextureRef("glProduceTextureDirectCHROMIUM", !client_id, 15982 ProduceTextureRef("glProduceTextureDirectCHROMIUM", !client_id,
15825 GetTexture(client_id), target, data); 15983 GetTexture(client_id), target, data);
15826 } 15984 }
15827 15985
15828 void GLES2DecoderImpl::ProduceTextureRef(const char* func_name, 15986 void GLES2DecoderImpl::ProduceTextureRef(const char* func_name,
15829 bool clear, 15987 bool clear,
15830 TextureRef* texture_ref, 15988 TextureRef* texture_ref,
15831 GLenum target, 15989 GLenum target,
15832 const GLbyte* data) { 15990 const volatile GLbyte* data) {
15833 Mailbox mailbox = *reinterpret_cast<const Mailbox*>(data); 15991 Mailbox mailbox =
15992 Mailbox::FromVolatile(*reinterpret_cast<const volatile Mailbox*>(data));
15834 DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a " 15993 DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a "
15835 "mailbox that was not generated by " 15994 "mailbox that was not generated by "
15836 "GenMailboxCHROMIUM."; 15995 "GenMailboxCHROMIUM.";
15837 15996
15838 if (clear) { 15997 if (clear) {
15839 DCHECK(!texture_ref); 15998 DCHECK(!texture_ref);
15840 15999
15841 group_->mailbox_manager()->ProduceTexture(mailbox, nullptr); 16000 group_->mailbox_manager()->ProduceTexture(mailbox, nullptr);
15842 return; 16001 return;
15843 } 16002 }
(...skipping 14 matching lines...) Expand all
15858 if (produced->target() != target) { 16017 if (produced->target() != target) {
15859 LOCAL_SET_GL_ERROR( 16018 LOCAL_SET_GL_ERROR(
15860 GL_INVALID_OPERATION, func_name, "invalid target"); 16019 GL_INVALID_OPERATION, func_name, "invalid target");
15861 return; 16020 return;
15862 } 16021 }
15863 16022
15864 group_->mailbox_manager()->ProduceTexture(mailbox, produced); 16023 group_->mailbox_manager()->ProduceTexture(mailbox, produced);
15865 } 16024 }
15866 16025
15867 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, 16026 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
15868 const GLbyte* data) { 16027 const volatile GLbyte* data) {
15869 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", 16028 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM",
15870 "context", logger_.GetLogPrefix(), 16029 "context", logger_.GetLogPrefix(),
15871 "mailbox[0]", static_cast<unsigned char>(data[0])); 16030 "mailbox[0]", static_cast<unsigned char>(data[0]));
15872 Mailbox mailbox = *reinterpret_cast<const Mailbox*>(data); 16031 Mailbox mailbox =
16032 Mailbox::FromVolatile(*reinterpret_cast<const volatile Mailbox*>(data));
15873 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " 16033 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a "
15874 "mailbox that was not generated by " 16034 "mailbox that was not generated by "
15875 "GenMailboxCHROMIUM."; 16035 "GenMailboxCHROMIUM.";
15876 16036
15877 scoped_refptr<TextureRef> texture_ref = 16037 scoped_refptr<TextureRef> texture_ref =
15878 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); 16038 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target);
15879 if (!texture_ref.get()) { 16039 if (!texture_ref.get()) {
15880 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 16040 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
15881 "glConsumeTextureCHROMIUM", 16041 "glConsumeTextureCHROMIUM",
15882 "unknown texture for target"); 16042 "unknown texture for target");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
15920 GLuint service_id; 16080 GLuint service_id;
15921 glGenTextures(1, &service_id); 16081 glGenTextures(1, &service_id);
15922 DCHECK_NE(0u, service_id); 16082 DCHECK_NE(0u, service_id);
15923 texture_ref = CreateTexture(client_id, service_id); 16083 texture_ref = CreateTexture(client_id, service_id);
15924 texture_manager()->SetTarget(texture_ref, target); 16084 texture_manager()->SetTarget(texture_ref, target);
15925 glBindTexture(target, service_id); 16085 glBindTexture(target, service_id);
15926 RestoreCurrentTextureBindings(&state_, target); 16086 RestoreCurrentTextureBindings(&state_, target);
15927 } 16087 }
15928 } 16088 }
15929 16089
15930 void GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL(GLenum target, 16090 void GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL(
15931 GLuint client_id, 16091 GLenum target,
15932 const GLbyte* data) { 16092 GLuint client_id,
16093 const volatile GLbyte* data) {
15933 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL", 16094 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL",
15934 "context", logger_.GetLogPrefix(), 16095 "context", logger_.GetLogPrefix(),
15935 "mailbox[0]", static_cast<unsigned char>(data[0])); 16096 "mailbox[0]", static_cast<unsigned char>(data[0]));
15936 Mailbox mailbox = *reinterpret_cast<const Mailbox*>(data); 16097 Mailbox mailbox =
16098 Mailbox::FromVolatile(*reinterpret_cast<const volatile Mailbox*>(data));
15937 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " 16099 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was "
15938 "passed a mailbox that was not " 16100 "passed a mailbox that was not "
15939 "generated by GenMailboxCHROMIUM."; 16101 "generated by GenMailboxCHROMIUM.";
15940 16102
15941 TextureRef* texture_ref = GetTexture(client_id); 16103 TextureRef* texture_ref = GetTexture(client_id);
15942 if (texture_ref) { 16104 if (texture_ref) {
15943 // No need to call EnsureTextureForClientId here, the client_id already has 16105 // No need to call EnsureTextureForClientId here, the client_id already has
15944 // an associated texture. 16106 // an associated texture.
15945 LOCAL_SET_GL_ERROR( 16107 LOCAL_SET_GL_ERROR(
15946 GL_INVALID_OPERATION, 16108 GL_INVALID_OPERATION,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
16098 texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, 16260 texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0,
16099 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); 16261 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
16100 } 16262 }
16101 16263
16102 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr, 16264 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr,
16103 Texture::UNBOUND); 16265 Texture::UNBOUND);
16104 } 16266 }
16105 16267
16106 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( 16268 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
16107 uint32_t immediate_data_size, 16269 uint32_t immediate_data_size,
16108 const void* cmd_data) { 16270 const volatile void* cmd_data) {
16109 const gles2::cmds::TraceBeginCHROMIUM& c = 16271 const volatile gles2::cmds::TraceBeginCHROMIUM& c =
16110 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); 16272 *static_cast<const volatile gles2::cmds::TraceBeginCHROMIUM*>(cmd_data);
16111 Bucket* category_bucket = GetBucket(c.category_bucket_id); 16273 Bucket* category_bucket = GetBucket(c.category_bucket_id);
16112 Bucket* name_bucket = GetBucket(c.name_bucket_id); 16274 Bucket* name_bucket = GetBucket(c.name_bucket_id);
16113 if (!category_bucket || category_bucket->size() == 0 || 16275 if (!category_bucket || category_bucket->size() == 0 ||
16114 !name_bucket || name_bucket->size() == 0) { 16276 !name_bucket || name_bucket->size() == 0) {
16115 return error::kInvalidArguments; 16277 return error::kInvalidArguments;
16116 } 16278 }
16117 16279
16118 std::string category_name; 16280 std::string category_name;
16119 std::string trace_name; 16281 std::string trace_name;
16120 if (!category_bucket->GetAsString(&category_name) || 16282 if (!category_bucket->GetAsString(&category_name) ||
(...skipping 13 matching lines...) Expand all
16134 16296
16135 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { 16297 void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
16136 debug_marker_manager_.PopGroup(); 16298 debug_marker_manager_.PopGroup();
16137 if (!gpu_tracer_->End(kTraceCHROMIUM)) { 16299 if (!gpu_tracer_->End(kTraceCHROMIUM)) {
16138 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 16300 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
16139 "glTraceEndCHROMIUM", "no trace begin found"); 16301 "glTraceEndCHROMIUM", "no trace begin found");
16140 return; 16302 return;
16141 } 16303 }
16142 } 16304 }
16143 16305
16144 void GLES2DecoderImpl::DoDrawBuffersEXT( 16306 void GLES2DecoderImpl::DoDrawBuffersEXT(GLsizei count,
16145 GLsizei count, const GLenum* bufs) { 16307 const volatile GLenum* bufs) {
16146 DCHECK_LE(group_->max_draw_buffers(), 16u); 16308 DCHECK_LE(group_->max_draw_buffers(), 16u);
16147 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { 16309 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) {
16148 LOCAL_SET_GL_ERROR( 16310 LOCAL_SET_GL_ERROR(
16149 GL_INVALID_VALUE, 16311 GL_INVALID_VALUE,
16150 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT"); 16312 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT");
16151 return; 16313 return;
16152 } 16314 }
16153 16315
16154 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); 16316 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
16155 if (framebuffer) { 16317 if (framebuffer) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
16196 void GLES2DecoderImpl::DoFlushDriverCachesCHROMIUM(void) { 16358 void GLES2DecoderImpl::DoFlushDriverCachesCHROMIUM(void) {
16197 // On Adreno Android devices we need to use a workaround to force caches to 16359 // On Adreno Android devices we need to use a workaround to force caches to
16198 // clear. 16360 // clear.
16199 if (feature_info_->workarounds().unbind_egl_context_to_flush_driver_caches) { 16361 if (feature_info_->workarounds().unbind_egl_context_to_flush_driver_caches) {
16200 context_->ReleaseCurrent(nullptr); 16362 context_->ReleaseCurrent(nullptr);
16201 context_->MakeCurrent(surface_.get()); 16363 context_->MakeCurrent(surface_.get());
16202 } 16364 }
16203 } 16365 }
16204 16366
16205 void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode, 16367 void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode,
16206 const GLfloat* matrix) { 16368 const volatile GLfloat* matrix) {
16207 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || 16369 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM ||
16208 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); 16370 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM);
16209 16371
16210 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM 16372 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM
16211 ? state_.projection_matrix 16373 ? state_.projection_matrix
16212 : state_.modelview_matrix; 16374 : state_.modelview_matrix;
16213 memcpy(target_matrix, matrix, sizeof(GLfloat) * 16); 16375 memcpy(target_matrix, const_cast<const GLfloat*>(matrix),
16376 sizeof(GLfloat) * 16);
16214 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV 16377 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV
16215 // since the values of the _NV and _CHROMIUM tokens match. 16378 // since the values of the _NV and _CHROMIUM tokens match.
16216 glMatrixLoadfEXT(matrix_mode, target_matrix); 16379 glMatrixLoadfEXT(matrix_mode, target_matrix);
16217 } 16380 }
16218 16381
16219 void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode) { 16382 void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode) {
16220 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || 16383 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM ||
16221 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); 16384 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM);
16222 16385
16223 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM 16386 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM
16224 ? state_.projection_matrix 16387 ? state_.projection_matrix
16225 : state_.modelview_matrix; 16388 : state_.modelview_matrix;
16226 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix)); 16389 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix));
16227 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV 16390 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV
16228 // since the values of the _NV and _CHROMIUM tokens match. 16391 // since the values of the _NV and _CHROMIUM tokens match.
16229 glMatrixLoadIdentityEXT(matrix_mode); 16392 glMatrixLoadIdentityEXT(matrix_mode);
16230 } 16393 }
16231 16394
16232 error::Error GLES2DecoderImpl::HandleUniformBlockBinding( 16395 error::Error GLES2DecoderImpl::HandleUniformBlockBinding(
16233 uint32_t immediate_data_size, const void* cmd_data) { 16396 uint32_t immediate_data_size,
16397 const volatile void* cmd_data) {
16234 const char* func_name = "glUniformBlockBinding"; 16398 const char* func_name = "glUniformBlockBinding";
16235 if (!unsafe_es3_apis_enabled()) 16399 if (!unsafe_es3_apis_enabled())
16236 return error::kUnknownCommand; 16400 return error::kUnknownCommand;
16237 const gles2::cmds::UniformBlockBinding& c = 16401 const volatile gles2::cmds::UniformBlockBinding& c =
16238 *static_cast<const gles2::cmds::UniformBlockBinding*>(cmd_data); 16402 *static_cast<const volatile gles2::cmds::UniformBlockBinding*>(cmd_data);
16239 GLuint client_id = c.program; 16403 GLuint client_id = c.program;
16240 GLuint index = static_cast<GLuint>(c.index); 16404 GLuint index = static_cast<GLuint>(c.index);
16241 GLuint binding = static_cast<GLuint>(c.binding); 16405 GLuint binding = static_cast<GLuint>(c.binding);
16242 Program* program = GetProgramInfoNotShader(client_id, func_name); 16406 Program* program = GetProgramInfoNotShader(client_id, func_name);
16243 if (!program) { 16407 if (!program) {
16244 return error::kNoError; 16408 return error::kNoError;
16245 } 16409 }
16246 if (index >= program->uniform_block_size_info().size()) { 16410 if (index >= program->uniform_block_size_info().size()) {
16247 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, 16411 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name,
16248 "uniformBlockIndex is not an active uniform block index"); 16412 "uniformBlockIndex is not an active uniform block index");
16249 return error::kNoError; 16413 return error::kNoError;
16250 } 16414 }
16251 if (binding >= group_->max_uniform_buffer_bindings()) { 16415 if (binding >= group_->max_uniform_buffer_bindings()) {
16252 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, 16416 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name,
16253 "uniformBlockBinding >= MAX_UNIFORM_BUFFER_BINDINGS"); 16417 "uniformBlockBinding >= MAX_UNIFORM_BUFFER_BINDINGS");
16254 return error::kNoError; 16418 return error::kNoError;
16255 } 16419 }
16256 GLuint service_id = program->service_id(); 16420 GLuint service_id = program->service_id();
16257 glUniformBlockBinding(service_id, index, binding); 16421 glUniformBlockBinding(service_id, index, binding);
16258 program->SetUniformBlockBinding(index, binding); 16422 program->SetUniformBlockBinding(index, binding);
16259 return error::kNoError; 16423 return error::kNoError;
16260 } 16424 }
16261 16425
16262 error::Error GLES2DecoderImpl::HandleClientWaitSync( 16426 error::Error GLES2DecoderImpl::HandleClientWaitSync(
16263 uint32_t immediate_data_size, const void* cmd_data) { 16427 uint32_t immediate_data_size,
16428 const volatile void* cmd_data) {
16264 const char* function_name = "glClientWaitSync"; 16429 const char* function_name = "glClientWaitSync";
16265 if (!unsafe_es3_apis_enabled()) 16430 if (!unsafe_es3_apis_enabled())
16266 return error::kUnknownCommand; 16431 return error::kUnknownCommand;
16267 const gles2::cmds::ClientWaitSync& c = 16432 const volatile gles2::cmds::ClientWaitSync& c =
16268 *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); 16433 *static_cast<const volatile gles2::cmds::ClientWaitSync*>(cmd_data);
16269 const GLuint sync = static_cast<GLuint>(c.sync); 16434 const GLuint sync = static_cast<GLuint>(c.sync);
16270 GLbitfield flags = static_cast<GLbitfield>(c.flags); 16435 GLbitfield flags = static_cast<GLbitfield>(c.flags);
16271 const GLuint64 timeout = c.timeout(); 16436 const GLuint64 timeout = c.timeout();
16272 typedef cmds::ClientWaitSync::Result Result; 16437 typedef cmds::ClientWaitSync::Result Result;
16273 Result* result_dst = GetSharedMemoryAs<Result*>( 16438 Result* result_dst = GetSharedMemoryAs<Result*>(
16274 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 16439 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
16275 if (!result_dst) { 16440 if (!result_dst) {
16276 return error::kOutOfBounds; 16441 return error::kOutOfBounds;
16277 } 16442 }
16278 if (*result_dst != GL_WAIT_FAILED) { 16443 if (*result_dst != GL_WAIT_FAILED) {
(...skipping 22 matching lines...) Expand all
16301 LOCAL_PEEK_GL_ERROR(function_name); 16466 LOCAL_PEEK_GL_ERROR(function_name);
16302 break; 16467 break;
16303 default: 16468 default:
16304 NOTREACHED(); 16469 NOTREACHED();
16305 break; 16470 break;
16306 } 16471 }
16307 *result_dst = status; 16472 *result_dst = status;
16308 return error::kNoError; 16473 return error::kNoError;
16309 } 16474 }
16310 16475
16311 error::Error GLES2DecoderImpl::HandleWaitSync( 16476 error::Error GLES2DecoderImpl::HandleWaitSync(uint32_t immediate_data_size,
16312 uint32_t immediate_data_size, const void* cmd_data) { 16477 const volatile void* cmd_data) {
16313 const char* function_name = "glWaitSync"; 16478 const char* function_name = "glWaitSync";
16314 if (!unsafe_es3_apis_enabled()) 16479 if (!unsafe_es3_apis_enabled())
16315 return error::kUnknownCommand; 16480 return error::kUnknownCommand;
16316 const gles2::cmds::WaitSync& c = 16481 const volatile gles2::cmds::WaitSync& c =
16317 *static_cast<const gles2::cmds::WaitSync*>(cmd_data); 16482 *static_cast<const volatile gles2::cmds::WaitSync*>(cmd_data);
16318 const GLuint sync = static_cast<GLuint>(c.sync); 16483 const GLuint sync = static_cast<GLuint>(c.sync);
16319 const GLbitfield flags = static_cast<GLbitfield>(c.flags); 16484 const GLbitfield flags = static_cast<GLbitfield>(c.flags);
16320 const GLuint64 timeout = c.timeout(); 16485 const GLuint64 timeout = c.timeout();
16321 GLsync service_sync = 0; 16486 GLsync service_sync = 0;
16322 if (!group_->GetSyncServiceId(sync, &service_sync)) { 16487 if (!group_->GetSyncServiceId(sync, &service_sync)) {
16323 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid sync"); 16488 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid sync");
16324 return error::kNoError; 16489 return error::kNoError;
16325 } 16490 }
16326 if (flags != 0) { 16491 if (flags != 0) {
16327 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags"); 16492 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags");
(...skipping 14 matching lines...) Expand all
16342 return 0; 16507 return 0;
16343 } 16508 }
16344 if (flags != 0) { 16509 if (flags != 0) {
16345 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags"); 16510 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags");
16346 return 0; 16511 return 0;
16347 } 16512 }
16348 return glFenceSync(condition, flags); 16513 return glFenceSync(condition, flags);
16349 } 16514 }
16350 16515
16351 error::Error GLES2DecoderImpl::HandleGetInternalformativ( 16516 error::Error GLES2DecoderImpl::HandleGetInternalformativ(
16352 uint32_t immediate_data_size, const void* cmd_data) { 16517 uint32_t immediate_data_size,
16518 const volatile void* cmd_data) {
16353 if (!unsafe_es3_apis_enabled()) 16519 if (!unsafe_es3_apis_enabled())
16354 return error::kUnknownCommand; 16520 return error::kUnknownCommand;
16355 const gles2::cmds::GetInternalformativ& c = 16521 const volatile gles2::cmds::GetInternalformativ& c =
16356 *static_cast<const gles2::cmds::GetInternalformativ*>(cmd_data); 16522 *static_cast<const volatile gles2::cmds::GetInternalformativ*>(cmd_data);
16357 GLenum target = static_cast<GLenum>(c.target); 16523 GLenum target = static_cast<GLenum>(c.target);
16358 GLenum format = static_cast<GLenum>(c.format); 16524 GLenum format = static_cast<GLenum>(c.format);
16359 GLenum pname = static_cast<GLenum>(c.pname); 16525 GLenum pname = static_cast<GLenum>(c.pname);
16360 if (!validators_->render_buffer_target.IsValid(target)) { 16526 if (!validators_->render_buffer_target.IsValid(target)) {
16361 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", target, "target"); 16527 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", target, "target");
16362 return error::kNoError; 16528 return error::kNoError;
16363 } 16529 }
16364 if (!validators_->render_buffer_format.IsValid(format)) { 16530 if (!validators_->render_buffer_format.IsValid(format)) {
16365 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", format, "format"); 16531 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", format, "format");
16366 return error::kNoError; 16532 return error::kNoError;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
16436 break; 16602 break;
16437 } 16603 }
16438 } else { 16604 } else {
16439 glGetInternalformativ(target, format, pname, num_values, params); 16605 glGetInternalformativ(target, format, pname, num_values, params);
16440 } 16606 }
16441 result->SetNumResults(num_values); 16607 result->SetNumResults(num_values);
16442 return error::kNoError; 16608 return error::kNoError;
16443 } 16609 }
16444 16610
16445 error::Error GLES2DecoderImpl::HandleMapBufferRange( 16611 error::Error GLES2DecoderImpl::HandleMapBufferRange(
16446 uint32_t immediate_data_size, const void* cmd_data) { 16612 uint32_t immediate_data_size,
16613 const volatile void* cmd_data) {
16447 if (!unsafe_es3_apis_enabled()) { 16614 if (!unsafe_es3_apis_enabled()) {
16448 return error::kUnknownCommand; 16615 return error::kUnknownCommand;
16449 } 16616 }
16450 const gles2::cmds::MapBufferRange& c = 16617 const volatile gles2::cmds::MapBufferRange& c =
16451 *static_cast<const gles2::cmds::MapBufferRange*>(cmd_data); 16618 *static_cast<const volatile gles2::cmds::MapBufferRange*>(cmd_data);
16452 GLenum target = static_cast<GLenum>(c.target); 16619 GLenum target = static_cast<GLenum>(c.target);
16453 GLbitfield access = static_cast<GLbitfield>(c.access); 16620 GLbitfield access = static_cast<GLbitfield>(c.access);
16454 GLintptr offset = static_cast<GLintptr>(c.offset); 16621 GLintptr offset = static_cast<GLintptr>(c.offset);
16455 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); 16622 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
16456 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); 16623 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id);
16457 16624
16458 typedef cmds::MapBufferRange::Result Result; 16625 typedef cmds::MapBufferRange::Result Result;
16459 Result* result = GetSharedMemoryAs<Result*>( 16626 Result* result = GetSharedMemoryAs<Result*>(
16460 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 16627 c.result_shm_id, c.result_shm_offset, sizeof(*result));
16461 if (!result) { 16628 if (!result) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
16505 buffer->SetMappedRange(offset, size, access, ptr, 16672 buffer->SetMappedRange(offset, size, access, ptr,
16506 GetSharedMemoryBuffer(data_shm_id)); 16673 GetSharedMemoryBuffer(data_shm_id));
16507 if ((access & GL_MAP_INVALIDATE_RANGE_BIT) == 0) { 16674 if ((access & GL_MAP_INVALIDATE_RANGE_BIT) == 0) {
16508 memcpy(mem, ptr, size); 16675 memcpy(mem, ptr, size);
16509 } 16676 }
16510 *result = 1; 16677 *result = 1;
16511 return error::kNoError; 16678 return error::kNoError;
16512 } 16679 }
16513 16680
16514 error::Error GLES2DecoderImpl::HandleUnmapBuffer( 16681 error::Error GLES2DecoderImpl::HandleUnmapBuffer(
16515 uint32_t immediate_data_size, const void* cmd_data) { 16682 uint32_t immediate_data_size,
16683 const volatile void* cmd_data) {
16516 if (!unsafe_es3_apis_enabled()) { 16684 if (!unsafe_es3_apis_enabled()) {
16517 return error::kUnknownCommand; 16685 return error::kUnknownCommand;
16518 } 16686 }
16519 const gles2::cmds::UnmapBuffer& c = 16687 const volatile gles2::cmds::UnmapBuffer& c =
16520 *static_cast<const gles2::cmds::UnmapBuffer*>(cmd_data); 16688 *static_cast<const volatile gles2::cmds::UnmapBuffer*>(cmd_data);
16521 GLenum target = static_cast<GLenum>(c.target); 16689 GLenum target = static_cast<GLenum>(c.target);
16522 16690
16523 if (!validators_->buffer_target.IsValid(target)) { 16691 if (!validators_->buffer_target.IsValid(target)) {
16524 LOCAL_SET_GL_ERROR_INVALID_ENUM("glMapBufferRange", target, "target"); 16692 LOCAL_SET_GL_ERROR_INVALID_ENUM("glMapBufferRange", target, "target");
16525 return error::kNoError; 16693 return error::kNoError;
16526 } 16694 }
16527 16695
16528 Buffer* buffer = buffer_manager()->GetBufferInfoForTarget(&state_, target); 16696 Buffer* buffer = buffer_manager()->GetBufferInfoForTarget(&state_, target);
16529 if (!buffer) { 16697 if (!buffer) {
16530 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "UnmapBuffer", "no buffer bound"); 16698 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "UnmapBuffer", "no buffer bound");
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
16815 } 16983 }
16816 GLES2DecoderImpl* decoder_; 16984 GLES2DecoderImpl* decoder_;
16817 ErrorState* error_state_; 16985 ErrorState* error_state_;
16818 const Validators* validators_; 16986 const Validators* validators_;
16819 const char* function_name_; 16987 const char* function_name_;
16820 error::Error error_; 16988 error::Error error_;
16821 }; 16989 };
16822 16990
16823 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM( 16991 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM(
16824 uint32_t immediate_data_size, 16992 uint32_t immediate_data_size,
16825 const void* cmd_data) { 16993 const volatile void* cmd_data) {
16826 const gles2::cmds::GenPathsCHROMIUM& c = 16994 const volatile gles2::cmds::GenPathsCHROMIUM& c =
16827 *static_cast<const gles2::cmds::GenPathsCHROMIUM*>(cmd_data); 16995 *static_cast<const volatile gles2::cmds::GenPathsCHROMIUM*>(cmd_data);
16828 if (!features().chromium_path_rendering) 16996 if (!features().chromium_path_rendering)
16829 return error::kUnknownCommand; 16997 return error::kUnknownCommand;
16830 16998
16831 PathCommandValidatorContext v(this, "glGenPathsCHROMIUM"); 16999 PathCommandValidatorContext v(this, "glGenPathsCHROMIUM");
16832 GLsizei range = 0; 17000 GLsizei range = 0;
16833 if (!v.GetPathRange(c, &range)) 17001 if (!v.GetPathRange(c, &range))
16834 return v.error(); 17002 return v.error();
16835 17003
16836 GLuint first_client_id = static_cast<GLuint>(c.first_client_id); 17004 GLuint first_client_id = static_cast<GLuint>(c.first_client_id);
16837 if (first_client_id == 0) 17005 if (first_client_id == 0)
16838 return error::kInvalidArguments; 17006 return error::kInvalidArguments;
16839 17007
16840 if (range == 0) 17008 if (range == 0)
16841 return error::kNoError; 17009 return error::kNoError;
16842 17010
16843 if (!GenPathsCHROMIUMHelper(first_client_id, range)) 17011 if (!GenPathsCHROMIUMHelper(first_client_id, range))
16844 return error::kInvalidArguments; 17012 return error::kInvalidArguments;
16845 17013
16846 return error::kNoError; 17014 return error::kNoError;
16847 } 17015 }
16848 error::Error GLES2DecoderImpl::HandleDeletePathsCHROMIUM( 17016 error::Error GLES2DecoderImpl::HandleDeletePathsCHROMIUM(
16849 uint32_t immediate_data_size, 17017 uint32_t immediate_data_size,
16850 const void* cmd_data) { 17018 const volatile void* cmd_data) {
16851 const gles2::cmds::DeletePathsCHROMIUM& c = 17019 const volatile gles2::cmds::DeletePathsCHROMIUM& c =
16852 *static_cast<const gles2::cmds::DeletePathsCHROMIUM*>(cmd_data); 17020 *static_cast<const volatile gles2::cmds::DeletePathsCHROMIUM*>(cmd_data);
16853 if (!features().chromium_path_rendering) 17021 if (!features().chromium_path_rendering)
16854 return error::kUnknownCommand; 17022 return error::kUnknownCommand;
16855 17023
16856 PathCommandValidatorContext v(this, "glDeletePathsCHROMIUM"); 17024 PathCommandValidatorContext v(this, "glDeletePathsCHROMIUM");
16857 GLsizei range = 0; 17025 GLsizei range = 0;
16858 if (!v.GetPathRange(c, &range)) 17026 if (!v.GetPathRange(c, &range))
16859 return v.error(); 17027 return v.error();
16860 17028
16861 if (range == 0) 17029 if (range == 0)
16862 return error::kNoError; 17030 return error::kNoError;
16863 17031
16864 GLuint first_client_id = c.first_client_id; 17032 GLuint first_client_id = c.first_client_id;
16865 // first_client_id can be 0, because non-existing path ids are skipped. 17033 // first_client_id can be 0, because non-existing path ids are skipped.
16866 17034
16867 if (!DeletePathsCHROMIUMHelper(first_client_id, range)) 17035 if (!DeletePathsCHROMIUMHelper(first_client_id, range))
16868 return error::kInvalidArguments; 17036 return error::kInvalidArguments;
16869 17037
16870 return error::kNoError; 17038 return error::kNoError;
16871 } 17039 }
16872 17040
16873 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM( 17041 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM(
16874 uint32_t immediate_data_size, 17042 uint32_t immediate_data_size,
16875 const void* cmd_data) { 17043 const volatile void* cmd_data) {
16876 static const char kFunctionName[] = "glPathCommandsCHROMIUM"; 17044 static const char kFunctionName[] = "glPathCommandsCHROMIUM";
16877 const gles2::cmds::PathCommandsCHROMIUM& c = 17045 const volatile gles2::cmds::PathCommandsCHROMIUM& c =
16878 *static_cast<const gles2::cmds::PathCommandsCHROMIUM*>(cmd_data); 17046 *static_cast<const volatile gles2::cmds::PathCommandsCHROMIUM*>(cmd_data);
16879 if (!features().chromium_path_rendering) 17047 if (!features().chromium_path_rendering)
16880 return error::kUnknownCommand; 17048 return error::kUnknownCommand;
16881 17049
16882 GLuint service_id = 0; 17050 GLuint service_id = 0;
16883 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17051 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
16884 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 17052 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
16885 "invalid path name"); 17053 "invalid path name");
16886 return error::kNoError; 17054 return error::kNoError;
16887 } 17055 }
16888 17056
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
16974 } 17142 }
16975 17143
16976 glPathCommandsNV(service_id, num_commands, commands.get(), num_coords, 17144 glPathCommandsNV(service_id, num_commands, commands.get(), num_coords,
16977 coord_type, coords); 17145 coord_type, coords);
16978 17146
16979 return error::kNoError; 17147 return error::kNoError;
16980 } 17148 }
16981 17149
16982 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM( 17150 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM(
16983 uint32_t immediate_data_size, 17151 uint32_t immediate_data_size,
16984 const void* cmd_data) { 17152 const volatile void* cmd_data) {
16985 static const char kFunctionName[] = "glPathParameterfCHROMIUM"; 17153 static const char kFunctionName[] = "glPathParameterfCHROMIUM";
16986 const gles2::cmds::PathParameterfCHROMIUM& c = 17154 const volatile gles2::cmds::PathParameterfCHROMIUM& c =
16987 *static_cast<const gles2::cmds::PathParameterfCHROMIUM*>(cmd_data); 17155 *static_cast<const volatile gles2::cmds::PathParameterfCHROMIUM*>(
17156 cmd_data);
16988 if (!features().chromium_path_rendering) 17157 if (!features().chromium_path_rendering)
16989 return error::kUnknownCommand; 17158 return error::kUnknownCommand;
16990 17159
16991 GLuint service_id = 0; 17160 GLuint service_id = 0;
16992 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17161 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
16993 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 17162 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
16994 "invalid path name"); 17163 "invalid path name");
16995 return error::kNoError; 17164 return error::kNoError;
16996 } 17165 }
16997 17166
(...skipping 28 matching lines...) Expand all
17026 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); 17195 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct");
17027 return error::kNoError; 17196 return error::kNoError;
17028 } 17197 }
17029 17198
17030 glPathParameterfNV(service_id, pname, value); 17199 glPathParameterfNV(service_id, pname, value);
17031 return error::kNoError; 17200 return error::kNoError;
17032 } 17201 }
17033 17202
17034 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM( 17203 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM(
17035 uint32_t immediate_data_size, 17204 uint32_t immediate_data_size,
17036 const void* cmd_data) { 17205 const volatile void* cmd_data) {
17037 static const char kFunctionName[] = "glPathParameteriCHROMIUM"; 17206 static const char kFunctionName[] = "glPathParameteriCHROMIUM";
17038 const gles2::cmds::PathParameteriCHROMIUM& c = 17207 const volatile gles2::cmds::PathParameteriCHROMIUM& c =
17039 *static_cast<const gles2::cmds::PathParameteriCHROMIUM*>(cmd_data); 17208 *static_cast<const volatile gles2::cmds::PathParameteriCHROMIUM*>(
17209 cmd_data);
17040 if (!features().chromium_path_rendering) 17210 if (!features().chromium_path_rendering)
17041 return error::kUnknownCommand; 17211 return error::kUnknownCommand;
17042 17212
17043 GLuint service_id = 0; 17213 GLuint service_id = 0;
17044 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17214 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
17045 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 17215 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
17046 "invalid path name"); 17216 "invalid path name");
17047 return error::kNoError; 17217 return error::kNoError;
17048 } 17218 }
17049 17219
(...skipping 26 matching lines...) Expand all
17076 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); 17246 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct");
17077 return error::kNoError; 17247 return error::kNoError;
17078 } 17248 }
17079 17249
17080 glPathParameteriNV(service_id, pname, value); 17250 glPathParameteriNV(service_id, pname, value);
17081 return error::kNoError; 17251 return error::kNoError;
17082 } 17252 }
17083 17253
17084 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM( 17254 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM(
17085 uint32_t immediate_data_size, 17255 uint32_t immediate_data_size,
17086 const void* cmd_data) { 17256 const volatile void* cmd_data) {
17087 static const char kFunctionName[] = "glStencilFillPathCHROMIUM"; 17257 static const char kFunctionName[] = "glStencilFillPathCHROMIUM";
17088 const gles2::cmds::StencilFillPathCHROMIUM& c = 17258 const volatile gles2::cmds::StencilFillPathCHROMIUM& c =
17089 *static_cast<const gles2::cmds::StencilFillPathCHROMIUM*>(cmd_data); 17259 *static_cast<const volatile gles2::cmds::StencilFillPathCHROMIUM*>(
17260 cmd_data);
17090 if (!features().chromium_path_rendering) 17261 if (!features().chromium_path_rendering)
17091 return error::kUnknownCommand; 17262 return error::kUnknownCommand;
17092 PathCommandValidatorContext v(this, kFunctionName); 17263 PathCommandValidatorContext v(this, kFunctionName);
17093 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17264 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17094 GLuint mask = 0; 17265 GLuint mask = 0;
17095 if (!v.GetFillModeAndMask(c, &fill_mode, &mask)) 17266 if (!v.GetFillModeAndMask(c, &fill_mode, &mask))
17096 return v.error(); 17267 return v.error();
17097 GLuint service_id = 0; 17268 GLuint service_id = 0;
17098 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17269 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
17099 // "If /path/ does not name an existing path object, the command does 17270 // "If /path/ does not name an existing path object, the command does
17100 // nothing (and no error is generated)." 17271 // nothing (and no error is generated)."
17101 // This holds for other rendering functions, too. 17272 // This holds for other rendering functions, too.
17102 return error::kNoError; 17273 return error::kNoError;
17103 } 17274 }
17104 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17275 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17105 return error::kNoError; 17276 return error::kNoError;
17106 ApplyDirtyState(); 17277 ApplyDirtyState();
17107 glStencilFillPathNV(service_id, fill_mode, mask); 17278 glStencilFillPathNV(service_id, fill_mode, mask);
17108 return error::kNoError; 17279 return error::kNoError;
17109 } 17280 }
17110 17281
17111 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM( 17282 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM(
17112 uint32_t immediate_data_size, 17283 uint32_t immediate_data_size,
17113 const void* cmd_data) { 17284 const volatile void* cmd_data) {
17114 static const char kFunctionName[] = "glStencilStrokePathCHROMIUM"; 17285 static const char kFunctionName[] = "glStencilStrokePathCHROMIUM";
17115 const gles2::cmds::StencilStrokePathCHROMIUM& c = 17286 const volatile gles2::cmds::StencilStrokePathCHROMIUM& c =
17116 *static_cast<const gles2::cmds::StencilStrokePathCHROMIUM*>(cmd_data); 17287 *static_cast<const volatile gles2::cmds::StencilStrokePathCHROMIUM*>(
17288 cmd_data);
17117 if (!features().chromium_path_rendering) 17289 if (!features().chromium_path_rendering)
17118 return error::kUnknownCommand; 17290 return error::kUnknownCommand;
17119 17291
17120 GLuint service_id = 0; 17292 GLuint service_id = 0;
17121 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17293 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
17122 return error::kNoError; 17294 return error::kNoError;
17123 } 17295 }
17124 GLint reference = static_cast<GLint>(c.reference); 17296 GLint reference = static_cast<GLint>(c.reference);
17125 GLuint mask = static_cast<GLuint>(c.mask); 17297 GLuint mask = static_cast<GLuint>(c.mask);
17126 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17298 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17127 return error::kNoError; 17299 return error::kNoError;
17128 ApplyDirtyState(); 17300 ApplyDirtyState();
17129 glStencilStrokePathNV(service_id, reference, mask); 17301 glStencilStrokePathNV(service_id, reference, mask);
17130 return error::kNoError; 17302 return error::kNoError;
17131 } 17303 }
17132 17304
17133 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM( 17305 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM(
17134 uint32_t immediate_data_size, 17306 uint32_t immediate_data_size,
17135 const void* cmd_data) { 17307 const volatile void* cmd_data) {
17136 static const char kFunctionName[] = "glCoverFillPathCHROMIUM"; 17308 static const char kFunctionName[] = "glCoverFillPathCHROMIUM";
17137 const gles2::cmds::CoverFillPathCHROMIUM& c = 17309 const volatile gles2::cmds::CoverFillPathCHROMIUM& c =
17138 *static_cast<const gles2::cmds::CoverFillPathCHROMIUM*>(cmd_data); 17310 *static_cast<const volatile gles2::cmds::CoverFillPathCHROMIUM*>(
17311 cmd_data);
17139 if (!features().chromium_path_rendering) 17312 if (!features().chromium_path_rendering)
17140 return error::kUnknownCommand; 17313 return error::kUnknownCommand;
17141 17314
17142 PathCommandValidatorContext v(this, kFunctionName); 17315 PathCommandValidatorContext v(this, kFunctionName);
17143 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17316 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17144 if (!v.GetCoverMode(c, &cover_mode)) 17317 if (!v.GetCoverMode(c, &cover_mode))
17145 return v.error(); 17318 return v.error();
17146 17319
17147 GLuint service_id = 0; 17320 GLuint service_id = 0;
17148 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17321 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17149 return error::kNoError; 17322 return error::kNoError;
17150 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17323 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17151 return error::kNoError; 17324 return error::kNoError;
17152 ApplyDirtyState(); 17325 ApplyDirtyState();
17153 glCoverFillPathNV(service_id, cover_mode); 17326 glCoverFillPathNV(service_id, cover_mode);
17154 return error::kNoError; 17327 return error::kNoError;
17155 } 17328 }
17156 17329
17157 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM( 17330 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM(
17158 uint32_t immediate_data_size, 17331 uint32_t immediate_data_size,
17159 const void* cmd_data) { 17332 const volatile void* cmd_data) {
17160 static const char kFunctionName[] = "glCoverStrokePathCHROMIUM"; 17333 static const char kFunctionName[] = "glCoverStrokePathCHROMIUM";
17161 const gles2::cmds::CoverStrokePathCHROMIUM& c = 17334 const volatile gles2::cmds::CoverStrokePathCHROMIUM& c =
17162 *static_cast<const gles2::cmds::CoverStrokePathCHROMIUM*>(cmd_data); 17335 *static_cast<const volatile gles2::cmds::CoverStrokePathCHROMIUM*>(
17336 cmd_data);
17163 if (!features().chromium_path_rendering) 17337 if (!features().chromium_path_rendering)
17164 return error::kUnknownCommand; 17338 return error::kUnknownCommand;
17165 17339
17166 PathCommandValidatorContext v(this, kFunctionName); 17340 PathCommandValidatorContext v(this, kFunctionName);
17167 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17341 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17168 if (!v.GetCoverMode(c, &cover_mode)) 17342 if (!v.GetCoverMode(c, &cover_mode))
17169 return v.error(); 17343 return v.error();
17170 17344
17171 GLuint service_id = 0; 17345 GLuint service_id = 0;
17172 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17346 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17173 return error::kNoError; 17347 return error::kNoError;
17174 17348
17175 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17349 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17176 return error::kNoError; 17350 return error::kNoError;
17177 ApplyDirtyState(); 17351 ApplyDirtyState();
17178 glCoverStrokePathNV(service_id, cover_mode); 17352 glCoverStrokePathNV(service_id, cover_mode);
17179 return error::kNoError; 17353 return error::kNoError;
17180 } 17354 }
17181 17355
17182 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathCHROMIUM( 17356 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathCHROMIUM(
17183 uint32_t immediate_data_size, 17357 uint32_t immediate_data_size,
17184 const void* cmd_data) { 17358 const volatile void* cmd_data) {
17185 static const char kFunctionName[] = "glStencilThenCoverFillPathCHROMIUM"; 17359 static const char kFunctionName[] = "glStencilThenCoverFillPathCHROMIUM";
17186 const gles2::cmds::StencilThenCoverFillPathCHROMIUM& c = 17360 const volatile gles2::cmds::StencilThenCoverFillPathCHROMIUM& c =
17187 *static_cast<const gles2::cmds::StencilThenCoverFillPathCHROMIUM*>( 17361 *static_cast<
17362 const volatile gles2::cmds::StencilThenCoverFillPathCHROMIUM*>(
17188 cmd_data); 17363 cmd_data);
17189 if (!features().chromium_path_rendering) 17364 if (!features().chromium_path_rendering)
17190 return error::kUnknownCommand; 17365 return error::kUnknownCommand;
17191 17366
17192 PathCommandValidatorContext v(this, kFunctionName); 17367 PathCommandValidatorContext v(this, kFunctionName);
17193 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17368 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17194 GLuint mask = 0; 17369 GLuint mask = 0;
17195 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17370 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17196 if (!v.GetFillModeAndMask(c, &fill_mode, &mask) || 17371 if (!v.GetFillModeAndMask(c, &fill_mode, &mask) ||
17197 !v.GetCoverMode(c, &cover_mode)) 17372 !v.GetCoverMode(c, &cover_mode))
17198 return v.error(); 17373 return v.error();
17199 17374
17200 GLuint service_id = 0; 17375 GLuint service_id = 0;
17201 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17376 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17202 return error::kNoError; 17377 return error::kNoError;
17203 17378
17204 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17379 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17205 return error::kNoError; 17380 return error::kNoError;
17206 ApplyDirtyState(); 17381 ApplyDirtyState();
17207 glStencilThenCoverFillPathNV(service_id, fill_mode, mask, cover_mode); 17382 glStencilThenCoverFillPathNV(service_id, fill_mode, mask, cover_mode);
17208 return error::kNoError; 17383 return error::kNoError;
17209 } 17384 }
17210 17385
17211 error::Error GLES2DecoderImpl::HandleStencilThenCoverStrokePathCHROMIUM( 17386 error::Error GLES2DecoderImpl::HandleStencilThenCoverStrokePathCHROMIUM(
17212 uint32_t immediate_data_size, 17387 uint32_t immediate_data_size,
17213 const void* cmd_data) { 17388 const volatile void* cmd_data) {
17214 static const char kFunctionName[] = "glStencilThenCoverStrokePathCHROMIUM"; 17389 static const char kFunctionName[] = "glStencilThenCoverStrokePathCHROMIUM";
17215 const gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c = 17390 const volatile gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c =
17216 *static_cast<const gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>( 17391 *static_cast<
17392 const volatile gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>(
17217 cmd_data); 17393 cmd_data);
17218 if (!features().chromium_path_rendering) 17394 if (!features().chromium_path_rendering)
17219 return error::kUnknownCommand; 17395 return error::kUnknownCommand;
17220 17396
17221 PathCommandValidatorContext v(this, kFunctionName); 17397 PathCommandValidatorContext v(this, kFunctionName);
17222 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17398 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17223 if (!v.GetCoverMode(c, &cover_mode)) 17399 if (!v.GetCoverMode(c, &cover_mode))
17224 return v.error(); 17400 return v.error();
17225 17401
17226 GLuint service_id = 0; 17402 GLuint service_id = 0;
17227 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17403 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17228 return error::kNoError; 17404 return error::kNoError;
17229 17405
17230 GLint reference = static_cast<GLint>(c.reference); 17406 GLint reference = static_cast<GLint>(c.reference);
17231 GLuint mask = static_cast<GLuint>(c.mask); 17407 GLuint mask = static_cast<GLuint>(c.mask);
17232 17408
17233 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17409 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17234 return error::kNoError; 17410 return error::kNoError;
17235 ApplyDirtyState(); 17411 ApplyDirtyState();
17236 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode); 17412 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode);
17237 return error::kNoError; 17413 return error::kNoError;
17238 } 17414 }
17239 17415
17240 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM( 17416 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM(
17241 uint32_t immediate_data_size, 17417 uint32_t immediate_data_size,
17242 const void* cmd_data) { 17418 const volatile void* cmd_data) {
17243 static const char kFunctionName[] = "glStencilFillPathInstancedCHROMIUM"; 17419 static const char kFunctionName[] = "glStencilFillPathInstancedCHROMIUM";
17244 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c = 17420 const volatile gles2::cmds::StencilFillPathInstancedCHROMIUM& c =
17245 *static_cast<const gles2::cmds::StencilFillPathInstancedCHROMIUM*>( 17421 *static_cast<
17422 const volatile gles2::cmds::StencilFillPathInstancedCHROMIUM*>(
17246 cmd_data); 17423 cmd_data);
17247 if (!features().chromium_path_rendering) 17424 if (!features().chromium_path_rendering)
17248 return error::kUnknownCommand; 17425 return error::kUnknownCommand;
17249 17426
17250 PathCommandValidatorContext v(this, kFunctionName); 17427 PathCommandValidatorContext v(this, kFunctionName);
17251 GLuint num_paths = 0; 17428 GLuint num_paths = 0;
17252 GLenum path_name_type = GL_NONE; 17429 GLenum path_name_type = GL_NONE;
17253 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17430 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17254 GLuint mask = 0; 17431 GLuint mask = 0;
17255 GLenum transform_type = GL_NONE; 17432 GLenum transform_type = GL_NONE;
(...skipping 16 matching lines...) Expand all
17272 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17449 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17273 return error::kNoError; 17450 return error::kNoError;
17274 ApplyDirtyState(); 17451 ApplyDirtyState();
17275 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17452 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17276 fill_mode, mask, transform_type, transforms); 17453 fill_mode, mask, transform_type, transforms);
17277 return error::kNoError; 17454 return error::kNoError;
17278 } 17455 }
17279 17456
17280 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM( 17457 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM(
17281 uint32_t immediate_data_size, 17458 uint32_t immediate_data_size,
17282 const void* cmd_data) { 17459 const volatile void* cmd_data) {
17283 static const char kFunctionName[] = "glStencilStrokePathInstancedCHROMIUM"; 17460 static const char kFunctionName[] = "glStencilStrokePathInstancedCHROMIUM";
17284 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c = 17461 const volatile gles2::cmds::StencilStrokePathInstancedCHROMIUM& c =
17285 *static_cast<const gles2::cmds::StencilStrokePathInstancedCHROMIUM*>( 17462 *static_cast<
17463 const volatile gles2::cmds::StencilStrokePathInstancedCHROMIUM*>(
17286 cmd_data); 17464 cmd_data);
17287 if (!features().chromium_path_rendering) 17465 if (!features().chromium_path_rendering)
17288 return error::kUnknownCommand; 17466 return error::kUnknownCommand;
17289 17467
17290 PathCommandValidatorContext v(this, kFunctionName); 17468 PathCommandValidatorContext v(this, kFunctionName);
17291 GLuint num_paths = 0; 17469 GLuint num_paths = 0;
17292 GLenum path_name_type = GL_NONE; 17470 GLenum path_name_type = GL_NONE;
17293 GLenum transform_type = GL_NONE; 17471 GLenum transform_type = GL_NONE;
17294 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17472 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
17295 !v.GetTransformType(c, &transform_type)) 17473 !v.GetTransformType(c, &transform_type))
(...skipping 15 matching lines...) Expand all
17311 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17489 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17312 return error::kNoError; 17490 return error::kNoError;
17313 ApplyDirtyState(); 17491 ApplyDirtyState();
17314 glStencilStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17492 glStencilStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17315 reference, mask, transform_type, transforms); 17493 reference, mask, transform_type, transforms);
17316 return error::kNoError; 17494 return error::kNoError;
17317 } 17495 }
17318 17496
17319 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM( 17497 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM(
17320 uint32_t immediate_data_size, 17498 uint32_t immediate_data_size,
17321 const void* cmd_data) { 17499 const volatile void* cmd_data) {
17322 static const char kFunctionName[] = "glCoverFillPathInstancedCHROMIUM"; 17500 static const char kFunctionName[] = "glCoverFillPathInstancedCHROMIUM";
17323 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c = 17501 const volatile gles2::cmds::CoverFillPathInstancedCHROMIUM& c =
17324 *static_cast<const gles2::cmds::CoverFillPathInstancedCHROMIUM*>( 17502 *static_cast<const volatile gles2::cmds::CoverFillPathInstancedCHROMIUM*>(
17325 cmd_data); 17503 cmd_data);
17326 if (!features().chromium_path_rendering) 17504 if (!features().chromium_path_rendering)
17327 return error::kUnknownCommand; 17505 return error::kUnknownCommand;
17328 17506
17329 PathCommandValidatorContext v(this, kFunctionName); 17507 PathCommandValidatorContext v(this, kFunctionName);
17330 GLuint num_paths = 0; 17508 GLuint num_paths = 0;
17331 GLenum path_name_type = GL_NONE; 17509 GLenum path_name_type = GL_NONE;
17332 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17510 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17333 GLenum transform_type = GL_NONE; 17511 GLenum transform_type = GL_NONE;
17334 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17512 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
(...skipping 15 matching lines...) Expand all
17350 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17528 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17351 return error::kNoError; 17529 return error::kNoError;
17352 ApplyDirtyState(); 17530 ApplyDirtyState();
17353 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17531 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17354 cover_mode, transform_type, transforms); 17532 cover_mode, transform_type, transforms);
17355 return error::kNoError; 17533 return error::kNoError;
17356 } 17534 }
17357 17535
17358 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM( 17536 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM(
17359 uint32_t immediate_data_size, 17537 uint32_t immediate_data_size,
17360 const void* cmd_data) { 17538 const volatile void* cmd_data) {
17361 static const char kFunctionName[] = "glCoverStrokePathInstancedCHROMIUM"; 17539 static const char kFunctionName[] = "glCoverStrokePathInstancedCHROMIUM";
17362 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c = 17540 const volatile gles2::cmds::CoverStrokePathInstancedCHROMIUM& c =
17363 *static_cast<const gles2::cmds::CoverStrokePathInstancedCHROMIUM*>( 17541 *static_cast<
17542 const volatile gles2::cmds::CoverStrokePathInstancedCHROMIUM*>(
17364 cmd_data); 17543 cmd_data);
17365 if (!features().chromium_path_rendering) 17544 if (!features().chromium_path_rendering)
17366 return error::kUnknownCommand; 17545 return error::kUnknownCommand;
17367 17546
17368 PathCommandValidatorContext v(this, kFunctionName); 17547 PathCommandValidatorContext v(this, kFunctionName);
17369 GLuint num_paths = 0; 17548 GLuint num_paths = 0;
17370 GLenum path_name_type = GL_NONE; 17549 GLenum path_name_type = GL_NONE;
17371 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17550 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17372 GLenum transform_type = GL_NONE; 17551 GLenum transform_type = GL_NONE;
17373 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17552 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
(...skipping 15 matching lines...) Expand all
17389 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17568 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17390 return error::kNoError; 17569 return error::kNoError;
17391 ApplyDirtyState(); 17570 ApplyDirtyState();
17392 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17571 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17393 cover_mode, transform_type, transforms); 17572 cover_mode, transform_type, transforms);
17394 return error::kNoError; 17573 return error::kNoError;
17395 } 17574 }
17396 17575
17397 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM( 17576 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM(
17398 uint32_t immediate_data_size, 17577 uint32_t immediate_data_size,
17399 const void* cmd_data) { 17578 const volatile void* cmd_data) {
17400 static const char kFunctionName[] = 17579 static const char kFunctionName[] =
17401 "glStencilThenCoverFillPathInstancedCHROMIUM"; 17580 "glStencilThenCoverFillPathInstancedCHROMIUM";
17402 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c = 17581 const volatile gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c =
17403 *static_cast< 17582 *static_cast<const volatile gles2::cmds::
17404 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM*>( 17583 StencilThenCoverFillPathInstancedCHROMIUM*>(cmd_data);
17405 cmd_data);
17406 if (!features().chromium_path_rendering) 17584 if (!features().chromium_path_rendering)
17407 return error::kUnknownCommand; 17585 return error::kUnknownCommand;
17408 PathCommandValidatorContext v(this, kFunctionName); 17586 PathCommandValidatorContext v(this, kFunctionName);
17409 17587
17410 GLuint num_paths = 0; 17588 GLuint num_paths = 0;
17411 GLenum path_name_type = GL_NONE; 17589 GLenum path_name_type = GL_NONE;
17412 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17590 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17413 GLuint mask = 0; 17591 GLuint mask = 0;
17414 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17592 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17415 GLenum transform_type = GL_NONE; 17593 GLenum transform_type = GL_NONE;
(...skipping 19 matching lines...) Expand all
17435 ApplyDirtyState(); 17613 ApplyDirtyState();
17436 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 17614 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(),
17437 0, fill_mode, mask, cover_mode, 17615 0, fill_mode, mask, cover_mode,
17438 transform_type, transforms); 17616 transform_type, transforms);
17439 return error::kNoError; 17617 return error::kNoError;
17440 } 17618 }
17441 17619
17442 error::Error 17620 error::Error
17443 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( 17621 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM(
17444 uint32_t immediate_data_size, 17622 uint32_t immediate_data_size,
17445 const void* cmd_data) { 17623 const volatile void* cmd_data) {
17446 static const char kFunctionName[] = 17624 static const char kFunctionName[] =
17447 "glStencilThenCoverStrokeInstancedCHROMIUM"; 17625 "glStencilThenCoverStrokeInstancedCHROMIUM";
17448 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = 17626 const volatile gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c =
17449 *static_cast< 17627 *static_cast<const volatile gles2::cmds::
17450 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM*>( 17628 StencilThenCoverStrokePathInstancedCHROMIUM*>(cmd_data);
17451 cmd_data);
17452 if (!features().chromium_path_rendering) 17629 if (!features().chromium_path_rendering)
17453 return error::kUnknownCommand; 17630 return error::kUnknownCommand;
17454 PathCommandValidatorContext v(this, kFunctionName); 17631 PathCommandValidatorContext v(this, kFunctionName);
17455 GLuint num_paths = 0; 17632 GLuint num_paths = 0;
17456 GLenum path_name_type = GL_NONE; 17633 GLenum path_name_type = GL_NONE;
17457 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17634 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17458 GLenum transform_type = GL_NONE; 17635 GLenum transform_type = GL_NONE;
17459 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17636 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
17460 !v.GetCoverMode(c, &cover_mode) || 17637 !v.GetCoverMode(c, &cover_mode) ||
17461 !v.GetTransformType(c, &transform_type)) 17638 !v.GetTransformType(c, &transform_type))
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
17587 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", 17764 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround",
17588 GetErrorState()); 17765 GetErrorState());
17589 clear_framebuffer_blit_->ClearFramebuffer( 17766 clear_framebuffer_blit_->ClearFramebuffer(
17590 this, GetBoundReadFramebufferSize(), mask, state_.color_clear_red, 17767 this, GetBoundReadFramebufferSize(), mask, state_.color_clear_red,
17591 state_.color_clear_green, state_.color_clear_blue, 17768 state_.color_clear_green, state_.color_clear_blue,
17592 state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear); 17769 state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear);
17593 } 17770 }
17594 17771
17595 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( 17772 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket(
17596 uint32_t immediate_data_size, 17773 uint32_t immediate_data_size,
17597 const void* cmd_data) { 17774 const volatile void* cmd_data) {
17598 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = 17775 const volatile gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c =
17599 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( 17776 *static_cast<
17777 const volatile gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>(
17600 cmd_data); 17778 cmd_data);
17601 if (!features().chromium_path_rendering) { 17779 if (!features().chromium_path_rendering) {
17602 return error::kUnknownCommand; 17780 return error::kUnknownCommand;
17603 } 17781 }
17604 17782
17605 GLuint program = static_cast<GLuint>(c.program); 17783 GLuint program = static_cast<GLuint>(c.program);
17606 GLint location = static_cast<GLint>(c.location); 17784 GLint location = static_cast<GLint>(c.location);
17607 Bucket* bucket = GetBucket(c.name_bucket_id); 17785 Bucket* bucket = GetBucket(c.name_bucket_id);
17608 if (!bucket || bucket->size() == 0) { 17786 if (!bucket || bucket->size() == 0) {
17609 return error::kInvalidArguments; 17787 return error::kInvalidArguments;
17610 } 17788 }
17611 std::string name_str; 17789 std::string name_str;
17612 if (!bucket->GetAsString(&name_str)) { 17790 if (!bucket->GetAsString(&name_str)) {
17613 return error::kInvalidArguments; 17791 return error::kInvalidArguments;
17614 } 17792 }
17615 DoBindFragmentInputLocationCHROMIUM(program, location, name_str); 17793 DoBindFragmentInputLocationCHROMIUM(program, location, name_str);
17616 return error::kNoError; 17794 return error::kNoError;
17617 } 17795 }
17618 17796
17619 error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM( 17797 error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM(
17620 uint32_t immediate_data_size, 17798 uint32_t immediate_data_size,
17621 const void* cmd_data) { 17799 const volatile void* cmd_data) {
17622 static const char kFunctionName[] = "glProgramPathFragmentInputGenCHROMIUM"; 17800 static const char kFunctionName[] = "glProgramPathFragmentInputGenCHROMIUM";
17623 const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c = 17801 const volatile gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c =
17624 *static_cast<const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>( 17802 *static_cast<
17803 const volatile gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>(
17625 cmd_data); 17804 cmd_data);
17626 if (!features().chromium_path_rendering) { 17805 if (!features().chromium_path_rendering) {
17627 return error::kUnknownCommand; 17806 return error::kUnknownCommand;
17628 } 17807 }
17629 17808
17630 GLint program_id = static_cast<GLint>(c.program); 17809 GLint program_id = static_cast<GLint>(c.program);
17631 17810
17632 Program* program = GetProgram(program_id); 17811 Program* program = GetProgram(program_id);
17633 if (!program || !program->IsValid() || program->IsDeleted()) { 17812 if (!program || !program->IsValid() || program->IsDeleted()) {
17634 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "invalid program"); 17813 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "invalid program");
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
17748 } 17927 }
17749 17928
17750 // Include the auto-generated part of this file. We split this because it means 17929 // Include the auto-generated part of this file. We split this because it means
17751 // we can easily edit the non-auto generated parts right here in this file 17930 // we can easily edit the non-auto generated parts right here in this file
17752 // instead of having to edit some template or the code generator. 17931 // instead of having to edit some template or the code generator.
17753 #include "base/macros.h" 17932 #include "base/macros.h"
17754 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17933 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17755 17934
17756 } // namespace gles2 17935 } // namespace gles2
17757 } // namespace gpu 17936 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698