| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) | 1073 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) |
| 1074 { | 1074 { |
| 1075 bool deleted; | 1075 bool deleted; |
| 1076 if (!checkObjectToBeBound("beginQuery", query, deleted)) | 1076 if (!checkObjectToBeBound("beginQuery", query, deleted)) |
| 1077 return; | 1077 return; |
| 1078 if (deleted) { | 1078 if (deleted) { |
| 1079 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "attempted to begi
n a deleted query object"); | 1079 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "attempted to begi
n a deleted query object"); |
| 1080 return; | 1080 return; |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 if (!query->isCompatibleTarget(target)) { | 1083 if (query->getTarget() && query->getTarget() != target) { |
| 1084 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query type does n
ot match target"); | 1084 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query type does n
ot match target"); |
| 1085 return; | 1085 return; |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 switch (target) { | 1088 switch (target) { |
| 1089 case GL_ANY_SAMPLES_PASSED: | 1089 case GL_ANY_SAMPLES_PASSED: |
| 1090 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: | 1090 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: |
| 1091 { | 1091 { |
| 1092 if (m_currentBooleanOcclusionQuery) { | 1092 if (m_currentBooleanOcclusionQuery) { |
| 1093 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "a query i
s already active for target"); | 1093 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "a query i
s already active for target"); |
| 1094 return; | 1094 return; |
| 1095 } | 1095 } |
| 1096 m_currentBooleanOcclusionQuery = query; | 1096 m_currentBooleanOcclusionQuery = query; |
| 1097 } | 1097 } |
| 1098 break; | 1098 break; |
| 1099 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: | 1099 case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: |
| 1100 { | 1100 { |
| 1101 if (m_currentTransformFeedbackPrimitivesWrittenQuery) { | 1101 if (m_currentTransformFeedbackPrimitivesWrittenQuery) { |
| 1102 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "a query i
s already active for target"); | 1102 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "a query i
s already active for target"); |
| 1103 return; | 1103 return; |
| 1104 } | 1104 } |
| 1105 m_currentTransformFeedbackPrimitivesWrittenQuery = query; | 1105 m_currentTransformFeedbackPrimitivesWrittenQuery = query; |
| 1106 } | 1106 } |
| 1107 break; | 1107 break; |
| 1108 default: | 1108 default: |
| 1109 synthesizeGLError(GL_INVALID_ENUM, "beginQuery", "invalid target"); | 1109 synthesizeGLError(GL_INVALID_ENUM, "beginQuery", "invalid target"); |
| 1110 return; | 1110 return; |
| 1111 } | 1111 } |
| 1112 | 1112 |
| 1113 query->setTarget(target); | 1113 if (!query->getTarget()) |
| 1114 query->setTarget(target); |
| 1114 | 1115 |
| 1115 webContext()->beginQueryEXT(target, query->object()); | 1116 webContext()->beginQueryEXT(target, query->object()); |
| 1116 } | 1117 } |
| 1117 | 1118 |
| 1118 void WebGL2RenderingContextBase::endQuery(GLenum target) | 1119 void WebGL2RenderingContextBase::endQuery(GLenum target) |
| 1119 { | 1120 { |
| 1120 if (isContextLost()) | 1121 if (isContextLost()) |
| 1121 return; | 1122 return; |
| 1122 | 1123 |
| 1123 switch (target) { | 1124 switch (target) { |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 2224 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
| 2224 { | 2225 { |
| 2225 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 2226 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
| 2226 return m_readFramebufferBinding->colorBufferFormat(); | 2227 return m_readFramebufferBinding->colorBufferFormat(); |
| 2227 if (m_requestedAttributes.alpha()) | 2228 if (m_requestedAttributes.alpha()) |
| 2228 return GL_RGBA; | 2229 return GL_RGBA; |
| 2229 return GL_RGB; | 2230 return GL_RGB; |
| 2230 } | 2231 } |
| 2231 | 2232 |
| 2232 } // namespace blink | 2233 } // namespace blink |
| OLD | NEW |