summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorhendrikw <hendrikw@chromium.org>2015-09-03 16:02:18 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-03 23:02:59 +0000
commit68d2c333812a14fbb81136f401bfbfe7cf915d7d (patch)
tree0123df2c9dec1d2d0885d0a29280d0db0c880a67 /gpu
parent75c602b3547645feba9d9494a3dadefd791176a4 (diff)
downloadchromium_src-68d2c333812a14fbb81136f401bfbfe7cf915d7d.zip
chromium_src-68d2c333812a14fbb81136f401bfbfe7cf915d7d.tar.gz
chromium_src-68d2c333812a14fbb81136f401bfbfe7cf915d7d.tar.bz2
Add command_buffer_gles2
This is a very simple library that exposes some egl-like functions that can be used by skia to use the command buffer as a backend for their tests Committed: https://crrev.com/604b615373e4e9f873db37cef9c6416176fc35f3 Cr-Commit-Position: refs/heads/master@{#346251} Committed: https://crrev.com/efa3a446183fbbff2034a03989f12543d0713e39 Cr-Commit-Position: refs/heads/master@{#346840} Committed: https://crrev.com/d65c55dac3f47e9a237579eb6f5fe31e19ca4704 Cr-Commit-Position: refs/heads/master@{#347013} Committed: https://crrev.com/a89ffff5113b3feb0c905f7ddc50da84a4ed577b Cr-Commit-Position: refs/heads/master@{#347103} Review URL: https://codereview.chromium.org/1220883008 Cr-Commit-Position: refs/heads/master@{#347277}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/BUILD.gn39
-rw-r--r--gpu/gles2_conform_support/egl/display.cc4
-rw-r--r--gpu/gles2_conform_support/egl/display.h12
-rw-r--r--gpu/gles2_conform_support/egl/egl.cc178
-rw-r--r--gpu/gpu.gyp39
5 files changed, 188 insertions, 84 deletions
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn
index 7322c09..dbd236c 100644
--- a/gpu/BUILD.gn
+++ b/gpu/BUILD.gn
@@ -49,6 +49,45 @@ component("gpu") {
]
}
+# GYP version: //gpu/gpu.gyp:command_buffer_gles2
+shared_library("command_buffer_gles2") {
+ sources = [
+ # TODO(hendrikw): Move egl out of gles2_conform_support.
+ "gles2_conform_support/egl/config.cc",
+ "gles2_conform_support/egl/config.h",
+ "gles2_conform_support/egl/display.cc",
+ "gles2_conform_support/egl/display.h",
+ "gles2_conform_support/egl/egl.cc",
+ "gles2_conform_support/egl/surface.cc",
+ "gles2_conform_support/egl/surface.h",
+ ]
+
+ deps = [
+ "//base",
+ "//gpu/command_buffer/client:gles2_c_lib",
+ "//gpu/command_buffer/client:gles2_implementation",
+ "//gpu/command_buffer/service",
+ "//ui/gl:gl",
+ ]
+
+ if (!is_component_build) {
+ deps += [
+ "//gpu/command_buffer/client:client_sources",
+ "//gpu/command_buffer/client:gles2_cmd_helper_sources",
+ ]
+ }
+
+ defines = [
+ "COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY",
+ "EGLAPIENTRY=",
+ ]
+ if (current_os == "win") {
+ defines += [ "EGLAPI=__declspec(dllexport)" ]
+ } else {
+ defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ]
+ }
+}
+
source_set("test_support") {
testonly = true
sources = [
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
index 18f4742..d943cca 100644
--- a/gpu/gles2_conform_support/egl/display.cc
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -5,6 +5,7 @@
#include "gpu/gles2_conform_support/egl/display.h"
#include <vector>
+#include "base/at_exit.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
@@ -29,6 +30,9 @@ namespace egl {
Display::Display(EGLNativeDisplayType display_id)
: display_id_(display_id),
is_initialized_(false),
+#if defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY)
+ exit_manager_(new base::AtExitManager),
+#endif
create_offscreen_(false),
create_offscreen_width_(0),
create_offscreen_height_(0) {
diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h
index adf3949..ee3a2a8 100644
--- a/gpu/gles2_conform_support/egl/display.h
+++ b/gpu/gles2_conform_support/egl/display.h
@@ -30,6 +30,10 @@ class GLES2Implementation;
} // namespace gles2
} // namespace gpu
+namespace base {
+class AtExitManager;
+} // namespace base
+
namespace egl {
class Config;
@@ -99,6 +103,14 @@ class Display : private gpu::GpuControl {
EGLNativeDisplayType display_id_;
bool is_initialized_;
+
+// elg::Display is used for comformance tests and command_buffer_gles. We only
+// need the exit manager for the command_buffer_gles library.
+// TODO(hendrikw): Find a cleaner solution for this.
+#if defined(COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY)
+ scoped_ptr<base::AtExitManager> exit_manager_;
+#endif // COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY
+
bool create_offscreen_;
int create_offscreen_width_;
int create_offscreen_height_;
diff --git a/gpu/gles2_conform_support/egl/egl.cc b/gpu/gles2_conform_support/egl/egl.cc
index 343937f..e64285a 100644
--- a/gpu/gles2_conform_support/egl/egl.cc
+++ b/gpu/gles2_conform_support/egl/egl.cc
@@ -85,16 +85,18 @@ EGLint ValidateDisplayContext(EGLDisplay dpy, EGLContext context) {
} // namespace
extern "C" {
-EGLint eglGetError() {
+EGLAPI EGLint EGLAPIENTRY eglGetError() {
// TODO(alokp): Fix me.
return EGL_SUCCESS;
}
-EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id) {
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
return new egl::Display(display_id);
}
-EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) {
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy,
+ EGLint* major,
+ EGLint* minor) {
if (dpy == EGL_NO_DISPLAY)
return EglError(EGL_BAD_DISPLAY, EGL_FALSE);
@@ -102,19 +104,21 @@ EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) {
if (!display->Initialize())
return EglError(EGL_NOT_INITIALIZED, EGL_FALSE);
- int argc = 1;
- const char* const argv[] = {
- "dummy"
- };
- base::CommandLine::Init(argc, argv);
- gfx::GLSurface::InitializeOneOff();
+ // eglInitialize can be called multiple times, prevent InitializeOneOff from
+ // being called multiple times.
+ if (gfx::GetGLImplementation() == gfx::kGLImplementationNone) {
+ int argc = 1;
+ const char* const argv[] = {"dummy"};
+ base::CommandLine::Init(argc, argv);
+ gfx::GLSurface::InitializeOneOff();
+ }
*major = 1;
*minor = 4;
return EglSuccess(EGL_TRUE);
}
-EGLBoolean eglTerminate(EGLDisplay dpy) {
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) {
EGLint error_code = ValidateDisplay(dpy);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -125,7 +129,7 @@ EGLBoolean eglTerminate(EGLDisplay dpy) {
return EglSuccess(EGL_TRUE);
}
-const char* eglQueryString(EGLDisplay dpy, EGLint name) {
+EGLAPI const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) {
EGLint error_code = ValidateDisplay(dpy);
if (error_code != EGL_SUCCESS)
return EglError(error_code, static_cast<const char*>(NULL));
@@ -144,11 +148,11 @@ const char* eglQueryString(EGLDisplay dpy, EGLint name) {
}
}
-EGLBoolean eglChooseConfig(EGLDisplay dpy,
- const EGLint* attrib_list,
- EGLConfig* configs,
- EGLint config_size,
- EGLint* num_config) {
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy,
+ const EGLint* attrib_list,
+ EGLConfig* configs,
+ EGLint config_size,
+ EGLint* num_config) {
EGLint error_code = ValidateDisplay(dpy);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -163,10 +167,10 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy,
return EglSuccess(EGL_TRUE);
}
-EGLBoolean eglGetConfigs(EGLDisplay dpy,
- EGLConfig* configs,
- EGLint config_size,
- EGLint* num_config) {
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy,
+ EGLConfig* configs,
+ EGLint config_size,
+ EGLint* num_config) {
EGLint error_code = ValidateDisplay(dpy);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -181,10 +185,10 @@ EGLBoolean eglGetConfigs(EGLDisplay dpy,
return EglSuccess(EGL_TRUE);
}
-EGLBoolean eglGetConfigAttrib(EGLDisplay dpy,
- EGLConfig config,
- EGLint attribute,
- EGLint* value) {
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy,
+ EGLConfig config,
+ EGLint attribute,
+ EGLint* value) {
EGLint error_code = ValidateDisplayConfig(dpy, config);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -196,10 +200,11 @@ EGLBoolean eglGetConfigAttrib(EGLDisplay dpy,
return EglSuccess(EGL_TRUE);
}
-EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
- EGLConfig config,
- EGLNativeWindowType win,
- const EGLint* attrib_list) {
+EGLAPI EGLSurface EGLAPIENTRY
+eglCreateWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint* attrib_list) {
EGLint error_code = ValidateDisplayConfig(dpy, config);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_NO_SURFACE);
@@ -215,9 +220,10 @@ EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
return EglSuccess(surface);
}
-EGLSurface eglCreatePbufferSurface(EGLDisplay dpy,
- EGLConfig config,
- const EGLint* attrib_list) {
+EGLAPI EGLSurface EGLAPIENTRY
+eglCreatePbufferSurface(EGLDisplay dpy,
+ EGLConfig config,
+ const EGLint* attrib_list) {
EGLint error_code = ValidateDisplayConfig(dpy, config);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_NO_SURFACE);
@@ -246,15 +252,16 @@ EGLSurface eglCreatePbufferSurface(EGLDisplay dpy,
return EglSuccess(surface);
}
-EGLSurface eglCreatePixmapSurface(EGLDisplay dpy,
- EGLConfig config,
- EGLNativePixmapType pixmap,
- const EGLint* attrib_list) {
+EGLAPI EGLSurface EGLAPIENTRY
+eglCreatePixmapSurface(EGLDisplay dpy,
+ EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint* attrib_list) {
return EGL_NO_SURFACE;
}
-EGLBoolean eglDestroySurface(EGLDisplay dpy,
- EGLSurface surface) {
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy,
+ EGLSurface surface) {
EGLint error_code = ValidateDisplaySurface(dpy, surface);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -264,64 +271,65 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy,
return EglSuccess(EGL_TRUE);
}
-EGLBoolean eglQuerySurface(EGLDisplay dpy,
- EGLSurface surface,
- EGLint attribute,
- EGLint* value) {
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint* value) {
return EGL_FALSE;
}
-EGLBoolean eglBindAPI(EGLenum api) {
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) {
return EGL_FALSE;
}
-EGLenum eglQueryAPI() {
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI() {
return EGL_OPENGL_ES_API;
}
-EGLBoolean eglWaitClient(void) {
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void) {
return EGL_FALSE;
}
-EGLBoolean eglReleaseThread(void) {
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) {
return EGL_FALSE;
}
-EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy,
- EGLenum buftype,
- EGLClientBuffer buffer,
- EGLConfig config,
- const EGLint* attrib_list) {
+EGLAPI EGLSurface EGLAPIENTRY
+eglCreatePbufferFromClientBuffer(EGLDisplay dpy,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ EGLConfig config,
+ const EGLint* attrib_list) {
return EGL_NO_SURFACE;
}
-EGLBoolean eglSurfaceAttrib(EGLDisplay dpy,
- EGLSurface surface,
- EGLint attribute,
- EGLint value) {
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint attribute,
+ EGLint value) {
return EGL_FALSE;
}
-EGLBoolean eglBindTexImage(EGLDisplay dpy,
- EGLSurface surface,
- EGLint buffer) {
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint buffer) {
return EGL_FALSE;
}
-EGLBoolean eglReleaseTexImage(EGLDisplay dpy,
- EGLSurface surface,
- EGLint buffer) {
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLint buffer) {
return EGL_FALSE;
}
-EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) {
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) {
return EGL_FALSE;
}
-EGLContext eglCreateContext(EGLDisplay dpy,
- EGLConfig config,
- EGLContext share_context,
- const EGLint* attrib_list) {
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy,
+ EGLConfig config,
+ EGLContext share_context,
+ const EGLint* attrib_list) {
EGLint error_code = ValidateDisplayConfig(dpy, config);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_NO_CONTEXT);
@@ -341,7 +349,8 @@ EGLContext eglCreateContext(EGLDisplay dpy,
return EglSuccess(context);
}
-EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy,
+ EGLContext ctx) {
EGLint error_code = ValidateDisplayContext(dpy, ctx);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -351,10 +360,10 @@ EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) {
return EGL_TRUE;
}
-EGLBoolean eglMakeCurrent(EGLDisplay dpy,
- EGLSurface draw,
- EGLSurface read,
- EGLContext ctx) {
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext ctx) {
if (ctx != EGL_NO_CONTEXT) {
EGLint error_code = ValidateDisplaySurface(dpy, draw);
if (error_code != EGL_SUCCESS)
@@ -378,34 +387,35 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy,
return EGL_TRUE;
}
-EGLContext eglGetCurrentContext() {
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext() {
return EGL_NO_CONTEXT;
}
-EGLSurface eglGetCurrentSurface(EGLint readdraw) {
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) {
return EGL_NO_SURFACE;
}
-EGLDisplay eglGetCurrentDisplay() {
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay() {
return EGL_NO_DISPLAY;
}
-EGLBoolean eglQueryContext(EGLDisplay dpy,
- EGLContext ctx,
- EGLint attribute,
- EGLint* value) {
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy,
+ EGLContext ctx,
+ EGLint attribute,
+ EGLint* value) {
return EGL_FALSE;
}
-EGLBoolean eglWaitGL() {
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL() {
return EGL_FALSE;
}
-EGLBoolean eglWaitNative(EGLint engine) {
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) {
return EGL_FALSE;
}
-EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) {
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy,
+ EGLSurface surface) {
EGLint error_code = ValidateDisplaySurface(dpy, surface);
if (error_code != EGL_SUCCESS)
return EglError(error_code, EGL_FALSE);
@@ -415,14 +425,14 @@ EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) {
return EglSuccess(EGL_TRUE);
}
-EGLBoolean eglCopyBuffers(EGLDisplay dpy,
- EGLSurface surface,
- EGLNativePixmapType target) {
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy,
+ EGLSurface surface,
+ EGLNativePixmapType target) {
return EGL_FALSE;
}
/* Now, define eglGetProcAddress using the generic function ptr. type */
-__eglMustCastToProperFunctionPointerType
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
eglGetProcAddress(const char* procname) {
return reinterpret_cast<__eglMustCastToProperFunctionPointerType>(
gles2::GetGLFunctionPointer(procname));
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 650db2a..48a7794 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -416,6 +416,45 @@
'command_buffer/service/gles2_cmd_decoder_mock.cc',
],
},
+ {
+ # GN version: //gpu:command_buffer_gles2
+ 'target_name': 'command_buffer_gles2',
+ 'type': 'shared_library',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../gpu/gpu.gyp:command_buffer_service',
+ '../ui/gfx/gfx.gyp:gfx_geometry',
+ '../ui/gl/gl.gyp:gl',
+ 'gles2_c_lib',
+ 'gles2_implementation',
+ ],
+ 'sources': [
+ # Note: sources list duplicated in GN build.
+ # TODO(hendrikw): Move egl out of gles2_conform_support.
+ 'gles2_conform_support/egl/config.cc',
+ 'gles2_conform_support/egl/config.h',
+ 'gles2_conform_support/egl/display.cc',
+ 'gles2_conform_support/egl/display.h',
+ 'gles2_conform_support/egl/egl.cc',
+ 'gles2_conform_support/egl/surface.cc',
+ 'gles2_conform_support/egl/surface.h',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': [
+ 'COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY',
+ 'EGLAPIENTRY=',
+ 'EGLAPI=__declspec(dllexport)',
+ ],
+ }, { # OS!="win"
+ 'defines': [
+ 'COMMAND_BUFFER_GLES_LIB_SUPPORT_ONLY',
+ 'EGLAPIENTRY=',
+ 'EGLAPI=__attribute__((visibility(\"default\")))'
+ ],
+ }, ],
+ ],
+ }
],
'conditions': [
['component=="static_library"', {