| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "core/frame/ImageBitmap.h" | 8 #include "core/frame/ImageBitmap.h" |
| 9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
| 10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
| (...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 if (isContextLost() || !validateWebGLObject("getUniformBlockIndex", program)
) | 2412 if (isContextLost() || !validateWebGLObject("getUniformBlockIndex", program)
) |
| 2413 return 0; | 2413 return 0; |
| 2414 if (!validateString("getUniformBlockIndex", uniformBlockName)) | 2414 if (!validateString("getUniformBlockIndex", uniformBlockName)) |
| 2415 return 0; | 2415 return 0; |
| 2416 | 2416 |
| 2417 return webContext()->getUniformBlockIndex(objectOrZero(program), uniformBloc
kName.utf8().data()); | 2417 return webContext()->getUniformBlockIndex(objectOrZero(program), uniformBloc
kName.utf8().data()); |
| 2418 } | 2418 } |
| 2419 | 2419 |
| 2420 bool WebGL2RenderingContextBase::validateUniformBlockIndex(const char* functionN
ame, WebGLProgram* program, GLuint blockIndex) | 2420 bool WebGL2RenderingContextBase::validateUniformBlockIndex(const char* functionN
ame, WebGLProgram* program, GLuint blockIndex) |
| 2421 { | 2421 { |
| 2422 ASSERT(program); |
| 2423 if (!program->linkStatus()) { |
| 2424 synthesizeGLError(GL_INVALID_OPERATION, functionName, "program not linke
d"); |
| 2425 return false; |
| 2426 } |
| 2422 GLint activeUniformBlocks = 0; | 2427 GLint activeUniformBlocks = 0; |
| 2423 webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS,
&activeUniformBlocks); | 2428 webContext()->getProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS,
&activeUniformBlocks); |
| 2424 if (blockIndex >= static_cast<GLuint>(activeUniformBlocks)) { | 2429 if (blockIndex >= static_cast<GLuint>(activeUniformBlocks)) { |
| 2425 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid uniform block
index"); | 2430 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid uniform block
index"); |
| 2426 return false; | 2431 return false; |
| 2427 } | 2432 } |
| 2428 return true; | 2433 return true; |
| 2429 } | 2434 } |
| 2430 | 2435 |
| 2431 ScriptValue WebGL2RenderingContextBase::getActiveUniformBlockParameter(ScriptSta
te* scriptState, WebGLProgram* program, GLuint uniformBlockIndex, GLenum pname) | 2436 ScriptValue WebGL2RenderingContextBase::getActiveUniformBlockParameter(ScriptSta
te* scriptState, WebGLProgram* program, GLuint uniformBlockIndex, GLenum pname) |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3136 if (!framebufferBinding) { | 3141 if (!framebufferBinding) { |
| 3137 // We can use m_requestedAttribs because in WebGL 2, they are required t
o be honored. | 3142 // We can use m_requestedAttribs because in WebGL 2, they are required t
o be honored. |
| 3138 bool hasDepth = m_requestedAttributes.depth(); | 3143 bool hasDepth = m_requestedAttributes.depth(); |
| 3139 bool hasStencil = m_requestedAttributes.stencil(); | 3144 bool hasStencil = m_requestedAttributes.stencil(); |
| 3140 bool hasAlpha = m_requestedAttributes.alpha(); | 3145 bool hasAlpha = m_requestedAttributes.alpha(); |
| 3141 bool missingImage = (attachment == GL_DEPTH && !hasDepth) | 3146 bool missingImage = (attachment == GL_DEPTH && !hasDepth) |
| 3142 || (attachment == GL_STENCIL && !hasStencil); | 3147 || (attachment == GL_STENCIL && !hasStencil); |
| 3143 if (missingImage) { | 3148 if (missingImage) { |
| 3144 switch (pname) { | 3149 switch (pname) { |
| 3145 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 3150 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 3146 return WebGLAny(scriptState, GL_FRAMEBUFFER_DEFAULT); | 3151 return WebGLAny(scriptState, GL_NONE); |
| 3147 default: | 3152 default: |
| 3148 synthesizeGLError(GL_INVALID_ENUM, kFunctionName, "invalid param
eter name"); | 3153 synthesizeGLError(GL_INVALID_OPERATION, kFunctionName, "invalid
parameter name"); |
| 3149 return ScriptValue::createNull(scriptState); | 3154 return ScriptValue::createNull(scriptState); |
| 3150 } | 3155 } |
| 3151 } | 3156 } |
| 3152 switch (pname) { | 3157 switch (pname) { |
| 3153 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: | 3158 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 3154 return WebGLAny(scriptState, GL_FRAMEBUFFER_DEFAULT); | 3159 return WebGLAny(scriptState, GL_FRAMEBUFFER_DEFAULT); |
| 3155 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: | 3160 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 3156 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: | 3161 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 3157 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: | 3162 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 3158 { | 3163 { |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3449 params.alignment = m_unpackAlignment; | 3454 params.alignment = m_unpackAlignment; |
| 3450 params.rowLength = m_unpackRowLength; | 3455 params.rowLength = m_unpackRowLength; |
| 3451 params.imageHeight = m_unpackImageHeight; | 3456 params.imageHeight = m_unpackImageHeight; |
| 3452 params.skipPixels = m_unpackSkipPixels; | 3457 params.skipPixels = m_unpackSkipPixels; |
| 3453 params.skipRows = m_unpackSkipRows; | 3458 params.skipRows = m_unpackSkipRows; |
| 3454 params.skipImages = m_unpackSkipImages; | 3459 params.skipImages = m_unpackSkipImages; |
| 3455 return params; | 3460 return params; |
| 3456 } | 3461 } |
| 3457 | 3462 |
| 3458 } // namespace blink | 3463 } // namespace blink |
| OLD | NEW |