summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h41
-rw-r--r--webkit/glue/webkit_glue.gypi2
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc53
-rw-r--r--webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h22
5 files changed, 122 insertions, 0 deletions
diff --git a/ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h b/ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h
new file mode 100644
index 0000000..119ebf1
--- /dev/null
+++ b/ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_C_DEV_PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_H_
+#define PPAPI_C_DEV_PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_H_
+
+#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/dev/ppb_opengles_dev.h"
+
+#define PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE "PPB_GLESChromiumTextureMapping(Dev);0.1"
+
+struct PPB_GLESChromiumTextureMapping_Dev {
+ // Maps the sub-image of a texture. 'level', 'xoffset', 'yoffset', 'width',
+ // 'height', 'format' and 'type' correspond to the similarly named parameters
+ // of TexSubImage2D, and define the sub-image region, as well as the format of
+ // the data. 'access' must be one of GL_READ_ONLY, GL_WRITE_ONLY or
+ // GL_READ_WRITE. If READ is included, the returned buffer will contain the
+ // pixel data for the sub-image. If WRITE is included, the pixel data for the
+ // sub-image will be updated to the contents of the buffer when
+ // UnmapTexSubImage2DCHROMIUM is called. NOTE: for a GL_WRITE_ONLY map, it
+ // means that all the values of the buffer must be written.
+ void* (*MapTexSubImage2DCHROMIUM)(
+ PP_Resource context,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLenum access);
+
+ // Unmaps the sub-image of a texture. If the sub-image was mapped with one of
+ // the WRITE accesses, the pixels are updated at this time to the contents of
+ // the buffer. 'mem' must be the pointer returned by MapTexSubImage2DCHROMIUM.
+ void (*UnmapTexSubImage2DCHROMIUM)(PP_Resource context, const void* mem);
+};
+
+#endif // PPAPI_C_DEV_PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_H_
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 9494596..7513d70 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -286,6 +286,8 @@
'../plugins/ppapi/ppb_flash_impl_linux.cc',
'../plugins/ppapi/ppb_font_impl.cc',
'../plugins/ppapi/ppb_font_impl.h',
+ '../plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc',
+ '../plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h',
'../plugins/ppapi/ppb_graphics_2d_impl.cc',
'../plugins/ppapi/ppb_graphics_2d_impl.h',
'../plugins/ppapi/ppb_graphics_3d_impl.cc',
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 620fff6..2f9781d 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -23,6 +23,7 @@
#include "ppapi/c/dev/ppb_find_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
+#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
@@ -85,6 +86,7 @@
#ifdef ENABLE_GPU
#include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
+#include "webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_opengles_impl.h"
#include "webkit/plugins/ppapi/ppb_surface_3d_impl.h"
@@ -289,6 +291,8 @@ const void* GetInterface(const char* name) {
return PPB_Graphics3D_Impl::GetInterface();
if (strcmp(name, PPB_CONTEXT_3D_DEV_INTERFACE) == 0)
return PPB_Context3D_Impl::GetInterface();
+ if (strcmp(name, PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == 0)
+ return PPB_GLESChromiumTextureMapping_Impl::GetInterface();
if (strcmp(name, PPB_OPENGLES2_DEV_INTERFACE) == 0)
return PPB_OpenGLES_Impl::GetInterface();
if (strcmp(name, PPB_SURFACE_3D_DEV_INTERFACE) == 0)
diff --git a/webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc b/webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc
new file mode 100644
index 0000000..c6df8f8
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h"
+
+#include "gpu/command_buffer/client/gles2_implementation.h"
+#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
+#include "webkit/plugins/ppapi/ppb_context_3d_impl.h"
+
+namespace webkit {
+namespace ppapi {
+
+namespace {
+
+void* MapTexSubImage2DCHROMIUM(
+ PP_Resource context_id,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLenum access) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ return context->gles2_impl()->MapTexSubImage2DCHROMIUM(
+ target, level, xoffset, yoffset, width, height, format, type, access);
+}
+
+void UnmapTexSubImage2DCHROMIUM(PP_Resource context_id, const void* mem) {
+ scoped_refptr<PPB_Context3D_Impl> context =
+ Resource::GetAs<PPB_Context3D_Impl>(context_id);
+ context->gles2_impl()->UnmapTexSubImage2DCHROMIUM(mem);
+}
+
+const struct PPB_GLESChromiumTextureMapping_Dev ppb_gles_chromium_extension = {
+ &MapTexSubImage2DCHROMIUM,
+ &UnmapTexSubImage2DCHROMIUM
+};
+
+} // namespace
+
+const PPB_GLESChromiumTextureMapping_Dev*
+PPB_GLESChromiumTextureMapping_Impl::GetInterface() {
+ return &ppb_gles_chromium_extension;
+}
+
+} // namespace ppapi
+} // namespace webkit
+
diff --git a/webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h b/webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h
new file mode 100644
index 0000000..ae592b4
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_GLES_CHROMIUM_TEXTURE_MAPPING_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_GLES_CHROMIUM_TEXTURE_MAPPING_IMPL_H_
+
+struct PPB_GLESChromiumTextureMapping_Dev;
+
+namespace webkit {
+namespace ppapi {
+
+class PPB_GLESChromiumTextureMapping_Impl {
+ public:
+ static const PPB_GLESChromiumTextureMapping_Dev* GetInterface();
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_GLES_CHROMIUM_TEXTURE_MAPPING_IMPL_H_
+