зеркало из https://github.com/AvaloniaUI/angle.git
Support instanced CHROMIUM_path_rendering
This implements instanced path rendering. BUG=angleproject:1382 Change-Id: I4654251882975d707b22c7bb522af14ae34eb1a1 Reviewed-on: https://chromium-review.googlesource.com/355401 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Sami Väisänen <svaisanen@nvidia.com>
This commit is contained in:
Родитель
10fcd9be1c
Коммит
d59ca052c0
|
@ -918,6 +918,59 @@ typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHCHROMIUMPROC)(GLuint pa
|
|||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
typedef void(GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDCHROMIUMPROC)(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
typedef void(GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDCHROMIUMPROC)(
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *m);
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum matrixMode);
|
||||
|
@ -947,6 +1000,58 @@ GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path,
|
|||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
GL_APICALL void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
GL_APICALL void GL_APIENTRY
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
GL_APICALL void GL_APIENTRY
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_path_rendering */
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#include "common/matrix_utils.h"
|
||||
#include "common/platform.h"
|
||||
|
@ -40,6 +41,58 @@
|
|||
namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
std::vector<gl::Path *> GatherPaths(gl::ResourceManager &resourceManager,
|
||||
GLsizei numPaths,
|
||||
const void *paths,
|
||||
GLuint pathBase)
|
||||
{
|
||||
std::vector<gl::Path *> ret;
|
||||
ret.reserve(numPaths);
|
||||
|
||||
const auto *nameArray = static_cast<const T *>(paths);
|
||||
|
||||
for (GLsizei i = 0; i < numPaths; ++i)
|
||||
{
|
||||
const GLuint pathName = nameArray[i] + pathBase;
|
||||
|
||||
ret.push_back(resourceManager.getPath(pathName));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<gl::Path *> GatherPaths(gl::ResourceManager &resourceManager,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase)
|
||||
{
|
||||
switch (pathNameType)
|
||||
{
|
||||
case GL_UNSIGNED_BYTE:
|
||||
return GatherPaths<GLubyte>(resourceManager, numPaths, paths, pathBase);
|
||||
|
||||
case GL_BYTE:
|
||||
return GatherPaths<GLbyte>(resourceManager, numPaths, paths, pathBase);
|
||||
|
||||
case GL_UNSIGNED_SHORT:
|
||||
return GatherPaths<GLushort>(resourceManager, numPaths, paths, pathBase);
|
||||
|
||||
case GL_SHORT:
|
||||
return GatherPaths<GLshort>(resourceManager, numPaths, paths, pathBase);
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
return GatherPaths<GLuint>(resourceManager, numPaths, paths, pathBase);
|
||||
|
||||
case GL_INT:
|
||||
return GatherPaths<GLint>(resourceManager, numPaths, paths, pathBase);
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
return std::vector<gl::Path *>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
gl::Error GetQueryObjectParameter(gl::Context *context, GLuint id, GLenum pname, T *params)
|
||||
{
|
||||
|
@ -1471,6 +1524,114 @@ void Context::stencilThenCoverStrokePath(GLuint path,
|
|||
mImplementation->stencilThenCoverStrokePath(pathObj, reference, mask, coverMode);
|
||||
}
|
||||
|
||||
void Context::coverFillPathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjects =
|
||||
GatherPaths(*mResourceManager, numPaths, pathNameType, paths, pathBase);
|
||||
|
||||
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
|
||||
syncRendererState();
|
||||
|
||||
mImplementation->coverFillPathInstanced(pathObjects, coverMode, transformType, transformValues);
|
||||
}
|
||||
void Context::coverStrokePathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjects =
|
||||
GatherPaths(*mResourceManager, numPaths, pathNameType, paths, pathBase);
|
||||
|
||||
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
|
||||
syncRendererState();
|
||||
|
||||
mImplementation->coverStrokePathInstanced(pathObjects, coverMode, transformType,
|
||||
transformValues);
|
||||
}
|
||||
void Context::stencilFillPathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjects =
|
||||
GatherPaths(*mResourceManager, numPaths, pathNameType, paths, pathBase);
|
||||
|
||||
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
|
||||
syncRendererState();
|
||||
|
||||
mImplementation->stencilFillPathInstanced(pathObjects, fillMode, mask, transformType,
|
||||
transformValues);
|
||||
}
|
||||
void Context::stencilStrokePathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjects =
|
||||
GatherPaths(*mResourceManager, numPaths, pathNameType, paths, pathBase);
|
||||
|
||||
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
|
||||
syncRendererState();
|
||||
|
||||
mImplementation->stencilStrokePathInstanced(pathObjects, reference, mask, transformType,
|
||||
transformValues);
|
||||
}
|
||||
void Context::stencilThenCoverFillPathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjects =
|
||||
GatherPaths(*mResourceManager, numPaths, pathNameType, paths, pathBase);
|
||||
|
||||
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
|
||||
syncRendererState();
|
||||
|
||||
mImplementation->stencilThenCoverFillPathInstanced(pathObjects, coverMode, fillMode, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
void Context::stencilThenCoverStrokePathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjects =
|
||||
GatherPaths(*mResourceManager, numPaths, pathNameType, paths, pathBase);
|
||||
|
||||
// TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
|
||||
syncRendererState();
|
||||
|
||||
mImplementation->stencilThenCoverStrokePathInstanced(pathObjects, coverMode, reference, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void Context::handleError(const Error &error)
|
||||
{
|
||||
if (error.isError())
|
||||
|
|
|
@ -491,6 +491,54 @@ class Context final : public ValidationContext
|
|||
void coverStrokePath(GLuint path, GLenum coverMode);
|
||||
void stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
|
||||
void stencilThenCoverStrokePath(GLuint path, GLint reference, GLuint mask, GLenum coverMode);
|
||||
void coverFillPathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void coverStrokePathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilFillPathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBAse,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilStrokePathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilThenCoverFillPathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilThenCoverStrokePathInstanced(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
void handleError(const Error &error) override;
|
||||
|
||||
|
|
|
@ -56,4 +56,58 @@ void ContextImpl::stencilThenCoverStrokePath(const gl::Path *path,
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void ContextImpl::coverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void ContextImpl::coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void ContextImpl::stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void ContextImpl::stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void ContextImpl::stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
void ContextImpl::stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
} // namespace rx
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#ifndef LIBANGLE_RENDERER_CONTEXTIMPL_H_
|
||||
#define LIBANGLE_RENDERER_CONTEXTIMPL_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "common/angleutils.h"
|
||||
#include "libANGLE/ContextState.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
|
@ -74,6 +76,37 @@ class ContextImpl : public GLImplFactory
|
|||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
|
||||
virtual void coverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
virtual void coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
virtual void stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
virtual void stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
virtual void stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
virtual void stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
// TODO(jmadill): Investigate proper impl methods for this.
|
||||
virtual void notifyDeviceLost() = 0;
|
||||
virtual bool isDeviceLost() const = 0;
|
||||
|
|
|
@ -222,6 +222,64 @@ void ContextGL::stencilThenCoverStrokePath(const gl::Path *path,
|
|||
mRenderer->stencilThenCoverStrokePath(mState, path, reference, mask, coverMode);
|
||||
}
|
||||
|
||||
void ContextGL::coverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
mRenderer->coverFillPathInstanced(mState, paths, coverMode, transformType, transformValues);
|
||||
}
|
||||
|
||||
void ContextGL::coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
mRenderer->coverStrokePathInstanced(mState, paths, coverMode, transformType, transformValues);
|
||||
}
|
||||
|
||||
void ContextGL::stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
mRenderer->stencilFillPathInstanced(mState, paths, fillMode, mask, transformType,
|
||||
transformValues);
|
||||
}
|
||||
|
||||
void ContextGL::stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
mRenderer->stencilStrokePathInstanced(mState, paths, reference, mask, transformType,
|
||||
transformValues);
|
||||
}
|
||||
|
||||
void ContextGL::stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
mRenderer->stencilThenCoverFillPathInstanced(mState, paths, coverMode, fillMode, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void ContextGL::stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
mRenderer->stencilThenCoverStrokePathInstanced(mState, paths, coverMode, reference, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void ContextGL::notifyDeviceLost()
|
||||
{
|
||||
mRenderer->notifyDeviceLost();
|
||||
|
|
|
@ -109,6 +109,36 @@ class ContextGL : public ContextImpl
|
|||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode) override;
|
||||
void coverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues) override;
|
||||
void coverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues) override;
|
||||
void stencilFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues) override;
|
||||
void stencilStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues) override;
|
||||
void stencilThenCoverFillPathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues) override;
|
||||
void stencilThenCoverStrokePathInstanced(const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues) override;
|
||||
|
||||
// TODO(jmadill): Investigate proper impl methods for this.
|
||||
void notifyDeviceLost() override;
|
||||
|
|
|
@ -433,6 +433,12 @@ FunctionsGL::FunctionsGL()
|
|||
coverStrokePathNV(nullptr),
|
||||
stencilThenCoverFillPathNV(nullptr),
|
||||
stencilThenCoverStrokePathNV(nullptr),
|
||||
coverFillPathInstancedNV(nullptr),
|
||||
coverStrokePathInstancedNV(nullptr),
|
||||
stencilFillPathInstancedNV(nullptr),
|
||||
stencilStrokePathInstancedNV(nullptr),
|
||||
stencilThenCoverFillPathInstancedNV(nullptr),
|
||||
stencilThenCoverStrokePathInstancedNV(nullptr),
|
||||
|
||||
bindFragDataLocationIndexed(nullptr),
|
||||
bindSampler(nullptr),
|
||||
|
@ -859,6 +865,13 @@ void FunctionsGL::initializeProcsDesktopGL()
|
|||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glCoverStrokePathNV"), &coverStrokePathNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverFillPathNV"), &stencilThenCoverFillPathNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverStrokePathNV"), &stencilThenCoverStrokePathNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glCoverFillPathInstancedNV"), &coverFillPathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glCoverStrokePathInstancedNV"), &coverStrokePathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilFillPathInstancedNV"), &stencilFillPathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilStrokePathInstancedNV"), &stencilStrokePathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverFillPathInstancedNV"), &stencilThenCoverFillPathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverStrokePathInstancedNV"), &stencilThenCoverStrokePathInstancedNV);
|
||||
|
||||
|
||||
// GL_NV_framebuffer_mixed_samples
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_framebuffer_mixed_samples", loadProcAddress("glCoverageModulationNV"), &coverageModulationNV);
|
||||
|
@ -1777,6 +1790,13 @@ void FunctionsGL::initializeProcsGLES()
|
|||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glCoverStrokePathNV"), &coverStrokePathNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverFillPathNV"), &stencilThenCoverFillPathNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverStrokePathNV"), &stencilThenCoverStrokePathNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glCoverFillPathInstancedNV"), &coverFillPathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glCoverStrokePathInstancedNV"), &coverStrokePathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilFillPathInstancedNV"), &stencilFillPathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilStrokePathInstancedNV"), &stencilStrokePathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverFillPathInstancedNV"), &stencilThenCoverFillPathInstancedNV);
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_NV_path_rendering", loadProcAddress("glStencilThenCoverStrokePathInstancedNV"), &stencilThenCoverStrokePathInstancedNV);
|
||||
|
||||
|
||||
// GL_OES_texture_3D
|
||||
AssignGLExtensionEntryPoint(extensions, "GL_OES_texture_3D", loadProcAddress("glTexImage3DOES"), &texImage3D);
|
||||
|
|
|
@ -413,6 +413,13 @@ class FunctionsGL
|
|||
PFNGLSTENCILTHENCOVERFILLPATHNVPROC stencilThenCoverFillPathNV;
|
||||
PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC stencilThenCoverStrokePathNV;
|
||||
|
||||
PFNGLCOVERFILLPATHINSTANCEDNVPROC coverFillPathInstancedNV;
|
||||
PFNGLCOVERSTROKEPATHINSTANCEDNVPROC coverStrokePathInstancedNV;
|
||||
PFNGLSTENCILFILLPATHINSTANCEDNVPROC stencilFillPathInstancedNV;
|
||||
PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC stencilStrokePathInstancedNV;
|
||||
PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC stencilThenCoverFillPathInstancedNV;
|
||||
PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC stencilThenCoverStrokePathInstancedNV;
|
||||
|
||||
// 3.3
|
||||
PFNGLBINDFRAGDATALOCATIONINDEXEDPROC bindFragDataLocationIndexed;
|
||||
PFNGLBINDSAMPLERPROC bindSampler;
|
||||
|
|
|
@ -36,6 +36,24 @@
|
|||
#include "libANGLE/renderer/gl/VertexArrayGL.h"
|
||||
#include "libANGLE/renderer/gl/renderergl_utils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::vector<GLuint> GatherPaths(const std::vector<gl::Path *> &paths)
|
||||
{
|
||||
std::vector<GLuint> ret;
|
||||
ret.reserve(paths.size());
|
||||
|
||||
for (const auto *p : paths)
|
||||
{
|
||||
const auto *pathObj = rx::GetImplAs<rx::PathGL>(p);
|
||||
ret.push_back(pathObj->getPathID());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifndef NDEBUG
|
||||
static void INTERNAL_GL_APIENTRY LogGLDebugMessage(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
|
||||
const GLchar *message, const void *userParam)
|
||||
|
@ -315,6 +333,98 @@ void RendererGL::stencilThenCoverStrokePath(const gl::ContextState &state,
|
|||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
void RendererGL::coverFillPathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjs = GatherPaths(paths);
|
||||
|
||||
mFunctions->coverFillPathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT,
|
||||
&pathObjs[0], 0, coverMode, transformType,
|
||||
transformValues);
|
||||
|
||||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
void RendererGL::coverStrokePathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjs = GatherPaths(paths);
|
||||
|
||||
mFunctions->coverStrokePathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT,
|
||||
&pathObjs[0], 0, coverMode, transformType,
|
||||
transformValues);
|
||||
|
||||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
void RendererGL::stencilFillPathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjs = GatherPaths(paths);
|
||||
|
||||
mFunctions->stencilFillPathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT,
|
||||
&pathObjs[0], 0, fillMode, mask, transformType,
|
||||
transformValues);
|
||||
|
||||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
void RendererGL::stencilStrokePathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjs = GatherPaths(paths);
|
||||
|
||||
mFunctions->stencilStrokePathInstancedNV(static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT,
|
||||
&pathObjs[0], 0, reference, mask, transformType,
|
||||
transformValues);
|
||||
|
||||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
void RendererGL::stencilThenCoverFillPathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjs = GatherPaths(paths);
|
||||
|
||||
mFunctions->stencilThenCoverFillPathInstancedNV(
|
||||
static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, &pathObjs[0], 0, fillMode, mask,
|
||||
coverMode, transformType, transformValues);
|
||||
|
||||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
void RendererGL::stencilThenCoverStrokePathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
const auto &pathObjs = GatherPaths(paths);
|
||||
|
||||
mFunctions->stencilThenCoverStrokePathInstancedNV(
|
||||
static_cast<GLsizei>(pathObjs.size()), GL_UNSIGNED_INT, &pathObjs[0], 0, reference, mask,
|
||||
coverMode, transformType, transformValues);
|
||||
|
||||
ASSERT(mFunctions->getError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
ContextImpl *RendererGL::createContext(const gl::ContextState &state)
|
||||
{
|
||||
return new ContextGL(state, this);
|
||||
|
|
|
@ -99,6 +99,43 @@ class RendererGL : angle::NonCopyable
|
|||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
void coverFillPathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void coverStrokePathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilFillPathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilStrokePathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
void stencilThenCoverFillPathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
void stencilThenCoverStrokePathInstanced(const gl::ContextState &state,
|
||||
const std::vector<gl::Path *> &paths,
|
||||
GLenum coverMode,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
// EXT_debug_marker
|
||||
void insertEventMarker(GLsizei length, const char *marker);
|
||||
|
|
|
@ -60,6 +60,150 @@ bool IsPartialBlit(gl::Context *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ValidatePathInstances(gl::Context *context,
|
||||
GLsizei numPaths,
|
||||
const void *paths,
|
||||
GLuint pathBase)
|
||||
{
|
||||
const auto *array = static_cast<const T *>(paths);
|
||||
|
||||
for (GLsizei i = 0; i < numPaths; ++i)
|
||||
{
|
||||
const GLuint pathName = array[i] + pathBase;
|
||||
if (context->hasPath(pathName) && !context->hasPathData(pathName))
|
||||
{
|
||||
context->handleError(gl::Error(GL_INVALID_OPERATION, "No such path object."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateInstancedPathParameters(gl::Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
if (!context->getExtensions().pathRendering)
|
||||
{
|
||||
context->handleError(
|
||||
gl::Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (paths == nullptr)
|
||||
{
|
||||
context->handleError(gl::Error(GL_INVALID_VALUE, "No path name array."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numPaths < 0)
|
||||
{
|
||||
context->handleError(gl::Error(GL_INVALID_VALUE, "Invalid (negative) numPaths."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!angle::IsValueInRangeForNumericType<std::uint32_t>(numPaths))
|
||||
{
|
||||
context->handleError(gl::Error(GL_INVALID_OPERATION, "Overflow in numPaths."));
|
||||
return false;
|
||||
}
|
||||
|
||||
std::uint32_t pathNameTypeSize = 0;
|
||||
std::uint32_t componentCount = 0;
|
||||
|
||||
switch (pathNameType)
|
||||
{
|
||||
case GL_UNSIGNED_BYTE:
|
||||
pathNameTypeSize = sizeof(GLubyte);
|
||||
if (!ValidatePathInstances<GLubyte>(context, numPaths, paths, pathBase))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
pathNameTypeSize = sizeof(GLbyte);
|
||||
if (!ValidatePathInstances<GLbyte>(context, numPaths, paths, pathBase))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT:
|
||||
pathNameTypeSize = sizeof(GLushort);
|
||||
if (!ValidatePathInstances<GLushort>(context, numPaths, paths, pathBase))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case GL_SHORT:
|
||||
pathNameTypeSize = sizeof(GLshort);
|
||||
if (!ValidatePathInstances<GLshort>(context, numPaths, paths, pathBase))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
pathNameTypeSize = sizeof(GLuint);
|
||||
if (!ValidatePathInstances<GLuint>(context, numPaths, paths, pathBase))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case GL_INT:
|
||||
pathNameTypeSize = sizeof(GLint);
|
||||
if (!ValidatePathInstances<GLint>(context, numPaths, paths, pathBase))
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
context->handleError(gl::Error(GL_INVALID_ENUM, "Invalid path name type."));
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (transformType)
|
||||
{
|
||||
case GL_NONE:
|
||||
componentCount = 0;
|
||||
break;
|
||||
case GL_TRANSLATE_X_CHROMIUM:
|
||||
case GL_TRANSLATE_Y_CHROMIUM:
|
||||
componentCount = 1;
|
||||
break;
|
||||
case GL_TRANSLATE_2D_CHROMIUM:
|
||||
componentCount = 2;
|
||||
break;
|
||||
case GL_TRANSLATE_3D_CHROMIUM:
|
||||
componentCount = 3;
|
||||
break;
|
||||
case GL_AFFINE_2D_CHROMIUM:
|
||||
case GL_TRANSPOSE_AFFINE_2D_CHROMIUM:
|
||||
componentCount = 6;
|
||||
break;
|
||||
case GL_AFFINE_3D_CHROMIUM:
|
||||
case GL_TRANSPOSE_AFFINE_3D_CHROMIUM:
|
||||
componentCount = 12;
|
||||
break;
|
||||
default:
|
||||
context->handleError(gl::Error(GL_INVALID_ENUM, "Invalid transformation."));
|
||||
return false;
|
||||
}
|
||||
if (componentCount != 0 && transformValues == nullptr)
|
||||
{
|
||||
context->handleError(gl::Error(GL_INVALID_VALUE, "No transform array given."));
|
||||
return false;
|
||||
}
|
||||
|
||||
angle::CheckedNumeric<std::uint32_t> checkedSize(0);
|
||||
checkedSize += (numPaths * pathNameTypeSize);
|
||||
checkedSize += (numPaths * sizeof(GLfloat) * componentCount);
|
||||
if (!checkedSize.IsValid())
|
||||
{
|
||||
context->handleError(gl::Error(GL_INVALID_OPERATION, "Overflow in num paths."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
bool ValidateES2TexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
|
||||
|
@ -2552,4 +2696,182 @@ bool ValidateIsPath(Context *context)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ValidateCoverFillPathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
|
||||
transformType, transformValues))
|
||||
return false;
|
||||
|
||||
switch (coverMode)
|
||||
{
|
||||
case GL_CONVEX_HULL_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
|
||||
break;
|
||||
default:
|
||||
context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateCoverStrokePathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
|
||||
transformType, transformValues))
|
||||
return false;
|
||||
|
||||
switch (coverMode)
|
||||
{
|
||||
case GL_CONVEX_HULL_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
|
||||
break;
|
||||
default:
|
||||
context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateStencilFillPathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
|
||||
if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
|
||||
transformType, transformValues))
|
||||
return false;
|
||||
|
||||
switch (fillMode)
|
||||
{
|
||||
case GL_COUNT_UP_CHROMIUM:
|
||||
case GL_COUNT_DOWN_CHROMIUM:
|
||||
break;
|
||||
default:
|
||||
context->handleError(Error(GL_INVALID_ENUM, "Invalid fill mode."));
|
||||
return false;
|
||||
}
|
||||
if (!isPow2(mask + 1))
|
||||
{
|
||||
context->handleError(Error(GL_INVALID_VALUE, "Invalid stencil bit mask."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateStencilStrokePathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
|
||||
transformType, transformValues))
|
||||
return false;
|
||||
|
||||
// no more validation here.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateStencilThenCoverFillPathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
|
||||
transformType, transformValues))
|
||||
return false;
|
||||
|
||||
switch (coverMode)
|
||||
{
|
||||
case GL_CONVEX_HULL_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
|
||||
break;
|
||||
default:
|
||||
context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (fillMode)
|
||||
{
|
||||
case GL_COUNT_UP_CHROMIUM:
|
||||
case GL_COUNT_DOWN_CHROMIUM:
|
||||
break;
|
||||
default:
|
||||
context->handleError(Error(GL_INVALID_ENUM, "Invalid fill mode."));
|
||||
return false;
|
||||
}
|
||||
if (!isPow2(mask + 1))
|
||||
{
|
||||
context->handleError(Error(GL_INVALID_VALUE, "Invalid stencil bit mask."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateStencilThenCoverStrokePathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
if (!ValidateInstancedPathParameters(context, numPaths, pathNameType, paths, pathBase,
|
||||
transformType, transformValues))
|
||||
return false;
|
||||
|
||||
switch (coverMode)
|
||||
{
|
||||
case GL_CONVEX_HULL_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_CHROMIUM:
|
||||
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
|
||||
break;
|
||||
default:
|
||||
context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace gl
|
||||
|
|
|
@ -219,6 +219,60 @@ bool ValidateStencilThenCoverStrokePath(Context *context,
|
|||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
bool ValidateIsPath(Context *context);
|
||||
bool ValidateCoverFillPathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
bool ValidateCoverStrokePathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
bool ValidateStencilFillPathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBAse,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
bool ValidateStencilStrokePathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
bool ValidateStencilThenCoverFillPathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
bool ValidateStencilThenCoverStrokePathInstanced(Context *context,
|
||||
GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
} // namespace gl
|
||||
|
||||
|
|
|
@ -1665,4 +1665,186 @@ ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path,
|
|||
}
|
||||
}
|
||||
|
||||
ANGLE_EXPORT void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
EVENT(
|
||||
"(GLsizei numPaths = %d, GLenum pathNameType = %u, const void *paths = %p "
|
||||
"GLuint pathBase = %u, GLenum coverMode = %u, GLenum transformType = %u "
|
||||
"const GLfloat *transformValues = %p)",
|
||||
numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues);
|
||||
|
||||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
if (!context->skipValidation() &&
|
||||
!ValidateCoverFillPathInstanced(context, numPaths, pathNameType, paths, pathBase,
|
||||
coverMode, transformType, transformValues))
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->coverFillPathInstanced(numPaths, pathNameType, paths, pathBase, coverMode,
|
||||
transformType, transformValues);
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
EVENT(
|
||||
"(GLsizei numPaths = %d, GLenum pathNameType = %u, const void *paths = %p "
|
||||
"GLuint pathBase = %u, GLenum coverMode = %u, GLenum transformType = %u "
|
||||
"const GLfloat *transformValues = %p)",
|
||||
numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues);
|
||||
|
||||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
if (!context->skipValidation() &&
|
||||
!ValidateCoverStrokePathInstanced(context, numPaths, pathNameType, paths, pathBase,
|
||||
coverMode, transformType, transformValues))
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->coverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, coverMode,
|
||||
transformType, transformValues);
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_EXPORT void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
EVENT(
|
||||
"(GLsizei numPaths = %u, GLenum pathNameType = %u, const void *paths = %p "
|
||||
"GLuint pathBase = %u, GLint reference = %d GLuint mask = %u GLenum transformType = %u "
|
||||
"const GLfloat *transformValues = %p)",
|
||||
numPaths, pathNameType, paths, pathBase, reference, mask, transformType, transformValues);
|
||||
|
||||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
if (!context->skipValidation() &&
|
||||
!ValidateStencilStrokePathInstanced(context, numPaths, pathNameType, paths, pathBase,
|
||||
reference, mask, transformType, transformValues))
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->stencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, reference,
|
||||
mask, transformType, transformValues);
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_EXPORT void GL_APIENTRY StencilFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
EVENT(
|
||||
"(GLsizei numPaths = %u, GLenum pathNameType = %u const void *paths = %p "
|
||||
"GLuint pathBase = %u, GLenum fillMode = %u, GLuint mask = %u, GLenum transformType = %u "
|
||||
"const GLfloat *transformValues = %p)",
|
||||
numPaths, pathNameType, paths, pathBase, fillMode, mask, transformType, transformValues);
|
||||
|
||||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
if (!context->skipValidation() &&
|
||||
!ValidateStencilFillPathInstanced(context, numPaths, pathNameType, paths, pathBase,
|
||||
fillMode, mask, transformType, transformValues))
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->stencilFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_EXPORT void GL_APIENTRY
|
||||
StencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
EVENT(
|
||||
"(GLsizei numPaths = %u, GLenum pathNameType = %u const void *paths = %p "
|
||||
"GLuint pathBase = %u, GLenum coverMode = %u, GLuint mask = %u, GLenum transformType = %u "
|
||||
"const GLfloat *transformValues = %p)",
|
||||
numPaths, pathNameType, paths, pathBase, coverMode, mask, transformType, transformValues);
|
||||
|
||||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
if (!context->skipValidation() &&
|
||||
!ValidateStencilThenCoverFillPathInstanced(context, numPaths, pathNameType, paths,
|
||||
pathBase, fillMode, mask, coverMode,
|
||||
transformType, transformValues))
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->stencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
|
||||
fillMode, mask, coverMode, transformType,
|
||||
transformValues);
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_EXPORT void GL_APIENTRY
|
||||
StencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
EVENT(
|
||||
"(GLsizei numPaths = %u, GLenum pathNameType = %u, const void *paths = %p "
|
||||
"GLuint pathBase = %u GLenum coverMode = %u GLint reference = %d GLuint mask = %u GLenum "
|
||||
"transformType = %u "
|
||||
"const GLfloat *transformValues = %p)",
|
||||
numPaths, pathNameType, paths, pathBase, coverMode, reference, mask, transformType,
|
||||
transformValues);
|
||||
|
||||
Context *context = GetValidGlobalContext();
|
||||
if (context)
|
||||
{
|
||||
if (!context->skipValidation() &&
|
||||
!ValidateStencilThenCoverStrokePathInstanced(context, numPaths, pathNameType, paths,
|
||||
pathBase, reference, mask, coverMode,
|
||||
transformType, transformValues))
|
||||
{
|
||||
return;
|
||||
}
|
||||
context->stencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
|
||||
reference, mask, coverMode, transformType,
|
||||
transformValues);
|
||||
}
|
||||
}
|
||||
|
||||
} // gl
|
||||
|
|
|
@ -179,6 +179,57 @@ ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path,
|
|||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode);
|
||||
}
|
||||
ANGLE_EXPORT void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
ANGLE_EXPORT void GL_APIENTRY StencilFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBAse,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
ANGLE_EXPORT void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
ANGLE_EXPORT void GL_APIENTRY
|
||||
StencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
ANGLE_EXPORT void GL_APIENTRY
|
||||
StencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues);
|
||||
|
||||
} // namespace gl
|
||||
|
||||
#endif // LIBGLESV2_ENTRYPOINTGLES20EXT_H_
|
||||
|
|
|
@ -1669,4 +1669,83 @@ void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path,
|
|||
GLenum coverMode)
|
||||
{
|
||||
gl::StencilThenCoverStrokePathCHROMIUM(path, reference, mask, coverMode);
|
||||
}
|
||||
|
||||
void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
gl::CoverFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, coverMode,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
gl::CoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, coverMode,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
gl::StencilFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, fillMode, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
gl::StencilStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, reference, mask,
|
||||
transformType, transformValues);
|
||||
}
|
||||
|
||||
void GL_APIENTRY glStencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLenum fillMode,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
gl::StencilThenCoverFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, fillMode,
|
||||
mask, coverMode, transformType, transformValues);
|
||||
}
|
||||
|
||||
void GL_APIENTRY glStencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths,
|
||||
GLenum pathNameType,
|
||||
const void *paths,
|
||||
GLuint pathBase,
|
||||
GLint reference,
|
||||
GLuint mask,
|
||||
GLenum coverMode,
|
||||
GLenum transformType,
|
||||
const GLfloat *transformValues)
|
||||
{
|
||||
gl::StencilThenCoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase,
|
||||
reference, mask, coverMode, transformType,
|
||||
transformValues);
|
||||
}
|
|
@ -220,8 +220,14 @@ EXPORTS
|
|||
glStencilStrokePathCHROMIUM @332
|
||||
glCoverFillPathCHROMIUM @333
|
||||
glCoverStrokePathCHROMIUM @334
|
||||
glStencilThenCoverFillPathCHROMIUM @335
|
||||
glStencilThenCoverStrokePathCHROMIUM @336
|
||||
glStencilThenCoverFillPathCHROMIUM @335
|
||||
glStencilThenCoverStrokePathCHROMIUM @336
|
||||
glCoverFillPathInstancedCHROMIUM @337
|
||||
glCoverStrokePathInstancedCHROMIUM @338
|
||||
glStencilStrokePathInstancedCHROMIUM @339
|
||||
glStencilFillPathInstancedCHROMIUM @340
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM @341
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM @342
|
||||
|
||||
; GLES 3.0 Functions
|
||||
glReadBuffer @180
|
||||
|
|
|
@ -483,38 +483,185 @@ TEST_P(CHROMIUMPathRenderingTest, TestPathRenderingInvalidArgs)
|
|||
GL_BOUNDING_BOX_CHROMIUM + 1);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
// For instanced variants, we need this to error the same way
|
||||
// regardless of whether # of paths == 0 would cause an early return.
|
||||
|
||||
// TODO: enable this once instanced path rendering is implemented.
|
||||
// for (int path_count = 0; path_count <= 1; ++path_count)
|
||||
// {
|
||||
// glStencilFillPathInstancedCHROMIUM(path_count, GL_UNSIGNED_INT, &path, 0,
|
||||
// GL_COUNT_UP_CHROMIUM - 1, 0x7F, GL_NONE, NULL);
|
||||
// EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError());
|
||||
// glStencilThenCoverFillPathInstancedCHROMIUM(
|
||||
// path_count, GL_UNSIGNED_INT, &path, 0, GL_COUNT_UP_CHROMIUM - 1, 0x7F,
|
||||
// GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM, GL_NONE, NULL);
|
||||
// EXPECT_EQ(static_cast<GLenum>(GL_INVALID_ENUM), glGetError());
|
||||
// }
|
||||
|
||||
// Using mask+1 not being power of two causes INVALID_VALUE with up/down fill mode
|
||||
glStencilFillPathCHROMIUM(path, GL_COUNT_UP_CHROMIUM, 0x40);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilThenCoverFillPathCHROMIUM(path, GL_COUNT_DOWN_CHROMIUM, 12, GL_BOUNDING_BOX_CHROMIUM);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
// TODO: enable this once instanced path rendering is implemented.
|
||||
// for (int path_count = 0; path_count <= 1; ++path_count)
|
||||
// {
|
||||
// glStencilFillPathInstancedCHROMIUM(path_count, GL_UNSIGNED_INT, &path, 0,
|
||||
// GL_COUNT_UP_CHROMIUM, 0x30, GL_NONE, NULL);
|
||||
// EXPECT_EQ(static_cast<GLenum>(GL_INVALID_VALUE), glGetError());
|
||||
// glStencilThenCoverFillPathInstancedCHROMIUM(
|
||||
// path_count, GL_UNSIGNED_INT, &path, 0, GL_COUNT_DOWN_CHROMIUM, 0xFE,
|
||||
// GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM, GL_NONE, NULL);
|
||||
// EXPECT_EQ(static_cast<GLenum>(GL_INVALID_VALUE), glGetError());
|
||||
// }
|
||||
// check incorrect instance parameters.
|
||||
|
||||
// CoverFillPathInstanced
|
||||
{
|
||||
glCoverFillPathInstancedCHROMIUM(-1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glCoverFillPathInstancedCHROMIUM(1, GL_FLOAT, &path, 0, GL_CONVEX_HULL_CHROMIUM, GL_NONE,
|
||||
NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, NULL, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_UNSIGNED_INT, GL_NONE,
|
||||
NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_UNSIGNED_INT, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_TRANSLATE_X_CHROMIUM, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
// CoverStrokePathInstanced
|
||||
{
|
||||
glCoverStrokePathInstancedCHROMIUM(-1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glCoverStrokePathInstancedCHROMIUM(1, GL_FLOAT, &path, 0, GL_CONVEX_HULL_CHROMIUM, GL_NONE,
|
||||
NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, NULL, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_UNSIGNED_INT, GL_NONE,
|
||||
NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_UNSIGNED_INT, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_TRANSLATE_X_CHROMIUM, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
// StencilFillPathInstanced
|
||||
{
|
||||
glStencilFillPathInstancedCHROMIUM(-1, GL_UNSIGNED_INT, &path, 0, GL_COUNT_UP_CHROMIUM, 0x0,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilFillPathInstancedCHROMIUM(1, GL_FLOAT, &path, 0, GL_COUNT_UP_CHROMIUM, 0x0,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, NULL, 0, GL_COUNT_UP_CHROMIUM, 0x0,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_UNSIGNED_INT, 0x0,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_COUNT_UP_CHROMIUM, 0x2,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_COUNT_UP_CHROMIUM, 0x0,
|
||||
GL_UNSIGNED_INT, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_COUNT_UP_CHROMIUM, 0x0,
|
||||
GL_TRANSLATE_X_CHROMIUM, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
// StencilStrokePathInstanced
|
||||
{
|
||||
glStencilStrokePathInstancedCHROMIUM(-1, GL_UNSIGNED_INT, &path, 0, 0x00, 0x00, GL_NONE,
|
||||
NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilStrokePathInstancedCHROMIUM(1, GL_FLOAT, &path, 0, 0x00, 0x00, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, nullptr, 0, 0x00, 0x00, GL_NONE,
|
||||
NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, 0x00, 0x00,
|
||||
GL_UNSIGNED_INT, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, 0x00, 0x00,
|
||||
GL_TRANSLATE_X_CHROMIUM, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
// StencilThenCoverFillPathInstanced
|
||||
{
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(-1, GL_UNSIGNED_INT, &path, 0,
|
||||
GL_COUNT_UP_CHROMIUM, 0, GL_COUNT_UP_CHROMIUM,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(1, GL_FLOAT, &path, 0, GL_CONVEX_HULL_CHROMIUM,
|
||||
0, GL_COUNT_UP_CHROMIUM, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, NULL, 0,
|
||||
GL_CONVEX_HULL_CHROMIUM, 0,
|
||||
GL_COUNT_UP_CHROMIUM, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, GL_UNSIGNED_INT,
|
||||
0, GL_COUNT_UP_CHROMIUM, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0,
|
||||
GL_CONVEX_HULL_CHROMIUM, 0, GL_UNSIGNED_INT,
|
||||
GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0,
|
||||
GL_CONVEX_HULL_CHROMIUM, 0,
|
||||
GL_COUNT_UP_CHROMIUM, GL_FLOAT, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(
|
||||
1, GL_UNSIGNED_INT, &path, 0, GL_CONVEX_HULL_CHROMIUM, 0, GL_COUNT_UP_CHROMIUM,
|
||||
GL_TRANSLATE_X_CHROMIUM, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
// StencilThenCoverStrokePathInstanced
|
||||
{
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(-1, GL_UNSIGNED_INT, &path, 0, 0x0, 0x0,
|
||||
GL_CONVEX_HULL_CHROMIUM, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(1, GL_FLOAT, &path, 0, 0x0, 0x0,
|
||||
GL_CONVEX_HULL_CHROMIUM, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, NULL, 0, 0x0, 0x0,
|
||||
GL_CONVEX_HULL_CHROMIUM, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, 0x0, 0x0,
|
||||
GL_FLOAT, GL_NONE, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, 0x0, 0x0,
|
||||
GL_CONVEX_HULL_CHROMIUM, GL_FLOAT, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_ENUM);
|
||||
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(1, GL_UNSIGNED_INT, &path, 0, 0x0, 0x0,
|
||||
GL_CONVEX_HULL_CHROMIUM,
|
||||
GL_TRANSLATE_X_CHROMIUM, NULL);
|
||||
EXPECT_GL_ERROR(GL_INVALID_VALUE);
|
||||
}
|
||||
|
||||
glDeletePathsCHROMIUM(path, 1);
|
||||
}
|
||||
|
@ -728,6 +875,151 @@ TEST_P(CHROMIUMPathRenderingDrawTest, TestPathRenderingThenFunctions)
|
|||
verifyTestPatternStroke(0, 0);
|
||||
}
|
||||
|
||||
// Tests that drawing with *Instanced functions work.
|
||||
TEST_P(CHROMIUMPathRenderingDrawTest, TestPathRenderingInstanced)
|
||||
{
|
||||
if (!isApplicable())
|
||||
return;
|
||||
|
||||
static const float kBlue[] = {0.0f, 0.0f, 1.0f, 1.0f};
|
||||
static const float kGreen[] = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
|
||||
setupStateForTestPattern();
|
||||
|
||||
GLuint path = glGenPathsCHROMIUM(1);
|
||||
setupPathStateForTestPattern(path);
|
||||
|
||||
const GLuint kPaths[] = {1, 1, 1, 1, 1};
|
||||
const GLsizei kPathCount = 5;
|
||||
const GLfloat kShapeSize = 80.0f;
|
||||
static const GLfloat kTransforms[kPathCount * 12] = {
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, kShapeSize, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, kShapeSize * 2, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, kShapeSize, 0.0f,
|
||||
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, kShapeSize, kShapeSize, 0.0f};
|
||||
|
||||
// The test pattern is the same as in the simple draw case above,
|
||||
// except that the path is drawn kPathCount times with different offsets.
|
||||
glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0xFF);
|
||||
glStencilStrokePathInstancedCHROMIUM(kPathCount, GL_UNSIGNED_INT, kPaths, path - 1, 0x80, 0x80,
|
||||
GL_AFFINE_3D_CHROMIUM, kTransforms);
|
||||
|
||||
glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0x7F);
|
||||
glUniform4fv(mColorLoc, 1, kBlue);
|
||||
glStencilFillPathInstancedCHROMIUM(kPathCount, GL_UNSIGNED_INT, kPaths, path - 1,
|
||||
GL_COUNT_UP_CHROMIUM, 0x7F, GL_AFFINE_3D_CHROMIUM,
|
||||
kTransforms);
|
||||
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
glStencilFunc(GL_LESS, 0, 0x7F);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
|
||||
glCoverFillPathInstancedCHROMIUM(kPathCount, GL_UNSIGNED_INT, kPaths, path - 1,
|
||||
GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM,
|
||||
GL_AFFINE_3D_CHROMIUM, kTransforms);
|
||||
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
glStencilFunc(GL_EQUAL, 0x80, 0x80);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
|
||||
glUniform4fv(mColorLoc, 1, kGreen);
|
||||
glCoverStrokePathInstancedCHROMIUM(kPathCount, GL_UNSIGNED_INT, kPaths, path - 1,
|
||||
GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM,
|
||||
GL_AFFINE_3D_CHROMIUM, kTransforms);
|
||||
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
glDeletePathsCHROMIUM(path, 1);
|
||||
|
||||
// Verify the image.
|
||||
verifyTestPatternFill(0.0f, 0.0f);
|
||||
verifyTestPatternBg(0.0f, 0.0f);
|
||||
verifyTestPatternStroke(0.0f, 0.0f);
|
||||
|
||||
verifyTestPatternFill(kShapeSize, 0.0f);
|
||||
verifyTestPatternBg(kShapeSize, 0.0f);
|
||||
verifyTestPatternStroke(kShapeSize, 0.0f);
|
||||
|
||||
verifyTestPatternFill(kShapeSize * 2, 0.0f);
|
||||
verifyTestPatternBg(kShapeSize * 2, 0.0f);
|
||||
verifyTestPatternStroke(kShapeSize * 2, 0.0f);
|
||||
|
||||
verifyTestPatternFill(0.0f, kShapeSize);
|
||||
verifyTestPatternBg(0.0f, kShapeSize);
|
||||
verifyTestPatternStroke(0.0f, kShapeSize);
|
||||
|
||||
verifyTestPatternFill(kShapeSize, kShapeSize);
|
||||
verifyTestPatternBg(kShapeSize, kShapeSize);
|
||||
verifyTestPatternStroke(kShapeSize, kShapeSize);
|
||||
}
|
||||
|
||||
// Test that instanced fill/stroke then cover functions work.
|
||||
TEST_P(CHROMIUMPathRenderingDrawTest, TestPathRenderingThenFunctionsInstanced)
|
||||
{
|
||||
if (!isApplicable())
|
||||
return;
|
||||
|
||||
static const float kBlue[] = {0.0f, 0.0f, 1.0f, 1.0f};
|
||||
static const float kGreen[] = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
|
||||
setupStateForTestPattern();
|
||||
|
||||
GLuint path = glGenPathsCHROMIUM(1);
|
||||
setupPathStateForTestPattern(path);
|
||||
|
||||
const GLuint kPaths[] = {1, 1, 1, 1, 1};
|
||||
const GLsizei kPathCount = 5;
|
||||
const GLfloat kShapeSize = 80.0f;
|
||||
static const GLfloat kTransforms[] = {
|
||||
0.0f, 0.0f, kShapeSize, 0.0f, kShapeSize * 2,
|
||||
0.0f, 0.0f, kShapeSize, kShapeSize, kShapeSize,
|
||||
};
|
||||
|
||||
glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0xFF);
|
||||
glStencilFunc(GL_EQUAL, 0x80, 0x80);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
|
||||
glUniform4fv(mColorLoc, 1, kGreen);
|
||||
glStencilThenCoverStrokePathInstancedCHROMIUM(
|
||||
kPathCount, GL_UNSIGNED_INT, kPaths, path - 1, 0x80, 0x80,
|
||||
GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM, GL_TRANSLATE_2D_CHROMIUM, kTransforms);
|
||||
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
glPathStencilFuncCHROMIUM(GL_ALWAYS, 0, 0x7F);
|
||||
glStencilFunc(GL_LESS, 0, 0x7F);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
|
||||
glUniform4fv(mColorLoc, 1, kBlue);
|
||||
glStencilThenCoverFillPathInstancedCHROMIUM(
|
||||
kPathCount, GL_UNSIGNED_INT, kPaths, path - 1, GL_COUNT_UP_CHROMIUM, 0x7F,
|
||||
GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM, GL_TRANSLATE_2D_CHROMIUM, kTransforms);
|
||||
|
||||
ASSERT_GL_NO_ERROR();
|
||||
|
||||
glDeletePathsCHROMIUM(path, 1);
|
||||
|
||||
// Verify the image.
|
||||
verifyTestPatternFill(0.0f, 0.0f);
|
||||
verifyTestPatternBg(0.0f, 0.0f);
|
||||
verifyTestPatternStroke(0.0f, 0.0f);
|
||||
|
||||
verifyTestPatternFill(kShapeSize, 0.0f);
|
||||
verifyTestPatternBg(kShapeSize, 0.0f);
|
||||
verifyTestPatternStroke(kShapeSize, 0.0f);
|
||||
|
||||
verifyTestPatternFill(kShapeSize * 2, 0.0f);
|
||||
verifyTestPatternBg(kShapeSize * 2, 0.0f);
|
||||
verifyTestPatternStroke(kShapeSize * 2, 0.0f);
|
||||
|
||||
verifyTestPatternFill(0.0f, kShapeSize);
|
||||
verifyTestPatternBg(0.0f, kShapeSize);
|
||||
verifyTestPatternStroke(0.0f, kShapeSize);
|
||||
|
||||
verifyTestPatternFill(kShapeSize, kShapeSize);
|
||||
verifyTestPatternBg(kShapeSize, kShapeSize);
|
||||
verifyTestPatternStroke(kShapeSize, kShapeSize);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ANGLE_INSTANTIATE_TEST(CHROMIUMPathRenderingTest,
|
||||
|
|
Загрузка…
Ссылка в новой задаче