本文整理汇总了C++中IsContextLost函数的典型用法代码示例。如果您正苦于以下问题:C++ IsContextLost函数的具体用法?C++ IsContextLost怎么用?C++ IsContextLost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsContextLost函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LastColorAttachmentEnum
void
WebGL2Context::ReadBuffer(GLenum mode)
{
if (IsContextLost())
return;
const bool isColorAttachment = (mode >= LOCAL_GL_COLOR_ATTACHMENT0 &&
mode <= LastColorAttachmentEnum());
if (mode != LOCAL_GL_NONE && mode != LOCAL_GL_BACK && !isColorAttachment) {
ErrorInvalidEnum("readBuffer: `mode` must be one of NONE, BACK, or "
"COLOR_ATTACHMENTi. Was %s",
EnumName(mode));
return;
}
if (mBoundReadFramebuffer) {
if (mode != LOCAL_GL_NONE &&
!isColorAttachment)
{
ErrorInvalidOperation("readBuffer: If READ_FRAMEBUFFER is non-null, `mode` "
"must be COLOR_ATTACHMENTi or NONE. Was %s",
EnumName(mode));
return;
}
MakeContextCurrent();
gl->fReadBuffer(mode);
return;
}
// Operating on the default framebuffer.
if (mode != LOCAL_GL_NONE &&
mode != LOCAL_GL_BACK)
{
ErrorInvalidOperation("readBuffer: If READ_FRAMEBUFFER is null, `mode`"
" must be BACK or NONE. Was %s",
EnumName(mode));
return;
}
gl->Screen()->SetReadBuffer(mode);
}
开发者ID:Think-Software,项目名称:newtab-dev,代码行数:43,代码来源:WebGL2ContextFramebuffers.cpp
示例2: GetStateTrackingSlot
void
WebGLContext::Enable(GLenum cap)
{
if (IsContextLost())
return;
if (!ValidateCapabilityEnum(cap, "enable"))
return;
realGLboolean* trackingSlot = GetStateTrackingSlot(cap);
if (trackingSlot)
{
*trackingSlot = 1;
}
MakeContextCurrent();
gl->fEnable(cap);
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:19,代码来源:WebGLContextState.cpp
示例3: GetQuerySlotByTarget
void
WebGL2Context::EndQuery(GLenum target)
{
if (IsContextLost())
return;
if (!ValidateQueryTarget(target, "endQuery"))
return;
WebGLRefPtr<WebGLQuery>& querySlot = GetQuerySlotByTarget(target);
WebGLQuery* activeQuery = querySlot.get();
if (!activeQuery || target != activeQuery->mType)
{
/* From GLES's EXT_occlusion_query_boolean:
* marks the end of the sequence of commands to be tracked for the
* query type given by <target>. The active query object for
* <target> is updated to indicate that query results are not
* available, and the active query object name for <target> is reset
* to zero. When the commands issued prior to EndQueryEXT have
* completed and a final query result is available, the query object
* active when EndQueryEXT is called is updated by the GL. The query
* object is updated to indicate that the query results are
* available and to contain the query result. If the active query
* object name for <target> is zero when EndQueryEXT is called, the
* error INVALID_OPERATION is generated.
*/
ErrorInvalidOperation("endQuery: There is no active query of type %s.",
GetQueryTargetEnumString(target));
return;
}
MakeContextCurrent();
if (target == LOCAL_GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN) {
gl->fEndQuery(LOCAL_GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
} else {
gl->fEndQuery(SimulateOcclusionQueryTarget(gl, target));
}
UpdateBoundQuery(target, nullptr);
NS_DispatchToCurrentThread(new WebGLQuery::AvailableRunnable(activeQuery));
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:43,代码来源:WebGL2ContextQueries.cpp
示例4: ErrorInvalidEnumInfo
void
WebGL2Context::GetInternalformatParameter(JSContext* cx, GLenum target,
GLenum internalformat, GLenum pname,
JS::MutableHandleValue retval,
ErrorResult& rv)
{
if (IsContextLost())
return;
if (target != LOCAL_GL_RENDERBUFFER) {
return ErrorInvalidEnumInfo("getInternalfomratParameter: target must be "
"RENDERBUFFER. Was:", target);
}
// GL_INVALID_ENUM is generated if internalformat is not color-,
// depth-, or stencil-renderable.
// TODO: When format table queries lands.
if (pname != LOCAL_GL_SAMPLES) {
return ErrorInvalidEnumInfo("getInternalformatParameter: pname must be SAMPLES. "
"Was:", pname);
}
GLint* samples = nullptr;
GLint sampleCount = 0;
gl->fGetInternalformativ(LOCAL_GL_RENDERBUFFER, internalformat,
LOCAL_GL_NUM_SAMPLE_COUNTS, 1, &sampleCount);
if (sampleCount > 0) {
samples = new GLint[sampleCount];
gl->fGetInternalformativ(LOCAL_GL_RENDERBUFFER, internalformat, LOCAL_GL_SAMPLES,
sampleCount, samples);
}
JSObject* obj = dom::Int32Array::Create(cx, this, sampleCount, samples);
if (!obj) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
delete[] samples;
retval.setObjectOrNull(obj);
}
开发者ID:Danielzac,项目名称:gecko-dev,代码行数:42,代码来源:WebGL2ContextRenderbuffers.cpp
示例5: ErrorOutOfMemory
void
WebGLContext::BufferDataT(GLenum target,
const BufferT& data,
GLenum usage)
{
if (IsContextLost())
return;
if (!ValidateBufferTarget(target, "bufferData"))
return;
const WebGLRefPtr<WebGLBuffer>& bufferSlot = GetBufferSlotByTarget(target);
data.ComputeLengthAndData();
// Careful: data.Length() could conceivably be any uint32_t, but GLsizeiptr
// is like intptr_t.
if (!CheckedInt<GLsizeiptr>(data.Length()).isValid())
return ErrorOutOfMemory("bufferData: bad size");
if (!ValidateBufferUsageEnum(usage, "bufferData: usage"))
return;
WebGLBuffer* boundBuffer = bufferSlot.get();
if (!boundBuffer)
return ErrorInvalidOperation("bufferData: no buffer bound!");
MakeContextCurrent();
InvalidateBufferFetching();
GLenum error = CheckedBufferData(target, data.Length(), data.Data(), usage);
if (error) {
GenerateWarning("bufferData generated error %s", ErrorName(error));
return;
}
boundBuffer->SetByteLength(data.Length());
if (!boundBuffer->ElementArrayCacheBufferData(data.Data(), data.Length()))
return ErrorOutOfMemory("bufferData: out of memory");
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:42,代码来源:WebGLContextBuffers.cpp
示例6: ErrorInvalidValue
void
WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler)
{
if (IsContextLost())
return;
if (!ValidateObjectAllowDeletedOrNull("bindSampler", sampler))
return;
if (GLint(unit) >= mGLMaxTextureUnits)
return ErrorInvalidValue("bindSampler: unit must be < %d", mGLMaxTextureUnits);
if (sampler && sampler->IsDeleted())
return ErrorInvalidOperation("bindSampler: binding deleted sampler");
WebGLContextUnchecked::BindSampler(unit, sampler);
InvalidateResolveCacheForTextureWithTexUnit(unit);
mBoundSamplers[unit] = sampler;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:20,代码来源:WebGL2ContextSamplers.cpp
示例7: ErrorInvalidOperation
void
WebGL2Context::SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Float32Array& param)
{
if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameterfv: invalid sampler");
param.ComputeLengthAndData();
if (param.Length() < 1)
return /* TODO(djg): Error message */;
/* TODO(djg): All of these calls in ES3 only take 1 param */
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param.Data()[0]), "samplerParameterfv"))
return;
sampler->SamplerParameter1f(pname, param.Data()[0]);
WebGLContextUnchecked::SamplerParameterfv(sampler, pname, param.Data());
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:20,代码来源:WebGL2ContextSamplers.cpp
示例8: ErrorInvalidOperation
void
WebGLContext::EndQuery(GLenum target, const char* funcName)
{
if (!funcName) {
funcName = "endQuery";
}
if (IsContextLost())
return;
const auto& slot = ValidateQuerySlotByTarget(funcName, target);
if (!slot)
return;
const auto& query = *slot;
if (!query)
return ErrorInvalidOperation("%s: Query target not active.", funcName);
query->EndQuery();
}
开发者ID:artines1,项目名称:gecko-dev,代码行数:20,代码来源:WebGL2ContextQueries.cpp
示例9:
void
WebGL2Context::DeleteSampler(WebGLSampler* sampler)
{
if (IsContextLost())
return;
if (!ValidateObjectAllowDeletedOrNull("deleteSampler", sampler))
return;
if (!sampler || sampler->IsDeleted())
return;
for (int n = 0; n < mGLMaxTextureUnits; n++) {
if (mBoundSamplers[n] == sampler) {
mBoundSamplers[n] = nullptr;
}
}
sampler->RequestDelete();
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:20,代码来源:WebGL2ContextSamplers.cpp
示例10: ErrorInvalidOperation
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;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:20,代码来源:WebGL2ContextTransformFeedback.cpp
示例11: InvalidateBufferFetching
void
WebGLContext::VertexAttribDivisor(GLuint index, GLuint divisor)
{
if (IsContextLost())
return;
if (!ValidateAttribIndex(index, "vertexAttribDivisor"))
return;
MOZ_ASSERT(mBoundVertexArray);
WebGLVertexAttribData& vd = mBoundVertexArray->mAttribs[index];
vd.mDivisor = divisor;
InvalidateBufferFetching();
MakeContextCurrent();
gl->fVertexAttribDivisor(index, divisor);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:20,代码来源:WebGLContextVertices.cpp
示例12: ErrorInvalidValue
/* This doesn't belong here. It's part of state querying */
void
WebGL2Context::GetIndexedParameter(GLenum target, GLuint index,
dom::Nullable<dom::OwningWebGLBufferOrLongLong>& retval)
{
retval.SetNull();
if (IsContextLost())
return;
GLint64 data = 0;
MakeContextCurrent();
switch (target) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
if (index >= mGLMaxTransformFeedbackSeparateAttribs)
return ErrorInvalidValue("getIndexedParameter: index should be less than "
"MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS");
retval.SetValue().SetAsWebGLBuffer() =
mBoundTransformFeedbackBuffers[index].get();
return;
case LOCAL_GL_UNIFORM_BUFFER_BINDING:
if (index >= mGLMaxUniformBufferBindings)
return ErrorInvalidValue("getIndexedParameter: index should be than "
"MAX_UNIFORM_BUFFER_BINDINGS");
retval.SetValue().SetAsWebGLBuffer() = mBoundUniformBuffers[index].get();
return;
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_START:
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
case LOCAL_GL_UNIFORM_BUFFER_START:
case LOCAL_GL_UNIFORM_BUFFER_SIZE:
gl->fGetInteger64i_v(target, index, &data);
retval.SetValue().SetAsLongLong() = data;
return;
}
ErrorInvalidEnumInfo("getIndexedParameter: target", target);
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:42,代码来源:WebGL2ContextUniforms.cpp
示例13: ErrorInvalidEnum
void
WebGL2Context::ClearBufferuiv(GLenum buffer, GLint drawBuffer, const Uint32Arr& src,
GLuint srcElemOffset)
{
const char funcName[] = "clearBufferuiv";
if (IsContextLost())
return;
if (buffer != LOCAL_GL_COLOR)
return ErrorInvalidEnum("%s: buffer must be COLOR.", funcName);
if (!ValidateClearBuffer(funcName, buffer, drawBuffer, src.elemCount, srcElemOffset,
LOCAL_GL_UNSIGNED_INT))
{
return;
}
ScopedDrawCallWrapper wrapper(*this);
const auto ptr = src.elemBytes + srcElemOffset;
gl->fClearBufferuiv(buffer, drawBuffer, ptr);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:21,代码来源:WebGL2ContextMRTs.cpp
示例14: WebGLExtensionID
void
WebGLContext::GetSupportedExtensions(dom::Nullable< nsTArray<nsString> >& retval,
dom::CallerType callerType)
{
retval.SetNull();
if (IsContextLost())
return;
nsTArray<nsString>& arr = retval.SetValue();
for (size_t i = 0; i < size_t(WebGLExtensionID::Max); i++) {
const auto extension = WebGLExtensionID(i);
if (extension == WebGLExtensionID::MOZ_debug)
continue; // Hide MOZ_debug from this list.
if (IsExtensionSupported(callerType, extension)) {
const char* extStr = GetExtensionString(extension);
arr.AppendElement(NS_ConvertUTF8toUTF16(extStr));
}
}
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:21,代码来源:WebGLContextExtensions.cpp
示例15: ErrorInvalidValue
void
WebGLContext::Clear(GLbitfield mask)
{
const char funcName[] = "clear";
if (IsContextLost())
return;
MakeContextCurrent();
uint32_t m = mask & (LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
if (mask != m)
return ErrorInvalidValue("%s: invalid mask bits", funcName);
if (mask == 0) {
GenerateWarning("Calling gl.clear(0) has no effect.");
} else if (mRasterizerDiscardEnabled) {
GenerateWarning("Calling gl.clear() with RASTERIZER_DISCARD enabled has no effects.");
}
if (mBoundDrawFramebuffer) {
if (!mBoundDrawFramebuffer->ValidateAndInitAttachments(funcName))
return;
gl->fClear(mask);
return;
} else {
ClearBackbufferIfNeeded();
}
// Ok, we're clearing the default framebuffer/screen.
{
ScopedMaskWorkaround autoMask(*this);
gl->fClear(mask);
}
Invalidate();
mShouldPresent = true;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:39,代码来源:WebGLContextFramebufferOperations.cpp
示例16: ErrorInvalidValue
void
WebGLContext::BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer,
WebGLintptr offset, WebGLsizeiptr size)
{
if (IsContextLost())
return;
if (!ValidateObjectAllowDeletedOrNull("bindBufferRange", buffer))
return;
// silently ignore a deleted buffer
if (buffer && buffer->IsDeleted())
return;
// ValidateBufferTarget
switch (target) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
if (index >= mGLMaxTransformFeedbackSeparateAttribs)
return ErrorInvalidValue("bindBufferRange: index should be less than "
"MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS");
break;
case LOCAL_GL_UNIFORM_BUFFER:
if (index >= mGLMaxUniformBufferBindings)
return ErrorInvalidValue("bindBufferRange: index should be less than "
"MAX_UNIFORM_BUFFER_BINDINGS");
break;
default:
return ErrorInvalidEnumInfo("bindBufferRange: target", target);
}
if (!ValidateBufferForTarget(target, buffer, "bindBufferRange"))
return;
WebGLContextUnchecked::BindBufferRange(target, index, buffer, offset, size);
UpdateBoundBufferIndexed(target, index, buffer);
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:39,代码来源:WebGLContextBuffers.cpp
示例17: ErrorInvalidEnum
already_AddRefed<WebGLQuery>
WebGL2Context::GetQuery(GLenum target, GLenum pname)
{
if (IsContextLost())
return nullptr;
if (!ValidateQueryTarget(target, "getQuery"))
return nullptr;
if (pname != LOCAL_GL_CURRENT_QUERY) {
/* OpenGL ES 3.0 spec 6.1.7:
* pname must be CURRENT_QUERY.
*/
ErrorInvalidEnum("getQuery: `pname` must be CURRENT_QUERY.");
return nullptr;
}
WebGLRefPtr<WebGLQuery>& targetSlot = GetQuerySlotByTarget(target);
nsRefPtr<WebGLQuery> tmp = targetSlot.get();
return tmp.forget();
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:22,代码来源:WebGL2ContextQueries.cpp
示例18: MakeContextCurrent
already_AddRefed<WebGLSampler>
WebGL2Context::CreateSampler()
{
const char funcName[] = "createSampler";
if (IsContextLost())
return nullptr;
/*
GLuint sampler;
MakeContextCurrent();
gl->fGenSamplers(1, &sampler);
RefPtr<WebGLSampler> globj = new WebGLSampler(this, sampler);
return globj.forget();
*/
ErrorInvalidOperation("%s: Sampler objects are still under development, and are"
" currently disabled.",
funcName);
return nullptr;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:22,代码来源:WebGL2ContextSamplers.cpp
示例19: ErrorInvalidOperation
void
WebGLContext::DrawBuffers(const dom::Sequence<GLenum>& buffers)
{
const char funcName[] = "drawBuffers";
if (IsContextLost())
return;
if (mBoundDrawFramebuffer) {
mBoundDrawFramebuffer->DrawBuffers(funcName, buffers);
return;
}
// GLES 3.0.4 p186:
// "If the GL is bound to the default framebuffer, then `n` must be 1 and the
// constant must be BACK or NONE. [...] If DrawBuffers is supplied with a
// constant other than BACK and NONE, or with a value of `n` other than 1, the
// error INVALID_OPERATION is generated."
if (buffers.Length() != 1) {
ErrorInvalidOperation("%s: For the default framebuffer, `buffers` must have a"
" length of 1.",
funcName);
return;
}
switch (buffers[0]) {
case LOCAL_GL_NONE:
case LOCAL_GL_BACK:
break;
default:
ErrorInvalidOperation("%s: For the default framebuffer, `buffers[0]` must be"
" BACK or NONE.",
funcName);
return;
}
mDefaultFB_DrawBuffer0 = buffers[0];
gl->Screen()->SetDrawBuffer(buffers[0]);
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:39,代码来源:WebGLContextFramebufferOperations.cpp
示例20: scopedResolve
void
WebGLContext::DrawElements(GLenum mode, GLsizei count, GLenum type,
WebGLintptr byteOffset)
{
const char funcName[] = "drawElements";
if (IsContextLost())
return;
if (!ValidateDrawModeEnum(mode, funcName))
return;
MakeContextCurrent();
bool error;
ScopedResolveTexturesForDraw scopedResolve(this, funcName, &error);
if (error)
return;
GLuint upperBound = 0;
if (!DrawElements_check(count, type, byteOffset, 1, funcName, &upperBound))
return;
RunContextLossTimer();
{
ScopedMaskWorkaround autoMask(*this);
if (gl->IsSupported(gl::GLFeature::draw_range_elements)) {
gl->fDrawRangeElements(mode, 0, upperBound, count, type,
reinterpret_cast<GLvoid*>(byteOffset));
} else {
gl->fDrawElements(mode, count, type,
reinterpret_cast<GLvoid*>(byteOffset));
}
}
Draw_cleanup(funcName);
}
开发者ID:devtools-html,项目名称:gecko-dev,代码行数:38,代码来源:WebGLContextDraw.cpp
注:本文中的IsContextLost函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论