Commit f97ba4d0 by Nicolas Capens Committed by Nicolas Capens

Restore the legacy PowerVR SDK 'BasicTnL' OpenGL ES 1.1 sample

OpenGL ES 1.1 will be removed from the main branch, but this sample can remain available as basic test of a legacy OpenGL ES 1.1 build. This partially reverts https://swiftshader-review.googlesource.com/c/SwiftShader/+/43190 Bug: b/147516027 Change-Id: I344b5c591e6560317c53cfa2da9f092e948e3cfa Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45709Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent a6940c8e
......@@ -117,7 +117,8 @@ option_if_not_defined(SWIFTSHADER_GET_PVR "Check out the PowerVR submodule" FALS
option_if_not_defined(SWIFTSHADER_USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_TESTS "Build unit tests" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_SAMPLES "Build sample programs" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_TESTS "Build test programs" TRUE)
option_if_not_defined(SWIFTSHADER_BUILD_BENCHMARKS "Build benchmarks" FALSE)
option_if_not_defined(SWIFTSHADER_MSAN "Build with memory sanitizer" FALSE)
......@@ -179,6 +180,7 @@ set(SWIFTSHADER_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SOURCE_DIR ${SWIFTSHADER_DIR}/src)
set(THIRD_PARTY_DIR ${SWIFTSHADER_DIR}/third_party)
set(TESTS_DIR ${SWIFTSHADER_DIR}/tests)
set(POWERVR_DIR ${THIRD_PARTY_DIR}/PowerVR_SDK)
###########################################################
# Initialize submodules
......@@ -733,6 +735,51 @@ endif()
# Sample programs and tests
###########################################################
if(SWIFTSHADER_BUILD_SAMPLES)
if(WIN32)
add_executable(BasicTnL
${POWERVR_DIR}/Examples/Beginner/04_BasicTnL/OGLES/OGLESBasicTnL.cpp
${POWERVR_DIR}/Shell/PVRShell.cpp
${POWERVR_DIR}/Shell/OS/Windows/PVRShellOS.cpp
${POWERVR_DIR}/Shell/API/KEGL/PVRShellAPI.cpp
)
target_include_directories(BasicTnL PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${POWERVR_DIR}/Shell
${POWERVR_DIR}/Shell/OS/Windows
${POWERVR_DIR}/Shell/API/KEGL
${POWERVR_DIR}/Builds/Include
)
set_target_properties(BasicTnL PROPERTIES
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
FOLDER "Samples"
)
target_link_libraries(BasicTnL libEGL libGLES_CM)
set_property(TARGET BasicTnL APPEND_STRING PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS")
set(CMAKE_DEFAULT_STARTUP_PROJECT BasicTnL)
elseif(LINUX)
add_executable(BasicTnL
${POWERVR_DIR}/Examples/Beginner/04_BasicTnL/OGLES/OGLESBasicTnL.cpp
${POWERVR_DIR}/Shell/PVRShell.cpp
${POWERVR_DIR}/Shell/OS/LinuxX11/PVRShellOS.cpp
${POWERVR_DIR}/Shell/API/KEGL/PVRShellAPI.cpp
)
target_include_directories(BasicTnL PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
${POWERVR_DIR}/Shell
${POWERVR_DIR}/Shell/OS/LinuxX11
${POWERVR_DIR}/Shell/API/KEGL
${POWERVR_DIR}/Builds/Include
)
set_target_properties(BasicTnL PROPERTIES
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS}"
COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
LINK_FLAGS "${SWIFTSHADER_LINK_FLAGS}"
)
target_link_libraries(BasicTnL dl ${X11} libEGL libGLES_CM) # Explicitly link our "lib*" targets, not the platform provided "EGL" and "GLES_CM"
endif()
endif(SWIFTSHADER_BUILD_SAMPLES)
if(HAVE_PVR_SUBMODULE AND SWIFTSHADER_BUILD_PVR)
if(UNIX AND NOT APPLE)
set(PVR_WINDOW_SYSTEM XCB)
......
#ifndef __eglplatform_h_
#define __eglplatform_h_
/*
** Copyright (c) 2007-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Platform-specific types and definitions for egl.h
* $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "EGL" component "Registry".
*/
#include <KHR/khrplatform.h>
/* Macros used in EGL function prototype declarations.
*
* EGL functions should be prototyped as:
*
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
*
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
*/
#ifndef EGLAPI
#define EGLAPI KHRONOS_APICALL
#endif
#ifndef EGLAPIENTRY
#define EGLAPIENTRY KHRONOS_APIENTRY
#endif
#define EGLAPIENTRYP EGLAPIENTRY*
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
* are aliases of window-system-dependent types, such as X Display * or
* Windows Device Context. They must be defined in platform-specific
* code below. The EGL-prefixed versions of Native*Type are the same
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
*
* Khronos STRONGLY RECOMMENDS that you use the default definitions
* provided below, since these changes affect both binary and source
* portability of applications using EGL running on different EGL
* implementations.
*/
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
#elif defined(SUPPORT_X11)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#elif defined(__ANDROID__) || defined(ANDROID)
#include <android/native_window.h>
struct egl_native_pixmap_t;
typedef struct ANativeWindow* EGLNativeWindowType;
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
typedef void* EGLNativeDisplayType;
#else
#if defined(_WIN64) || __WORDSIZE == 64
typedef khronos_int64_t EGLNativeDisplayType;
#else
typedef int EGLNativeDisplayType;
#endif
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
#endif
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
typedef EGLNativeDisplayType NativeDisplayType;
typedef EGLNativePixmapType NativePixmapType;
typedef EGLNativeWindowType NativeWindowType;
/* Define EGLint. This must be a signed integral type large enough to contain
* all legal attribute names and values passed into and out of EGL, whether
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
* handle, or other. While in general a 32-bit integer will suffice, if
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
* integer type.
*/
typedef khronos_int32_t EGLint;
#endif /* __eglplatform_h */
/*
* Skeleton egl.h to provide compatibility for early GLES 1.0
* applications. Several early implementations included gl.h
* in egl.h leading applications to include only egl.h
*
* $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$
*/
#ifndef __legacy_egl_h_
#define __legacy_egl_h_
#include <EGL/egl.h>
#include <GLES/gl.h>
#endif /* __legacy_egl_h_ */
#ifndef __glplatform_h_
#define __glplatform_h_
/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
* 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
*/
/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
*
* Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
* by filing a bug against product "OpenGL-ES" component "Registry".
*/
#include <KHR/khrplatform.h>
#ifndef GL_API
#define GL_API KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __glplatform_h_ */
/*!***************************************************************************
@File sdkver.h
@Title Version numbers and strings.
@Date 08/11/2011
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Platform Independant
@Description Version numbers and strings for SDK components.
*****************************************************************************/
#ifndef __SDKVER_H_
#define __SDKVER_H_
/*!***************************************************************************
Defines
*****************************************************************************/
#define PVRSDK_VERSION "3.2@2654748"
#define PVRVERSION_MAJ "3"
#define PVRVERSION_MIN "2"
#define PVRVERSION_BRANCH "32"
#define PVRVERSION_BRANCH_DEC "3.2"
#define PVRVERSION_BRANCH_NAME "REL/3.2"
#define PVRVERSION_BUILD "2654748"
#define PVRVERSION_BUILD_HI "265"
#define PVRVERSION_BUILD_LO "4748"
#define PVRSDK_COPYRIGHT_TXT "Copyright (c) Imagination Technologies Ltd. All Rights Reserved."
#endif /* __SDKVER_H_ */
/*****************************************************************************
End of file (sdkver.h)
*****************************************************************************/
:Title:
BasicTnL
:ShortDescription:
This training course consists of a demonstration of basic transformation and lighting.
:FullDescription:
This training course consists of a demonstration of basic transformation and lighting, growing on the basic drawing techniques learnt in HelloTriangle.
Controls:
- Esc - Close the application
:VGP:
Not Required
:PolyCount:
1
:VertexCount:
3
/******************************************************************************
@File OGLESBasicTnL.cpp
@Title Shows basic transformations and lighting
@Version
@Copyright Copyright (c) Imagination Technologies Limited.
@Platform Independant
@Description Shows basic transformations and lighting
******************************************************************************/
#include "PVRShell.h"
#include <math.h>
#if defined(__APPLE__) && defined (TARGET_OS_IPHONE)
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#else
#include <GLES/gl.h>
#endif
/******************************************************************************
Defines
******************************************************************************/
// Size of the texture we create
const int g_i32TexSize = 128;
/*!****************************************************************************
Class implementing the PVRShell functions.
******************************************************************************/
class OGLESBasicTnL : public PVRShell
{
// Texture handle
GLuint m_ui32Texture;
// Angle to rotate the triangle
float m_fAngle;
// Vertex Buffer Object (VBO) handle
GLuint m_ui32Vbo;
public:
virtual bool InitApplication();
virtual bool InitView();
virtual bool ReleaseView();
virtual bool QuitApplication();
virtual bool RenderScene();
};
/*!****************************************************************************
@Function InitApplication
@Return bool true if no error occured
@Description Code in InitApplication() will be called by PVRShell once per
run, before the rendering context is created.
Used to initialize variables that are not dependant on it
(e.g. external modules, loading meshes, etc.)
If the rendering context is lost, InitApplication() will
not be called again.
******************************************************************************/
bool OGLESBasicTnL::InitApplication()
{
m_fAngle = 0;
return true;
}
/*!****************************************************************************
@Function QuitApplication
@Return bool true if no error occured
@Description Code in QuitApplication() will be called by PVRShell once per
run, just before exiting the program.
If the rendering context is lost, QuitApplication() will
not be called.
******************************************************************************/
bool OGLESBasicTnL::QuitApplication()
{
return true;
}
/*!****************************************************************************
@Function InitView
@Return bool true if no error occured
@Description Code in InitView() will be called by PVRShell upon
initialization or after a change in the rendering context.
Used to initialize variables that are dependant on the rendering
context (e.g. textures, vertex buffers, etc.)
******************************************************************************/
bool OGLESBasicTnL::InitView()
{
// Sets the clear color
glClearColor(0.6f, 0.8f, 1.0f, 1.0f);
// Enables texturing
glEnable(GL_TEXTURE_2D);
/*
Creates the texture.
Please refer to the training course "Texturing" for a detailed explanation.
*/
glGenTextures(1, &m_ui32Texture);
glBindTexture(GL_TEXTURE_2D, m_ui32Texture);
GLuint* pTexData = new GLuint[g_i32TexSize*g_i32TexSize];
for(int i = 0; i < g_i32TexSize; ++i)
{
for(int j = 0; j < g_i32TexSize; ++j)
{
GLuint col = (255<<24) + ((255-j*2)<<16) + ((255-i)<<8) + (255-i*2);
if ( ((i*j)/8) % 2 )
col = 0xffff00ff;
pTexData[j*g_i32TexSize+i] = col;
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, g_i32TexSize, g_i32TexSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
delete[] pTexData;
// Enables lighting and light 0
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
/*
Specifies the light direction.
If the 4th component is 0, it's a parallel light (the case here).
If the 4th component is not 0, it's a point light.
*/
float aLightPosition[] = {0.0f,0.0f,1.0f,0.0f};
/*
Assigns the light direction to the light number 0.
This function allows you to set also the ambiant, diffuse,
specular, emission colors of the light as well as attenuation parameters.
We keep the other parameters to their default value in this demo.
*/
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, aLightPosition);
// Create VBO for the triangle from our data
// Interleaved vertex data
float afVertices[] = { -0.4f,-0.4f,0.0f, // Position
0.0f,0.0f, // UV
0,0,1, // Normal
0.4f,-0.4f,0.0f,
1.0f,0.0f,
0,0,1,
0.0f,0.4f,0.0f,
0.5f,1.0f,
0,0,1};
glGenBuffers(1, &m_ui32Vbo);
unsigned int uiSize = 3 * (sizeof(float) * 8); // 3 vertices * stride (8 verttypes per vertex)
// Bind the VBO
glBindBuffer(GL_ARRAY_BUFFER, m_ui32Vbo);
// Set the buffer's data
glBufferData(GL_ARRAY_BUFFER, uiSize, afVertices, GL_STATIC_DRAW);
// Unbind the VBO
glBindBuffer(GL_ARRAY_BUFFER, 0);
return true;
}
/*!****************************************************************************
@Function ReleaseView
@Return bool true if no error occured
@Description Code in ReleaseView() will be called by PVRShell when the
application quits or before a change in the rendering context.
******************************************************************************/
bool OGLESBasicTnL::ReleaseView()
{
// Frees the texture
glDeleteTextures(1, &m_ui32Texture);
return true;
}
/*!****************************************************************************
@Function RenderScene
@Return bool true if no error occured
@Description Main rendering loop function of the program. The shell will
call this function every frame.
eglSwapBuffers() will be performed by PVRShell automatically.
PVRShell will also manage important OS events.
Will also manage relevent OS events. The user has access to
these events through an abstraction layer provided by PVRShell.
******************************************************************************/
bool OGLESBasicTnL::RenderScene()
{
// Clears the color and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Model view matrix
float aModelView[] =
{
(float)cos(m_fAngle), 0, (float)sin(m_fAngle), 0,
0, 1, 0, 0,
-(float)sin(m_fAngle), 0, (float)cos(m_fAngle), 0,
0, 0, 0, 1
};
// Sets the matrix mode to modify the Model View matrix
glMatrixMode(GL_MODELVIEW);
// Loads our matrix into OpenGL Model View matrix
glLoadMatrixf(aModelView);
// Increments the angle of the view
m_fAngle += .02f;
/*
Draw a triangle.
Please refer to the training course IntroducingPVRShell for a detailed explanation.
*/
// bind the VBO for the triangle
glBindBuffer(GL_ARRAY_BUFFER, m_ui32Vbo);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,sizeof(float) * 8, 0);
// Pass the texture coordinates data
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2,GL_FLOAT,sizeof(float) * 8, (unsigned char*) (sizeof(float) * 3));
// Pass the normals data
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT,sizeof(float) * 8, (unsigned char*) (sizeof(float) * 5));
// Draws a non-indexed triangle array
glDrawArrays(GL_TRIANGLES, 0, 3);
// unbind the vertex buffer as we don't need it bound anymore
glBindBuffer(GL_ARRAY_BUFFER, 0);
return true;
}
/*!****************************************************************************
@Function NewDemo
@Return PVRShell* The demo supplied by the user
@Description This function must be implemented by the user of the shell.
The user should return its PVRShell object defining the
behaviour of the application.
******************************************************************************/
PVRShell* NewDemo()
{
return new OGLESBasicTnL();
}
/******************************************************************************
End of file (OGLESBasicTnL.cpp)
******************************************************************************/
SDK END USER LICENSE AGREEMENT
PLEASE READ THIS AGREEMENT CAREFULLY. BY USING ANY PORTION OF THE SDK YOU WILL BE LEGALLY BOUND TO THESE TERMS.
Imagination Technologies Limited ("Imagination") provides this Software Development Kit subject to the terms of this Agreement. If you do not agree with any of these terms, then do not install or otherwise use the SDK.
1. Definitions
"SDK" means all or any component of software in source or binary form, tools, code examples, drivers, files, libraries, utilities, reference manuals, documentation, or other materials, and including any related updates or upgrades made available by Imagination under this Agreement from time to time.
2. Licence Grant
Subject to your compliance with the terms of this Agreement, Imagination grants to you a non-exclusive, non-assignable licence to:
(a) use the SDK for the sole purpose of developing, profiling, or assisting in the optimisation of internal, commercial, or non-commercial applications ("Development License");
(b) distribute the SDK in source code, object file, or compiled binary form as a component of your application, provided that:
i. you do not distribute the SDK on a stand alone basis;
ii. you distribute such components under terms no less restrictive than those in this Agreement;
iii. you comply with the attribution requirements set out in Appendix 1;
iv. you are solely responsible for any update, support obligation or other liability that may arise from such distribution;
v. you do not make any statements that your application or its performance are certified, guaranteed or otherwise endorsed by Imagination ("Production License")
(c) Use the SDK as expressly authorised by Imagination in writing, on the payment and/or support terms set out in Appendix 2 (if applicable) ("Custom License").
3. Restrictions
Other than as expressly permitted herein, you may not: (i) use the SDK for any unauthorised purpose; (ii) modify, disassemble, decompile, reverse engineer, revise or enhance the SDK, create derivative works or attempt to discover the source code for any element of the SDK not already provided in source code form; (iii) remove any proprietary or copyright notices on or accompanying the SDK; or (iv) incorporate or combine the SDK, with any open source software in such a way that would cause the SDK, or any portion thereof, to be subject to all or part of the licence obligations or other intellectual property related terms with respect to such open source software.
4. Ownership
Imagination retains all ownership of the SDK, including without limitation all copyrights and other intellectual property rights therein.
5. Warranty Disclaimer
THE SDK IS PROVIDED "AS IS". Imagination HEREBY DISCLAIMS ALL EXPRESS OR IMPLIED WARRANTIES AND CONDITIONS WITH REGARD TO THE SDK, INCLUDING ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT.
6. Limitation of Liability
IN NO EVENT WILL Imagination BE LIABLE TO YOU FOR ANY DAMAGES, CLAIMS OR COSTS WHATSOEVER ARISING FROM THIS AGREEMENT AND/OR YOUR USE OF THE SDK OR ANY COMPONENT THEREOF, INCLUDING WITHOUT LIMITATION ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL DAMAGES, OR ANY LOST PROFITS OR LOST SAVINGS, EVEN IF Imagination HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS OR FOR ANY CLAIM BY ANY THIRD PARTY. THE FOREGOING LIMITATIONS AND EXCLUSIONS APPLY TO THE EXTENT PERMITTED BY APPLICABLE LAW IN YOUR JURISDICTION.
7. Third Party Materials
All third party materials found on this SDK, including without limitation, artwork, graphics, game demos and patches, are the sole and exclusive property of such third parties. Imagination makes no representations or warranties about the accuracy, usability or validity of any third party materials, and disclaims all liabilities in connection with such third party materials.
8. Term
This Agreement is effective until terminated. Imagination has the right to terminate this Agreement immediately if you fail to comply with any term of this Agreement. You may terminate this Agreement by destroying or returning to Imagination all copies of the SDK in your possession.
9. Governing Law
This Agreement is governed by and shall be construed in accordance with English law and each party agrees to submit to the exclusive jurisdiction of the courts of England.
APPENDIX 1: ATTRIBUTION REQUIREMENTS
If source code is released as it is, the Copyright notice should be kept in a visible position.
If object code is bundled with a product, all branding should be kept as it was originally, and the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the SDK component: "This product includes components of the PowerVR SDK from Imagination Technologies Limited"
If source code is used to compile a product, the following acknowledgement should be displayed clearly in any associated documentation or other collateral in printed or electronic form distributed with the product incorporating the SDK component: "This product includes components of the PowerVR SDK from Imagination Technologies Limited"
APPENDIX 2: FEES
LICENCE FEES:
nil
ROYALTY FEES:
nil
SUPPORT AND MAINTENANCE TERMS AND FEES:
nil
\ No newline at end of file
/*!****************************************************************************
@file KEGL/PVRShellAPI.h
@ingroup API_KEGL
@copyright Copyright (c) Imagination Technologies Limited.
@brief 3D API context management for KEGL.
@details Makes programming for 3D APIs easier by wrapping surface
initialization, Texture allocation and other functions for use by a demo.
******************************************************************************/
#ifndef __PVRSHELLAPI_H_
#define __PVRSHELLAPI_H_
/****************************************************************************
** 3D API header files
****************************************************************************/
#if defined(BUILD_OGLES2)
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#elif defined(BUILD_OGLES3)
#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h>
#include <GLES3/gl3ext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#elif defined(BUILD_OGL)
#define SUPPORT_OPENGL
#if defined(_WIN32)
#include <windows.h>
#endif
#include <GL/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#else
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES/glplatform.h>
#endif
/*!***************************************************************************
@addtogroup API_KEGL
@brief KEGL API
@{
****************************************************************************/
/*!***************************************************************************
@class PVRShellInitAPI
@brief Initialisation interface with specific API.
****************************************************************************/
class PVRShellInitAPI
{
public:
EGLDisplay m_EGLDisplay;
EGLSurface m_EGLWindow;
EGLContext m_EGLContext;
EGLConfig m_EGLConfig;
EGLint m_MajorVersion, m_MinorVersion;
bool m_bPowerManagementSupported;
EGLint m_iRequestedConfig;
EGLint m_iConfig;
EGLNativeDisplayType m_NDT;
EGLNativePixmapType m_NPT;
EGLNativeWindowType m_NWT;
public:
PVRShellInitAPI() : m_bPowerManagementSupported(false), m_iRequestedConfig(0), m_iConfig(0) {}
EGLConfig SelectEGLConfiguration(const PVRShellData * const pData);
const char *StringFrom_eglGetError() const;
#if defined(BUILD_OGLES) || defined(BUILD_OGLES2)
protected:
typedef void (GL_APIENTRY * PFNGLDISCARDFRAMEBUFFEREXT)(GLenum target, GLsizei numAttachments, const GLenum *attachments);
PFNGLDISCARDFRAMEBUFFEREXT glDiscardFramebufferEXT;
#endif
};
/*! @} */
#endif // __PVRSHELLAPI_H_
/*****************************************************************************
End of file (PVRShellAPI.h)
*****************************************************************************/
/*!****************************************************************************
@file LinuxX11/PVRShellOS.h
@ingroup OS_LinuxX11
@copyright Copyright (c) Imagination Technologies Limited.
@brief Initialization for the shell for LinuxX11.
@details Makes programming for 3D APIs easier by wrapping surface
initialization, Texture allocation and other functions for use by a demo.
******************************************************************************/
#ifndef _PVRSHELLOS_
#define _PVRSHELLOS_
#include "X11/Xlib.h"
#include "X11/Xutil.h"
#ifdef BUILD_OGL
#include "X11/extensions/xf86vmode.h"
#endif
#define PVRSHELL_DIR_SYM '/'
#define _stricmp strcasecmp
/*!
@addtogroup OS_LinuxX11
@brief LinuxX11 OS
@details The following table illustrates how key codes are mapped in LinuxX11:
<table>
<tr><th> Key code </th><th> nLastKeyPressed (PVRShell) </th></tr>
<tr><td> Esc </td><td> PVRShellKeyNameQUIT </td></tr>
<tr><td> F11 </td><td> PVRShellKeyNameScreenshot </td></tr>
<tr><td> Enter </td><td> PVRShellKeyNameSELECT </td></tr>
<tr><td> '1' </td><td> PVRShellKeyNameACTION1 </td></tr>
<tr><td> '2' </td><td> PVRShellKeyNameACTION2 </td></tr>
<tr><td> Up arrow </td><td> m_eKeyMapUP </td></tr>
<tr><td> Down arrow </td><td> m_eKeyMapDOWN </td></tr>
<tr><td> Left arrow </td><td> m_eKeyMapLEFT </td></tr>
<tr><td> Right arrow </td><td> m_eKeyMapRIGHT </td></tr>
</table>
@{
*/
/*!***************************************************************************
@class PVRShellInitOS
@brief Interface with specific Operative System.
*****************************************************************************/
class PVRShellInitOS
{
public:
Display* m_X11Display;
long m_X11Screen;
XVisualInfo* m_X11Visual;
Colormap m_X11ColorMap;
Window m_X11Window;
timeval m_StartTime;
#ifdef BUILD_OGL
XF86VidModeModeLine m_OriginalMode; // modeline that was active at the starting point of this aplication
int m_i32OriginalModeDotClock;
#endif
// Pixmap support: variables for the pixmap
Pixmap m_X11Pixmap;
GC m_X11GC;
unsigned int m_u32ButtonState; // 1 = left, 2 = right, 4 = middle
public:
int OpenX11Window(const PVRShell &shell);
void CloseX11Window();
};
/*! @} */
#endif /* _PVRSHELLOS_ */
/*****************************************************************************
End of file (PVRShellOS.h)
*****************************************************************************/
/*!****************************************************************************
@file Windows/PVRShellOS.h
@ingroup OS_Windows
@copyright Copyright (c) Imagination Technologies Limited.
@brief Initialization for the shell for the Windows OS.
@details Makes programming for 3D APIs easier by wrapping surface
initialization, Texture allocation and other functions for use by a demo.
******************************************************************************/
#ifndef _PVRSHELLOS_
#define _PVRSHELLOS_
#include <windows.h>
// The following defines are for Windows PC platforms only
#if defined(_WIN32)
// Enable the following 2 lines for memory leak checking - also see WinMain()
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#define PVRSHELL_DIR_SYM '\\'
#define vsnprintf _vsnprintf
/*!
@addtogroup OS_Windows
@brief Windows OS
@details The following table illustrates how key codes are mapped in Windows:
<table>
<tr><th> Key code </th><th> KeyPressed (PVRShell) </th></tr>
<tr><td> ESCAPE </td><td> PVRShellKeyNameQUIT </td></tr>
<tr><td> UP </td><td> m_eKeyMapUP </td></tr>
<tr><td> DOWN </td><td> m_eKeyMapDOWN </td></tr>
<tr><td> LEFT </td><td> m_eKeyMapLEFT </td></tr>
<tr><td> RIGHT </td><td> m_eKeyMapRIGHT </td></tr>
<tr><td> SPACE </td><td> PVRShellKeyNameSELECT </td></tr>
<tr><td> '1' </td><td> PVRShellKeyNameACTION1 </td></tr>
<tr><td> '2' </td><td> PVRShellKeyNameACTION2 </td></tr>
<tr><td> F11 </td><td> PVRShellKeyNameScreenshot </td></tr>
</table>
@{
*/
/*!***************************************************************************
@class PVRShellInitOS
@brief Interface with specific Operating System.
*****************************************************************************/
class PVRShellInitOS
{
public:
HDC m_hDC;
HWND m_hWnd;
// Pixmap support: variables for the pixmap
HBITMAP m_hBmPixmap, m_hBmPixmapOld;
HDC m_hDcPixmap;
HACCEL m_hAccelTable;
HINSTANCE m_hInstance;
int m_nCmdShow;
bool m_bHaveFocus;
unsigned int m_u32ButtonState;
public:
ATOM MyRegisterClass();
};
/*! @} */
#endif /* _PVRSHELLOS_ */
/*****************************************************************************
End of file (PVRShellOS.h)
*****************************************************************************/
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