本文整理汇总了C++中ErrorInvalidOperation函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorInvalidOperation函数的具体用法?C++ ErrorInvalidOperation怎么用?C++ ErrorInvalidOperation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorInvalidOperation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ErrorInvalidOperation
void
WebGL2Context::SamplerParameteri(WebGLSampler* sampler, GLenum pname, GLint param)
{
if (IsContextLost())
return;
if (!sampler || sampler->IsDeleted())
return ErrorInvalidOperation("samplerParameteri: invalid sampler");
if (!ValidateSamplerParameterParams(pname, WebGLIntOrFloat(param), "samplerParameteri"))
return;
WebGLContextUnchecked::SamplerParameteri(sampler, pname, param);
}
示例2: ErrorInvalidOperation
bool
WebGLContext::ValidateStencilParamsForDrawCall()
{
const char msg[] = "%s set different front and back stencil %s. Drawing in"
" this configuration is not allowed.";
if (mStencilRefFront != mStencilRefBack) {
ErrorInvalidOperation(msg, "stencilFuncSeparate", "reference values");
return false;
}
if (mStencilValueMaskFront != mStencilValueMaskBack) {
ErrorInvalidOperation(msg, "stencilFuncSeparate", "value masks");
return false;
}
if (mStencilWriteMaskFront != mStencilWriteMaskBack) {
ErrorInvalidOperation(msg, "stencilMaskSeparate", "write masks");
return false;
}
return true;
}
示例3: ErrorInvalidOperation
void
WebGL2Context::RenderbufferStorageMultisample(GLenum target, GLsizei samples,
GLenum internalFormat,
GLsizei width, GLsizei height)
{
const char funcName[] = "renderbufferStorageMultisample";
if (IsContextLost())
return;
//RenderbufferStorage_base(funcName, target, samples, internalFormat, width, height);
ErrorInvalidOperation("%s: Multisampling is still under development, and is currently"
" disabled.", funcName);
}
示例4: ErrorInvalidOperation
void
WebGLContext::BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer)
{
const char funcName[] = "bindBufferBase";
if (IsContextLost())
return;
if (!ValidateObjectAllowDeletedOrNull(funcName, buffer))
return;
if (buffer && buffer->IsDeleted())
return ErrorInvalidOperation("%s: Cannot bind a deleted object.", funcName);
WebGLRefPtr<WebGLBuffer>* genericBinding;
IndexedBufferBinding* indexedBinding;
if (!ValidateIndexedBufferBinding(funcName, target, index, &genericBinding,
&indexedBinding))
{
return;
}
if (buffer && !buffer->ValidateCanBindToTarget(funcName, target))
return;
////
gl->MakeCurrent();
gl->fBindBufferBase(target, index, buffer ? buffer->mGLName : 0);
////
*genericBinding = buffer;
indexedBinding->mBufferBinding = buffer;
indexedBinding->mRangeStart = 0;
indexedBinding->mRangeSize = 0;
if (buffer) {
buffer->SetContentAfterBind(target);
}
switch (target) {
case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER:
mBoundTransformFeedback->OnIndexedBindingsChanged();
break;
case LOCAL_GL_UNIFORM:
OnUBIndexedBindingsChanged();
break;
}
}
示例5: funcScope
void WebGLContext::BeginQuery(GLenum target, WebGLQuery& query) {
const FuncScope funcScope(*this, "beginQuery");
if (IsContextLost()) return;
if (!ValidateObject("query", query)) return;
const auto& slot = ValidateQuerySlotByTarget(target);
if (!slot) return;
if (*slot) return ErrorInvalidOperation("Query target already active.");
////
query.BeginQuery(target, *slot);
}
示例6: MOZ_ASSERT
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;
}
示例7: GetBufferSlotByTarget
void
WebGLContext::BufferSubDataT(GLenum target,
WebGLsizeiptr byteOffset,
const BufferT& data)
{
if (IsContextLost())
return;
if (!ValidateBufferTarget(target, "bufferSubData"))
return;
WebGLRefPtr<WebGLBuffer>& bufferSlot = GetBufferSlotByTarget(target);
if (byteOffset < 0)
return ErrorInvalidValue("bufferSubData: negative offset");
WebGLBuffer* boundBuffer = bufferSlot.get();
if (!boundBuffer)
return ErrorInvalidOperation("bufferData: no buffer bound!");
data.ComputeLengthAndData();
CheckedInt<WebGLsizeiptr> checked_neededByteLength =
CheckedInt<WebGLsizeiptr>(byteOffset) + data.Length();
if (!checked_neededByteLength.isValid()) {
ErrorInvalidValue("bufferSubData: Integer overflow computing the needed"
" byte length.");
return;
}
if (checked_neededByteLength.value() > boundBuffer->ByteLength()) {
ErrorInvalidValue("bufferSubData: Not enough data. Operation requires"
" %d bytes, but buffer only has %d bytes.",
checked_neededByteLength.value(),
boundBuffer->ByteLength());
return;
}
boundBuffer->ElementArrayCacheBufferSubData(byteOffset, data.Data(),
data.Length());
MakeContextCurrent();
gl->fBufferSubData(target, byteOffset, data.Length(), data.Data());
}
示例8: ErrorInvalidOperation
void
WebGL2Context::DeleteTransformFeedback(WebGLTransformFeedback* tf)
{
const char funcName[] = "deleteTransformFeedback";
if (!ValidateDeleteObject(funcName, tf))
return;
if (tf->mIsActive) {
ErrorInvalidOperation("%s: Cannot delete active transform feedbacks.", funcName);
return;
}
if (mBoundTransformFeedback == tf) {
BindTransformFeedback(LOCAL_GL_TRANSFORM_FEEDBACK, nullptr);
}
tf->RequestDelete();
}
示例9: ValidateBufferSlot
WebGLBuffer*
WebGLContext::ValidateBufferSelection(const char* funcName, GLenum target)
{
const auto& slot = ValidateBufferSlot(funcName, target);
if (!slot)
return nullptr;
const auto& buffer = *slot;
if (!buffer) {
ErrorInvalidOperation("%s: Buffer for `target` is null.", funcName);
return nullptr;
}
if (!ValidateForNonTransformFeedback(funcName, buffer.get()))
return nullptr;
return buffer.get();
}
示例10: switch
bool
WebGLContext::ValidateFramebufferAttachment(const WebGLFramebuffer* fb, GLenum attachment,
const char* funcName,
bool badColorAttachmentIsInvalidOp)
{
if (!fb) {
switch (attachment) {
case LOCAL_GL_COLOR:
case LOCAL_GL_DEPTH:
case LOCAL_GL_STENCIL:
return true;
default:
ErrorInvalidEnum("%s: attachment: invalid enum value 0x%x.",
funcName, attachment);
return false;
}
}
if (attachment == LOCAL_GL_DEPTH_ATTACHMENT ||
attachment == LOCAL_GL_STENCIL_ATTACHMENT ||
attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
{
return true;
}
if (attachment >= LOCAL_GL_COLOR_ATTACHMENT0 &&
attachment <= LastColorAttachmentEnum())
{
return true;
}
if (badColorAttachmentIsInvalidOp &&
attachment >= LOCAL_GL_COLOR_ATTACHMENT0)
{
const uint32_t offset = attachment - LOCAL_GL_COLOR_ATTACHMENT0;
ErrorInvalidOperation("%s: Bad color attachment: COLOR_ATTACHMENT%u. (0x%04x)",
funcName, offset, attachment);
} else {
ErrorInvalidEnum("%s: attachment: Bad attachment 0x%x.", funcName, attachment);
}
return false;
}
示例11: 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);
mBoundSamplers[unit] = sampler;
}
示例12: 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));
}
示例13: ErrorInvalidOperation
bool WebGLContext::ValidateIndexedBufferBinding(
GLenum target, GLuint index,
WebGLRefPtr<WebGLBuffer>** const out_genericBinding,
IndexedBufferBinding** const out_indexedBinding) {
*out_genericBinding = ValidateBufferSlot(target);
if (!*out_genericBinding) return false;
*out_indexedBinding = ValidateIndexedBufferSlot(target, index);
if (!*out_indexedBinding) return false;
if (target == LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER &&
mBoundTransformFeedback->mIsActive) {
ErrorInvalidOperation(
"Cannot update indexed buffer bindings on active"
" transform feedback objects.");
return false;
}
return true;
}
示例14: ValidateQuerySlotByTarget
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();
}
示例15: 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;
}