mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1167423 - patch 5 - Handle return values of FallibleTArray functions in WebGL2Context, r=smaug
This commit is contained in:
parent
827e00769e
commit
f6fa4f7bf5
@ -10,6 +10,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
class WebGLSampler;
|
||||
class WebGLSync;
|
||||
class WebGLTransformFeedback;
|
||||
@ -56,9 +57,10 @@ public:
|
||||
GLbitfield mask, GLenum filter);
|
||||
void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
void GetInternalformatParameter(JSContext*, GLenum target, GLenum internalformat, GLenum pname, JS::MutableHandleValue retval);
|
||||
void InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>& attachments);
|
||||
void InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>& attachments,
|
||||
ErrorResult& aRv);
|
||||
void InvalidateSubFramebuffer (GLenum target, const dom::Sequence<GLenum>& attachments, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
GLsizei width, GLsizei height, ErrorResult& aRv);
|
||||
void ReadBuffer(GLenum mode);
|
||||
void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat,
|
||||
GLsizei width, GLsizei height);
|
||||
|
@ -343,26 +343,38 @@ WebGL2Context::GetInternalformatParameter(JSContext*, GLenum target, GLenum inte
|
||||
|
||||
// Map attachments intended for the default buffer, to attachments for a non-
|
||||
// default buffer.
|
||||
static void
|
||||
static bool
|
||||
TranslateDefaultAttachments(const dom::Sequence<GLenum>& in, dom::Sequence<GLenum>* out)
|
||||
{
|
||||
for (size_t i = 0; i < in.Length(); i++) {
|
||||
switch (in[i]) {
|
||||
case LOCAL_GL_COLOR:
|
||||
out->AppendElement(LOCAL_GL_COLOR_ATTACHMENT0);
|
||||
if (!out->AppendElement(LOCAL_GL_COLOR_ATTACHMENT0)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case LOCAL_GL_DEPTH:
|
||||
out->AppendElement(LOCAL_GL_DEPTH_ATTACHMENT);
|
||||
if (!out->AppendElement(LOCAL_GL_DEPTH_ATTACHMENT)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case LOCAL_GL_STENCIL:
|
||||
out->AppendElement(LOCAL_GL_STENCIL_ATTACHMENT);
|
||||
if (!out->AppendElement(LOCAL_GL_STENCIL_ATTACHMENT)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
WebGL2Context::InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>& attachments)
|
||||
WebGL2Context::InvalidateFramebuffer(GLenum target,
|
||||
const dom::Sequence<GLenum>& attachments,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (IsContextLost())
|
||||
return;
|
||||
@ -407,7 +419,11 @@ WebGL2Context::InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>&
|
||||
|
||||
if (!fb && !isDefaultFB) {
|
||||
dom::Sequence<GLenum> tmpAttachments;
|
||||
TranslateDefaultAttachments(attachments, &tmpAttachments);
|
||||
if (!TranslateDefaultAttachments(attachments, &tmpAttachments)) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
gl->fInvalidateFramebuffer(target, tmpAttachments.Length(), tmpAttachments.Elements());
|
||||
} else {
|
||||
gl->fInvalidateFramebuffer(target, attachments.Length(), attachments.Elements());
|
||||
@ -416,7 +432,8 @@ WebGL2Context::InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>&
|
||||
|
||||
void
|
||||
WebGL2Context::InvalidateSubFramebuffer(GLenum target, const dom::Sequence<GLenum>& attachments,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (IsContextLost())
|
||||
return;
|
||||
@ -461,7 +478,11 @@ WebGL2Context::InvalidateSubFramebuffer(GLenum target, const dom::Sequence<GLenu
|
||||
|
||||
if (!fb && !isDefaultFB) {
|
||||
dom::Sequence<GLenum> tmpAttachments;
|
||||
TranslateDefaultAttachments(attachments, &tmpAttachments);
|
||||
if (!TranslateDefaultAttachments(attachments, &tmpAttachments)) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
|
||||
gl->fInvalidateSubFramebuffer(target, tmpAttachments.Length(), tmpAttachments.Elements(),
|
||||
x, y, width, height);
|
||||
} else {
|
||||
|
@ -329,9 +329,14 @@ interface WebGL2RenderingContext : WebGLRenderingContext
|
||||
GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
void framebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
|
||||
|
||||
[Throws]
|
||||
void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
|
||||
|
||||
[Throws]
|
||||
void invalidateSubFramebuffer (GLenum target, sequence<GLenum> attachments,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
void readBuffer(GLenum src);
|
||||
|
||||
/* Renderbuffer objects */
|
||||
|
Loading…
Reference in New Issue
Block a user