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

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: rebase 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?
no sievers 2016/09/02 21:17:34 Hmm.. maybe we shouldn't use gfx::Transform then a
piman 2016/09/02 23:11:06 Yes, agreed it would be ridiculous... gfx::Transfo
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 std::copy(transform, transform + arraysize(gl_matrix), gl_matrix);
no sievers 2016/09/02 21:17:34 This array is small, but was wondering about std::
piman 2016/09/02 23:11:06 I went a bit back and forth on this. The const_cas
8569 } 8671 }
8570 } else { 8672 } else {
8571 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 8673 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
8572 "DoUniformMatrix4vStreamTextureMatrix", 8674 "DoUniformMatrix4vStreamTextureMatrix",
8573 "no texture bound"); 8675 "no texture bound");
8574 return; 8676 return;
8575 } 8677 }
8576 8678
8577 GLenum type = 0; 8679 GLenum type = 0;
8578 GLint real_location = -1; 8680 GLint real_location = -1;
8579 GLsizei count = 1; 8681 GLsizei count = 1;
8580 if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv", 8682 if (!PrepForSetUniformByLocation(fake_location, "glUniformMatrix4fv",
8581 Program::kUniformMatrix4f, &real_location, 8683 Program::kUniformMatrix4f, &real_location,
8582 &type, &count)) { 8684 &type, &count)) {
8583 return; 8685 return;
8584 } 8686 }
8585 8687
8586 glUniformMatrix4fv(real_location, count, transpose, gl_matrix); 8688 glUniformMatrix4fv(real_location, count, transpose, gl_matrix);
8587 } 8689 }
8588 8690
8589 void GLES2DecoderImpl::DoUniformMatrix2x3fv( 8691 void GLES2DecoderImpl::DoUniformMatrix2x3fv(GLint fake_location,
8590 GLint fake_location, GLsizei count, GLboolean transpose, 8692 GLsizei count,
8591 const GLfloat* value) { 8693 GLboolean transpose,
8694 const volatile GLfloat* value) {
8592 GLenum type = 0; 8695 GLenum type = 0;
8593 GLint real_location = -1; 8696 GLint real_location = -1;
8594 if (!PrepForSetUniformByLocation(fake_location, 8697 if (!PrepForSetUniformByLocation(fake_location,
8595 "glUniformMatrix2x3fv", 8698 "glUniformMatrix2x3fv",
8596 Program::kUniformMatrix2x3f, 8699 Program::kUniformMatrix2x3f,
8597 &real_location, 8700 &real_location,
8598 &type, 8701 &type,
8599 &count)) { 8702 &count)) {
8600 return; 8703 return;
8601 } 8704 }
8602 glUniformMatrix2x3fv(real_location, count, transpose, value); 8705 glUniformMatrix2x3fv(real_location, count, transpose,
8706 const_cast<const GLfloat*>(value));
8603 } 8707 }
8604 8708
8605 void GLES2DecoderImpl::DoUniformMatrix2x4fv( 8709 void GLES2DecoderImpl::DoUniformMatrix2x4fv(GLint fake_location,
8606 GLint fake_location, GLsizei count, GLboolean transpose, 8710 GLsizei count,
8607 const GLfloat* value) { 8711 GLboolean transpose,
8712 const volatile GLfloat* value) {
8608 GLenum type = 0; 8713 GLenum type = 0;
8609 GLint real_location = -1; 8714 GLint real_location = -1;
8610 if (!PrepForSetUniformByLocation(fake_location, 8715 if (!PrepForSetUniformByLocation(fake_location,
8611 "glUniformMatrix2x4fv", 8716 "glUniformMatrix2x4fv",
8612 Program::kUniformMatrix2x4f, 8717 Program::kUniformMatrix2x4f,
8613 &real_location, 8718 &real_location,
8614 &type, 8719 &type,
8615 &count)) { 8720 &count)) {
8616 return; 8721 return;
8617 } 8722 }
8618 glUniformMatrix2x4fv(real_location, count, transpose, value); 8723 glUniformMatrix2x4fv(real_location, count, transpose,
8724 const_cast<const GLfloat*>(value));
8619 } 8725 }
8620 8726
8621 void GLES2DecoderImpl::DoUniformMatrix3x2fv( 8727 void GLES2DecoderImpl::DoUniformMatrix3x2fv(GLint fake_location,
8622 GLint fake_location, GLsizei count, GLboolean transpose, 8728 GLsizei count,
8623 const GLfloat* value) { 8729 GLboolean transpose,
8730 const volatile GLfloat* value) {
8624 GLenum type = 0; 8731 GLenum type = 0;
8625 GLint real_location = -1; 8732 GLint real_location = -1;
8626 if (!PrepForSetUniformByLocation(fake_location, 8733 if (!PrepForSetUniformByLocation(fake_location,
8627 "glUniformMatrix3x2fv", 8734 "glUniformMatrix3x2fv",
8628 Program::kUniformMatrix3x2f, 8735 Program::kUniformMatrix3x2f,
8629 &real_location, 8736 &real_location,
8630 &type, 8737 &type,
8631 &count)) { 8738 &count)) {
8632 return; 8739 return;
8633 } 8740 }
8634 glUniformMatrix3x2fv(real_location, count, transpose, value); 8741 glUniformMatrix3x2fv(real_location, count, transpose,
8742 const_cast<const GLfloat*>(value));
8635 } 8743 }
8636 8744
8637 void GLES2DecoderImpl::DoUniformMatrix3x4fv( 8745 void GLES2DecoderImpl::DoUniformMatrix3x4fv(GLint fake_location,
8638 GLint fake_location, GLsizei count, GLboolean transpose, 8746 GLsizei count,
8639 const GLfloat* value) { 8747 GLboolean transpose,
8748 const volatile GLfloat* value) {
8640 GLenum type = 0; 8749 GLenum type = 0;
8641 GLint real_location = -1; 8750 GLint real_location = -1;
8642 if (!PrepForSetUniformByLocation(fake_location, 8751 if (!PrepForSetUniformByLocation(fake_location,
8643 "glUniformMatrix3x4fv", 8752 "glUniformMatrix3x4fv",
8644 Program::kUniformMatrix3x4f, 8753 Program::kUniformMatrix3x4f,
8645 &real_location, 8754 &real_location,
8646 &type, 8755 &type,
8647 &count)) { 8756 &count)) {
8648 return; 8757 return;
8649 } 8758 }
8650 glUniformMatrix3x4fv(real_location, count, transpose, value); 8759 glUniformMatrix3x4fv(real_location, count, transpose,
8760 const_cast<const GLfloat*>(value));
8651 } 8761 }
8652 8762
8653 void GLES2DecoderImpl::DoUniformMatrix4x2fv( 8763 void GLES2DecoderImpl::DoUniformMatrix4x2fv(GLint fake_location,
8654 GLint fake_location, GLsizei count, GLboolean transpose, 8764 GLsizei count,
8655 const GLfloat* value) { 8765 GLboolean transpose,
8766 const volatile GLfloat* value) {
8656 GLenum type = 0; 8767 GLenum type = 0;
8657 GLint real_location = -1; 8768 GLint real_location = -1;
8658 if (!PrepForSetUniformByLocation(fake_location, 8769 if (!PrepForSetUniformByLocation(fake_location,
8659 "glUniformMatrix4x2fv", 8770 "glUniformMatrix4x2fv",
8660 Program::kUniformMatrix4x2f, 8771 Program::kUniformMatrix4x2f,
8661 &real_location, 8772 &real_location,
8662 &type, 8773 &type,
8663 &count)) { 8774 &count)) {
8664 return; 8775 return;
8665 } 8776 }
8666 glUniformMatrix4x2fv(real_location, count, transpose, value); 8777 glUniformMatrix4x2fv(real_location, count, transpose,
8778 const_cast<const GLfloat*>(value));
8667 } 8779 }
8668 8780
8669 void GLES2DecoderImpl::DoUniformMatrix4x3fv( 8781 void GLES2DecoderImpl::DoUniformMatrix4x3fv(GLint fake_location,
8670 GLint fake_location, GLsizei count, GLboolean transpose, 8782 GLsizei count,
8671 const GLfloat* value) { 8783 GLboolean transpose,
8784 const volatile GLfloat* value) {
8672 GLenum type = 0; 8785 GLenum type = 0;
8673 GLint real_location = -1; 8786 GLint real_location = -1;
8674 if (!PrepForSetUniformByLocation(fake_location, 8787 if (!PrepForSetUniformByLocation(fake_location,
8675 "glUniformMatrix4x3fv", 8788 "glUniformMatrix4x3fv",
8676 Program::kUniformMatrix4x3f, 8789 Program::kUniformMatrix4x3f,
8677 &real_location, 8790 &real_location,
8678 &type, 8791 &type,
8679 &count)) { 8792 &count)) {
8680 return; 8793 return;
8681 } 8794 }
8682 glUniformMatrix4x3fv(real_location, count, transpose, value); 8795 glUniformMatrix4x3fv(real_location, count, transpose,
8796 const_cast<const GLfloat*>(value));
8683 } 8797 }
8684 8798
8685 void GLES2DecoderImpl::DoUseProgram(GLuint program_id) { 8799 void GLES2DecoderImpl::DoUseProgram(GLuint program_id) {
8686 const char* function_name = "glUseProgram"; 8800 const char* function_name = "glUseProgram";
8687 GLuint service_id = 0; 8801 GLuint service_id = 0;
8688 Program* program = nullptr; 8802 Program* program = nullptr;
8689 if (program_id) { 8803 if (program_id) {
8690 program = GetProgramInfoNotShader(program_id, function_name); 8804 program = GetProgramInfoNotShader(program_id, function_name);
8691 if (!program) { 8805 if (!program) {
8692 return; 8806 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 9391 // 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 9392 // it in each draw call, and attrib 0 generic data queries use cached
9279 // values instead of passing down to the underlying driver. 9393 // values instead of passing down to the underlying driver.
9280 RestoreStateForAttrib(0, false); 9394 RestoreStateForAttrib(0, false);
9281 } 9395 }
9282 } 9396 }
9283 return error::kNoError; 9397 return error::kNoError;
9284 } 9398 }
9285 9399
9286 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32_t immediate_data_size, 9400 error::Error GLES2DecoderImpl::HandleDrawArrays(uint32_t immediate_data_size,
9287 const void* cmd_data) { 9401 const volatile void* cmd_data) {
9288 const cmds::DrawArrays& c = *static_cast<const cmds::DrawArrays*>(cmd_data); 9402 const volatile cmds::DrawArrays& c =
9403 *static_cast<const volatile cmds::DrawArrays*>(cmd_data);
9289 return DoDrawArrays("glDrawArrays", 9404 return DoDrawArrays("glDrawArrays",
9290 false, 9405 false,
9291 static_cast<GLenum>(c.mode), 9406 static_cast<GLenum>(c.mode),
9292 static_cast<GLint>(c.first), 9407 static_cast<GLint>(c.first),
9293 static_cast<GLsizei>(c.count), 9408 static_cast<GLsizei>(c.count),
9294 1); 9409 1);
9295 } 9410 }
9296 9411
9297 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( 9412 error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE(
9298 uint32_t immediate_data_size, 9413 uint32_t immediate_data_size,
9299 const void* cmd_data) { 9414 const volatile void* cmd_data) {
9300 const gles2::cmds::DrawArraysInstancedANGLE& c = 9415 const volatile gles2::cmds::DrawArraysInstancedANGLE& c =
9301 *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); 9416 *static_cast<const volatile gles2::cmds::DrawArraysInstancedANGLE*>(
9417 cmd_data);
9302 if (!features().angle_instanced_arrays) 9418 if (!features().angle_instanced_arrays)
9303 return error::kUnknownCommand; 9419 return error::kUnknownCommand;
9304 9420
9305 return DoDrawArrays("glDrawArraysIntancedANGLE", 9421 return DoDrawArrays("glDrawArraysIntancedANGLE",
9306 true, 9422 true,
9307 static_cast<GLenum>(c.mode), 9423 static_cast<GLenum>(c.mode),
9308 static_cast<GLint>(c.first), 9424 static_cast<GLint>(c.first),
9309 static_cast<GLsizei>(c.count), 9425 static_cast<GLsizei>(c.count),
9310 static_cast<GLsizei>(c.primcount)); 9426 static_cast<GLsizei>(c.primcount));
9311 } 9427 }
(...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 9560 // 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 9561 // 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 9562 // it in each draw call, and attrib 0 generic data queries use cached
9447 // values instead of passing down to the underlying driver. 9563 // values instead of passing down to the underlying driver.
9448 RestoreStateForAttrib(0, false); 9564 RestoreStateForAttrib(0, false);
9449 } 9565 }
9450 } 9566 }
9451 return error::kNoError; 9567 return error::kNoError;
9452 } 9568 }
9453 9569
9454 error::Error GLES2DecoderImpl::HandleDrawElements(uint32_t immediate_data_size, 9570 error::Error GLES2DecoderImpl::HandleDrawElements(
9455 const void* cmd_data) { 9571 uint32_t immediate_data_size,
9456 const gles2::cmds::DrawElements& c = 9572 const volatile void* cmd_data) {
9457 *static_cast<const gles2::cmds::DrawElements*>(cmd_data); 9573 const volatile gles2::cmds::DrawElements& c =
9574 *static_cast<const volatile gles2::cmds::DrawElements*>(cmd_data);
9458 return DoDrawElements("glDrawElements", false, static_cast<GLenum>(c.mode), 9575 return DoDrawElements("glDrawElements", false, static_cast<GLenum>(c.mode),
9459 static_cast<GLsizei>(c.count), 9576 static_cast<GLsizei>(c.count),
9460 static_cast<GLenum>(c.type), 9577 static_cast<GLenum>(c.type),
9461 static_cast<int32_t>(c.index_offset), 1); 9578 static_cast<int32_t>(c.index_offset), 1);
9462 } 9579 }
9463 9580
9464 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE( 9581 error::Error GLES2DecoderImpl::HandleDrawElementsInstancedANGLE(
9465 uint32_t immediate_data_size, 9582 uint32_t immediate_data_size,
9466 const void* cmd_data) { 9583 const volatile void* cmd_data) {
9467 const gles2::cmds::DrawElementsInstancedANGLE& c = 9584 const volatile gles2::cmds::DrawElementsInstancedANGLE& c =
9468 *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); 9585 *static_cast<const volatile gles2::cmds::DrawElementsInstancedANGLE*>(
9586 cmd_data);
9469 if (!features().angle_instanced_arrays) 9587 if (!features().angle_instanced_arrays)
9470 return error::kUnknownCommand; 9588 return error::kUnknownCommand;
9471 9589
9472 return DoDrawElements( 9590 return DoDrawElements(
9473 "glDrawElementsInstancedANGLE", true, static_cast<GLenum>(c.mode), 9591 "glDrawElementsInstancedANGLE", true, static_cast<GLenum>(c.mode),
9474 static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type), 9592 static_cast<GLsizei>(c.count), static_cast<GLenum>(c.type),
9475 static_cast<int32_t>(c.index_offset), static_cast<GLsizei>(c.primcount)); 9593 static_cast<int32_t>(c.index_offset), static_cast<GLsizei>(c.primcount));
9476 } 9594 }
9477 9595
9478 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( 9596 GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
9595 ++(*params); 9713 ++(*params);
9596 return; 9714 return;
9597 default: 9715 default:
9598 break; 9716 break;
9599 } 9717 }
9600 glGetShaderiv(shader->service_id(), pname, params); 9718 glGetShaderiv(shader->service_id(), pname, params);
9601 } 9719 }
9602 9720
9603 error::Error GLES2DecoderImpl::HandleGetShaderSource( 9721 error::Error GLES2DecoderImpl::HandleGetShaderSource(
9604 uint32_t immediate_data_size, 9722 uint32_t immediate_data_size,
9605 const void* cmd_data) { 9723 const volatile void* cmd_data) {
9606 const gles2::cmds::GetShaderSource& c = 9724 const volatile gles2::cmds::GetShaderSource& c =
9607 *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); 9725 *static_cast<const volatile gles2::cmds::GetShaderSource*>(cmd_data);
9608 GLuint shader_id = c.shader; 9726 GLuint shader_id = c.shader;
9609 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9727 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9610 Bucket* bucket = CreateBucket(bucket_id); 9728 Bucket* bucket = CreateBucket(bucket_id);
9611 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource"); 9729 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderSource");
9612 if (!shader || shader->source().empty()) { 9730 if (!shader || shader->source().empty()) {
9613 bucket->SetSize(0); 9731 bucket->SetSize(0);
9614 return error::kNoError; 9732 return error::kNoError;
9615 } 9733 }
9616 bucket->SetFromString(shader->source().c_str()); 9734 bucket->SetFromString(shader->source().c_str());
9617 return error::kNoError; 9735 return error::kNoError;
9618 } 9736 }
9619 9737
9620 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE( 9738 error::Error GLES2DecoderImpl::HandleGetTranslatedShaderSourceANGLE(
9621 uint32_t immediate_data_size, 9739 uint32_t immediate_data_size,
9622 const void* cmd_data) { 9740 const volatile void* cmd_data) {
9623 const gles2::cmds::GetTranslatedShaderSourceANGLE& c = 9741 const volatile gles2::cmds::GetTranslatedShaderSourceANGLE& c =
9624 *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( 9742 *static_cast<const volatile gles2::cmds::GetTranslatedShaderSourceANGLE*>(
9625 cmd_data); 9743 cmd_data);
9626 GLuint shader_id = c.shader; 9744 GLuint shader_id = c.shader;
9627 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9745 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9628 Bucket* bucket = CreateBucket(bucket_id); 9746 Bucket* bucket = CreateBucket(bucket_id);
9629 Shader* shader = GetShaderInfoNotProgram( 9747 Shader* shader = GetShaderInfoNotProgram(
9630 shader_id, "glGetTranslatedShaderSourceANGLE"); 9748 shader_id, "glGetTranslatedShaderSourceANGLE");
9631 if (!shader) { 9749 if (!shader) {
9632 bucket->SetSize(0); 9750 bucket->SetSize(0);
9633 return error::kNoError; 9751 return error::kNoError;
9634 } 9752 }
9635 9753
9636 // Make sure translator has been utilized in compile. 9754 // Make sure translator has been utilized in compile.
9637 shader->DoCompile(); 9755 shader->DoCompile();
9638 9756
9639 bucket->SetFromString(shader->translated_source().c_str()); 9757 bucket->SetFromString(shader->translated_source().c_str());
9640 return error::kNoError; 9758 return error::kNoError;
9641 } 9759 }
9642 9760
9643 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog( 9761 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog(
9644 uint32_t immediate_data_size, 9762 uint32_t immediate_data_size,
9645 const void* cmd_data) { 9763 const volatile void* cmd_data) {
9646 const gles2::cmds::GetProgramInfoLog& c = 9764 const volatile gles2::cmds::GetProgramInfoLog& c =
9647 *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); 9765 *static_cast<const volatile gles2::cmds::GetProgramInfoLog*>(cmd_data);
9648 GLuint program_id = c.program; 9766 GLuint program_id = c.program;
9649 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9767 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9650 Bucket* bucket = CreateBucket(bucket_id); 9768 Bucket* bucket = CreateBucket(bucket_id);
9651 Program* program = GetProgramInfoNotShader( 9769 Program* program = GetProgramInfoNotShader(
9652 program_id, "glGetProgramInfoLog"); 9770 program_id, "glGetProgramInfoLog");
9653 if (!program || !program->log_info()) { 9771 if (!program || !program->log_info()) {
9654 bucket->SetFromString(""); 9772 bucket->SetFromString("");
9655 return error::kNoError; 9773 return error::kNoError;
9656 } 9774 }
9657 bucket->SetFromString(program->log_info()->c_str()); 9775 bucket->SetFromString(program->log_info()->c_str());
9658 return error::kNoError; 9776 return error::kNoError;
9659 } 9777 }
9660 9778
9661 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog( 9779 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog(
9662 uint32_t immediate_data_size, 9780 uint32_t immediate_data_size,
9663 const void* cmd_data) { 9781 const volatile void* cmd_data) {
9664 const gles2::cmds::GetShaderInfoLog& c = 9782 const volatile gles2::cmds::GetShaderInfoLog& c =
9665 *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); 9783 *static_cast<const volatile gles2::cmds::GetShaderInfoLog*>(cmd_data);
9666 GLuint shader_id = c.shader; 9784 GLuint shader_id = c.shader;
9667 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); 9785 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id);
9668 Bucket* bucket = CreateBucket(bucket_id); 9786 Bucket* bucket = CreateBucket(bucket_id);
9669 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog"); 9787 Shader* shader = GetShaderInfoNotProgram(shader_id, "glGetShaderInfoLog");
9670 if (!shader) { 9788 if (!shader) {
9671 bucket->SetFromString(""); 9789 bucket->SetFromString("");
9672 return error::kNoError; 9790 return error::kNoError;
9673 } 9791 }
9674 9792
9675 // Shader must be compiled in order to get the info log. 9793 // 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( 10114 void GLES2DecoderImpl::DoVertexAttrib4f(
9997 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { 10115 GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) {
9998 GLfloat v[4] = { v0, v1, v2, v3, }; 10116 GLfloat v[4] = { v0, v1, v2, v3, };
9999 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) { 10117 if (SetVertexAttribValue("glVertexAttrib4f", index, v)) {
10000 state_.SetGenericVertexAttribBaseType( 10118 state_.SetGenericVertexAttribBaseType(
10001 index, SHADER_VARIABLE_FLOAT); 10119 index, SHADER_VARIABLE_FLOAT);
10002 glVertexAttrib4f(index, v0, v1, v2, v3); 10120 glVertexAttrib4f(index, v0, v1, v2, v3);
10003 } 10121 }
10004 } 10122 }
10005 10123
10006 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { 10124 void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index,
10125 const volatile GLfloat* v) {
10007 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, }; 10126 GLfloat t[4] = { v[0], 0.0f, 0.0f, 1.0f, };
10008 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) { 10127 if (SetVertexAttribValue("glVertexAttrib1fv", index, t)) {
10009 state_.SetGenericVertexAttribBaseType( 10128 state_.SetGenericVertexAttribBaseType(
10010 index, SHADER_VARIABLE_FLOAT); 10129 index, SHADER_VARIABLE_FLOAT);
10011 glVertexAttrib1fv(index, t); 10130 glVertexAttrib1fv(index, t);
10012 } 10131 }
10013 } 10132 }
10014 10133
10015 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { 10134 void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index,
10135 const volatile GLfloat* v) {
10016 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, }; 10136 GLfloat t[4] = { v[0], v[1], 0.0f, 1.0f, };
10017 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) { 10137 if (SetVertexAttribValue("glVertexAttrib2fv", index, t)) {
10018 state_.SetGenericVertexAttribBaseType( 10138 state_.SetGenericVertexAttribBaseType(
10019 index, SHADER_VARIABLE_FLOAT); 10139 index, SHADER_VARIABLE_FLOAT);
10020 glVertexAttrib2fv(index, t); 10140 glVertexAttrib2fv(index, t);
10021 } 10141 }
10022 } 10142 }
10023 10143
10024 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index, const GLfloat* v) { 10144 void GLES2DecoderImpl::DoVertexAttrib3fv(GLuint index,
10145 const volatile GLfloat* v) {
10025 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, }; 10146 GLfloat t[4] = { v[0], v[1], v[2], 1.0f, };
10026 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) { 10147 if (SetVertexAttribValue("glVertexAttrib3fv", index, t)) {
10027 state_.SetGenericVertexAttribBaseType( 10148 state_.SetGenericVertexAttribBaseType(
10028 index, SHADER_VARIABLE_FLOAT); 10149 index, SHADER_VARIABLE_FLOAT);
10029 glVertexAttrib3fv(index, t); 10150 glVertexAttrib3fv(index, t);
10030 } 10151 }
10031 } 10152 }
10032 10153
10033 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index, const GLfloat* v) { 10154 void GLES2DecoderImpl::DoVertexAttrib4fv(GLuint index,
10155 const volatile GLfloat* v) {
10034 GLfloat t[4] = {v[0], v[1], v[2], v[3]}; 10156 GLfloat t[4] = {v[0], v[1], v[2], v[3]};
10035 if (SetVertexAttribValue("glVertexAttrib4fv", index, t)) { 10157 if (SetVertexAttribValue("glVertexAttrib4fv", index, t)) {
10036 state_.SetGenericVertexAttribBaseType( 10158 state_.SetGenericVertexAttribBaseType(
10037 index, SHADER_VARIABLE_FLOAT); 10159 index, SHADER_VARIABLE_FLOAT);
10038 glVertexAttrib4fv(index, t); 10160 glVertexAttrib4fv(index, t);
10039 } 10161 }
10040 } 10162 }
10041 10163
10042 void GLES2DecoderImpl::DoVertexAttribI4i( 10164 void GLES2DecoderImpl::DoVertexAttribI4i(
10043 GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) { 10165 GLuint index, GLint v0, GLint v1, GLint v2, GLint v3) {
10044 GLint v[4] = { v0, v1, v2, v3 }; 10166 GLint v[4] = { v0, v1, v2, v3 };
10045 if (SetVertexAttribValue("glVertexAttribI4i", index, v)) { 10167 if (SetVertexAttribValue("glVertexAttribI4i", index, v)) {
10046 state_.SetGenericVertexAttribBaseType( 10168 state_.SetGenericVertexAttribBaseType(
10047 index, SHADER_VARIABLE_INT); 10169 index, SHADER_VARIABLE_INT);
10048 glVertexAttribI4i(index, v0, v1, v2, v3); 10170 glVertexAttribI4i(index, v0, v1, v2, v3);
10049 } 10171 }
10050 } 10172 }
10051 10173
10052 void GLES2DecoderImpl::DoVertexAttribI4iv(GLuint index, const GLint* v) { 10174 void GLES2DecoderImpl::DoVertexAttribI4iv(GLuint index,
10175 const volatile GLint* v) {
10053 GLint t[4] = {v[0], v[1], v[2], v[3]}; 10176 GLint t[4] = {v[0], v[1], v[2], v[3]};
10054 if (SetVertexAttribValue("glVertexAttribI4iv", index, t)) { 10177 if (SetVertexAttribValue("glVertexAttribI4iv", index, t)) {
10055 state_.SetGenericVertexAttribBaseType( 10178 state_.SetGenericVertexAttribBaseType(
10056 index, SHADER_VARIABLE_INT); 10179 index, SHADER_VARIABLE_INT);
10057 glVertexAttribI4iv(index, t); 10180 glVertexAttribI4iv(index, t);
10058 } 10181 }
10059 } 10182 }
10060 10183
10061 void GLES2DecoderImpl::DoVertexAttribI4ui( 10184 void GLES2DecoderImpl::DoVertexAttribI4ui(
10062 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { 10185 GLuint index, GLuint v0, GLuint v1, GLuint v2, GLuint v3) {
10063 GLuint v[4] = { v0, v1, v2, v3 }; 10186 GLuint v[4] = { v0, v1, v2, v3 };
10064 if (SetVertexAttribValue("glVertexAttribI4ui", index, v)) { 10187 if (SetVertexAttribValue("glVertexAttribI4ui", index, v)) {
10065 state_.SetGenericVertexAttribBaseType( 10188 state_.SetGenericVertexAttribBaseType(
10066 index, SHADER_VARIABLE_UINT); 10189 index, SHADER_VARIABLE_UINT);
10067 glVertexAttribI4ui(index, v0, v1, v2, v3); 10190 glVertexAttribI4ui(index, v0, v1, v2, v3);
10068 } 10191 }
10069 } 10192 }
10070 10193
10071 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const GLuint* v) { 10194 void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index,
10195 const volatile GLuint* v) {
10072 GLuint t[4] = {v[0], v[1], v[2], v[3]}; 10196 GLuint t[4] = {v[0], v[1], v[2], v[3]};
10073 if (SetVertexAttribValue("glVertexAttribI4uiv", index, t)) { 10197 if (SetVertexAttribValue("glVertexAttribI4uiv", index, t)) {
10074 state_.SetGenericVertexAttribBaseType( 10198 state_.SetGenericVertexAttribBaseType(
10075 index, SHADER_VARIABLE_UINT); 10199 index, SHADER_VARIABLE_UINT);
10076 glVertexAttribI4uiv(index, t); 10200 glVertexAttribI4uiv(index, t);
10077 } 10201 }
10078 } 10202 }
10079 10203
10080 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer( 10204 error::Error GLES2DecoderImpl::HandleVertexAttribIPointer(
10081 uint32_t immediate_data_size, 10205 uint32_t immediate_data_size,
10082 const void* cmd_data) { 10206 const volatile void* cmd_data) {
10083 if (!unsafe_es3_apis_enabled()) 10207 if (!unsafe_es3_apis_enabled())
10084 return error::kUnknownCommand; 10208 return error::kUnknownCommand;
10085 const gles2::cmds::VertexAttribIPointer& c = 10209 const volatile gles2::cmds::VertexAttribIPointer& c =
10086 *static_cast<const gles2::cmds::VertexAttribIPointer*>(cmd_data); 10210 *static_cast<const volatile gles2::cmds::VertexAttribIPointer*>(cmd_data);
10087 GLuint indx = c.indx; 10211 GLuint indx = c.indx;
10088 GLint size = c.size; 10212 GLint size = c.size;
10089 GLenum type = c.type; 10213 GLenum type = c.type;
10090 GLsizei stride = c.stride; 10214 GLsizei stride = c.stride;
10091 GLsizei offset = c.offset; 10215 GLsizei offset = c.offset;
10092 10216
10093 if (!state_.bound_array_buffer.get() || 10217 if (!state_.bound_array_buffer.get() ||
10094 state_.bound_array_buffer->IsDeleted()) { 10218 state_.bound_array_buffer->IsDeleted()) {
10095 if (state_.vertex_attrib_manager.get() == 10219 if (state_.vertex_attrib_manager.get() ==
10096 state_.default_vertex_attrib_manager.get()) { 10220 state_.default_vertex_attrib_manager.get()) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
10166 stride, 10290 stride,
10167 stride != 0 ? stride : group_size, 10291 stride != 0 ? stride : group_size,
10168 offset, 10292 offset,
10169 GL_TRUE); 10293 GL_TRUE);
10170 glVertexAttribIPointer(indx, size, type, stride, ptr); 10294 glVertexAttribIPointer(indx, size, type, stride, ptr);
10171 return error::kNoError; 10295 return error::kNoError;
10172 } 10296 }
10173 10297
10174 error::Error GLES2DecoderImpl::HandleVertexAttribPointer( 10298 error::Error GLES2DecoderImpl::HandleVertexAttribPointer(
10175 uint32_t immediate_data_size, 10299 uint32_t immediate_data_size,
10176 const void* cmd_data) { 10300 const volatile void* cmd_data) {
10177 const gles2::cmds::VertexAttribPointer& c = 10301 const volatile gles2::cmds::VertexAttribPointer& c =
10178 *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); 10302 *static_cast<const volatile gles2::cmds::VertexAttribPointer*>(cmd_data);
10179 GLuint indx = c.indx; 10303 GLuint indx = c.indx;
10180 GLint size = c.size; 10304 GLint size = c.size;
10181 GLenum type = c.type; 10305 GLenum type = c.type;
10182 GLboolean normalized = static_cast<GLboolean>(c.normalized); 10306 GLboolean normalized = static_cast<GLboolean>(c.normalized);
10183 GLsizei stride = c.stride; 10307 GLsizei stride = c.stride;
10184 GLsizei offset = c.offset; 10308 GLsizei offset = c.offset;
10185 10309
10186 if (!state_.bound_array_buffer.get() || 10310 if (!state_.bound_array_buffer.get() ||
10187 state_.bound_array_buffer->IsDeleted()) { 10311 state_.bound_array_buffer->IsDeleted()) {
10188 if (state_.vertex_attrib_manager.get() == 10312 if (state_.vertex_attrib_manager.get() ==
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
10274 GLsizei height) { 10398 GLsizei height) {
10275 state_.viewport_x = x; 10399 state_.viewport_x = x;
10276 state_.viewport_y = y; 10400 state_.viewport_y = y;
10277 state_.viewport_width = std::min(width, viewport_max_width_); 10401 state_.viewport_width = std::min(width, viewport_max_width_);
10278 state_.viewport_height = std::min(height, viewport_max_height_); 10402 state_.viewport_height = std::min(height, viewport_max_height_);
10279 glViewport(x, y, width, height); 10403 glViewport(x, y, width, height);
10280 } 10404 }
10281 10405
10282 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( 10406 error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE(
10283 uint32_t immediate_data_size, 10407 uint32_t immediate_data_size,
10284 const void* cmd_data) { 10408 const volatile void* cmd_data) {
10285 const gles2::cmds::VertexAttribDivisorANGLE& c = 10409 const volatile gles2::cmds::VertexAttribDivisorANGLE& c =
10286 *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); 10410 *static_cast<const volatile gles2::cmds::VertexAttribDivisorANGLE*>(
10411 cmd_data);
10287 if (!features().angle_instanced_arrays) 10412 if (!features().angle_instanced_arrays)
10288 return error::kUnknownCommand; 10413 return error::kUnknownCommand;
10289 10414
10290 GLuint index = c.index; 10415 GLuint index = c.index;
10291 GLuint divisor = c.divisor; 10416 GLuint divisor = c.divisor;
10292 if (index >= group_->max_vertex_attribs()) { 10417 if (index >= group_->max_vertex_attribs()) {
10293 LOCAL_SET_GL_ERROR( 10418 LOCAL_SET_GL_ERROR(
10294 GL_INVALID_VALUE, 10419 GL_INVALID_VALUE,
10295 "glVertexAttribDivisorANGLE", "index out of range"); 10420 "glVertexAttribDivisorANGLE", "index out of range");
10296 return error::kNoError; 10421 return error::kNoError;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
10432 case GL_HALF_FLOAT: 10557 case GL_HALF_FLOAT:
10433 WriteAlphaData<uint16_t>(pixels, height, channel_count, alpha_channel, 10558 WriteAlphaData<uint16_t>(pixels, height, channel_count, alpha_channel,
10434 unpadded_row_size, padded_row_size, 0x3C00); 10559 unpadded_row_size, padded_row_size, 0x3C00);
10435 break; 10560 break;
10436 } 10561 }
10437 } 10562 }
10438 } 10563 }
10439 } 10564 }
10440 10565
10441 error::Error GLES2DecoderImpl::HandleReadPixels(uint32_t immediate_data_size, 10566 error::Error GLES2DecoderImpl::HandleReadPixels(uint32_t immediate_data_size,
10442 const void* cmd_data) { 10567 const volatile void* cmd_data) {
10443 const gles2::cmds::ReadPixels& c = 10568 const volatile gles2::cmds::ReadPixels& c =
10444 *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); 10569 *static_cast<const volatile gles2::cmds::ReadPixels*>(cmd_data);
10445 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels"); 10570 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandleReadPixels");
10446 error::Error fbo_error = WillAccessBoundFramebufferForRead(); 10571 error::Error fbo_error = WillAccessBoundFramebufferForRead();
10447 if (fbo_error != error::kNoError) 10572 if (fbo_error != error::kNoError)
10448 return fbo_error; 10573 return fbo_error;
10449 GLint x = c.x; 10574 GLint x = c.x;
10450 GLint y = c.y; 10575 GLint y = c.y;
10451 GLsizei width = c.width; 10576 GLsizei width = c.width;
10452 GLsizei height = c.height; 10577 GLsizei height = c.height;
10453 GLenum format = c.format; 10578 GLenum format = c.format;
10454 GLenum type = c.type; 10579 GLenum type = c.type;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
10772 } 10897 }
10773 FinishReadPixels(width, height, format, type, pixels_shm_id, 10898 FinishReadPixels(width, height, format, type, pixels_shm_id,
10774 pixels_shm_offset, result_shm_id, result_shm_offset, 10899 pixels_shm_offset, result_shm_id, result_shm_offset,
10775 state_.pack_alignment, read_format, 0); 10900 state_.pack_alignment, read_format, 0);
10776 } 10901 }
10777 } 10902 }
10778 10903
10779 return error::kNoError; 10904 return error::kNoError;
10780 } 10905 }
10781 10906
10782 error::Error GLES2DecoderImpl::HandlePixelStorei(uint32_t immediate_data_size, 10907 error::Error GLES2DecoderImpl::HandlePixelStorei(
10783 const void* cmd_data) { 10908 uint32_t immediate_data_size,
10784 const gles2::cmds::PixelStorei& c = 10909 const volatile void* cmd_data) {
10785 *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); 10910 const volatile gles2::cmds::PixelStorei& c =
10911 *static_cast<const volatile gles2::cmds::PixelStorei*>(cmd_data);
10786 GLenum pname = c.pname; 10912 GLenum pname = c.pname;
10787 GLint param = c.param; 10913 GLint param = c.param;
10788 if (!validators_->pixel_store.IsValid(pname)) { 10914 if (!validators_->pixel_store.IsValid(pname)) {
10789 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname"); 10915 LOCAL_SET_GL_ERROR_INVALID_ENUM("glPixelStorei", pname, "pname");
10790 return error::kNoError; 10916 return error::kNoError;
10791 } 10917 }
10792 switch (pname) { 10918 switch (pname) {
10793 case GL_PACK_ALIGNMENT: 10919 case GL_PACK_ALIGNMENT:
10794 case GL_UNPACK_ALIGNMENT: 10920 case GL_UNPACK_ALIGNMENT:
10795 if (!validators_->pixel_store_alignment.IsValid(param)) { 10921 if (!validators_->pixel_store_alignment.IsValid(param)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
10855 default: 10981 default:
10856 // Validation should have prevented us from getting here. 10982 // Validation should have prevented us from getting here.
10857 NOTREACHED(); 10983 NOTREACHED();
10858 break; 10984 break;
10859 } 10985 }
10860 return error::kNoError; 10986 return error::kNoError;
10861 } 10987 }
10862 10988
10863 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( 10989 error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
10864 uint32_t immediate_data_size, 10990 uint32_t immediate_data_size,
10865 const void* cmd_data) { 10991 const volatile void* cmd_data) {
10866 const gles2::cmds::PostSubBufferCHROMIUM& c = 10992 const volatile gles2::cmds::PostSubBufferCHROMIUM& c =
10867 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); 10993 *static_cast<const volatile gles2::cmds::PostSubBufferCHROMIUM*>(
10994 cmd_data);
10868 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM"); 10995 TRACE_EVENT0("gpu", "GLES2DecoderImpl::HandlePostSubBufferCHROMIUM");
10869 { 10996 {
10870 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); 10997 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame");
10871 } 10998 }
10872 if (!supports_post_sub_buffer_) { 10999 if (!supports_post_sub_buffer_) {
10873 LOCAL_SET_GL_ERROR( 11000 LOCAL_SET_GL_ERROR(
10874 GL_INVALID_OPERATION, 11001 GL_INVALID_OPERATION,
10875 "glPostSubBufferCHROMIUM", "command not supported by surface"); 11002 "glPostSubBufferCHROMIUM", "command not supported by surface");
10876 return error::kNoError; 11003 return error::kNoError;
10877 } 11004 }
(...skipping 17 matching lines...) Expand all
10895 base::AsWeakPtr(this))); 11022 base::AsWeakPtr(this)));
10896 } else { 11023 } else {
10897 FinishSwapBuffers(surface_->PostSubBuffer(c.x, c.y, c.width, c.height)); 11024 FinishSwapBuffers(surface_->PostSubBuffer(c.x, c.y, c.width, c.height));
10898 } 11025 }
10899 11026
10900 return error::kNoError; 11027 return error::kNoError;
10901 } 11028 }
10902 11029
10903 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM( 11030 error::Error GLES2DecoderImpl::HandleScheduleOverlayPlaneCHROMIUM(
10904 uint32_t immediate_data_size, 11031 uint32_t immediate_data_size,
10905 const void* cmd_data) { 11032 const volatile void* cmd_data) {
10906 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = 11033 const volatile gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c =
10907 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); 11034 *static_cast<const volatile gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(
11035 cmd_data);
10908 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id); 11036 TextureRef* ref = texture_manager()->GetTexture(c.overlay_texture_id);
10909 if (!ref) { 11037 if (!ref) {
10910 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, 11038 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
10911 "glScheduleOverlayPlaneCHROMIUM", 11039 "glScheduleOverlayPlaneCHROMIUM",
10912 "unknown texture"); 11040 "unknown texture");
10913 return error::kNoError; 11041 return error::kNoError;
10914 } 11042 }
10915 Texture::ImageState image_state; 11043 Texture::ImageState image_state;
10916 gl::GLImage* image = 11044 gl::GLImage* image =
10917 ref->texture()->GetLevelImage(ref->texture()->target(), 0, &image_state); 11045 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))) { 11064 gfx::RectF(c.uv_x, c.uv_y, c.uv_width, c.uv_height))) {
10937 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 11065 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
10938 "glScheduleOverlayPlaneCHROMIUM", 11066 "glScheduleOverlayPlaneCHROMIUM",
10939 "failed to schedule overlay"); 11067 "failed to schedule overlay");
10940 } 11068 }
10941 return error::kNoError; 11069 return error::kNoError;
10942 } 11070 }
10943 11071
10944 error::Error GLES2DecoderImpl::HandleScheduleCALayerSharedStateCHROMIUM( 11072 error::Error GLES2DecoderImpl::HandleScheduleCALayerSharedStateCHROMIUM(
10945 uint32_t immediate_data_size, 11073 uint32_t immediate_data_size,
10946 const void* cmd_data) { 11074 const volatile void* cmd_data) {
10947 const gles2::cmds::ScheduleCALayerSharedStateCHROMIUM& c = 11075 const volatile gles2::cmds::ScheduleCALayerSharedStateCHROMIUM& c =
10948 *static_cast<const gles2::cmds::ScheduleCALayerSharedStateCHROMIUM*>( 11076 *static_cast<
11077 const volatile gles2::cmds::ScheduleCALayerSharedStateCHROMIUM*>(
10949 cmd_data); 11078 cmd_data);
10950 11079
10951 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset, 11080 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset,
10952 20 * sizeof(GLfloat)); 11081 20 * sizeof(GLfloat));
10953 if (!mem) { 11082 if (!mem) {
10954 return error::kOutOfBounds; 11083 return error::kOutOfBounds;
10955 } 11084 }
10956 gfx::RectF clip_rect(mem[0], mem[1], mem[2], mem[3]); 11085 gfx::RectF clip_rect(mem[0], mem[1], mem[2], mem[3]);
10957 gfx::Transform transform(mem[4], mem[8], mem[12], mem[16], 11086 gfx::Transform transform(mem[4], mem[8], mem[12], mem[16],
10958 mem[5], mem[9], mem[13], mem[17], 11087 mem[5], mem[9], mem[13], mem[17],
10959 mem[6], mem[10], mem[14], mem[18], 11088 mem[6], mem[10], mem[14], mem[18],
10960 mem[7], mem[11], mem[15], mem[19]); 11089 mem[7], mem[11], mem[15], mem[19]);
10961 ca_layer_shared_state_.reset(new CALayerSharedState); 11090 ca_layer_shared_state_.reset(new CALayerSharedState);
10962 ca_layer_shared_state_->opacity = c.opacity; 11091 ca_layer_shared_state_->opacity = c.opacity;
10963 ca_layer_shared_state_->is_clipped = c.is_clipped ? true : false; 11092 ca_layer_shared_state_->is_clipped = c.is_clipped ? true : false;
10964 ca_layer_shared_state_->clip_rect = gfx::ToEnclosingRect(clip_rect); 11093 ca_layer_shared_state_->clip_rect = gfx::ToEnclosingRect(clip_rect);
10965 ca_layer_shared_state_->sorting_context_id = c.sorting_context_id; 11094 ca_layer_shared_state_->sorting_context_id = c.sorting_context_id;
10966 ca_layer_shared_state_->transform = transform; 11095 ca_layer_shared_state_->transform = transform;
10967 return error::kNoError; 11096 return error::kNoError;
10968 } 11097 }
10969 11098
10970 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM( 11099 error::Error GLES2DecoderImpl::HandleScheduleCALayerCHROMIUM(
10971 uint32_t immediate_data_size, 11100 uint32_t immediate_data_size,
10972 const void* cmd_data) { 11101 const volatile void* cmd_data) {
10973 const gles2::cmds::ScheduleCALayerCHROMIUM& c = 11102 const volatile gles2::cmds::ScheduleCALayerCHROMIUM& c =
10974 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); 11103 *static_cast<const volatile gles2::cmds::ScheduleCALayerCHROMIUM*>(
11104 cmd_data);
10975 GLuint filter = c.filter; 11105 GLuint filter = c.filter;
10976 if (filter != GL_NEAREST && filter != GL_LINEAR) { 11106 if (filter != GL_NEAREST && filter != GL_LINEAR) {
10977 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM", 11107 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glScheduleCALayerCHROMIUM",
10978 "invalid filter"); 11108 "invalid filter");
10979 return error::kNoError; 11109 return error::kNoError;
10980 } 11110 }
10981 11111
10982 if (!ca_layer_shared_state_) { 11112 if (!ca_layer_shared_state_) {
10983 LOCAL_SET_GL_ERROR( 11113 LOCAL_SET_GL_ERROR(
10984 GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", 11114 GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
11021 ca_layer_shared_state_->opacity, filter); 11151 ca_layer_shared_state_->opacity, filter);
11022 if (!surface_->ScheduleCALayer(params)) { 11152 if (!surface_->ScheduleCALayer(params)) {
11023 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM", 11153 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glScheduleCALayerCHROMIUM",
11024 "failed to schedule CALayer"); 11154 "failed to schedule CALayer");
11025 } 11155 }
11026 return error::kNoError; 11156 return error::kNoError;
11027 } 11157 }
11028 11158
11029 void GLES2DecoderImpl::DoScheduleCALayerInUseQueryCHROMIUM( 11159 void GLES2DecoderImpl::DoScheduleCALayerInUseQueryCHROMIUM(
11030 GLsizei count, 11160 GLsizei count,
11031 const GLuint* textures) { 11161 const volatile GLuint* textures) {
11032 std::vector<gl::GLSurface::CALayerInUseQuery> queries; 11162 std::vector<gl::GLSurface::CALayerInUseQuery> queries;
11033 queries.reserve(count); 11163 queries.reserve(count);
11034 for (GLsizei i = 0; i < count; ++i) { 11164 for (GLsizei i = 0; i < count; ++i) {
11035 gl::GLImage* image = nullptr; 11165 gl::GLImage* image = nullptr;
11036 GLuint texture_id = textures[i]; 11166 GLuint texture_id = textures[i];
11037 if (texture_id) { 11167 if (texture_id) {
11038 TextureRef* ref = texture_manager()->GetTexture(texture_id); 11168 TextureRef* ref = texture_manager()->GetTexture(texture_id);
11039 if (!ref) { 11169 if (!ref) {
11040 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, 11170 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE,
11041 "glScheduleCALayerInUseQueryCHROMIUM", 11171 "glScheduleCALayerInUseQueryCHROMIUM",
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
11083 // Check that the client initialized the result. 11213 // Check that the client initialized the result.
11084 if (*location != -1) { 11214 if (*location != -1) {
11085 return error::kInvalidArguments; 11215 return error::kInvalidArguments;
11086 } 11216 }
11087 *location = program->GetAttribLocation(name_str); 11217 *location = program->GetAttribLocation(name_str);
11088 return error::kNoError; 11218 return error::kNoError;
11089 } 11219 }
11090 11220
11091 error::Error GLES2DecoderImpl::HandleGetAttribLocation( 11221 error::Error GLES2DecoderImpl::HandleGetAttribLocation(
11092 uint32_t immediate_data_size, 11222 uint32_t immediate_data_size,
11093 const void* cmd_data) { 11223 const volatile void* cmd_data) {
11094 const gles2::cmds::GetAttribLocation& c = 11224 const volatile gles2::cmds::GetAttribLocation& c =
11095 *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); 11225 *static_cast<const volatile gles2::cmds::GetAttribLocation*>(cmd_data);
11096 Bucket* bucket = GetBucket(c.name_bucket_id); 11226 Bucket* bucket = GetBucket(c.name_bucket_id);
11097 if (!bucket) { 11227 if (!bucket) {
11098 return error::kInvalidArguments; 11228 return error::kInvalidArguments;
11099 } 11229 }
11100 std::string name_str; 11230 std::string name_str;
11101 if (!bucket->GetAsString(&name_str)) { 11231 if (!bucket->GetAsString(&name_str)) {
11102 return error::kInvalidArguments; 11232 return error::kInvalidArguments;
11103 } 11233 }
11104 return GetAttribLocationHelper( 11234 return GetAttribLocationHelper(
11105 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11235 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. 11263 // Check that the client initialized the result.
11134 if (*location != -1) { 11264 if (*location != -1) {
11135 return error::kInvalidArguments; 11265 return error::kInvalidArguments;
11136 } 11266 }
11137 *location = program->GetUniformFakeLocation(name_str); 11267 *location = program->GetUniformFakeLocation(name_str);
11138 return error::kNoError; 11268 return error::kNoError;
11139 } 11269 }
11140 11270
11141 error::Error GLES2DecoderImpl::HandleGetUniformLocation( 11271 error::Error GLES2DecoderImpl::HandleGetUniformLocation(
11142 uint32_t immediate_data_size, 11272 uint32_t immediate_data_size,
11143 const void* cmd_data) { 11273 const volatile void* cmd_data) {
11144 const gles2::cmds::GetUniformLocation& c = 11274 const volatile gles2::cmds::GetUniformLocation& c =
11145 *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); 11275 *static_cast<const volatile gles2::cmds::GetUniformLocation*>(cmd_data);
11146 Bucket* bucket = GetBucket(c.name_bucket_id); 11276 Bucket* bucket = GetBucket(c.name_bucket_id);
11147 if (!bucket) { 11277 if (!bucket) {
11148 return error::kInvalidArguments; 11278 return error::kInvalidArguments;
11149 } 11279 }
11150 std::string name_str; 11280 std::string name_str;
11151 if (!bucket->GetAsString(&name_str)) { 11281 if (!bucket->GetAsString(&name_str)) {
11152 return error::kInvalidArguments; 11282 return error::kInvalidArguments;
11153 } 11283 }
11154 return GetUniformLocationHelper( 11284 return GetUniformLocationHelper(
11155 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11285 c.program, c.location_shm_id, c.location_shm_offset, name_str);
11156 } 11286 }
11157 11287
11158 error::Error GLES2DecoderImpl::HandleGetUniformIndices( 11288 error::Error GLES2DecoderImpl::HandleGetUniformIndices(
11159 uint32_t immediate_data_size, 11289 uint32_t immediate_data_size,
11160 const void* cmd_data) { 11290 const volatile void* cmd_data) {
11161 if (!unsafe_es3_apis_enabled()) 11291 if (!unsafe_es3_apis_enabled())
11162 return error::kUnknownCommand; 11292 return error::kUnknownCommand;
11163 const gles2::cmds::GetUniformIndices& c = 11293 const volatile gles2::cmds::GetUniformIndices& c =
11164 *static_cast<const gles2::cmds::GetUniformIndices*>(cmd_data); 11294 *static_cast<const volatile gles2::cmds::GetUniformIndices*>(cmd_data);
11165 Bucket* bucket = GetBucket(c.names_bucket_id); 11295 Bucket* bucket = GetBucket(c.names_bucket_id);
11166 if (!bucket) { 11296 if (!bucket) {
11167 return error::kInvalidArguments; 11297 return error::kInvalidArguments;
11168 } 11298 }
11169 GLsizei count = 0; 11299 GLsizei count = 0;
11170 std::vector<char*> names; 11300 std::vector<char*> names;
11171 std::vector<GLint> len; 11301 std::vector<GLint> len;
11172 if (!bucket->GetAsStrings(&count, &names, &len) || count <= 0) { 11302 if (!bucket->GetAsStrings(&count, &names, &len) || count <= 0) {
11173 return error::kInvalidArguments; 11303 return error::kInvalidArguments;
11174 } 11304 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
11231 "program not linked"); 11361 "program not linked");
11232 return error::kNoError; 11362 return error::kNoError;
11233 } 11363 }
11234 11364
11235 *location = program->GetFragDataLocation(name_str); 11365 *location = program->GetFragDataLocation(name_str);
11236 return error::kNoError; 11366 return error::kNoError;
11237 } 11367 }
11238 11368
11239 error::Error GLES2DecoderImpl::HandleGetFragDataLocation( 11369 error::Error GLES2DecoderImpl::HandleGetFragDataLocation(
11240 uint32_t immediate_data_size, 11370 uint32_t immediate_data_size,
11241 const void* cmd_data) { 11371 const volatile void* cmd_data) {
11242 if (!unsafe_es3_apis_enabled()) 11372 if (!unsafe_es3_apis_enabled())
11243 return error::kUnknownCommand; 11373 return error::kUnknownCommand;
11244 const gles2::cmds::GetFragDataLocation& c = 11374 const volatile gles2::cmds::GetFragDataLocation& c =
11245 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); 11375 *static_cast<const volatile gles2::cmds::GetFragDataLocation*>(cmd_data);
11246 Bucket* bucket = GetBucket(c.name_bucket_id); 11376 Bucket* bucket = GetBucket(c.name_bucket_id);
11247 if (!bucket) { 11377 if (!bucket) {
11248 return error::kInvalidArguments; 11378 return error::kInvalidArguments;
11249 } 11379 }
11250 std::string name_str; 11380 std::string name_str;
11251 if (!bucket->GetAsString(&name_str)) { 11381 if (!bucket->GetAsString(&name_str)) {
11252 return error::kInvalidArguments; 11382 return error::kInvalidArguments;
11253 } 11383 }
11254 return GetFragDataLocationHelper( 11384 return GetFragDataLocationHelper(
11255 c.program, c.location_shm_id, c.location_shm_offset, name_str); 11385 c.program, c.location_shm_id, c.location_shm_offset, name_str);
(...skipping 23 matching lines...) Expand all
11279 "program not linked"); 11409 "program not linked");
11280 return error::kNoError; 11410 return error::kNoError;
11281 } 11411 }
11282 11412
11283 *index = program->GetFragDataIndex(name_str); 11413 *index = program->GetFragDataIndex(name_str);
11284 return error::kNoError; 11414 return error::kNoError;
11285 } 11415 }
11286 11416
11287 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT( 11417 error::Error GLES2DecoderImpl::HandleGetFragDataIndexEXT(
11288 uint32_t immediate_data_size, 11418 uint32_t immediate_data_size,
11289 const void* cmd_data) { 11419 const volatile void* cmd_data) {
11290 if (!features().ext_blend_func_extended) { 11420 if (!features().ext_blend_func_extended) {
11291 return error::kUnknownCommand; 11421 return error::kUnknownCommand;
11292 } 11422 }
11293 const gles2::cmds::GetFragDataIndexEXT& c = 11423 const volatile gles2::cmds::GetFragDataIndexEXT& c =
11294 *static_cast<const gles2::cmds::GetFragDataIndexEXT*>(cmd_data); 11424 *static_cast<const volatile gles2::cmds::GetFragDataIndexEXT*>(cmd_data);
11295 Bucket* bucket = GetBucket(c.name_bucket_id); 11425 Bucket* bucket = GetBucket(c.name_bucket_id);
11296 if (!bucket) { 11426 if (!bucket) {
11297 return error::kInvalidArguments; 11427 return error::kInvalidArguments;
11298 } 11428 }
11299 std::string name_str; 11429 std::string name_str;
11300 if (!bucket->GetAsString(&name_str)) { 11430 if (!bucket->GetAsString(&name_str)) {
11301 return error::kInvalidArguments; 11431 return error::kInvalidArguments;
11302 } 11432 }
11303 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset, 11433 return GetFragDataIndexHelper(c.program, c.index_shm_id, c.index_shm_offset,
11304 name_str); 11434 name_str);
11305 } 11435 }
11306 11436
11307 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex( 11437 error::Error GLES2DecoderImpl::HandleGetUniformBlockIndex(
11308 uint32_t immediate_data_size, 11438 uint32_t immediate_data_size,
11309 const void* cmd_data) { 11439 const volatile void* cmd_data) {
11310 if (!unsafe_es3_apis_enabled()) 11440 if (!unsafe_es3_apis_enabled())
11311 return error::kUnknownCommand; 11441 return error::kUnknownCommand;
11312 const gles2::cmds::GetUniformBlockIndex& c = 11442 const volatile gles2::cmds::GetUniformBlockIndex& c =
11313 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); 11443 *static_cast<const volatile gles2::cmds::GetUniformBlockIndex*>(cmd_data);
11314 Bucket* bucket = GetBucket(c.name_bucket_id); 11444 Bucket* bucket = GetBucket(c.name_bucket_id);
11315 if (!bucket) { 11445 if (!bucket) {
11316 return error::kInvalidArguments; 11446 return error::kInvalidArguments;
11317 } 11447 }
11318 std::string name_str; 11448 std::string name_str;
11319 if (!bucket->GetAsString(&name_str)) { 11449 if (!bucket->GetAsString(&name_str)) {
11320 return error::kInvalidArguments; 11450 return error::kInvalidArguments;
11321 } 11451 }
11322 GLuint* index = GetSharedMemoryAs<GLuint*>( 11452 GLuint* index = GetSharedMemoryAs<GLuint*>(
11323 c.index_shm_id, c.index_shm_offset, sizeof(GLuint)); 11453 c.index_shm_id, c.index_shm_offset, sizeof(GLuint));
11324 if (!index) { 11454 if (!index) {
11325 return error::kOutOfBounds; 11455 return error::kOutOfBounds;
11326 } 11456 }
11327 // Check that the client initialized the result. 11457 // Check that the client initialized the result.
11328 if (*index != GL_INVALID_INDEX) { 11458 if (*index != GL_INVALID_INDEX) {
11329 return error::kInvalidArguments; 11459 return error::kInvalidArguments;
11330 } 11460 }
11331 Program* program = GetProgramInfoNotShader( 11461 Program* program = GetProgramInfoNotShader(
11332 c.program, "glGetUniformBlockIndex"); 11462 c.program, "glGetUniformBlockIndex");
11333 if (!program) { 11463 if (!program) {
11334 return error::kNoError; 11464 return error::kNoError;
11335 } 11465 }
11336 *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str()); 11466 *index = glGetUniformBlockIndex(program->service_id(), name_str.c_str());
11337 return error::kNoError; 11467 return error::kNoError;
11338 } 11468 }
11339 11469
11340 error::Error GLES2DecoderImpl::HandleGetString(uint32_t immediate_data_size, 11470 error::Error GLES2DecoderImpl::HandleGetString(uint32_t immediate_data_size,
11341 const void* cmd_data) { 11471 const volatile void* cmd_data) {
11342 const gles2::cmds::GetString& c = 11472 const volatile gles2::cmds::GetString& c =
11343 *static_cast<const gles2::cmds::GetString*>(cmd_data); 11473 *static_cast<const volatile gles2::cmds::GetString*>(cmd_data);
11344 GLenum name = static_cast<GLenum>(c.name); 11474 GLenum name = static_cast<GLenum>(c.name);
11345 if (!validators_->string_type.IsValid(name)) { 11475 if (!validators_->string_type.IsValid(name)) {
11346 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name"); 11476 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetString", name, "name");
11347 return error::kNoError; 11477 return error::kNoError;
11348 } 11478 }
11349 11479
11350 const char* str = nullptr; 11480 const char* str = nullptr;
11351 std::string extensions; 11481 std::string extensions;
11352 switch (name) { 11482 switch (name) {
11353 case GL_VERSION: 11483 case GL_VERSION:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
11417 default: 11547 default:
11418 str = reinterpret_cast<const char*>(glGetString(name)); 11548 str = reinterpret_cast<const char*>(glGetString(name));
11419 break; 11549 break;
11420 } 11550 }
11421 Bucket* bucket = CreateBucket(c.bucket_id); 11551 Bucket* bucket = CreateBucket(c.bucket_id);
11422 bucket->SetFromString(str); 11552 bucket->SetFromString(str);
11423 return error::kNoError; 11553 return error::kNoError;
11424 } 11554 }
11425 11555
11426 error::Error GLES2DecoderImpl::HandleBufferData(uint32_t immediate_data_size, 11556 error::Error GLES2DecoderImpl::HandleBufferData(uint32_t immediate_data_size,
11427 const void* cmd_data) { 11557 const volatile void* cmd_data) {
11428 const gles2::cmds::BufferData& c = 11558 const volatile gles2::cmds::BufferData& c =
11429 *static_cast<const gles2::cmds::BufferData*>(cmd_data); 11559 *static_cast<const volatile gles2::cmds::BufferData*>(cmd_data);
11430 GLenum target = static_cast<GLenum>(c.target); 11560 GLenum target = static_cast<GLenum>(c.target);
11431 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); 11561 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
11432 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); 11562 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); 11563 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset);
11434 GLenum usage = static_cast<GLenum>(c.usage); 11564 GLenum usage = static_cast<GLenum>(c.usage);
11435 const void* data = NULL; 11565 const void* data = NULL;
11436 if (data_shm_id != 0 || data_shm_offset != 0) { 11566 if (data_shm_id != 0 || data_shm_offset != 0) {
11437 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); 11567 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size);
11438 if (!data) { 11568 if (!data) {
11439 return error::kOutOfBounds; 11569 return error::kOutOfBounds;
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
12557 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, 12687 glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width,
12558 height, depth, format, image_size, data); 12688 height, depth, format, image_size, data);
12559 } 12689 }
12560 12690
12561 // This may be a slow command. Exit command processing to allow for 12691 // This may be a slow command. Exit command processing to allow for
12562 // context preemption and GPU watchdog checks. 12692 // context preemption and GPU watchdog checks.
12563 ExitCommandProcessingEarly(); 12693 ExitCommandProcessingEarly();
12564 } 12694 }
12565 12695
12566 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, 12696 error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size,
12567 const void* cmd_data) { 12697 const volatile void* cmd_data) {
12568 const gles2::cmds::TexImage2D& c = 12698 const volatile gles2::cmds::TexImage2D& c =
12569 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); 12699 *static_cast<const volatile gles2::cmds::TexImage2D*>(cmd_data);
12570 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D", 12700 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage2D",
12571 "width", c.width, "height", c.height); 12701 "width", c.width, "height", c.height);
12572 // Set as failed for now, but if it successed, this will be set to not failed. 12702 // Set as failed for now, but if it successed, this will be set to not failed.
12573 texture_state_.tex_image_failed = true; 12703 texture_state_.tex_image_failed = true;
12574 GLenum target = static_cast<GLenum>(c.target); 12704 GLenum target = static_cast<GLenum>(c.target);
12575 GLint level = static_cast<GLint>(c.level); 12705 GLint level = static_cast<GLint>(c.level);
12576 GLint internal_format = static_cast<GLint>(c.internalformat); 12706 GLint internal_format = static_cast<GLint>(c.internalformat);
12577 GLsizei width = static_cast<GLsizei>(c.width); 12707 GLsizei width = static_cast<GLsizei>(c.width);
12578 GLsizei height = static_cast<GLsizei>(c.height); 12708 GLsizei height = static_cast<GLsizei>(c.height);
12579 GLint border = static_cast<GLint>(c.border); 12709 GLint border = static_cast<GLint>(c.border);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
12643 texture_manager()->ValidateAndDoTexImage( 12773 texture_manager()->ValidateAndDoTexImage(
12644 &texture_state_, &state_, &framebuffer_state_, "glTexImage2D", args); 12774 &texture_state_, &state_, &framebuffer_state_, "glTexImage2D", args);
12645 12775
12646 // This may be a slow command. Exit command processing to allow for 12776 // This may be a slow command. Exit command processing to allow for
12647 // context preemption and GPU watchdog checks. 12777 // context preemption and GPU watchdog checks.
12648 ExitCommandProcessingEarly(); 12778 ExitCommandProcessingEarly();
12649 return error::kNoError; 12779 return error::kNoError;
12650 } 12780 }
12651 12781
12652 error::Error GLES2DecoderImpl::HandleTexImage3D(uint32_t immediate_data_size, 12782 error::Error GLES2DecoderImpl::HandleTexImage3D(uint32_t immediate_data_size,
12653 const void* cmd_data) { 12783 const volatile void* cmd_data) {
12654 if (!unsafe_es3_apis_enabled()) 12784 if (!unsafe_es3_apis_enabled())
12655 return error::kUnknownCommand; 12785 return error::kUnknownCommand;
12656 12786
12657 const gles2::cmds::TexImage3D& c = 12787 const volatile gles2::cmds::TexImage3D& c =
12658 *static_cast<const gles2::cmds::TexImage3D*>(cmd_data); 12788 *static_cast<const volatile gles2::cmds::TexImage3D*>(cmd_data);
12659 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D", 12789 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexImage3D",
12660 "widthXheight", c.width * c.height, "depth", c.depth); 12790 "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. 12791 // Set as failed for now, but if it successed, this will be set to not failed.
12662 texture_state_.tex_image_failed = true; 12792 texture_state_.tex_image_failed = true;
12663 GLenum target = static_cast<GLenum>(c.target); 12793 GLenum target = static_cast<GLenum>(c.target);
12664 GLint level = static_cast<GLint>(c.level); 12794 GLint level = static_cast<GLint>(c.level);
12665 GLint internal_format = static_cast<GLint>(c.internalformat); 12795 GLint internal_format = static_cast<GLint>(c.internalformat);
12666 GLsizei width = static_cast<GLsizei>(c.width); 12796 GLsizei width = static_cast<GLsizei>(c.width);
12667 GLsizei height = static_cast<GLsizei>(c.height); 12797 GLsizei height = static_cast<GLsizei>(c.height);
12668 GLsizei depth = static_cast<GLsizei>(c.depth); 12798 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, 13446 glCopyTexSubImage3D(target, level, destX, destY, zoffset,
13317 copyX, copyY, copyWidth, copyHeight); 13447 copyX, copyY, copyWidth, copyHeight);
13318 } 13448 }
13319 } 13449 }
13320 13450
13321 // This may be a slow command. Exit command processing to allow for 13451 // This may be a slow command. Exit command processing to allow for
13322 // context preemption and GPU watchdog checks. 13452 // context preemption and GPU watchdog checks.
13323 ExitCommandProcessingEarly(); 13453 ExitCommandProcessingEarly();
13324 } 13454 }
13325 13455
13326 error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, 13456 error::Error GLES2DecoderImpl::HandleTexSubImage2D(
13327 const void* cmd_data) { 13457 uint32_t immediate_data_size,
13328 const gles2::cmds::TexSubImage2D& c = 13458 const volatile void* cmd_data) {
13329 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); 13459 const volatile gles2::cmds::TexSubImage2D& c =
13460 *static_cast<const volatile gles2::cmds::TexSubImage2D*>(cmd_data);
13330 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D", 13461 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage2D",
13331 "width", c.width, "height", c.height); 13462 "width", c.width, "height", c.height);
13332 GLboolean internal = static_cast<GLboolean>(c.internal); 13463 GLboolean internal = static_cast<GLboolean>(c.internal);
13333 if (internal == GL_TRUE && texture_state_.tex_image_failed) 13464 if (internal == GL_TRUE && texture_state_.tex_image_failed)
13334 return error::kNoError; 13465 return error::kNoError;
13335 13466
13336 GLenum target = static_cast<GLenum>(c.target); 13467 GLenum target = static_cast<GLenum>(c.target);
13337 GLint level = static_cast<GLint>(c.level); 13468 GLint level = static_cast<GLint>(c.level);
13338 GLint xoffset = static_cast<GLint>(c.xoffset); 13469 GLint xoffset = static_cast<GLint>(c.xoffset);
13339 GLint yoffset = static_cast<GLint>(c.yoffset); 13470 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_, 13525 texture_manager()->ValidateAndDoTexSubImage(this, &texture_state_, &state_,
13395 &framebuffer_state_, 13526 &framebuffer_state_,
13396 "glTexSubImage2D", args); 13527 "glTexSubImage2D", args);
13397 13528
13398 // This may be a slow command. Exit command processing to allow for 13529 // This may be a slow command. Exit command processing to allow for
13399 // context preemption and GPU watchdog checks. 13530 // context preemption and GPU watchdog checks.
13400 ExitCommandProcessingEarly(); 13531 ExitCommandProcessingEarly();
13401 return error::kNoError; 13532 return error::kNoError;
13402 } 13533 }
13403 13534
13404 error::Error GLES2DecoderImpl::HandleTexSubImage3D(uint32_t immediate_data_size, 13535 error::Error GLES2DecoderImpl::HandleTexSubImage3D(
13405 const void* cmd_data) { 13536 uint32_t immediate_data_size,
13537 const volatile void* cmd_data) {
13406 if (!unsafe_es3_apis_enabled()) 13538 if (!unsafe_es3_apis_enabled())
13407 return error::kUnknownCommand; 13539 return error::kUnknownCommand;
13408 13540
13409 const gles2::cmds::TexSubImage3D& c = 13541 const volatile gles2::cmds::TexSubImage3D& c =
13410 *static_cast<const gles2::cmds::TexSubImage3D*>(cmd_data); 13542 *static_cast<const volatile gles2::cmds::TexSubImage3D*>(cmd_data);
13411 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D", 13543 TRACE_EVENT2("gpu", "GLES2DecoderImpl::HandleTexSubImage3D",
13412 "widthXheight", c.width * c.height, "depth", c.depth); 13544 "widthXheight", c.width * c.height, "depth", c.depth);
13413 GLboolean internal = static_cast<GLboolean>(c.internal); 13545 GLboolean internal = static_cast<GLboolean>(c.internal);
13414 if (internal == GL_TRUE && texture_state_.tex_image_failed) 13546 if (internal == GL_TRUE && texture_state_.tex_image_failed)
13415 return error::kNoError; 13547 return error::kNoError;
13416 13548
13417 GLenum target = static_cast<GLenum>(c.target); 13549 GLenum target = static_cast<GLenum>(c.target);
13418 GLint level = static_cast<GLint>(c.level); 13550 GLint level = static_cast<GLint>(c.level);
13419 GLint xoffset = static_cast<GLint>(c.xoffset); 13551 GLint xoffset = static_cast<GLint>(c.xoffset);
13420 GLint yoffset = static_cast<GLint>(c.yoffset); 13552 GLint yoffset = static_cast<GLint>(c.yoffset);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
13479 "glTexSubImage3D", args); 13611 "glTexSubImage3D", args);
13480 13612
13481 // This may be a slow command. Exit command processing to allow for 13613 // This may be a slow command. Exit command processing to allow for
13482 // context preemption and GPU watchdog checks. 13614 // context preemption and GPU watchdog checks.
13483 ExitCommandProcessingEarly(); 13615 ExitCommandProcessingEarly();
13484 return error::kNoError; 13616 return error::kNoError;
13485 } 13617 }
13486 13618
13487 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv( 13619 error::Error GLES2DecoderImpl::HandleGetVertexAttribPointerv(
13488 uint32_t immediate_data_size, 13620 uint32_t immediate_data_size,
13489 const void* cmd_data) { 13621 const volatile void* cmd_data) {
13490 const gles2::cmds::GetVertexAttribPointerv& c = 13622 const volatile gles2::cmds::GetVertexAttribPointerv& c =
13491 *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); 13623 *static_cast<const volatile gles2::cmds::GetVertexAttribPointerv*>(
13624 cmd_data);
13492 GLuint index = static_cast<GLuint>(c.index); 13625 GLuint index = static_cast<GLuint>(c.index);
13493 GLenum pname = static_cast<GLenum>(c.pname); 13626 GLenum pname = static_cast<GLenum>(c.pname);
13494 typedef cmds::GetVertexAttribPointerv::Result Result; 13627 typedef cmds::GetVertexAttribPointerv::Result Result;
13495 Result* result = GetSharedMemoryAs<Result*>( 13628 Result* result = GetSharedMemoryAs<Result*>(
13496 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1)); 13629 c.pointer_shm_id, c.pointer_shm_offset, Result::ComputeSize(1));
13497 if (!result) { 13630 if (!result) {
13498 return error::kOutOfBounds; 13631 return error::kOutOfBounds;
13499 } 13632 }
13500 // Check that the client initialized the result. 13633 // Check that the client initialized the result.
13501 if (result->size != 0) { 13634 if (result->size != 0) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
13578 if (!result) { 13711 if (!result) {
13579 *error = error::kOutOfBounds; 13712 *error = error::kOutOfBounds;
13580 return false; 13713 return false;
13581 } 13714 }
13582 result->SetNumResults(num_elements); 13715 result->SetNumResults(num_elements);
13583 *result_size = num_elements * sizeof(T); 13716 *result_size = num_elements * sizeof(T);
13584 *result_type = type; 13717 *result_type = type;
13585 return true; 13718 return true;
13586 } 13719 }
13587 13720
13588 error::Error GLES2DecoderImpl::HandleGetUniformiv(uint32_t immediate_data_size, 13721 error::Error GLES2DecoderImpl::HandleGetUniformiv(
13589 const void* cmd_data) { 13722 uint32_t immediate_data_size,
13590 const gles2::cmds::GetUniformiv& c = 13723 const volatile void* cmd_data) {
13591 *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); 13724 const volatile gles2::cmds::GetUniformiv& c =
13725 *static_cast<const volatile gles2::cmds::GetUniformiv*>(cmd_data);
13592 GLuint program = c.program; 13726 GLuint program = c.program;
13593 GLint fake_location = c.location; 13727 GLint fake_location = c.location;
13594 GLuint service_id; 13728 GLuint service_id;
13595 GLenum result_type; 13729 GLenum result_type;
13596 GLsizei result_size; 13730 GLsizei result_size;
13597 GLint real_location = -1; 13731 GLint real_location = -1;
13598 Error error; 13732 Error error;
13599 cmds::GetUniformiv::Result* result; 13733 cmds::GetUniformiv::Result* result;
13600 if (GetUniformSetup<GLint>(program, fake_location, c.params_shm_id, 13734 if (GetUniformSetup<GLint>(program, fake_location, c.params_shm_id,
13601 c.params_shm_offset, &error, &real_location, 13735 c.params_shm_offset, &error, &real_location,
13602 &service_id, &result, &result_type, 13736 &service_id, &result, &result_type,
13603 &result_size)) { 13737 &result_size)) {
13604 glGetUniformiv( 13738 glGetUniformiv(
13605 service_id, real_location, result->GetData()); 13739 service_id, real_location, result->GetData());
13606 } 13740 }
13607 return error; 13741 return error;
13608 } 13742 }
13609 13743
13610 error::Error GLES2DecoderImpl::HandleGetUniformuiv(uint32_t immediate_data_size, 13744 error::Error GLES2DecoderImpl::HandleGetUniformuiv(
13611 const void* cmd_data) { 13745 uint32_t immediate_data_size,
13746 const volatile void* cmd_data) {
13612 if (!unsafe_es3_apis_enabled()) 13747 if (!unsafe_es3_apis_enabled())
13613 return error::kUnknownCommand; 13748 return error::kUnknownCommand;
13614 13749
13615 const gles2::cmds::GetUniformuiv& c = 13750 const volatile gles2::cmds::GetUniformuiv& c =
13616 *static_cast<const gles2::cmds::GetUniformuiv*>(cmd_data); 13751 *static_cast<const volatile gles2::cmds::GetUniformuiv*>(cmd_data);
13617 GLuint program = c.program; 13752 GLuint program = c.program;
13618 GLint fake_location = c.location; 13753 GLint fake_location = c.location;
13619 GLuint service_id; 13754 GLuint service_id;
13620 GLenum result_type; 13755 GLenum result_type;
13621 GLsizei result_size; 13756 GLsizei result_size;
13622 GLint real_location = -1; 13757 GLint real_location = -1;
13623 Error error; 13758 Error error;
13624 cmds::GetUniformuiv::Result* result; 13759 cmds::GetUniformuiv::Result* result;
13625 if (GetUniformSetup<GLuint>(program, fake_location, c.params_shm_id, 13760 if (GetUniformSetup<GLuint>(program, fake_location, c.params_shm_id,
13626 c.params_shm_offset, &error, &real_location, 13761 c.params_shm_offset, &error, &real_location,
13627 &service_id, &result, &result_type, 13762 &service_id, &result, &result_type,
13628 &result_size)) { 13763 &result_size)) {
13629 glGetUniformuiv( 13764 glGetUniformuiv(
13630 service_id, real_location, result->GetData()); 13765 service_id, real_location, result->GetData());
13631 } 13766 }
13632 return error; 13767 return error;
13633 } 13768 }
13634 13769
13635 error::Error GLES2DecoderImpl::HandleGetUniformfv(uint32_t immediate_data_size, 13770 error::Error GLES2DecoderImpl::HandleGetUniformfv(
13636 const void* cmd_data) { 13771 uint32_t immediate_data_size,
13637 const gles2::cmds::GetUniformfv& c = 13772 const volatile void* cmd_data) {
13638 *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); 13773 const volatile gles2::cmds::GetUniformfv& c =
13774 *static_cast<const volatile gles2::cmds::GetUniformfv*>(cmd_data);
13639 GLuint program = c.program; 13775 GLuint program = c.program;
13640 GLint fake_location = c.location; 13776 GLint fake_location = c.location;
13641 GLuint service_id; 13777 GLuint service_id;
13642 GLint real_location = -1; 13778 GLint real_location = -1;
13643 Error error; 13779 Error error;
13644 cmds::GetUniformfv::Result* result; 13780 cmds::GetUniformfv::Result* result;
13645 GLenum result_type; 13781 GLenum result_type;
13646 GLsizei result_size; 13782 GLsizei result_size;
13647 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id, 13783 if (GetUniformSetup<GLfloat>(program, fake_location, c.params_shm_id,
13648 c.params_shm_offset, &error, &real_location, 13784 c.params_shm_offset, &error, &real_location,
(...skipping 10 matching lines...) Expand all
13659 } 13795 }
13660 } else { 13796 } else {
13661 glGetUniformfv(service_id, real_location, result->GetData()); 13797 glGetUniformfv(service_id, real_location, result->GetData());
13662 } 13798 }
13663 } 13799 }
13664 return error; 13800 return error;
13665 } 13801 }
13666 13802
13667 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( 13803 error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat(
13668 uint32_t immediate_data_size, 13804 uint32_t immediate_data_size,
13669 const void* cmd_data) { 13805 const volatile void* cmd_data) {
13670 const gles2::cmds::GetShaderPrecisionFormat& c = 13806 const volatile gles2::cmds::GetShaderPrecisionFormat& c =
13671 *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); 13807 *static_cast<const volatile gles2::cmds::GetShaderPrecisionFormat*>(
13808 cmd_data);
13672 GLenum shader_type = static_cast<GLenum>(c.shadertype); 13809 GLenum shader_type = static_cast<GLenum>(c.shadertype);
13673 GLenum precision_type = static_cast<GLenum>(c.precisiontype); 13810 GLenum precision_type = static_cast<GLenum>(c.precisiontype);
13674 typedef cmds::GetShaderPrecisionFormat::Result Result; 13811 typedef cmds::GetShaderPrecisionFormat::Result Result;
13675 Result* result = GetSharedMemoryAs<Result*>( 13812 Result* result = GetSharedMemoryAs<Result*>(
13676 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 13813 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13677 if (!result) { 13814 if (!result) {
13678 return error::kOutOfBounds; 13815 return error::kOutOfBounds;
13679 } 13816 }
13680 // Check that the client initialized the result. 13817 // Check that the client initialized the result.
13681 if (result->success != 0) { 13818 if (result->success != 0) {
(...skipping 19 matching lines...) Expand all
13701 13838
13702 result->min_range = range[0]; 13839 result->min_range = range[0];
13703 result->max_range = range[1]; 13840 result->max_range = range[1];
13704 result->precision = precision; 13841 result->precision = precision;
13705 13842
13706 return error::kNoError; 13843 return error::kNoError;
13707 } 13844 }
13708 13845
13709 error::Error GLES2DecoderImpl::HandleGetAttachedShaders( 13846 error::Error GLES2DecoderImpl::HandleGetAttachedShaders(
13710 uint32_t immediate_data_size, 13847 uint32_t immediate_data_size,
13711 const void* cmd_data) { 13848 const volatile void* cmd_data) {
13712 const gles2::cmds::GetAttachedShaders& c = 13849 const volatile gles2::cmds::GetAttachedShaders& c =
13713 *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); 13850 *static_cast<const volatile gles2::cmds::GetAttachedShaders*>(cmd_data);
13714 uint32_t result_size = c.result_size; 13851 uint32_t result_size = c.result_size;
13715 GLuint program_id = static_cast<GLuint>(c.program); 13852 GLuint program_id = static_cast<GLuint>(c.program);
13716 Program* program = GetProgramInfoNotShader( 13853 Program* program = GetProgramInfoNotShader(
13717 program_id, "glGetAttachedShaders"); 13854 program_id, "glGetAttachedShaders");
13718 if (!program) { 13855 if (!program) {
13719 return error::kNoError; 13856 return error::kNoError;
13720 } 13857 }
13721 typedef cmds::GetAttachedShaders::Result Result; 13858 typedef cmds::GetAttachedShaders::Result Result;
13722 uint32_t max_count = Result::ComputeMaxResults(result_size); 13859 uint32_t max_count = Result::ComputeMaxResults(result_size);
13723 Result* result = GetSharedMemoryAs<Result*>( 13860 Result* result = GetSharedMemoryAs<Result*>(
(...skipping 14 matching lines...) Expand all
13738 NOTREACHED(); 13875 NOTREACHED();
13739 return error::kGenericError; 13876 return error::kGenericError;
13740 } 13877 }
13741 } 13878 }
13742 result->SetNumResults(count); 13879 result->SetNumResults(count);
13743 return error::kNoError; 13880 return error::kNoError;
13744 } 13881 }
13745 13882
13746 error::Error GLES2DecoderImpl::HandleGetActiveUniform( 13883 error::Error GLES2DecoderImpl::HandleGetActiveUniform(
13747 uint32_t immediate_data_size, 13884 uint32_t immediate_data_size,
13748 const void* cmd_data) { 13885 const volatile void* cmd_data) {
13749 const gles2::cmds::GetActiveUniform& c = 13886 const volatile gles2::cmds::GetActiveUniform& c =
13750 *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); 13887 *static_cast<const volatile gles2::cmds::GetActiveUniform*>(cmd_data);
13751 GLuint program_id = c.program; 13888 GLuint program_id = c.program;
13752 GLuint index = c.index; 13889 GLuint index = c.index;
13753 uint32_t name_bucket_id = c.name_bucket_id; 13890 uint32_t name_bucket_id = c.name_bucket_id;
13754 typedef cmds::GetActiveUniform::Result Result; 13891 typedef cmds::GetActiveUniform::Result Result;
13755 Result* result = GetSharedMemoryAs<Result*>( 13892 Result* result = GetSharedMemoryAs<Result*>(
13756 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 13893 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13757 if (!result) { 13894 if (!result) {
13758 return error::kOutOfBounds; 13895 return error::kOutOfBounds;
13759 } 13896 }
13760 // Check that the client initialized the result. 13897 // Check that the client initialized the result.
(...skipping 15 matching lines...) Expand all
13776 result->success = 1; // true. 13913 result->success = 1; // true.
13777 result->size = uniform_info->size; 13914 result->size = uniform_info->size;
13778 result->type = uniform_info->type; 13915 result->type = uniform_info->type;
13779 Bucket* bucket = CreateBucket(name_bucket_id); 13916 Bucket* bucket = CreateBucket(name_bucket_id);
13780 bucket->SetFromString(uniform_info->name.c_str()); 13917 bucket->SetFromString(uniform_info->name.c_str());
13781 return error::kNoError; 13918 return error::kNoError;
13782 } 13919 }
13783 13920
13784 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv( 13921 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockiv(
13785 uint32_t immediate_data_size, 13922 uint32_t immediate_data_size,
13786 const void* cmd_data) { 13923 const volatile void* cmd_data) {
13787 if (!unsafe_es3_apis_enabled()) 13924 if (!unsafe_es3_apis_enabled())
13788 return error::kUnknownCommand; 13925 return error::kUnknownCommand;
13789 const gles2::cmds::GetActiveUniformBlockiv& c = 13926 const volatile gles2::cmds::GetActiveUniformBlockiv& c =
13790 *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); 13927 *static_cast<const volatile gles2::cmds::GetActiveUniformBlockiv*>(
13928 cmd_data);
13791 GLuint program_id = c.program; 13929 GLuint program_id = c.program;
13792 GLuint index = static_cast<GLuint>(c.index); 13930 GLuint index = static_cast<GLuint>(c.index);
13793 GLenum pname = static_cast<GLenum>(c.pname); 13931 GLenum pname = static_cast<GLenum>(c.pname);
13794 Program* program = GetProgramInfoNotShader( 13932 Program* program = GetProgramInfoNotShader(
13795 program_id, "glGetActiveUniformBlockiv"); 13933 program_id, "glGetActiveUniformBlockiv");
13796 if (!program) { 13934 if (!program) {
13797 return error::kNoError; 13935 return error::kNoError;
13798 } 13936 }
13799 GLuint service_id = program->service_id(); 13937 GLuint service_id = program->service_id();
13800 GLint link_status = GL_FALSE; 13938 GLint link_status = GL_FALSE;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
13834 if (error == GL_NO_ERROR) { 13972 if (error == GL_NO_ERROR) {
13835 result->SetNumResults(num_values); 13973 result->SetNumResults(num_values);
13836 } else { 13974 } else {
13837 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", ""); 13975 LOCAL_SET_GL_ERROR(error, "GetActiveUniformBlockiv", "");
13838 } 13976 }
13839 return error::kNoError; 13977 return error::kNoError;
13840 } 13978 }
13841 13979
13842 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName( 13980 error::Error GLES2DecoderImpl::HandleGetActiveUniformBlockName(
13843 uint32_t immediate_data_size, 13981 uint32_t immediate_data_size,
13844 const void* cmd_data) { 13982 const volatile void* cmd_data) {
13845 if (!unsafe_es3_apis_enabled()) 13983 if (!unsafe_es3_apis_enabled())
13846 return error::kUnknownCommand; 13984 return error::kUnknownCommand;
13847 const gles2::cmds::GetActiveUniformBlockName& c = 13985 const volatile gles2::cmds::GetActiveUniformBlockName& c =
13848 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); 13986 *static_cast<const volatile gles2::cmds::GetActiveUniformBlockName*>(
13987 cmd_data);
13849 GLuint program_id = c.program; 13988 GLuint program_id = c.program;
13850 GLuint index = c.index; 13989 GLuint index = c.index;
13851 uint32_t name_bucket_id = c.name_bucket_id; 13990 uint32_t name_bucket_id = c.name_bucket_id;
13852 typedef cmds::GetActiveUniformBlockName::Result Result; 13991 typedef cmds::GetActiveUniformBlockName::Result Result;
13853 Result* result = GetSharedMemoryAs<Result*>( 13992 Result* result = GetSharedMemoryAs<Result*>(
13854 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 13993 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13855 if (!result) { 13994 if (!result) {
13856 return error::kOutOfBounds; 13995 return error::kOutOfBounds;
13857 } 13996 }
13858 // Check that the client initialized the result. 13997 // Check that the client initialized the result.
(...skipping 29 matching lines...) Expand all
13888 *result = 1; 14027 *result = 1;
13889 Bucket* bucket = CreateBucket(name_bucket_id); 14028 Bucket* bucket = CreateBucket(name_bucket_id);
13890 DCHECK_GT(buf_size, length); 14029 DCHECK_GT(buf_size, length);
13891 DCHECK_EQ(0, buffer[length]); 14030 DCHECK_EQ(0, buffer[length]);
13892 bucket->SetFromString(&buffer[0]); 14031 bucket->SetFromString(&buffer[0]);
13893 return error::kNoError; 14032 return error::kNoError;
13894 } 14033 }
13895 14034
13896 error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( 14035 error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv(
13897 uint32_t immediate_data_size, 14036 uint32_t immediate_data_size,
13898 const void* cmd_data) { 14037 const volatile void* cmd_data) {
13899 if (!unsafe_es3_apis_enabled()) 14038 if (!unsafe_es3_apis_enabled())
13900 return error::kUnknownCommand; 14039 return error::kUnknownCommand;
13901 const gles2::cmds::GetActiveUniformsiv& c = 14040 const volatile gles2::cmds::GetActiveUniformsiv& c =
13902 *static_cast<const gles2::cmds::GetActiveUniformsiv*>(cmd_data); 14041 *static_cast<const volatile gles2::cmds::GetActiveUniformsiv*>(cmd_data);
13903 GLuint program_id = c.program; 14042 GLuint program_id = c.program;
13904 GLenum pname = static_cast<GLenum>(c.pname); 14043 GLenum pname = static_cast<GLenum>(c.pname);
13905 Bucket* bucket = GetBucket(c.indices_bucket_id); 14044 Bucket* bucket = GetBucket(c.indices_bucket_id);
13906 if (!bucket) { 14045 if (!bucket) {
13907 return error::kInvalidArguments; 14046 return error::kInvalidArguments;
13908 } 14047 }
13909 if (!validators_->uniform_parameter.IsValid(pname)) { 14048 if (!validators_->uniform_parameter.IsValid(pname)) {
13910 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetActiveUniformsiv", pname, "pname"); 14049 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetActiveUniformsiv", pname, "pname");
13911 return error::kNoError; 14050 return error::kNoError;
13912 } 14051 }
(...skipping 29 matching lines...) Expand all
13942 if (error == GL_NO_ERROR) { 14081 if (error == GL_NO_ERROR) {
13943 result->SetNumResults(count); 14082 result->SetNumResults(count);
13944 } else { 14083 } else {
13945 LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", ""); 14084 LOCAL_SET_GL_ERROR(error, "GetActiveUniformsiv", "");
13946 } 14085 }
13947 return error::kNoError; 14086 return error::kNoError;
13948 } 14087 }
13949 14088
13950 error::Error GLES2DecoderImpl::HandleGetActiveAttrib( 14089 error::Error GLES2DecoderImpl::HandleGetActiveAttrib(
13951 uint32_t immediate_data_size, 14090 uint32_t immediate_data_size,
13952 const void* cmd_data) { 14091 const volatile void* cmd_data) {
13953 const gles2::cmds::GetActiveAttrib& c = 14092 const volatile gles2::cmds::GetActiveAttrib& c =
13954 *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); 14093 *static_cast<const volatile gles2::cmds::GetActiveAttrib*>(cmd_data);
13955 GLuint program_id = c.program; 14094 GLuint program_id = c.program;
13956 GLuint index = c.index; 14095 GLuint index = c.index;
13957 uint32_t name_bucket_id = c.name_bucket_id; 14096 uint32_t name_bucket_id = c.name_bucket_id;
13958 typedef cmds::GetActiveAttrib::Result Result; 14097 typedef cmds::GetActiveAttrib::Result Result;
13959 Result* result = GetSharedMemoryAs<Result*>( 14098 Result* result = GetSharedMemoryAs<Result*>(
13960 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 14099 c.result_shm_id, c.result_shm_offset, sizeof(*result));
13961 if (!result) { 14100 if (!result) {
13962 return error::kOutOfBounds; 14101 return error::kOutOfBounds;
13963 } 14102 }
13964 // Check that the client initialized the result. 14103 // Check that the client initialized the result.
(...skipping 13 matching lines...) Expand all
13978 return error::kNoError; 14117 return error::kNoError;
13979 } 14118 }
13980 result->success = 1; // true. 14119 result->success = 1; // true.
13981 result->size = attrib_info->size; 14120 result->size = attrib_info->size;
13982 result->type = attrib_info->type; 14121 result->type = attrib_info->type;
13983 Bucket* bucket = CreateBucket(name_bucket_id); 14122 Bucket* bucket = CreateBucket(name_bucket_id);
13984 bucket->SetFromString(attrib_info->name.c_str()); 14123 bucket->SetFromString(attrib_info->name.c_str());
13985 return error::kNoError; 14124 return error::kNoError;
13986 } 14125 }
13987 14126
13988 error::Error GLES2DecoderImpl::HandleShaderBinary(uint32_t immediate_data_size, 14127 error::Error GLES2DecoderImpl::HandleShaderBinary(
13989 const void* cmd_data) { 14128 uint32_t immediate_data_size,
14129 const volatile void* cmd_data) {
13990 #if 1 // No binary shader support. 14130 #if 1 // No binary shader support.
13991 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported"); 14131 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glShaderBinary", "not supported");
13992 return error::kNoError; 14132 return error::kNoError;
13993 #else 14133 #else
13994 GLsizei n = static_cast<GLsizei>(c.n); 14134 GLsizei n = static_cast<GLsizei>(c.n);
13995 if (n < 0) { 14135 if (n < 0) {
13996 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0"); 14136 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glShaderBinary", "n < 0");
13997 return error::kNoError; 14137 return error::kNoError;
13998 } 14138 }
13999 GLsizei length = static_cast<GLsizei>(c.length); 14139 GLsizei length = static_cast<GLsizei>(c.length);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
14183 FinishSwapBuffers(surface_->CommitOverlayPlanes()); 14323 FinishSwapBuffers(surface_->CommitOverlayPlanes());
14184 } 14324 }
14185 } 14325 }
14186 14326
14187 void GLES2DecoderImpl::DoSwapInterval(int interval) { 14327 void GLES2DecoderImpl::DoSwapInterval(int interval) {
14188 context_->SetSwapInterval(interval); 14328 context_->SetSwapInterval(interval);
14189 } 14329 }
14190 14330
14191 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM( 14331 error::Error GLES2DecoderImpl::HandleEnableFeatureCHROMIUM(
14192 uint32_t immediate_data_size, 14332 uint32_t immediate_data_size,
14193 const void* cmd_data) { 14333 const volatile void* cmd_data) {
14194 const gles2::cmds::EnableFeatureCHROMIUM& c = 14334 const volatile gles2::cmds::EnableFeatureCHROMIUM& c =
14195 *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); 14335 *static_cast<const volatile gles2::cmds::EnableFeatureCHROMIUM*>(
14336 cmd_data);
14196 Bucket* bucket = GetBucket(c.bucket_id); 14337 Bucket* bucket = GetBucket(c.bucket_id);
14197 if (!bucket || bucket->size() == 0) { 14338 if (!bucket || bucket->size() == 0) {
14198 return error::kInvalidArguments; 14339 return error::kInvalidArguments;
14199 } 14340 }
14200 typedef cmds::EnableFeatureCHROMIUM::Result Result; 14341 typedef cmds::EnableFeatureCHROMIUM::Result Result;
14201 Result* result = GetSharedMemoryAs<Result*>( 14342 Result* result = GetSharedMemoryAs<Result*>(
14202 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 14343 c.result_shm_id, c.result_shm_offset, sizeof(*result));
14203 if (!result) { 14344 if (!result) {
14204 return error::kOutOfBounds; 14345 return error::kOutOfBounds;
14205 } 14346 }
(...skipping 24 matching lines...) Expand all
14230 } else { 14371 } else {
14231 return error::kNoError; 14372 return error::kNoError;
14232 } 14373 }
14233 14374
14234 *result = 1; // true. 14375 *result = 1; // true.
14235 return error::kNoError; 14376 return error::kNoError;
14236 } 14377 }
14237 14378
14238 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( 14379 error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM(
14239 uint32_t immediate_data_size, 14380 uint32_t immediate_data_size,
14240 const void* cmd_data) { 14381 const volatile void* cmd_data) {
14241 const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = 14382 const volatile gles2::cmds::GetRequestableExtensionsCHROMIUM& c =
14242 *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( 14383 *static_cast<
14384 const volatile gles2::cmds::GetRequestableExtensionsCHROMIUM*>(
14243 cmd_data); 14385 cmd_data);
14244 Bucket* bucket = CreateBucket(c.bucket_id); 14386 Bucket* bucket = CreateBucket(c.bucket_id);
14245 scoped_refptr<FeatureInfo> info(new FeatureInfo(workarounds())); 14387 scoped_refptr<FeatureInfo> info(new FeatureInfo(workarounds()));
14246 DisallowedFeatures disallowed_features = feature_info_->disallowed_features(); 14388 DisallowedFeatures disallowed_features = feature_info_->disallowed_features();
14247 disallowed_features.AllowExtensions(); 14389 disallowed_features.AllowExtensions();
14248 info->Initialize(feature_info_->context_type(), disallowed_features); 14390 info->Initialize(feature_info_->context_type(), disallowed_features);
14249 bucket->SetFromString(info->extensions().c_str()); 14391 bucket->SetFromString(info->extensions().c_str());
14250 return error::kNoError; 14392 return error::kNoError;
14251 } 14393 }
14252 14394
14253 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM( 14395 error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM(
14254 uint32_t immediate_data_size, 14396 uint32_t immediate_data_size,
14255 const void* cmd_data) { 14397 const volatile void* cmd_data) {
14256 const gles2::cmds::RequestExtensionCHROMIUM& c = 14398 const volatile gles2::cmds::RequestExtensionCHROMIUM& c =
14257 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); 14399 *static_cast<const volatile gles2::cmds::RequestExtensionCHROMIUM*>(
14400 cmd_data);
14258 Bucket* bucket = GetBucket(c.bucket_id); 14401 Bucket* bucket = GetBucket(c.bucket_id);
14259 if (!bucket || bucket->size() == 0) { 14402 if (!bucket || bucket->size() == 0) {
14260 return error::kInvalidArguments; 14403 return error::kInvalidArguments;
14261 } 14404 }
14262 std::string feature_str; 14405 std::string feature_str;
14263 if (!bucket->GetAsString(&feature_str)) { 14406 if (!bucket->GetAsString(&feature_str)) {
14264 return error::kInvalidArguments; 14407 return error::kInvalidArguments;
14265 } 14408 }
14266 feature_str = feature_str + " "; 14409 feature_str = feature_str + " ";
14267 14410
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
14309 feature_info_->EnableOESTextureHalfFloatLinear(); 14452 feature_info_->EnableOESTextureHalfFloatLinear();
14310 } 14453 }
14311 14454
14312 UpdateCapabilities(); 14455 UpdateCapabilities();
14313 14456
14314 return error::kNoError; 14457 return error::kNoError;
14315 } 14458 }
14316 14459
14317 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM( 14460 error::Error GLES2DecoderImpl::HandleGetProgramInfoCHROMIUM(
14318 uint32_t immediate_data_size, 14461 uint32_t immediate_data_size,
14319 const void* cmd_data) { 14462 const volatile void* cmd_data) {
14320 const gles2::cmds::GetProgramInfoCHROMIUM& c = 14463 const volatile gles2::cmds::GetProgramInfoCHROMIUM& c =
14321 *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); 14464 *static_cast<const volatile gles2::cmds::GetProgramInfoCHROMIUM*>(
14465 cmd_data);
14322 GLuint program_id = static_cast<GLuint>(c.program); 14466 GLuint program_id = static_cast<GLuint>(c.program);
14323 uint32_t bucket_id = c.bucket_id; 14467 uint32_t bucket_id = c.bucket_id;
14324 Bucket* bucket = CreateBucket(bucket_id); 14468 Bucket* bucket = CreateBucket(bucket_id);
14325 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. 14469 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail.
14326 Program* program = NULL; 14470 Program* program = NULL;
14327 program = GetProgram(program_id); 14471 program = GetProgram(program_id);
14328 if (!program || !program->IsValid()) { 14472 if (!program || !program->IsValid()) {
14329 return error::kNoError; 14473 return error::kNoError;
14330 } 14474 }
14331 program->GetProgramInfo(program_manager(), bucket); 14475 program->GetProgramInfo(program_manager(), bucket);
14332 return error::kNoError; 14476 return error::kNoError;
14333 } 14477 }
14334 14478
14335 error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM( 14479 error::Error GLES2DecoderImpl::HandleGetUniformBlocksCHROMIUM(
14336 uint32_t immediate_data_size, 14480 uint32_t immediate_data_size,
14337 const void* cmd_data) { 14481 const volatile void* cmd_data) {
14338 if (!unsafe_es3_apis_enabled()) 14482 if (!unsafe_es3_apis_enabled())
14339 return error::kUnknownCommand; 14483 return error::kUnknownCommand;
14340 const gles2::cmds::GetUniformBlocksCHROMIUM& c = 14484 const volatile gles2::cmds::GetUniformBlocksCHROMIUM& c =
14341 *static_cast<const gles2::cmds::GetUniformBlocksCHROMIUM*>(cmd_data); 14485 *static_cast<const volatile gles2::cmds::GetUniformBlocksCHROMIUM*>(
14486 cmd_data);
14342 GLuint program_id = static_cast<GLuint>(c.program); 14487 GLuint program_id = static_cast<GLuint>(c.program);
14343 uint32_t bucket_id = c.bucket_id; 14488 uint32_t bucket_id = c.bucket_id;
14344 Bucket* bucket = CreateBucket(bucket_id); 14489 Bucket* bucket = CreateBucket(bucket_id);
14345 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail. 14490 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail.
14346 Program* program = NULL; 14491 Program* program = NULL;
14347 program = GetProgram(program_id); 14492 program = GetProgram(program_id);
14348 if (!program || !program->IsValid()) { 14493 if (!program || !program->IsValid()) {
14349 return error::kNoError; 14494 return error::kNoError;
14350 } 14495 }
14351 program->GetUniformBlocks(bucket); 14496 program->GetUniformBlocks(bucket);
14352 return error::kNoError; 14497 return error::kNoError;
14353 } 14498 }
14354 14499
14355 error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM( 14500 error::Error GLES2DecoderImpl::HandleGetUniformsES3CHROMIUM(
14356 uint32_t immediate_data_size, 14501 uint32_t immediate_data_size,
14357 const void* cmd_data) { 14502 const volatile void* cmd_data) {
14358 if (!unsafe_es3_apis_enabled()) 14503 if (!unsafe_es3_apis_enabled())
14359 return error::kUnknownCommand; 14504 return error::kUnknownCommand;
14360 const gles2::cmds::GetUniformsES3CHROMIUM& c = 14505 const volatile gles2::cmds::GetUniformsES3CHROMIUM& c =
14361 *static_cast<const gles2::cmds::GetUniformsES3CHROMIUM*>(cmd_data); 14506 *static_cast<const volatile gles2::cmds::GetUniformsES3CHROMIUM*>(
14507 cmd_data);
14362 GLuint program_id = static_cast<GLuint>(c.program); 14508 GLuint program_id = static_cast<GLuint>(c.program);
14363 uint32_t bucket_id = c.bucket_id; 14509 uint32_t bucket_id = c.bucket_id;
14364 Bucket* bucket = CreateBucket(bucket_id); 14510 Bucket* bucket = CreateBucket(bucket_id);
14365 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail. 14511 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail.
14366 Program* program = NULL; 14512 Program* program = NULL;
14367 program = GetProgram(program_id); 14513 program = GetProgram(program_id);
14368 if (!program || !program->IsValid()) { 14514 if (!program || !program->IsValid()) {
14369 return error::kNoError; 14515 return error::kNoError;
14370 } 14516 }
14371 program->GetUniformsES3(bucket); 14517 program->GetUniformsES3(bucket);
14372 return error::kNoError; 14518 return error::kNoError;
14373 } 14519 }
14374 14520
14375 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying( 14521 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying(
14376 uint32_t immediate_data_size, 14522 uint32_t immediate_data_size,
14377 const void* cmd_data) { 14523 const volatile void* cmd_data) {
14378 if (!unsafe_es3_apis_enabled()) 14524 if (!unsafe_es3_apis_enabled())
14379 return error::kUnknownCommand; 14525 return error::kUnknownCommand;
14380 const gles2::cmds::GetTransformFeedbackVarying& c = 14526 const volatile gles2::cmds::GetTransformFeedbackVarying& c =
14381 *static_cast<const gles2::cmds::GetTransformFeedbackVarying*>(cmd_data); 14527 *static_cast<const volatile gles2::cmds::GetTransformFeedbackVarying*>(
14528 cmd_data);
14382 GLuint program_id = c.program; 14529 GLuint program_id = c.program;
14383 GLuint index = c.index; 14530 GLuint index = c.index;
14384 uint32_t name_bucket_id = c.name_bucket_id; 14531 uint32_t name_bucket_id = c.name_bucket_id;
14385 typedef cmds::GetTransformFeedbackVarying::Result Result; 14532 typedef cmds::GetTransformFeedbackVarying::Result Result;
14386 Result* result = GetSharedMemoryAs<Result*>( 14533 Result* result = GetSharedMemoryAs<Result*>(
14387 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 14534 c.result_shm_id, c.result_shm_offset, sizeof(*result));
14388 if (!result) { 14535 if (!result) {
14389 return error::kOutOfBounds; 14536 return error::kOutOfBounds;
14390 } 14537 }
14391 // Check that the client initialized the result. 14538 // 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); 14573 result->type = static_cast<uint32_t>(type);
14427 Bucket* bucket = CreateBucket(name_bucket_id); 14574 Bucket* bucket = CreateBucket(name_bucket_id);
14428 DCHECK(length >= 0 && length < max_length); 14575 DCHECK(length >= 0 && length < max_length);
14429 buffer[length] = '\0'; // Just to be safe. 14576 buffer[length] = '\0'; // Just to be safe.
14430 bucket->SetFromString(&buffer[0]); 14577 bucket->SetFromString(&buffer[0]);
14431 return error::kNoError; 14578 return error::kNoError;
14432 } 14579 }
14433 14580
14434 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM( 14581 error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVaryingsCHROMIUM(
14435 uint32_t immediate_data_size, 14582 uint32_t immediate_data_size,
14436 const void* cmd_data) { 14583 const volatile void* cmd_data) {
14437 if (!unsafe_es3_apis_enabled()) 14584 if (!unsafe_es3_apis_enabled())
14438 return error::kUnknownCommand; 14585 return error::kUnknownCommand;
14439 const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c = 14586 const volatile gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c =
14440 *static_cast<const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>( 14587 *static_cast<
14588 const volatile gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>(
14441 cmd_data); 14589 cmd_data);
14442 GLuint program_id = static_cast<GLuint>(c.program); 14590 GLuint program_id = static_cast<GLuint>(c.program);
14443 uint32_t bucket_id = c.bucket_id; 14591 uint32_t bucket_id = c.bucket_id;
14444 Bucket* bucket = CreateBucket(bucket_id); 14592 Bucket* bucket = CreateBucket(bucket_id);
14445 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail. 14593 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail.
14446 Program* program = NULL; 14594 Program* program = NULL;
14447 program = GetProgram(program_id); 14595 program = GetProgram(program_id);
14448 if (!program || !program->IsValid()) { 14596 if (!program || !program->IsValid()) {
14449 return error::kNoError; 14597 return error::kNoError;
14450 } 14598 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
14532 return false; 14680 return false;
14533 } 14681 }
14534 reset_by_robustness_extension_ = true; 14682 reset_by_robustness_extension_ = true;
14535 return true; 14683 return true;
14536 } 14684 }
14537 return false; 14685 return false;
14538 } 14686 }
14539 14687
14540 error::Error GLES2DecoderImpl::HandleDescheduleUntilFinishedCHROMIUM( 14688 error::Error GLES2DecoderImpl::HandleDescheduleUntilFinishedCHROMIUM(
14541 uint32_t immediate_data_size, 14689 uint32_t immediate_data_size,
14542 const void* cmd_data) { 14690 const volatile void* cmd_data) {
14543 if (deschedule_until_finished_callback_.is_null() || 14691 if (deschedule_until_finished_callback_.is_null() ||
14544 reschedule_after_finished_callback_.is_null()) { 14692 reschedule_after_finished_callback_.is_null()) {
14545 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 14693 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
14546 "glDescheduleUntilFinishedCHROMIUM", 14694 "glDescheduleUntilFinishedCHROMIUM",
14547 "Not fully implemented."); 14695 "Not fully implemented.");
14548 return error::kNoError; 14696 return error::kNoError;
14549 } 14697 }
14550 14698
14551 std::unique_ptr<gl::GLFence> fence(gl::GLFence::Create()); 14699 std::unique_ptr<gl::GLFence> fence(gl::GLFence::Create());
14552 deschedule_until_finished_fences_.push_back(std::move(fence)); 14700 deschedule_until_finished_fences_.push_back(std::move(fence));
14553 14701
14554 if (deschedule_until_finished_fences_.size() == 1) 14702 if (deschedule_until_finished_fences_.size() == 1)
14555 return error::kNoError; 14703 return error::kNoError;
14556 14704
14557 DCHECK_EQ(2u, deschedule_until_finished_fences_.size()); 14705 DCHECK_EQ(2u, deschedule_until_finished_fences_.size());
14558 if (deschedule_until_finished_fences_[0]->HasCompleted()) { 14706 if (deschedule_until_finished_fences_[0]->HasCompleted()) {
14559 deschedule_until_finished_fences_.erase( 14707 deschedule_until_finished_fences_.erase(
14560 deschedule_until_finished_fences_.begin()); 14708 deschedule_until_finished_fences_.begin());
14561 return error::kNoError; 14709 return error::kNoError;
14562 } 14710 }
14563 14711
14564 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::DescheduleUntilFinished", 14712 TRACE_EVENT_ASYNC_BEGIN0("cc", "GLES2DecoderImpl::DescheduleUntilFinished",
14565 this); 14713 this);
14566 deschedule_until_finished_callback_.Run(); 14714 deschedule_until_finished_callback_.Run();
14567 return error::kDeferLaterCommands; 14715 return error::kDeferLaterCommands;
14568 } 14716 }
14569 14717
14570 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM( 14718 error::Error GLES2DecoderImpl::HandleInsertFenceSyncCHROMIUM(
14571 uint32_t immediate_data_size, 14719 uint32_t immediate_data_size,
14572 const void* cmd_data) { 14720 const volatile void* cmd_data) {
14573 const gles2::cmds::InsertFenceSyncCHROMIUM& c = 14721 const volatile gles2::cmds::InsertFenceSyncCHROMIUM& c =
14574 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); 14722 *static_cast<const volatile gles2::cmds::InsertFenceSyncCHROMIUM*>(
14723 cmd_data);
14575 14724
14576 const uint64_t release_count = c.release_count(); 14725 const uint64_t release_count = c.release_count();
14577 if (!fence_sync_release_callback_.is_null()) 14726 if (!fence_sync_release_callback_.is_null())
14578 fence_sync_release_callback_.Run(release_count); 14727 fence_sync_release_callback_.Run(release_count);
14579 return error::kNoError; 14728 return error::kNoError;
14580 } 14729 }
14581 14730
14582 error::Error GLES2DecoderImpl::HandleWaitSyncTokenCHROMIUM( 14731 error::Error GLES2DecoderImpl::HandleWaitSyncTokenCHROMIUM(
14583 uint32_t immediate_data_size, 14732 uint32_t immediate_data_size,
14584 const void* cmd_data) { 14733 const volatile void* cmd_data) {
14585 const gles2::cmds::WaitSyncTokenCHROMIUM& c = 14734 const volatile gles2::cmds::WaitSyncTokenCHROMIUM& c =
14586 *static_cast<const gles2::cmds::WaitSyncTokenCHROMIUM*>(cmd_data); 14735 *static_cast<const volatile gles2::cmds::WaitSyncTokenCHROMIUM*>(
14736 cmd_data);
14587 14737
14588 const gpu::CommandBufferNamespace kMinNamespaceId = 14738 const gpu::CommandBufferNamespace kMinNamespaceId =
14589 gpu::CommandBufferNamespace::INVALID; 14739 gpu::CommandBufferNamespace::INVALID;
14590 const gpu::CommandBufferNamespace kMaxNamespaceId = 14740 const gpu::CommandBufferNamespace kMaxNamespaceId =
14591 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; 14741 gpu::CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES;
14592 14742
14593 gpu::CommandBufferNamespace namespace_id = 14743 gpu::CommandBufferNamespace namespace_id =
14594 static_cast<gpu::CommandBufferNamespace>(c.namespace_id); 14744 static_cast<gpu::CommandBufferNamespace>(c.namespace_id);
14595 if ((namespace_id < static_cast<int32_t>(kMinNamespaceId)) || 14745 if ((namespace_id < static_cast<int32_t>(kMinNamespaceId)) ||
14596 (namespace_id >= static_cast<int32_t>(kMaxNamespaceId))) { 14746 (namespace_id >= static_cast<int32_t>(kMaxNamespaceId))) {
14597 namespace_id = gpu::CommandBufferNamespace::INVALID; 14747 namespace_id = gpu::CommandBufferNamespace::INVALID;
14598 } 14748 }
14599 const CommandBufferId command_buffer_id = 14749 const CommandBufferId command_buffer_id =
14600 CommandBufferId::FromUnsafeValue(c.command_buffer_id()); 14750 CommandBufferId::FromUnsafeValue(c.command_buffer_id());
14601 const uint64_t release = c.release_count(); 14751 const uint64_t release = c.release_count();
14602 if (wait_fence_sync_callback_.is_null()) 14752 if (wait_fence_sync_callback_.is_null())
14603 return error::kNoError; 14753 return error::kNoError;
14604 14754
14605 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release) 14755 return wait_fence_sync_callback_.Run(namespace_id, command_buffer_id, release)
14606 ? error::kNoError 14756 ? error::kNoError
14607 : error::kDeferCommandUntilLater; 14757 : error::kDeferCommandUntilLater;
14608 } 14758 }
14609 14759
14610 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM( 14760 error::Error GLES2DecoderImpl::HandleDiscardBackbufferCHROMIUM(
14611 uint32_t immediate_data_size, 14761 uint32_t immediate_data_size,
14612 const void* cmd_data) { 14762 const volatile void* cmd_data) {
14613 if (surface_->DeferDraws()) 14763 if (surface_->DeferDraws())
14614 return error::kDeferCommandUntilLater; 14764 return error::kDeferCommandUntilLater;
14615 if (!surface_->SetBackbufferAllocation(false)) 14765 if (!surface_->SetBackbufferAllocation(false))
14616 return error::kLostContext; 14766 return error::kLostContext;
14617 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT; 14767 backbuffer_needs_clear_bits_ |= GL_COLOR_BUFFER_BIT;
14618 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT; 14768 backbuffer_needs_clear_bits_ |= GL_DEPTH_BUFFER_BIT;
14619 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT; 14769 backbuffer_needs_clear_bits_ |= GL_STENCIL_BUFFER_BIT;
14620 return error::kNoError; 14770 return error::kNoError;
14621 } 14771 }
14622 14772
14623 bool GLES2DecoderImpl::GenQueriesEXTHelper( 14773 bool GLES2DecoderImpl::GenQueriesEXTHelper(
14624 GLsizei n, const GLuint* client_ids) { 14774 GLsizei n, const GLuint* client_ids) {
14625 for (GLsizei ii = 0; ii < n; ++ii) { 14775 for (GLsizei ii = 0; ii < n; ++ii) {
14626 if (query_manager_->IsValidQuery(client_ids[ii])) { 14776 if (query_manager_->IsValidQuery(client_ids[ii])) {
14627 return false; 14777 return false;
14628 } 14778 }
14629 } 14779 }
14630 query_manager_->GenQueries(n, client_ids); 14780 query_manager_->GenQueries(n, client_ids);
14631 return true; 14781 return true;
14632 } 14782 }
14633 14783
14634 void GLES2DecoderImpl::DeleteQueriesEXTHelper(GLsizei n, 14784 void GLES2DecoderImpl::DeleteQueriesEXTHelper(
14635 const GLuint* client_ids) { 14785 GLsizei n,
14786 const volatile GLuint* client_ids) {
14636 for (GLsizei ii = 0; ii < n; ++ii) { 14787 for (GLsizei ii = 0; ii < n; ++ii) {
14637 GLuint client_id = client_ids[ii]; 14788 GLuint client_id = client_ids[ii];
14638 query_manager_->RemoveQuery(client_id); 14789 query_manager_->RemoveQuery(client_id);
14639 } 14790 }
14640 } 14791 }
14641 14792
14642 bool GLES2DecoderImpl::HasPendingQueries() const { 14793 bool GLES2DecoderImpl::HasPendingQueries() const {
14643 return query_manager_.get() && query_manager_->HavePendingQueries(); 14794 return query_manager_.get() && query_manager_->HavePendingQueries();
14644 } 14795 }
14645 14796
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
14702 } 14853 }
14703 14854
14704 bool GLES2DecoderImpl::HasPollingWork() const { 14855 bool GLES2DecoderImpl::HasPollingWork() const {
14705 return deschedule_until_finished_fences_.size() >= 2; 14856 return deschedule_until_finished_fences_.size() >= 2;
14706 } 14857 }
14707 14858
14708 void GLES2DecoderImpl::PerformPollingWork() { 14859 void GLES2DecoderImpl::PerformPollingWork() {
14709 ProcessDescheduleUntilFinished(); 14860 ProcessDescheduleUntilFinished();
14710 } 14861 }
14711 14862
14712 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(uint32_t immediate_data_size, 14863 error::Error GLES2DecoderImpl::HandleBeginQueryEXT(
14713 const void* cmd_data) { 14864 uint32_t immediate_data_size,
14714 const gles2::cmds::BeginQueryEXT& c = 14865 const volatile void* cmd_data) {
14715 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); 14866 const volatile gles2::cmds::BeginQueryEXT& c =
14867 *static_cast<const volatile gles2::cmds::BeginQueryEXT*>(cmd_data);
14716 GLenum target = static_cast<GLenum>(c.target); 14868 GLenum target = static_cast<GLenum>(c.target);
14717 GLuint client_id = static_cast<GLuint>(c.id); 14869 GLuint client_id = static_cast<GLuint>(c.id);
14718 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); 14870 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); 14871 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset);
14720 14872
14721 switch (target) { 14873 switch (target) {
14722 case GL_COMMANDS_ISSUED_CHROMIUM: 14874 case GL_COMMANDS_ISSUED_CHROMIUM:
14723 case GL_LATENCY_QUERY_CHROMIUM: 14875 case GL_LATENCY_QUERY_CHROMIUM:
14724 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: 14876 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
14725 case GL_GET_ERROR_QUERY_CHROMIUM: 14877 case GL_GET_ERROR_QUERY_CHROMIUM:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
14795 return error::kInvalidArguments; 14947 return error::kInvalidArguments;
14796 } 14948 }
14797 14949
14798 if (!query_manager_->BeginQuery(query)) { 14950 if (!query_manager_->BeginQuery(query)) {
14799 return error::kOutOfBounds; 14951 return error::kOutOfBounds;
14800 } 14952 }
14801 14953
14802 return error::kNoError; 14954 return error::kNoError;
14803 } 14955 }
14804 14956
14805 error::Error GLES2DecoderImpl::HandleEndQueryEXT(uint32_t immediate_data_size, 14957 error::Error GLES2DecoderImpl::HandleEndQueryEXT(
14806 const void* cmd_data) { 14958 uint32_t immediate_data_size,
14807 const gles2::cmds::EndQueryEXT& c = 14959 const volatile void* cmd_data) {
14808 *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); 14960 const volatile gles2::cmds::EndQueryEXT& c =
14961 *static_cast<const volatile gles2::cmds::EndQueryEXT*>(cmd_data);
14809 GLenum target = static_cast<GLenum>(c.target); 14962 GLenum target = static_cast<GLenum>(c.target);
14810 uint32_t submit_count = static_cast<GLuint>(c.submit_count); 14963 uint32_t submit_count = static_cast<GLuint>(c.submit_count);
14811 14964
14812 QueryManager::Query* query = query_manager_->GetActiveQuery(target); 14965 QueryManager::Query* query = query_manager_->GetActiveQuery(target);
14813 if (!query) { 14966 if (!query) {
14814 LOCAL_SET_GL_ERROR( 14967 LOCAL_SET_GL_ERROR(
14815 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query"); 14968 GL_INVALID_OPERATION, "glEndQueryEXT", "No active query");
14816 return error::kNoError; 14969 return error::kNoError;
14817 } 14970 }
14818 14971
14819 if (!query_manager_->EndQuery(query, submit_count)) { 14972 if (!query_manager_->EndQuery(query, submit_count)) {
14820 return error::kOutOfBounds; 14973 return error::kOutOfBounds;
14821 } 14974 }
14822 14975
14823 query_manager_->ProcessPendingTransferQueries(); 14976 query_manager_->ProcessPendingTransferQueries();
14824 14977
14825 return error::kNoError; 14978 return error::kNoError;
14826 } 14979 }
14827 14980
14828 error::Error GLES2DecoderImpl::HandleQueryCounterEXT( 14981 error::Error GLES2DecoderImpl::HandleQueryCounterEXT(
14829 uint32_t immediate_data_size, 14982 uint32_t immediate_data_size,
14830 const void* cmd_data) { 14983 const volatile void* cmd_data) {
14831 const gles2::cmds::QueryCounterEXT& c = 14984 const volatile gles2::cmds::QueryCounterEXT& c =
14832 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data); 14985 *static_cast<const volatile gles2::cmds::QueryCounterEXT*>(cmd_data);
14833 GLuint client_id = static_cast<GLuint>(c.id); 14986 GLuint client_id = static_cast<GLuint>(c.id);
14834 GLenum target = static_cast<GLenum>(c.target); 14987 GLenum target = static_cast<GLenum>(c.target);
14835 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); 14988 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); 14989 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); 14990 uint32_t submit_count = static_cast<GLuint>(c.submit_count);
14838 14991
14839 switch (target) { 14992 switch (target) {
14840 case GL_TIMESTAMP: 14993 case GL_TIMESTAMP:
14841 if (!query_manager_->GPUTimingAvailable()) { 14994 if (!query_manager_->GPUTimingAvailable()) {
14842 LOCAL_SET_GL_ERROR( 14995 LOCAL_SET_GL_ERROR(
(...skipping 22 matching lines...) Expand all
14865 } 15018 }
14866 if (!query_manager_->QueryCounter(query, submit_count)) { 15019 if (!query_manager_->QueryCounter(query, submit_count)) {
14867 return error::kOutOfBounds; 15020 return error::kOutOfBounds;
14868 } 15021 }
14869 15022
14870 return error::kNoError; 15023 return error::kNoError;
14871 } 15024 }
14872 15025
14873 error::Error GLES2DecoderImpl::HandleSetDisjointValueSyncCHROMIUM( 15026 error::Error GLES2DecoderImpl::HandleSetDisjointValueSyncCHROMIUM(
14874 uint32_t immediate_data_size, 15027 uint32_t immediate_data_size,
14875 const void* cmd_data) { 15028 const volatile void* cmd_data) {
14876 const gles2::cmds::SetDisjointValueSyncCHROMIUM& c = 15029 const volatile gles2::cmds::SetDisjointValueSyncCHROMIUM& c =
14877 *static_cast<const gles2::cmds::SetDisjointValueSyncCHROMIUM*>(cmd_data); 15030 *static_cast<const volatile gles2::cmds::SetDisjointValueSyncCHROMIUM*>(
15031 cmd_data);
14878 int32_t sync_shm_id = static_cast<int32_t>(c.sync_data_shm_id); 15032 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); 15033 uint32_t sync_shm_offset = static_cast<uint32_t>(c.sync_data_shm_offset);
14880 15034
14881 return query_manager_->SetDisjointSync(sync_shm_id, sync_shm_offset); 15035 return query_manager_->SetDisjointSync(sync_shm_id, sync_shm_offset);
14882 } 15036 }
14883 15037
14884 bool GLES2DecoderImpl::GenVertexArraysOESHelper( 15038 bool GLES2DecoderImpl::GenVertexArraysOESHelper(
14885 GLsizei n, const GLuint* client_ids) { 15039 GLsizei n, const GLuint* client_ids) {
14886 for (GLsizei ii = 0; ii < n; ++ii) { 15040 for (GLsizei ii = 0; ii < n; ++ii) {
14887 if (GetVertexAttribManager(client_ids[ii])) { 15041 if (GetVertexAttribManager(client_ids[ii])) {
(...skipping 11 matching lines...) Expand all
14899 15053
14900 glGenVertexArraysOES(n, service_ids.get()); 15054 glGenVertexArraysOES(n, service_ids.get());
14901 for (GLsizei ii = 0; ii < n; ++ii) { 15055 for (GLsizei ii = 0; ii < n; ++ii) {
14902 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true); 15056 CreateVertexAttribManager(client_ids[ii], service_ids[ii], true);
14903 } 15057 }
14904 } 15058 }
14905 15059
14906 return true; 15060 return true;
14907 } 15061 }
14908 15062
14909 void GLES2DecoderImpl::DeleteVertexArraysOESHelper(GLsizei n, 15063 void GLES2DecoderImpl::DeleteVertexArraysOESHelper(
14910 const GLuint* client_ids) { 15064 GLsizei n,
15065 const volatile GLuint* client_ids) {
14911 for (GLsizei ii = 0; ii < n; ++ii) { 15066 for (GLsizei ii = 0; ii < n; ++ii) {
14912 GLuint client_id = client_ids[ii]; 15067 GLuint client_id = client_ids[ii];
14913 VertexAttribManager* vao = GetVertexAttribManager(client_id); 15068 VertexAttribManager* vao = GetVertexAttribManager(client_id);
14914 if (vao && !vao->IsDeleted()) { 15069 if (vao && !vao->IsDeleted()) {
14915 if (state_.vertex_attrib_manager.get() == vao) { 15070 if (state_.vertex_attrib_manager.get() == vao) {
14916 DoBindVertexArrayOES(0); 15071 DoBindVertexArrayOES(0);
14917 } 15072 }
14918 RemoveVertexAttribManager(client_id); 15073 RemoveVertexAttribManager(client_id);
14919 } 15074 }
14920 } 15075 }
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
15797 GLsizei width, 15952 GLsizei width,
15798 GLsizei height, 15953 GLsizei height,
15799 GLsizei depth) { 15954 GLsizei depth) {
15800 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage3D", 15955 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage3D",
15801 "widthXheight", width * height, "depth", depth); 15956 "widthXheight", width * height, "depth", depth);
15802 TexStorageImpl(target, levels, internal_format, width, height, depth, 15957 TexStorageImpl(target, levels, internal_format, width, height, depth,
15803 ContextState::k3D, "glTexStorage3D"); 15958 ContextState::k3D, "glTexStorage3D");
15804 } 15959 }
15805 15960
15806 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, 15961 void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
15807 const GLbyte* data) { 15962 const volatile GLbyte* data) {
15808 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM", 15963 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureCHROMIUM",
15809 "context", logger_.GetLogPrefix(), 15964 "context", logger_.GetLogPrefix(),
15810 "mailbox[0]", static_cast<unsigned char>(data[0])); 15965 "mailbox[0]", static_cast<unsigned char>(data[0]));
15811 15966
15812 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( 15967 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
15813 &state_, target); 15968 &state_, target);
15814 ProduceTextureRef("glProduceTextureCHROMIUM", false, texture_ref, target, 15969 ProduceTextureRef("glProduceTextureCHROMIUM", false, texture_ref, target,
15815 data); 15970 data);
15816 } 15971 }
15817 15972
15818 void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(GLuint client_id, 15973 void GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM(
15819 GLenum target, const GLbyte* data) { 15974 GLuint client_id,
15975 GLenum target,
15976 const volatile GLbyte* data) {
15820 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM", 15977 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoProduceTextureDirectCHROMIUM",
15821 "context", logger_.GetLogPrefix(), 15978 "context", logger_.GetLogPrefix(),
15822 "mailbox[0]", static_cast<unsigned char>(data[0])); 15979 "mailbox[0]", static_cast<unsigned char>(data[0]));
15823 15980
15824 ProduceTextureRef("glProduceTextureDirectCHROMIUM", !client_id, 15981 ProduceTextureRef("glProduceTextureDirectCHROMIUM", !client_id,
15825 GetTexture(client_id), target, data); 15982 GetTexture(client_id), target, data);
15826 } 15983 }
15827 15984
15828 void GLES2DecoderImpl::ProduceTextureRef(const char* func_name, 15985 void GLES2DecoderImpl::ProduceTextureRef(const char* func_name,
15829 bool clear, 15986 bool clear,
15830 TextureRef* texture_ref, 15987 TextureRef* texture_ref,
15831 GLenum target, 15988 GLenum target,
15832 const GLbyte* data) { 15989 const volatile GLbyte* data) {
15833 Mailbox mailbox = *reinterpret_cast<const Mailbox*>(data); 15990 Mailbox mailbox =
15991 Mailbox::FromVolatile(*reinterpret_cast<const volatile Mailbox*>(data));
15834 DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a " 15992 DLOG_IF(ERROR, !mailbox.Verify()) << func_name << " was passed a "
15835 "mailbox that was not generated by " 15993 "mailbox that was not generated by "
15836 "GenMailboxCHROMIUM."; 15994 "GenMailboxCHROMIUM.";
15837 15995
15838 if (clear) { 15996 if (clear) {
15839 DCHECK(!texture_ref); 15997 DCHECK(!texture_ref);
15840 15998
15841 group_->mailbox_manager()->ProduceTexture(mailbox, nullptr); 15999 group_->mailbox_manager()->ProduceTexture(mailbox, nullptr);
15842 return; 16000 return;
15843 } 16001 }
(...skipping 14 matching lines...) Expand all
15858 if (produced->target() != target) { 16016 if (produced->target() != target) {
15859 LOCAL_SET_GL_ERROR( 16017 LOCAL_SET_GL_ERROR(
15860 GL_INVALID_OPERATION, func_name, "invalid target"); 16018 GL_INVALID_OPERATION, func_name, "invalid target");
15861 return; 16019 return;
15862 } 16020 }
15863 16021
15864 group_->mailbox_manager()->ProduceTexture(mailbox, produced); 16022 group_->mailbox_manager()->ProduceTexture(mailbox, produced);
15865 } 16023 }
15866 16024
15867 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, 16025 void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
15868 const GLbyte* data) { 16026 const volatile GLbyte* data) {
15869 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM", 16027 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoConsumeTextureCHROMIUM",
15870 "context", logger_.GetLogPrefix(), 16028 "context", logger_.GetLogPrefix(),
15871 "mailbox[0]", static_cast<unsigned char>(data[0])); 16029 "mailbox[0]", static_cast<unsigned char>(data[0]));
15872 Mailbox mailbox = *reinterpret_cast<const Mailbox*>(data); 16030 Mailbox mailbox =
16031 Mailbox::FromVolatile(*reinterpret_cast<const volatile Mailbox*>(data));
15873 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " 16032 DLOG_IF(ERROR, !mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a "
15874 "mailbox that was not generated by " 16033 "mailbox that was not generated by "
15875 "GenMailboxCHROMIUM."; 16034 "GenMailboxCHROMIUM.";
15876 16035
15877 scoped_refptr<TextureRef> texture_ref = 16036 scoped_refptr<TextureRef> texture_ref =
15878 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); 16037 texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target);
15879 if (!texture_ref.get()) { 16038 if (!texture_ref.get()) {
15880 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 16039 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
15881 "glConsumeTextureCHROMIUM", 16040 "glConsumeTextureCHROMIUM",
15882 "unknown texture for target"); 16041 "unknown texture for target");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
15920 GLuint service_id; 16079 GLuint service_id;
15921 glGenTextures(1, &service_id); 16080 glGenTextures(1, &service_id);
15922 DCHECK_NE(0u, service_id); 16081 DCHECK_NE(0u, service_id);
15923 texture_ref = CreateTexture(client_id, service_id); 16082 texture_ref = CreateTexture(client_id, service_id);
15924 texture_manager()->SetTarget(texture_ref, target); 16083 texture_manager()->SetTarget(texture_ref, target);
15925 glBindTexture(target, service_id); 16084 glBindTexture(target, service_id);
15926 RestoreCurrentTextureBindings(&state_, target); 16085 RestoreCurrentTextureBindings(&state_, target);
15927 } 16086 }
15928 } 16087 }
15929 16088
15930 void GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL(GLenum target, 16089 void GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL(
15931 GLuint client_id, 16090 GLenum target,
15932 const GLbyte* data) { 16091 GLuint client_id,
16092 const volatile GLbyte* data) {
15933 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL", 16093 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL",
15934 "context", logger_.GetLogPrefix(), 16094 "context", logger_.GetLogPrefix(),
15935 "mailbox[0]", static_cast<unsigned char>(data[0])); 16095 "mailbox[0]", static_cast<unsigned char>(data[0]));
15936 Mailbox mailbox = *reinterpret_cast<const Mailbox*>(data); 16096 Mailbox mailbox =
16097 Mailbox::FromVolatile(*reinterpret_cast<const volatile Mailbox*>(data));
15937 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was " 16098 DLOG_IF(ERROR, !mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was "
15938 "passed a mailbox that was not " 16099 "passed a mailbox that was not "
15939 "generated by GenMailboxCHROMIUM."; 16100 "generated by GenMailboxCHROMIUM.";
15940 16101
15941 TextureRef* texture_ref = GetTexture(client_id); 16102 TextureRef* texture_ref = GetTexture(client_id);
15942 if (texture_ref) { 16103 if (texture_ref) {
15943 // No need to call EnsureTextureForClientId here, the client_id already has 16104 // No need to call EnsureTextureForClientId here, the client_id already has
15944 // an associated texture. 16105 // an associated texture.
15945 LOCAL_SET_GL_ERROR( 16106 LOCAL_SET_GL_ERROR(
15946 GL_INVALID_OPERATION, 16107 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, 16259 texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0,
16099 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); 16260 GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect());
16100 } 16261 }
16101 16262
16102 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr, 16263 texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr,
16103 Texture::UNBOUND); 16264 Texture::UNBOUND);
16104 } 16265 }
16105 16266
16106 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( 16267 error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
16107 uint32_t immediate_data_size, 16268 uint32_t immediate_data_size,
16108 const void* cmd_data) { 16269 const volatile void* cmd_data) {
16109 const gles2::cmds::TraceBeginCHROMIUM& c = 16270 const volatile gles2::cmds::TraceBeginCHROMIUM& c =
16110 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); 16271 *static_cast<const volatile gles2::cmds::TraceBeginCHROMIUM*>(cmd_data);
16111 Bucket* category_bucket = GetBucket(c.category_bucket_id); 16272 Bucket* category_bucket = GetBucket(c.category_bucket_id);
16112 Bucket* name_bucket = GetBucket(c.name_bucket_id); 16273 Bucket* name_bucket = GetBucket(c.name_bucket_id);
16113 if (!category_bucket || category_bucket->size() == 0 || 16274 if (!category_bucket || category_bucket->size() == 0 ||
16114 !name_bucket || name_bucket->size() == 0) { 16275 !name_bucket || name_bucket->size() == 0) {
16115 return error::kInvalidArguments; 16276 return error::kInvalidArguments;
16116 } 16277 }
16117 16278
16118 std::string category_name; 16279 std::string category_name;
16119 std::string trace_name; 16280 std::string trace_name;
16120 if (!category_bucket->GetAsString(&category_name) || 16281 if (!category_bucket->GetAsString(&category_name) ||
(...skipping 13 matching lines...) Expand all
16134 16295
16135 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { 16296 void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
16136 debug_marker_manager_.PopGroup(); 16297 debug_marker_manager_.PopGroup();
16137 if (!gpu_tracer_->End(kTraceCHROMIUM)) { 16298 if (!gpu_tracer_->End(kTraceCHROMIUM)) {
16138 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, 16299 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
16139 "glTraceEndCHROMIUM", "no trace begin found"); 16300 "glTraceEndCHROMIUM", "no trace begin found");
16140 return; 16301 return;
16141 } 16302 }
16142 } 16303 }
16143 16304
16144 void GLES2DecoderImpl::DoDrawBuffersEXT( 16305 void GLES2DecoderImpl::DoDrawBuffersEXT(GLsizei count,
16145 GLsizei count, const GLenum* bufs) { 16306 const volatile GLenum* bufs) {
16146 DCHECK_LE(group_->max_draw_buffers(), 16u); 16307 DCHECK_LE(group_->max_draw_buffers(), 16u);
16147 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { 16308 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) {
16148 LOCAL_SET_GL_ERROR( 16309 LOCAL_SET_GL_ERROR(
16149 GL_INVALID_VALUE, 16310 GL_INVALID_VALUE,
16150 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT"); 16311 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT");
16151 return; 16312 return;
16152 } 16313 }
16153 16314
16154 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); 16315 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
16155 if (framebuffer) { 16316 if (framebuffer) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
16196 void GLES2DecoderImpl::DoFlushDriverCachesCHROMIUM(void) { 16357 void GLES2DecoderImpl::DoFlushDriverCachesCHROMIUM(void) {
16197 // On Adreno Android devices we need to use a workaround to force caches to 16358 // On Adreno Android devices we need to use a workaround to force caches to
16198 // clear. 16359 // clear.
16199 if (feature_info_->workarounds().unbind_egl_context_to_flush_driver_caches) { 16360 if (feature_info_->workarounds().unbind_egl_context_to_flush_driver_caches) {
16200 context_->ReleaseCurrent(nullptr); 16361 context_->ReleaseCurrent(nullptr);
16201 context_->MakeCurrent(surface_.get()); 16362 context_->MakeCurrent(surface_.get());
16202 } 16363 }
16203 } 16364 }
16204 16365
16205 void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode, 16366 void GLES2DecoderImpl::DoMatrixLoadfCHROMIUM(GLenum matrix_mode,
16206 const GLfloat* matrix) { 16367 const volatile GLfloat* matrix) {
16207 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || 16368 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM ||
16208 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); 16369 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM);
16209 16370
16210 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM 16371 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM
16211 ? state_.projection_matrix 16372 ? state_.projection_matrix
16212 : state_.modelview_matrix; 16373 : state_.modelview_matrix;
16213 memcpy(target_matrix, matrix, sizeof(GLfloat) * 16); 16374 std::copy(matrix, matrix + 16, target_matrix);
no sievers 2016/09/02 21:17:34 likewise
piman 2016/09/02 23:11:06 ditto.
16214 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV 16375 // 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. 16376 // since the values of the _NV and _CHROMIUM tokens match.
16216 glMatrixLoadfEXT(matrix_mode, target_matrix); 16377 glMatrixLoadfEXT(matrix_mode, target_matrix);
16217 } 16378 }
16218 16379
16219 void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode) { 16380 void GLES2DecoderImpl::DoMatrixLoadIdentityCHROMIUM(GLenum matrix_mode) {
16220 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM || 16381 DCHECK(matrix_mode == GL_PATH_PROJECTION_CHROMIUM ||
16221 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM); 16382 matrix_mode == GL_PATH_MODELVIEW_CHROMIUM);
16222 16383
16223 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM 16384 GLfloat* target_matrix = matrix_mode == GL_PATH_PROJECTION_CHROMIUM
16224 ? state_.projection_matrix 16385 ? state_.projection_matrix
16225 : state_.modelview_matrix; 16386 : state_.modelview_matrix;
16226 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix)); 16387 memcpy(target_matrix, kIdentityMatrix, sizeof(kIdentityMatrix));
16227 // The matrix_mode is either GL_PATH_MODELVIEW_NV or GL_PATH_PROJECTION_NV 16388 // 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. 16389 // since the values of the _NV and _CHROMIUM tokens match.
16229 glMatrixLoadIdentityEXT(matrix_mode); 16390 glMatrixLoadIdentityEXT(matrix_mode);
16230 } 16391 }
16231 16392
16232 error::Error GLES2DecoderImpl::HandleUniformBlockBinding( 16393 error::Error GLES2DecoderImpl::HandleUniformBlockBinding(
16233 uint32_t immediate_data_size, const void* cmd_data) { 16394 uint32_t immediate_data_size,
16395 const volatile void* cmd_data) {
16234 const char* func_name = "glUniformBlockBinding"; 16396 const char* func_name = "glUniformBlockBinding";
16235 if (!unsafe_es3_apis_enabled()) 16397 if (!unsafe_es3_apis_enabled())
16236 return error::kUnknownCommand; 16398 return error::kUnknownCommand;
16237 const gles2::cmds::UniformBlockBinding& c = 16399 const volatile gles2::cmds::UniformBlockBinding& c =
16238 *static_cast<const gles2::cmds::UniformBlockBinding*>(cmd_data); 16400 *static_cast<const volatile gles2::cmds::UniformBlockBinding*>(cmd_data);
16239 GLuint client_id = c.program; 16401 GLuint client_id = c.program;
16240 GLuint index = static_cast<GLuint>(c.index); 16402 GLuint index = static_cast<GLuint>(c.index);
16241 GLuint binding = static_cast<GLuint>(c.binding); 16403 GLuint binding = static_cast<GLuint>(c.binding);
16242 Program* program = GetProgramInfoNotShader(client_id, func_name); 16404 Program* program = GetProgramInfoNotShader(client_id, func_name);
16243 if (!program) { 16405 if (!program) {
16244 return error::kNoError; 16406 return error::kNoError;
16245 } 16407 }
16246 if (index >= program->uniform_block_size_info().size()) { 16408 if (index >= program->uniform_block_size_info().size()) {
16247 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, 16409 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name,
16248 "uniformBlockIndex is not an active uniform block index"); 16410 "uniformBlockIndex is not an active uniform block index");
16249 return error::kNoError; 16411 return error::kNoError;
16250 } 16412 }
16251 if (binding >= group_->max_uniform_buffer_bindings()) { 16413 if (binding >= group_->max_uniform_buffer_bindings()) {
16252 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name, 16414 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, func_name,
16253 "uniformBlockBinding >= MAX_UNIFORM_BUFFER_BINDINGS"); 16415 "uniformBlockBinding >= MAX_UNIFORM_BUFFER_BINDINGS");
16254 return error::kNoError; 16416 return error::kNoError;
16255 } 16417 }
16256 GLuint service_id = program->service_id(); 16418 GLuint service_id = program->service_id();
16257 glUniformBlockBinding(service_id, index, binding); 16419 glUniformBlockBinding(service_id, index, binding);
16258 program->SetUniformBlockBinding(index, binding); 16420 program->SetUniformBlockBinding(index, binding);
16259 return error::kNoError; 16421 return error::kNoError;
16260 } 16422 }
16261 16423
16262 error::Error GLES2DecoderImpl::HandleClientWaitSync( 16424 error::Error GLES2DecoderImpl::HandleClientWaitSync(
16263 uint32_t immediate_data_size, const void* cmd_data) { 16425 uint32_t immediate_data_size,
16426 const volatile void* cmd_data) {
16264 const char* function_name = "glClientWaitSync"; 16427 const char* function_name = "glClientWaitSync";
16265 if (!unsafe_es3_apis_enabled()) 16428 if (!unsafe_es3_apis_enabled())
16266 return error::kUnknownCommand; 16429 return error::kUnknownCommand;
16267 const gles2::cmds::ClientWaitSync& c = 16430 const volatile gles2::cmds::ClientWaitSync& c =
16268 *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); 16431 *static_cast<const volatile gles2::cmds::ClientWaitSync*>(cmd_data);
16269 const GLuint sync = static_cast<GLuint>(c.sync); 16432 const GLuint sync = static_cast<GLuint>(c.sync);
16270 GLbitfield flags = static_cast<GLbitfield>(c.flags); 16433 GLbitfield flags = static_cast<GLbitfield>(c.flags);
16271 const GLuint64 timeout = c.timeout(); 16434 const GLuint64 timeout = c.timeout();
16272 typedef cmds::ClientWaitSync::Result Result; 16435 typedef cmds::ClientWaitSync::Result Result;
16273 Result* result_dst = GetSharedMemoryAs<Result*>( 16436 Result* result_dst = GetSharedMemoryAs<Result*>(
16274 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 16437 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
16275 if (!result_dst) { 16438 if (!result_dst) {
16276 return error::kOutOfBounds; 16439 return error::kOutOfBounds;
16277 } 16440 }
16278 if (*result_dst != GL_WAIT_FAILED) { 16441 if (*result_dst != GL_WAIT_FAILED) {
(...skipping 22 matching lines...) Expand all
16301 LOCAL_PEEK_GL_ERROR(function_name); 16464 LOCAL_PEEK_GL_ERROR(function_name);
16302 break; 16465 break;
16303 default: 16466 default:
16304 NOTREACHED(); 16467 NOTREACHED();
16305 break; 16468 break;
16306 } 16469 }
16307 *result_dst = status; 16470 *result_dst = status;
16308 return error::kNoError; 16471 return error::kNoError;
16309 } 16472 }
16310 16473
16311 error::Error GLES2DecoderImpl::HandleWaitSync( 16474 error::Error GLES2DecoderImpl::HandleWaitSync(uint32_t immediate_data_size,
16312 uint32_t immediate_data_size, const void* cmd_data) { 16475 const volatile void* cmd_data) {
16313 const char* function_name = "glWaitSync"; 16476 const char* function_name = "glWaitSync";
16314 if (!unsafe_es3_apis_enabled()) 16477 if (!unsafe_es3_apis_enabled())
16315 return error::kUnknownCommand; 16478 return error::kUnknownCommand;
16316 const gles2::cmds::WaitSync& c = 16479 const volatile gles2::cmds::WaitSync& c =
16317 *static_cast<const gles2::cmds::WaitSync*>(cmd_data); 16480 *static_cast<const volatile gles2::cmds::WaitSync*>(cmd_data);
16318 const GLuint sync = static_cast<GLuint>(c.sync); 16481 const GLuint sync = static_cast<GLuint>(c.sync);
16319 const GLbitfield flags = static_cast<GLbitfield>(c.flags); 16482 const GLbitfield flags = static_cast<GLbitfield>(c.flags);
16320 const GLuint64 timeout = c.timeout(); 16483 const GLuint64 timeout = c.timeout();
16321 GLsync service_sync = 0; 16484 GLsync service_sync = 0;
16322 if (!group_->GetSyncServiceId(sync, &service_sync)) { 16485 if (!group_->GetSyncServiceId(sync, &service_sync)) {
16323 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid sync"); 16486 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid sync");
16324 return error::kNoError; 16487 return error::kNoError;
16325 } 16488 }
16326 if (flags != 0) { 16489 if (flags != 0) {
16327 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags"); 16490 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags");
(...skipping 14 matching lines...) Expand all
16342 return 0; 16505 return 0;
16343 } 16506 }
16344 if (flags != 0) { 16507 if (flags != 0) {
16345 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags"); 16508 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid flags");
16346 return 0; 16509 return 0;
16347 } 16510 }
16348 return glFenceSync(condition, flags); 16511 return glFenceSync(condition, flags);
16349 } 16512 }
16350 16513
16351 error::Error GLES2DecoderImpl::HandleGetInternalformativ( 16514 error::Error GLES2DecoderImpl::HandleGetInternalformativ(
16352 uint32_t immediate_data_size, const void* cmd_data) { 16515 uint32_t immediate_data_size,
16516 const volatile void* cmd_data) {
16353 if (!unsafe_es3_apis_enabled()) 16517 if (!unsafe_es3_apis_enabled())
16354 return error::kUnknownCommand; 16518 return error::kUnknownCommand;
16355 const gles2::cmds::GetInternalformativ& c = 16519 const volatile gles2::cmds::GetInternalformativ& c =
16356 *static_cast<const gles2::cmds::GetInternalformativ*>(cmd_data); 16520 *static_cast<const volatile gles2::cmds::GetInternalformativ*>(cmd_data);
16357 GLenum target = static_cast<GLenum>(c.target); 16521 GLenum target = static_cast<GLenum>(c.target);
16358 GLenum format = static_cast<GLenum>(c.format); 16522 GLenum format = static_cast<GLenum>(c.format);
16359 GLenum pname = static_cast<GLenum>(c.pname); 16523 GLenum pname = static_cast<GLenum>(c.pname);
16360 if (!validators_->render_buffer_target.IsValid(target)) { 16524 if (!validators_->render_buffer_target.IsValid(target)) {
16361 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", target, "target"); 16525 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", target, "target");
16362 return error::kNoError; 16526 return error::kNoError;
16363 } 16527 }
16364 if (!validators_->render_buffer_format.IsValid(format)) { 16528 if (!validators_->render_buffer_format.IsValid(format)) {
16365 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", format, "format"); 16529 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", format, "format");
16366 return error::kNoError; 16530 return error::kNoError;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
16436 break; 16600 break;
16437 } 16601 }
16438 } else { 16602 } else {
16439 glGetInternalformativ(target, format, pname, num_values, params); 16603 glGetInternalformativ(target, format, pname, num_values, params);
16440 } 16604 }
16441 result->SetNumResults(num_values); 16605 result->SetNumResults(num_values);
16442 return error::kNoError; 16606 return error::kNoError;
16443 } 16607 }
16444 16608
16445 error::Error GLES2DecoderImpl::HandleMapBufferRange( 16609 error::Error GLES2DecoderImpl::HandleMapBufferRange(
16446 uint32_t immediate_data_size, const void* cmd_data) { 16610 uint32_t immediate_data_size,
16611 const volatile void* cmd_data) {
16447 if (!unsafe_es3_apis_enabled()) { 16612 if (!unsafe_es3_apis_enabled()) {
16448 return error::kUnknownCommand; 16613 return error::kUnknownCommand;
16449 } 16614 }
16450 const gles2::cmds::MapBufferRange& c = 16615 const volatile gles2::cmds::MapBufferRange& c =
16451 *static_cast<const gles2::cmds::MapBufferRange*>(cmd_data); 16616 *static_cast<const volatile gles2::cmds::MapBufferRange*>(cmd_data);
16452 GLenum target = static_cast<GLenum>(c.target); 16617 GLenum target = static_cast<GLenum>(c.target);
16453 GLbitfield access = static_cast<GLbitfield>(c.access); 16618 GLbitfield access = static_cast<GLbitfield>(c.access);
16454 GLintptr offset = static_cast<GLintptr>(c.offset); 16619 GLintptr offset = static_cast<GLintptr>(c.offset);
16455 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); 16620 GLsizeiptr size = static_cast<GLsizeiptr>(c.size);
16456 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); 16621 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id);
16457 16622
16458 typedef cmds::MapBufferRange::Result Result; 16623 typedef cmds::MapBufferRange::Result Result;
16459 Result* result = GetSharedMemoryAs<Result*>( 16624 Result* result = GetSharedMemoryAs<Result*>(
16460 c.result_shm_id, c.result_shm_offset, sizeof(*result)); 16625 c.result_shm_id, c.result_shm_offset, sizeof(*result));
16461 if (!result) { 16626 if (!result) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
16505 buffer->SetMappedRange(offset, size, access, ptr, 16670 buffer->SetMappedRange(offset, size, access, ptr,
16506 GetSharedMemoryBuffer(data_shm_id)); 16671 GetSharedMemoryBuffer(data_shm_id));
16507 if ((access & GL_MAP_INVALIDATE_RANGE_BIT) == 0) { 16672 if ((access & GL_MAP_INVALIDATE_RANGE_BIT) == 0) {
16508 memcpy(mem, ptr, size); 16673 memcpy(mem, ptr, size);
16509 } 16674 }
16510 *result = 1; 16675 *result = 1;
16511 return error::kNoError; 16676 return error::kNoError;
16512 } 16677 }
16513 16678
16514 error::Error GLES2DecoderImpl::HandleUnmapBuffer( 16679 error::Error GLES2DecoderImpl::HandleUnmapBuffer(
16515 uint32_t immediate_data_size, const void* cmd_data) { 16680 uint32_t immediate_data_size,
16681 const volatile void* cmd_data) {
16516 if (!unsafe_es3_apis_enabled()) { 16682 if (!unsafe_es3_apis_enabled()) {
16517 return error::kUnknownCommand; 16683 return error::kUnknownCommand;
16518 } 16684 }
16519 const gles2::cmds::UnmapBuffer& c = 16685 const volatile gles2::cmds::UnmapBuffer& c =
16520 *static_cast<const gles2::cmds::UnmapBuffer*>(cmd_data); 16686 *static_cast<const volatile gles2::cmds::UnmapBuffer*>(cmd_data);
16521 GLenum target = static_cast<GLenum>(c.target); 16687 GLenum target = static_cast<GLenum>(c.target);
16522 16688
16523 if (!validators_->buffer_target.IsValid(target)) { 16689 if (!validators_->buffer_target.IsValid(target)) {
16524 LOCAL_SET_GL_ERROR_INVALID_ENUM("glMapBufferRange", target, "target"); 16690 LOCAL_SET_GL_ERROR_INVALID_ENUM("glMapBufferRange", target, "target");
16525 return error::kNoError; 16691 return error::kNoError;
16526 } 16692 }
16527 16693
16528 Buffer* buffer = buffer_manager()->GetBufferInfoForTarget(&state_, target); 16694 Buffer* buffer = buffer_manager()->GetBufferInfoForTarget(&state_, target);
16529 if (!buffer) { 16695 if (!buffer) {
16530 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "UnmapBuffer", "no buffer bound"); 16696 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "UnmapBuffer", "no buffer bound");
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
16815 } 16981 }
16816 GLES2DecoderImpl* decoder_; 16982 GLES2DecoderImpl* decoder_;
16817 ErrorState* error_state_; 16983 ErrorState* error_state_;
16818 const Validators* validators_; 16984 const Validators* validators_;
16819 const char* function_name_; 16985 const char* function_name_;
16820 error::Error error_; 16986 error::Error error_;
16821 }; 16987 };
16822 16988
16823 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM( 16989 error::Error GLES2DecoderImpl::HandleGenPathsCHROMIUM(
16824 uint32_t immediate_data_size, 16990 uint32_t immediate_data_size,
16825 const void* cmd_data) { 16991 const volatile void* cmd_data) {
16826 const gles2::cmds::GenPathsCHROMIUM& c = 16992 const volatile gles2::cmds::GenPathsCHROMIUM& c =
16827 *static_cast<const gles2::cmds::GenPathsCHROMIUM*>(cmd_data); 16993 *static_cast<const volatile gles2::cmds::GenPathsCHROMIUM*>(cmd_data);
16828 if (!features().chromium_path_rendering) 16994 if (!features().chromium_path_rendering)
16829 return error::kUnknownCommand; 16995 return error::kUnknownCommand;
16830 16996
16831 PathCommandValidatorContext v(this, "glGenPathsCHROMIUM"); 16997 PathCommandValidatorContext v(this, "glGenPathsCHROMIUM");
16832 GLsizei range = 0; 16998 GLsizei range = 0;
16833 if (!v.GetPathRange(c, &range)) 16999 if (!v.GetPathRange(c, &range))
16834 return v.error(); 17000 return v.error();
16835 17001
16836 GLuint first_client_id = static_cast<GLuint>(c.first_client_id); 17002 GLuint first_client_id = static_cast<GLuint>(c.first_client_id);
16837 if (first_client_id == 0) 17003 if (first_client_id == 0)
16838 return error::kInvalidArguments; 17004 return error::kInvalidArguments;
16839 17005
16840 if (range == 0) 17006 if (range == 0)
16841 return error::kNoError; 17007 return error::kNoError;
16842 17008
16843 if (!GenPathsCHROMIUMHelper(first_client_id, range)) 17009 if (!GenPathsCHROMIUMHelper(first_client_id, range))
16844 return error::kInvalidArguments; 17010 return error::kInvalidArguments;
16845 17011
16846 return error::kNoError; 17012 return error::kNoError;
16847 } 17013 }
16848 error::Error GLES2DecoderImpl::HandleDeletePathsCHROMIUM( 17014 error::Error GLES2DecoderImpl::HandleDeletePathsCHROMIUM(
16849 uint32_t immediate_data_size, 17015 uint32_t immediate_data_size,
16850 const void* cmd_data) { 17016 const volatile void* cmd_data) {
16851 const gles2::cmds::DeletePathsCHROMIUM& c = 17017 const volatile gles2::cmds::DeletePathsCHROMIUM& c =
16852 *static_cast<const gles2::cmds::DeletePathsCHROMIUM*>(cmd_data); 17018 *static_cast<const volatile gles2::cmds::DeletePathsCHROMIUM*>(cmd_data);
16853 if (!features().chromium_path_rendering) 17019 if (!features().chromium_path_rendering)
16854 return error::kUnknownCommand; 17020 return error::kUnknownCommand;
16855 17021
16856 PathCommandValidatorContext v(this, "glDeletePathsCHROMIUM"); 17022 PathCommandValidatorContext v(this, "glDeletePathsCHROMIUM");
16857 GLsizei range = 0; 17023 GLsizei range = 0;
16858 if (!v.GetPathRange(c, &range)) 17024 if (!v.GetPathRange(c, &range))
16859 return v.error(); 17025 return v.error();
16860 17026
16861 if (range == 0) 17027 if (range == 0)
16862 return error::kNoError; 17028 return error::kNoError;
16863 17029
16864 GLuint first_client_id = c.first_client_id; 17030 GLuint first_client_id = c.first_client_id;
16865 // first_client_id can be 0, because non-existing path ids are skipped. 17031 // first_client_id can be 0, because non-existing path ids are skipped.
16866 17032
16867 if (!DeletePathsCHROMIUMHelper(first_client_id, range)) 17033 if (!DeletePathsCHROMIUMHelper(first_client_id, range))
16868 return error::kInvalidArguments; 17034 return error::kInvalidArguments;
16869 17035
16870 return error::kNoError; 17036 return error::kNoError;
16871 } 17037 }
16872 17038
16873 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM( 17039 error::Error GLES2DecoderImpl::HandlePathCommandsCHROMIUM(
16874 uint32_t immediate_data_size, 17040 uint32_t immediate_data_size,
16875 const void* cmd_data) { 17041 const volatile void* cmd_data) {
16876 static const char kFunctionName[] = "glPathCommandsCHROMIUM"; 17042 static const char kFunctionName[] = "glPathCommandsCHROMIUM";
16877 const gles2::cmds::PathCommandsCHROMIUM& c = 17043 const volatile gles2::cmds::PathCommandsCHROMIUM& c =
16878 *static_cast<const gles2::cmds::PathCommandsCHROMIUM*>(cmd_data); 17044 *static_cast<const volatile gles2::cmds::PathCommandsCHROMIUM*>(cmd_data);
16879 if (!features().chromium_path_rendering) 17045 if (!features().chromium_path_rendering)
16880 return error::kUnknownCommand; 17046 return error::kUnknownCommand;
16881 17047
16882 GLuint service_id = 0; 17048 GLuint service_id = 0;
16883 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17049 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
16884 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 17050 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
16885 "invalid path name"); 17051 "invalid path name");
16886 return error::kNoError; 17052 return error::kNoError;
16887 } 17053 }
16888 17054
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
16974 } 17140 }
16975 17141
16976 glPathCommandsNV(service_id, num_commands, commands.get(), num_coords, 17142 glPathCommandsNV(service_id, num_commands, commands.get(), num_coords,
16977 coord_type, coords); 17143 coord_type, coords);
16978 17144
16979 return error::kNoError; 17145 return error::kNoError;
16980 } 17146 }
16981 17147
16982 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM( 17148 error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM(
16983 uint32_t immediate_data_size, 17149 uint32_t immediate_data_size,
16984 const void* cmd_data) { 17150 const volatile void* cmd_data) {
16985 static const char kFunctionName[] = "glPathParameterfCHROMIUM"; 17151 static const char kFunctionName[] = "glPathParameterfCHROMIUM";
16986 const gles2::cmds::PathParameterfCHROMIUM& c = 17152 const volatile gles2::cmds::PathParameterfCHROMIUM& c =
16987 *static_cast<const gles2::cmds::PathParameterfCHROMIUM*>(cmd_data); 17153 *static_cast<const volatile gles2::cmds::PathParameterfCHROMIUM*>(
17154 cmd_data);
16988 if (!features().chromium_path_rendering) 17155 if (!features().chromium_path_rendering)
16989 return error::kUnknownCommand; 17156 return error::kUnknownCommand;
16990 17157
16991 GLuint service_id = 0; 17158 GLuint service_id = 0;
16992 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17159 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
16993 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 17160 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
16994 "invalid path name"); 17161 "invalid path name");
16995 return error::kNoError; 17162 return error::kNoError;
16996 } 17163 }
16997 17164
(...skipping 28 matching lines...) Expand all
17026 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); 17193 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct");
17027 return error::kNoError; 17194 return error::kNoError;
17028 } 17195 }
17029 17196
17030 glPathParameterfNV(service_id, pname, value); 17197 glPathParameterfNV(service_id, pname, value);
17031 return error::kNoError; 17198 return error::kNoError;
17032 } 17199 }
17033 17200
17034 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM( 17201 error::Error GLES2DecoderImpl::HandlePathParameteriCHROMIUM(
17035 uint32_t immediate_data_size, 17202 uint32_t immediate_data_size,
17036 const void* cmd_data) { 17203 const volatile void* cmd_data) {
17037 static const char kFunctionName[] = "glPathParameteriCHROMIUM"; 17204 static const char kFunctionName[] = "glPathParameteriCHROMIUM";
17038 const gles2::cmds::PathParameteriCHROMIUM& c = 17205 const volatile gles2::cmds::PathParameteriCHROMIUM& c =
17039 *static_cast<const gles2::cmds::PathParameteriCHROMIUM*>(cmd_data); 17206 *static_cast<const volatile gles2::cmds::PathParameteriCHROMIUM*>(
17207 cmd_data);
17040 if (!features().chromium_path_rendering) 17208 if (!features().chromium_path_rendering)
17041 return error::kUnknownCommand; 17209 return error::kUnknownCommand;
17042 17210
17043 GLuint service_id = 0; 17211 GLuint service_id = 0;
17044 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17212 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
17045 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 17213 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
17046 "invalid path name"); 17214 "invalid path name");
17047 return error::kNoError; 17215 return error::kNoError;
17048 } 17216 }
17049 17217
(...skipping 26 matching lines...) Expand all
17076 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct"); 17244 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "value not correct");
17077 return error::kNoError; 17245 return error::kNoError;
17078 } 17246 }
17079 17247
17080 glPathParameteriNV(service_id, pname, value); 17248 glPathParameteriNV(service_id, pname, value);
17081 return error::kNoError; 17249 return error::kNoError;
17082 } 17250 }
17083 17251
17084 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM( 17252 error::Error GLES2DecoderImpl::HandleStencilFillPathCHROMIUM(
17085 uint32_t immediate_data_size, 17253 uint32_t immediate_data_size,
17086 const void* cmd_data) { 17254 const volatile void* cmd_data) {
17087 static const char kFunctionName[] = "glStencilFillPathCHROMIUM"; 17255 static const char kFunctionName[] = "glStencilFillPathCHROMIUM";
17088 const gles2::cmds::StencilFillPathCHROMIUM& c = 17256 const volatile gles2::cmds::StencilFillPathCHROMIUM& c =
17089 *static_cast<const gles2::cmds::StencilFillPathCHROMIUM*>(cmd_data); 17257 *static_cast<const volatile gles2::cmds::StencilFillPathCHROMIUM*>(
17258 cmd_data);
17090 if (!features().chromium_path_rendering) 17259 if (!features().chromium_path_rendering)
17091 return error::kUnknownCommand; 17260 return error::kUnknownCommand;
17092 PathCommandValidatorContext v(this, kFunctionName); 17261 PathCommandValidatorContext v(this, kFunctionName);
17093 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17262 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17094 GLuint mask = 0; 17263 GLuint mask = 0;
17095 if (!v.GetFillModeAndMask(c, &fill_mode, &mask)) 17264 if (!v.GetFillModeAndMask(c, &fill_mode, &mask))
17096 return v.error(); 17265 return v.error();
17097 GLuint service_id = 0; 17266 GLuint service_id = 0;
17098 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17267 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
17099 // "If /path/ does not name an existing path object, the command does 17268 // "If /path/ does not name an existing path object, the command does
17100 // nothing (and no error is generated)." 17269 // nothing (and no error is generated)."
17101 // This holds for other rendering functions, too. 17270 // This holds for other rendering functions, too.
17102 return error::kNoError; 17271 return error::kNoError;
17103 } 17272 }
17104 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17273 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17105 return error::kNoError; 17274 return error::kNoError;
17106 ApplyDirtyState(); 17275 ApplyDirtyState();
17107 glStencilFillPathNV(service_id, fill_mode, mask); 17276 glStencilFillPathNV(service_id, fill_mode, mask);
17108 return error::kNoError; 17277 return error::kNoError;
17109 } 17278 }
17110 17279
17111 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM( 17280 error::Error GLES2DecoderImpl::HandleStencilStrokePathCHROMIUM(
17112 uint32_t immediate_data_size, 17281 uint32_t immediate_data_size,
17113 const void* cmd_data) { 17282 const volatile void* cmd_data) {
17114 static const char kFunctionName[] = "glStencilStrokePathCHROMIUM"; 17283 static const char kFunctionName[] = "glStencilStrokePathCHROMIUM";
17115 const gles2::cmds::StencilStrokePathCHROMIUM& c = 17284 const volatile gles2::cmds::StencilStrokePathCHROMIUM& c =
17116 *static_cast<const gles2::cmds::StencilStrokePathCHROMIUM*>(cmd_data); 17285 *static_cast<const volatile gles2::cmds::StencilStrokePathCHROMIUM*>(
17286 cmd_data);
17117 if (!features().chromium_path_rendering) 17287 if (!features().chromium_path_rendering)
17118 return error::kUnknownCommand; 17288 return error::kUnknownCommand;
17119 17289
17120 GLuint service_id = 0; 17290 GLuint service_id = 0;
17121 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { 17291 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) {
17122 return error::kNoError; 17292 return error::kNoError;
17123 } 17293 }
17124 GLint reference = static_cast<GLint>(c.reference); 17294 GLint reference = static_cast<GLint>(c.reference);
17125 GLuint mask = static_cast<GLuint>(c.mask); 17295 GLuint mask = static_cast<GLuint>(c.mask);
17126 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17296 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17127 return error::kNoError; 17297 return error::kNoError;
17128 ApplyDirtyState(); 17298 ApplyDirtyState();
17129 glStencilStrokePathNV(service_id, reference, mask); 17299 glStencilStrokePathNV(service_id, reference, mask);
17130 return error::kNoError; 17300 return error::kNoError;
17131 } 17301 }
17132 17302
17133 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM( 17303 error::Error GLES2DecoderImpl::HandleCoverFillPathCHROMIUM(
17134 uint32_t immediate_data_size, 17304 uint32_t immediate_data_size,
17135 const void* cmd_data) { 17305 const volatile void* cmd_data) {
17136 static const char kFunctionName[] = "glCoverFillPathCHROMIUM"; 17306 static const char kFunctionName[] = "glCoverFillPathCHROMIUM";
17137 const gles2::cmds::CoverFillPathCHROMIUM& c = 17307 const volatile gles2::cmds::CoverFillPathCHROMIUM& c =
17138 *static_cast<const gles2::cmds::CoverFillPathCHROMIUM*>(cmd_data); 17308 *static_cast<const volatile gles2::cmds::CoverFillPathCHROMIUM*>(
17309 cmd_data);
17139 if (!features().chromium_path_rendering) 17310 if (!features().chromium_path_rendering)
17140 return error::kUnknownCommand; 17311 return error::kUnknownCommand;
17141 17312
17142 PathCommandValidatorContext v(this, kFunctionName); 17313 PathCommandValidatorContext v(this, kFunctionName);
17143 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17314 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17144 if (!v.GetCoverMode(c, &cover_mode)) 17315 if (!v.GetCoverMode(c, &cover_mode))
17145 return v.error(); 17316 return v.error();
17146 17317
17147 GLuint service_id = 0; 17318 GLuint service_id = 0;
17148 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17319 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17149 return error::kNoError; 17320 return error::kNoError;
17150 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17321 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17151 return error::kNoError; 17322 return error::kNoError;
17152 ApplyDirtyState(); 17323 ApplyDirtyState();
17153 glCoverFillPathNV(service_id, cover_mode); 17324 glCoverFillPathNV(service_id, cover_mode);
17154 return error::kNoError; 17325 return error::kNoError;
17155 } 17326 }
17156 17327
17157 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM( 17328 error::Error GLES2DecoderImpl::HandleCoverStrokePathCHROMIUM(
17158 uint32_t immediate_data_size, 17329 uint32_t immediate_data_size,
17159 const void* cmd_data) { 17330 const volatile void* cmd_data) {
17160 static const char kFunctionName[] = "glCoverStrokePathCHROMIUM"; 17331 static const char kFunctionName[] = "glCoverStrokePathCHROMIUM";
17161 const gles2::cmds::CoverStrokePathCHROMIUM& c = 17332 const volatile gles2::cmds::CoverStrokePathCHROMIUM& c =
17162 *static_cast<const gles2::cmds::CoverStrokePathCHROMIUM*>(cmd_data); 17333 *static_cast<const volatile gles2::cmds::CoverStrokePathCHROMIUM*>(
17334 cmd_data);
17163 if (!features().chromium_path_rendering) 17335 if (!features().chromium_path_rendering)
17164 return error::kUnknownCommand; 17336 return error::kUnknownCommand;
17165 17337
17166 PathCommandValidatorContext v(this, kFunctionName); 17338 PathCommandValidatorContext v(this, kFunctionName);
17167 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17339 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17168 if (!v.GetCoverMode(c, &cover_mode)) 17340 if (!v.GetCoverMode(c, &cover_mode))
17169 return v.error(); 17341 return v.error();
17170 17342
17171 GLuint service_id = 0; 17343 GLuint service_id = 0;
17172 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17344 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17173 return error::kNoError; 17345 return error::kNoError;
17174 17346
17175 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17347 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17176 return error::kNoError; 17348 return error::kNoError;
17177 ApplyDirtyState(); 17349 ApplyDirtyState();
17178 glCoverStrokePathNV(service_id, cover_mode); 17350 glCoverStrokePathNV(service_id, cover_mode);
17179 return error::kNoError; 17351 return error::kNoError;
17180 } 17352 }
17181 17353
17182 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathCHROMIUM( 17354 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathCHROMIUM(
17183 uint32_t immediate_data_size, 17355 uint32_t immediate_data_size,
17184 const void* cmd_data) { 17356 const volatile void* cmd_data) {
17185 static const char kFunctionName[] = "glStencilThenCoverFillPathCHROMIUM"; 17357 static const char kFunctionName[] = "glStencilThenCoverFillPathCHROMIUM";
17186 const gles2::cmds::StencilThenCoverFillPathCHROMIUM& c = 17358 const volatile gles2::cmds::StencilThenCoverFillPathCHROMIUM& c =
17187 *static_cast<const gles2::cmds::StencilThenCoverFillPathCHROMIUM*>( 17359 *static_cast<
17360 const volatile gles2::cmds::StencilThenCoverFillPathCHROMIUM*>(
17188 cmd_data); 17361 cmd_data);
17189 if (!features().chromium_path_rendering) 17362 if (!features().chromium_path_rendering)
17190 return error::kUnknownCommand; 17363 return error::kUnknownCommand;
17191 17364
17192 PathCommandValidatorContext v(this, kFunctionName); 17365 PathCommandValidatorContext v(this, kFunctionName);
17193 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17366 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17194 GLuint mask = 0; 17367 GLuint mask = 0;
17195 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17368 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17196 if (!v.GetFillModeAndMask(c, &fill_mode, &mask) || 17369 if (!v.GetFillModeAndMask(c, &fill_mode, &mask) ||
17197 !v.GetCoverMode(c, &cover_mode)) 17370 !v.GetCoverMode(c, &cover_mode))
17198 return v.error(); 17371 return v.error();
17199 17372
17200 GLuint service_id = 0; 17373 GLuint service_id = 0;
17201 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17374 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17202 return error::kNoError; 17375 return error::kNoError;
17203 17376
17204 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17377 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17205 return error::kNoError; 17378 return error::kNoError;
17206 ApplyDirtyState(); 17379 ApplyDirtyState();
17207 glStencilThenCoverFillPathNV(service_id, fill_mode, mask, cover_mode); 17380 glStencilThenCoverFillPathNV(service_id, fill_mode, mask, cover_mode);
17208 return error::kNoError; 17381 return error::kNoError;
17209 } 17382 }
17210 17383
17211 error::Error GLES2DecoderImpl::HandleStencilThenCoverStrokePathCHROMIUM( 17384 error::Error GLES2DecoderImpl::HandleStencilThenCoverStrokePathCHROMIUM(
17212 uint32_t immediate_data_size, 17385 uint32_t immediate_data_size,
17213 const void* cmd_data) { 17386 const volatile void* cmd_data) {
17214 static const char kFunctionName[] = "glStencilThenCoverStrokePathCHROMIUM"; 17387 static const char kFunctionName[] = "glStencilThenCoverStrokePathCHROMIUM";
17215 const gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c = 17388 const volatile gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c =
17216 *static_cast<const gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>( 17389 *static_cast<
17390 const volatile gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>(
17217 cmd_data); 17391 cmd_data);
17218 if (!features().chromium_path_rendering) 17392 if (!features().chromium_path_rendering)
17219 return error::kUnknownCommand; 17393 return error::kUnknownCommand;
17220 17394
17221 PathCommandValidatorContext v(this, kFunctionName); 17395 PathCommandValidatorContext v(this, kFunctionName);
17222 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM; 17396 GLenum cover_mode = GL_BOUNDING_BOX_CHROMIUM;
17223 if (!v.GetCoverMode(c, &cover_mode)) 17397 if (!v.GetCoverMode(c, &cover_mode))
17224 return v.error(); 17398 return v.error();
17225 17399
17226 GLuint service_id = 0; 17400 GLuint service_id = 0;
17227 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) 17401 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id))
17228 return error::kNoError; 17402 return error::kNoError;
17229 17403
17230 GLint reference = static_cast<GLint>(c.reference); 17404 GLint reference = static_cast<GLint>(c.reference);
17231 GLuint mask = static_cast<GLuint>(c.mask); 17405 GLuint mask = static_cast<GLuint>(c.mask);
17232 17406
17233 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17407 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17234 return error::kNoError; 17408 return error::kNoError;
17235 ApplyDirtyState(); 17409 ApplyDirtyState();
17236 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode); 17410 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode);
17237 return error::kNoError; 17411 return error::kNoError;
17238 } 17412 }
17239 17413
17240 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM( 17414 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM(
17241 uint32_t immediate_data_size, 17415 uint32_t immediate_data_size,
17242 const void* cmd_data) { 17416 const volatile void* cmd_data) {
17243 static const char kFunctionName[] = "glStencilFillPathInstancedCHROMIUM"; 17417 static const char kFunctionName[] = "glStencilFillPathInstancedCHROMIUM";
17244 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c = 17418 const volatile gles2::cmds::StencilFillPathInstancedCHROMIUM& c =
17245 *static_cast<const gles2::cmds::StencilFillPathInstancedCHROMIUM*>( 17419 *static_cast<
17420 const volatile gles2::cmds::StencilFillPathInstancedCHROMIUM*>(
17246 cmd_data); 17421 cmd_data);
17247 if (!features().chromium_path_rendering) 17422 if (!features().chromium_path_rendering)
17248 return error::kUnknownCommand; 17423 return error::kUnknownCommand;
17249 17424
17250 PathCommandValidatorContext v(this, kFunctionName); 17425 PathCommandValidatorContext v(this, kFunctionName);
17251 GLuint num_paths = 0; 17426 GLuint num_paths = 0;
17252 GLenum path_name_type = GL_NONE; 17427 GLenum path_name_type = GL_NONE;
17253 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17428 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17254 GLuint mask = 0; 17429 GLuint mask = 0;
17255 GLenum transform_type = GL_NONE; 17430 GLenum transform_type = GL_NONE;
(...skipping 16 matching lines...) Expand all
17272 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17447 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17273 return error::kNoError; 17448 return error::kNoError;
17274 ApplyDirtyState(); 17449 ApplyDirtyState();
17275 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17450 glStencilFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17276 fill_mode, mask, transform_type, transforms); 17451 fill_mode, mask, transform_type, transforms);
17277 return error::kNoError; 17452 return error::kNoError;
17278 } 17453 }
17279 17454
17280 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM( 17455 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM(
17281 uint32_t immediate_data_size, 17456 uint32_t immediate_data_size,
17282 const void* cmd_data) { 17457 const volatile void* cmd_data) {
17283 static const char kFunctionName[] = "glStencilStrokePathInstancedCHROMIUM"; 17458 static const char kFunctionName[] = "glStencilStrokePathInstancedCHROMIUM";
17284 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c = 17459 const volatile gles2::cmds::StencilStrokePathInstancedCHROMIUM& c =
17285 *static_cast<const gles2::cmds::StencilStrokePathInstancedCHROMIUM*>( 17460 *static_cast<
17461 const volatile gles2::cmds::StencilStrokePathInstancedCHROMIUM*>(
17286 cmd_data); 17462 cmd_data);
17287 if (!features().chromium_path_rendering) 17463 if (!features().chromium_path_rendering)
17288 return error::kUnknownCommand; 17464 return error::kUnknownCommand;
17289 17465
17290 PathCommandValidatorContext v(this, kFunctionName); 17466 PathCommandValidatorContext v(this, kFunctionName);
17291 GLuint num_paths = 0; 17467 GLuint num_paths = 0;
17292 GLenum path_name_type = GL_NONE; 17468 GLenum path_name_type = GL_NONE;
17293 GLenum transform_type = GL_NONE; 17469 GLenum transform_type = GL_NONE;
17294 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17470 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
17295 !v.GetTransformType(c, &transform_type)) 17471 !v.GetTransformType(c, &transform_type))
(...skipping 15 matching lines...) Expand all
17311 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17487 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17312 return error::kNoError; 17488 return error::kNoError;
17313 ApplyDirtyState(); 17489 ApplyDirtyState();
17314 glStencilStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17490 glStencilStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17315 reference, mask, transform_type, transforms); 17491 reference, mask, transform_type, transforms);
17316 return error::kNoError; 17492 return error::kNoError;
17317 } 17493 }
17318 17494
17319 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM( 17495 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM(
17320 uint32_t immediate_data_size, 17496 uint32_t immediate_data_size,
17321 const void* cmd_data) { 17497 const volatile void* cmd_data) {
17322 static const char kFunctionName[] = "glCoverFillPathInstancedCHROMIUM"; 17498 static const char kFunctionName[] = "glCoverFillPathInstancedCHROMIUM";
17323 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c = 17499 const volatile gles2::cmds::CoverFillPathInstancedCHROMIUM& c =
17324 *static_cast<const gles2::cmds::CoverFillPathInstancedCHROMIUM*>( 17500 *static_cast<const volatile gles2::cmds::CoverFillPathInstancedCHROMIUM*>(
17325 cmd_data); 17501 cmd_data);
17326 if (!features().chromium_path_rendering) 17502 if (!features().chromium_path_rendering)
17327 return error::kUnknownCommand; 17503 return error::kUnknownCommand;
17328 17504
17329 PathCommandValidatorContext v(this, kFunctionName); 17505 PathCommandValidatorContext v(this, kFunctionName);
17330 GLuint num_paths = 0; 17506 GLuint num_paths = 0;
17331 GLenum path_name_type = GL_NONE; 17507 GLenum path_name_type = GL_NONE;
17332 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17508 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17333 GLenum transform_type = GL_NONE; 17509 GLenum transform_type = GL_NONE;
17334 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17510 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
(...skipping 15 matching lines...) Expand all
17350 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17526 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17351 return error::kNoError; 17527 return error::kNoError;
17352 ApplyDirtyState(); 17528 ApplyDirtyState();
17353 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17529 glCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17354 cover_mode, transform_type, transforms); 17530 cover_mode, transform_type, transforms);
17355 return error::kNoError; 17531 return error::kNoError;
17356 } 17532 }
17357 17533
17358 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM( 17534 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM(
17359 uint32_t immediate_data_size, 17535 uint32_t immediate_data_size,
17360 const void* cmd_data) { 17536 const volatile void* cmd_data) {
17361 static const char kFunctionName[] = "glCoverStrokePathInstancedCHROMIUM"; 17537 static const char kFunctionName[] = "glCoverStrokePathInstancedCHROMIUM";
17362 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c = 17538 const volatile gles2::cmds::CoverStrokePathInstancedCHROMIUM& c =
17363 *static_cast<const gles2::cmds::CoverStrokePathInstancedCHROMIUM*>( 17539 *static_cast<
17540 const volatile gles2::cmds::CoverStrokePathInstancedCHROMIUM*>(
17364 cmd_data); 17541 cmd_data);
17365 if (!features().chromium_path_rendering) 17542 if (!features().chromium_path_rendering)
17366 return error::kUnknownCommand; 17543 return error::kUnknownCommand;
17367 17544
17368 PathCommandValidatorContext v(this, kFunctionName); 17545 PathCommandValidatorContext v(this, kFunctionName);
17369 GLuint num_paths = 0; 17546 GLuint num_paths = 0;
17370 GLenum path_name_type = GL_NONE; 17547 GLenum path_name_type = GL_NONE;
17371 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17548 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17372 GLenum transform_type = GL_NONE; 17549 GLenum transform_type = GL_NONE;
17373 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17550 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
(...skipping 15 matching lines...) Expand all
17389 if (!CheckBoundDrawFramebufferValid(kFunctionName)) 17566 if (!CheckBoundDrawFramebufferValid(kFunctionName))
17390 return error::kNoError; 17567 return error::kNoError;
17391 ApplyDirtyState(); 17568 ApplyDirtyState();
17392 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0, 17569 glCoverStrokePathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 0,
17393 cover_mode, transform_type, transforms); 17570 cover_mode, transform_type, transforms);
17394 return error::kNoError; 17571 return error::kNoError;
17395 } 17572 }
17396 17573
17397 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM( 17574 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM(
17398 uint32_t immediate_data_size, 17575 uint32_t immediate_data_size,
17399 const void* cmd_data) { 17576 const volatile void* cmd_data) {
17400 static const char kFunctionName[] = 17577 static const char kFunctionName[] =
17401 "glStencilThenCoverFillPathInstancedCHROMIUM"; 17578 "glStencilThenCoverFillPathInstancedCHROMIUM";
17402 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c = 17579 const volatile gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c =
17403 *static_cast< 17580 *static_cast<const volatile gles2::cmds::
17404 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM*>( 17581 StencilThenCoverFillPathInstancedCHROMIUM*>(cmd_data);
17405 cmd_data);
17406 if (!features().chromium_path_rendering) 17582 if (!features().chromium_path_rendering)
17407 return error::kUnknownCommand; 17583 return error::kUnknownCommand;
17408 PathCommandValidatorContext v(this, kFunctionName); 17584 PathCommandValidatorContext v(this, kFunctionName);
17409 17585
17410 GLuint num_paths = 0; 17586 GLuint num_paths = 0;
17411 GLenum path_name_type = GL_NONE; 17587 GLenum path_name_type = GL_NONE;
17412 GLenum fill_mode = GL_COUNT_UP_CHROMIUM; 17588 GLenum fill_mode = GL_COUNT_UP_CHROMIUM;
17413 GLuint mask = 0; 17589 GLuint mask = 0;
17414 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17590 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17415 GLenum transform_type = GL_NONE; 17591 GLenum transform_type = GL_NONE;
(...skipping 19 matching lines...) Expand all
17435 ApplyDirtyState(); 17611 ApplyDirtyState();
17436 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(), 17612 glStencilThenCoverFillPathInstancedNV(num_paths, GL_UNSIGNED_INT, paths.get(),
17437 0, fill_mode, mask, cover_mode, 17613 0, fill_mode, mask, cover_mode,
17438 transform_type, transforms); 17614 transform_type, transforms);
17439 return error::kNoError; 17615 return error::kNoError;
17440 } 17616 }
17441 17617
17442 error::Error 17618 error::Error
17443 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( 17619 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM(
17444 uint32_t immediate_data_size, 17620 uint32_t immediate_data_size,
17445 const void* cmd_data) { 17621 const volatile void* cmd_data) {
17446 static const char kFunctionName[] = 17622 static const char kFunctionName[] =
17447 "glStencilThenCoverStrokeInstancedCHROMIUM"; 17623 "glStencilThenCoverStrokeInstancedCHROMIUM";
17448 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = 17624 const volatile gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c =
17449 *static_cast< 17625 *static_cast<const volatile gles2::cmds::
17450 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM*>( 17626 StencilThenCoverStrokePathInstancedCHROMIUM*>(cmd_data);
17451 cmd_data);
17452 if (!features().chromium_path_rendering) 17627 if (!features().chromium_path_rendering)
17453 return error::kUnknownCommand; 17628 return error::kUnknownCommand;
17454 PathCommandValidatorContext v(this, kFunctionName); 17629 PathCommandValidatorContext v(this, kFunctionName);
17455 GLuint num_paths = 0; 17630 GLuint num_paths = 0;
17456 GLenum path_name_type = GL_NONE; 17631 GLenum path_name_type = GL_NONE;
17457 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; 17632 GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM;
17458 GLenum transform_type = GL_NONE; 17633 GLenum transform_type = GL_NONE;
17459 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || 17634 if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) ||
17460 !v.GetCoverMode(c, &cover_mode) || 17635 !v.GetCoverMode(c, &cover_mode) ||
17461 !v.GetTransformType(c, &transform_type)) 17636 !v.GetTransformType(c, &transform_type))
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
17587 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround", 17762 ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::ClearWorkaround",
17588 GetErrorState()); 17763 GetErrorState());
17589 clear_framebuffer_blit_->ClearFramebuffer( 17764 clear_framebuffer_blit_->ClearFramebuffer(
17590 this, GetBoundReadFramebufferSize(), mask, state_.color_clear_red, 17765 this, GetBoundReadFramebufferSize(), mask, state_.color_clear_red,
17591 state_.color_clear_green, state_.color_clear_blue, 17766 state_.color_clear_green, state_.color_clear_blue,
17592 state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear); 17767 state_.color_clear_alpha, state_.depth_clear, state_.stencil_clear);
17593 } 17768 }
17594 17769
17595 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket( 17770 error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket(
17596 uint32_t immediate_data_size, 17771 uint32_t immediate_data_size,
17597 const void* cmd_data) { 17772 const volatile void* cmd_data) {
17598 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = 17773 const volatile gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c =
17599 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( 17774 *static_cast<
17775 const volatile gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>(
17600 cmd_data); 17776 cmd_data);
17601 if (!features().chromium_path_rendering) { 17777 if (!features().chromium_path_rendering) {
17602 return error::kUnknownCommand; 17778 return error::kUnknownCommand;
17603 } 17779 }
17604 17780
17605 GLuint program = static_cast<GLuint>(c.program); 17781 GLuint program = static_cast<GLuint>(c.program);
17606 GLint location = static_cast<GLint>(c.location); 17782 GLint location = static_cast<GLint>(c.location);
17607 Bucket* bucket = GetBucket(c.name_bucket_id); 17783 Bucket* bucket = GetBucket(c.name_bucket_id);
17608 if (!bucket || bucket->size() == 0) { 17784 if (!bucket || bucket->size() == 0) {
17609 return error::kInvalidArguments; 17785 return error::kInvalidArguments;
17610 } 17786 }
17611 std::string name_str; 17787 std::string name_str;
17612 if (!bucket->GetAsString(&name_str)) { 17788 if (!bucket->GetAsString(&name_str)) {
17613 return error::kInvalidArguments; 17789 return error::kInvalidArguments;
17614 } 17790 }
17615 DoBindFragmentInputLocationCHROMIUM(program, location, name_str); 17791 DoBindFragmentInputLocationCHROMIUM(program, location, name_str);
17616 return error::kNoError; 17792 return error::kNoError;
17617 } 17793 }
17618 17794
17619 error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM( 17795 error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM(
17620 uint32_t immediate_data_size, 17796 uint32_t immediate_data_size,
17621 const void* cmd_data) { 17797 const volatile void* cmd_data) {
17622 static const char kFunctionName[] = "glProgramPathFragmentInputGenCHROMIUM"; 17798 static const char kFunctionName[] = "glProgramPathFragmentInputGenCHROMIUM";
17623 const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c = 17799 const volatile gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c =
17624 *static_cast<const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>( 17800 *static_cast<
17801 const volatile gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>(
17625 cmd_data); 17802 cmd_data);
17626 if (!features().chromium_path_rendering) { 17803 if (!features().chromium_path_rendering) {
17627 return error::kUnknownCommand; 17804 return error::kUnknownCommand;
17628 } 17805 }
17629 17806
17630 GLint program_id = static_cast<GLint>(c.program); 17807 GLint program_id = static_cast<GLint>(c.program);
17631 17808
17632 Program* program = GetProgram(program_id); 17809 Program* program = GetProgram(program_id);
17633 if (!program || !program->IsValid() || program->IsDeleted()) { 17810 if (!program || !program->IsValid() || program->IsDeleted()) {
17634 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "invalid program"); 17811 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, "invalid program");
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
17748 } 17925 }
17749 17926
17750 // Include the auto-generated part of this file. We split this because it means 17927 // 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 17928 // 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. 17929 // instead of having to edit some template or the code generator.
17753 #include "base/macros.h" 17930 #include "base/macros.h"
17754 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17931 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17755 17932
17756 } // namespace gles2 17933 } // namespace gles2
17757 } // namespace gpu 17934 } // 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