Commit 919cabb7 authored by piman@chromium.org's avatar piman@chromium.org

Make PPB_GLESChromiumTextureMapping_Dev work with PPB_Graphics3D_Dev

BUG=None
TEST=Pepper Flash


Review URL: http://codereview.chromium.org/7763007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98555 0039d316-1c4b-4281-b951-d872f2087c98
parent 84df7440
...@@ -58,6 +58,23 @@ int32_t Graphics3DImpl::SwapBuffers(PP_CompletionCallback callback) { ...@@ -58,6 +58,23 @@ int32_t Graphics3DImpl::SwapBuffers(PP_CompletionCallback callback) {
return DoSwapBuffers(); return DoSwapBuffers();
} }
void* Graphics3DImpl::MapTexSubImage2DCHROMIUM(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
GLenum access) {
return gles2_impl_->MapTexSubImage2DCHROMIUM(
target, level, xoffset, yoffset, width, height, format, type, access);
}
void Graphics3DImpl::UnmapTexSubImage2DCHROMIUM(const void* mem) {
gles2_impl_->UnmapTexSubImage2DCHROMIUM(mem);
}
void Graphics3DImpl::SwapBuffersACK(int32_t pp_error) { void Graphics3DImpl::SwapBuffersACK(int32_t pp_error) {
DCHECK(HasPendingSwap()); DCHECK(HasPendingSwap());
PP_RunAndClearCompletionCallback(&swap_callback_, pp_error); PP_RunAndClearCompletionCallback(&swap_callback_, pp_error);
......
...@@ -28,6 +28,16 @@ class PPAPI_SHARED_EXPORT Graphics3DImpl : public thunk::PPB_Graphics3D_API { ...@@ -28,6 +28,16 @@ class PPAPI_SHARED_EXPORT Graphics3DImpl : public thunk::PPB_Graphics3D_API {
virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE; virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE;
virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE; virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE;
virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE;
virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
GLenum access) OVERRIDE;
virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE;
gpu::gles2::GLES2Implementation* gles2_impl() { gpu::gles2::GLES2Implementation* gles2_impl() {
return gles2_impl_.get(); return gles2_impl_.get();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "ppapi/thunk/thunk.h" #include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/enter.h" #include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_context_3d_api.h" #include "ppapi/thunk/ppb_context_3d_api.h"
#include "ppapi/thunk/ppb_graphics_3d_api.h"
#include "ppapi/thunk/resource_creation_api.h" #include "ppapi/thunk/resource_creation_api.h"
namespace ppapi { namespace ppapi {
...@@ -13,6 +14,7 @@ namespace thunk { ...@@ -13,6 +14,7 @@ namespace thunk {
namespace { namespace {
typedef EnterResource<PPB_Context3D_API> EnterContext3D; typedef EnterResource<PPB_Context3D_API> EnterContext3D;
typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D;
void* MapTexSubImage2DCHROMIUM(PP_Resource context, void* MapTexSubImage2DCHROMIUM(PP_Resource context,
GLenum target, GLenum target,
...@@ -24,17 +26,38 @@ void* MapTexSubImage2DCHROMIUM(PP_Resource context, ...@@ -24,17 +26,38 @@ void* MapTexSubImage2DCHROMIUM(PP_Resource context,
GLenum format, GLenum format,
GLenum type, GLenum type,
GLenum access) { GLenum access) {
EnterContext3D enter(context, true); {
if (enter.failed()) EnterContext3D enter(context, false);
return NULL; if (enter.succeeded()) {
return enter.object()->MapTexSubImage2DCHROMIUM(
target, level, xoffset, yoffset, width, height, format, type, access);
}
}
{
EnterGraphics3D enter(context, true);
if (enter.succeeded()) {
return enter.object()->MapTexSubImage2DCHROMIUM( return enter.object()->MapTexSubImage2DCHROMIUM(
target, level, xoffset, yoffset, width, height, format, type, access); target, level, xoffset, yoffset, width, height, format, type, access);
}
}
return NULL;
} }
void UnmapTexSubImage2DCHROMIUM(PP_Resource context, const void* mem) { void UnmapTexSubImage2DCHROMIUM(PP_Resource context, const void* mem) {
EnterContext3D enter(context, true); {
if (enter.succeeded()) EnterContext3D enter(context, false);
if (enter.succeeded()) {
enter.object()->UnmapTexSubImage2DCHROMIUM(mem);
return;
}
}
{
EnterGraphics3D enter(context, true);
if (enter.succeeded()) {
enter.object()->UnmapTexSubImage2DCHROMIUM(mem); enter.object()->UnmapTexSubImage2DCHROMIUM(mem);
return;
}
}
} }
const PPB_GLESChromiumTextureMapping_Dev const PPB_GLESChromiumTextureMapping_Dev
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ppapi/c/dev/ppb_graphics_3d_dev.h" #include "ppapi/c/dev/ppb_graphics_3d_dev.h"
#include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h" #include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/thunk/ppapi_thunk_export.h" #include "ppapi/thunk/ppapi_thunk_export.h"
namespace ppapi { namespace ppapi {
...@@ -37,8 +38,17 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API { ...@@ -37,8 +38,17 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API {
virtual PP_Graphics3DTrustedState FlushSyncFast(int32_t put_offset, virtual PP_Graphics3DTrustedState FlushSyncFast(int32_t put_offset,
int32_t last_known_get) = 0; int32_t last_known_get) = 0;
// TODO(alokp): Implement GLESChromiumTextureMapping here after // GLESChromiumTextureMapping.
// deprecating Context3D. virtual void* MapTexSubImage2DCHROMIUM(GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type,
GLenum access) = 0;
virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0;
}; };
} // namespace thunk } // namespace thunk
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment