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

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

Issue 1812243003: Remove methods from WebGraphicsContext3D that wrap type casts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simples-tplus
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 { 2123 {
2124 if (!validateDrawElements("drawElements", type, offset)) 2124 if (!validateDrawElements("drawElements", type, offset))
2125 return; 2125 return;
2126 2126
2127 if (transformFeedbackActive() && !transformFeedbackPaused()) { 2127 if (transformFeedbackActive() && !transformFeedbackPaused()) {
2128 synthesizeGLError(GL_INVALID_OPERATION, "drawElements", "transform feedb ack is active and not paused"); 2128 synthesizeGLError(GL_INVALID_OPERATION, "drawElements", "transform feedb ack is active and not paused");
2129 return; 2129 return;
2130 } 2130 }
2131 2131
2132 clearIfComposited(); 2132 clearIfComposited();
2133 webContext()->drawElements(mode, count, type, static_cast<GLintptr>(offset)) ; 2133 contextGL()->DrawElements(mode, count, type, reinterpret_cast<void*>(static_ cast<intptr_t>(offset)));
2134 markContextChanged(CanvasChanged); 2134 markContextChanged(CanvasChanged);
2135 } 2135 }
2136 2136
2137 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs t, GLsizei count, GLsizei primcount) 2137 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs t, GLsizei count, GLsizei primcount)
2138 { 2138 {
2139 if (!validateDrawArrays("drawArraysInstancedANGLE")) 2139 if (!validateDrawArrays("drawArraysInstancedANGLE"))
2140 return; 2140 return;
2141 2141
2142 clearIfComposited(); 2142 clearIfComposited();
2143 contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount); 2143 contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount);
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after
3285 default: 3285 default:
3286 synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter name"); 3286 synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter name");
3287 return ScriptValue::createNull(scriptState); 3287 return ScriptValue::createNull(scriptState);
3288 } 3288 }
3289 } 3289 }
3290 3290
3291 long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum pname) 3291 long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum pname)
3292 { 3292 {
3293 if (isContextLost()) 3293 if (isContextLost())
3294 return 0; 3294 return 0;
3295 GLintptr result = webContext()->getVertexAttribOffset(index, pname); 3295 GLvoid* result = nullptr;
3296 return static_cast<long long>(result); 3296 // NOTE: If pname is ever a value that returns more then 1 element
3297 // this will corrupt memory.
3298 contextGL()->GetVertexAttribPointerv(index, pname, &result);
3299 return static_cast<long long>(reinterpret_cast<intptr_t>(result));
3297 } 3300 }
3298 3301
3299 void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) 3302 void WebGLRenderingContextBase::hint(GLenum target, GLenum mode)
3300 { 3303 {
3301 if (isContextLost()) 3304 if (isContextLost())
3302 return; 3305 return;
3303 bool isValid = false; 3306 bool isValid = false;
3304 switch (target) { 3307 switch (target) {
3305 case GL_GENERATE_MIPMAP_HINT: 3308 case GL_GENERATE_MIPMAP_HINT:
3306 isValid = true; 3309 isValid = true;
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
4943 return; 4946 return;
4944 } 4947 }
4945 if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset)) 4948 if (!validateValueFitNonNegInt32("vertexAttribPointer", "offset", offset))
4946 return; 4949 return;
4947 if (!m_boundArrayBuffer) { 4950 if (!m_boundArrayBuffer) {
4948 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound ARRAY_BUFFER"); 4951 synthesizeGLError(GL_INVALID_OPERATION, "vertexAttribPointer", "no bound ARRAY_BUFFER");
4949 return; 4952 return;
4950 } 4953 }
4951 4954
4952 m_boundVertexArrayObject->setArrayBufferForAttrib(index, m_boundArrayBuffer. get()); 4955 m_boundVertexArrayObject->setArrayBufferForAttrib(index, m_boundArrayBuffer. get());
4953 webContext()->vertexAttribPointer(index, size, type, normalized, stride, sta tic_cast<GLintptr>(offset)); 4956 contextGL()->VertexAttribPointer(index, size, type, normalized, stride, rein terpret_cast<void*>(static_cast<intptr_t>(offset)));
4954 maybePreserveDefaultVAOObjectWrapper(scriptState); 4957 maybePreserveDefaultVAOObjectWrapper(scriptState);
4955 preserveObjectWrapper(scriptState, m_boundVertexArrayObject, "arraybuffer", index, m_boundArrayBuffer); 4958 preserveObjectWrapper(scriptState, m_boundVertexArrayObject, "arraybuffer", index, m_boundArrayBuffer);
4956 } 4959 }
4957 4960
4958 void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint di visor) 4961 void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint di visor)
4959 { 4962 {
4960 if (isContextLost()) 4963 if (isContextLost())
4961 return; 4964 return;
4962 4965
4963 if (index >= m_maxVertexAttribs) { 4966 if (index >= m_maxVertexAttribs) {
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
6289 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 6292 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
6290 } 6293 }
6291 6294
6292 void WebGLRenderingContextBase::restoreUnpackParameters() 6295 void WebGLRenderingContextBase::restoreUnpackParameters()
6293 { 6296 {
6294 if (m_unpackAlignment != 1) 6297 if (m_unpackAlignment != 1)
6295 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); 6298 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment);
6296 } 6299 }
6297 6300
6298 } // namespace blink 6301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698