Add a cmdbuffer_es3 config
Adds the ability to create an es3 command buffer context, but does not yet begin testing it because libcommand_buffer_gles2.dylib needs to be updated first to respect the EGL_CONTEXT_CLIENT_VERSION attrib. Adds a version check on the context as well to verify we actually get an es3 context when we ask for one. Bug: chromium:1220246 Change-Id: I996f482d8ad831b81f873e1bfd2f0526e5f1e73e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419616 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
e5766b8080
commit
e0f4de6f23
@ -271,9 +271,9 @@ func (b *taskBuilder) dmFlags(internalHardwareLabel string) {
|
||||
skip("gltestthreading gm _ draw_image_set")
|
||||
}
|
||||
|
||||
// CommandBuffer bot *only* runs the command_buffer config.
|
||||
// CommandBuffer bot *only* runs the cmdbuffer_es2 config.
|
||||
if b.extraConfig("CommandBuffer") {
|
||||
configs = []string{"commandbuffer"}
|
||||
configs = []string{"cmdbuffer_es2"}
|
||||
}
|
||||
|
||||
// Dawn bot *only* runs the dawn config
|
||||
|
@ -99,7 +99,7 @@ func (b *taskBuilder) nanobenchFlags(doUpload bool) {
|
||||
}
|
||||
|
||||
if b.extraConfig("CommandBuffer") {
|
||||
configs = []string{"commandbuffer"}
|
||||
configs = []string{"cmdbuffer_es2"}
|
||||
}
|
||||
|
||||
if b.extraConfig("Vulkan") {
|
||||
|
File diff suppressed because one or more lines are too long
@ -94,7 +94,8 @@ static const struct {
|
||||
{ "angle_gl_es2_msaa8", "gpu", "api=angle_gl_es2,samples=8" },
|
||||
{ "angle_gl_es3_msaa4", "gpu", "api=angle_gl_es3,samples=4" },
|
||||
{ "angle_gl_es3_msaa8", "gpu", "api=angle_gl_es3,samples=8" },
|
||||
{ "commandbuffer", "gpu", "api=commandbuffer" },
|
||||
{ "cmdbuffer_es2", "gpu", "api=cmdbuffer_es2" },
|
||||
{ "cmdbuffer_es3", "gpu", "api=cmdbuffer_es3" },
|
||||
{ "mock", "gpu", "api=mock" },
|
||||
#ifdef SK_DAWN
|
||||
{ "dawn", "gpu", "api=dawn" },
|
||||
@ -286,8 +287,12 @@ static bool parse_option_gpu_api(const SkString& value,
|
||||
*outContextType = GrContextFactory::kANGLE_GL_ES3_ContextType;
|
||||
return true;
|
||||
}
|
||||
if (value.equals("commandbuffer")) {
|
||||
*outContextType = GrContextFactory::kCommandBuffer_ContextType;
|
||||
if (value.equals("cmdbuffer_es2")) {
|
||||
*outContextType = GrContextFactory::kCommandBuffer_ES2_ContextType;
|
||||
return true;
|
||||
}
|
||||
if (value.equals("cmdbuffer_es3")) {
|
||||
*outContextType = GrContextFactory::kCommandBuffer_ES3_ContextType;
|
||||
return true;
|
||||
}
|
||||
if (value.equals("mock")) {
|
||||
|
@ -498,7 +498,8 @@ int main(int argc, char** argv) {
|
||||
{ "angle_d3d11_es3", GrContextFactory::kANGLE_D3D11_ES3_ContextType },
|
||||
{ "angle_gl_es2" , GrContextFactory::kANGLE_GL_ES2_ContextType },
|
||||
{ "angle_gl_es3" , GrContextFactory::kANGLE_GL_ES3_ContextType },
|
||||
{ "commandbuffer" , GrContextFactory::kCommandBuffer_ContextType },
|
||||
{ "cmdbuffer_es2" , GrContextFactory::kCommandBuffer_ES2_ContextType },
|
||||
{ "cmdbuffer_es3" , GrContextFactory::kCommandBuffer_ES3_ContextType },
|
||||
{ "vk" , GrContextFactory::kVulkan_ContextType },
|
||||
{ "mtl" , GrContextFactory::kMetal_ContextType },
|
||||
{ "mock" , GrContextFactory::kMock_ContextType },
|
||||
|
@ -213,8 +213,11 @@ ContextInfo GrContextFactory::getContextInfoInternal(ContextType type, ContextOv
|
||||
break;
|
||||
#endif
|
||||
#ifndef SK_NO_COMMAND_BUFFER
|
||||
case kCommandBuffer_ContextType:
|
||||
glCtx = CommandBufferGLTestContext::Create(glShareContext);
|
||||
case kCommandBuffer_ES2_ContextType:
|
||||
glCtx = CommandBufferGLTestContext::Create(2, glShareContext);
|
||||
break;
|
||||
case kCommandBuffer_ES3_ContextType:
|
||||
glCtx = CommandBufferGLTestContext::Create(3, glShareContext);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -31,19 +31,20 @@ public:
|
||||
// The availability of context types is subject to platform and build configuration
|
||||
// restrictions.
|
||||
enum ContextType {
|
||||
kGL_ContextType, //! OpenGL context.
|
||||
kGLES_ContextType, //! OpenGL ES context.
|
||||
kANGLE_D3D9_ES2_ContextType, //! ANGLE on Direct3D9 OpenGL ES 2 context.
|
||||
kANGLE_D3D11_ES2_ContextType,//! ANGLE on Direct3D11 OpenGL ES 2 context.
|
||||
kANGLE_D3D11_ES3_ContextType,//! ANGLE on Direct3D11 OpenGL ES 3 context.
|
||||
kANGLE_GL_ES2_ContextType, //! ANGLE on OpenGL OpenGL ES 2 context.
|
||||
kANGLE_GL_ES3_ContextType, //! ANGLE on OpenGL OpenGL ES 3 context.
|
||||
kCommandBuffer_ContextType, //! Chromium command buffer OpenGL ES context.
|
||||
kVulkan_ContextType, //! Vulkan
|
||||
kMetal_ContextType, //! Metal
|
||||
kDirect3D_ContextType, //! Direct3D 12
|
||||
kDawn_ContextType, //! Dawn
|
||||
kMock_ContextType, //! Mock context that does not draw.
|
||||
kGL_ContextType, //! OpenGL context.
|
||||
kGLES_ContextType, //! OpenGL ES context.
|
||||
kANGLE_D3D9_ES2_ContextType, //! ANGLE on Direct3D9 OpenGL ES 2 context.
|
||||
kANGLE_D3D11_ES2_ContextType, //! ANGLE on Direct3D11 OpenGL ES 2 context.
|
||||
kANGLE_D3D11_ES3_ContextType, //! ANGLE on Direct3D11 OpenGL ES 3 context.
|
||||
kANGLE_GL_ES2_ContextType, //! ANGLE on OpenGL OpenGL ES 2 context.
|
||||
kANGLE_GL_ES3_ContextType, //! ANGLE on OpenGL OpenGL ES 3 context.
|
||||
kCommandBuffer_ES2_ContextType, //! Chromium command buffer OpenGL ES 2 context.
|
||||
kCommandBuffer_ES3_ContextType, //! Chromium command buffer OpenGL ES 3 context.
|
||||
kVulkan_ContextType, //! Vulkan
|
||||
kMetal_ContextType, //! Metal
|
||||
kDirect3D_ContextType, //! Direct3D 12
|
||||
kDawn_ContextType, //! Dawn
|
||||
kMock_ContextType, //! Mock context that does not draw.
|
||||
kLastContextType = kMock_ContextType
|
||||
};
|
||||
|
||||
@ -102,8 +103,10 @@ public:
|
||||
return "ANGLE GL ES2";
|
||||
case kANGLE_GL_ES3_ContextType:
|
||||
return "ANGLE GL ES3";
|
||||
case kCommandBuffer_ContextType:
|
||||
return "Command Buffer";
|
||||
case kCommandBuffer_ES2_ContextType:
|
||||
return "Command Buffer ES2";
|
||||
case kCommandBuffer_ES3_ContextType:
|
||||
return "Command Buffer ES3";
|
||||
case kVulkan_ContextType:
|
||||
return "Vulkan";
|
||||
case kMetal_ContextType:
|
||||
|
@ -29,6 +29,7 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TRUE 1
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
||||
#define EGL_OPENGL_ES3_BIT 0x0040
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
@ -214,12 +215,27 @@ std::function<void()> context_restorer() {
|
||||
|
||||
namespace sk_gpu_test {
|
||||
|
||||
CommandBufferGLTestContext::CommandBufferGLTestContext(CommandBufferGLTestContext* shareContext)
|
||||
CommandBufferGLTestContext::CommandBufferGLTestContext(int version,
|
||||
CommandBufferGLTestContext* shareContext)
|
||||
: fContext(EGL_NO_CONTEXT), fDisplay(EGL_NO_DISPLAY), fSurface(EGL_NO_SURFACE) {
|
||||
|
||||
static const EGLint configAttribs[] = {
|
||||
EGLint renderableType;
|
||||
switch (version) {
|
||||
case 2:
|
||||
renderableType = EGL_OPENGL_ES2_BIT;
|
||||
break;
|
||||
case 3:
|
||||
renderableType = EGL_OPENGL_ES3_BIT;
|
||||
break;
|
||||
default:
|
||||
SkDebugf("Command Buffer: Invalid version requested (%i). Must be either 2 or 3.\n",
|
||||
version);
|
||||
return;
|
||||
}
|
||||
|
||||
EGLint configAttribs[] = {
|
||||
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_RENDERABLE_TYPE, renderableType,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
@ -266,8 +282,8 @@ CommandBufferGLTestContext::CommandBufferGLTestContext(CommandBufferGLTestContex
|
||||
return;
|
||||
}
|
||||
|
||||
static const EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, version,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLContext eglShareContext = shareContext
|
||||
@ -299,6 +315,19 @@ CommandBufferGLTestContext::CommandBufferGLTestContext(CommandBufferGLTestContex
|
||||
return;
|
||||
}
|
||||
|
||||
// libcommand_buffer_gles2 has not always respected the EGL_CONTEXT_CLIENT_VERSION attrib.
|
||||
// Double check that we are not using an old library and we actually got the context version we
|
||||
// asked for.
|
||||
const char* versionString = (const char*)gl->fFunctions.fGetString(GR_GL_VERSION);
|
||||
const char* expectedVersion = (version == 2) ? "OpenGL ES 2.0" : "OpenGL ES 3.0";
|
||||
if (strstr(versionString, expectedVersion) != versionString) {
|
||||
SkDebugf("Command Buffer: Unexpected version.\n"
|
||||
" Got: \"%s\".\n"
|
||||
" Expected: \"%s ...\".\n",
|
||||
versionString, expectedVersion);
|
||||
return;
|
||||
}
|
||||
|
||||
this->init(std::move(gl));
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,10 @@ class CommandBufferGLTestContext : public GLTestContext {
|
||||
public:
|
||||
~CommandBufferGLTestContext() override;
|
||||
|
||||
static CommandBufferGLTestContext *Create(GLTestContext* shareContext) {
|
||||
static CommandBufferGLTestContext *Create(int version, GLTestContext* shareContext) {
|
||||
CommandBufferGLTestContext* cbShareContext =
|
||||
reinterpret_cast<CommandBufferGLTestContext*>(shareContext);
|
||||
CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(cbShareContext);
|
||||
CommandBufferGLTestContext *ctx = new CommandBufferGLTestContext(version, cbShareContext);
|
||||
if (!ctx->isValid()) {
|
||||
delete ctx;
|
||||
return nullptr;
|
||||
@ -36,7 +36,7 @@ public:
|
||||
int getSampleCount();
|
||||
|
||||
private:
|
||||
CommandBufferGLTestContext(CommandBufferGLTestContext* shareContext);
|
||||
CommandBufferGLTestContext(int version, CommandBufferGLTestContext* shareContext);
|
||||
|
||||
void destroyGLContext();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user