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

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

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