Commit 29e280d4 by Nicolas Capens

Remove the Radiance prototype.

Change-Id: Ife60e89ac857e103138a139c01be68f761d6dc3c Reviewed-on: https://swiftshader-review.googlesource.com/3432Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent d1746741
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
namespace es
{
static void output(const char *format, va_list vararg)
{
if(false)
{
FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
if(file)
{
vfprintf(file, format, vararg);
fclose(file);
}
}
}
void trace(const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
output(format, vararg);
va_end(vararg);
}
}
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// debug.h: Debugging utilities.
#ifndef COMMON_DEBUG_H_
#define COMMON_DEBUG_H_
#include <stdio.h>
#include <assert.h>
#if !defined(TRACE_OUTPUT_FILE)
#define TRACE_OUTPUT_FILE "debug.txt"
#endif
namespace es
{
// Outputs text to the debugging log
void trace(const char *format, ...);
}
// A macro to output a trace of a function call and its arguments to the debugging log
#if defined(ANGLE_DISABLE_TRACE)
#define TRACE(message, ...) (void(0))
#else
#define TRACE(message, ...) es::trace("trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
#if defined(ANGLE_DISABLE_TRACE)
#define FIXME(message, ...) (void(0))
#else
#define FIXME(message, ...) do {es::trace("fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
#if defined(ANGLE_DISABLE_TRACE)
#define ERR(message, ...) (void(0))
#else
#define ERR(message, ...) do {es::trace("err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)
#endif
// A macro asserting a condition and outputting failures to the debug log
#if !defined(NDEBUG)
#define ASSERT(expression) do { \
if(!(expression)) \
ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
assert(expression); \
} while(0)
#else
#define ASSERT(expression) (void(0))
#endif
// A macro to indicate unimplemented functionality
#if !defined(NDEBUG)
#define UNIMPLEMENTED() do { \
FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} while(0)
#else
#define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
// A macro for code which is not expected to be reached under valid assumptions
#if !defined(NDEBUG)
#define UNREACHABLE() do { \
ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} while(0)
#else
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
// A macro functioning as a compile-time assert to validate constant conditions
#define META_ASSERT(condition) typedef int COMPILE_TIME_ASSERT_##__LINE__[static_cast<bool>(condition) ? 1 : -1]
#endif // COMMON_DEBUG_H_
#ifndef __eglplatform_h_
#define __eglplatform_h_
/*
** Copyright (c) 2007-2013 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: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
*
* 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(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
typedef int EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
#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;
#elif defined(__unix__)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#else
#error "Platform not recognized"
#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_ */
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifndef __gl2platform_h_
#define __gl2platform_h_
/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
/*
* 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 2.X gl2.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_APICALL
#define GL_APICALL KHRONOS_APICALL
#endif
#ifndef GL_APIENTRY
#define GL_APIENTRY KHRONOS_APIENTRY
#endif
#endif /* __gl2platform_h_ */
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Config.h: Defines the egl::Config class, describing the format, type
// and size for an egl::Surface. Implements EGLConfig and related functionality.
// [EGL 1.4] section 3.4 page 15.
#ifndef INCLUDE_CONFIG_H_
#define INCLUDE_CONFIG_H_
#include "Renderer/Surface.hpp"
#define EGLAPI
#include <EGL/egl.h>
#include <set>
namespace egl
{
class Display;
struct DisplayMode
{
unsigned int width;
unsigned int height;
sw::Format format;
};
class Config
{
public:
Config(const DisplayMode &displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
EGLConfig getHandle() const;
bool isSlowConfig() const;
const DisplayMode mDisplayMode;
const sw::Format mRenderTargetFormat;
const sw::Format mDepthStencilFormat;
const EGLint mMultiSample;
EGLint mBufferSize; // Depth of the color buffer
EGLint mRedSize; // Bits of Red in the color buffer
EGLint mGreenSize; // Bits of Green in the color buffer
EGLint mBlueSize; // Bits of Blue in the color buffer
EGLint mLuminanceSize; // Bits of Luminance in the color buffer
EGLint mAlphaSize; // Bits of Alpha in the color buffer
EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer
EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures.
EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures.
EGLenum mColorBufferType; // Color buffer type
EGLenum mConfigCaveat; // Any caveats for the configuration
EGLint mConfigID; // Unique EGLConfig identifier
EGLint mConformant; // Whether contexts created with this config are conformant
EGLint mDepthSize; // Bits of Z in the depth buffer
EGLint mLevel; // Frame buffer level
EGLBoolean mMatchNativePixmap; // Match the native pixmap format
EGLint mMaxPBufferWidth; // Maximum width of pbuffer
EGLint mMaxPBufferHeight; // Maximum height of pbuffer
EGLint mMaxPBufferPixels; // Maximum size of pbuffer
EGLint mMaxSwapInterval; // Maximum swap interval
EGLint mMinSwapInterval; // Minimum swap interval
EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
EGLint mNativeVisualID; // Handle of corresponding native visual
EGLint mNativeVisualType; // Native visual type of the associated visual
EGLint mRenderableType; // Which client rendering APIs are supported.
EGLint mSampleBuffers; // Number of multisample buffers
EGLint mSamples; // Number of samples per pixel
EGLint mStencilSize; // Bits of Stencil in the stencil buffer
EGLint mSurfaceType; // Which types of EGL surfaces are supported.
EGLenum mTransparentType; // Type of transparency supported
EGLint mTransparentRedValue; // Transparent red value
EGLint mTransparentGreenValue; // Transparent green value
EGLint mTransparentBlueValue; // Transparent blue value
};
// Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
class SortConfig
{
public:
explicit SortConfig(const EGLint *attribList);
bool operator()(const Config *x, const Config *y) const;
bool operator()(const Config &x, const Config &y) const;
private:
void scanForWantedComponents(const EGLint *attribList);
EGLint wantedComponentsSize(const Config &config) const;
bool mWantRed;
bool mWantGreen;
bool mWantBlue;
bool mWantAlpha;
bool mWantLuminance;
};
class ConfigSet
{
friend class Display;
public:
ConfigSet();
void add(const DisplayMode &displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
size_t size() const;
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
const egl::Config *get(EGLConfig configHandle);
private:
typedef std::set<Config, SortConfig> Set;
typedef Set::iterator Iterator;
Set mSet;
static const EGLint mSortAttribs[];
};
}
#endif // INCLUDE_CONFIG_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Context.h: Defines the Context class, managing all GL state and performing
// rendering operations. It is the GLES2 specific implementation of EGLContext.
#ifndef LIBGLESV2_CONTEXT_H_
#define LIBGLESV2_CONTEXT_H_
#include "Context.hpp"
#include "Image.hpp"
#include "Renderer/Sampler.hpp"
#define GL_APICALL
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#define EGLAPI
#include <EGL/egl.h>
#include <map>
#include <string>
namespace egl
{
class Display;
class Surface;
class Config;
}
namespace es2
{
class Device;
class Shader;
class Program;
class Texture;
class Texture2D;
class TextureCubeMap;
class TextureExternal;
class Fence;
enum
{
MAX_VERTEX_ATTRIBS = 16,
MAX_UNIFORM_VECTORS = 256, // Device limit
MAX_VERTEX_UNIFORM_VECTORS = 256 - 3, // Reserve space for gl_DepthRange
MAX_VARYING_VECTORS = 10,
MAX_TEXTURE_IMAGE_UNITS = 16,
MAX_VERTEX_TEXTURE_IMAGE_UNITS = 4,
MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS,
MAX_FRAGMENT_UNIFORM_VECTORS = 224 - 3, // Reserve space for gl_DepthRange
MAX_DRAW_BUFFERS = 1,
IMPLEMENTATION_COLOR_READ_FORMAT = GL_RGB,
IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5
};
const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
const float ALIASED_POINT_SIZE_RANGE_MIN = 0.125f;
const float ALIASED_POINT_SIZE_RANGE_MAX = 8192.0f;
const float MAX_TEXTURE_MAX_ANISOTROPY = 16.0f;
struct Color
{
float red;
float green;
float blue;
float alpha;
};
// Helper structure describing a single vertex attribute
class VertexAttribute
{
public:
VertexAttribute() : mType(GL_FLOAT), mSize(0), mNormalized(false), mStride(0), mOffset(0), mArrayEnabled(false)
{
}
int typeSize() const;
GLsizei stride() const
{
return mStride ? mStride : typeSize();
}
// From glVertexAttribPointer
GLenum mType;
GLint mSize;
bool mNormalized;
GLsizei mStride; // 0 means natural stride
intptr_t mOffset;
sw::Resource *buffer;
bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
};
typedef VertexAttribute VertexAttributeArray[MAX_VERTEX_ATTRIBS];
// Helper structure to store all raw state
struct State
{
Color colorClearValue;
GLclampf depthClearValue;
int stencilClearValue;
bool cullFace;
GLenum cullMode;
GLenum frontFace;
bool depthTest;
GLenum depthFunc;
bool blend;
GLenum sourceBlendRGB;
GLenum destBlendRGB;
GLenum sourceBlendAlpha;
GLenum destBlendAlpha;
GLenum blendEquationRGB;
GLenum blendEquationAlpha;
Color blendColor;
bool stencilTest;
GLenum stencilFunc;
GLint stencilRef;
GLuint stencilMask;
GLenum stencilFail;
GLenum stencilPassDepthFail;
GLenum stencilPassDepthPass;
GLuint stencilWritemask;
GLenum stencilBackFunc;
GLint stencilBackRef;
GLuint stencilBackMask;
GLenum stencilBackFail;
GLenum stencilBackPassDepthFail;
GLenum stencilBackPassDepthPass;
GLuint stencilBackWritemask;
bool polygonOffsetFill;
GLfloat polygonOffsetFactor;
GLfloat polygonOffsetUnits;
bool sampleAlphaToCoverage;
bool sampleCoverage;
GLclampf sampleCoverageValue;
bool sampleCoverageInvert;
bool scissorTest;
bool dither;
GLfloat lineWidth;
GLenum generateMipmapHint;
GLenum fragmentShaderDerivativeHint;
GLint viewportX;
GLint viewportY;
GLsizei viewportWidth;
GLsizei viewportHeight;
float zNear;
float zFar;
GLint scissorX;
GLint scissorY;
GLsizei scissorWidth;
GLsizei scissorHeight;
bool colorMaskRed;
bool colorMaskGreen;
bool colorMaskBlue;
bool colorMaskAlpha;
bool depthMask;
unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
sw::Resource *elementArrayBuffer;
GLuint readFramebuffer;
GLuint drawFramebuffer;
Program *program;
egl::Image *colorBuffer;
egl::Image *depthBuffer;
egl::Image *stencilBuffer;
VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
GLint unpackAlignment;
GLint packAlignment;
};
class Context : public egl::Context
{
public:
Context(const egl::Config *config, const Context *shareContext);
virtual void makeCurrent(egl::Surface *surface);
virtual void destroy();
virtual int getClientVersion();
void markAllStateDirty();
// State manipulation
void setClearColor(float red, float green, float blue, float alpha);
void setClearDepth(float depth);
void setClearStencil(int stencil);
void setCullFace(bool enabled);
bool isCullFaceEnabled() const;
void setCullMode(GLenum mode);
void setFrontFace(GLenum front);
void setDepthTest(bool enabled);
bool isDepthTestEnabled() const;
void setDepthFunc(GLenum depthFunc);
void setDepthRange(float zNear, float zFar);
void setBlend(bool enabled);
bool isBlendEnabled() const;
void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
void setBlendColor(float red, float green, float blue, float alpha);
void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
void setStencilTest(bool enabled);
bool isStencilTestEnabled() const;
void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
void setStencilWritemask(GLuint stencilWritemask);
void setStencilBackWritemask(GLuint stencilBackWritemask);
void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
void setPolygonOffsetFill(bool enabled);
bool isPolygonOffsetFillEnabled() const;
void setPolygonOffsetParams(GLfloat factor, GLfloat units);
void setSampleAlphaToCoverage(bool enabled);
bool isSampleAlphaToCoverageEnabled() const;
void setSampleCoverage(bool enabled);
bool isSampleCoverageEnabled() const;
void setSampleCoverageParams(GLclampf value, bool invert);
void setDither(bool enabled);
bool isDitherEnabled() const;
void setLineWidth(GLfloat width);
void setGenerateMipmapHint(GLenum hint);
void setFragmentShaderDerivativeHint(GLenum hint);
void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
void setScissorTest(bool enabled);
bool isScissorTestEnabled() const;
void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
void setColorMask(bool red, bool green, bool blue, bool alpha);
void setDepthMask(bool mask);
void setActiveSampler(unsigned int active);
void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
const VertexAttribute &getVertexAttribState(unsigned int attribNum);
void setVertexAttribState(unsigned int attribNum, sw::Resource *buffer, GLint size, GLenum type,
bool normalized, GLsizei stride, intptr_t offset);
void setUnpackAlignment(GLint alignment);
GLint getUnpackAlignment() const;
void setPackAlignment(GLint alignment);
GLint getPackAlignment() const;
void drawArrays(GLenum mode, GLint first, GLsizei count);
void drawElements(GLenum mode, GLsizei count, GLenum type, intptr_t offset);
void finish();
void flush();
void recordInvalidEnum();
void recordInvalidValue();
void recordInvalidOperation();
void recordOutOfMemory();
void recordInvalidFramebufferOperation();
GLenum getError();
static int getSupportedMultiSampleDepth(sw::Format format, int requested);
Device *getDevice();
public:
virtual ~Context();
bool applyRenderTarget();
void applyState(GLenum drawMode);
GLenum applyVertexBuffer(GLint base, GLint first);
void applyIndexBuffer();
void applyShaders();
void applyTexture(sw::SamplerType type, int sampler, Texture *texture);
bool cullSkipsDraw(GLenum drawMode);
bool isTriangleMode(GLenum drawMode);
const egl::Config *const mConfig;
State mState;
// Recorded errors
bool mInvalidEnum;
bool mInvalidValue;
bool mInvalidOperation;
bool mOutOfMemory;
bool mInvalidFramebufferOperation;
bool mHasBeenCurrent;
unsigned int mAppliedProgramSerial;
// state caching flags
bool mDepthStateDirty;
bool mMaskStateDirty;
bool mPixelPackingStateDirty;
bool mBlendStateDirty;
bool mStencilStateDirty;
bool mPolygonOffsetStateDirty;
bool mSampleStateDirty;
bool mFrontFaceDirty;
bool mDitherStateDirty;
Device *device;
};
}
#endif // INCLUDE_CONTEXT_H_
#ifndef egl_Context_hpp
#define egl_Context_hpp
#define EGLAPI
#include <EGL/egl.h>
#define GL_API
#include <GLES/gl.h>
namespace egl
{
class Surface;
class Image;
class Context
{
public:
virtual void destroy() = 0;
virtual void makeCurrent(Surface *surface) = 0;
virtual int getClientVersion() = 0;
};
}
#endif // egl_Context_hpp
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
#ifndef gl_Device_hpp
#define gl_Device_hpp
#include "Renderer/Renderer.hpp"
namespace egl
{
class Image;
}
namespace es2
{
class Texture;
class Image;
enum PrimitiveType
{
DRAW_POINTLIST,
DRAW_LINELIST,
DRAW_LINESTRIP,
DRAW_LINELOOP,
DRAW_TRIANGLELIST,
DRAW_TRIANGLESTRIP,
DRAW_TRIANGLEFAN
};
struct Viewport
{
int x0;
int y0;
unsigned int width;
unsigned int height;
float minZ;
float maxZ;
};
class Device : public sw::Renderer
{
public:
explicit Device(sw::Context *context);
virtual ~Device();
virtual void clearColor(unsigned int color, unsigned int rgbaMask);
virtual void clearDepth(float z);
virtual void clearStencil(unsigned int stencil, unsigned int mask);
virtual Image *createDepthStencilSurface(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
virtual Image *createRenderTarget(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool lockable);
virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize);
virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount);
virtual void setDepthStencilSurface(egl::Image *newDepthStencil);
virtual void setPixelShader(sw::PixelShader *shader);
virtual void setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
virtual void setScissorEnable(bool enable);
virtual void setRenderTarget(egl::Image *renderTarget);
virtual void setScissorRect(const sw::Rect &rect);
virtual void setVertexShader(sw::VertexShader *shader);
virtual void setVertexShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
virtual void setViewport(const Viewport &viewport);
virtual bool stretchRect(egl::Image *sourceSurface, const sw::SliceRect *sourceRect, egl::Image *destSurface, const sw::SliceRect *destRect, bool filter);
virtual void finish();
private:
sw::Context *const context;
bool bindResources();
void bindShaderConstants();
bool bindViewport(); // Also adjusts for scissoring
bool validRectangle(const sw::Rect *rect, egl::Image *surface);
Viewport viewport;
sw::Rect scissorRect;
bool scissorEnable;
sw::PixelShader *pixelShader;
sw::VertexShader *vertexShader;
bool pixelShaderDirty;
unsigned int pixelShaderConstantsFDirty;
bool vertexShaderDirty;
unsigned int vertexShaderConstantsFDirty;
float pixelShaderConstantF[FRAGMENT_UNIFORM_VECTORS][4];
float vertexShaderConstantF[VERTEX_UNIFORM_VECTORS][4];
egl::Image *renderTarget;
egl::Image *depthStencil;
};
}
#endif // gl_Device_hpp
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Display.h: Defines the egl::Display class, representing the abstract
// display on which graphics are drawn. Implements EGLDisplay.
// [EGL 1.4] section 2.1.2 page 3.
#ifndef INCLUDE_DISPLAY_H_
#define INCLUDE_DISPLAY_H_
#include "Config.h"
#include <set>
namespace egl
{
class Surface;
class Context;
class Display
{
public:
~Display();
static egl::Display *getDisplay(EGLNativeDisplayType displayId);
bool initialize();
void terminate();
bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
EGLSurface createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLint *attribList);
EGLSurface createOffscreenSurface(EGLConfig config, const EGLint *attribList);
EGLContext createContext(EGLConfig configHandle, const Context *shareContext, EGLint clientVersion);
void destroySurface(Surface *surface);
void destroyContext(Context *context);
bool isInitialized() const;
bool isValidConfig(EGLConfig config);
bool isValidContext(Context *context);
bool isValidSurface(Surface *surface);
bool isValidWindow(EGLNativeWindowType window);
bool hasExistingWindowSurface(EGLNativeWindowType window);
EGLint getMinSwapInterval();
EGLint getMaxSwapInterval();
EGLNativeDisplayType getNativeDisplay() const;
const char *getExtensionString() const;
public:
Display(EGLNativeDisplayType displayId);
DisplayMode getDisplayMode() const;
const EGLNativeDisplayType displayId;
EGLint mMaxSwapInterval;
EGLint mMinSwapInterval;
typedef std::set<Surface*> SurfaceSet;
SurfaceSet mSurfaceSet;
ConfigSet mConfigSet;
typedef std::set<Context*> ContextSet;
ContextSet mContextSet;
};
}
#endif // INCLUDE_DISPLAY_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Fence.cpp: Implements the Fence class, which supports the GL_NV_fence extension.
#include "Fence.h"
#include "main.h"
#include "Common/Thread.hpp"
namespace es2
{
Fence::Fence()
{
mQuery = false;
mCondition = GL_NONE;
mStatus = GL_FALSE;
}
Fence::~Fence()
{
mQuery = false;
}
GLboolean Fence::isFence()
{
// GL_NV_fence spec:
// A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
return mQuery;
}
void Fence::setFence(GLenum condition)
{
mQuery = true;
mCondition = condition;
mStatus = GL_FALSE;
}
GLboolean Fence::testFence()
{
if(!mQuery)
{
return rad::error(GL_INVALID_OPERATION, GL_TRUE);
}
UNIMPLEMENTED();
mStatus = GL_TRUE;
return mStatus;
}
void Fence::finishFence()
{
if(!mQuery)
{
return rad::error(GL_INVALID_OPERATION);
}
while(!testFence())
{
sw::Thread::yield();
}
}
void Fence::getFenceiv(GLenum pname, GLint *params)
{
if(!mQuery)
{
return rad::error(GL_INVALID_OPERATION);
}
switch (pname)
{
case GL_FENCE_STATUS_NV:
{
// GL_NV_fence spec:
// Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
// or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
if(mStatus)
{
params[0] = GL_TRUE;
return;
}
mStatus = testFence();
params[0] = mStatus;
break;
}
case GL_FENCE_CONDITION_NV:
params[0] = mCondition;
break;
default:
return rad::error(GL_INVALID_ENUM);
break;
}
}
}
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Fence.h: Defines the Fence class, which supports the GL_NV_fence extension.
#ifndef LIBGLESV2_FENCE_H_
#define LIBGLESV2_FENCE_H_
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
{
class Fence
{
public:
Fence();
virtual ~Fence();
GLboolean isFence();
void setFence(GLenum condition);
GLboolean testFence();
void finishFence();
void getFenceiv(GLenum pname, GLint *params);
private:
bool mQuery;
GLenum mCondition;
GLboolean mStatus;
};
}
#endif // LIBGLESV2_FENCE_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
#ifndef gl_Image_hpp
#define gl_Image_hpp
#include "Renderer/Surface.hpp"
#include "ImageEGL.hpp"
#define GL_APICALL
#include <GLES2/gl2.h>
namespace es2
{
class Texture;
class Image : public egl::Image
{
public:
Image(Texture *parentTexture, GLsizei width, GLsizei height, GLenum format, GLenum type);
Image(Texture *parentTexture, GLsizei width, GLsizei height, sw::Format internalFormat, int multiSampleDepth, bool lockable, bool renderTarget);
void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input);
void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
virtual void addRef();
virtual void release();
void unbind(); // Break parent ownership and release
static sw::Format selectInternalFormat(GLenum format, GLenum type);
private:
virtual ~Image();
void loadAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadLuminanceImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadLuminanceFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadLuminanceHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadLuminanceAlphaImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadLuminanceAlphaFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadLuminanceAlphaHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGB565ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBAUByteImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBA4444ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBA5551ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBAFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadRGBAHalfFloatImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadBGRAImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadD16ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadD32ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer) const;
void loadD24S8ImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, int inputPitch, const void *input, void *buffer);
Texture *parentTexture;
volatile int referenceCount;
};
}
#endif // gl_Image_hpp
#ifndef egl_Image_hpp
#define egl_Image_hpp
#include "Renderer/Surface.hpp"
namespace egl
{
// Types common between gl.h and gl2.h
// We can't include either header in EGL
typedef unsigned int GLenum;
typedef int GLint;
typedef int GLsizei;
class Image : public sw::Surface
{
public:
Image(sw::Resource *resource, GLsizei width, GLsizei height, GLenum format, GLenum type, sw::Format internalFormat)
: width(width), height(height), format(format), type(type), internalFormat(internalFormat), multiSampleDepth(1)
, sw::Surface(resource, width, height, 1, internalFormat, true, true)
{
shared = false;
}
Image(sw::Resource *resource, int width, int height, int depth, sw::Format internalFormat, bool lockable, bool renderTarget)
: width(width), height(height), format(0 /*GL_NONE*/), type(0 /*GL_NONE*/), internalFormat(internalFormat), multiSampleDepth(depth)
, sw::Surface(resource, width, height, depth, internalFormat, lockable, renderTarget)
{
shared = false;
}
GLsizei getWidth()
{
return width;
}
GLsizei getHeight()
{
return height;
}
GLenum getFormat()
{
return format;
}
GLenum getType()
{
return type;
}
sw::Format getInternalFormat()
{
return internalFormat;
}
int getMultiSampleDepth()
{
return multiSampleDepth;
}
bool isShared() const
{
return shared;
}
void markShared()
{
shared = true;
}
void *lock(unsigned int left, unsigned int top, sw::Lock lock)
{
return lockExternal(left, top, 0, lock, sw::PUBLIC);
}
unsigned int getPitch() const
{
return getExternalPitchB();
}
void unlock()
{
unlockExternal();
}
virtual void addRef() = 0;
virtual void release() = 0;
virtual void unbind() = 0; // Break parent ownership and release
virtual void loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *input) = 0;
virtual void loadCompressedData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels) = 0;
protected:
const GLsizei width;
const GLsizei height;
const GLenum format;
const GLenum type;
const sw::Format internalFormat;
const int multiSampleDepth;
private:
bool shared; // Used as an EGLImage
};
}
#endif // egl_Image_hpp
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Program.h: Defines the Program class. Implements GL program objects
// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
#ifndef LIBGLESV2_PROGRAM_H_
#define LIBGLESV2_PROGRAM_H_
#include "Shader.h"
#include "Context.h"
#include "Shader/PixelShader.hpp"
#include "Shader/VertexShader.hpp"
#include <string>
#include <vector>
#include <set>
namespace es2
{
class Device;
class FragmentShader;
class VertexShader;
// Helper struct representing a single shader uniform
struct Uniform
{
Uniform(GLenum type, GLenum precision, const std::string &name, unsigned int arraySize);
~Uniform();
bool isArray() const;
int size() const;
int registerCount() const;
const GLenum type;
const GLenum precision;
const std::string name;
const unsigned int arraySize;
unsigned char *data;
bool dirty;
short psRegisterIndex;
short vsRegisterIndex;
};
// Struct used for correlating uniforms/elements of uniform arrays to handles
struct UniformLocation
{
UniformLocation(const std::string &name, unsigned int element, unsigned int index);
std::string name;
unsigned int element;
unsigned int index;
};
enum TextureType
{
TEXTURE_2D,
TEXTURE_CUBE,
TEXTURE_EXTERNAL,
TEXTURE_TYPE_COUNT,
TEXTURE_UNKNOWN
};
class Program
{
public:
Program(GLuint handle);
~Program();
bool attachShader(Shader *shader);
bool detachShader(Shader *shader);
int getAttachedShadersCount() const;
sw::PixelShader *getPixelShader();
sw::VertexShader *getVertexShader();
void bindAttributeLocation(GLuint index, const char *name);
GLuint getAttributeLocation(const char *name);
int getAttributeStream(int attributeIndex);
GLint getSamplerMapping(sw::SamplerType type, unsigned int samplerIndex);
TextureType getSamplerTextureType(sw::SamplerType type, unsigned int samplerIndex);
GLint getUniformLocation(std::string name);
bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
bool setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
bool setUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
bool setUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
bool setUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
bool setUniform1iv(GLint location, GLsizei count, const GLint *v);
bool setUniform2iv(GLint location, GLsizei count, const GLint *v);
bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
void dirtyAllUniforms();
void applyUniforms();
void link();
bool isLinked();
int getInfoLogLength() const;
void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
GLint getActiveAttributeCount() const;
GLint getActiveAttributeMaxLength() const;
void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
GLint getActiveUniformCount() const;
GLint getActiveUniformMaxLength() const;
void addRef();
void release();
unsigned int getRefCount() const;
void flagForDeletion();
bool isFlaggedForDeletion() const;
void validate();
bool validateSamplers(bool logErrors);
bool isValidated() const;
unsigned int getSerial() const;
private:
void unlink();
int packVaryings(const glsl::Varying *packing[][4]);
bool linkVaryings();
bool linkAttributes();
int getAttributeBinding(const std::string &name);
bool linkUniforms(Shader *shader);
bool defineUniform(GLenum shader, GLenum type, GLenum precision, const std::string &_name, unsigned int arraySize, int registerIndex);
bool applyUniform1bv(GLint location, GLsizei count, const GLboolean *v);
bool applyUniform2bv(GLint location, GLsizei count, const GLboolean *v);
bool applyUniform3bv(GLint location, GLsizei count, const GLboolean *v);
bool applyUniform4bv(GLint location, GLsizei count, const GLboolean *v);
bool applyUniform1fv(GLint location, GLsizei count, const GLfloat *v);
bool applyUniform2fv(GLint location, GLsizei count, const GLfloat *v);
bool applyUniform3fv(GLint location, GLsizei count, const GLfloat *v);
bool applyUniform4fv(GLint location, GLsizei count, const GLfloat *v);
bool applyUniformMatrix2fv(GLint location, GLsizei count, const GLfloat *value);
bool applyUniformMatrix3fv(GLint location, GLsizei count, const GLfloat *value);
bool applyUniformMatrix4fv(GLint location, GLsizei count, const GLfloat *value);
bool applyUniform1iv(GLint location, GLsizei count, const GLint *v);
bool applyUniform2iv(GLint location, GLsizei count, const GLint *v);
bool applyUniform3iv(GLint location, GLsizei count, const GLint *v);
bool applyUniform4iv(GLint location, GLsizei count, const GLint *v);
void appendToInfoLog(const char *info, ...);
void resetInfoLog();
static unsigned int issueSerial();
private:
es2::Device *device;
FragmentShader *fragmentShader;
VertexShader *vertexShader;
sw::PixelShader *pixelBinary;
sw::VertexShader *vertexBinary;
std::set<std::string> attributeBinding[MAX_VERTEX_ATTRIBS];
glsl::Attribute linkedAttribute[MAX_VERTEX_ATTRIBS];
int attributeStream[MAX_VERTEX_ATTRIBS];
struct Sampler
{
bool active;
GLint logicalTextureUnit;
TextureType textureType;
};
Sampler samplersPS[MAX_TEXTURE_IMAGE_UNITS];
Sampler samplersVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS];
typedef std::vector<Uniform*> UniformArray;
UniformArray uniforms;
typedef std::vector<UniformLocation> UniformIndex;
UniformIndex uniformIndex;
bool linked;
bool orphaned; // Flag to indicate that the program can be deleted when no longer in use
char *infoLog;
bool validated;
unsigned int referenceCount;
const unsigned int serial;
static unsigned int currentSerial;
const GLuint handle;
};
}
#endif // LIBGLESV2_PROGRAM_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Shader.h: Defines the abstract Shader class and its concrete derived
// classes VertexShader and FragmentShader. Implements GL shader objects and
// related functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section
// 3.8 page 84.
#ifndef LIBGLESV2_SHADER_H_
#define LIBGLESV2_SHADER_H_
#include "../OpenGL/compiler/TranslatorASM.h"
#define GL_APICALL
#include <GLES2/gl2.h>
#include <list>
#include <vector>
namespace glsl
{
class OutputASM;
}
namespace es2
{
class Shader : public glsl::Shader
{
friend class Program;
public:
Shader(GLuint handle);
virtual ~Shader();
virtual GLenum getType() = 0;
GLuint getName() const;
void deleteSource();
void setSource(GLsizei count, const char *const *string, const GLint *length);
int getInfoLogLength() const;
void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
int getSourceLength() const;
void getSource(GLsizei bufSize, GLsizei *length, char *source);
virtual void compile() = 0;
bool isCompiled();
void addRef();
void release();
unsigned int getRefCount() const;
bool isFlaggedForDeletion() const;
void flagForDeletion();
static void releaseCompiler();
protected:
static bool compilerInitialized;
TranslatorASM *createCompiler(GLenum type);
void clear();
static GLenum parseType(const std::string &type);
static bool compareVarying(const glsl::Varying &x, const glsl::Varying &y);
char *mSource;
char *mInfoLog;
private:
const GLuint mHandle;
unsigned int mRefCount; // Number of program objects this shader is attached to
bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
};
class VertexShader : public Shader
{
friend class Program;
public:
VertexShader(GLuint handle);
~VertexShader();
virtual GLenum getType();
virtual void compile();
int getSemanticIndex(const std::string &attributeName);
virtual sw::Shader *getShader() const;
virtual sw::VertexShader *getVertexShader() const;
private:
sw::VertexShader *vertexShader;
};
class FragmentShader : public Shader
{
public:
FragmentShader(GLuint handle);
~FragmentShader();
virtual GLenum getType();
virtual void compile();
virtual sw::Shader *getShader() const;
virtual sw::PixelShader *getPixelShader() const;
private:
sw::PixelShader *pixelShader;
};
}
#endif // LIBGLESV2_SHADER_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
// such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
#include "Surface.h"
#include "main.h"
#include "Display.h"
#include "TextureEGL.hpp"
#include "Image.hpp"
#include "Context.hpp"
#include "common/debug.h"
#include "Main/FrameBuffer.hpp"
#if defined(_WIN32)
#include <tchar.h>
#endif
#include <algorithm>
extern "C"
{
es2::Image *createBackBuffer(int width, int height, const egl::Config *config);
es2::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard);
}
#if defined(_WIN32)
sw::FrameBuffer *createFrameBuffer(HDC display, HWND window, int width, int height);
#else
sw::FrameBuffer *createFrameBuffer(Display *display, Window window, int width, int height);
#endif
namespace egl
{
Surface::Surface(Display *display, const Config *config, EGLNativeWindowType window)
: mDisplay(display), mConfig(config), mWindow(window)
{
frameBuffer = 0;
backBuffer = 0;
mDepthStencil = NULL;
mTexture = NULL;
mTextureFormat = EGL_NO_TEXTURE;
mTextureTarget = EGL_NO_TEXTURE;
mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING); // FIXME: Determine actual pixel aspect ratio
mRenderBuffer = EGL_BACK_BUFFER;
mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1;
setSwapInterval(1);
}
Surface::Surface(Display *display, const Config *config, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType)
: mDisplay(display), mWindow(NULL), mConfig(config), mWidth(width), mHeight(height)
{
frameBuffer = 0;
backBuffer = 0;
mDepthStencil = NULL;
mWindowSubclassed = false;
mTexture = NULL;
mTextureFormat = textureFormat;
mTextureTarget = textureType;
mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING); // FIXME: Determine actual pixel aspect ratio
mRenderBuffer = EGL_BACK_BUFFER;
mSwapBehavior = EGL_BUFFER_PRESERVED;
mSwapInterval = -1;
setSwapInterval(1);
}
Surface::~Surface()
{
release();
}
bool Surface::initialize()
{
ASSERT(!frameBuffer && !backBuffer && !mDepthStencil);
return reset();
}
void Surface::release()
{
if(mDepthStencil)
{
mDepthStencil->release();
mDepthStencil = NULL;
}
if(backBuffer)
{
backBuffer->release();
backBuffer = 0;
}
delete frameBuffer;
frameBuffer = 0;
}
bool Surface::reset()
{
if(!mWindow)
{
return reset(mWidth, mHeight);
}
// FIXME: Wrap into an abstract Window class
#if defined(_WIN32)
RECT windowRect;
GetClientRect(mWindow, &windowRect);
return reset(windowRect.right - windowRect.left, windowRect.bottom - windowRect.top);
#else
XWindowAttributes windowAttributes;
XGetWindowAttributes(mDisplay->getNativeDisplay(), mWindow, &windowAttributes);
return reset(windowAttributes.width, windowAttributes.height);
#endif
}
bool Surface::reset(int backBufferWidth, int backBufferHeight)
{
release();
if(mWindow)
{
frameBuffer = createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight);
if(!frameBuffer)
{
ERR("Could not create frame buffer");
release();
return error(EGL_BAD_ALLOC, false);
}
}
backBuffer = createBackBuffer(backBufferWidth, backBufferHeight, mConfig);
if(!backBuffer)
{
ERR("Could not create back buffer");
release();
return error(EGL_BAD_ALLOC, false);
}
if(mConfig->mDepthStencilFormat != sw::FORMAT_NULL)
{
mDepthStencil = createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false);
if(!mDepthStencil)
{
ERR("Could not create depth/stencil buffer for surface");
release();
return error(EGL_BAD_ALLOC, false);
}
}
mWidth = backBufferWidth;
mHeight = backBufferHeight;
return true;
}
EGLNativeWindowType Surface::getWindowHandle()
{
return mWindow;
}
void Surface::swap()
{
if(backBuffer)
{
void *source = backBuffer->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
frameBuffer->flip(source, backBuffer->getInternalFormat());
backBuffer->unlockInternal();
checkForResize();
}
}
egl::Image *Surface::getRenderTarget()
{
if(backBuffer)
{
backBuffer->addRef();
}
return backBuffer;
}
egl::Image *Surface::getDepthStencil()
{
if(mDepthStencil)
{
mDepthStencil->addRef();
}
return mDepthStencil;
}
void Surface::setSwapInterval(EGLint interval)
{
if(mSwapInterval == interval)
{
return;
}
mSwapInterval = interval;
mSwapInterval = std::max(mSwapInterval, mDisplay->getMinSwapInterval());
mSwapInterval = std::min(mSwapInterval, mDisplay->getMaxSwapInterval());
}
EGLint Surface::getConfigID() const
{
return mConfig->mConfigID;
}
EGLint Surface::getWidth() const
{
return mWidth;
}
EGLint Surface::getHeight() const
{
return mHeight;
}
EGLint Surface::getPixelAspectRatio() const
{
return mPixelAspectRatio;
}
EGLenum Surface::getRenderBuffer() const
{
return mRenderBuffer;
}
EGLenum Surface::getSwapBehavior() const
{
return mSwapBehavior;
}
EGLenum Surface::getTextureFormat() const
{
return mTextureFormat;
}
EGLenum Surface::getTextureTarget() const
{
return mTextureTarget;
}
void Surface::setBoundTexture(egl::Texture2D *texture)
{
mTexture = texture;
}
egl::Texture2D *Surface::getBoundTexture() const
{
return mTexture;
}
sw::Format Surface::getInternalFormat() const
{
return mConfig->mRenderTargetFormat;
}
bool Surface::checkForResize()
{
#if defined(_WIN32)
RECT client;
if(!GetClientRect(mWindow, &client))
{
ASSERT(false);
return false;
}
int clientWidth = client.right - client.left;
int clientHeight = client.bottom - client.top;
#else
XWindowAttributes windowAttributes;
XGetWindowAttributes(mDisplay->getNativeDisplay(), mWindow, &windowAttributes);
int clientWidth = windowAttributes.width;
int clientHeight = windowAttributes.height;
#endif
bool sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
if(sizeDirty)
{
reset(clientWidth, clientHeight);
if(static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{
static_cast<egl::Context*>(getCurrentContext())->makeCurrent(this);
}
return true;
}
return false;
}
}
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Surface.h: Defines the egl::Surface class, representing a drawing surface
// such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
#ifndef INCLUDE_SURFACE_H_
#define INCLUDE_SURFACE_H_
#include "Main/FrameBuffer.hpp"
#define EGLAPI
#include <EGL/egl.h>
namespace egl
{
class Display;
class Config;
class Texture2D;
class Image;
class Surface
{
public:
Surface(Display *display, const egl::Config *config, EGLNativeWindowType window);
Surface(Display *display, const egl::Config *config, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
virtual ~Surface();
bool initialize();
void swap();
EGLNativeWindowType getWindowHandle();
virtual egl::Image *getRenderTarget();
virtual egl::Image *getDepthStencil();
void setSwapInterval(EGLint interval);
virtual EGLint getConfigID() const;
virtual EGLint getWidth() const;
virtual EGLint getHeight() const;
virtual EGLint getPixelAspectRatio() const;
virtual EGLenum getRenderBuffer() const;
virtual EGLenum getSwapBehavior() const;
virtual EGLenum getTextureFormat() const;
virtual EGLenum getTextureTarget() const;
virtual sw::Format getInternalFormat() const;
virtual void setBoundTexture(egl::Texture2D *texture);
virtual egl::Texture2D *getBoundTexture() const;
bool checkForResize(); // Returns true if surface changed due to resize
public:
void release();
bool reset();
Display *const mDisplay;
egl::Image *mDepthStencil;
sw::FrameBuffer *frameBuffer;
egl::Image *backBuffer;
egl::Texture2D *mTexture;
bool reset(int backbufferWidth, int backbufferHeight);
const EGLNativeWindowType mWindow; // Window that the surface is created for.
bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
const egl::Config *mConfig; // EGL config surface was created with
EGLint mHeight; // Height of surface
EGLint mWidth; // Width of surface
// EGLint horizontalResolution; // Horizontal dot pitch
// EGLint verticalResolution; // Vertical dot pitch
// EGLBoolean largestPBuffer; // If true, create largest pbuffer possible
// EGLBoolean mipmapTexture; // True if texture has mipmaps
// EGLint mipmapLevel; // Mipmap level to render to
// EGLenum multisampleResolve; // Multisample resolve behavior
EGLint mPixelAspectRatio; // Display aspect ratio
EGLenum mRenderBuffer; // Render buffer
EGLenum mSwapBehavior; // Buffer swap behavior
EGLenum mTextureFormat; // Format of texture: RGB, RGBA, or no texture
EGLenum mTextureTarget; // Type of texture: 2D or no texture
// EGLenum vgAlphaFormat; // Alpha format for OpenVG
// EGLenum vgColorSpace; // Color space for OpenVG
EGLint mSwapInterval;
};
}
#endif // INCLUDE_SURFACE_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// Texture.h: Defines the abstract Texture class and its concrete derived
// classes Texture2D and TextureCubeMap. Implements GL texture objects and
// related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
#ifndef LIBGLESV2_TEXTURE_H_
#define LIBGLESV2_TEXTURE_H_
#include "utilities.h"
#include "TextureEGL.hpp"
#include "common/debug.h"
#define GL_APICALL
#include <GLES2/gl2.h>
#include <vector>
namespace egl
{
class Surface;
class Config;
}
namespace es2
{
class Framebuffer;
enum
{
IMPLEMENTATION_MAX_TEXTURE_LEVELS = MIPMAP_LEVELS,
IMPLEMENTATION_MAX_TEXTURE_SIZE = 1 << (MIPMAP_LEVELS - 1),
IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 1 << (MIPMAP_LEVELS - 1),
IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = OUTLINE_RESOLUTION,
IMPLEMENTATION_MAX_SAMPLES = 4
};
class Texture : public egl::Texture
{
public:
explicit Texture();
virtual ~Texture();
virtual void addRef();
virtual void release();
sw::Resource *getResource() const;
virtual GLenum getTarget() const = 0;
bool setMinFilter(GLenum filter);
bool setMagFilter(GLenum filter);
bool setWrapS(GLenum wrap);
bool setWrapT(GLenum wrap);
bool setMaxAnisotropy(GLfloat textureMaxAnisotropy);
GLenum getMinFilter() const;
GLenum getMagFilter() const;
GLenum getWrapS() const;
GLenum getWrapT() const;
GLfloat getMaxAnisotropy() const;
virtual GLsizei getWidth(GLenum target, GLint level) const = 0;
virtual GLsizei getHeight(GLenum target, GLint level) const = 0;
virtual GLenum getFormat(GLenum target, GLint level) const = 0;
virtual GLenum getType(GLenum target, GLint level) const = 0;
virtual sw::Format getInternalFormat(GLenum target, GLint level) const = 0;
virtual int getLevelCount() const = 0;
virtual bool isSamplerComplete() const = 0;
virtual bool isCompressed(GLenum target, GLint level) const = 0;
virtual bool isDepth(GLenum target, GLint level) const = 0;
virtual egl::Image *getRenderTarget(GLenum target, unsigned int level) = 0;
virtual egl::Image *createSharedImage(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const = 0;
virtual void generateMipmaps() = 0;
protected:
void setImage(GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image);
void subImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels, egl::Image *image);
void setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image);
void subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image);
bool copy(egl::Image *source, const sw::Rect &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, egl::Image *dest);
bool isMipmapFiltered() const;
GLenum mMinFilter;
GLenum mMagFilter;
GLenum mWrapS;
GLenum mWrapT;
GLfloat mMaxAnisotropy;
sw::Resource *resource;
volatile int referenceCount;
};
class Texture2D : public Texture
{
public:
explicit Texture2D();
virtual ~Texture2D();
virtual GLenum getTarget() const;
virtual GLsizei getWidth(GLenum target, GLint level) const;
virtual GLsizei getHeight(GLenum target, GLint level) const;
virtual GLenum getFormat(GLenum target, GLint level) const;
virtual GLenum getType(GLenum target, GLint level) const;
virtual sw::Format getInternalFormat(GLenum target, GLint level) const;
virtual int getLevelCount() const;
void setImage(GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
virtual bool isSamplerComplete() const;
virtual bool isCompressed(GLenum target, GLint level) const;
virtual bool isDepth(GLenum target, GLint level) const;
virtual void generateMipmaps();
virtual egl::Image *getRenderTarget(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const;
egl::Image *getImage(unsigned int level);
protected:
bool isMipmapComplete() const;
egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
egl::Surface *mSurface;
};
class TextureCubeMap : public Texture
{
public:
explicit TextureCubeMap();
virtual ~TextureCubeMap();
virtual GLenum getTarget() const;
virtual GLsizei getWidth(GLenum target, GLint level) const;
virtual GLsizei getHeight(GLenum target, GLint level) const;
virtual GLenum getFormat(GLenum target, GLint level) const;
virtual GLenum getType(GLenum target, GLint level) const;
virtual sw::Format getInternalFormat(GLenum target, GLint level) const;
virtual int getLevelCount() const;
void setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels);
void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
virtual bool isSamplerComplete() const;
virtual bool isCompressed(GLenum target, GLint level) const;
virtual bool isDepth(GLenum target, GLint level) const;
virtual void generateMipmaps();
virtual Image *getRenderTarget(GLenum target, unsigned int level);
virtual bool isShared(GLenum target, unsigned int level) const;
Image *getImage(int face, unsigned int level);
private:
bool isCubeComplete() const;
bool isMipmapCubeComplete() const;
// face is one of the GL_TEXTURE_CUBE_MAP_* enumerants. Returns NULL on failure.
Image *getImage(GLenum face, unsigned int level);
Image *image[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
};
}
#endif // LIBGLESV2_TEXTURE_H_
#ifndef egl_TextureEGL_hpp
#define egl_TextureEGL_hpp
namespace egl
{
class Texture
{
public:
};
}
#endif // egl_TextureEGL_hpp
{
global:
radGetProcAddress;
eglBindAPI;
eglChooseConfig;
eglCreateContext;
eglCreateWindowSurface;
eglGetDisplay;
eglGetError;
eglGetProcAddress;
eglInitialize;
eglMakeCurrent;
eglTerminate;
Register;
local:
*;
};
LIBRARY libRAD
EXPORTS
radGetProcAddress
eglBindAPI
eglChooseConfig
eglCreateContext
eglCreateWindowSurface
eglGetDisplay
eglGetError
eglGetProcAddress
eglInitialize
eglMakeCurrent
eglTerminate
Register
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h>
#include "../../common/Version.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""../common/version.h""\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
#ifdef WIN64
VALUE "FileDescription", "SwiftShader libRAD 64-bit Dynamic Link Library"
#else
VALUE "FileDescription", "SwiftShader libRAD 32-bit Dynamic Link Library"
#endif
VALUE "FileDescription", "SwiftShader libRAD Dynamic Link Library"
VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", "libRAD"
VALUE "LegalCopyright", "Copyright (C) 2014 Google Inc."
VALUE "OriginalFilename", "libRAD.dll"
VALUE "PrivateBuild", VERSION_STRING
VALUE "ProductName", "SwiftShader libRAD Dynamic Link Library"
VALUE "ProductVersion", VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOGEX 0, 0, 129, 47
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Waiting for debugger"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Cancel",IDCANCEL,72,26,50,14
LTEXT "Attach a debugger or ESC to cancel",IDC_STATIC,7,7,115,8
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 122
TOPMARGIN, 7
BOTTOMMARGIN, 40
END
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Context.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\common\debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Fence.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="libRAD.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Program.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Shader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Texture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utilities.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Device.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Image.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Config.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Display.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="libEGL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Surface.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Context.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Fence.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="main.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="mathutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Program.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Shader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Texture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="utilities.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Device.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Image.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\GLES2\gl2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\GLES2\gl2ext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\GLES2\gl2platform.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\common\debug.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Context.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Display.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ImageEGL.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="mainEGL.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Surface.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TextureEGL.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="libRAD.rc" />
</ItemGroup>
<ItemGroup>
<None Include="libRAD.def" />
</ItemGroup>
</Project>
\ No newline at end of file
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// main.cpp: DLL entry point and management of thread-local data.
#include "main.h"
#include "Surface.h"
#include "Common/Thread.hpp"
#include "Common/SharedLibrary.hpp"
#include "common/debug.h"
#include "resource.h"
static sw::Thread::LocalStorageKey currentTLS = TLS_OUT_OF_INDEXES;
#if !defined(_MSC_VER)
#define CONSTRUCTOR __attribute__((constructor))
#define DESTRUCTOR __attribute__((destructor))
#else
#define CONSTRUCTOR
#define DESTRUCTOR
#endif
static void eglAttachThread()
{
TRACE("()");
egl::Current *current = new egl::Current;
if(current)
{
sw::Thread::setLocalStorage(currentTLS, current);
current->error = EGL_SUCCESS;
current->API = EGL_OPENGL_ES_API;
current->display = EGL_NO_DISPLAY;
current->drawSurface = EGL_NO_SURFACE;
current->readSurface = EGL_NO_SURFACE;
current->context = EGL_NO_CONTEXT;
}
}
static void eglDetachThread()
{
TRACE("()");
egl::Current *current = (egl::Current*)sw::Thread::getLocalStorage(currentTLS);
if(current)
{
delete current;
}
}
CONSTRUCTOR static void eglAttachProcess()
{
TRACE("()");
#if !defined(ANGLE_DISABLE_TRACE)
FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
if(debug)
{
fclose(debug);
debug = fopen(TRACE_OUTPUT_FILE, "wt"); // Erase
fclose(debug);
}
#endif
currentTLS = sw::Thread::allocateLocalStorageKey();
if(currentTLS == TLS_OUT_OF_INDEXES)
{
return;
}
eglAttachThread();
}
DESTRUCTOR static void eglDetachProcess()
{
TRACE("()");
eglDetachThread();
sw::Thread::freeLocalStorageKey(currentTLS);
}
#if defined(_WIN32)
static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RECT rect;
switch(uMsg)
{
case WM_INITDIALOG:
GetWindowRect(GetDesktopWindow(), &rect);
SetWindowPos(hwnd, HWND_TOP, rect.right / 2, rect.bottom / 2, 0, 0, SWP_NOSIZE);
SetTimer(hwnd, 1, 100, NULL);
return TRUE;
case WM_COMMAND:
if(LOWORD(wParam) == IDCANCEL)
{
EndDialog(hwnd, 0);
}
break;
case WM_TIMER:
if(IsDebuggerPresent())
{
EndDialog(hwnd, 0);
}
}
return FALSE;
}
static void WaitForDebugger(HINSTANCE instance)
{
if(!IsDebuggerPresent())
{
HRSRC dialog = FindResource(instance, MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG);
DLGTEMPLATE *dialogTemplate = (DLGTEMPLATE*)LoadResource(instance, dialog);
DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc);
}
}
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
#ifndef NDEBUG
WaitForDebugger(instance);
#endif
eglAttachProcess();
break;
case DLL_THREAD_ATTACH:
eglAttachThread();
break;
case DLL_THREAD_DETACH:
eglDetachThread();
break;
case DLL_PROCESS_DETACH:
eglDetachProcess();
break;
default:
break;
}
return TRUE;
}
#endif
namespace egl
{
static Current *eglGetCurrent(void)
{
Current *current = (Current*)sw::Thread::getLocalStorage(currentTLS);
if(!current)
{
eglAttachThread();
}
return (Current*)sw::Thread::getLocalStorage(currentTLS);
}
void setCurrentError(EGLint error)
{
Current *current = eglGetCurrent();
current->error = error;
}
EGLint getCurrentError()
{
Current *current = eglGetCurrent();
return current->error;
}
void setCurrentAPI(EGLenum API)
{
Current *current = eglGetCurrent();
current->API = API;
}
EGLenum getCurrentAPI()
{
Current *current = eglGetCurrent();
return current->API;
}
void setCurrentDisplay(EGLDisplay dpy)
{
Current *current = eglGetCurrent();
current->display = dpy;
}
EGLDisplay getCurrentDisplay()
{
Current *current = eglGetCurrent();
return current->display;
}
void setCurrentContext(EGLContext ctx)
{
Current *current = eglGetCurrent();
current->context = ctx;
}
EGLContext getCurrentContext()
{
Current *current = eglGetCurrent();
return current->context;
}
void setCurrentDrawSurface(EGLSurface surface)
{
Current *current = eglGetCurrent();
current->drawSurface = surface;
}
EGLSurface getCurrentDrawSurface()
{
Current *current = eglGetCurrent();
return current->drawSurface;
}
void setCurrentReadSurface(EGLSurface surface)
{
Current *current = eglGetCurrent();
current->readSurface = surface;
}
EGLSurface getCurrentReadSurface()
{
Current *current = eglGetCurrent();
return current->readSurface;
}
}
namespace egl
{
void error(EGLint errorCode)
{
egl::setCurrentError(errorCode);
if(errorCode != EGL_SUCCESS)
{
switch(errorCode)
{
case EGL_NOT_INITIALIZED: TRACE("\t! Error generated: not initialized\n"); break;
case EGL_BAD_ACCESS: TRACE("\t! Error generated: bad access\n"); break;
case EGL_BAD_ALLOC: TRACE("\t! Error generated: bad alloc\n"); break;
case EGL_BAD_ATTRIBUTE: TRACE("\t! Error generated: bad attribute\n"); break;
case EGL_BAD_CONFIG: TRACE("\t! Error generated: bad config\n"); break;
case EGL_BAD_CONTEXT: TRACE("\t! Error generated: bad context\n"); break;
case EGL_BAD_CURRENT_SURFACE: TRACE("\t! Error generated: bad current surface\n"); break;
case EGL_BAD_DISPLAY: TRACE("\t! Error generated: bad display\n"); break;
case EGL_BAD_MATCH: TRACE("\t! Error generated: bad match\n"); break;
case EGL_BAD_NATIVE_PIXMAP: TRACE("\t! Error generated: bad native pixmap\n"); break;
case EGL_BAD_NATIVE_WINDOW: TRACE("\t! Error generated: bad native window\n"); break;
case EGL_BAD_PARAMETER: TRACE("\t! Error generated: bad parameter\n"); break;
case EGL_BAD_SURFACE: TRACE("\t! Error generated: bad surface\n"); break;
case EGL_CONTEXT_LOST: TRACE("\t! Error generated: context lost\n"); break;
default: TRACE("\t! Error generated: <0x%X>\n", errorCode); break;
}
}
}
}
extern "C"
{
EGLContext clientGetCurrentContext()
{
return egl::getCurrentContext();
}
EGLContext clientGetCurrentDisplay()
{
return egl::getCurrentDisplay();
}
}
namespace es2
{
es2::Context *getContext()
{
egl::Context *context = static_cast<egl::Context*>(egl::getCurrentContext());
if(context && context->getClientVersion() == 2)
{
return static_cast<es2::Context*>(context);
}
return 0;
}
egl::Display *getDisplay()
{
return static_cast<egl::Display*>(egl::getCurrentDisplay());
}
Device *getDevice()
{
Context *context = getContext();
return context ? context->getDevice() : 0;
}
}
namespace egl
{
GLint getClientVersion()
{
Context *context = static_cast<egl::Context*>(egl::getCurrentContext());
return context ? context->getClientVersion() : 0;
}
}
namespace rad
{
// Records an error code
void error(GLenum errorCode)
{
es2::Context *context = es2::getContext();
if(context)
{
switch(errorCode)
{
case GL_INVALID_ENUM:
context->recordInvalidEnum();
TRACE("\t! Error generated: invalid enum\n");
break;
case GL_INVALID_VALUE:
context->recordInvalidValue();
TRACE("\t! Error generated: invalid value\n");
break;
case GL_INVALID_OPERATION:
context->recordInvalidOperation();
TRACE("\t! Error generated: invalid operation\n");
break;
case GL_OUT_OF_MEMORY:
context->recordOutOfMemory();
TRACE("\t! Error generated: out of memory\n");
break;
case GL_INVALID_FRAMEBUFFER_OPERATION:
context->recordInvalidFramebufferOperation();
TRACE("\t! Error generated: invalid framebuffer operation\n");
break;
default: UNREACHABLE();
}
}
}
}
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// main.h: Management of thread-local data.
#ifndef LIBGLESV2_MAIN_H_
#define LIBGLESV2_MAIN_H_
#include "Context.h"
#include "Device.hpp"
#include "common/debug.h"
#include "Display.h"
#define GL_APICALL
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
namespace es2
{
Context *getContext();
egl::Display *getDisplay();
Device *getDevice();
}
namespace egl
{
GLint getClientVersion();
}
namespace rad
{
void error(GLenum errorCode);
template<class T>
const T &error(GLenum errorCode, const T &returnValue)
{
error(errorCode);
return returnValue;
}
}
#define EGLAPI
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <RAD/rad.h>
namespace egl
{
struct Current
{
EGLint error;
EGLenum API;
EGLDisplay display;
EGLContext context;
EGLSurface drawSurface;
EGLSurface readSurface;
};
void setCurrentError(EGLint error);
EGLint getCurrentError();
void setCurrentAPI(EGLenum API);
EGLenum getCurrentAPI();
void setCurrentDisplay(EGLDisplay dpy);
EGLDisplay getCurrentDisplay();
void setCurrentContext(EGLContext ctx);
EGLContext getCurrentContext();
void setCurrentDrawSurface(EGLSurface surface);
EGLSurface getCurrentDrawSurface();
void setCurrentReadSurface(EGLSurface surface);
EGLSurface getCurrentReadSurface();
void error(EGLint errorCode);
template<class T>
const T &error(EGLint errorCode, const T &returnValue)
{
error(errorCode);
return returnValue;
}
template<class T>
const T &success(const T &returnValue)
{
egl::setCurrentError(EGL_SUCCESS);
return returnValue;
}
class Config;
class Surface;
class Display;
class Context;
class Image;
}
#endif // LIBGLESV2_MAIN_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// main.h: Management of thread-local data.
#ifndef LIBEGL_MAIN_H_
#define LIBEGL_MAIN_H_
namespace sw
{
class FrameBuffer;
enum Format : unsigned char;
}
#endif // LIBEGL_MAIN_H_
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2012 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// mathutil.h: Math and bit manipulation functions.
#ifndef LIBGLESV2_MATHUTIL_H_
#define LIBGLESV2_MATHUTIL_H_
#include "common/debug.h"
#include <math.h>
namespace es2
{
inline bool isPow2(int x)
{
return (x & (x - 1)) == 0 && (x != 0);
}
inline int log2(int x)
{
int r = 0;
while((x >> r) > 1) r++;
return r;
}
inline unsigned int ceilPow2(unsigned int x)
{
if(x != 0) x--;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x++;
return x;
}
template<typename T, typename MIN, typename MAX>
inline T clamp(T x, MIN min, MAX max)
{
return x < min ? min : (x > max ? max : x);
}
inline float clamp01(float x)
{
return clamp(x, 0.0f, 1.0f);
}
template<const int n>
inline unsigned int unorm(float x)
{
const unsigned int max = 0xFFFFFFFF >> (32 - n);
if(x > 1)
{
return max;
}
else if(x < 0)
{
return 0;
}
else
{
return (unsigned int)(max * x + 0.5f);
}
}
}
#endif // LIBGLESV2_MATHUTIL_H_
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by libRAD.rc
//
#define IDD_DIALOG1 101
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
// SwiftShader Software Renderer
//
// Copyright(c) 2005-2013 TransGaming Inc.
//
// All rights reserved. No part of this software may be copied, distributed, transmitted,
// transcribed, stored in a retrieval system, translated into any human or computer
// language by any means, or disclosed to third parties without the explicit written
// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express
// or implied, including but not limited to any patent rights, are granted to you.
//
// utilities.h: Conversion functions and other utility routines.
#ifndef LIBGLESV2_UTILITIES_H
#define LIBGLESV2_UTILITIES_H
#include "Device.hpp"
#include "Image.hpp"
#include "Texture.h"
#define GL_APICALL
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <string>
namespace es2
{
struct Color;
int UniformComponentCount(GLenum type);
GLenum UniformComponentType(GLenum type);
size_t UniformTypeSize(GLenum type);
int VariableRowCount(GLenum type);
int VariableColumnCount(GLenum type);
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
int ComputePixelSize(GLenum format, GLenum type);
GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment);
GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);
GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);
bool IsCompressed(GLenum format);
bool IsDepthTexture(GLenum format);
bool IsStencilTexture(GLenum format);
bool IsCubemapTextureTarget(GLenum target);
int CubeFaceIndex(GLenum cubeTarget);
bool IsTextureTarget(GLenum target);
bool CheckTextureFormatType(GLenum format, GLenum type);
bool IsColorRenderable(GLenum internalformat);
bool IsDepthRenderable(GLenum internalformat);
bool IsStencilRenderable(GLenum internalformat);
}
namespace rad2sw
{
sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);
sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);
sw::Color<float> ConvertColor(es2::Color color);
sw::BlendFactor ConvertBlendFunc(GLenum blend);
sw::BlendOperation ConvertBlendOp(GLenum blendOp);
sw::StencilOperation ConvertStencilOp(GLenum stencilOp);
sw::AddressingMode ConvertTextureWrap(GLenum wrap);
sw::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace);
unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
sw::FilterType ConvertMagFilter(GLenum magFilter);
void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);
bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, es2::PrimitiveType &swPrimitiveType, int &primitiveCount);
sw::Format ConvertRenderbufferFormat(GLenum format);
}
namespace sw2rad
{
GLuint GetAlphaSize(sw::Format colorFormat);
GLuint GetRedSize(sw::Format colorFormat);
GLuint GetGreenSize(sw::Format colorFormat);
GLuint GetBlueSize(sw::Format colorFormat);
GLuint GetDepthSize(sw::Format depthFormat);
GLuint GetStencilSize(sw::Format stencilFormat);
GLenum ConvertBackBufferFormat(sw::Format format);
GLenum ConvertDepthStencilFormat(sw::Format format);
}
#endif // LIBGLESV2_UTILITIES_H
......@@ -238,15 +238,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OGLESBasicTnL", "..\tests\t
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{B7E24D8E-6BE9-4DEF-A8B9-6A6E60CA60E9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libRAD", "Radiance\libRAD\libRAD.vcxproj", "{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Radiance", "Radiance", "{CA0EBD66-3F60-4F3D-8143-B31F14458B40}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rad", "..\tests\HelloRAD\rad.vcxproj", "{B4537008-1302-4EE7-98C8-6897472B9E36}"
ProjectSection(ProjectDependencies) = postProject
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD} = {A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGL", "OpenGL\libGL\libGL.vcxproj", "{3EF851E7-4AAB-4C7C-9A79-3122CEA1EB67}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OGLES2ColourGrading", "..\tests\third_party\PowerVR\Examples\Intermediate\ColourGrading\OGLES2\Build\WindowsVC2010\OGLES2ColourGrading.vcxproj", "{9F14A82C-19FD-4A8A-B4FF-FF00FFF6F2DD}"
......@@ -666,30 +657,6 @@ Global
{AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|Win32.Build.0 = Release|Win32
{AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|x64.ActiveCfg = Release|x64
{AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5}.Release|x64.Build.0 = Release|x64
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Debug|Win32.ActiveCfg = Debug|Win32
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Debug|Win32.Build.0 = Debug|Win32
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Debug|x64.ActiveCfg = Debug|x64
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Debug|x64.Build.0 = Debug|x64
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Profile|Win32.ActiveCfg = Profile|Win32
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Profile|Win32.Build.0 = Profile|Win32
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Profile|x64.ActiveCfg = Profile|x64
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Profile|x64.Build.0 = Profile|x64
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Release|Win32.ActiveCfg = Release|Win32
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Release|Win32.Build.0 = Release|Win32
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Release|x64.ActiveCfg = Release|x64
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD}.Release|x64.Build.0 = Release|x64
{B4537008-1302-4EE7-98C8-6897472B9E36}.Debug|Win32.ActiveCfg = Debug|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Debug|Win32.Build.0 = Debug|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Debug|x64.ActiveCfg = Debug|x64
{B4537008-1302-4EE7-98C8-6897472B9E36}.Debug|x64.Build.0 = Debug|x64
{B4537008-1302-4EE7-98C8-6897472B9E36}.Profile|Win32.ActiveCfg = Release|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Profile|Win32.Build.0 = Release|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Profile|x64.ActiveCfg = Release|x64
{B4537008-1302-4EE7-98C8-6897472B9E36}.Profile|x64.Build.0 = Release|x64
{B4537008-1302-4EE7-98C8-6897472B9E36}.Release|Win32.ActiveCfg = Release|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Release|Win32.Build.0 = Release|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Release|x64.ActiveCfg = Release|x64
{B4537008-1302-4EE7-98C8-6897472B9E36}.Release|x64.Build.0 = Release|x64
{3EF851E7-4AAB-4C7C-9A79-3122CEA1EB67}.Debug|Win32.ActiveCfg = Debug|Win32
{3EF851E7-4AAB-4C7C-9A79-3122CEA1EB67}.Debug|Win32.Build.0 = Debug|Win32
{3EF851E7-4AAB-4C7C-9A79-3122CEA1EB67}.Debug|x64.ActiveCfg = Debug|x64
......@@ -763,8 +730,6 @@ Global
{235B1D85-E6B6-45E2-BA5D-5C60396428FF} = {D33114D7-E582-4D61-B27D-FAB0297C43FF}
{AB1EB229-D86C-41B3-8E20-7A7E1FF5DDF5} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}
{B7E24D8E-6BE9-4DEF-A8B9-6A6E60CA60E9} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}
{A08DD1A8-998C-4FBB-8710-89B80D0BC3AD} = {CA0EBD66-3F60-4F3D-8143-B31F14458B40}
{B4537008-1302-4EE7-98C8-6897472B9E36} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}
{3EF851E7-4AAB-4C7C-9A79-3122CEA1EB67} = {D33114D7-E582-4D61-B27D-FAB0297C43FF}
{9F14A82C-19FD-4A8A-B4FF-FF00FFF6F2DD} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}
{27E15292-4A8D-4BA0-8D9B-5D1ECFF85747} = {ED25C308-5BDB-43A7-BED6-C2C059FC2D7D}
......
......@@ -13,11 +13,5 @@
<Depends filename="OpenGL/libEGL/libEGL.cbp" />
<Depends filename="OpenGL/libGLESv2/libGLESv2.cbp" />
</Project>
<Project filename="Radiance/libRAD/libRAD.cbp">
<Depends filename="LLVM/LLVM.cbp" />
</Project>
<Project filename="../tests/HelloRAD/rad.cbp">
<Depends filename="Radiance/libRAD/libRAD.cbp" />
</Project>
</Workspace>
</CodeBlocks_workspace_file>
rad: src/app/rad.cpp src/app/radfnptrinit.c src/app/radexample.cpp
gcc -o rad src/app/rad.cpp src/app/radfnptrinit.c src/app/radexample.cpp -I/usr/include/GL -I./ -I./src/GL -lGL -lglut -lX11
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="rad" />
<Option pch_mode="2" />
<Option compiler="clang" />
<Build>
<Target title="Debug x86">
<Option output="rad" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../lib/Debug_x86" />
<Option object_output="obj/Debug_x86" />
<Option type="1" />
<Option compiler="clang" />
<Compiler>
<Add option="-g" />
<Add option="-m32" />
</Compiler>
<Linker>
<Add option="-m32" />
<Add directory="../../lib/Debug_x86" />
</Linker>
</Target>
<Target title="Release x86">
<Option output="rad" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../lib/Release_x86" />
<Option object_output="obj/Release_x86" />
<Option type="1" />
<Option compiler="clang" />
<Compiler>
<Add option="-O2" />
<Add option="-m32" />
<Add option="-DNDEBUG" />
<Add option="-DANGLE_DISABLE_TRACE" />
<Add directory="./src/GL" />
</Compiler>
<ResourceCompiler>
<Add directory="./src/GL" />
</ResourceCompiler>
<Linker>
<Add option="-s" />
<Add option="-m32" />
<Add directory="../../lib/Release_x86" />
</Linker>
</Target>
<Target title="Debug x64">
<Option output="rad" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../lib/Debug_x64" />
<Option object_output="obj/Debug_x64" />
<Option type="1" />
<Option compiler="clang" />
<Compiler>
<Add option="-g" />
<Add option="-m64" />
</Compiler>
<Linker>
<Add option="-m64" />
<Add directory="../../lib/Debug_x64" />
</Linker>
</Target>
<Target title="Release x64">
<Option output="rad" prefix_auto="1" extension_auto="1" />
<Option working_dir="../../lib/Release_x64" />
<Option object_output="obj/Release_x64" />
<Option type="1" />
<Option compiler="clang" />
<Compiler>
<Add option="-O2" />
<Add option="-march=core2" />
<Add option="-m64" />
<Add option="-fPIC" />
<Add option="-DNDEBUG" />
<Add option="-DANGLE_DISABLE_TRACE" />
<Add directory="./src/GL" />
</Compiler>
<ResourceCompiler>
<Add directory="./src/GL" />
</ResourceCompiler>
<Linker>
<Add option="-s" />
<Add option="-m64" />
<Add directory="../../lib/Release_x64" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
<Add directory="./src/include/" />
</Compiler>
<Linker>
<Add library="X11" />
<Add library="RAD" />
</Linker>
<Unit filename="src/app/rad_LinuxX11.cpp" />
<Unit filename="src/app/radexample.cpp" />
<Unit filename="src/app/radfnptrinit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="src/app/radfnptrinit.h" />
<Unit filename="src/include/RAD/rad.h" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rad", "rad.vcproj", "{B4537008-1302-4EE7-98C8-6897472B9E36}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B4537008-1302-4EE7-98C8-6897472B9E36}.Debug|Win32.ActiveCfg = Debug|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Debug|Win32.Build.0 = Debug|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Release|Win32.ActiveCfg = Release|Win32
{B4537008-1302-4EE7-98C8-6897472B9E36}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="rad"
ProjectGUID="{B4537008-1302-4EE7-98C8-6897472B9E36}"
RootNamespace="rad"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\src\GL"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
AdditionalLibraryDirectories="E:\p4-14\sw\apps\gpu\drivers\opengl\lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=".\src\GL"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
AdditionalLibraryDirectories="E:\p4-14\sw\apps\gpu\drivers\opengl\lib"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\app\rad.cpp"
>
</File>
<File
RelativePath=".\src\app\radexample.cpp"
>
</File>
<File
RelativePath=".\src\app\radfnptrinit.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
CompileAs="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\GL\rad.h"
>
</File>
<File
RelativePath=".\src\app\radfnptrinit.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\app\rad.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\app\radexample.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\app\radfnptrinit.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\app\radfnptrinit.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\include\RAD\rad.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerEnvironment>PATH=$(SolutionDir)..\lib\$(Configuration)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
#ifndef __eglplatform_h_
#define __eglplatform_h_
/*
** Copyright (c) 2007-2013 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: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
*
* 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(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
typedef int EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
typedef void *EGLNativePixmapType;
#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;
#elif defined(__unix__)
/* X11 (tentative) */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#else
#error "Platform not recognized"
#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 */
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