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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 1379863003: Added overloads of uniform[1234]uiv taking Uint32Array to match spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo causing crashes in uniform API tests. Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "config.h" 5 #include "config.h"
6 #include "modules/webgl/WebGL2RenderingContextBase.h" 6 #include "modules/webgl/WebGL2RenderingContextBase.h"
7 7
8 #include "bindings/modules/v8/WebGLAny.h" 8 #include "bindings/modules/v8/WebGLAny.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 return; 916 return;
917 917
918 if (location->program() != m_currentProgram) { 918 if (location->program() != m_currentProgram) {
919 synthesizeGLError(GL_INVALID_OPERATION, "uniform4ui", "location not for current program"); 919 synthesizeGLError(GL_INVALID_OPERATION, "uniform4ui", "location not for current program");
920 return; 920 return;
921 } 921 }
922 922
923 webContext()->uniform4ui(location->location(), v0, v1, v2, v3); 923 webContext()->uniform4ui(location->location(), v0, v1, v2, v3);
924 } 924 }
925 925
926 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
927 {
928 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 1uiv", location, v, 1))
929 return;
930
931 webContext()->uniform1uiv(location->location(), v.length(), v.dataMaybeOnSta ck());
932 }
933
926 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 934 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
927 { 935 {
928 if (isContextLost() || validateUniformParameters("uniform1uiv", location, va lue.data(), value.size(), 1)) 936 if (isContextLost() || !validateUniformParameters("uniform1uiv", location, v alue.data(), value.size(), 1))
929 return; 937 return;
930 938
931 webContext()->uniform1uiv(location->location(), value.size(), value.data()); 939 webContext()->uniform1uiv(location->location(), value.size(), value.data());
932 } 940 }
933 941
942 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
943 {
944 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 2uiv", location, v, 2))
945 return;
946
947 webContext()->uniform2uiv(location->location(), v.length() >> 1, v.dataMaybe OnStack());
948 }
949
934 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 950 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
935 { 951 {
936 if (isContextLost() || !validateUniformParameters("uniform2uiv", location, v alue.data(), value.size(), 2)) 952 if (isContextLost() || !validateUniformParameters("uniform2uiv", location, v alue.data(), value.size(), 2))
937 return; 953 return;
938 954
939 webContext()->uniform2uiv(location->location(), value.size() / 2, value.data ()); 955 webContext()->uniform2uiv(location->location(), value.size() / 2, value.data ());
940 } 956 }
941 957
958 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
959 {
960 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 3uiv", location, v, 3))
961 return;
962
963 webContext()->uniform3uiv(location->location(), v.length() / 3, v.dataMaybeO nStack());
964 }
965
942 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 966 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
943 { 967 {
944 if (isContextLost() || !validateUniformParameters("uniform3uiv", location, v alue.data(), value.size(), 3)) 968 if (isContextLost() || !validateUniformParameters("uniform3uiv", location, v alue.data(), value.size(), 3))
945 return; 969 return;
946 970
947 webContext()->uniform3uiv(location->location(), value.size() / 3, value.data ()); 971 webContext()->uniform3uiv(location->location(), value.size() / 3, value.data ());
948 } 972 }
949 973
974 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, const FlexibleUint32ArrayView& v)
975 {
976 if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform 4uiv", location, v, 4))
977 return;
978
979 webContext()->uniform4uiv(location->location(), v.length() >> 2, v.dataMaybe OnStack());
980 }
981
950 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value) 982 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* locatio n, Vector<GLuint>& value)
951 { 983 {
952 if (isContextLost() || !validateUniformParameters("uniform4uiv", location, v alue.data(), value.size(), 4)) 984 if (isContextLost() || !validateUniformParameters("uniform4uiv", location, v alue.data(), value.size(), 4))
953 return; 985 return;
954 986
955 webContext()->uniform4uiv(location->location(), value.size() / 4, value.data ()); 987 webContext()->uniform4uiv(location->location(), value.size() / 4, value.data ());
956 } 988 }
957 989
958 void WebGL2RenderingContextBase::uniformMatrix2x3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value) 990 void WebGL2RenderingContextBase::uniformMatrix2x3fv(const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32Array* value)
959 { 991 {
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() 2940 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat()
2909 { 2941 {
2910 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) 2942 if (m_readFramebufferBinding && m_readFramebufferBinding->object())
2911 return m_readFramebufferBinding->colorBufferFormat(); 2943 return m_readFramebufferBinding->colorBufferFormat();
2912 if (m_requestedAttributes.alpha()) 2944 if (m_requestedAttributes.alpha())
2913 return GL_RGBA; 2945 return GL_RGBA;
2914 return GL_RGB; 2946 return GL_RGB;
2915 } 2947 }
2916 2948
2917 } // namespace blink 2949 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698