1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "WebGL2Context.h"
9 using namespace mozilla
;
10 using namespace mozilla::dom
;
12 // -------------------------------------------------------------------------
13 // Framebuffer objects
16 WebGL2Context::BlitFramebuffer(GLint srcX0
, GLint srcY0
, GLint srcX1
, GLint srcY1
,
17 GLint dstX0
, GLint dstY0
, GLint dstX1
, GLint dstY1
,
18 GLbitfield mask
, GLenum filter
)
20 MOZ_CRASH("Not Implemented.");
24 WebGL2Context::FramebufferTextureLayer(GLenum target
, GLenum attachment
, GLuint texture
, GLint level
, GLint layer
)
26 MOZ_CRASH("Not Implemented.");
30 WebGL2Context::GetInternalformatParameter(JSContext
*, GLenum target
, GLenum internalformat
, GLenum pname
, JS::MutableHandleValue retval
)
32 MOZ_CRASH("Not Implemented.");
35 // Map attachments intended for the default buffer, to attachments for a non-
38 TranslateDefaultAttachments(const dom::Sequence
<GLenum
>& in
, dom::Sequence
<GLenum
>* out
)
40 for (size_t i
= 0; i
< in
.Length(); i
++) {
43 out
->AppendElement(LOCAL_GL_COLOR_ATTACHMENT0
);
46 out
->AppendElement(LOCAL_GL_DEPTH_ATTACHMENT
);
48 case LOCAL_GL_STENCIL
:
49 out
->AppendElement(LOCAL_GL_STENCIL_ATTACHMENT
);
56 WebGL2Context::InvalidateFramebuffer(GLenum target
, const dom::Sequence
<GLenum
>& attachments
)
62 if (target
!= LOCAL_GL_FRAMEBUFFER
)
63 return ErrorInvalidEnumInfo("invalidateFramebuffer: target", target
);
64 for (size_t i
= 0; i
< attachments
.Length(); i
++) {
65 if (!ValidateFramebufferAttachment(attachments
[i
], "invalidateFramebuffer"))
69 if (!mBoundFramebuffer
&& !gl
->IsDrawingToDefaultFramebuffer()) {
70 dom::Sequence
<GLenum
> tmpAttachments
;
71 TranslateDefaultAttachments(attachments
, &tmpAttachments
);
72 gl
->fInvalidateFramebuffer(target
, tmpAttachments
.Length(), tmpAttachments
.Elements());
74 gl
->fInvalidateFramebuffer(target
, attachments
.Length(), attachments
.Elements());
79 WebGL2Context::InvalidateSubFramebuffer(GLenum target
, const dom::Sequence
<GLenum
>& attachments
,
80 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
86 if (target
!= LOCAL_GL_FRAMEBUFFER
)
87 return ErrorInvalidEnumInfo("invalidateFramebuffer: target", target
);
88 for (size_t i
= 0; i
< attachments
.Length(); i
++) {
89 if (!ValidateFramebufferAttachment(attachments
[i
], "invalidateSubFramebuffer"))
93 if (!mBoundFramebuffer
&& !gl
->IsDrawingToDefaultFramebuffer()) {
94 dom::Sequence
<GLenum
> tmpAttachments
;
95 TranslateDefaultAttachments(attachments
, &tmpAttachments
);
96 gl
->fInvalidateSubFramebuffer(target
, tmpAttachments
.Length(), tmpAttachments
.Elements(),
99 gl
->fInvalidateSubFramebuffer(target
, attachments
.Length(), attachments
.Elements(),
100 x
, y
, width
, height
);
105 WebGL2Context::ReadBuffer(GLenum mode
)
107 MOZ_CRASH("Not Implemented.");
111 WebGL2Context::RenderbufferStorageMultisample(GLenum target
, GLsizei samples
, GLenum internalformat
,
112 GLsizei width
, GLsizei height
)
114 MOZ_CRASH("Not Implemented.");