| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/html/canvas/WebGL2RenderingContextBase.h" | 6 #include "core/html/canvas/WebGL2RenderingContextBase.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/WebGLAny.h" | 8 #include "bindings/core/v8/WebGLAny.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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 } | 713 } |
| 714 | 714 |
| 715 void WebGL2RenderingContextBase::clearBufferfi(GLenum buffer, GLint drawbuffer,
GLfloat depth, GLint stencil) | 715 void WebGL2RenderingContextBase::clearBufferfi(GLenum buffer, GLint drawbuffer,
GLfloat depth, GLint stencil) |
| 716 { | 716 { |
| 717 if (isContextLost()) | 717 if (isContextLost()) |
| 718 return; | 718 return; |
| 719 | 719 |
| 720 webContext()->clearBufferfi(buffer, drawbuffer, depth, stencil); | 720 webContext()->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 721 } | 721 } |
| 722 | 722 |
| 723 PassRefPtr<WebGLQuery> WebGL2RenderingContextBase::createQuery() | 723 PassRefPtrWillBeRawPtr<WebGLQuery> WebGL2RenderingContextBase::createQuery() |
| 724 { | 724 { |
| 725 if (isContextLost()) | 725 if (isContextLost()) |
| 726 return nullptr; | 726 return nullptr; |
| 727 RefPtr<WebGLQuery> o = WebGLQuery::create(this); | 727 RefPtrWillBeRawPtr<WebGLQuery> o = WebGLQuery::create(this); |
| 728 addSharedObject(o.get()); | 728 addSharedObject(o.get()); |
| 729 return o; | 729 return o; |
| 730 } | 730 } |
| 731 | 731 |
| 732 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) | 732 void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query) |
| 733 { | 733 { |
| 734 deleteObject(query); | 734 deleteObject(query); |
| 735 } | 735 } |
| 736 | 736 |
| 737 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) | 737 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 751 } | 751 } |
| 752 | 752 |
| 753 void WebGL2RenderingContextBase::endQuery(GLenum target) | 753 void WebGL2RenderingContextBase::endQuery(GLenum target) |
| 754 { | 754 { |
| 755 if (isContextLost()) | 755 if (isContextLost()) |
| 756 return; | 756 return; |
| 757 | 757 |
| 758 webContext()->endQueryEXT(target); | 758 webContext()->endQueryEXT(target); |
| 759 } | 759 } |
| 760 | 760 |
| 761 PassRefPtr<WebGLQuery> WebGL2RenderingContextBase::getQuery(GLenum target, GLenu
m pname) | 761 PassRefPtrWillBeRawPtr<WebGLQuery> WebGL2RenderingContextBase::getQuery(GLenum t
arget, GLenum pname) |
| 762 { | 762 { |
| 763 if (isContextLost()) | 763 if (isContextLost()) |
| 764 return nullptr; | 764 return nullptr; |
| 765 | 765 |
| 766 notImplemented(); | 766 notImplemented(); |
| 767 return nullptr; | 767 return nullptr; |
| 768 } | 768 } |
| 769 | 769 |
| 770 ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
te, WebGLQuery* query, GLenum pname) | 770 ScriptValue WebGL2RenderingContextBase::getQueryParameter(ScriptState* scriptSta
te, WebGLQuery* query, GLenum pname) |
| 771 { | 771 { |
| 772 if (isContextLost() || !validateWebGLObject("getQueryParameter", query)) | 772 if (isContextLost() || !validateWebGLObject("getQueryParameter", query)) |
| 773 return ScriptValue::createNull(scriptState); | 773 return ScriptValue::createNull(scriptState); |
| 774 | 774 |
| 775 notImplemented(); | 775 notImplemented(); |
| 776 return ScriptValue::createNull(scriptState); | 776 return ScriptValue::createNull(scriptState); |
| 777 } | 777 } |
| 778 | 778 |
| 779 PassRefPtr<WebGLSampler> WebGL2RenderingContextBase::createSampler() | 779 PassRefPtrWillBeRawPtr<WebGLSampler> WebGL2RenderingContextBase::createSampler() |
| 780 { | 780 { |
| 781 if (isContextLost()) | 781 if (isContextLost()) |
| 782 return nullptr; | 782 return nullptr; |
| 783 RefPtr<WebGLSampler> o = WebGLSampler::create(this); | 783 RefPtrWillBeRawPtr<WebGLSampler> o = WebGLSampler::create(this); |
| 784 addSharedObject(o.get()); | 784 addSharedObject(o.get()); |
| 785 return o; | 785 return o; |
| 786 } | 786 } |
| 787 | 787 |
| 788 void WebGL2RenderingContextBase::deleteSampler(WebGLSampler* sampler) | 788 void WebGL2RenderingContextBase::deleteSampler(WebGLSampler* sampler) |
| 789 { | 789 { |
| 790 deleteObject(sampler); | 790 deleteObject(sampler); |
| 791 } | 791 } |
| 792 | 792 |
| 793 GLboolean WebGL2RenderingContextBase::isSampler(WebGLSampler* sampler) | 793 GLboolean WebGL2RenderingContextBase::isSampler(WebGLSampler* sampler) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 GLfloat value = 0.f; | 846 GLfloat value = 0.f; |
| 847 webContext()->getSamplerParameterfv(objectOrZero(sampler), pname, &v
alue); | 847 webContext()->getSamplerParameterfv(objectOrZero(sampler), pname, &v
alue); |
| 848 return WebGLAny(scriptState, value); | 848 return WebGLAny(scriptState, value); |
| 849 } | 849 } |
| 850 default: | 850 default: |
| 851 synthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter", "invalid param
eter name"); | 851 synthesizeGLError(GL_INVALID_ENUM, "getSamplerParameter", "invalid param
eter name"); |
| 852 return ScriptValue::createNull(scriptState); | 852 return ScriptValue::createNull(scriptState); |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 | 855 |
| 856 PassRefPtr<WebGLSync> WebGL2RenderingContextBase::fenceSync(GLenum condition, GL
bitfield flags) | 856 PassRefPtrWillBeRawPtr<WebGLSync> WebGL2RenderingContextBase::fenceSync(GLenum c
ondition, GLbitfield flags) |
| 857 { | 857 { |
| 858 if (isContextLost()) | 858 if (isContextLost()) |
| 859 return nullptr; | 859 return nullptr; |
| 860 | 860 |
| 861 RefPtr<WebGLSync> o = WebGLFenceSync::create(this, condition, flags); | 861 RefPtrWillBeRawPtr<WebGLSync> o = WebGLFenceSync::create(this, condition, fl
ags); |
| 862 addSharedObject(o.get()); | 862 addSharedObject(o.get()); |
| 863 return o.release(); | 863 return o.release(); |
| 864 } | 864 } |
| 865 | 865 |
| 866 GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) | 866 GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) |
| 867 { | 867 { |
| 868 if (isContextLost() || !sync) | 868 if (isContextLost() || !sync) |
| 869 return 0; | 869 return 0; |
| 870 | 870 |
| 871 return webContext()->isSync(sync->object()); | 871 return webContext()->isSync(sync->object()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 896 | 896 |
| 897 ScriptValue WebGL2RenderingContextBase::getSyncParameter(ScriptState* scriptStat
e, WebGLSync* sync, GLenum pname) | 897 ScriptValue WebGL2RenderingContextBase::getSyncParameter(ScriptState* scriptStat
e, WebGLSync* sync, GLenum pname) |
| 898 { | 898 { |
| 899 if (isContextLost() || !validateWebGLObject("getSyncParameter", sync)) | 899 if (isContextLost() || !validateWebGLObject("getSyncParameter", sync)) |
| 900 return ScriptValue::createNull(scriptState); | 900 return ScriptValue::createNull(scriptState); |
| 901 | 901 |
| 902 notImplemented(); | 902 notImplemented(); |
| 903 return ScriptValue::createNull(scriptState); | 903 return ScriptValue::createNull(scriptState); |
| 904 } | 904 } |
| 905 | 905 |
| 906 PassRefPtr<WebGLTransformFeedback> WebGL2RenderingContextBase::createTransformFe
edback() | 906 PassRefPtrWillBeRawPtr<WebGLTransformFeedback> WebGL2RenderingContextBase::creat
eTransformFeedback() |
| 907 { | 907 { |
| 908 if (isContextLost()) | 908 if (isContextLost()) |
| 909 return nullptr; | 909 return nullptr; |
| 910 RefPtr<WebGLTransformFeedback> o = WebGLTransformFeedback::create(this); | 910 RefPtrWillBeRawPtr<WebGLTransformFeedback> o = WebGLTransformFeedback::creat
e(this); |
| 911 addSharedObject(o.get()); | 911 addSharedObject(o.get()); |
| 912 return o; | 912 return o; |
| 913 } | 913 } |
| 914 | 914 |
| 915 void WebGL2RenderingContextBase::deleteTransformFeedback(WebGLTransformFeedback*
feedback) | 915 void WebGL2RenderingContextBase::deleteTransformFeedback(WebGLTransformFeedback*
feedback) |
| 916 { | 916 { |
| 917 deleteObject(feedback); | 917 deleteObject(feedback); |
| 918 } | 918 } |
| 919 | 919 |
| 920 GLboolean WebGL2RenderingContextBase::isTransformFeedback(WebGLTransformFeedback
* feedback) | 920 GLboolean WebGL2RenderingContextBase::isTransformFeedback(WebGLTransformFeedback
* feedback) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 950 } | 950 } |
| 951 | 951 |
| 952 void WebGL2RenderingContextBase::transformFeedbackVaryings(WebGLProgram* program
, const Vector<String>& varyings, GLenum bufferMode) | 952 void WebGL2RenderingContextBase::transformFeedbackVaryings(WebGLProgram* program
, const Vector<String>& varyings, GLenum bufferMode) |
| 953 { | 953 { |
| 954 if (isContextLost() || !validateWebGLObject("transformFeedbackVaryings", pro
gram)) | 954 if (isContextLost() || !validateWebGLObject("transformFeedbackVaryings", pro
gram)) |
| 955 return; | 955 return; |
| 956 | 956 |
| 957 notImplemented(); | 957 notImplemented(); |
| 958 } | 958 } |
| 959 | 959 |
| 960 PassRefPtr<WebGLActiveInfo> WebGL2RenderingContextBase::getTransformFeedbackVary
ing(WebGLProgram* program, GLuint index) | 960 PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGL2RenderingContextBase::getTransform
FeedbackVarying(WebGLProgram* program, GLuint index) |
| 961 { | 961 { |
| 962 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) | 962 if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", p
rogram)) |
| 963 return nullptr; | 963 return nullptr; |
| 964 | 964 |
| 965 notImplemented(); | 965 notImplemented(); |
| 966 return nullptr; | 966 return nullptr; |
| 967 } | 967 } |
| 968 | 968 |
| 969 void WebGL2RenderingContextBase::pauseTransformFeedback() | 969 void WebGL2RenderingContextBase::pauseTransformFeedback() |
| 970 { | 970 { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) | 1091 void WebGL2RenderingContextBase::uniformBlockBinding(WebGLProgram* program, GLui
nt uniformBlockIndex, GLuint uniformBlockBinding) |
| 1092 { | 1092 { |
| 1093 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) | 1093 if (isContextLost() || !validateWebGLObject("uniformBlockBinding", program)) |
| 1094 return; | 1094 return; |
| 1095 | 1095 |
| 1096 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); | 1096 webContext()->uniformBlockBinding(objectOrZero(program), uniformBlockIndex,
uniformBlockBinding); |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 PassRefPtr<WebGLVertexArrayObjectOES> WebGL2RenderingContextBase::createVertexAr
ray() | 1099 PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> WebGL2RenderingContextBase::cr
eateVertexArray() |
| 1100 { | 1100 { |
| 1101 if (isContextLost()) | 1101 if (isContextLost()) |
| 1102 return nullptr; | 1102 return nullptr; |
| 1103 | 1103 |
| 1104 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(this
, WebGLVertexArrayObjectOES::VaoTypeUser); | 1104 RefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES:
:create(this, WebGLVertexArrayObjectOES::VaoTypeUser); |
| 1105 addContextObject(o.get()); | 1105 addContextObject(o.get()); |
| 1106 return o.release(); | 1106 return o.release(); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObjectOES* ve
rtexArray) | 1109 void WebGL2RenderingContextBase::deleteVertexArray(WebGLVertexArrayObjectOES* ve
rtexArray) |
| 1110 { | 1110 { |
| 1111 if (isContextLost() || !vertexArray) | 1111 if (isContextLost() || !vertexArray) |
| 1112 return; | 1112 return; |
| 1113 | 1113 |
| 1114 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) | 1114 if (!vertexArray->isDefaultObject() && vertexArray == m_boundVertexArrayObje
ct) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 setBoundVertexArrayObject(nullptr); | 1148 setBoundVertexArrayObject(nullptr); |
| 1149 } | 1149 } |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 void WebGL2RenderingContextBase::trace(Visitor* visitor) | 1152 void WebGL2RenderingContextBase::trace(Visitor* visitor) |
| 1153 { | 1153 { |
| 1154 WebGLRenderingContextBase::trace(visitor); | 1154 WebGLRenderingContextBase::trace(visitor); |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 } // namespace blink | 1157 } // namespace blink |
| OLD | NEW |