mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
2fdb3f6084
- Bug 1048721 - Implement WebGL2Sync. r=jgilbert (b15a0a106) - Bug 1156626 - Add ES3 buffer binding values to strong type. r=jgilbert (2495c6e3b) - Bug 1144889 - Do proper sRGB detection. - r=kamidphish (db7956d1c) - Bug 1159117 - Enable support for legacy formats. r=jgilbert (8a1cc3f16) - Bug 974832 - Implement necessary GL features to provide timer queries. r=dglastonbury (eaed796c8) - Bug 974832 - Add support for WebGL's EXT_disjoint_timer_query. r=dglastonbury, r=smaug (35f1a540c) - Bug 974832 - Add tests for WebGL's EXT_disjoint_timer_query. r=dglastonbury (a7201f461) - Bug 1167504 - Part 9: Remove BindableName - Queries. r=jgilbert (c5e304f55) - Bug 1168845 - Update WebGL interface names to follow the spec. r=smaug, r=dglastonbury (494859b27) - Bug 1150310 - Return context cached value for stencil* queries. r=jgilbert (f5afa0562) - Bug 1150310 - Only check stencil LSB 8bit value. r=jgilbert (fa9506d8b) - Bug 1167504 - Part 10: Remove WebGLBindableName.h. r=jgilbert (dc1fee18e) - Bug 1048745 - Non square UniformMatrix. r=jgilbert (0dac5c36b) - Bug 1048745 - Uniform with GLuint. r=jgilbert (41de94bc1) - Bug 1048745 - Uniform array with Uint32Array. r=jgilbert, r=smaug (0fa503e7e) - Bug 1048745 - Query GL for glGetUniformuiv function. r=jgilbert (8086c9053) - Bug 1145501 - Extend validation of BufferData usage. r=jgilbert (5f57241fc) - Bug 1155470 - Fix queries. r=jgilbert (ccf7dad00) - Bug 1153386 - All the GLES3 uniform types. r=jgilbert (2b223ed42) - Bug 1048747 - Cleanup how uniform interface blocks are handled. r=jgilbert (6ac86d50e) - Bug 1048724 - Sort out Transform Feedback Varyings. r=jgilbert (bcdd6dfdf) - Bug 1167504 - Part 12: Return new buffer binding points from getParameter. r=jgilbert (3d01ff848) - Bug 1170855 - Part 1: Extract WebGL 2 specific pnames. r=jgilbert (935a74b45) - Bug 1170855 - Part 2: Be consistent when handling pnames from extensions. r=jgilbert (06522e47b) - Bug 1170855 - Part 3: Cleanup and better comments. r=jgilbert (3e422adf8) - Bug 1170855 - Part 4: Pour in the WebGL 2 pnames. r=jgilbert (2119d2f3d) - Bug 1170855 - Part 5: Correctly load glGetInteger64v. r=jgilbert (3e44d32e3) - Bug 1009734 - Wait until draw to warn about texture completeness. - r=kamidphish (d7dc3eaa8) - Bug 1170855 - Part 6: Implement Sampler binding tracking. r=jgilbert (6f1a1e713) - Bug 1170855 - Part 7: Implement MAX_CLIENT_WAIT_TIMEOUT_WEBGL. r=jgilbert, r=smaug (7ca761b1f) - Bug 1170855 - Part 8: MAX_SERVER_WAIT_TIMEOUT is unsigned. r=jgilbert (16939ba9f) - Bug 1170855 - Part 9: MAX_VARYING_COMPONENTS workaround. r=jgilbert (2cc7e870c) - Bug 1170855 - Part A: Don't error on MAX_ELEMENT_INDEX. r=jgilbert (acefb1580) - Bug 1170855 - Part B: READ_BUFFER requires emulation for default FB. r=jgilbert (795bb5793) - Bug 1170855 - Part C: Move _WEBGL GLenums from GLConsts.h to WebGLContext.h. r=jgilbert (3eada1f47) - Bug 1182950 - Fix compile error in non-unified build. r=botond (018bb21ea)
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, tf);
|
|
|
|
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);
|
|
}
|