mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
2e86f7f52e
- Bug 909993 - Add WebIDL for TextTrackCue and fix link in VTTCue.webidl. r=rillian r=bz (24a78498b) - Bug 1044102 - Part 4 - update W3C web platform tests. r=smaug (1379beb25) - Bug 1159830 - Autophone - webappstartup should not use console.log to output WEBAPP STARTUP COMPLETE. r=snorp, r=froydnj (f85a43beb) - Bug 1152574: Fix console service discarding to run when it is actually safe to do so (off of inner-window-destroyed). Also add a backstop at xpcom-shutdown to discard any cycle collected messages before it is too late. r=froydnj (01f6f8708) - Bug 1152574 - Do not report aborted XHR requests in web console (r=sicking) (814b8868d) - Bug 1186589 - Ensure CORS preflight requests are never intercepted. r=sicking (f0484fbe5) - namespace (6dc7db16d) - namespace (585e04c34) - Bug 1179505 - Make LoadInfo arguments optional in ipdl (r=bent,sicking) (c9d2efa2a) - fix old misspatch (3950e6fae) - Bug 1219027. Fix unbinding transformfeedback when deleting it. r=djg I believe this was the original intention of the code. This fixes deletion conformance tests. (3878dade7) - Bug 1175803 - Store redirect chain within loadInfo - part 1 (r=sicking,mayhemer) (5b0ea460a) - Bug 1143922 - Add AsyncOpen2 to nsIChannel and perform security checks when opening a channel - loadinfo changes (r=sicking,tanvi,sworkman) (46ab73d45) - Bug 1175803 - Store redirect chain within loadInfo - part 2 (r=sicking,mayhemer) (6181a439c) - Bug 1180964 - Provide a C++ friendly version of LoadInfo on nsIChanne version of LoadInfo on nsIChanne (563a98940) - Bug 1175803 - Store redirect chain within loadInfo - part 3 e10s (r=mrbkap,mayhemer) (7bf552870)
219 lines
6.0 KiB
C++
219 lines
6.0 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "WebGL2Context.h"
|
|
#include "WebGLActiveInfo.h"
|
|
#include "WebGLProgram.h"
|
|
#include "WebGLTransformFeedback.h"
|
|
#include "GLContext.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
// -------------------------------------------------------------------------
|
|
// Transform Feedback
|
|
|
|
already_AddRefed<WebGLTransformFeedback>
|
|
WebGL2Context::CreateTransformFeedback()
|
|
{
|
|
if (IsContextLost())
|
|
return nullptr;
|
|
|
|
GLuint tf = 0;
|
|
MakeContextCurrent();
|
|
gl->fGenTransformFeedbacks(1, &tf);
|
|
|
|
nsRefPtr<WebGLTransformFeedback> globj = new WebGLTransformFeedback(this, tf);
|
|
return globj.forget();
|
|
}
|
|
|
|
void
|
|
WebGL2Context::DeleteTransformFeedback(WebGLTransformFeedback* tf)
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
if (!ValidateObjectAllowDeletedOrNull("deleteTransformFeedback", tf))
|
|
return;
|
|
|
|
if (!tf || tf->IsDeleted())
|
|
return;
|
|
|
|
if (mBoundTransformFeedback == tf)
|
|
BindTransformFeedback(LOCAL_GL_TRANSFORM_FEEDBACK, nullptr);
|
|
|
|
tf->RequestDelete();
|
|
}
|
|
|
|
bool
|
|
WebGL2Context::IsTransformFeedback(WebGLTransformFeedback* tf)
|
|
{
|
|
if (IsContextLost())
|
|
return false;
|
|
|
|
if (!ValidateObjectAllowDeleted("isTransformFeedback", tf))
|
|
return false;
|
|
|
|
if (tf->IsDeleted())
|
|
return false;
|
|
|
|
MakeContextCurrent();
|
|
return gl->fIsTransformFeedback(tf->mGLName);
|
|
}
|
|
|
|
void
|
|
WebGL2Context::BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf)
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
if (!ValidateObjectAllowDeletedOrNull("bindTransformFeedback", tf))
|
|
return;
|
|
|
|
if (target != LOCAL_GL_TRANSFORM_FEEDBACK)
|
|
return ErrorInvalidEnum("bindTransformFeedback: target must be TRANSFORM_FEEDBACK");
|
|
|
|
WebGLRefPtr<WebGLTransformFeedback> currentTF = mBoundTransformFeedback;
|
|
if (currentTF && currentTF->mIsActive && !currentTF->mIsPaused) {
|
|
return ErrorInvalidOperation("bindTransformFeedback: Currently bound transform "
|
|
"feedback is active and not paused");
|
|
}
|
|
|
|
if (tf && tf->IsDeleted())
|
|
return ErrorInvalidOperation("bindTransformFeedback: Attempt to bind deleted id");
|
|
|
|
MakeContextCurrent();
|
|
gl->fBindTransformFeedback(target, tf ? tf->mGLName : 0);
|
|
if (tf)
|
|
mBoundTransformFeedback = tf;
|
|
else
|
|
mBoundTransformFeedback = mDefaultTransformFeedback;
|
|
}
|
|
|
|
void
|
|
WebGL2Context::BeginTransformFeedback(GLenum primitiveMode)
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
WebGLTransformFeedback* tf = mBoundTransformFeedback;
|
|
MOZ_ASSERT(tf);
|
|
if (!tf)
|
|
return;
|
|
|
|
if (tf->mIsActive)
|
|
return ErrorInvalidOperation("beginTransformFeedback: transform feedback is active");
|
|
|
|
const GLenum mode = tf->mMode;
|
|
if (mode != LOCAL_GL_POINTS && mode != LOCAL_GL_LINES && mode != LOCAL_GL_TRIANGLES)
|
|
return ErrorInvalidEnum("beginTransformFeedback: primitive must be one of POINTS, LINES, or TRIANGLES");
|
|
|
|
// TODO:
|
|
// GL_INVALID_OPERATION is generated by glBeginTransformFeedback
|
|
// if any binding point used in transform feedback mode does not
|
|
// have a buffer object bound. In interleaved mode, only the first
|
|
// buffer object binding point is ever written to.
|
|
|
|
// GL_INVALID_OPERATION is generated by glBeginTransformFeedback
|
|
// if no binding points would be used, either because no program
|
|
// object is active of because the active program object has
|
|
// specified no varying variables to record.
|
|
if (!mCurrentProgram)
|
|
return ErrorInvalidOperation("beginTransformFeedback: no program is active");
|
|
|
|
MakeContextCurrent();
|
|
gl->fBeginTransformFeedback(primitiveMode);
|
|
tf->mIsActive = true;
|
|
tf->mIsPaused = false;
|
|
}
|
|
|
|
void
|
|
WebGL2Context::EndTransformFeedback()
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
WebGLTransformFeedback* tf = mBoundTransformFeedback;
|
|
MOZ_ASSERT(tf);
|
|
|
|
if (!tf)
|
|
return;
|
|
|
|
if (!tf->mIsActive)
|
|
return ErrorInvalidOperation("%s: transform feedback in not active",
|
|
"endTransformFeedback");
|
|
|
|
MakeContextCurrent();
|
|
gl->fEndTransformFeedback();
|
|
tf->mIsActive = false;
|
|
tf->mIsPaused = false;
|
|
}
|
|
|
|
void
|
|
WebGL2Context::PauseTransformFeedback()
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
WebGLTransformFeedback* tf = mBoundTransformFeedback;
|
|
MOZ_ASSERT(tf);
|
|
if (!tf)
|
|
return;
|
|
|
|
if (!tf->mIsActive || tf->mIsPaused) {
|
|
return ErrorInvalidOperation("%s: transform feedback is not active or is paused",
|
|
"pauseTransformFeedback");
|
|
}
|
|
|
|
MakeContextCurrent();
|
|
gl->fPauseTransformFeedback();
|
|
tf->mIsPaused = true;
|
|
}
|
|
|
|
void
|
|
WebGL2Context::ResumeTransformFeedback()
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
WebGLTransformFeedback* tf = mBoundTransformFeedback;
|
|
MOZ_ASSERT(tf);
|
|
if (!tf)
|
|
return;
|
|
|
|
if (!tf->mIsActive || !tf->mIsPaused)
|
|
return ErrorInvalidOperation("resumeTransformFeedback: transform feedback is not active or is not paused");
|
|
|
|
MakeContextCurrent();
|
|
gl->fResumeTransformFeedback();
|
|
tf->mIsPaused = false;
|
|
}
|
|
|
|
void
|
|
WebGL2Context::TransformFeedbackVaryings(WebGLProgram* program,
|
|
const dom::Sequence<nsString>& varyings,
|
|
GLenum bufferMode)
|
|
{
|
|
if (IsContextLost())
|
|
return;
|
|
|
|
if (!ValidateObject("transformFeedbackVaryings: program", program))
|
|
return;
|
|
|
|
program->TransformFeedbackVaryings(varyings, bufferMode);
|
|
}
|
|
|
|
already_AddRefed<WebGLActiveInfo>
|
|
WebGL2Context::GetTransformFeedbackVarying(WebGLProgram* program, GLuint index)
|
|
{
|
|
if (IsContextLost())
|
|
return nullptr;
|
|
|
|
if (!ValidateObject("getTransformFeedbackVarying: program", program))
|
|
return nullptr;
|
|
|
|
return program->GetTransformFeedbackVarying(index);
|
|
}
|