Chromium Code Reviews| 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 "modules/webgl/WebGL2RenderingContextBase.h" | 6 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 7 | 7 |
| 8 #include "bindings/modules/v8/WebGLAny.h" | 8 #include "bindings/modules/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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 } | 236 } |
| 237 | 237 |
| 238 void WebGL2RenderingContextBase::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfi eld mask, GLenum filter) | 238 void WebGL2RenderingContextBase::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfi eld mask, GLenum filter) |
| 239 { | 239 { |
| 240 if (isContextLost()) | 240 if (isContextLost()) |
| 241 return; | 241 return; |
| 242 | 242 |
| 243 webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dst Y0, dstX1, dstY1, mask, filter); | 243 webContext()->blitFramebufferCHROMIUM(srcX0, srcY0, srcX1, srcY1, dstX0, dst Y0, dstX1, dstY1, mask, filter); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target, GLenum a ttachment, const WebGLTexture* texture, GLint level, GLint layer) | 246 void WebGL2RenderingContextBase::framebufferTextureLayer(ScriptState* scriptStat e, GLenum target, GLenum attachment, WebGLTexture* texture, GLint level, GLint l ayer) |
| 247 { | 247 { |
| 248 if (isContextLost()) | 248 if (isContextLost()) |
| 249 return; | 249 return; |
| 250 | |
| 251 if (texture && !texture->validate(contextGroup(), this)) { | 250 if (texture && !texture->validate(contextGroup(), this)) { |
| 252 synthesizeGLError(GL_INVALID_VALUE, "framebufferTextureLayer", "no textu re or texture not from this context"); | 251 synthesizeGLError(GL_INVALID_VALUE, "framebufferTextureLayer", "no textu re or texture not from this context"); |
| 253 return; | 252 return; |
| 254 } | 253 } |
| 254 GLenum textarget = texture->getTarget(); | |
| 255 if (!validateTexFuncLevel("framebufferTextureLayer", textarget, level)) | |
| 256 return; | |
| 255 | 257 |
| 258 | |
| 259 WebGLFramebuffer* framebufferBinding = getFramebufferBinding(target); | |
| 260 if (!framebufferBinding || !framebufferBinding->object()) { | |
| 261 synthesizeGLError(GL_INVALID_OPERATION, "framebufferTextureLayer", "no f ramebuffer bound"); | |
| 262 return; | |
| 263 } | |
| 256 webContext()->framebufferTextureLayer(target, attachment, objectOrZero(textu re), level, layer); | 264 webContext()->framebufferTextureLayer(target, attachment, objectOrZero(textu re), level, layer); |
| 265 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, tex target, texture, level); | |
|
Zhenyao Mo
2015/10/26 21:50:33
You miss validation of target, attachment, texture
qiankun
2015/10/27 14:26:31
More validations were added. Incorporated layer pa
| |
| 266 applyStencilTest(); | |
| 267 preserveObjectWrapper(scriptState, framebufferBinding, "texture3d", attachme nt, texture); | |
|
Ken Russell (switch to Gerrit)
2015/10/26 21:23:09
I made a mistake in the original patch adding thes
qiankun
2015/10/27 14:26:31
Done.
| |
| 257 } | 268 } |
| 258 | 269 |
| 259 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* scriptState, GLenum target, GLenum internalformat, GLenum pname) | 270 ScriptValue WebGL2RenderingContextBase::getInternalformatParameter(ScriptState* scriptState, GLenum target, GLenum internalformat, GLenum pname) |
| 260 { | 271 { |
| 261 if (isContextLost()) | 272 if (isContextLost()) |
| 262 return ScriptValue::createNull(scriptState); | 273 return ScriptValue::createNull(scriptState); |
| 263 | 274 |
| 264 if (target != GL_RENDERBUFFER) { | 275 if (target != GL_RENDERBUFFER) { |
| 265 synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invali d target"); | 276 synthesizeGLError(GL_INVALID_ENUM, "getInternalformatParameter", "invali d target"); |
| 266 return ScriptValue::createNull(scriptState); | 277 return ScriptValue::createNull(scriptState); |
| (...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2962 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() | 2973 GLenum WebGL2RenderingContextBase::boundFramebufferColorFormat() |
| 2963 { | 2974 { |
| 2964 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) | 2975 if (m_readFramebufferBinding && m_readFramebufferBinding->object()) |
| 2965 return m_readFramebufferBinding->colorBufferFormat(); | 2976 return m_readFramebufferBinding->colorBufferFormat(); |
| 2966 if (m_requestedAttributes.alpha()) | 2977 if (m_requestedAttributes.alpha()) |
| 2967 return GL_RGBA; | 2978 return GL_RGBA; |
| 2968 return GL_RGB; | 2979 return GL_RGB; |
| 2969 } | 2980 } |
| 2970 | 2981 |
| 2971 } // namespace blink | 2982 } // namespace blink |
| OLD | NEW |