зеркало из https://github.com/AvaloniaUI/angle.git
Move draw call primitive type check to the API.
A part of a larger refactoring to clean up the draw call validation. BUG=angle:571 Change-Id: I0b220d68c04524a81ca11dc58e10c90e458cabde Reviewed-on: https://chromium-review.googlesource.com/203771 Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
This commit is contained in:
Родитель
9efa581d0e
Коммит
1aeb13146c
|
@ -793,7 +793,8 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count)
|
|||
// emulate fans via rewriting index buffer
|
||||
case GL_TRIANGLE_FAN: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; minCount = 3; break;
|
||||
default:
|
||||
return gl::error(GL_INVALID_ENUM, false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (primitiveTopology != mCurrentPrimitiveTopology)
|
||||
|
|
|
@ -1094,7 +1094,8 @@ bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count)
|
|||
mPrimitiveCount = count - 2;
|
||||
break;
|
||||
default:
|
||||
return gl::error(GL_INVALID_ENUM, false);
|
||||
UNREACHABLE();
|
||||
return false;
|
||||
}
|
||||
|
||||
return mPrimitiveCount > 0;
|
||||
|
|
|
@ -1290,8 +1290,22 @@ bool ValidateCopyTexImageParametersBase(gl::Context* context, GLenum target, GLi
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool ValidateDrawBase(const gl::Context *context, GLsizei count)
|
||||
static bool ValidateDrawBase(const gl::Context *context, GLenum mode, GLsizei count)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case GL_POINTS:
|
||||
case GL_LINES:
|
||||
case GL_LINE_LOOP:
|
||||
case GL_LINE_STRIP:
|
||||
case GL_TRIANGLES:
|
||||
case GL_TRIANGLE_STRIP:
|
||||
case GL_TRIANGLE_FAN:
|
||||
break;
|
||||
default:
|
||||
return gl::error(GL_INVALID_ENUM, false);
|
||||
}
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
return gl::error(GL_INVALID_VALUE, false);
|
||||
|
@ -1347,7 +1361,7 @@ bool ValidateDrawArrays(const gl::Context *context, GLenum mode, GLint first, GL
|
|||
return gl::error(GL_INVALID_OPERATION, false);
|
||||
}
|
||||
|
||||
if (!ValidateDrawBase(context, count))
|
||||
if (!ValidateDrawBase(context, mode, count))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1408,7 +1422,7 @@ bool ValidateDrawElements(const gl::Context *context, GLenum mode, GLsizei count
|
|||
return gl::error(GL_INVALID_OPERATION, false);
|
||||
}
|
||||
|
||||
if (!ValidateDrawBase(context, count))
|
||||
if (!ValidateDrawBase(context, mode, count))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче