| 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 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 } | 2282 } |
| 2283 | 2283 |
| 2284 webContext()->transformFeedbackVaryings(objectOrZero(program), varyings.size
(), varyingStrings.data(), bufferMode); | 2284 webContext()->transformFeedbackVaryings(objectOrZero(program), varyings.size
(), varyingStrings.data(), bufferMode); |
| 2285 } | 2285 } |
| 2286 | 2286 |
| 2287 WebGLActiveInfo* WebGL2RenderingContextBase::getTransformFeedbackVarying(WebGLPr
ogram* program, GLuint index) | 2287 WebGLActiveInfo* WebGL2RenderingContextBase::getTransformFeedbackVarying(WebGLPr
ogram* program, GLuint index) |
| 2288 { | 2288 { |
| 2289 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) | 2289 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) |
| 2290 return nullptr; | 2290 return nullptr; |
| 2291 | 2291 |
| 2292 if (!program->linkStatus()) { | 2292 if (!program->linkStatus(this)) { |
| 2293 synthesizeGLError(GL_INVALID_OPERATION, "getTransformFeedbackVarying", "
program not linked"); | 2293 synthesizeGLError(GL_INVALID_OPERATION, "getTransformFeedbackVarying", "
program not linked"); |
| 2294 return nullptr; | 2294 return nullptr; |
| 2295 } | 2295 } |
| 2296 GLint maxIndex = 0; | 2296 GLint maxIndex = 0; |
| 2297 contextGL()->GetProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYI
NGS, &maxIndex); | 2297 contextGL()->GetProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYI
NGS, &maxIndex); |
| 2298 if (index >= static_cast<GLuint>(maxIndex)) { | 2298 if (index >= static_cast<GLuint>(maxIndex)) { |
| 2299 synthesizeGLError(GL_INVALID_VALUE, "getTransformFeedbackVarying", "inva
lid index"); | 2299 synthesizeGLError(GL_INVALID_VALUE, "getTransformFeedbackVarying", "inva
lid index"); |
| 2300 return nullptr; | 2300 return nullptr; |
| 2301 } | 2301 } |
| 2302 | 2302 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 return 0; | 2576 return 0; |
| 2577 if (!validateString("getUniformBlockIndex", uniformBlockName)) | 2577 if (!validateString("getUniformBlockIndex", uniformBlockName)) |
| 2578 return 0; | 2578 return 0; |
| 2579 | 2579 |
| 2580 return webContext()->getUniformBlockIndex(objectOrZero(program), uniformBloc
kName.utf8().data()); | 2580 return webContext()->getUniformBlockIndex(objectOrZero(program), uniformBloc
kName.utf8().data()); |
| 2581 } | 2581 } |
| 2582 | 2582 |
| 2583 bool WebGL2RenderingContextBase::validateUniformBlockIndex(const char* functionN
ame, WebGLProgram* program, GLuint blockIndex) | 2583 bool WebGL2RenderingContextBase::validateUniformBlockIndex(const char* functionN
ame, WebGLProgram* program, GLuint blockIndex) |
| 2584 { | 2584 { |
| 2585 ASSERT(program); | 2585 ASSERT(program); |
| 2586 if (!program->linkStatus()) { | 2586 if (!program->linkStatus(this)) { |
| 2587 synthesizeGLError(GL_INVALID_OPERATION, functionName, "program not linke
d"); | 2587 synthesizeGLError(GL_INVALID_OPERATION, functionName, "program not linke
d"); |
| 2588 return false; | 2588 return false; |
| 2589 } | 2589 } |
| 2590 GLint activeUniformBlocks = 0; | 2590 GLint activeUniformBlocks = 0; |
| 2591 contextGL()->GetProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS, &
activeUniformBlocks); | 2591 contextGL()->GetProgramiv(objectOrZero(program), GL_ACTIVE_UNIFORM_BLOCKS, &
activeUniformBlocks); |
| 2592 if (blockIndex >= static_cast<GLuint>(activeUniformBlocks)) { | 2592 if (blockIndex >= static_cast<GLuint>(activeUniformBlocks)) { |
| 2593 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid uniform block
index"); | 2593 synthesizeGLError(GL_INVALID_VALUE, functionName, "invalid uniform block
index"); |
| 2594 return false; | 2594 return false; |
| 2595 } | 2595 } |
| 2596 return true; | 2596 return true; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 | 2700 |
| 2701 return contextGL()->IsVertexArrayOES(vertexArray->object()); | 2701 return contextGL()->IsVertexArrayOES(vertexArray->object()); |
| 2702 } | 2702 } |
| 2703 | 2703 |
| 2704 void WebGL2RenderingContextBase::bindVertexArray(ScriptState* scriptState, WebGL
VertexArrayObject* vertexArray) | 2704 void WebGL2RenderingContextBase::bindVertexArray(ScriptState* scriptState, WebGL
VertexArrayObject* vertexArray) |
| 2705 { | 2705 { |
| 2706 if (isContextLost()) | 2706 if (isContextLost()) |
| 2707 return; | 2707 return; |
| 2708 | 2708 |
| 2709 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th
is))) { | 2709 if (vertexArray && (vertexArray->isDeleted() || !vertexArray->validate(0, th
is))) { |
| 2710 webContext()->synthesizeGLError(GL_INVALID_OPERATION); | 2710 synthesizeGLError(GL_INVALID_OPERATION, "bindVertexArray", "invalid vert
exArray"); |
| 2711 return; | 2711 return; |
| 2712 } | 2712 } |
| 2713 | 2713 |
| 2714 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object())
{ | 2714 if (vertexArray && !vertexArray->isDefaultObject() && vertexArray->object())
{ |
| 2715 contextGL()->BindVertexArrayOES(objectOrZero(vertexArray)); | 2715 contextGL()->BindVertexArrayOES(objectOrZero(vertexArray)); |
| 2716 | 2716 |
| 2717 vertexArray->setHasEverBeenBound(); | 2717 vertexArray->setHasEverBeenBound(); |
| 2718 setBoundVertexArrayObject(scriptState, vertexArray); | 2718 setBoundVertexArrayObject(scriptState, vertexArray); |
| 2719 } else { | 2719 } else { |
| 2720 contextGL()->BindVertexArrayOES(0); | 2720 contextGL()->BindVertexArrayOES(0); |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3608 params.skipPixels = m_unpackSkipPixels; | 3608 params.skipPixels = m_unpackSkipPixels; |
| 3609 params.skipRows = m_unpackSkipRows; | 3609 params.skipRows = m_unpackSkipRows; |
| 3610 if (dimension == Tex3D) { | 3610 if (dimension == Tex3D) { |
| 3611 params.imageHeight = m_unpackImageHeight; | 3611 params.imageHeight = m_unpackImageHeight; |
| 3612 params.skipImages = m_unpackSkipImages; | 3612 params.skipImages = m_unpackSkipImages; |
| 3613 } | 3613 } |
| 3614 return params; | 3614 return params; |
| 3615 } | 3615 } |
| 3616 | 3616 |
| 3617 } // namespace blink | 3617 } // namespace blink |
| OLD | NEW |