summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc14
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h8
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc6
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h6
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc6
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc4
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h18
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc6
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.cc110
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.html12
-rw-r--r--ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc24
-rw-r--r--ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h8
13 files changed, 156 insertions, 70 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
index 566dcf6..1ac2a5f 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.cc
@@ -213,16 +213,16 @@ const PPB_Graphics2D* PPBGraphics2DInterface() {
return ppb;
}
-const PPB_Graphics3D_Dev* PPBGraphics3DInterface() {
- static const PPB_Graphics3D_Dev* ppb = static_cast<const PPB_Graphics3D_Dev*>(
- GetBrowserInterfaceSafe(PPB_GRAPHICS_3D_DEV_INTERFACE));
+const PPB_Graphics3D* PPBGraphics3DInterface() {
+ static const PPB_Graphics3D* ppb = static_cast<const PPB_Graphics3D*>(
+ GetBrowserInterfaceSafe(PPB_GRAPHICS_3D_INTERFACE));
return ppb;
}
-const PPB_Graphics3DTrusted_Dev* PPBGraphics3DTrustedInterface() {
- static const PPB_Graphics3DTrusted_Dev* ppb =
- static_cast<const PPB_Graphics3DTrusted_Dev*>(
- GetBrowserInterfaceSafe(PPB_GRAPHICS_3D_TRUSTED_DEV_INTERFACE));
+const PPB_Graphics3DTrusted* PPBGraphics3DTrustedInterface() {
+ static const PPB_Graphics3DTrusted* ppb =
+ static_cast<const PPB_Graphics3DTrusted*>(
+ GetBrowserInterfaceSafe(PPB_GRAPHICS_3D_TRUSTED_INTERFACE));
return ppb;
}
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h
index e0d17a1..e118e6a 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_globals.h
@@ -9,8 +9,6 @@
#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_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
@@ -25,6 +23,7 @@
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/c/ppb_file_system.h"
#include "ppapi/c/ppb_graphics_2d.h"
+#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/c/ppb_instance.h"
@@ -34,6 +33,7 @@
#include "ppapi/c/ppb_url_response_info.h"
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/private/ppb_pdf.h"
+#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
#include "ppapi/c/trusted/ppb_image_data_trusted.h"
struct NaClSrpcRpc;
@@ -105,8 +105,8 @@ const PPB_Find_Dev* PPBFindInterface();
const PPB_Font_Dev* PPBFontInterface();
const PPB_Fullscreen_Dev* PPBFullscreenInterface();
const PPB_Graphics2D* PPBGraphics2DInterface();
-const PPB_Graphics3D_Dev* PPBGraphics3DInterface();
-const PPB_Graphics3DTrusted_Dev* PPBGraphics3DTrustedInterface();
+const PPB_Graphics3D* PPBGraphics3DInterface();
+const PPB_Graphics3DTrusted* PPBGraphics3DTrustedInterface();
const PPB_ImageData* PPBImageDataInterface();
const PPB_ImageDataTrusted* PPBImageDataTrustedInterface();
const PPB_InputEvent* PPBInputEventInterface();
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
index 59fd02c..f86c735 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppb_graphics_3d_rpc_server.cc
@@ -14,11 +14,11 @@
#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
#include "native_client/src/shared/ppapi_proxy/utility.h"
#include "native_client/src/trusted/desc/nacl_desc_wrapper.h"
-#include "ppapi/c/dev/pp_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/pp_errors.h"
+#include "ppapi/c/pp_graphics_3d.h"
+#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/c/private/ppb_gpu_blacklist_private.h"
+#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
#include "srpcgen/ppb_rpc.h"
using ppapi_proxy::DebugPrintf;
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h b/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h
index 0b0dd6a..a699241 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/command_buffer_nacl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Native Client Authors. All rights reserved.
+// 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.
@@ -6,9 +6,9 @@
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H
#include "gpu/command_buffer/common/command_buffer.h"
-#include "ppapi/c/dev/pp_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h"
+#include "ppapi/c/pp_graphics_3d.h"
#include "ppapi/c/pp_resource.h"
+#include "ppapi/c/trusted/ppb_graphics_3d_trusted.h"
struct PPB_Core;
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc
index 266981c..af2f009 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_opengles.cc
@@ -9,7 +9,7 @@
#include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "ppapi/c/dev/ppb_opengles_dev.h"
+#include "ppapi/c/ppb_opengles.h"
using ppapi_proxy::PluginGraphics3D;
using ppapi_proxy::PluginResource;
@@ -632,8 +632,8 @@ void Viewport(
} // namespace
-const PPB_OpenGLES2_Dev* PluginGraphics3D::GetOpenGLESInterface() {
- const static struct PPB_OpenGLES2_Dev ppb_opengles = {
+const PPB_OpenGLES2* PluginGraphics3D::GetOpenGLESInterface() {
+ const static struct PPB_OpenGLES2 ppb_opengles = {
&ActiveTexture,
&AttachShader,
&BindAttribLocation,
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
index 8032f84..8db868e 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb.cc
@@ -61,7 +61,7 @@ InterfaceMapElement interface_map[] = {
{ PPB_FONT_DEV_INTERFACE, PluginFont::GetInterface(), true },
{ PPB_FULLSCREEN_DEV_INTERFACE, PluginFullscreen::GetInterface(), true },
{ PPB_GRAPHICS_2D_INTERFACE, PluginGraphics2D::GetInterface(), true },
- { PPB_GRAPHICS_3D_DEV_INTERFACE, PluginGraphics3D::GetInterface(), true },
+ { PPB_GRAPHICS_3D_INTERFACE, PluginGraphics3D::GetInterface(), true },
{ PPB_IMAGEDATA_INTERFACE, PluginImageData::GetInterface(), true },
{ PPB_INPUT_EVENT_INTERFACE, PluginInputEvent::GetInterface(), true },
{ PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true },
@@ -73,7 +73,7 @@ InterfaceMapElement interface_map[] = {
PluginInputEvent::GetMouseInterface1_0(), true },
{ PPB_MOUSE_INPUT_EVENT_INTERFACE_1_1,
PluginInputEvent::GetMouseInterface1_1(), true },
- { PPB_OPENGLES2_DEV_INTERFACE, PluginGraphics3D::GetOpenGLESInterface(),
+ { PPB_OPENGLES2_INTERFACE, PluginGraphics3D::GetOpenGLESInterface(),
true },
{ PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true },
{ PPB_SCROLLBAR_DEV_INTERFACE, PluginScrollbar::GetInterface(), true },
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
index 3befbf5..974563a 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.cc
@@ -259,8 +259,8 @@ int32_t PluginGraphics3D::SwapBuffers(PP_Resource graphics3d_id,
// static
-const PPB_Graphics3D_Dev* PluginGraphics3D::GetInterface() {
- static const PPB_Graphics3D_Dev intf = {
+const PPB_Graphics3D* PluginGraphics3D::GetInterface() {
+ static const PPB_Graphics3D intf = {
&GetAttribMaxValue,
&Create,
&IsGraphics3D,
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h
index 63c3bca..f3358de 100644
--- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h
+++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h
@@ -1,8 +1,6 @@
-/*
- * Copyright 2011 The Native Client Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can
- * be found in the LICENSE file.
- */
+// 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PLUGIN_PPB_GRAPHICS_3D_H_
@@ -10,9 +8,9 @@
#include "base/scoped_ptr.h"
#include "native_client/src/include/nacl_macros.h"
#include "native_client/src/shared/ppapi_proxy/plugin_resource.h"
-#include "ppapi/c/dev/pp_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_opengles_dev.h"
+#include "ppapi/c/pp_graphics_3d.h"
+#include "ppapi/c/ppb_graphics_3d.h"
+#include "ppapi/c/ppb_opengles.h"
#include "ppapi/c/pp_instance.h"
namespace gpu {
@@ -31,8 +29,8 @@ class PluginGraphics3D : public PluginResource {
PluginGraphics3D();
virtual ~PluginGraphics3D();
- static const PPB_Graphics3D_Dev* GetInterface();
- static const PPB_OpenGLES2_Dev* GetOpenGLESInterface();
+ static const PPB_Graphics3D* GetInterface();
+ static const PPB_OpenGLES2* GetOpenGLESInterface();
virtual bool InitFromBrowserResource(PP_Resource graphics3d_id);
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc b/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc
index 1362a97..d1e6d6a 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_dev/ppapi_ppb_dev.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Native Client Authors. All rights reserved.
+// 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.
//
@@ -29,10 +29,8 @@
#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_layer_compositor_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_surface_3d_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
@@ -67,10 +65,8 @@ void TestGetDevInterfaces() {
CHECK(GetBrowserInterface(PPB_FULLSCREEN_DEV_INTERFACE) == NULL);
CHECK(GetBrowserInterface(
PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE) == NULL);
- CHECK(GetBrowserInterface(PPB_GRAPHICS_3D_DEV_INTERFACE) == NULL);
CHECK(GetBrowserInterface(PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == NULL);
CHECK(GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE) == NULL);
- CHECK(GetBrowserInterface(PPB_OPENGLES2_DEV_INTERFACE) == NULL);
CHECK(GetBrowserInterface(PPB_SCROLLBAR_DEV_INTERFACE) == NULL);
CHECK(GetBrowserInterface(PPB_SURFACE_3D_DEV_INTERFACE) == NULL);
CHECK(GetBrowserInterface(PPB_TESTING_DEV_INTERFACE) == NULL);
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.cc b/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.cc
index 63f1143..9621c5e 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.cc
@@ -14,19 +14,19 @@
#include "native_client/tests/ppapi_test_lib/get_browser_interface.h"
#include "native_client/tests/ppapi_test_lib/internal_utils.h"
#include "native_client/tests/ppapi_test_lib/test_interface.h"
-#include "ppapi/c/dev/pp_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
-#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/pp_graphics_3d.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/c/ppb_core.h"
+#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_instance.h"
+#include "ppapi/c/ppb_opengles.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
@@ -40,13 +40,13 @@ const int kHeight = 200;
// Tests the Graphics3D interface is available.
void TestGraphics3DInterface() {
- EXPECT(PPBGraphics3DDev() != NULL);
+ EXPECT(PPBGraphics3D() != NULL);
TEST_PASSED;
}
// Tests the OpenGLES interface is available.
void TestOpenGLES2Interface() {
- EXPECT(PPBOpenGLES2Dev() != NULL);
+ EXPECT(PPBOpenGLES2() != NULL);
TEST_PASSED;
}
@@ -56,20 +56,20 @@ void TestCreate() {
PP_GRAPHICS3DATTRIB_WIDTH, kWidth,
PP_GRAPHICS3DATTRIB_HEIGHT, kHeight,
PP_GRAPHICS3DATTRIB_NONE};
- PP_Resource graphics3d_id = PPBGraphics3DDev()->
+ PP_Resource graphics3d_id = PPBGraphics3D()->
Create(pp_instance(), kInvalidResource, attribs);
EXPECT(graphics3d_id != kInvalidResource);
PPBCore()->ReleaseResource(graphics3d_id);
- PP_Resource invalid_graphics3d_id = PPBGraphics3DDev()->
+ PP_Resource invalid_graphics3d_id = PPBGraphics3D()->
Create(0, kInvalidResource, attribs);
EXPECT(invalid_graphics3d_id == kInvalidResource);
int32_t empty_attribs[] = {
PP_GRAPHICS3DATTRIB_NONE};
- PP_Resource graphics3d_empty_attrib_id = PPBGraphics3DDev()->
+ PP_Resource graphics3d_empty_attrib_id = PPBGraphics3D()->
Create(pp_instance(), kInvalidResource, empty_attribs);
EXPECT(graphics3d_empty_attrib_id != kInvalidResource);
PPBCore()->ReleaseResource(graphics3d_empty_attrib_id);
- PP_Resource graphics3d_null_attrib_id = PPBGraphics3DDev()->
+ PP_Resource graphics3d_null_attrib_id = PPBGraphics3D()->
Create(pp_instance(), kInvalidResource, NULL);
EXPECT(graphics3d_null_attrib_id != kInvalidResource);
PPBCore()->ReleaseResource(graphics3d_null_attrib_id);
@@ -82,10 +82,10 @@ void TestIsGraphics3D() {
PP_GRAPHICS3DATTRIB_WIDTH, kWidth,
PP_GRAPHICS3DATTRIB_HEIGHT, kHeight,
PP_GRAPHICS3DATTRIB_NONE};
- PP_Resource graphics3d_id = PPBGraphics3DDev()->
+ PP_Resource graphics3d_id = PPBGraphics3D()->
Create(pp_instance(), kInvalidResource, attribs);
EXPECT(graphics3d_id != kInvalidResource);
- EXPECT(PPBGraphics3DDev()->IsGraphics3D(graphics3d_id) == PP_TRUE);
+ EXPECT(PPBGraphics3D()->IsGraphics3D(graphics3d_id) == PP_TRUE);
PPBCore()->ReleaseResource(graphics3d_id);
TEST_PASSED;
}
@@ -118,7 +118,7 @@ void TestSwapCallback(void* user_data, int32_t result) {
if (info->frame_counter < info->frame_end) {
PP_CompletionCallback cc =
PP_MakeCompletionCallback(TestSwapCallback, info);
- int32_t result = PPBGraphics3DDev()->SwapBuffers(info->graphics3d_id, cc);
+ int32_t result = PPBGraphics3D()->SwapBuffers(info->graphics3d_id, cc);
CHECK(PP_OK_COMPLETIONPENDING == result);
} else {
PPBCore()->ReleaseResource(info->graphics3d_id);
@@ -135,7 +135,7 @@ void TestSwapBuffers() {
PP_GRAPHICS3DATTRIB_WIDTH, kWidth,
PP_GRAPHICS3DATTRIB_HEIGHT, kHeight,
PP_GRAPHICS3DATTRIB_NONE};
- PP_Resource graphics3d_id = PPBGraphics3DDev()->
+ PP_Resource graphics3d_id = PPBGraphics3D()->
Create(pp_instance(), kInvalidResource, attribs);
EXPECT(graphics3d_id != kInvalidResource);
int32_t success = PPBInstance()->BindGraphics(pp_instance(), graphics3d_id);
@@ -150,6 +150,86 @@ void TestSwapBuffers() {
PPBCore()->CallOnMainThread(0, cc, PP_OK);
}
+void TestResizeAndSwapCallback(void* user_data, int32_t result) {
+ EXPECT(result == PP_OK);
+ RenderInfo* info = static_cast<RenderInfo *>(user_data);
+ int32_t new_width = kWidth - info->frame_counter * 2;
+ int32_t new_height = kHeight - info->frame_counter * 2;
+ if (new_width < 0) new_width = 0;
+ if (new_height < 0) new_height = 0;
+ int32_t resize_result = PPBGraphics3D()->ResizeBuffers(info->graphics3d_id,
+ new_width, new_height);
+ EXPECT(resize_result == PP_OK);
+ // Set graphics3d_id to the main context, so we can use normal gl style calls
+ // instead of going through the PPAPI PPBOpenGLES2 interface.
+ glSetCurrentContextPPAPI(info->graphics3d_id);
+ // Note: still use original width & height in glViewport; visual inspection
+ // should show a clipped window that shrinks to new_width, new_height size.
+ glViewport(0, 0, new_width, new_height);
+ float green = float(info->frame_counter) / float(info->frame_end);
+ glClearColor(0.0f, green, 0.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ info->frame_counter += info->frame_increment;
+ if (info->frame_counter < info->frame_end) {
+ PP_CompletionCallback cc =
+ PP_MakeCompletionCallback(TestResizeAndSwapCallback, info);
+ int32_t result = PPBGraphics3D()->SwapBuffers(info->graphics3d_id, cc);
+ CHECK(PP_OK_COMPLETIONPENDING == result);
+ } else {
+ PPBCore()->ReleaseResource(info->graphics3d_id);
+ delete info;
+ TEST_PASSED;
+ }
+ glSetCurrentContextPPAPI(0);
+}
+
+// Tests PPB_Graphics3D::ResizeBuffers().
+void TestResizeBuffers(int32_t* attribs) {
+ PP_Resource graphics3d_id = PPBGraphics3D()->
+ Create(pp_instance(), kInvalidResource, attribs);
+ EXPECT(graphics3d_id != kInvalidResource);
+ int32_t success = PPBInstance()->BindGraphics(pp_instance(), graphics3d_id);
+ EXPECT(success == PP_TRUE);
+ int32_t result;
+ // Attempt negative width & heights
+ result = PPBGraphics3D()->ResizeBuffers(graphics3d_id, -1000, 0);
+ EXPECT(result == PP_ERROR_BADARGUMENT);
+ result = PPBGraphics3D()->ResizeBuffers(graphics3d_id, 100, -1);
+ EXPECT(result == PP_ERROR_BADARGUMENT);
+ result = PPBGraphics3D()->ResizeBuffers(graphics3d_id, -1, -1);
+ EXPECT(result == PP_ERROR_BADARGUMENT);
+ RenderInfo* render_info = new RenderInfo;
+ render_info->graphics3d_id = graphics3d_id;
+ render_info->frame_counter = 0;
+ render_info->frame_end = 256;
+ render_info->frame_increment = 8;
+ PP_CompletionCallback cc = PP_MakeCompletionCallback(
+ TestResizeAndSwapCallback, render_info);
+ PPBCore()->CallOnMainThread(0, cc, PP_OK);
+}
+
+
+// Tests PPB_Graphics3D::ResizeBuffers() w/o depth buffer attached.
+void TestResizeBuffersWithoutDepthBuffer() {
+ int32_t attribs[] = {
+ PP_GRAPHICS3DATTRIB_WIDTH, kWidth,
+ PP_GRAPHICS3DATTRIB_HEIGHT, kHeight,
+ PP_GRAPHICS3DATTRIB_NONE};
+ TestResizeBuffers(attribs);
+}
+
+
+// Tests PPB_Graphics3D::ResizeBuffers() w/ depth buffer attached.
+void TestResizeBuffersWithDepthBuffer() {
+ int32_t attribs[] = {
+ PP_GRAPHICS3DATTRIB_WIDTH, kWidth,
+ PP_GRAPHICS3DATTRIB_HEIGHT, kHeight,
+ PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 32,
+ PP_GRAPHICS3DATTRIB_NONE};
+ TestResizeBuffers(attribs);
+}
+
+
// Tests glTerminatePPAPI.
void Test_glTerminatePPAPI() {
GLboolean terminate = glTerminatePPAPI();
@@ -166,6 +246,10 @@ void SetupTests() {
RegisterTest("TestIsGraphics3D", TestIsGraphics3D);
RegisterTest("Test_glInitializePPAPI", Test_glInitializePPAPI);
RegisterTest("TestSwapBuffers", TestSwapBuffers);
+ RegisterTest("TestResizeBuffersWithoutDepthBuffer",
+ TestResizeBuffersWithoutDepthBuffer);
+ RegisterTest("TestResizeBuffersWithDepthBuffer",
+ TestResizeBuffersWithDepthBuffer);
RegisterTest("Test_glTerminatePPAPI", Test_glTerminatePPAPI);
}
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.html b/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.html
index 196747c..8fe0a01 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.html
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/ppapi_ppb_graphics3d.html
@@ -38,6 +38,14 @@ function setupTests(tester, plugin) {
tester.addAsyncTest('PPB_Graphics3D::SwapBuffers', function(test) {
testAndAssertStatus(test, 'TestSwapBuffers', 'TestSwapCallback:PASSED');
});
+ tester.addAsyncTest('PPB_Graphics3D::ResizeBuffers', function(test) {
+ testAndAssertStatus(test, 'TestResizeBuffersWithoutDepthBuffer',
+ 'TestResizeAndSwapCallback:PASSED');
+ });
+ tester.addAsyncTest('PPB_Graphics3D::ResizeBuffers w/ Depth', function(test) {
+ testAndAssertStatus(test, 'TestResizeBuffersWithDepthBuffer',
+ 'TestResizeAndSwapCallback:PASSED');
+ });
tester.addAsyncTest('glTerminatePPAPI', function(test) {
testAndAssertStatus(test, 'Test_glTerminatePPAPI');
});
@@ -46,7 +54,7 @@ function setupTests(tester, plugin) {
</script>
<title>PPAPI PPB_Graphics3D Test</title>
</head>
- <body>
+ <body style="height:100%">
<h1>PPAPI PPB_Graphics3D Test</h1>
NOTE: requires --enable-pepper-testing --enable-accelerated-plugins
<br>
@@ -58,7 +66,7 @@ function setupTests(tester, plugin) {
name="nacl_module"
src="ppapi_ppb_graphics3d.nmf"
style="background-color:#FFFFFF"
- width="320" height="200" />
+ width="80%" height="40%" />
<br>
<script type="text/javascript">
//<![CDATA[
diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc
index c725ba3..08d4316 100644
--- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc
+++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.cc
@@ -8,9 +8,7 @@
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/c/dev/ppb_font_dev.h"
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
-#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
#include "ppapi/c/dev/ppb_memory_dev.h"
-#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_surface_3d_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
@@ -21,10 +19,12 @@
#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/c/ppb_file_system.h"
#include "ppapi/c/ppb_graphics_2d.h"
+#include "ppapi/c/ppb_graphics_3d.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_input_event.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/ppb_messaging.h"
+#include "ppapi/c/ppb_opengles.h"
#include "ppapi/c/ppb_url_loader.h"
#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/c/ppb_url_response_info.h"
@@ -70,6 +70,11 @@ const PPB_Graphics2D* PPBGraphics2D() {
GetBrowserInterfaceSafe(PPB_GRAPHICS_2D_INTERFACE));
}
+const PPB_Graphics3D* PPBGraphics3D() {
+ return reinterpret_cast<const PPB_Graphics3D*>(
+ GetBrowserInterface(PPB_GRAPHICS_3D_INTERFACE));
+}
+
const PPB_ImageData* PPBImageData() {
return reinterpret_cast<const PPB_ImageData*>(
GetBrowserInterfaceSafe(PPB_IMAGEDATA_INTERFACE));
@@ -100,6 +105,11 @@ const PPB_MouseInputEvent* PPBMouseInputEvent() {
GetBrowserInterfaceSafe(PPB_MOUSE_INPUT_EVENT_INTERFACE));
}
+const PPB_OpenGLES2* PPBOpenGLES2() {
+ return reinterpret_cast<const PPB_OpenGLES2*>(
+ GetBrowserInterface(PPB_OPENGLES2_INTERFACE));
+}
+
const PPB_URLLoader* PPBURLLoader() {
return reinterpret_cast<const PPB_URLLoader*>(
GetBrowserInterfaceSafe(PPB_URLLOADER_INTERFACE));
@@ -138,11 +148,6 @@ const PPB_CursorControl_Dev* PPBCursorControlDev() {
GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE));
}
-const PPB_Graphics3D_Dev* PPBGraphics3DDev() {
- return reinterpret_cast<const PPB_Graphics3D_Dev*>(
- GetBrowserInterface(PPB_GRAPHICS_3D_DEV_INTERFACE));
-}
-
const PPB_Font_Dev* PPBFontDev() {
return reinterpret_cast<const PPB_Font_Dev*>(
GetBrowserInterface(PPB_FONT_DEV_INTERFACE));
@@ -158,11 +163,6 @@ const PPB_Memory_Dev* PPBMemoryDev() {
GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE));
}
-const PPB_OpenGLES2_Dev* PPBOpenGLES2Dev() {
- return reinterpret_cast<const PPB_OpenGLES2_Dev*>(
- GetBrowserInterface(PPB_OPENGLES2_DEV_INTERFACE));
-}
-
const PPB_Scrollbar_Dev* PPBScrollbarDev() {
return reinterpret_cast<const PPB_Scrollbar_Dev*>(
GetBrowserInterface(PPB_SCROLLBAR_DEV_INTERFACE));
diff --git a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h
index 405754d..826ad1b 100644
--- a/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h
+++ b/ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h
@@ -22,7 +22,7 @@ struct PPB_FileSystem;
struct PPB_Font_Dev;
struct PPB_Fullscreen_Dev;
struct PPB_Graphics2D;
-struct PPB_Graphics3D_Dev;
+struct PPB_Graphics3D;
struct PPB_ImageData;
struct PPB_InputEvent;
struct PPB_Instance;
@@ -30,7 +30,7 @@ struct PPB_KeyboardInputEvent;
struct PPB_Memory_Dev;
struct PPB_Messaging;
struct PPB_MouseInputEvent;
-struct PPB_OpenGLES2_Dev;
+struct PPB_OpenGLES2;
struct PPB_Surface3D_Dev;
struct PPB_Testing_Dev;
struct PPB_URLLoader;
@@ -55,12 +55,14 @@ const PPB_FileIO* PPBFileIO();
const PPB_FileRef* PPBFileRef();
const PPB_FileSystem* PPBFileSystem();
const PPB_Graphics2D* PPBGraphics2D();
+const PPB_Graphics3D* PPBGraphics3D();
const PPB_ImageData* PPBImageData();
const PPB_InputEvent* PPBInputEvent();
const PPB_Instance* PPBInstance();
const PPB_KeyboardInputEvent* PPBKeyboardInputEvent();
const PPB_Messaging* PPBMessaging();
const PPB_MouseInputEvent* PPBMouseInputEvent();
+const PPB_OpenGLES2* PPBOpenGLES2();
const PPB_URLLoader* PPBURLLoader();
const PPB_URLRequestInfo* PPBURLRequestInfo();
const PPB_URLResponseInfo* PPBURLResponseInfo();
@@ -76,9 +78,7 @@ const PPB_Context3D_Dev* PPBContext3DDev();
const PPB_CursorControl_Dev* PPBCursorControlDev();
const PPB_Font_Dev* PPBFontDev();
const PPB_Fullscreen_Dev* PPBFullscreenDev();
-const PPB_Graphics3D_Dev* PPBGraphics3DDev();
const PPB_Memory_Dev* PPBMemoryDev();
-const PPB_OpenGLES2_Dev* PPBOpenGLES2Dev();
const PPB_Scrollbar_Dev* PPBScrollbarDev();
const PPB_Surface3D_Dev* PPBSurface3DDev();
const PPB_Testing_Dev* PPBTestingDev();