| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "modules/webgl/WebGLRenderingContextBase.h" | 27 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/ExceptionMessages.h" | 29 #include "bindings/core/v8/ExceptionMessages.h" |
| 30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
| 31 #include "bindings/modules/v8/WebGLAny.h" | 31 #include "bindings/modules/v8/WebGLAny.h" |
| 32 #include "core/dom/DOMArrayBuffer.h" | 32 #include "core/dom/DOMArrayBuffer.h" |
| 33 #include "core/dom/DOMTypedArray.h" | 33 #include "core/dom/DOMTypedArray.h" |
| 34 #include "core/dom/ExceptionCode.h" | 34 #include "core/dom/ExceptionCode.h" |
| 35 #include "core/dom/FlexibleArrayBufferView.h" |
| 35 #include "core/fetch/ImageResource.h" | 36 #include "core/fetch/ImageResource.h" |
| 36 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 37 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
| 38 #include "core/html/HTMLCanvasElement.h" | 39 #include "core/html/HTMLCanvasElement.h" |
| 39 #include "core/html/HTMLImageElement.h" | 40 #include "core/html/HTMLImageElement.h" |
| 40 #include "core/html/HTMLVideoElement.h" | 41 #include "core/html/HTMLVideoElement.h" |
| 41 #include "core/html/ImageData.h" | 42 #include "core/html/ImageData.h" |
| 42 #include "core/inspector/ConsoleMessage.h" | 43 #include "core/inspector/ConsoleMessage.h" |
| 43 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
| 44 #include "core/layout/LayoutBox.h" | 45 #include "core/layout/LayoutBox.h" |
| (...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 | 1649 |
| 1649 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D
OMArrayBuffer* data) | 1650 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D
OMArrayBuffer* data) |
| 1650 { | 1651 { |
| 1651 if (isContextLost()) | 1652 if (isContextLost()) |
| 1652 return; | 1653 return; |
| 1653 if (!data) | 1654 if (!data) |
| 1654 return; | 1655 return; |
| 1655 bufferSubDataImpl(target, offset, data->byteLength(), data->data()); | 1656 bufferSubDataImpl(target, offset, data->byteLength(), data->data()); |
| 1656 } | 1657 } |
| 1657 | 1658 |
| 1658 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D
OMArrayBufferView* data) | 1659 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, c
onst FlexibleArrayBufferView& data) |
| 1659 { | 1660 { |
| 1660 if (isContextLost()) | 1661 if (isContextLost()) |
| 1661 return; | 1662 return; |
| 1662 if (!data) | 1663 if (!data) |
| 1663 return; | 1664 return; |
| 1664 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress()); | 1665 bufferSubDataImpl(target, offset, data.byteLength(), data.baseAddressMaybeOn
Stack()); |
| 1665 } | 1666 } |
| 1666 | 1667 |
| 1667 bool WebGLRenderingContextBase::validateFramebufferTarget(GLenum target) | 1668 bool WebGLRenderingContextBase::validateFramebufferTarget(GLenum target) |
| 1668 { | 1669 { |
| 1669 if (target == GL_FRAMEBUFFER) | 1670 if (target == GL_FRAMEBUFFER) |
| 1670 return true; | 1671 return true; |
| 1671 return false; | 1672 return false; |
| 1672 } | 1673 } |
| 1673 | 1674 |
| 1674 WebGLFramebuffer* WebGLRenderingContextBase::getFramebufferBinding(GLenum target
) | 1675 WebGLFramebuffer* WebGLRenderingContextBase::getFramebufferBinding(GLenum target
) |
| (...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4594 return; | 4595 return; |
| 4595 | 4596 |
| 4596 if (location->program() != m_currentProgram) { | 4597 if (location->program() != m_currentProgram) { |
| 4597 synthesizeGLError(GL_INVALID_OPERATION, "uniform1f", "location not for c
urrent program"); | 4598 synthesizeGLError(GL_INVALID_OPERATION, "uniform1f", "location not for c
urrent program"); |
| 4598 return; | 4599 return; |
| 4599 } | 4600 } |
| 4600 | 4601 |
| 4601 webContext()->uniform1f(location->location(), x); | 4602 webContext()->uniform1f(location->location(), x); |
| 4602 } | 4603 } |
| 4603 | 4604 |
| 4604 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) | 4605 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
const FlexibleFloat32ArrayView& v) |
| 4605 { | 4606 { |
| 4606 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v,
1)) | 4607 if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
m1fv", location, v, 1)) |
| 4607 return; | 4608 return; |
| 4608 | 4609 |
| 4609 webContext()->uniform1fv(location->location(), v->length(), v->data()); | 4610 webContext()->uniform1fv(location->location(), v.length(), v.dataMaybeOnStac
k()); |
| 4610 } | 4611 } |
| 4611 | 4612 |
| 4612 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) | 4613 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) |
| 4613 { | 4614 { |
| 4614 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v.
data(), v.size(), 1)) | 4615 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v.
data(), v.size(), 1)) |
| 4615 return; | 4616 return; |
| 4616 | 4617 |
| 4617 webContext()->uniform1fv(location->location(), v.size(), v.data()); | 4618 webContext()->uniform1fv(location->location(), v.size(), v.data()); |
| 4618 } | 4619 } |
| 4619 | 4620 |
| 4620 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location,
GLint x) | 4621 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location,
GLint x) |
| 4621 { | 4622 { |
| 4622 if (isContextLost() || !location) | 4623 if (isContextLost() || !location) |
| 4623 return; | 4624 return; |
| 4624 | 4625 |
| 4625 if (location->program() != m_currentProgram) { | 4626 if (location->program() != m_currentProgram) { |
| 4626 synthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for c
urrent program"); | 4627 synthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for c
urrent program"); |
| 4627 return; | 4628 return; |
| 4628 } | 4629 } |
| 4629 | 4630 |
| 4630 webContext()->uniform1i(location->location(), x); | 4631 webContext()->uniform1i(location->location(), x); |
| 4631 } | 4632 } |
| 4632 | 4633 |
| 4633 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
DOMInt32Array* v) | 4634 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
const FlexibleInt32ArrayView& v) |
| 4634 { | 4635 { |
| 4635 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v,
1)) | 4636 if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform1
iv", location, v, 1)) |
| 4636 return; | 4637 return; |
| 4637 | 4638 |
| 4638 webContext()->uniform1iv(location->location(), v->length(), v->data()); | 4639 webContext()->uniform1iv(location->location(), v.length(), v.dataMaybeOnStac
k()); |
| 4639 } | 4640 } |
| 4640 | 4641 |
| 4641 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
Vector<GLint>& v) | 4642 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
Vector<GLint>& v) |
| 4642 { | 4643 { |
| 4643 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v.
data(), v.size(), 1)) | 4644 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v.
data(), v.size(), 1)) |
| 4644 return; | 4645 return; |
| 4645 | 4646 |
| 4646 webContext()->uniform1iv(location->location(), v.size(), v.data()); | 4647 webContext()->uniform1iv(location->location(), v.size(), v.data()); |
| 4647 } | 4648 } |
| 4648 | 4649 |
| 4649 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y) | 4650 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y) |
| 4650 { | 4651 { |
| 4651 if (isContextLost() || !location) | 4652 if (isContextLost() || !location) |
| 4652 return; | 4653 return; |
| 4653 | 4654 |
| 4654 if (location->program() != m_currentProgram) { | 4655 if (location->program() != m_currentProgram) { |
| 4655 synthesizeGLError(GL_INVALID_OPERATION, "uniform2f", "location not for c
urrent program"); | 4656 synthesizeGLError(GL_INVALID_OPERATION, "uniform2f", "location not for c
urrent program"); |
| 4656 return; | 4657 return; |
| 4657 } | 4658 } |
| 4658 | 4659 |
| 4659 webContext()->uniform2f(location->location(), x, y); | 4660 webContext()->uniform2f(location->location(), x, y); |
| 4660 } | 4661 } |
| 4661 | 4662 |
| 4662 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) | 4663 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
const FlexibleFloat32ArrayView& v) |
| 4663 { | 4664 { |
| 4664 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v,
2)) | 4665 if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
m2fv", location, v, 2)) |
| 4665 return; | 4666 return; |
| 4666 | 4667 |
| 4667 webContext()->uniform2fv(location->location(), v->length() >> 1, v->data()); | 4668 webContext()->uniform2fv(location->location(), v.length() >> 1, v.dataMaybeO
nStack()); |
| 4668 } | 4669 } |
| 4669 | 4670 |
| 4670 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) | 4671 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) |
| 4671 { | 4672 { |
| 4672 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v.
data(), v.size(), 2)) | 4673 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v.
data(), v.size(), 2)) |
| 4673 return; | 4674 return; |
| 4674 | 4675 |
| 4675 webContext()->uniform2fv(location->location(), v.size() >> 1, v.data()); | 4676 webContext()->uniform2fv(location->location(), v.size() >> 1, v.data()); |
| 4676 } | 4677 } |
| 4677 | 4678 |
| 4678 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location,
GLint x, GLint y) | 4679 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location,
GLint x, GLint y) |
| 4679 { | 4680 { |
| 4680 if (isContextLost() || !location) | 4681 if (isContextLost() || !location) |
| 4681 return; | 4682 return; |
| 4682 | 4683 |
| 4683 if (location->program() != m_currentProgram) { | 4684 if (location->program() != m_currentProgram) { |
| 4684 synthesizeGLError(GL_INVALID_OPERATION, "uniform2i", "location not for c
urrent program"); | 4685 synthesizeGLError(GL_INVALID_OPERATION, "uniform2i", "location not for c
urrent program"); |
| 4685 return; | 4686 return; |
| 4686 } | 4687 } |
| 4687 | 4688 |
| 4688 webContext()->uniform2i(location->location(), x, y); | 4689 webContext()->uniform2i(location->location(), x, y); |
| 4689 } | 4690 } |
| 4690 | 4691 |
| 4691 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
DOMInt32Array* v) | 4692 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
const FlexibleInt32ArrayView& v) |
| 4692 { | 4693 { |
| 4693 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v,
2)) | 4694 if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform2
iv", location, v, 2)) |
| 4694 return; | 4695 return; |
| 4695 | 4696 |
| 4696 webContext()->uniform2iv(location->location(), v->length() >> 1, v->data()); | 4697 webContext()->uniform2iv(location->location(), v.length() >> 1, v.dataMaybeO
nStack()); |
| 4697 } | 4698 } |
| 4698 | 4699 |
| 4699 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
Vector<GLint>& v) | 4700 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
Vector<GLint>& v) |
| 4700 { | 4701 { |
| 4701 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v.
data(), v.size(), 2)) | 4702 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v.
data(), v.size(), 2)) |
| 4702 return; | 4703 return; |
| 4703 | 4704 |
| 4704 webContext()->uniform2iv(location->location(), v.size() >> 1, v.data()); | 4705 webContext()->uniform2iv(location->location(), v.size() >> 1, v.data()); |
| 4705 } | 4706 } |
| 4706 | 4707 |
| 4707 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z) | 4708 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z) |
| 4708 { | 4709 { |
| 4709 if (isContextLost() || !location) | 4710 if (isContextLost() || !location) |
| 4710 return; | 4711 return; |
| 4711 | 4712 |
| 4712 if (location->program() != m_currentProgram) { | 4713 if (location->program() != m_currentProgram) { |
| 4713 synthesizeGLError(GL_INVALID_OPERATION, "uniform3f", "location not for c
urrent program"); | 4714 synthesizeGLError(GL_INVALID_OPERATION, "uniform3f", "location not for c
urrent program"); |
| 4714 return; | 4715 return; |
| 4715 } | 4716 } |
| 4716 | 4717 |
| 4717 webContext()->uniform3f(location->location(), x, y, z); | 4718 webContext()->uniform3f(location->location(), x, y, z); |
| 4718 } | 4719 } |
| 4719 | 4720 |
| 4720 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) | 4721 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
const FlexibleFloat32ArrayView& v) |
| 4721 { | 4722 { |
| 4722 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v,
3)) | 4723 if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
m3fv", location, v, 3)) |
| 4723 return; | 4724 return; |
| 4724 | 4725 |
| 4725 webContext()->uniform3fv(location->location(), v->length() / 3, v->data()); | 4726 webContext()->uniform3fv(location->location(), v.length() / 3, v.dataMaybeOn
Stack()); |
| 4726 } | 4727 } |
| 4727 | 4728 |
| 4728 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) | 4729 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) |
| 4729 { | 4730 { |
| 4730 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v.
data(), v.size(), 3)) | 4731 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v.
data(), v.size(), 3)) |
| 4731 return; | 4732 return; |
| 4732 | 4733 |
| 4733 webContext()->uniform3fv(location->location(), v.size() / 3, v.data()); | 4734 webContext()->uniform3fv(location->location(), v.size() / 3, v.data()); |
| 4734 } | 4735 } |
| 4735 | 4736 |
| 4736 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z) | 4737 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z) |
| 4737 { | 4738 { |
| 4738 if (isContextLost() || !location) | 4739 if (isContextLost() || !location) |
| 4739 return; | 4740 return; |
| 4740 | 4741 |
| 4741 if (location->program() != m_currentProgram) { | 4742 if (location->program() != m_currentProgram) { |
| 4742 synthesizeGLError(GL_INVALID_OPERATION, "uniform3i", "location not for c
urrent program"); | 4743 synthesizeGLError(GL_INVALID_OPERATION, "uniform3i", "location not for c
urrent program"); |
| 4743 return; | 4744 return; |
| 4744 } | 4745 } |
| 4745 | 4746 |
| 4746 webContext()->uniform3i(location->location(), x, y, z); | 4747 webContext()->uniform3i(location->location(), x, y, z); |
| 4747 } | 4748 } |
| 4748 | 4749 |
| 4749 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
DOMInt32Array* v) | 4750 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
const FlexibleInt32ArrayView& v) |
| 4750 { | 4751 { |
| 4751 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v,
3)) | 4752 if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform3
iv", location, v, 3)) |
| 4752 return; | 4753 return; |
| 4753 | 4754 |
| 4754 webContext()->uniform3iv(location->location(), v->length() / 3, v->data()); | 4755 webContext()->uniform3iv(location->location(), v.length() / 3, v.dataMaybeOn
Stack()); |
| 4755 } | 4756 } |
| 4756 | 4757 |
| 4757 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
Vector<GLint>& v) | 4758 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
Vector<GLint>& v) |
| 4758 { | 4759 { |
| 4759 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v.
data(), v.size(), 3)) | 4760 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v.
data(), v.size(), 3)) |
| 4760 return; | 4761 return; |
| 4761 | 4762 |
| 4762 webContext()->uniform3iv(location->location(), v.size() / 3, v.data()); | 4763 webContext()->uniform3iv(location->location(), v.size() / 3, v.data()); |
| 4763 } | 4764 } |
| 4764 | 4765 |
| 4765 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z, GLfloat w) | 4766 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 4766 { | 4767 { |
| 4767 if (isContextLost() || !location) | 4768 if (isContextLost() || !location) |
| 4768 return; | 4769 return; |
| 4769 | 4770 |
| 4770 if (location->program() != m_currentProgram) { | 4771 if (location->program() != m_currentProgram) { |
| 4771 synthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for c
urrent program"); | 4772 synthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for c
urrent program"); |
| 4772 return; | 4773 return; |
| 4773 } | 4774 } |
| 4774 | 4775 |
| 4775 webContext()->uniform4f(location->location(), x, y, z, w); | 4776 webContext()->uniform4f(location->location(), x, y, z, w); |
| 4776 } | 4777 } |
| 4777 | 4778 |
| 4778 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) | 4779 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
const FlexibleFloat32ArrayView& v) |
| 4779 { | 4780 { |
| 4780 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v,
4)) | 4781 if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
m4fv", location, v, 4)) |
| 4781 return; | 4782 return; |
| 4782 | 4783 |
| 4783 webContext()->uniform4fv(location->location(), v->length() >> 2, v->data()); | 4784 webContext()->uniform4fv(location->location(), v.length() >> 2, v.dataMaybeO
nStack()); |
| 4784 } | 4785 } |
| 4785 | 4786 |
| 4786 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) | 4787 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
Vector<GLfloat>& v) |
| 4787 { | 4788 { |
| 4788 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v.
data(), v.size(), 4)) | 4789 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v.
data(), v.size(), 4)) |
| 4789 return; | 4790 return; |
| 4790 | 4791 |
| 4791 webContext()->uniform4fv(location->location(), v.size() >> 2, v.data()); | 4792 webContext()->uniform4fv(location->location(), v.size() >> 2, v.data()); |
| 4792 } | 4793 } |
| 4793 | 4794 |
| 4794 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z, GLint w) | 4795 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z, GLint w) |
| 4795 { | 4796 { |
| 4796 if (isContextLost() || !location) | 4797 if (isContextLost() || !location) |
| 4797 return; | 4798 return; |
| 4798 | 4799 |
| 4799 if (location->program() != m_currentProgram) { | 4800 if (location->program() != m_currentProgram) { |
| 4800 synthesizeGLError(GL_INVALID_OPERATION, "uniform4i", "location not for c
urrent program"); | 4801 synthesizeGLError(GL_INVALID_OPERATION, "uniform4i", "location not for c
urrent program"); |
| 4801 return; | 4802 return; |
| 4802 } | 4803 } |
| 4803 | 4804 |
| 4804 webContext()->uniform4i(location->location(), x, y, z, w); | 4805 webContext()->uniform4i(location->location(), x, y, z, w); |
| 4805 } | 4806 } |
| 4806 | 4807 |
| 4807 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
DOMInt32Array* v) | 4808 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
const FlexibleInt32ArrayView& v) |
| 4808 { | 4809 { |
| 4809 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v,
4)) | 4810 if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform4
iv", location, v, 4)) |
| 4810 return; | 4811 return; |
| 4811 | 4812 |
| 4812 webContext()->uniform4iv(location->location(), v->length() >> 2, v->data()); | 4813 webContext()->uniform4iv(location->location(), v.length() >> 2, v.dataMaybeO
nStack()); |
| 4813 } | 4814 } |
| 4814 | 4815 |
| 4815 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
Vector<GLint>& v) | 4816 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
Vector<GLint>& v) |
| 4816 { | 4817 { |
| 4817 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v.
data(), v.size(), 4)) | 4818 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v.
data(), v.size(), 4)) |
| 4818 return; | 4819 return; |
| 4819 | 4820 |
| 4820 webContext()->uniform4iv(location->location(), v.size() >> 2, v.data()); | 4821 webContext()->uniform4iv(location->location(), v.size() >> 2, v.data()); |
| 4821 } | 4822 } |
| 4822 | 4823 |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5956 case GL_SAMPLE_COVERAGE: | 5957 case GL_SAMPLE_COVERAGE: |
| 5957 case GL_SCISSOR_TEST: | 5958 case GL_SCISSOR_TEST: |
| 5958 case GL_STENCIL_TEST: | 5959 case GL_STENCIL_TEST: |
| 5959 return true; | 5960 return true; |
| 5960 default: | 5961 default: |
| 5961 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid capability"); | 5962 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid capability"); |
| 5962 return false; | 5963 return false; |
| 5963 } | 5964 } |
| 5964 } | 5965 } |
| 5965 | 5966 |
| 5967 template<typename WTFTypedArray> |
| 5968 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, const TypedFlexibleArrayBufferView<WTF
TypedArray>& v, GLsizei requiredMinSize) |
| 5969 { |
| 5970 if (!v.dataMaybeOnStack()) { |
| 5971 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
| 5972 return false; |
| 5973 } |
| 5974 return validateUniformMatrixParameters(functionName, location, false, v.data
MaybeOnStack(), v.length(), requiredMinSize); |
| 5975 } |
| 5976 |
| 5966 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, DOMFloat32Array* v, GLsizei requiredMi
nSize) | 5977 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, DOMFloat32Array* v, GLsizei requiredMi
nSize) |
| 5967 { | 5978 { |
| 5968 if (!v) { | 5979 if (!v) { |
| 5969 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); | 5980 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
| 5970 return false; | 5981 return false; |
| 5971 } | 5982 } |
| 5972 return validateUniformMatrixParameters(functionName, location, false, v->dat
a(), v->length(), requiredMinSize); | 5983 return validateUniformMatrixParameters(functionName, location, false, v->dat
a(), v->length(), requiredMinSize); |
| 5973 } | 5984 } |
| 5974 | 5985 |
| 5975 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, DOMInt32Array* v, GLsizei requiredMinS
ize) | 5986 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, DOMInt32Array* v, GLsizei requiredMinS
ize) |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6595 | 6606 |
| 6596 return totalBytesPerPixel; | 6607 return totalBytesPerPixel; |
| 6597 } | 6608 } |
| 6598 | 6609 |
| 6599 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6610 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6600 { | 6611 { |
| 6601 return m_drawingBuffer.get(); | 6612 return m_drawingBuffer.get(); |
| 6602 } | 6613 } |
| 6603 | 6614 |
| 6604 } // namespace blink | 6615 } // namespace blink |
| OLD | NEW |