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

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

Issue 2401893002: [wrapper-tracing] WebGL and friends: Add write barriers (Closed)
Patch Set: Rebase Created 4 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 "modules/webgl/WebGL2RenderingContextBase.h" 5 #include "modules/webgl/WebGL2RenderingContextBase.h"
6 6
7 #include "bindings/modules/v8/WebGLAny.h" 7 #include "bindings/modules/v8/WebGLAny.h"
8 #include "core/dom/DOMException.h" 8 #include "core/dom/DOMException.h"
9 #include "core/frame/ImageBitmap.h" 9 #include "core/frame/ImageBitmap.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 visitor->trace(m_destinationArrayBufferView); 220 visitor->trace(m_destinationArrayBufferView);
221 } 221 }
222 222
223 WebGL2RenderingContextBase::WebGL2RenderingContextBase( 223 WebGL2RenderingContextBase::WebGL2RenderingContextBase(
224 HTMLCanvasElement* passedCanvas, 224 HTMLCanvasElement* passedCanvas,
225 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, 225 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
226 const CanvasContextCreationAttributes& requestedAttributes) 226 const CanvasContextCreationAttributes& requestedAttributes)
227 : WebGLRenderingContextBase(passedCanvas, 227 : WebGLRenderingContextBase(passedCanvas,
228 std::move(contextProvider), 228 std::move(contextProvider),
229 requestedAttributes, 229 requestedAttributes,
230 2) { 230 2),
231 m_readFramebufferBinding(this, nullptr),
232 m_transformFeedbackBinding(this, nullptr),
233 m_boundCopyReadBuffer(this, nullptr),
234 m_boundCopyWriteBuffer(this, nullptr),
235 m_boundPixelPackBuffer(this, nullptr),
236 m_boundPixelUnpackBuffer(this, nullptr),
237 m_boundTransformFeedbackBuffer(this, nullptr),
238 m_boundUniformBuffer(this, nullptr),
239 m_currentBooleanOcclusionQuery(this, nullptr),
240 m_currentTransformFeedbackPrimitivesWrittenQuery(this, nullptr) {
231 m_supportedInternalFormatsStorage.insert( 241 m_supportedInternalFormatsStorage.insert(
232 kSupportedInternalFormatsStorage, 242 kSupportedInternalFormatsStorage,
233 kSupportedInternalFormatsStorage + 243 kSupportedInternalFormatsStorage +
234 WTF_ARRAY_LENGTH(kSupportedInternalFormatsStorage)); 244 WTF_ARRAY_LENGTH(kSupportedInternalFormatsStorage));
235 } 245 }
236 246
237 WebGL2RenderingContextBase::~WebGL2RenderingContextBase() { 247 WebGL2RenderingContextBase::~WebGL2RenderingContextBase() {
238 m_readFramebufferBinding = nullptr; 248 m_readFramebufferBinding = nullptr;
239 249
240 m_boundCopyReadBuffer = nullptr; 250 m_boundCopyReadBuffer = nullptr;
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 "attempted to bind a deleted sampler"); 2852 "attempted to bind a deleted sampler");
2843 return; 2853 return;
2844 } 2854 }
2845 2855
2846 if (unit >= m_samplerUnits.size()) { 2856 if (unit >= m_samplerUnits.size()) {
2847 synthesizeGLError(GL_INVALID_VALUE, "bindSampler", 2857 synthesizeGLError(GL_INVALID_VALUE, "bindSampler",
2848 "texture unit out of range"); 2858 "texture unit out of range");
2849 return; 2859 return;
2850 } 2860 }
2851 2861
2852 m_samplerUnits[unit] = sampler; 2862 m_samplerUnits[unit] = TraceWrapperMember<WebGLSampler>(this, sampler);
2853 2863
2854 contextGL()->BindSampler(unit, objectOrZero(sampler)); 2864 contextGL()->BindSampler(unit, objectOrZero(sampler));
2855 } 2865 }
2856 2866
2857 void WebGL2RenderingContextBase::samplerParameter(WebGLSampler* sampler, 2867 void WebGL2RenderingContextBase::samplerParameter(WebGLSampler* sampler,
2858 GLenum pname, 2868 GLenum pname,
2859 GLfloat paramf, 2869 GLfloat paramf,
2860 GLint parami, 2870 GLint parami,
2861 bool isFloat) { 2871 bool isFloat) {
2862 if (isContextLost() || !validateWebGLObject("samplerParameter", sampler)) 2872 if (isContextLost() || !validateWebGLObject("samplerParameter", sampler))
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 if (buffer && 4045 if (buffer &&
4036 !validateBufferTargetCompatibility(functionName, target, buffer)) 4046 !validateBufferTargetCompatibility(functionName, target, buffer))
4037 return false; 4047 return false;
4038 4048
4039 switch (target) { 4049 switch (target) {
4040 case GL_TRANSFORM_FEEDBACK_BUFFER: 4050 case GL_TRANSFORM_FEEDBACK_BUFFER:
4041 if (index >= m_boundIndexedTransformFeedbackBuffers.size()) { 4051 if (index >= m_boundIndexedTransformFeedbackBuffers.size()) {
4042 synthesizeGLError(GL_INVALID_VALUE, functionName, "index out of range"); 4052 synthesizeGLError(GL_INVALID_VALUE, functionName, "index out of range");
4043 return false; 4053 return false;
4044 } 4054 }
4045 m_boundIndexedTransformFeedbackBuffers[index] = buffer; 4055 m_boundIndexedTransformFeedbackBuffers[index] =
4056 TraceWrapperMember<WebGLBuffer>(this, buffer);
4046 m_boundTransformFeedbackBuffer = buffer; 4057 m_boundTransformFeedbackBuffer = buffer;
4047 break; 4058 break;
4048 case GL_UNIFORM_BUFFER: 4059 case GL_UNIFORM_BUFFER:
4049 if (index >= m_boundIndexedUniformBuffers.size()) { 4060 if (index >= m_boundIndexedUniformBuffers.size()) {
4050 synthesizeGLError(GL_INVALID_VALUE, functionName, "index out of range"); 4061 synthesizeGLError(GL_INVALID_VALUE, functionName, "index out of range");
4051 return false; 4062 return false;
4052 } 4063 }
4053 m_boundIndexedUniformBuffers[index] = buffer; 4064 m_boundIndexedUniformBuffers[index] =
4065 TraceWrapperMember<WebGLBuffer>(this, buffer);
4054 m_boundUniformBuffer = buffer; 4066 m_boundUniformBuffer = buffer;
4055 4067
4056 // Keep track of what the maximum bound uniform buffer index is 4068 // Keep track of what the maximum bound uniform buffer index is
4057 if (buffer) { 4069 if (buffer) {
4058 if (index > m_maxBoundUniformBufferIndex) 4070 if (index > m_maxBoundUniformBufferIndex)
4059 m_maxBoundUniformBufferIndex = index; 4071 m_maxBoundUniformBufferIndex = index;
4060 } else if (m_maxBoundUniformBufferIndex > 0 && 4072 } else if (m_maxBoundUniformBufferIndex > 0 &&
4061 index == m_maxBoundUniformBufferIndex) { 4073 index == m_maxBoundUniformBufferIndex) {
4062 size_t i = m_maxBoundUniformBufferIndex - 1; 4074 size_t i = m_maxBoundUniformBufferIndex - 1;
4063 for (; i > 0; --i) { 4075 for (; i > 0; --i) {
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
4705 params.skipPixels = m_unpackSkipPixels; 4717 params.skipPixels = m_unpackSkipPixels;
4706 params.skipRows = m_unpackSkipRows; 4718 params.skipRows = m_unpackSkipRows;
4707 if (dimension == Tex3D) { 4719 if (dimension == Tex3D) {
4708 params.imageHeight = m_unpackImageHeight; 4720 params.imageHeight = m_unpackImageHeight;
4709 params.skipImages = m_unpackSkipImages; 4721 params.skipImages = m_unpackSkipImages;
4710 } 4722 }
4711 return params; 4723 return params;
4712 } 4724 }
4713 4725
4714 } // namespace blink 4726 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698