diff options
author | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-03 02:00:58 +0000 |
---|---|---|
committer | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-03 02:00:58 +0000 |
commit | 0c998e4429e5583a48a244ac2d37d0bd3c02e480 (patch) | |
tree | 268c40a1dda52e10ec2e8009fc298d738738b196 /ppapi/native_client | |
parent | 067af377641397672347e8e5bb850c6365de51df (diff) | |
download | chromium_src-0c998e4429e5583a48a244ac2d37d0bd3c02e480.zip chromium_src-0c998e4429e5583a48a244ac2d37d0bd3c02e480.tar.gz chromium_src-0c998e4429e5583a48a244ac2d37d0bd3c02e480.tar.bz2 |
Update gl2.h and gl2ext.h headers from Khronos.
These headers make using gl extensions easier.
BUG=none
TEST=ppb_graphics3d,building of gles book examples
Review URL: https://chromiumcodereview.appspot.com/10290006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
7 files changed, 44 insertions, 5 deletions
diff --git a/ppapi/native_client/src/shared/ppapi/nacl.scons b/ppapi/native_client/src/shared/ppapi/nacl.scons index c6bc96d..cb6fb00 100644 --- a/ppapi/native_client/src/shared/ppapi/nacl.scons +++ b/ppapi/native_client/src/shared/ppapi/nacl.scons @@ -39,6 +39,8 @@ env.Append(CPPPATH=[ '$SOURCE_ROOT/ppapi/lib/gl/include', ]) +env.Prepend(CPPDEFINES=['GL_GLEXT_PROTOTYPES']) + # Load ppapi_gl.gypi ppapi_gl_gypi = gyp_extract.LoadGypFile( env.File('$SOURCE_ROOT/ppapi/ppapi_gl.gypi').abspath) diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc index e3959eb..bf0c5c4 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp.cc @@ -169,8 +169,8 @@ const void* BrowserPpp::GetPluginInterface(const char* interface_name) { strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_1) == 0) { srpc_result = PppRpcClient::PPP_GetInterface(main_channel_, - PPP_INSTANCE_INTERFACE_1_0, - &exports_interface_name); + const_cast<char *>(PPP_INSTANCE_INTERFACE_1_0), + &exports_interface_name); } const void* ppp_interface = NULL; diff --git a/ppapi/native_client/tests/ppapi/nacl.scons b/ppapi/native_client/tests/ppapi/nacl.scons index 99adc8d..b3aaa1f 100644 --- a/ppapi/native_client/tests/ppapi/nacl.scons +++ b/ppapi/native_client/tests/ppapi/nacl.scons @@ -7,7 +7,7 @@ import gyp_extract Import('env') -env.Prepend(CPPDEFINES=['XP_UNIX']) +env.Prepend(CPPDEFINES=['XP_UNIX', 'GL_GLEXT_PROTOTYPES']) # TODO(robertm): those should not be necessary once we go -std=c99 env.FilterOut(CFLAGS=['-pedantic']) diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/nacl.scons b/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/nacl.scons index 70fba04..87dc43a 100644 --- a/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/nacl.scons +++ b/ppapi/native_client/tests/ppapi_browser/ppb_graphics3d/nacl.scons @@ -7,7 +7,7 @@ Import('env') -env.Prepend(CPPDEFINES=['XP_UNIX']) +env.Prepend(CPPDEFINES=['XP_UNIX', 'GL_GLEXT_PROTOTYPES']) env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/ppapi_browser/' + 'ppb_graphics3d') 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 7ecd172..789ad35 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 @@ -6,6 +6,7 @@ // TODO(nfullagar): More comprehensive testing of the PPAPI interface. #include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> #include <string.h> #include <sys/time.h> @@ -129,6 +130,38 @@ void TestBasicSetup() { TEST_PASSED; } +// Test basic extensions. +// Simple test, mostly to see if extensions can compile, link, and return +// something that makes sense without crashing. The build environment must +// define GL_GLEXT_PROTOTYPES to enable this test. +void TestBasicExtensions() { +#if defined(GL_GLEXT_PROTOTYPES) + int32_t attribs[] = { + PP_GRAPHICS3DATTRIB_WIDTH, kWidth, + PP_GRAPHICS3DATTRIB_HEIGHT, kHeight, + PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 32, + PP_GRAPHICS3DATTRIB_NONE}; + PP_Resource graphics3d_id = PPBGraphics3D()-> + Create(pp_instance(), kInvalidResource, attribs); + EXPECT(graphics3d_id != kInvalidResource); + glSetCurrentContextPPAPI(graphics3d_id); + EXPECT(glGetString(GL_VERSION) != NULL); + const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); + if (strstr(ext, "GL_EXT_occlusion_query_boolean")) { + GLuint a_query; + glGenQueriesEXT(1, &a_query); + EXPECT(0 != a_query); + } + if (strstr(ext, "GL_ANGLE_instanced_arrays")) { + glDrawArraysInstancedANGLE(GL_TRIANGLE_STRIP, 0, 0, 0); + } + glSetCurrentContextPPAPI(0); + PPBCore()->ReleaseResource(graphics3d_id); +#endif + TEST_PASSED; +} + + struct RenderInfo { PP_Resource graphics3d_id; int32_t frame_counter; @@ -275,6 +308,7 @@ void SetupTests() { RegisterTest("TestIsGraphics3D", TestIsGraphics3D); RegisterTest("Test_glInitializePPAPI", Test_glInitializePPAPI); RegisterTest("TestBasicSetup", TestBasicSetup); + RegisterTest("TestBasicExtensions", TestBasicExtensions); RegisterTest("TestSwapBuffers", TestSwapBuffers); RegisterTest("TestResizeBuffersWithoutDepthBuffer", TestResizeBuffersWithoutDepthBuffer); 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 d0ffd8b..6fa632b 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,9 @@ function setupTests(tester, plugin) { tester.addAsyncTest('Basic Setup', function(test) { testAndAssertStatus(test, 'TestBasicSetup'); }); + tester.addAsyncTest('Basic Extensions', function(test) { + testAndAssertStatus(test, 'TestBasicExtensions'); + }); tester.addAsyncTest('PPB_Graphics3D::SwapBuffers', function(test) { testAndAssertStatus(test, 'TestSwapBuffers', 'TestSwapCallback:PASSED'); }); diff --git a/ppapi/native_client/tests/ppapi_gles_book/nacl.scons b/ppapi/native_client/tests/ppapi_gles_book/nacl.scons index 8e73806..284c573 100644 --- a/ppapi/native_client/tests/ppapi_gles_book/nacl.scons +++ b/ppapi/native_client/tests/ppapi_gles_book/nacl.scons @@ -7,7 +7,7 @@ Import('env') -env.Prepend(CPPDEFINES=['XP_UNIX']) +env.Prepend(CPPDEFINES=['XP_UNIX', 'GL_GLEXT_PROTOTYPES']) env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' + 'ppapi_gles_book/') |