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

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

Issue 1281953003: Revert of [Oilpan] Migrate classes under module/webgl onto oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « Source/modules/webgl/WebGLRenderingContextBase.h ('k') | Source/modules/webgl/WebGLSampler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 ~ScopedDrawingBufferBinder() 240 ~ScopedDrawingBufferBinder()
241 { 241 {
242 // Restore DrawingBuffer if needed 242 // Restore DrawingBuffer if needed
243 if (!m_readFramebufferBinding && m_drawingBuffer) 243 if (!m_readFramebufferBinding && m_drawingBuffer)
244 m_drawingBuffer->restoreFramebufferBindings(); 244 m_drawingBuffer->restoreFramebufferBindings();
245 } 245 }
246 246
247 private: 247 private:
248 DrawingBuffer* m_drawingBuffer; 248 DrawingBuffer* m_drawingBuffer;
249 Member<WebGLFramebuffer> m_readFramebufferBinding; 249 RawPtrWillBeMember<WebGLFramebuffer> m_readFramebufferBinding;
250 }; 250 };
251 251
252 GLint clamp(GLint value, GLint min, GLint max) 252 GLint clamp(GLint value, GLint min, GLint max)
253 { 253 {
254 if (value < min) 254 if (value < min)
255 value = min; 255 value = min;
256 if (value > max) 256 if (value > max)
257 value = max; 257 value = max;
258 return value; 258 return value;
259 } 259 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 ~ScopedFramebufferRestorer() 495 ~ScopedFramebufferRestorer()
496 { 496 {
497 m_context->restoreCurrentFramebuffer(); 497 m_context->restoreCurrentFramebuffer();
498 } 498 }
499 499
500 private: 500 private:
501 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; 501 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
502 }; 502 };
503 503
504 class WebGLRenderingContextLostCallback final : public GarbageCollectedFinalized <WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::WebGraphicsCon textLostCallback { 504 class WebGLRenderingContextLostCallback final : public NoBaseWillBeGarbageCollec tedFinalized<WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::We bGraphicsContextLostCallback {
505 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextLostCallback);
505 public: 506 public:
506 static WebGLRenderingContextLostCallback* create(WebGLRenderingContextBase* context) 507 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebG LRenderingContextBase* context)
507 { 508 {
508 return new WebGLRenderingContextLostCallback(context); 509 return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context) );
509 } 510 }
510 511
511 ~WebGLRenderingContextLostCallback() override { } 512 ~WebGLRenderingContextLostCallback() override { }
512 513
513 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext, WebGLRenderingContextBase::Auto); } 514 virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingCon textBase::RealLostContext, WebGLRenderingContextBase::Auto); }
514 515
515 DEFINE_INLINE_TRACE() 516 DEFINE_INLINE_TRACE()
516 { 517 {
517 visitor->trace(m_context); 518 visitor->trace(m_context);
518 } 519 }
519 520
520 private: 521 private:
521 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t) 522 explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* contex t)
522 : m_context(context) { } 523 : m_context(context) { }
523 524
524 RawPtrWillBeMember<WebGLRenderingContextBase> m_context; 525 RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
525 }; 526 };
526 527
527 class WebGLRenderingContextErrorMessageCallback final : public GarbageCollectedF inalized<WebGLRenderingContextErrorMessageCallback>, public WebGraphicsContext3D ::WebGraphicsErrorMessageCallback { 528 class WebGLRenderingContextErrorMessageCallback final : public NoBaseWillBeGarba geCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public WebGraph icsContext3D::WebGraphicsErrorMessageCallback {
529 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextErrorMessageCal lback);
528 public: 530 public:
529 static WebGLRenderingContextErrorMessageCallback* create(WebGLRenderingConte xtBase* context) 531 static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> cre ate(WebGLRenderingContextBase* context)
530 { 532 {
531 return new WebGLRenderingContextErrorMessageCallback(context); 533 return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback( context));
532 } 534 }
533 535
534 ~WebGLRenderingContextErrorMessageCallback() override { } 536 ~WebGLRenderingContextErrorMessageCallback() override { }
535 537
536 virtual void onErrorMessage(const WebString& message, WGC3Dint) 538 virtual void onErrorMessage(const WebString& message, WGC3Dint)
537 { 539 {
538 if (m_context->m_synthesizedErrorsToConsole) 540 if (m_context->m_synthesizedErrorsToConsole)
539 m_context->printGLErrorToConsole(message); 541 m_context->printGLErrorToConsole(message);
540 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message); 542 InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas() , message);
541 } 543 }
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 m_textureUnits[i].m_texture3DBinding = nullptr; 1114 m_textureUnits[i].m_texture3DBinding = nullptr;
1113 m_textureUnits[i].m_texture2DArrayBinding = nullptr; 1115 m_textureUnits[i].m_texture2DArrayBinding = nullptr;
1114 } 1116 }
1115 1117
1116 m_blackTexture2D = nullptr; 1118 m_blackTexture2D = nullptr;
1117 m_blackTextureCubeMap = nullptr; 1119 m_blackTextureCubeMap = nullptr;
1118 1120
1119 detachAndRemoveAllObjects(); 1121 detachAndRemoveAllObjects();
1120 1122
1121 // Release all extensions now. 1123 // Release all extensions now.
1122 for (ExtensionTracker* tracker : m_extensions) {
1123 tracker->loseExtension(true);
1124 }
1125 m_extensions.clear(); 1124 m_extensions.clear();
1126 1125
1127 // Context must be removed from the group prior to the destruction of the 1126 // Context must be removed from the group prior to the destruction of the
1128 // WebGraphicsContext3D, otherwise shared objects may not be properly delete d. 1127 // WebGraphicsContext3D, otherwise shared objects may not be properly delete d.
1129 m_contextGroup->removeContext(this); 1128 m_contextGroup->removeContext(this);
1130 1129
1131 destroyContext(); 1130 destroyContext();
1132 1131
1133 if (m_multisamplingObserverRegistered) 1132 if (m_multisamplingObserverRegistered)
1134 if (Page* page = canvas()->document().page()) 1133 if (Page* page = canvas()->document().page())
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 return; 1923 return;
1925 } 1924 }
1926 WebGLFramebuffer* readFramebufferBinding = nullptr; 1925 WebGLFramebuffer* readFramebufferBinding = nullptr;
1927 if (!validateReadBufferAndGetInfo("copyTexSubImage2D", readFramebufferBindin g, nullptr, nullptr)) 1926 if (!validateReadBufferAndGetInfo("copyTexSubImage2D", readFramebufferBindin g, nullptr, nullptr))
1928 return; 1927 return;
1929 clearIfComposited(); 1928 clearIfComposited();
1930 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); 1929 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding);
1931 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); 1930 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height);
1932 } 1931 }
1933 1932
1934 WebGLBuffer* WebGLRenderingContextBase::createBuffer() 1933 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer()
1935 { 1934 {
1936 if (isContextLost()) 1935 if (isContextLost())
1937 return nullptr; 1936 return nullptr;
1938 WebGLBuffer* o = WebGLBuffer::create(this); 1937 RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this);
1939 addSharedObject(o); 1938 addSharedObject(o.get());
1940 return o; 1939 return o.release();
1941 } 1940 }
1942 1941
1943 WebGLFramebuffer* WebGLRenderingContextBase::createFramebuffer() 1942 PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFrameb uffer()
1944 { 1943 {
1945 if (isContextLost()) 1944 if (isContextLost())
1946 return nullptr; 1945 return nullptr;
1947 WebGLFramebuffer* o = WebGLFramebuffer::create(this); 1946 RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this);
1948 addContextObject(o); 1947 addContextObject(o.get());
1949 return o; 1948 return o.release();
1950 } 1949 }
1951 1950
1952 WebGLTexture* WebGLRenderingContextBase::createTexture() 1951 PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture()
1953 { 1952 {
1954 if (isContextLost()) 1953 if (isContextLost())
1955 return nullptr; 1954 return nullptr;
1956 WebGLTexture* o = WebGLTexture::create(this); 1955 RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this);
1957 addSharedObject(o); 1956 addSharedObject(o.get());
1958 return o; 1957 return o.release();
1959 } 1958 }
1960 1959
1961 WebGLProgram* WebGLRenderingContextBase::createProgram() 1960 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram()
1962 { 1961 {
1963 if (isContextLost()) 1962 if (isContextLost())
1964 return nullptr; 1963 return nullptr;
1965 WebGLProgram* o = WebGLProgram::create(this); 1964 RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this);
1966 addSharedObject(o); 1965 addSharedObject(o.get());
1967 return o; 1966 return o.release();
1968 } 1967 }
1969 1968
1970 WebGLRenderbuffer* WebGLRenderingContextBase::createRenderbuffer() 1969 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRende rbuffer()
1971 { 1970 {
1972 if (isContextLost()) 1971 if (isContextLost())
1973 return nullptr; 1972 return nullptr;
1974 WebGLRenderbuffer* o = WebGLRenderbuffer::create(this); 1973 RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this);
1975 addSharedObject(o); 1974 addSharedObject(o.get());
1976 return o; 1975 return o.release();
1977 } 1976 }
1978 1977
1979 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) 1978 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer)
1980 { 1979 {
1981 if (isContextLost()) 1980 if (isContextLost())
1982 return nullptr; 1981 return nullptr;
1983 if (!renderbuffer->emulatedStencilBuffer()) { 1982 if (!renderbuffer->emulatedStencilBuffer()) {
1984 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); 1983 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer());
1985 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); 1984 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer()));
1986 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); 1985 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get()));
1987 } 1986 }
1988 return renderbuffer->emulatedStencilBuffer(); 1987 return renderbuffer->emulatedStencilBuffer();
1989 } 1988 }
1990 1989
1991 WebGLShader* WebGLRenderingContextBase::createShader(GLenum type) 1990 PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen um type)
1992 { 1991 {
1993 if (isContextLost()) 1992 if (isContextLost())
1994 return nullptr; 1993 return nullptr;
1995 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { 1994 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) {
1996 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); 1995 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" );
1997 return nullptr; 1996 return nullptr;
1998 } 1997 }
1999 1998
2000 WebGLShader* o = WebGLShader::create(this, type); 1999 RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type);
2001 addSharedObject(o); 2000 addSharedObject(o.get());
2002 return o; 2001 return o.release();
2003 } 2002 }
2004 2003
2005 void WebGLRenderingContextBase::cullFace(GLenum mode) 2004 void WebGLRenderingContextBase::cullFace(GLenum mode)
2006 { 2005 {
2007 if (isContextLost()) 2006 if (isContextLost())
2008 return; 2007 return;
2009 switch (mode) { 2008 switch (mode) {
2010 case GL_FRONT_AND_BACK: 2009 case GL_FRONT_AND_BACK:
2011 case GL_FRONT: 2010 case GL_FRONT:
2012 case GL_BACK: 2011 case GL_BACK:
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 } 2447 }
2449 #endif 2448 #endif
2450 webContext()->generateMipmap(target); 2449 webContext()->generateMipmap(target);
2451 #if OS(MACOSX) 2450 #if OS(MACOSX)
2452 if (needToResetMinFilter) 2451 if (needToResetMinFilter)
2453 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); 2452 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter());
2454 #endif 2453 #endif
2455 tex->generateMipmapLevelInfo(); 2454 tex->generateMipmapLevelInfo();
2456 } 2455 }
2457 2456
2458 WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* progra m, GLuint index) 2457 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index)
2459 { 2458 {
2460 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) 2459 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
2461 return nullptr; 2460 return nullptr;
2462 WebGraphicsContext3D::ActiveInfo info; 2461 WebGraphicsContext3D::ActiveInfo info;
2463 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) 2462 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info))
2464 return nullptr; 2463 return nullptr;
2465 return WebGLActiveInfo::create(info.name, info.type, info.size); 2464 return WebGLActiveInfo::create(info.name, info.type, info.size);
2466 } 2465 }
2467 2466
2468 WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* progr am, GLuint index) 2467 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index)
2469 { 2468 {
2470 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) 2469 if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
2471 return nullptr; 2470 return nullptr;
2472 WebGraphicsContext3D::ActiveInfo info; 2471 WebGraphicsContext3D::ActiveInfo info;
2473 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) 2472 if (!webContext()->getActiveUniform(objectOrZero(program), index, info))
2474 return nullptr; 2473 return nullptr;
2475 return WebGLActiveInfo::create(info.name, info.type, info.size); 2474 return WebGLActiveInfo::create(info.name, info.type, info.size);
2476 } 2475 }
2477 2476
2478 Nullable<HeapVector<Member<WebGLShader>>> WebGLRenderingContextBase::getAttached Shaders(WebGLProgram* program) 2477 Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> WebGLRenderingContex tBase::getAttachedShaders(WebGLProgram* program)
2479 { 2478 {
2480 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) 2479 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
2481 return nullptr; 2480 return nullptr;
2482 2481
2483 HeapVector<Member<WebGLShader>> shaderObjects; 2482 WillBeHeapVector<RefPtrWillBeMember<WebGLShader>> shaderObjects;
2484 const GLenum shaderType[] = { 2483 const GLenum shaderType[] = {
2485 GL_VERTEX_SHADER, 2484 GL_VERTEX_SHADER,
2486 GL_FRAGMENT_SHADER 2485 GL_FRAGMENT_SHADER
2487 }; 2486 };
2488 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { 2487 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) {
2489 WebGLShader* shader = program->getAttachedShader(shaderType[i]); 2488 WebGLShader* shader = program->getAttachedShader(shaderType[i]);
2490 if (shader) 2489 if (shader)
2491 shaderObjects.append(shader); 2490 shaderObjects.append(shader);
2492 } 2491 }
2493 return shaderObjects; 2492 return shaderObjects;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 { 2598 {
2600 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) 2599 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ())
2601 return false; 2600 return false;
2602 if (!tracker->supported(this)) 2601 if (!tracker->supported(this))
2603 return false; 2602 return false;
2604 return true; 2603 return true;
2605 } 2604 }
2606 2605
2607 ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, co nst String& name) 2606 ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, co nst String& name)
2608 { 2607 {
2609 WebGLExtension* extension = nullptr; 2608 RefPtrWillBeRawPtr<WebGLExtension> extension = nullptr;
2610 2609
2611 if (!isContextLost()) { 2610 if (!isContextLost()) {
2612 for (size_t i = 0; i < m_extensions.size(); ++i) { 2611 for (size_t i = 0; i < m_extensions.size(); ++i) {
2613 ExtensionTracker* tracker = m_extensions[i]; 2612 ExtensionTracker* tracker = m_extensions[i].get();
2614 if (tracker->matchesNameWithPrefixes(name)) { 2613 if (tracker->matchesNameWithPrefixes(name)) {
2615 if (extensionSupportedAndAllowed(tracker)) { 2614 if (extensionSupportedAndAllowed(tracker)) {
2616 extension = tracker->getExtension(this); 2615 extension = tracker->getExtension(this);
2617 if (extension) 2616 if (extension)
2618 m_extensionEnabled[extension->name()] = true; 2617 m_extensionEnabled[extension->name()] = true;
2619 } 2618 }
2620 break; 2619 break;
2621 } 2620 }
2622 } 2621 }
2623 } 2622 }
(...skipping 20 matching lines...) Expand all
2644 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); 2643 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name");
2645 return ScriptValue::createNull(scriptState); 2644 return ScriptValue::createNull(scriptState);
2646 } 2645 }
2647 2646
2648 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer()); 2647 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer());
2649 if (attachmentObject->isTexture()) { 2648 if (attachmentObject->isTexture()) {
2650 switch (pname) { 2649 switch (pname) {
2651 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2650 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2652 return WebGLAny(scriptState, GL_TEXTURE); 2651 return WebGLAny(scriptState, GL_TEXTURE);
2653 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2652 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2654 return WebGLAny(scriptState, attachmentObject); 2653 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att achmentObject));
2655 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 2654 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
2656 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 2655 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
2657 { 2656 {
2658 GLint value = 0; 2657 GLint value = 0;
2659 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2658 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2660 return WebGLAny(scriptState, value); 2659 return WebGLAny(scriptState, value);
2661 } 2660 }
2662 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 2661 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
2663 if (extensionEnabled(EXTsRGBName)) { 2662 if (extensionEnabled(EXTsRGBName)) {
2664 GLint value = 0; 2663 GLint value = 0;
2665 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2664 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2666 return WebGLAny(scriptState, static_cast<unsigned>(value)); 2665 return WebGLAny(scriptState, static_cast<unsigned>(value));
2667 } 2666 }
2668 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2667 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
2669 return ScriptValue::createNull(scriptState); 2668 return ScriptValue::createNull(scriptState);
2670 default: 2669 default:
2671 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); 2670 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment");
2672 return ScriptValue::createNull(scriptState); 2671 return ScriptValue::createNull(scriptState);
2673 } 2672 }
2674 } else { 2673 } else {
2675 switch (pname) { 2674 switch (pname) {
2676 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2675 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2677 return WebGLAny(scriptState, GL_RENDERBUFFER); 2676 return WebGLAny(scriptState, GL_RENDERBUFFER);
2678 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2677 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2679 return WebGLAny(scriptState, attachmentObject); 2678 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att achmentObject));
2680 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 2679 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
2681 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { 2680 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) {
2682 GLint value = 0; 2681 GLint value = 0;
2683 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2682 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2684 return WebGLAny(scriptState, value); 2683 return WebGLAny(scriptState, value);
2685 } 2684 }
2686 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2685 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
2687 return ScriptValue::createNull(scriptState); 2686 return ScriptValue::createNull(scriptState);
2688 default: 2687 default:
2689 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2688 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
(...skipping 10 matching lines...) Expand all
2700 switch (pname) { 2699 switch (pname) {
2701 case GL_ACTIVE_TEXTURE: 2700 case GL_ACTIVE_TEXTURE:
2702 return getUnsignedIntParameter(scriptState, pname); 2701 return getUnsignedIntParameter(scriptState, pname);
2703 case GL_ALIASED_LINE_WIDTH_RANGE: 2702 case GL_ALIASED_LINE_WIDTH_RANGE:
2704 return getWebGLFloatArrayParameter(scriptState, pname); 2703 return getWebGLFloatArrayParameter(scriptState, pname);
2705 case GL_ALIASED_POINT_SIZE_RANGE: 2704 case GL_ALIASED_POINT_SIZE_RANGE:
2706 return getWebGLFloatArrayParameter(scriptState, pname); 2705 return getWebGLFloatArrayParameter(scriptState, pname);
2707 case GL_ALPHA_BITS: 2706 case GL_ALPHA_BITS:
2708 return getIntParameter(scriptState, pname); 2707 return getIntParameter(scriptState, pname);
2709 case GL_ARRAY_BUFFER_BINDING: 2708 case GL_ARRAY_BUFFER_BINDING:
2710 return WebGLAny(scriptState, m_boundArrayBuffer.get()); 2709 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound ArrayBuffer.get()));
2711 case GL_BLEND: 2710 case GL_BLEND:
2712 return getBooleanParameter(scriptState, pname); 2711 return getBooleanParameter(scriptState, pname);
2713 case GL_BLEND_COLOR: 2712 case GL_BLEND_COLOR:
2714 return getWebGLFloatArrayParameter(scriptState, pname); 2713 return getWebGLFloatArrayParameter(scriptState, pname);
2715 case GL_BLEND_DST_ALPHA: 2714 case GL_BLEND_DST_ALPHA:
2716 return getUnsignedIntParameter(scriptState, pname); 2715 return getUnsignedIntParameter(scriptState, pname);
2717 case GL_BLEND_DST_RGB: 2716 case GL_BLEND_DST_RGB:
2718 return getUnsignedIntParameter(scriptState, pname); 2717 return getUnsignedIntParameter(scriptState, pname);
2719 case GL_BLEND_EQUATION_ALPHA: 2718 case GL_BLEND_EQUATION_ALPHA:
2720 return getUnsignedIntParameter(scriptState, pname); 2719 return getUnsignedIntParameter(scriptState, pname);
2721 case GL_BLEND_EQUATION_RGB: 2720 case GL_BLEND_EQUATION_RGB:
2722 return getUnsignedIntParameter(scriptState, pname); 2721 return getUnsignedIntParameter(scriptState, pname);
2723 case GL_BLEND_SRC_ALPHA: 2722 case GL_BLEND_SRC_ALPHA:
2724 return getUnsignedIntParameter(scriptState, pname); 2723 return getUnsignedIntParameter(scriptState, pname);
2725 case GL_BLEND_SRC_RGB: 2724 case GL_BLEND_SRC_RGB:
2726 return getUnsignedIntParameter(scriptState, pname); 2725 return getUnsignedIntParameter(scriptState, pname);
2727 case GL_BLUE_BITS: 2726 case GL_BLUE_BITS:
2728 return getIntParameter(scriptState, pname); 2727 return getIntParameter(scriptState, pname);
2729 case GL_COLOR_CLEAR_VALUE: 2728 case GL_COLOR_CLEAR_VALUE:
2730 return getWebGLFloatArrayParameter(scriptState, pname); 2729 return getWebGLFloatArrayParameter(scriptState, pname);
2731 case GL_COLOR_WRITEMASK: 2730 case GL_COLOR_WRITEMASK:
2732 return getBooleanArrayParameter(scriptState, pname); 2731 return getBooleanArrayParameter(scriptState, pname);
2733 case GL_COMPRESSED_TEXTURE_FORMATS: 2732 case GL_COMPRESSED_TEXTURE_FORMATS:
2734 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF ormats.data(), m_compressedTextureFormats.size())); 2733 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF ormats.data(), m_compressedTextureFormats.size()));
2735 case GL_CULL_FACE: 2734 case GL_CULL_FACE:
2736 return getBooleanParameter(scriptState, pname); 2735 return getBooleanParameter(scriptState, pname);
2737 case GL_CULL_FACE_MODE: 2736 case GL_CULL_FACE_MODE:
2738 return getUnsignedIntParameter(scriptState, pname); 2737 return getUnsignedIntParameter(scriptState, pname);
2739 case GL_CURRENT_PROGRAM: 2738 case GL_CURRENT_PROGRAM:
2740 return WebGLAny(scriptState, m_currentProgram.get()); 2739 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_curre ntProgram.get()));
2741 case GL_DEPTH_BITS: 2740 case GL_DEPTH_BITS:
2742 if (!m_framebufferBinding && !m_requestedAttributes.depth()) 2741 if (!m_framebufferBinding && !m_requestedAttributes.depth())
2743 return WebGLAny(scriptState, intZero); 2742 return WebGLAny(scriptState, intZero);
2744 return getIntParameter(scriptState, pname); 2743 return getIntParameter(scriptState, pname);
2745 case GL_DEPTH_CLEAR_VALUE: 2744 case GL_DEPTH_CLEAR_VALUE:
2746 return getFloatParameter(scriptState, pname); 2745 return getFloatParameter(scriptState, pname);
2747 case GL_DEPTH_FUNC: 2746 case GL_DEPTH_FUNC:
2748 return getUnsignedIntParameter(scriptState, pname); 2747 return getUnsignedIntParameter(scriptState, pname);
2749 case GL_DEPTH_RANGE: 2748 case GL_DEPTH_RANGE:
2750 return getWebGLFloatArrayParameter(scriptState, pname); 2749 return getWebGLFloatArrayParameter(scriptState, pname);
2751 case GL_DEPTH_TEST: 2750 case GL_DEPTH_TEST:
2752 return getBooleanParameter(scriptState, pname); 2751 return getBooleanParameter(scriptState, pname);
2753 case GL_DEPTH_WRITEMASK: 2752 case GL_DEPTH_WRITEMASK:
2754 return getBooleanParameter(scriptState, pname); 2753 return getBooleanParameter(scriptState, pname);
2755 case GL_DITHER: 2754 case GL_DITHER:
2756 return getBooleanParameter(scriptState, pname); 2755 return getBooleanParameter(scriptState, pname);
2757 case GL_ELEMENT_ARRAY_BUFFER_BINDING: 2756 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
2758 return WebGLAny(scriptState, m_boundVertexArrayObject->boundElementArray Buffer()); 2757 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound VertexArrayObject->boundElementArrayBuffer()));
2759 case GL_FRAMEBUFFER_BINDING: 2758 case GL_FRAMEBUFFER_BINDING:
2760 return WebGLAny(scriptState, m_framebufferBinding.get()); 2759 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_frame bufferBinding.get()));
2761 case GL_FRONT_FACE: 2760 case GL_FRONT_FACE:
2762 return getUnsignedIntParameter(scriptState, pname); 2761 return getUnsignedIntParameter(scriptState, pname);
2763 case GL_GENERATE_MIPMAP_HINT: 2762 case GL_GENERATE_MIPMAP_HINT:
2764 return getUnsignedIntParameter(scriptState, pname); 2763 return getUnsignedIntParameter(scriptState, pname);
2765 case GL_GREEN_BITS: 2764 case GL_GREEN_BITS:
2766 return getIntParameter(scriptState, pname); 2765 return getIntParameter(scriptState, pname);
2767 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: 2766 case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
2768 return getIntParameter(scriptState, pname); 2767 return getIntParameter(scriptState, pname);
2769 case GL_IMPLEMENTATION_COLOR_READ_TYPE: 2768 case GL_IMPLEMENTATION_COLOR_READ_TYPE:
2770 return getIntParameter(scriptState, pname); 2769 return getIntParameter(scriptState, pname);
(...skipping 28 matching lines...) Expand all
2799 return getIntParameter(scriptState, pname); 2798 return getIntParameter(scriptState, pname);
2800 case GL_POLYGON_OFFSET_FACTOR: 2799 case GL_POLYGON_OFFSET_FACTOR:
2801 return getFloatParameter(scriptState, pname); 2800 return getFloatParameter(scriptState, pname);
2802 case GL_POLYGON_OFFSET_FILL: 2801 case GL_POLYGON_OFFSET_FILL:
2803 return getBooleanParameter(scriptState, pname); 2802 return getBooleanParameter(scriptState, pname);
2804 case GL_POLYGON_OFFSET_UNITS: 2803 case GL_POLYGON_OFFSET_UNITS:
2805 return getFloatParameter(scriptState, pname); 2804 return getFloatParameter(scriptState, pname);
2806 case GL_RED_BITS: 2805 case GL_RED_BITS:
2807 return getIntParameter(scriptState, pname); 2806 return getIntParameter(scriptState, pname);
2808 case GL_RENDERBUFFER_BINDING: 2807 case GL_RENDERBUFFER_BINDING:
2809 return WebGLAny(scriptState, m_renderbufferBinding.get()); 2808 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_rende rbufferBinding.get()));
2810 case GL_RENDERER: 2809 case GL_RENDERER:
2811 return WebGLAny(scriptState, String("WebKit WebGL")); 2810 return WebGLAny(scriptState, String("WebKit WebGL"));
2812 case GL_SAMPLE_BUFFERS: 2811 case GL_SAMPLE_BUFFERS:
2813 return getIntParameter(scriptState, pname); 2812 return getIntParameter(scriptState, pname);
2814 case GL_SAMPLE_COVERAGE_INVERT: 2813 case GL_SAMPLE_COVERAGE_INVERT:
2815 return getBooleanParameter(scriptState, pname); 2814 return getBooleanParameter(scriptState, pname);
2816 case GL_SAMPLE_COVERAGE_VALUE: 2815 case GL_SAMPLE_COVERAGE_VALUE:
2817 return getFloatParameter(scriptState, pname); 2816 return getFloatParameter(scriptState, pname);
2818 case GL_SAMPLES: 2817 case GL_SAMPLES:
2819 return getIntParameter(scriptState, pname); 2818 return getIntParameter(scriptState, pname);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2855 return getIntParameter(scriptState, pname); 2854 return getIntParameter(scriptState, pname);
2856 case GL_STENCIL_TEST: 2855 case GL_STENCIL_TEST:
2857 return getBooleanParameter(scriptState, pname); 2856 return getBooleanParameter(scriptState, pname);
2858 case GL_STENCIL_VALUE_MASK: 2857 case GL_STENCIL_VALUE_MASK:
2859 return getUnsignedIntParameter(scriptState, pname); 2858 return getUnsignedIntParameter(scriptState, pname);
2860 case GL_STENCIL_WRITEMASK: 2859 case GL_STENCIL_WRITEMASK:
2861 return getUnsignedIntParameter(scriptState, pname); 2860 return getUnsignedIntParameter(scriptState, pname);
2862 case GL_SUBPIXEL_BITS: 2861 case GL_SUBPIXEL_BITS:
2863 return getIntParameter(scriptState, pname); 2862 return getIntParameter(scriptState, pname);
2864 case GL_TEXTURE_BINDING_2D: 2863 case GL_TEXTURE_BINDING_2D:
2865 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu re2DBinding.get()); 2864 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu reUnits[m_activeTextureUnit].m_texture2DBinding.get()));
2866 case GL_TEXTURE_BINDING_CUBE_MAP: 2865 case GL_TEXTURE_BINDING_CUBE_MAP:
2867 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu reCubeMapBinding.get()); 2866 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu reUnits[m_activeTextureUnit].m_textureCubeMapBinding.get()));
2868 case GL_UNPACK_ALIGNMENT: 2867 case GL_UNPACK_ALIGNMENT:
2869 return getIntParameter(scriptState, pname); 2868 return getIntParameter(scriptState, pname);
2870 case GC3D_UNPACK_FLIP_Y_WEBGL: 2869 case GC3D_UNPACK_FLIP_Y_WEBGL:
2871 return WebGLAny(scriptState, m_unpackFlipY); 2870 return WebGLAny(scriptState, m_unpackFlipY);
2872 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: 2871 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL:
2873 return WebGLAny(scriptState, m_unpackPremultiplyAlpha); 2872 return WebGLAny(scriptState, m_unpackPremultiplyAlpha);
2874 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: 2873 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL:
2875 return WebGLAny(scriptState, m_unpackColorspaceConversion); 2874 return WebGLAny(scriptState, m_unpackColorspaceConversion);
2876 case GL_VENDOR: 2875 case GL_VENDOR:
2877 return WebGLAny(scriptState, String("WebKit")); 2876 return WebGLAny(scriptState, String("WebKit"));
(...skipping 12 matching lines...) Expand all
2890 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); 2889 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled");
2891 return ScriptValue::createNull(scriptState); 2890 return ScriptValue::createNull(scriptState);
2892 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: 2891 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL:
2893 if (extensionEnabled(WebGLDebugRendererInfoName)) 2892 if (extensionEnabled(WebGLDebugRendererInfoName))
2894 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR)); 2893 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR));
2895 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); 2894 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled");
2896 return ScriptValue::createNull(scriptState); 2895 return ScriptValue::createNull(scriptState);
2897 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object 2896 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object
2898 if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) { 2897 if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) {
2899 if (!m_boundVertexArrayObject->isDefaultObject()) 2898 if (!m_boundVertexArrayObject->isDefaultObject())
2900 return WebGLAny(scriptState, m_boundVertexArrayObject.get()); 2899 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject> (m_boundVertexArrayObject.get()));
2901 return ScriptValue::createNull(scriptState); 2900 return ScriptValue::createNull(scriptState);
2902 } 2901 }
2903 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); 2902 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled");
2904 return ScriptValue::createNull(scriptState); 2903 return ScriptValue::createNull(scriptState);
2905 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic 2904 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic
2906 if (extensionEnabled(EXTTextureFilterAnisotropicName)) 2905 if (extensionEnabled(EXTTextureFilterAnisotropicName))
2907 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT); 2906 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT);
2908 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); 2907 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled");
2909 return ScriptValue::createNull(scriptState); 2908 return ScriptValue::createNull(scriptState);
2910 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN 2909 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 } 3041 }
3043 } 3042 }
3044 3043
3045 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) 3044 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader)
3046 { 3045 {
3047 if (isContextLost() || !validateWebGLObject("getShaderInfoLog", shader)) 3046 if (isContextLost() || !validateWebGLObject("getShaderInfoLog", shader))
3048 return String(); 3047 return String();
3049 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); 3048 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader)));
3050 } 3049 }
3051 3050
3052 WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( GLenum shaderType, GLenum precisionType) 3051 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::ge tShaderPrecisionFormat(GLenum shaderType, GLenum precisionType)
3053 { 3052 {
3054 if (isContextLost()) 3053 if (isContextLost())
3055 return nullptr; 3054 return nullptr;
3056 switch (shaderType) { 3055 switch (shaderType) {
3057 case GL_VERTEX_SHADER: 3056 case GL_VERTEX_SHADER:
3058 case GL_FRAGMENT_SHADER: 3057 case GL_FRAGMENT_SHADER:
3059 break; 3058 break;
3060 default: 3059 default:
3061 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); 3060 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type");
3062 return nullptr; 3061 return nullptr;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 notImplemented(); 3337 notImplemented();
3339 } 3338 }
3340 } 3339 }
3341 } 3340 }
3342 } 3341 }
3343 // If we get here, something went wrong in our unfortunately complex logic a bove 3342 // If we get here, something went wrong in our unfortunately complex logic a bove
3344 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); 3343 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error");
3345 return ScriptValue::createNull(scriptState); 3344 return ScriptValue::createNull(scriptState);
3346 } 3345 }
3347 3346
3348 WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram * program, const String& name) 3347 PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUnifo rmLocation(WebGLProgram* program, const String& name)
3349 { 3348 {
3350 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) 3349 if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
3351 return nullptr; 3350 return nullptr;
3352 if (!validateLocationLength("getUniformLocation", name)) 3351 if (!validateLocationLength("getUniformLocation", name))
3353 return nullptr; 3352 return nullptr;
3354 if (!validateString("getUniformLocation", name)) 3353 if (!validateString("getUniformLocation", name))
3355 return nullptr; 3354 return nullptr;
3356 if (isPrefixReserved(name)) 3355 if (isPrefixReserved(name))
3357 return nullptr; 3356 return nullptr;
3358 if (!program->linkStatus()) { 3357 if (!program->linkStatus()) {
(...skipping 17 matching lines...) Expand all
3376 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index); 3375 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index);
3377 3376
3378 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) 3377 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher())
3379 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) 3378 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
3380 return WebGLAny(scriptState, state->divisor); 3379 return WebGLAny(scriptState, state->divisor);
3381 3380
3382 switch (pname) { 3381 switch (pname) {
3383 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 3382 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
3384 if (!state->bufferBinding || !state->bufferBinding->object()) 3383 if (!state->bufferBinding || !state->bufferBinding->object())
3385 return ScriptValue::createNull(scriptState); 3384 return ScriptValue::createNull(scriptState);
3386 return WebGLAny(scriptState, state->bufferBinding.get()); 3385 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get()));
3387 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: 3386 case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
3388 return WebGLAny(scriptState, state->enabled); 3387 return WebGLAny(scriptState, state->enabled);
3389 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: 3388 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
3390 return WebGLAny(scriptState, state->normalized); 3389 return WebGLAny(scriptState, state->normalized);
3391 case GL_VERTEX_ATTRIB_ARRAY_SIZE: 3390 case GL_VERTEX_ATTRIB_ARRAY_SIZE:
3392 return WebGLAny(scriptState, state->size); 3391 return WebGLAny(scriptState, state->size);
3393 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: 3392 case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
3394 return WebGLAny(scriptState, state->originalStride); 3393 return WebGLAny(scriptState, state->originalStride);
3395 case GL_VERTEX_ATTRIB_ARRAY_TYPE: 3394 case GL_VERTEX_ATTRIB_ARRAY_TYPE:
3396 return WebGLAny(scriptState, state->type); 3395 return WebGLAny(scriptState, state->type);
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 webContext()->stencilOp(fail, zfail, zpass); 3969 webContext()->stencilOp(fail, zfail, zpass);
3971 } 3970 }
3972 3971
3973 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen um zfail, GLenum zpass) 3972 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen um zfail, GLenum zpass)
3974 { 3973 {
3975 if (isContextLost()) 3974 if (isContextLost())
3976 return; 3975 return;
3977 webContext()->stencilOpSeparate(face, fail, zfail, zpass); 3976 webContext()->stencilOpSeparate(face, fail, zfail, zpass);
3978 } 3977 }
3979 3978
3980 CHROMIUMValuebuffer* WebGLRenderingContextBase::createValuebufferCHROMIUM() 3979 PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> WebGLRenderingContextBase::createVal uebufferCHROMIUM()
3981 { 3980 {
3982 if (isContextLost()) 3981 if (isContextLost())
3983 return nullptr; 3982 return nullptr;
3984 CHROMIUMValuebuffer* o = CHROMIUMValuebuffer::create(this); 3983 RefPtrWillBeRawPtr<CHROMIUMValuebuffer> o = CHROMIUMValuebuffer::create(this );
3985 addSharedObject(o); 3984 addSharedObject(o.get());
3986 return o; 3985 return o.release();
3987 } 3986 }
3988 3987
3989 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v aluebuffer) 3988 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v aluebuffer)
3990 { 3989 {
3991 if (!deleteObject(valuebuffer)) 3990 if (!deleteObject(valuebuffer))
3992 return; 3991 return;
3993 if (valuebuffer == m_valuebufferBinding) 3992 if (valuebuffer == m_valuebufferBinding)
3994 m_valuebufferBinding = nullptr; 3993 m_valuebufferBinding = nullptr;
3995 } 3994 }
3996 3995
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
5070 } 5069 }
5071 5070
5072 // Make absolutely sure we do not refer to an already-deleted texture or fra mebuffer. 5071 // Make absolutely sure we do not refer to an already-deleted texture or fra mebuffer.
5073 drawingBuffer()->setTexture2DBinding(0); 5072 drawingBuffer()->setTexture2DBinding(0);
5074 drawingBuffer()->setFramebufferBinding(GL_FRAMEBUFFER, 0); 5073 drawingBuffer()->setFramebufferBinding(GL_FRAMEBUFFER, 0);
5075 5074
5076 detachAndRemoveAllObjects(); 5075 detachAndRemoveAllObjects();
5077 5076
5078 // Lose all the extensions. 5077 // Lose all the extensions.
5079 for (size_t i = 0; i < m_extensions.size(); ++i) { 5078 for (size_t i = 0; i < m_extensions.size(); ++i) {
5080 ExtensionTracker* tracker = m_extensions[i]; 5079 ExtensionTracker* tracker = m_extensions[i].get();
5081 tracker->loseExtension(false); 5080 tracker->loseExtension();
5082 } 5081 }
5083 5082
5084 for (size_t i = 0; i < WebGLExtensionNameCount; ++i) 5083 for (size_t i = 0; i < WebGLExtensionNameCount; ++i)
5085 m_extensionEnabled[i] = false; 5084 m_extensionEnabled[i] = false;
5086 5085
5087 removeAllCompressedTextureFormats(); 5086 removeAllCompressedTextureFormats();
5088 5087
5089 if (mode != RealLostContext) 5088 if (mode != RealLostContext)
5090 destroyContext(); 5089 destroyContext();
5091 5090
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5161 5160
5162 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) 5161 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object)
5163 { 5162 {
5164 ASSERT(!isContextLost()); 5163 ASSERT(!isContextLost());
5165 m_contextObjects.add(object); 5164 m_contextObjects.add(object);
5166 } 5165 }
5167 5166
5168 void WebGLRenderingContextBase::detachAndRemoveAllObjects() 5167 void WebGLRenderingContextBase::detachAndRemoveAllObjects()
5169 { 5168 {
5170 while (m_contextObjects.size() > 0) { 5169 while (m_contextObjects.size() > 0) {
5171 // Following detachContext() will remove the iterated object from 5170 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject>>::iterator it = m_contextObjects.begin();
5172 // |m_contextObjects|, and thus we need to look up begin() every time.
5173 auto it = m_contextObjects.begin();
5174 (*it)->detachContext(); 5171 (*it)->detachContext();
5175 } 5172 }
5176 } 5173 }
5177 5174
5178 void WebGLRenderingContextBase::stop() 5175 void WebGLRenderingContextBase::stop()
5179 { 5176 {
5180 if (!isContextLost()) { 5177 if (!isContextLost()) {
5181 // Never attempt to restore the context because the page is being torn d own. 5178 // Never attempt to restore the context because the page is being torn d own.
5182 forceLostContext(SyntheticLostContext, Manual); 5179 forceLostContext(SyntheticLostContext, Manual);
5183 } 5180 }
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
6065 return false; 6062 return false;
6066 } 6063 }
6067 return true; 6064 return true;
6068 } 6065 }
6069 6066
6070 WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun ctionName, GLenum target) 6067 WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun ctionName, GLenum target)
6071 { 6068 {
6072 WebGLBuffer* buffer = nullptr; 6069 WebGLBuffer* buffer = nullptr;
6073 switch (target) { 6070 switch (target) {
6074 case GL_ELEMENT_ARRAY_BUFFER: 6071 case GL_ELEMENT_ARRAY_BUFFER:
6075 buffer = m_boundVertexArrayObject->boundElementArrayBuffer(); 6072 buffer = m_boundVertexArrayObject->boundElementArrayBuffer().get();
6076 break; 6073 break;
6077 case GL_ARRAY_BUFFER: 6074 case GL_ARRAY_BUFFER:
6078 buffer = m_boundArrayBuffer.get(); 6075 buffer = m_boundArrayBuffer.get();
6079 break; 6076 break;
6080 default: 6077 default:
6081 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); 6078 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target");
6082 return nullptr; 6079 return nullptr;
6083 } 6080 }
6084 if (!buffer) { 6081 if (!buffer) {
6085 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no buffer"); 6082 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no buffer");
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
6591 DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState) 6588 DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState)
6592 { 6589 {
6593 visitor->trace(m_texture2DBinding); 6590 visitor->trace(m_texture2DBinding);
6594 visitor->trace(m_textureCubeMapBinding); 6591 visitor->trace(m_textureCubeMapBinding);
6595 visitor->trace(m_texture3DBinding); 6592 visitor->trace(m_texture3DBinding);
6596 visitor->trace(m_texture2DArrayBinding); 6593 visitor->trace(m_texture2DArrayBinding);
6597 } 6594 }
6598 6595
6599 DEFINE_TRACE(WebGLRenderingContextBase) 6596 DEFINE_TRACE(WebGLRenderingContextBase)
6600 { 6597 {
6598 #if ENABLE(OILPAN)
6601 visitor->trace(m_contextObjects); 6599 visitor->trace(m_contextObjects);
6602 visitor->trace(m_contextLostCallbackAdapter); 6600 visitor->trace(m_contextLostCallbackAdapter);
6603 visitor->trace(m_errorMessageCallbackAdapter); 6601 visitor->trace(m_errorMessageCallbackAdapter);
6604 visitor->trace(m_boundArrayBuffer); 6602 visitor->trace(m_boundArrayBuffer);
6605 visitor->trace(m_defaultVertexArrayObject); 6603 visitor->trace(m_defaultVertexArrayObject);
6606 visitor->trace(m_boundVertexArrayObject); 6604 visitor->trace(m_boundVertexArrayObject);
6607 visitor->trace(m_vertexAttrib0Buffer); 6605 visitor->trace(m_vertexAttrib0Buffer);
6608 visitor->trace(m_currentProgram); 6606 visitor->trace(m_currentProgram);
6609 visitor->trace(m_framebufferBinding); 6607 visitor->trace(m_framebufferBinding);
6610 visitor->trace(m_renderbufferBinding); 6608 visitor->trace(m_renderbufferBinding);
6611 visitor->trace(m_valuebufferBinding); 6609 visitor->trace(m_valuebufferBinding);
6612 visitor->trace(m_textureUnits); 6610 visitor->trace(m_textureUnits);
6613 visitor->trace(m_blackTexture2D); 6611 visitor->trace(m_blackTexture2D);
6614 visitor->trace(m_blackTextureCubeMap); 6612 visitor->trace(m_blackTextureCubeMap);
6613 visitor->trace(m_requestedAttributes);
6615 visitor->trace(m_extensions); 6614 visitor->trace(m_extensions);
6615 #endif
6616 CanvasRenderingContext::trace(visitor); 6616 CanvasRenderingContext::trace(visitor);
6617 } 6617 }
6618 6618
6619 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel() 6619 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel()
6620 { 6620 {
6621 if (isContextLost()) 6621 if (isContextLost())
6622 return 0; 6622 return 0;
6623 6623
6624 int bytesPerPixel = 4; 6624 int bytesPerPixel = 4;
6625 int totalBytesPerPixel = bytesPerPixel * 2; // WebGL's front and back color buffers. 6625 int totalBytesPerPixel = bytesPerPixel * 2; // WebGL's front and back color buffers.
(...skipping 15 matching lines...) Expand all
6641 6641
6642 return totalBytesPerPixel; 6642 return totalBytesPerPixel;
6643 } 6643 }
6644 6644
6645 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6645 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6646 { 6646 {
6647 return m_drawingBuffer.get(); 6647 return m_drawingBuffer.get();
6648 } 6648 }
6649 6649
6650 } // namespace blink 6650 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webgl/WebGLRenderingContextBase.h ('k') | Source/modules/webgl/WebGLSampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698