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