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

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 & work for some comments 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
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 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 return; 1918 return;
1921 } 1919 }
1922 WebGLFramebuffer* readFramebufferBinding = nullptr; 1920 WebGLFramebuffer* readFramebufferBinding = nullptr;
1923 if (!validateReadBufferAndGetInfo("copyTexSubImage2D", readFramebufferBindin g, nullptr, nullptr)) 1921 if (!validateReadBufferAndGetInfo("copyTexSubImage2D", readFramebufferBindin g, nullptr, nullptr))
1924 return; 1922 return;
1925 clearIfComposited(); 1923 clearIfComposited();
1926 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding); 1924 ScopedDrawingBufferBinder binder(drawingBuffer(), readFramebufferBinding);
1927 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height); 1925 webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width , height);
1928 } 1926 }
1929 1927
1930 PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() 1928 WebGLBuffer* WebGLRenderingContextBase::createBuffer()
1931 { 1929 {
1932 if (isContextLost()) 1930 if (isContextLost())
1933 return nullptr; 1931 return nullptr;
1934 RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this); 1932 WebGLBuffer* o = WebGLBuffer::create(this);
1935 addSharedObject(o.get()); 1933 addSharedObject(o);
1936 return o.release(); 1934 return o;
1937 } 1935 }
1938 1936
1939 PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFrameb uffer() 1937 WebGLFramebuffer* WebGLRenderingContextBase::createFramebuffer()
1940 { 1938 {
1941 if (isContextLost()) 1939 if (isContextLost())
1942 return nullptr; 1940 return nullptr;
1943 RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); 1941 WebGLFramebuffer* o = WebGLFramebuffer::create(this);
1944 addContextObject(o.get()); 1942 addContextObject(o);
1945 return o.release(); 1943 return o;
1946 } 1944 }
1947 1945
1948 PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() 1946 WebGLTexture* WebGLRenderingContextBase::createTexture()
1949 { 1947 {
1950 if (isContextLost()) 1948 if (isContextLost())
1951 return nullptr; 1949 return nullptr;
1952 RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this); 1950 WebGLTexture* o = WebGLTexture::create(this);
1953 addSharedObject(o.get()); 1951 addSharedObject(o);
1954 return o.release(); 1952 return o;
1955 } 1953 }
1956 1954
1957 PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() 1955 WebGLProgram* WebGLRenderingContextBase::createProgram()
1958 { 1956 {
1959 if (isContextLost()) 1957 if (isContextLost())
1960 return nullptr; 1958 return nullptr;
1961 RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this); 1959 WebGLProgram* o = WebGLProgram::create(this);
1962 addSharedObject(o.get()); 1960 addSharedObject(o);
1963 return o.release(); 1961 return o;
1964 } 1962 }
1965 1963
1966 PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRende rbuffer() 1964 WebGLRenderbuffer* WebGLRenderingContextBase::createRenderbuffer()
1967 { 1965 {
1968 if (isContextLost()) 1966 if (isContextLost())
1969 return nullptr; 1967 return nullptr;
1970 RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); 1968 WebGLRenderbuffer* o = WebGLRenderbuffer::create(this);
1971 addSharedObject(o.get()); 1969 addSharedObject(o);
1972 return o.release(); 1970 return o;
1973 } 1971 }
1974 1972
1975 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) 1973 WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer)
1976 { 1974 {
1977 if (isContextLost()) 1975 if (isContextLost())
1978 return nullptr; 1976 return nullptr;
1979 if (!renderbuffer->emulatedStencilBuffer()) { 1977 if (!renderbuffer->emulatedStencilBuffer()) {
1980 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer()); 1978 renderbuffer->setEmulatedStencilBuffer(createRenderbuffer());
1981 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer())); 1979 webContext()->bindRenderbuffer(target, objectOrZero(renderbuffer->emulat edStencilBuffer()));
1982 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get())); 1980 webContext()->bindRenderbuffer(target, objectOrZero(m_renderbufferBindin g.get()));
1983 } 1981 }
1984 return renderbuffer->emulatedStencilBuffer(); 1982 return renderbuffer->emulatedStencilBuffer();
1985 } 1983 }
1986 1984
1987 PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen um type) 1985 WebGLShader* WebGLRenderingContextBase::createShader(GLenum type)
1988 { 1986 {
1989 if (isContextLost()) 1987 if (isContextLost())
1990 return nullptr; 1988 return nullptr;
1991 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) { 1989 if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) {
1992 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" ); 1990 synthesizeGLError(GL_INVALID_ENUM, "createShader", "invalid shader type" );
1993 return nullptr; 1991 return nullptr;
1994 } 1992 }
1995 1993
1996 RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type); 1994 WebGLShader* o = WebGLShader::create(this, type);
1997 addSharedObject(o.get()); 1995 addSharedObject(o);
1998 return o.release(); 1996 return o;
1999 } 1997 }
2000 1998
2001 void WebGLRenderingContextBase::cullFace(GLenum mode) 1999 void WebGLRenderingContextBase::cullFace(GLenum mode)
2002 { 2000 {
2003 if (isContextLost()) 2001 if (isContextLost())
2004 return; 2002 return;
2005 switch (mode) { 2003 switch (mode) {
2006 case GL_FRONT_AND_BACK: 2004 case GL_FRONT_AND_BACK:
2007 case GL_FRONT: 2005 case GL_FRONT:
2008 case GL_BACK: 2006 case GL_BACK:
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
2444 } 2442 }
2445 #endif 2443 #endif
2446 webContext()->generateMipmap(target); 2444 webContext()->generateMipmap(target);
2447 #if OS(MACOSX) 2445 #if OS(MACOSX)
2448 if (needToResetMinFilter) 2446 if (needToResetMinFilter)
2449 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter()); 2447 webContext()->texParameteri(target, GL_TEXTURE_MIN_FILTER, tex->getMinFi lter());
2450 #endif 2448 #endif
2451 tex->generateMipmapLevelInfo(); 2449 tex->generateMipmapLevelInfo();
2452 } 2450 }
2453 2451
2454 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr ib(WebGLProgram* program, GLuint index) 2452 WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* progra m, GLuint index)
2455 { 2453 {
2456 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) 2454 if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
2457 return nullptr; 2455 return nullptr;
2458 WebGraphicsContext3D::ActiveInfo info; 2456 WebGraphicsContext3D::ActiveInfo info;
2459 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info)) 2457 if (!webContext()->getActiveAttrib(objectOrZero(program), index, info))
2460 return nullptr; 2458 return nullptr;
2461 return WebGLActiveInfo::create(info.name, info.type, info.size); 2459 return WebGLActiveInfo::create(info.name, info.type, info.size);
2462 } 2460 }
2463 2461
2464 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif orm(WebGLProgram* program, GLuint index) 2462 WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* progr am, GLuint index)
2465 { 2463 {
2466 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) 2464 if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
2467 return nullptr; 2465 return nullptr;
2468 WebGraphicsContext3D::ActiveInfo info; 2466 WebGraphicsContext3D::ActiveInfo info;
2469 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) 2467 if (!webContext()->getActiveUniform(objectOrZero(program), index, info))
2470 return nullptr; 2468 return nullptr;
2471 return WebGLActiveInfo::create(info.name, info.type, info.size); 2469 return WebGLActiveInfo::create(info.name, info.type, info.size);
2472 } 2470 }
2473 2471
2474 Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> WebGLRenderingContex tBase::getAttachedShaders(WebGLProgram* program) 2472 Nullable<HeapVector<Member<WebGLShader>>> WebGLRenderingContextBase::getAttached Shaders(WebGLProgram* program)
2475 { 2473 {
2476 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) 2474 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
2477 return nullptr; 2475 return nullptr;
2478 2476
2479 WillBeHeapVector<RefPtrWillBeMember<WebGLShader>> shaderObjects; 2477 HeapVector<Member<WebGLShader>> shaderObjects;
2480 const GLenum shaderType[] = { 2478 const GLenum shaderType[] = {
2481 GL_VERTEX_SHADER, 2479 GL_VERTEX_SHADER,
2482 GL_FRAGMENT_SHADER 2480 GL_FRAGMENT_SHADER
2483 }; 2481 };
2484 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { 2482 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) {
2485 WebGLShader* shader = program->getAttachedShader(shaderType[i]); 2483 WebGLShader* shader = program->getAttachedShader(shaderType[i]);
2486 if (shader) 2484 if (shader)
2487 shaderObjects.append(shader); 2485 shaderObjects.append(shader);
2488 } 2486 }
2489 return shaderObjects; 2487 return shaderObjects;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 { 2593 {
2596 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ()) 2594 if (tracker->draft() && !RuntimeEnabledFeatures::webGLDraftExtensionsEnabled ())
2597 return false; 2595 return false;
2598 if (!tracker->supported(this)) 2596 if (!tracker->supported(this))
2599 return false; 2597 return false;
2600 return true; 2598 return true;
2601 } 2599 }
2602 2600
2603 ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, co nst String& name) 2601 ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, co nst String& name)
2604 { 2602 {
2605 RefPtrWillBeRawPtr<WebGLExtension> extension = nullptr; 2603 WebGLExtension* extension = nullptr;
2606 2604
2607 if (!isContextLost()) { 2605 if (!isContextLost()) {
2608 for (size_t i = 0; i < m_extensions.size(); ++i) { 2606 for (size_t i = 0; i < m_extensions.size(); ++i) {
2609 ExtensionTracker* tracker = m_extensions[i].get(); 2607 ExtensionTracker* tracker = m_extensions[i].get();
2610 if (tracker->matchesNameWithPrefixes(name)) { 2608 if (tracker->matchesNameWithPrefixes(name)) {
2611 if (extensionSupportedAndAllowed(tracker)) { 2609 if (extensionSupportedAndAllowed(tracker)) {
2612 extension = tracker->getExtension(this); 2610 extension = tracker->getExtension(this);
2613 if (extension) 2611 if (extension)
2614 m_extensionEnabled[extension->name()] = true; 2612 m_extensionEnabled[extension->name()] = true;
2615 } 2613 }
(...skipping 24 matching lines...) Expand all
2640 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name"); 2638 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name");
2641 return ScriptValue::createNull(scriptState); 2639 return ScriptValue::createNull(scriptState);
2642 } 2640 }
2643 2641
2644 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer()); 2642 ASSERT(attachmentObject->isTexture() || attachmentObject->isRenderbuffer());
2645 if (attachmentObject->isTexture()) { 2643 if (attachmentObject->isTexture()) {
2646 switch (pname) { 2644 switch (pname) {
2647 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2645 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2648 return WebGLAny(scriptState, GL_TEXTURE); 2646 return WebGLAny(scriptState, GL_TEXTURE);
2649 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2647 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2650 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att achmentObject)); 2648 return WebGLAny(scriptState, attachmentObject);
2651 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 2649 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
2652 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 2650 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
2653 { 2651 {
2654 GLint value = 0; 2652 GLint value = 0;
2655 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2653 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2656 return WebGLAny(scriptState, value); 2654 return WebGLAny(scriptState, value);
2657 } 2655 }
2658 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 2656 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
2659 if (extensionEnabled(EXTsRGBName)) { 2657 if (extensionEnabled(EXTsRGBName)) {
2660 GLint value = 0; 2658 GLint value = 0;
2661 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2659 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2662 return WebGLAny(scriptState, static_cast<unsigned>(value)); 2660 return WebGLAny(scriptState, static_cast<unsigned>(value));
2663 } 2661 }
2664 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2662 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
2665 return ScriptValue::createNull(scriptState); 2663 return ScriptValue::createNull(scriptState);
2666 default: 2664 default:
2667 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment"); 2665 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for texture attachment");
2668 return ScriptValue::createNull(scriptState); 2666 return ScriptValue::createNull(scriptState);
2669 } 2667 }
2670 } else { 2668 } else {
2671 switch (pname) { 2669 switch (pname) {
2672 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 2670 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
2673 return WebGLAny(scriptState, GL_RENDERBUFFER); 2671 return WebGLAny(scriptState, GL_RENDERBUFFER);
2674 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 2672 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
2675 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(att achmentObject)); 2673 return WebGLAny(scriptState, attachmentObject);
2676 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 2674 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT:
2677 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { 2675 if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) {
2678 GLint value = 0; 2676 GLint value = 0;
2679 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value); 2677 webContext()->getFramebufferAttachmentParameteriv(target, attach ment, pname, &value);
2680 return WebGLAny(scriptState, value); 2678 return WebGLAny(scriptState, value);
2681 } 2679 }
2682 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2680 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
2683 return ScriptValue::createNull(scriptState); 2681 return ScriptValue::createNull(scriptState);
2684 default: 2682 default:
2685 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment"); 2683 synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParamete r", "invalid parameter name for renderbuffer attachment");
(...skipping 10 matching lines...) Expand all
2696 switch (pname) { 2694 switch (pname) {
2697 case GL_ACTIVE_TEXTURE: 2695 case GL_ACTIVE_TEXTURE:
2698 return getUnsignedIntParameter(scriptState, pname); 2696 return getUnsignedIntParameter(scriptState, pname);
2699 case GL_ALIASED_LINE_WIDTH_RANGE: 2697 case GL_ALIASED_LINE_WIDTH_RANGE:
2700 return getWebGLFloatArrayParameter(scriptState, pname); 2698 return getWebGLFloatArrayParameter(scriptState, pname);
2701 case GL_ALIASED_POINT_SIZE_RANGE: 2699 case GL_ALIASED_POINT_SIZE_RANGE:
2702 return getWebGLFloatArrayParameter(scriptState, pname); 2700 return getWebGLFloatArrayParameter(scriptState, pname);
2703 case GL_ALPHA_BITS: 2701 case GL_ALPHA_BITS:
2704 return getIntParameter(scriptState, pname); 2702 return getIntParameter(scriptState, pname);
2705 case GL_ARRAY_BUFFER_BINDING: 2703 case GL_ARRAY_BUFFER_BINDING:
2706 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound ArrayBuffer.get())); 2704 return WebGLAny(scriptState, m_boundArrayBuffer.get());
2707 case GL_BLEND: 2705 case GL_BLEND:
2708 return getBooleanParameter(scriptState, pname); 2706 return getBooleanParameter(scriptState, pname);
2709 case GL_BLEND_COLOR: 2707 case GL_BLEND_COLOR:
2710 return getWebGLFloatArrayParameter(scriptState, pname); 2708 return getWebGLFloatArrayParameter(scriptState, pname);
2711 case GL_BLEND_DST_ALPHA: 2709 case GL_BLEND_DST_ALPHA:
2712 return getUnsignedIntParameter(scriptState, pname); 2710 return getUnsignedIntParameter(scriptState, pname);
2713 case GL_BLEND_DST_RGB: 2711 case GL_BLEND_DST_RGB:
2714 return getUnsignedIntParameter(scriptState, pname); 2712 return getUnsignedIntParameter(scriptState, pname);
2715 case GL_BLEND_EQUATION_ALPHA: 2713 case GL_BLEND_EQUATION_ALPHA:
2716 return getUnsignedIntParameter(scriptState, pname); 2714 return getUnsignedIntParameter(scriptState, pname);
2717 case GL_BLEND_EQUATION_RGB: 2715 case GL_BLEND_EQUATION_RGB:
2718 return getUnsignedIntParameter(scriptState, pname); 2716 return getUnsignedIntParameter(scriptState, pname);
2719 case GL_BLEND_SRC_ALPHA: 2717 case GL_BLEND_SRC_ALPHA:
2720 return getUnsignedIntParameter(scriptState, pname); 2718 return getUnsignedIntParameter(scriptState, pname);
2721 case GL_BLEND_SRC_RGB: 2719 case GL_BLEND_SRC_RGB:
2722 return getUnsignedIntParameter(scriptState, pname); 2720 return getUnsignedIntParameter(scriptState, pname);
2723 case GL_BLUE_BITS: 2721 case GL_BLUE_BITS:
2724 return getIntParameter(scriptState, pname); 2722 return getIntParameter(scriptState, pname);
2725 case GL_COLOR_CLEAR_VALUE: 2723 case GL_COLOR_CLEAR_VALUE:
2726 return getWebGLFloatArrayParameter(scriptState, pname); 2724 return getWebGLFloatArrayParameter(scriptState, pname);
2727 case GL_COLOR_WRITEMASK: 2725 case GL_COLOR_WRITEMASK:
2728 return getBooleanArrayParameter(scriptState, pname); 2726 return getBooleanArrayParameter(scriptState, pname);
2729 case GL_COMPRESSED_TEXTURE_FORMATS: 2727 case GL_COMPRESSED_TEXTURE_FORMATS:
2730 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF ormats.data(), m_compressedTextureFormats.size())); 2728 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF ormats.data(), m_compressedTextureFormats.size()));
2731 case GL_CULL_FACE: 2729 case GL_CULL_FACE:
2732 return getBooleanParameter(scriptState, pname); 2730 return getBooleanParameter(scriptState, pname);
2733 case GL_CULL_FACE_MODE: 2731 case GL_CULL_FACE_MODE:
2734 return getUnsignedIntParameter(scriptState, pname); 2732 return getUnsignedIntParameter(scriptState, pname);
2735 case GL_CURRENT_PROGRAM: 2733 case GL_CURRENT_PROGRAM:
2736 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_curre ntProgram.get())); 2734 return WebGLAny(scriptState, m_currentProgram.get());
2737 case GL_DEPTH_BITS: 2735 case GL_DEPTH_BITS:
2738 if (!m_framebufferBinding && !m_requestedAttributes.depth()) 2736 if (!m_framebufferBinding && !m_requestedAttributes.depth())
2739 return WebGLAny(scriptState, intZero); 2737 return WebGLAny(scriptState, intZero);
2740 return getIntParameter(scriptState, pname); 2738 return getIntParameter(scriptState, pname);
2741 case GL_DEPTH_CLEAR_VALUE: 2739 case GL_DEPTH_CLEAR_VALUE:
2742 return getFloatParameter(scriptState, pname); 2740 return getFloatParameter(scriptState, pname);
2743 case GL_DEPTH_FUNC: 2741 case GL_DEPTH_FUNC:
2744 return getUnsignedIntParameter(scriptState, pname); 2742 return getUnsignedIntParameter(scriptState, pname);
2745 case GL_DEPTH_RANGE: 2743 case GL_DEPTH_RANGE:
2746 return getWebGLFloatArrayParameter(scriptState, pname); 2744 return getWebGLFloatArrayParameter(scriptState, pname);
2747 case GL_DEPTH_TEST: 2745 case GL_DEPTH_TEST:
2748 return getBooleanParameter(scriptState, pname); 2746 return getBooleanParameter(scriptState, pname);
2749 case GL_DEPTH_WRITEMASK: 2747 case GL_DEPTH_WRITEMASK:
2750 return getBooleanParameter(scriptState, pname); 2748 return getBooleanParameter(scriptState, pname);
2751 case GL_DITHER: 2749 case GL_DITHER:
2752 return getBooleanParameter(scriptState, pname); 2750 return getBooleanParameter(scriptState, pname);
2753 case GL_ELEMENT_ARRAY_BUFFER_BINDING: 2751 case GL_ELEMENT_ARRAY_BUFFER_BINDING:
2754 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_bound VertexArrayObject->boundElementArrayBuffer())); 2752 return WebGLAny(scriptState, m_boundVertexArrayObject->boundElementArray Buffer());
2755 case GL_FRAMEBUFFER_BINDING: 2753 case GL_FRAMEBUFFER_BINDING:
2756 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_frame bufferBinding.get())); 2754 return WebGLAny(scriptState, m_framebufferBinding.get());
2757 case GL_FRONT_FACE: 2755 case GL_FRONT_FACE:
2758 return getUnsignedIntParameter(scriptState, pname); 2756 return getUnsignedIntParameter(scriptState, pname);
2759 case GL_GENERATE_MIPMAP_HINT: 2757 case GL_GENERATE_MIPMAP_HINT:
2760 return getUnsignedIntParameter(scriptState, pname); 2758 return getUnsignedIntParameter(scriptState, pname);
2761 case GL_GREEN_BITS: 2759 case GL_GREEN_BITS:
2762 return getIntParameter(scriptState, pname); 2760 return getIntParameter(scriptState, pname);
2763 case GL_IMPLEMENTATION_COLOR_READ_FORMAT: 2761 case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
2764 return getIntParameter(scriptState, pname); 2762 return getIntParameter(scriptState, pname);
2765 case GL_IMPLEMENTATION_COLOR_READ_TYPE: 2763 case GL_IMPLEMENTATION_COLOR_READ_TYPE:
2766 return getIntParameter(scriptState, pname); 2764 return getIntParameter(scriptState, pname);
(...skipping 28 matching lines...) Expand all
2795 return getIntParameter(scriptState, pname); 2793 return getIntParameter(scriptState, pname);
2796 case GL_POLYGON_OFFSET_FACTOR: 2794 case GL_POLYGON_OFFSET_FACTOR:
2797 return getFloatParameter(scriptState, pname); 2795 return getFloatParameter(scriptState, pname);
2798 case GL_POLYGON_OFFSET_FILL: 2796 case GL_POLYGON_OFFSET_FILL:
2799 return getBooleanParameter(scriptState, pname); 2797 return getBooleanParameter(scriptState, pname);
2800 case GL_POLYGON_OFFSET_UNITS: 2798 case GL_POLYGON_OFFSET_UNITS:
2801 return getFloatParameter(scriptState, pname); 2799 return getFloatParameter(scriptState, pname);
2802 case GL_RED_BITS: 2800 case GL_RED_BITS:
2803 return getIntParameter(scriptState, pname); 2801 return getIntParameter(scriptState, pname);
2804 case GL_RENDERBUFFER_BINDING: 2802 case GL_RENDERBUFFER_BINDING:
2805 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_rende rbufferBinding.get())); 2803 return WebGLAny(scriptState, m_renderbufferBinding.get());
2806 case GL_RENDERER: 2804 case GL_RENDERER:
2807 return WebGLAny(scriptState, String("WebKit WebGL")); 2805 return WebGLAny(scriptState, String("WebKit WebGL"));
2808 case GL_SAMPLE_BUFFERS: 2806 case GL_SAMPLE_BUFFERS:
2809 return getIntParameter(scriptState, pname); 2807 return getIntParameter(scriptState, pname);
2810 case GL_SAMPLE_COVERAGE_INVERT: 2808 case GL_SAMPLE_COVERAGE_INVERT:
2811 return getBooleanParameter(scriptState, pname); 2809 return getBooleanParameter(scriptState, pname);
2812 case GL_SAMPLE_COVERAGE_VALUE: 2810 case GL_SAMPLE_COVERAGE_VALUE:
2813 return getFloatParameter(scriptState, pname); 2811 return getFloatParameter(scriptState, pname);
2814 case GL_SAMPLES: 2812 case GL_SAMPLES:
2815 return getIntParameter(scriptState, pname); 2813 return getIntParameter(scriptState, pname);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 return getIntParameter(scriptState, pname); 2849 return getIntParameter(scriptState, pname);
2852 case GL_STENCIL_TEST: 2850 case GL_STENCIL_TEST:
2853 return getBooleanParameter(scriptState, pname); 2851 return getBooleanParameter(scriptState, pname);
2854 case GL_STENCIL_VALUE_MASK: 2852 case GL_STENCIL_VALUE_MASK:
2855 return getUnsignedIntParameter(scriptState, pname); 2853 return getUnsignedIntParameter(scriptState, pname);
2856 case GL_STENCIL_WRITEMASK: 2854 case GL_STENCIL_WRITEMASK:
2857 return getUnsignedIntParameter(scriptState, pname); 2855 return getUnsignedIntParameter(scriptState, pname);
2858 case GL_SUBPIXEL_BITS: 2856 case GL_SUBPIXEL_BITS:
2859 return getIntParameter(scriptState, pname); 2857 return getIntParameter(scriptState, pname);
2860 case GL_TEXTURE_BINDING_2D: 2858 case GL_TEXTURE_BINDING_2D:
2861 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu reUnits[m_activeTextureUnit].m_texture2DBinding.get())); 2859 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu re2DBinding.get());
2862 case GL_TEXTURE_BINDING_CUBE_MAP: 2860 case GL_TEXTURE_BINDING_CUBE_MAP:
2863 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textu reUnits[m_activeTextureUnit].m_textureCubeMapBinding.get())); 2861 return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textu reCubeMapBinding.get());
2864 case GL_UNPACK_ALIGNMENT: 2862 case GL_UNPACK_ALIGNMENT:
2865 return getIntParameter(scriptState, pname); 2863 return getIntParameter(scriptState, pname);
2866 case GC3D_UNPACK_FLIP_Y_WEBGL: 2864 case GC3D_UNPACK_FLIP_Y_WEBGL:
2867 return WebGLAny(scriptState, m_unpackFlipY); 2865 return WebGLAny(scriptState, m_unpackFlipY);
2868 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL: 2866 case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL:
2869 return WebGLAny(scriptState, m_unpackPremultiplyAlpha); 2867 return WebGLAny(scriptState, m_unpackPremultiplyAlpha);
2870 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: 2868 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL:
2871 return WebGLAny(scriptState, m_unpackColorspaceConversion); 2869 return WebGLAny(scriptState, m_unpackColorspaceConversion);
2872 case GL_VENDOR: 2870 case GL_VENDOR:
2873 return WebGLAny(scriptState, String("WebKit")); 2871 return WebGLAny(scriptState, String("WebKit"));
(...skipping 12 matching lines...) Expand all
2886 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); 2884 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled");
2887 return ScriptValue::createNull(scriptState); 2885 return ScriptValue::createNull(scriptState);
2888 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: 2886 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL:
2889 if (extensionEnabled(WebGLDebugRendererInfoName)) 2887 if (extensionEnabled(WebGLDebugRendererInfoName))
2890 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR)); 2888 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR));
2891 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");
2892 return ScriptValue::createNull(scriptState); 2890 return ScriptValue::createNull(scriptState);
2893 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object 2891 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object
2894 if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) { 2892 if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) {
2895 if (!m_boundVertexArrayObject->isDefaultObject()) 2893 if (!m_boundVertexArrayObject->isDefaultObject())
2896 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject> (m_boundVertexArrayObject.get())); 2894 return WebGLAny(scriptState, m_boundVertexArrayObject.get());
2897 return ScriptValue::createNull(scriptState); 2895 return ScriptValue::createNull(scriptState);
2898 } 2896 }
2899 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); 2897 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled");
2900 return ScriptValue::createNull(scriptState); 2898 return ScriptValue::createNull(scriptState);
2901 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic 2899 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic
2902 if (extensionEnabled(EXTTextureFilterAnisotropicName)) 2900 if (extensionEnabled(EXTTextureFilterAnisotropicName))
2903 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT); 2901 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT);
2904 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); 2902 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled");
2905 return ScriptValue::createNull(scriptState); 2903 return ScriptValue::createNull(scriptState);
2906 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN 2904 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3038 } 3036 }
3039 } 3037 }
3040 3038
3041 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) 3039 String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader)
3042 { 3040 {
3043 if (isContextLost() || !validateWebGLObject("getShaderInfoLog", shader)) 3041 if (isContextLost() || !validateWebGLObject("getShaderInfoLog", shader))
3044 return String(); 3042 return String();
3045 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); 3043 return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader)));
3046 } 3044 }
3047 3045
3048 PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::ge tShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) 3046 WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat( GLenum shaderType, GLenum precisionType)
3049 { 3047 {
3050 if (isContextLost()) 3048 if (isContextLost())
3051 return nullptr; 3049 return nullptr;
3052 switch (shaderType) { 3050 switch (shaderType) {
3053 case GL_VERTEX_SHADER: 3051 case GL_VERTEX_SHADER:
3054 case GL_FRAGMENT_SHADER: 3052 case GL_FRAGMENT_SHADER:
3055 break; 3053 break;
3056 default: 3054 default:
3057 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type"); 3055 synthesizeGLError(GL_INVALID_ENUM, "getShaderPrecisionFormat", "invalid shader type");
3058 return nullptr; 3056 return nullptr;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
3334 notImplemented(); 3332 notImplemented();
3335 } 3333 }
3336 } 3334 }
3337 } 3335 }
3338 } 3336 }
3339 // If we get here, something went wrong in our unfortunately complex logic a bove 3337 // If we get here, something went wrong in our unfortunately complex logic a bove
3340 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error"); 3338 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unknown error");
3341 return ScriptValue::createNull(scriptState); 3339 return ScriptValue::createNull(scriptState);
3342 } 3340 }
3343 3341
3344 PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUnifo rmLocation(WebGLProgram* program, const String& name) 3342 WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram * program, const String& name)
3345 { 3343 {
3346 if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) 3344 if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
3347 return nullptr; 3345 return nullptr;
3348 if (!validateLocationLength("getUniformLocation", name)) 3346 if (!validateLocationLength("getUniformLocation", name))
3349 return nullptr; 3347 return nullptr;
3350 if (!validateString("getUniformLocation", name)) 3348 if (!validateString("getUniformLocation", name))
3351 return nullptr; 3349 return nullptr;
3352 if (isPrefixReserved(name)) 3350 if (isPrefixReserved(name))
3353 return nullptr; 3351 return nullptr;
3354 if (!program->linkStatus()) { 3352 if (!program->linkStatus()) {
(...skipping 17 matching lines...) Expand all
3372 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index); 3370 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index);
3373 3371
3374 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) 3372 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher())
3375 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) 3373 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
3376 return WebGLAny(scriptState, state->divisor); 3374 return WebGLAny(scriptState, state->divisor);
3377 3375
3378 switch (pname) { 3376 switch (pname) {
3379 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 3377 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
3380 if (!state->bufferBinding || !state->bufferBinding->object()) 3378 if (!state->bufferBinding || !state->bufferBinding->object())
3381 return ScriptValue::createNull(scriptState); 3379 return ScriptValue::createNull(scriptState);
3382 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get())); 3380 return WebGLAny(scriptState, state->bufferBinding.get());
3383 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: 3381 case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
3384 return WebGLAny(scriptState, state->enabled); 3382 return WebGLAny(scriptState, state->enabled);
3385 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: 3383 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
3386 return WebGLAny(scriptState, state->normalized); 3384 return WebGLAny(scriptState, state->normalized);
3387 case GL_VERTEX_ATTRIB_ARRAY_SIZE: 3385 case GL_VERTEX_ATTRIB_ARRAY_SIZE:
3388 return WebGLAny(scriptState, state->size); 3386 return WebGLAny(scriptState, state->size);
3389 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: 3387 case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
3390 return WebGLAny(scriptState, state->originalStride); 3388 return WebGLAny(scriptState, state->originalStride);
3391 case GL_VERTEX_ATTRIB_ARRAY_TYPE: 3389 case GL_VERTEX_ATTRIB_ARRAY_TYPE:
3392 return WebGLAny(scriptState, state->type); 3390 return WebGLAny(scriptState, state->type);
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 webContext()->stencilOp(fail, zfail, zpass); 3964 webContext()->stencilOp(fail, zfail, zpass);
3967 } 3965 }
3968 3966
3969 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen um zfail, GLenum zpass) 3967 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen um zfail, GLenum zpass)
3970 { 3968 {
3971 if (isContextLost()) 3969 if (isContextLost())
3972 return; 3970 return;
3973 webContext()->stencilOpSeparate(face, fail, zfail, zpass); 3971 webContext()->stencilOpSeparate(face, fail, zfail, zpass);
3974 } 3972 }
3975 3973
3976 PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> WebGLRenderingContextBase::createVal uebufferCHROMIUM() 3974 CHROMIUMValuebuffer* WebGLRenderingContextBase::createValuebufferCHROMIUM()
3977 { 3975 {
3978 if (isContextLost()) 3976 if (isContextLost())
3979 return nullptr; 3977 return nullptr;
3980 RefPtrWillBeRawPtr<CHROMIUMValuebuffer> o = CHROMIUMValuebuffer::create(this ); 3978 CHROMIUMValuebuffer* o = CHROMIUMValuebuffer::create(this);
3981 addSharedObject(o.get()); 3979 addSharedObject(o);
3982 return o.release(); 3980 return o;
3983 } 3981 }
3984 3982
3985 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v aluebuffer) 3983 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v aluebuffer)
3986 { 3984 {
3987 if (!deleteObject(valuebuffer)) 3985 if (!deleteObject(valuebuffer))
3988 return; 3986 return;
3989 if (valuebuffer == m_valuebufferBinding) 3987 if (valuebuffer == m_valuebufferBinding)
3990 m_valuebufferBinding = nullptr; 3988 m_valuebufferBinding = nullptr;
3991 } 3989 }
3992 3990
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
5148 5146
5149 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) 5147 void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object)
5150 { 5148 {
5151 ASSERT(!isContextLost()); 5149 ASSERT(!isContextLost());
5152 m_contextObjects.add(object); 5150 m_contextObjects.add(object);
5153 } 5151 }
5154 5152
5155 void WebGLRenderingContextBase::detachAndRemoveAllObjects() 5153 void WebGLRenderingContextBase::detachAndRemoveAllObjects()
5156 { 5154 {
5157 while (m_contextObjects.size() > 0) { 5155 while (m_contextObjects.size() > 0) {
5158 WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject>>::iterator it = m_contextObjects.begin(); 5156 // Following detachContext() will remove the iterated object from
5157 // |m_contextObjects|, and thus we need to look up begin() every time.
5158 auto it = m_contextObjects.begin();
5159 (*it)->detachContext(); 5159 (*it)->detachContext();
5160 } 5160 }
5161 } 5161 }
5162 5162
5163 void WebGLRenderingContextBase::stop() 5163 void WebGLRenderingContextBase::stop()
5164 { 5164 {
5165 if (!isContextLost()) { 5165 if (!isContextLost()) {
5166 // Never attempt to restore the context because the page is being torn d own. 5166 // Never attempt to restore the context because the page is being torn d own.
5167 forceLostContext(SyntheticLostContext, Manual); 5167 forceLostContext(SyntheticLostContext, Manual);
5168 } 5168 }
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
6036 return false; 6036 return false;
6037 } 6037 }
6038 return true; 6038 return true;
6039 } 6039 }
6040 6040
6041 WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun ctionName, GLenum target) 6041 WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun ctionName, GLenum target)
6042 { 6042 {
6043 WebGLBuffer* buffer = nullptr; 6043 WebGLBuffer* buffer = nullptr;
6044 switch (target) { 6044 switch (target) {
6045 case GL_ELEMENT_ARRAY_BUFFER: 6045 case GL_ELEMENT_ARRAY_BUFFER:
6046 buffer = m_boundVertexArrayObject->boundElementArrayBuffer().get(); 6046 buffer = m_boundVertexArrayObject->boundElementArrayBuffer();
6047 break; 6047 break;
6048 case GL_ARRAY_BUFFER: 6048 case GL_ARRAY_BUFFER:
6049 buffer = m_boundArrayBuffer.get(); 6049 buffer = m_boundArrayBuffer.get();
6050 break; 6050 break;
6051 default: 6051 default:
6052 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); 6052 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target");
6053 return nullptr; 6053 return nullptr;
6054 } 6054 }
6055 if (!buffer) { 6055 if (!buffer) {
6056 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no buffer"); 6056 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no buffer");
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
6562 DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState) 6562 DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState)
6563 { 6563 {
6564 visitor->trace(m_texture2DBinding); 6564 visitor->trace(m_texture2DBinding);
6565 visitor->trace(m_textureCubeMapBinding); 6565 visitor->trace(m_textureCubeMapBinding);
6566 visitor->trace(m_texture3DBinding); 6566 visitor->trace(m_texture3DBinding);
6567 visitor->trace(m_texture2DArrayBinding); 6567 visitor->trace(m_texture2DArrayBinding);
6568 } 6568 }
6569 6569
6570 DEFINE_TRACE(WebGLRenderingContextBase) 6570 DEFINE_TRACE(WebGLRenderingContextBase)
6571 { 6571 {
6572 #if ENABLE(OILPAN)
6573 visitor->trace(m_contextObjects); 6572 visitor->trace(m_contextObjects);
6574 visitor->trace(m_contextLostCallbackAdapter); 6573 visitor->trace(m_contextLostCallbackAdapter);
6575 visitor->trace(m_errorMessageCallbackAdapter); 6574 visitor->trace(m_errorMessageCallbackAdapter);
6576 visitor->trace(m_boundArrayBuffer); 6575 visitor->trace(m_boundArrayBuffer);
6577 visitor->trace(m_defaultVertexArrayObject); 6576 visitor->trace(m_defaultVertexArrayObject);
6578 visitor->trace(m_boundVertexArrayObject); 6577 visitor->trace(m_boundVertexArrayObject);
6579 visitor->trace(m_vertexAttrib0Buffer); 6578 visitor->trace(m_vertexAttrib0Buffer);
6580 visitor->trace(m_currentProgram); 6579 visitor->trace(m_currentProgram);
6581 visitor->trace(m_framebufferBinding); 6580 visitor->trace(m_framebufferBinding);
6582 visitor->trace(m_renderbufferBinding); 6581 visitor->trace(m_renderbufferBinding);
6583 visitor->trace(m_valuebufferBinding); 6582 visitor->trace(m_valuebufferBinding);
6584 visitor->trace(m_textureUnits); 6583 visitor->trace(m_textureUnits);
6585 visitor->trace(m_blackTexture2D); 6584 visitor->trace(m_blackTexture2D);
6586 visitor->trace(m_blackTextureCubeMap); 6585 visitor->trace(m_blackTextureCubeMap);
6587 visitor->trace(m_requestedAttributes);
6588 visitor->trace(m_extensions); 6586 visitor->trace(m_extensions);
6589 #endif
6590 CanvasRenderingContext::trace(visitor); 6587 CanvasRenderingContext::trace(visitor);
6591 } 6588 }
6592 6589
6593 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel() 6590 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel()
6594 { 6591 {
6595 if (isContextLost()) 6592 if (isContextLost())
6596 return 0; 6593 return 0;
6597 6594
6598 int bytesPerPixel = 4; 6595 int bytesPerPixel = 4;
6599 int totalBytesPerPixel = bytesPerPixel * 2; // WebGL's front and back color buffers. 6596 int totalBytesPerPixel = bytesPerPixel * 2; // WebGL's front and back color buffers.
(...skipping 15 matching lines...) Expand all
6615 6612
6616 return totalBytesPerPixel; 6613 return totalBytesPerPixel;
6617 } 6614 }
6618 6615
6619 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6616 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6620 { 6617 {
6621 return m_drawingBuffer.get(); 6618 return m_drawingBuffer.get();
6622 } 6619 }
6623 6620
6624 } // namespace blink 6621 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698