Commit 11157826 by Nicolas Capens Committed by Nicolas Capens

Add ES1 stubs and remove ES2-only functions.

BUG=18110152 Change-Id: Iecebf951fe708d3f47ca6c821f448d6bbbfe0abc Reviewed-on: https://swiftshader-review.googlesource.com/1235Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent d2620712
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
// index data. Implements GL buffer objects and related functionality. // index data. Implements GL buffer objects and related functionality.
// [OpenGL ES 2.0.24] section 2.9 page 21. // [OpenGL ES 2.0.24] section 2.9 page 21.
#ifndef LIBGLESV2_BUFFER_H_ #ifndef LIBGLES_CM_BUFFER_H_
#define LIBGLESV2_BUFFER_H_ #define LIBGLES_CM_BUFFER_H_
#include "RefCountObject.h" #include "RefCountObject.h"
#include "Common/Resource.hpp" #include "Common/Resource.hpp"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <cstddef> #include <cstddef>
#include <vector> #include <vector>
...@@ -51,4 +51,4 @@ class Buffer : public RefCountObject ...@@ -51,4 +51,4 @@ class Buffer : public RefCountObject
} }
#endif // LIBGLESV2_BUFFER_H_ #endif // LIBGLES_CM_BUFFER_H_
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
// Context.h: Defines the Context class, managing all GL state and performing // Context.h: Defines the Context class, managing all GL state and performing
// rendering operations. It is the GLES2 specific implementation of EGLContext. // rendering operations. It is the GLES2 specific implementation of EGLContext.
#ifndef LIBGLESV2_CONTEXT_H_ #ifndef LIBGLES_CM_CONTEXT_H_
#define LIBGLESV2_CONTEXT_H_ #define LIBGLES_CM_CONTEXT_H_
#include "ResourceManager.h" #include "ResourceManager.h"
#include "HandleAllocator.h" #include "HandleAllocator.h"
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
#include "Image.hpp" #include "Image.hpp"
#include "Renderer/Sampler.hpp" #include "Renderer/Sampler.hpp"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <GLES2/gl2ext.h>
#define EGLAPI #define EGLAPI
#include <EGL/egl.h> #include <EGL/egl.h>
...@@ -43,11 +42,8 @@ struct TranslatedAttribute; ...@@ -43,11 +42,8 @@ struct TranslatedAttribute;
struct TranslatedIndexData; struct TranslatedIndexData;
class Buffer; class Buffer;
class Shader;
class Program;
class Texture; class Texture;
class Texture2D; class Texture2D;
class TextureCubeMap;
class TextureExternal; class TextureExternal;
class Framebuffer; class Framebuffer;
class Renderbuffer; class Renderbuffer;
...@@ -59,8 +55,6 @@ class Stencilbuffer; ...@@ -59,8 +55,6 @@ class Stencilbuffer;
class DepthStencilbuffer; class DepthStencilbuffer;
class VertexDataManager; class VertexDataManager;
class IndexDataManager; class IndexDataManager;
class Fence;
class Query;
enum enum
{ {
...@@ -170,7 +164,6 @@ struct State ...@@ -170,7 +164,6 @@ struct State
GLenum destBlendAlpha; GLenum destBlendAlpha;
GLenum blendEquationRGB; GLenum blendEquationRGB;
GLenum blendEquationAlpha; GLenum blendEquationAlpha;
Color blendColor;
bool stencilTest; bool stencilTest;
GLenum stencilFunc; GLenum stencilFunc;
GLint stencilRef; GLint stencilRef;
...@@ -179,13 +172,6 @@ struct State ...@@ -179,13 +172,6 @@ struct State
GLenum stencilPassDepthFail; GLenum stencilPassDepthFail;
GLenum stencilPassDepthPass; GLenum stencilPassDepthPass;
GLuint stencilWritemask; GLuint stencilWritemask;
GLenum stencilBackFunc;
GLint stencilBackRef;
GLuint stencilBackMask;
GLenum stencilBackFail;
GLenum stencilBackPassDepthFail;
GLenum stencilBackPassDepthPass;
GLuint stencilBackWritemask;
bool polygonOffsetFill; bool polygonOffsetFill;
GLfloat polygonOffsetFactor; GLfloat polygonOffsetFactor;
GLfloat polygonOffsetUnits; GLfloat polygonOffsetUnits;
...@@ -199,7 +185,6 @@ struct State ...@@ -199,7 +185,6 @@ struct State
GLfloat lineWidth; GLfloat lineWidth;
GLenum generateMipmapHint; GLenum generateMipmapHint;
GLenum fragmentShaderDerivativeHint;
GLint viewportX; GLint viewportX;
GLint viewportY; GLint viewportY;
...@@ -222,14 +207,11 @@ struct State ...@@ -222,14 +207,11 @@ struct State
unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0 unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
BindingPointer<Buffer> arrayBuffer; BindingPointer<Buffer> arrayBuffer;
BindingPointer<Buffer> elementArrayBuffer; BindingPointer<Buffer> elementArrayBuffer;
GLuint readFramebuffer; GLuint framebuffer;
GLuint drawFramebuffer;
BindingPointer<Renderbuffer> renderbuffer; BindingPointer<Renderbuffer> renderbuffer;
GLuint currentProgram;
VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS]; VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS]; BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS];
BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
GLint unpackAlignment; GLint unpackAlignment;
GLint packAlignment; GLint packAlignment;
...@@ -264,18 +246,14 @@ class Context ...@@ -264,18 +246,14 @@ class Context
void setBlend(bool enabled); void setBlend(bool enabled);
bool isBlendEnabled() const; bool isBlendEnabled() const;
void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha); 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 setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
void setStencilTest(bool enabled); void setStencilTest(bool enabled);
bool isStencilTestEnabled() const; bool isStencilTestEnabled() const;
void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask); void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
void setStencilWritemask(GLuint stencilWritemask); void setStencilWritemask(GLuint stencilWritemask);
void setStencilBackWritemask(GLuint stencilBackWritemask);
void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass); void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
void setPolygonOffsetFill(bool enabled); void setPolygonOffsetFill(bool enabled);
bool isPolygonOffsetFillEnabled() const; bool isPolygonOffsetFillEnabled() const;
void setPolygonOffsetParams(GLfloat factor, GLfloat units); void setPolygonOffsetParams(GLfloat factor, GLfloat units);
...@@ -292,7 +270,6 @@ class Context ...@@ -292,7 +270,6 @@ class Context
void setLineWidth(GLfloat width); void setLineWidth(GLfloat width);
void setGenerateMipmapHint(GLenum hint); void setGenerateMipmapHint(GLenum hint);
void setFragmentShaderDerivativeHint(GLenum hint);
void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height); void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
...@@ -305,12 +282,9 @@ class Context ...@@ -305,12 +282,9 @@ class Context
void setActiveSampler(unsigned int active); void setActiveSampler(unsigned int active);
GLuint getReadFramebufferHandle() const; GLuint getFramebufferHandle() const;
GLuint getDrawFramebufferHandle() const;
GLuint getRenderbufferHandle() const; GLuint getRenderbufferHandle() const;
GLuint getActiveQuery(GLenum target) const;
GLuint getArrayBufferHandle() const; GLuint getArrayBufferHandle() const;
void setEnableVertexAttribArray(unsigned int attribNum, bool enabled); void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
...@@ -330,14 +304,10 @@ class Context ...@@ -330,14 +304,10 @@ class Context
// These create and destroy methods are merely pass-throughs to // These create and destroy methods are merely pass-throughs to
// ResourceManager, which owns these object types // ResourceManager, which owns these object types
GLuint createBuffer(); GLuint createBuffer();
GLuint createShader(GLenum type);
GLuint createProgram();
GLuint createTexture(); GLuint createTexture();
GLuint createRenderbuffer(); GLuint createRenderbuffer();
void deleteBuffer(GLuint buffer); void deleteBuffer(GLuint buffer);
void deleteShader(GLuint shader);
void deleteProgram(GLuint program);
void deleteTexture(GLuint texture); void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer); void deleteRenderbuffer(GLuint renderbuffer);
...@@ -345,26 +315,12 @@ class Context ...@@ -345,26 +315,12 @@ class Context
GLuint createFramebuffer(); GLuint createFramebuffer();
void deleteFramebuffer(GLuint framebuffer); void deleteFramebuffer(GLuint framebuffer);
// Fences are owned by the Context
GLuint createFence();
void deleteFence(GLuint fence);
// Queries are owned by the Context
GLuint createQuery();
void deleteQuery(GLuint query);
void bindArrayBuffer(GLuint buffer); void bindArrayBuffer(GLuint buffer);
void bindElementArrayBuffer(GLuint buffer); void bindElementArrayBuffer(GLuint buffer);
void bindTexture2D(GLuint texture); void bindTexture2D(GLuint texture);
void bindTextureCubeMap(GLuint texture);
void bindTextureExternal(GLuint texture); void bindTextureExternal(GLuint texture);
void bindReadFramebuffer(GLuint framebuffer); void bindFramebuffer(GLuint framebuffer);
void bindDrawFramebuffer(GLuint framebuffer);
void bindRenderbuffer(GLuint renderbuffer); void bindRenderbuffer(GLuint renderbuffer);
void useProgram(GLuint program);
void beginQuery(GLenum target, GLuint query);
void endQuery(GLenum target);
void setFramebufferZero(Framebuffer *framebuffer); void setFramebufferZero(Framebuffer *framebuffer);
...@@ -373,29 +329,25 @@ class Context ...@@ -373,29 +329,25 @@ class Context
void setVertexAttrib(GLuint index, const GLfloat *values); void setVertexAttrib(GLuint index, const GLfloat *values);
Buffer *getBuffer(GLuint handle); Buffer *getBuffer(GLuint handle);
Fence *getFence(GLuint handle);
Shader *getShader(GLuint handle);
Program *getProgram(GLuint handle);
virtual Texture *getTexture(GLuint handle); virtual Texture *getTexture(GLuint handle);
Framebuffer *getFramebuffer(GLuint handle); Framebuffer *getFramebuffer(GLuint handle);
virtual Renderbuffer *getRenderbuffer(GLuint handle); virtual Renderbuffer *getRenderbuffer(GLuint handle);
Query *getQuery(GLuint handle, bool create, GLenum type);
Buffer *getArrayBuffer(); Buffer *getArrayBuffer();
Buffer *getElementArrayBuffer(); Buffer *getElementArrayBuffer();
Program *getCurrentProgram();
Texture2D *getTexture2D(); Texture2D *getTexture2D();
TextureCubeMap *getTextureCubeMap();
TextureExternal *getTextureExternal(); TextureExternal *getTextureExternal();
Texture *getSamplerTexture(unsigned int sampler, TextureType type); Texture *getSamplerTexture(unsigned int sampler, TextureType type);
Framebuffer *getReadFramebuffer(); Framebuffer *getFramebuffer();
Framebuffer *getDrawFramebuffer();
bool getFloatv(GLenum pname, GLfloat *params); bool getFloatv(GLenum pname, GLfloat *params);
bool getIntegerv(GLenum pname, GLint *params); bool getIntegerv(GLenum pname, GLint *params);
bool getBooleanv(GLenum pname, GLboolean *params); bool getBooleanv(GLenum pname, GLboolean *params);
bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams); int getQueryParameterNum(GLenum pname);
bool isQueryParameterInt(GLenum pname);
bool isQueryParameterFloat(GLenum pname);
bool isQueryParameterBool(GLenum pname);
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels); void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
void clear(GLbitfield mask); void clear(GLbitfield mask);
...@@ -413,20 +365,14 @@ class Context ...@@ -413,20 +365,14 @@ class Context
GLenum getError(); GLenum getError();
static int getSupportedMultiSampleDepth(sw::Format format, int requested); static int getSupportedMultiSampleDepth(sw::Format format, int requested);
void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask);
private: private:
bool applyRenderTarget(); bool applyRenderTarget();
void applyState(GLenum drawMode); void applyState(GLenum drawMode);
GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count); GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count);
GLenum applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo); GLenum applyIndexBuffer(const void *indices, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
void applyShaders();
void applyTextures(); void applyTextures();
void applyTextures(sw::SamplerType type); void applyTexture(int sampler, Texture *texture);
void applyTexture(sw::SamplerType type, int sampler, Texture *texture);
void detachBuffer(GLuint buffer); void detachBuffer(GLuint buffer);
void detachTexture(GLuint texture); void detachTexture(GLuint texture);
...@@ -441,21 +387,12 @@ class Context ...@@ -441,21 +387,12 @@ class Context
State mState; State mState;
BindingPointer<Texture2D> mTexture2DZero; BindingPointer<Texture2D> mTexture2DZero;
BindingPointer<TextureCubeMap> mTextureCubeMapZero;
BindingPointer<TextureExternal> mTextureExternalZero; BindingPointer<TextureExternal> mTextureExternalZero;
typedef std::map<GLint, Framebuffer*> FramebufferMap; typedef std::map<GLint, Framebuffer*> FramebufferMap;
FramebufferMap mFramebufferMap; FramebufferMap mFramebufferMap;
HandleAllocator mFramebufferHandleAllocator; HandleAllocator mFramebufferHandleAllocator;
typedef std::map<GLint, Fence*> FenceMap;
FenceMap mFenceMap;
HandleAllocator mFenceHandleAllocator;
typedef std::map<GLint, Query*> QueryMap;
QueryMap mQueryMap;
HandleAllocator mQueryHandleAllocator;
VertexDataManager *mVertexDataManager; VertexDataManager *mVertexDataManager;
IndexDataManager *mIndexDataManager; IndexDataManager *mIndexDataManager;
...@@ -467,8 +404,6 @@ class Context ...@@ -467,8 +404,6 @@ class Context
bool mInvalidFramebufferOperation; bool mInvalidFramebufferOperation;
bool mHasBeenCurrent; bool mHasBeenCurrent;
unsigned int mAppliedProgramSerial;
// state caching flags // state caching flags
bool mDepthStateDirty; bool mDepthStateDirty;
......
...@@ -118,28 +118,6 @@ namespace gl ...@@ -118,28 +118,6 @@ namespace gl
setClipPlane(i, plane); setClipPlane(i, plane);
} }
pixelShader = 0;
vertexShader = 0;
pixelShaderDirty = true;
pixelShaderConstantsFDirty = 0;
vertexShaderDirty = true;
vertexShaderConstantsFDirty = 0;
for(int i = 0; i < 224; i++)
{
float zero[4] = {0, 0, 0, 0};
setPixelShaderConstantF(i, zero, 1);
}
for(int i = 0; i < 256; i++)
{
float zero[4] = {0, 0, 0, 0};
setVertexShaderConstantF(i, zero, 1);
}
} }
Device::~Device() Device::~Device()
...@@ -272,7 +250,7 @@ namespace gl ...@@ -272,7 +250,7 @@ namespace gl
UNREACHABLE(); UNREACHABLE();
} }
Image *surface = new Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true); Image *surface = new Image(0, width, height, format, GL_NONE_OES, GL_NONE_OES, multiSampleDepth, lockable, true);
if(!surface) if(!surface)
{ {
...@@ -293,7 +271,7 @@ namespace gl ...@@ -293,7 +271,7 @@ namespace gl
return 0; return 0;
} }
Image *surface = new Image(0, width, height, format, GL_NONE, GL_NONE, multiSampleDepth, lockable, true); Image *surface = new Image(0, width, height, format, GL_NONE_OES, GL_NONE_OES, multiSampleDepth, lockable, true);
if(!surface) if(!surface)
{ {
...@@ -414,30 +392,6 @@ namespace gl ...@@ -414,30 +392,6 @@ namespace gl
setDepthStencil(depthStencil); setDepthStencil(depthStencil);
} }
void Device::setPixelShader(PixelShader *pixelShader)
{
TRACE("PixelShader *shader = 0x%0.8p", pixelShader);
this->pixelShader = pixelShader;
pixelShaderDirty = true;
}
void Device::setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count)
{
TRACE("unsigned int startRegister = %d, const int *constantData = 0x%0.8p, unsigned int count = %d", startRegister, constantData, count);
for(unsigned int i = 0; i < count && startRegister + i < 224; i++)
{
pixelShaderConstantF[startRegister + i][0] = constantData[i * 4 + 0];
pixelShaderConstantF[startRegister + i][1] = constantData[i * 4 + 1];
pixelShaderConstantF[startRegister + i][2] = constantData[i * 4 + 2];
pixelShaderConstantF[startRegister + i][3] = constantData[i * 4 + 3];
}
pixelShaderConstantsFDirty = max(startRegister + count, pixelShaderConstantsFDirty);
pixelShaderDirty = true; // Reload DEF constants
}
void Device::setScissorEnable(bool enable) void Device::setScissorEnable(bool enable)
{ {
scissorEnable = enable; scissorEnable = enable;
...@@ -469,30 +423,6 @@ namespace gl ...@@ -469,30 +423,6 @@ namespace gl
scissorRect = rect; scissorRect = rect;
} }
void Device::setVertexShader(VertexShader *vertexShader)
{
TRACE("VertexShader *shader = 0x%0.8p", vertexShader);
this->vertexShader = vertexShader;
vertexShaderDirty = true;
}
void Device::setVertexShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count)
{
TRACE("unsigned int startRegister = %d, const int *constantData = 0x%0.8p, unsigned int count = %d", startRegister, constantData, count);
for(unsigned int i = 0; i < count && startRegister + i < 256; i++)
{
vertexShaderConstantF[startRegister + i][0] = constantData[i * 4 + 0];
vertexShaderConstantF[startRegister + i][1] = constantData[i * 4 + 1];
vertexShaderConstantF[startRegister + i][2] = constantData[i * 4 + 2];
vertexShaderConstantF[startRegister + i][3] = constantData[i * 4 + 3];
}
vertexShaderConstantsFDirty = max(startRegister + count, vertexShaderConstantsFDirty);
vertexShaderDirty = true; // Reload DEF constants
}
void Device::setViewport(const Viewport &viewport) void Device::setViewport(const Viewport &viewport)
{ {
TRACE("const Viewport *viewport = 0x%0.8p", viewport); TRACE("const Viewport *viewport = 0x%0.8p", viewport);
...@@ -643,53 +573,8 @@ namespace gl ...@@ -643,53 +573,8 @@ namespace gl
return false; // Zero-area target region return false; // Zero-area target region
} }
bindShaderConstants();
return true; return true;
} }
void Device::bindShaderConstants()
{
if(pixelShaderDirty)
{
if(pixelShader)
{
if(pixelShaderConstantsFDirty)
{
Renderer::setPixelShaderConstantF(0, pixelShaderConstantF[0], pixelShaderConstantsFDirty);
}
Renderer::setPixelShader(pixelShader); // Loads shader constants set with DEF
pixelShaderConstantsFDirty = pixelShader->dirtyConstantsF; // Shader DEF'ed constants are dirty
}
else
{
setPixelShader(0);
}
pixelShaderDirty = false;
}
if(vertexShaderDirty)
{
if(vertexShader)
{
if(vertexShaderConstantsFDirty)
{
Renderer::setVertexShaderConstantF(0, vertexShaderConstantF[0], vertexShaderConstantsFDirty);
}
Renderer::setVertexShader(vertexShader); // Loads shader constants set with DEF
vertexShaderConstantsFDirty = vertexShader->dirtyConstantsF; // Shader DEF'ed constants are dirty
}
else
{
setVertexShader(0);
}
vertexShaderDirty = false;
}
}
bool Device::bindViewport() bool Device::bindViewport()
{ {
......
...@@ -59,13 +59,9 @@ namespace gl ...@@ -59,13 +59,9 @@ namespace gl
virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize); virtual void drawIndexedPrimitive(PrimitiveType type, unsigned int indexOffset, unsigned int primitiveCount, int indexSize);
virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount); virtual void drawPrimitive(PrimitiveType primitiveType, unsigned int primiveCount);
virtual void setDepthStencilSurface(Image *newDepthStencil); virtual void setDepthStencilSurface(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 setScissorEnable(bool enable);
virtual void setRenderTarget(Image *renderTarget); virtual void setRenderTarget(Image *renderTarget);
virtual void setScissorRect(const sw::Rect &rect); 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 void setViewport(const Viewport &viewport);
virtual bool stretchRect(Image *sourceSurface, const sw::Rect *sourceRect, Image *destSurface, const sw::Rect *destRect, bool filter); virtual bool stretchRect(Image *sourceSurface, const sw::Rect *sourceRect, Image *destSurface, const sw::Rect *destRect, bool filter);
...@@ -75,7 +71,6 @@ namespace gl ...@@ -75,7 +71,6 @@ namespace gl
sw::Context *const context; sw::Context *const context;
bool bindResources(); bool bindResources();
void bindShaderConstants();
bool bindViewport(); // Also adjusts for scissoring bool bindViewport(); // Also adjusts for scissoring
bool validRectangle(const sw::Rect *rect, Image *surface); bool validRectangle(const sw::Rect *rect, Image *surface);
...@@ -84,17 +79,6 @@ namespace gl ...@@ -84,17 +79,6 @@ namespace gl
sw::Rect scissorRect; sw::Rect scissorRect;
bool scissorEnable; bool scissorEnable;
sw::PixelShader *pixelShader;
sw::VertexShader *vertexShader;
bool pixelShaderDirty;
unsigned int pixelShaderConstantsFDirty;
bool vertexShaderDirty;
unsigned int vertexShaderConstantsFDirty;
float pixelShaderConstantF[224][4];
float vertexShaderConstantF[256][4];
Image *renderTarget; Image *renderTarget;
Image *depthStencil; Image *depthStencil;
}; };
......
// 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 gl
{
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 error(GL_INVALID_OPERATION, GL_TRUE);
}
UNIMPLEMENTED();
mStatus = GL_TRUE;
return mStatus;
}
void Fence::finishFence()
{
if(!mQuery)
{
return error(GL_INVALID_OPERATION);
}
while(!testFence())
{
sw::Thread::yield();
}
}
void Fence::getFenceiv(GLenum pname, GLint *params)
{
if(!mQuery)
{
return 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 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 gl
{
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_
...@@ -24,9 +24,9 @@ namespace gl ...@@ -24,9 +24,9 @@ namespace gl
Framebuffer::Framebuffer() Framebuffer::Framebuffer()
{ {
mColorbufferType = GL_NONE; mColorbufferType = GL_NONE_OES;
mDepthbufferType = GL_NONE; mDepthbufferType = GL_NONE_OES;
mStencilbufferType = GL_NONE; mStencilbufferType = GL_NONE_OES;
} }
Framebuffer::~Framebuffer() Framebuffer::~Framebuffer()
...@@ -41,11 +41,11 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const ...@@ -41,11 +41,11 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const
Context *context = getContext(); Context *context = getContext();
Renderbuffer *buffer = NULL; Renderbuffer *buffer = NULL;
if(type == GL_NONE) if(type == GL_NONE_OES)
{ {
buffer = NULL; buffer = NULL;
} }
else if(type == GL_RENDERBUFFER) else if(type == GL_RENDERBUFFER_OES)
{ {
buffer = context->getRenderbuffer(handle); buffer = context->getRenderbuffer(handle);
} }
...@@ -63,19 +63,19 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const ...@@ -63,19 +63,19 @@ Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle) const
void Framebuffer::setColorbuffer(GLenum type, GLuint colorbuffer) void Framebuffer::setColorbuffer(GLenum type, GLuint colorbuffer)
{ {
mColorbufferType = (colorbuffer != 0) ? type : GL_NONE; mColorbufferType = (colorbuffer != 0) ? type : GL_NONE_OES;
mColorbufferPointer.set(lookupRenderbuffer(type, colorbuffer)); mColorbufferPointer.set(lookupRenderbuffer(type, colorbuffer));
} }
void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer) void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer)
{ {
mDepthbufferType = (depthbuffer != 0) ? type : GL_NONE; mDepthbufferType = (depthbuffer != 0) ? type : GL_NONE_OES;
mDepthbufferPointer.set(lookupRenderbuffer(type, depthbuffer)); mDepthbufferPointer.set(lookupRenderbuffer(type, depthbuffer));
} }
void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer) void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer)
{ {
mStencilbufferType = (stencilbuffer != 0) ? type : GL_NONE; mStencilbufferType = (stencilbuffer != 0) ? type : GL_NONE_OES;
mStencilbufferPointer.set(lookupRenderbuffer(type, stencilbuffer)); mStencilbufferPointer.set(lookupRenderbuffer(type, stencilbuffer));
} }
...@@ -83,40 +83,40 @@ void Framebuffer::detachTexture(GLuint texture) ...@@ -83,40 +83,40 @@ void Framebuffer::detachTexture(GLuint texture)
{ {
if(mColorbufferPointer.id() == texture && IsTextureTarget(mColorbufferType)) if(mColorbufferPointer.id() == texture && IsTextureTarget(mColorbufferType))
{ {
mColorbufferType = GL_NONE; mColorbufferType = GL_NONE_OES;
mColorbufferPointer.set(NULL); mColorbufferPointer.set(NULL);
} }
if(mDepthbufferPointer.id() == texture && IsTextureTarget(mDepthbufferType)) if(mDepthbufferPointer.id() == texture && IsTextureTarget(mDepthbufferType))
{ {
mDepthbufferType = GL_NONE; mDepthbufferType = GL_NONE_OES;
mDepthbufferPointer.set(NULL); mDepthbufferPointer.set(NULL);
} }
if(mStencilbufferPointer.id() == texture && IsTextureTarget(mStencilbufferType)) if(mStencilbufferPointer.id() == texture && IsTextureTarget(mStencilbufferType))
{ {
mStencilbufferType = GL_NONE; mStencilbufferType = GL_NONE_OES;
mStencilbufferPointer.set(NULL); mStencilbufferPointer.set(NULL);
} }
} }
void Framebuffer::detachRenderbuffer(GLuint renderbuffer) void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
{ {
if(mColorbufferPointer.id() == renderbuffer && mColorbufferType == GL_RENDERBUFFER) if(mColorbufferPointer.id() == renderbuffer && mColorbufferType == GL_RENDERBUFFER_OES)
{ {
mColorbufferType = GL_NONE; mColorbufferType = GL_NONE_OES;
mColorbufferPointer.set(NULL); mColorbufferPointer.set(NULL);
} }
if(mDepthbufferPointer.id() == renderbuffer && mDepthbufferType == GL_RENDERBUFFER) if(mDepthbufferPointer.id() == renderbuffer && mDepthbufferType == GL_RENDERBUFFER_OES)
{ {
mDepthbufferType = GL_NONE; mDepthbufferType = GL_NONE_OES;
mDepthbufferPointer.set(NULL); mDepthbufferPointer.set(NULL);
} }
if(mStencilbufferPointer.id() == renderbuffer && mStencilbufferType == GL_RENDERBUFFER) if(mStencilbufferPointer.id() == renderbuffer && mStencilbufferType == GL_RENDERBUFFER_OES)
{ {
mStencilbufferType = GL_NONE; mStencilbufferType = GL_NONE_OES;
mStencilbufferPointer.set(NULL); mStencilbufferPointer.set(NULL);
} }
} }
...@@ -201,7 +201,7 @@ GLuint Framebuffer::getStencilbufferHandle() ...@@ -201,7 +201,7 @@ GLuint Framebuffer::getStencilbufferHandle()
bool Framebuffer::hasStencil() bool Framebuffer::hasStencil()
{ {
if(mStencilbufferType != GL_NONE) if(mStencilbufferType != GL_NONE_OES)
{ {
Renderbuffer *stencilbufferObject = getStencilbuffer(); Renderbuffer *stencilbufferObject = getStencilbuffer();
...@@ -229,25 +229,25 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -229,25 +229,25 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
height = -1; height = -1;
samples = -1; samples = -1;
if(mColorbufferType != GL_NONE) if(mColorbufferType != GL_NONE_OES)
{ {
Renderbuffer *colorbuffer = getColorbuffer(); Renderbuffer *colorbuffer = getColorbuffer();
if(!colorbuffer) if(!colorbuffer)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(colorbuffer->getWidth() == 0 || colorbuffer->getHeight() == 0) if(colorbuffer->getWidth() == 0 || colorbuffer->getHeight() == 0)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(mColorbufferType == GL_RENDERBUFFER) if(mColorbufferType == GL_RENDERBUFFER_OES)
{ {
if(!gl::IsColorRenderable(colorbuffer->getFormat())) if(!gl::IsColorRenderable(colorbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
} }
else if(IsTextureTarget(mColorbufferType)) else if(IsTextureTarget(mColorbufferType))
...@@ -259,18 +259,18 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -259,18 +259,18 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
format == GL_LUMINANCE || format == GL_LUMINANCE ||
format == GL_LUMINANCE_ALPHA) format == GL_LUMINANCE_ALPHA)
{ {
return GL_FRAMEBUFFER_UNSUPPORTED; return GL_FRAMEBUFFER_UNSUPPORTED_OES;
} }
if(gl::IsDepthTexture(format) || gl::IsStencilTexture(format)) if(gl::IsDepthTexture(format) || gl::IsStencilTexture(format))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
} }
else else
{ {
UNREACHABLE(); UNREACHABLE();
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
width = colorbuffer->getWidth(); width = colorbuffer->getWidth();
...@@ -281,38 +281,38 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -281,38 +281,38 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
Renderbuffer *depthbuffer = NULL; Renderbuffer *depthbuffer = NULL;
Renderbuffer *stencilbuffer = NULL; Renderbuffer *stencilbuffer = NULL;
if(mDepthbufferType != GL_NONE) if(mDepthbufferType != GL_NONE_OES)
{ {
depthbuffer = getDepthbuffer(); depthbuffer = getDepthbuffer();
if(!depthbuffer) if(!depthbuffer)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(depthbuffer->getWidth() == 0 || depthbuffer->getHeight() == 0) if(depthbuffer->getWidth() == 0 || depthbuffer->getHeight() == 0)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(mDepthbufferType == GL_RENDERBUFFER) if(mDepthbufferType == GL_RENDERBUFFER_OES)
{ {
if(!gl::IsDepthRenderable(depthbuffer->getFormat())) if(!gl::IsDepthRenderable(depthbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
} }
else if(IsTextureTarget(mDepthbufferType)) else if(IsTextureTarget(mDepthbufferType))
{ {
if(!gl::IsDepthTexture(depthbuffer->getFormat())) if(!gl::IsDepthTexture(depthbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
} }
else else
{ {
UNREACHABLE(); UNREACHABLE();
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(width == -1 || height == -1) if(width == -1 || height == -1)
...@@ -323,33 +323,33 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -323,33 +323,33 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
} }
else if(width != depthbuffer->getWidth() || height != depthbuffer->getHeight()) else if(width != depthbuffer->getWidth() || height != depthbuffer->getHeight())
{ {
return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES;
} }
else if(samples != depthbuffer->getSamples()) else if(samples != depthbuffer->getSamples())
{ {
return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE; UNREACHABLE();
} }
} }
if(mStencilbufferType != GL_NONE) if(mStencilbufferType != GL_NONE_OES)
{ {
stencilbuffer = getStencilbuffer(); stencilbuffer = getStencilbuffer();
if(!stencilbuffer) if(!stencilbuffer)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(stencilbuffer->getWidth() == 0 || stencilbuffer->getHeight() == 0) if(stencilbuffer->getWidth() == 0 || stencilbuffer->getHeight() == 0)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(mStencilbufferType == GL_RENDERBUFFER) if(mStencilbufferType == GL_RENDERBUFFER_OES)
{ {
if(!gl::IsStencilRenderable(stencilbuffer->getFormat())) if(!gl::IsStencilRenderable(stencilbuffer->getFormat()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
} }
else if(IsTextureTarget(mStencilbufferType)) else if(IsTextureTarget(mStencilbufferType))
...@@ -358,13 +358,13 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -358,13 +358,13 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
if(!gl::IsStencilTexture(internalformat)) if(!gl::IsStencilTexture(internalformat))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
} }
else else
{ {
UNREACHABLE(); UNREACHABLE();
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
} }
if(width == -1 || height == -1) if(width == -1 || height == -1)
...@@ -375,11 +375,12 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -375,11 +375,12 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
} }
else if(width != stencilbuffer->getWidth() || height != stencilbuffer->getHeight()) else if(width != stencilbuffer->getWidth() || height != stencilbuffer->getHeight())
{ {
return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES;
} }
else if(samples != stencilbuffer->getSamples()) else if(samples != stencilbuffer->getSamples())
{ {
return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE; UNREACHABLE();
return GL_FRAMEBUFFER_UNSUPPORTED_OES; // GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES;
} }
} }
...@@ -387,16 +388,16 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples) ...@@ -387,16 +388,16 @@ GLenum Framebuffer::completeness(int &width, int &height, int &samples)
// since we only support packed_depth_stencil and not separate depth and stencil // since we only support packed_depth_stencil and not separate depth and stencil
if(depthbuffer && stencilbuffer && (depthbuffer != stencilbuffer)) if(depthbuffer && stencilbuffer && (depthbuffer != stencilbuffer))
{ {
return GL_FRAMEBUFFER_UNSUPPORTED; return GL_FRAMEBUFFER_UNSUPPORTED_OES;
} }
// We need to have at least one attachment to be complete // We need to have at least one attachment to be complete
if(width == -1 || height == -1) if(width == -1 || height == -1)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES;
} }
return GL_FRAMEBUFFER_COMPLETE; return GL_FRAMEBUFFER_COMPLETE_OES;
} }
DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil) DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
...@@ -407,17 +408,17 @@ DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuf ...@@ -407,17 +408,17 @@ DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuf
mDepthbufferPointer.set(depthStencilRenderbuffer); mDepthbufferPointer.set(depthStencilRenderbuffer);
mStencilbufferPointer.set(depthStencilRenderbuffer); mStencilbufferPointer.set(depthStencilRenderbuffer);
mColorbufferType = GL_RENDERBUFFER; mColorbufferType = GL_RENDERBUFFER_OES;
mDepthbufferType = (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE; mDepthbufferType = (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_RENDERBUFFER_OES : GL_NONE_OES;
mStencilbufferType = (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE; mStencilbufferType = (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_RENDERBUFFER_OES : GL_NONE_OES;
} }
GLenum DefaultFramebuffer::completeness() GLenum DefaultFramebuffer::completeness()
{ {
// The default framebuffer should always be complete // The default framebuffer should always be complete
ASSERT(Framebuffer::completeness() == GL_FRAMEBUFFER_COMPLETE); ASSERT(Framebuffer::completeness() == GL_FRAMEBUFFER_COMPLETE_OES);
return GL_FRAMEBUFFER_COMPLETE; return GL_FRAMEBUFFER_COMPLETE_OES;
} }
} }
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
// Framebuffer.h: Defines the Framebuffer class. Implements GL framebuffer // Framebuffer.h: Defines the Framebuffer class. Implements GL framebuffer
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105. // objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
#ifndef LIBGLESV2_FRAMEBUFFER_H_ #ifndef LIBGLES_CM_FRAMEBUFFER_H_
#define LIBGLESV2_FRAMEBUFFER_H_ #define LIBGLES_CM_FRAMEBUFFER_H_
#include "RefCountObject.h" #include "RefCountObject.h"
#include "Image.hpp" #include "Image.hpp"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
namespace gl namespace gl
{ {
...@@ -87,4 +87,4 @@ public: ...@@ -87,4 +87,4 @@ public:
} }
#endif // LIBGLESV2_FRAMEBUFFER_H_ #endif // LIBGLES_CM_FRAMEBUFFER_H_
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
// HandleAllocator.h: Defines the HandleAllocator class, which is used to // HandleAllocator.h: Defines the HandleAllocator class, which is used to
// allocate GL handles. // allocate GL handles.
#ifndef LIBGLESV2_HANDLEALLOCATOR_H_ #ifndef LIBGLES_CM_HANDLEALLOCATOR_H_
#define LIBGLESV2_HANDLEALLOCATOR_H_ #define LIBGLES_CM_HANDLEALLOCATOR_H_
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <vector> #include <vector>
...@@ -43,4 +43,4 @@ class HandleAllocator ...@@ -43,4 +43,4 @@ class HandleAllocator
} }
#endif // LIBGLESV2_HANDLEALLOCATOR_H_ #endif // LIBGLES_CM_HANDLEALLOCATOR_H_
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
#include "../common/debug.h" #include "../common/debug.h"
#include "Common/Thread.hpp" #include "Common/Thread.hpp"
#include <GLES2/gl2ext.h> #define GL_GLEXT_PROTOTYPES
#include <GLES/glext.h>
namespace gl namespace gl
{ {
...@@ -150,24 +151,12 @@ namespace gl ...@@ -150,24 +151,12 @@ namespace gl
{ {
return sw::FORMAT_DXT1; return sw::FORMAT_DXT1;
} }
else if(format == GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE)
{
return sw::FORMAT_DXT3;
}
else if(format == GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE)
{
return sw::FORMAT_DXT5;
}
else else
#endif #endif
if(type == GL_FLOAT) if(type == GL_FLOAT)
{ {
return sw::FORMAT_A32B32G32R32F; return sw::FORMAT_A32B32G32R32F;
} }
else if(type == GL_HALF_FLOAT_OES)
{
return sw::FORMAT_A16B16G16R16F;
}
else if(type == GL_UNSIGNED_BYTE) else if(type == GL_UNSIGNED_BYTE)
{ {
if(format == GL_LUMINANCE) if(format == GL_LUMINANCE)
...@@ -192,14 +181,6 @@ namespace gl ...@@ -192,14 +181,6 @@ namespace gl
} }
else UNREACHABLE(); else UNREACHABLE();
} }
else if(type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_INT)
{
if(format == GL_DEPTH_COMPONENT)
{
return sw::FORMAT_D32FS8_TEXTURE;
}
else UNREACHABLE();
}
else if(type == GL_UNSIGNED_INT_24_8_OES) else if(type == GL_UNSIGNED_INT_24_8_OES)
{ {
if(format == GL_DEPTH_STENCIL_OES) if(format == GL_DEPTH_STENCIL_OES)
...@@ -312,28 +293,6 @@ namespace gl ...@@ -312,28 +293,6 @@ namespace gl
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case GL_HALF_FLOAT_OES:
switch(format)
{
// float textures are converted to RGBA, not BGRA
case GL_ALPHA:
loadAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, buffer);
break;
case GL_LUMINANCE:
loadLuminanceHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, buffer);
break;
case GL_LUMINANCE_ALPHA:
loadLuminanceAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, buffer);
break;
case GL_RGB:
loadRGBHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, buffer);
break;
case GL_RGBA:
loadRGBAHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, buffer);
break;
default: UNREACHABLE();
}
break;
case GL_UNSIGNED_SHORT: case GL_UNSIGNED_SHORT:
loadD16ImageData(xoffset, yoffset, width, height, inputPitch, input, buffer); loadD16ImageData(xoffset, yoffset, width, height, inputPitch, input, buffer);
break; break;
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "Renderer/Surface.hpp" #include "Renderer/Surface.hpp"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
namespace gl namespace gl
{ {
......
...@@ -49,10 +49,6 @@ void copyIndices(GLenum type, const void *input, GLsizei count, void *output) ...@@ -49,10 +49,6 @@ void copyIndices(GLenum type, const void *input, GLsizei count, void *output)
{ {
memcpy(output, input, count * sizeof(GLubyte)); memcpy(output, input, count * sizeof(GLubyte));
} }
else if(type == GL_UNSIGNED_INT)
{
memcpy(output, input, count * sizeof(GLuint));
}
else if(type == GL_UNSIGNED_SHORT) else if(type == GL_UNSIGNED_SHORT)
{ {
memcpy(output, input, count * sizeof(GLushort)); memcpy(output, input, count * sizeof(GLushort));
...@@ -79,10 +75,6 @@ void computeRange(GLenum type, const void *indices, GLsizei count, GLuint *minIn ...@@ -79,10 +75,6 @@ void computeRange(GLenum type, const void *indices, GLsizei count, GLuint *minIn
{ {
computeRange(static_cast<const GLubyte*>(indices), count, minIndex, maxIndex); computeRange(static_cast<const GLubyte*>(indices), count, minIndex, maxIndex);
} }
else if(type == GL_UNSIGNED_INT)
{
computeRange(static_cast<const GLuint*>(indices), count, minIndex, maxIndex);
}
else if(type == GL_UNSIGNED_SHORT) else if(type == GL_UNSIGNED_SHORT)
{ {
computeRange(static_cast<const GLushort*>(indices), count, minIndex, maxIndex); computeRange(static_cast<const GLushort*>(indices), count, minIndex, maxIndex);
...@@ -106,7 +98,6 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *bu ...@@ -106,7 +98,6 @@ GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *bu
{ {
case GL_UNSIGNED_BYTE: alignedOffset = (offset % sizeof(GLubyte) == 0); break; case GL_UNSIGNED_BYTE: alignedOffset = (offset % sizeof(GLubyte) == 0); break;
case GL_UNSIGNED_SHORT: alignedOffset = (offset % sizeof(GLushort) == 0); break; case GL_UNSIGNED_SHORT: alignedOffset = (offset % sizeof(GLushort) == 0); break;
case GL_UNSIGNED_INT: alignedOffset = (offset % sizeof(GLuint) == 0); break;
default: UNREACHABLE(); alignedOffset = false; default: UNREACHABLE(); alignedOffset = false;
} }
...@@ -159,7 +150,6 @@ std::size_t IndexDataManager::typeSize(GLenum type) ...@@ -159,7 +150,6 @@ std::size_t IndexDataManager::typeSize(GLenum type)
{ {
switch(type) switch(type)
{ {
case GL_UNSIGNED_INT: return sizeof(GLuint);
case GL_UNSIGNED_SHORT: return sizeof(GLushort); case GL_UNSIGNED_SHORT: return sizeof(GLushort);
case GL_UNSIGNED_BYTE: return sizeof(GLubyte); case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
default: UNREACHABLE(); return sizeof(GLushort); default: UNREACHABLE(); return sizeof(GLushort);
......
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
// IndexDataManager.h: Defines the IndexDataManager, a class that // IndexDataManager.h: Defines the IndexDataManager, a class that
// runs the Buffer translation process for index buffers. // runs the Buffer translation process for index buffers.
#ifndef LIBGLESV2_INDEXDATAMANAGER_H_ #ifndef LIBGLES_CM_INDEXDATAMANAGER_H_
#define LIBGLESV2_INDEXDATAMANAGER_H_ #define LIBGLES_CM_INDEXDATAMANAGER_H_
#include "Context.h" #include "Context.h"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
namespace gl namespace gl
{ {
...@@ -66,4 +66,4 @@ class IndexDataManager ...@@ -66,4 +66,4 @@ class IndexDataManager
} }
#endif // LIBGLESV2_INDEXDATAMANAGER_H_ #endif // LIBGLES_CM_INDEXDATAMANAGER_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.
//
// 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 gl
{
class Device;
class ResourceManager;
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;
};
class Program
{
public:
Program(ResourceManager *manager, 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 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:
gl::Device *device;
FragmentShader *fragmentShader;
VertexShader *vertexShader;
sw::PixelShader *pixelBinary;
sw::VertexShader *vertexBinary;
std::set<std::string> attributeBinding[MAX_VERTEX_ATTRIBS];
sh::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;
ResourceManager *resourceManager;
const GLuint handle;
};
}
#endif // LIBGLESV2_PROGRAM_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.
//
// Query.cpp: Implements the gl::Query class
#include "Query.h"
#include "main.h"
#include "Common/Thread.hpp"
namespace gl
{
Query::Query(GLuint id, GLenum type) : RefCountObject(id)
{
mQuery = NULL;
mStatus = GL_FALSE;
mResult = GL_FALSE;
mType = type;
}
Query::~Query()
{
if(mQuery != NULL)
{
delete mQuery;
}
}
void Query::begin()
{
if(mQuery == NULL)
{
mQuery = new sw::Query();
if(!mQuery)
{
return error(GL_OUT_OF_MEMORY);
}
}
Device *device = getDevice();
mQuery->begin();
device->addQuery(mQuery);
device->setOcclusionEnabled(true);
}
void Query::end()
{
if(mQuery == NULL)
{
return error(GL_INVALID_OPERATION);
}
Device *device = getDevice();
mQuery->end();
device->removeQuery(mQuery);
device->setOcclusionEnabled(false);
mStatus = GL_FALSE;
mResult = GL_FALSE;
}
GLuint Query::getResult()
{
if(mQuery != NULL)
{
while(!testQuery())
{
sw::Thread::yield();
}
}
return (GLuint)mResult;
}
GLboolean Query::isResultAvailable()
{
if(mQuery != NULL)
{
testQuery();
}
return mStatus;
}
GLenum Query::getType() const
{
return mType;
}
GLboolean Query::testQuery()
{
if(mQuery != NULL && mStatus != GL_TRUE)
{
if(!mQuery->building && mQuery->reference == 0)
{
unsigned int numPixels = mQuery->data;
mStatus = GL_TRUE;
switch(mType)
{
case GL_ANY_SAMPLES_PASSED_EXT:
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
break;
default:
ASSERT(false);
}
}
return mStatus;
}
return GL_TRUE; // Prevent blocking when query is null
}
}
// 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.
//
// Query.h: Defines the gl::Query class
#ifndef LIBGLESV2_QUERY_H_
#define LIBGLESV2_QUERY_H_
#include "RefCountObject.h"
#include "Renderer/Renderer.hpp"
#define GL_APICALL
#include <GLES2/gl2.h>
namespace gl
{
class Query : public RefCountObject
{
public:
Query(GLuint id, GLenum type);
virtual ~Query();
void begin();
void end();
GLuint getResult();
GLboolean isResultAvailable();
GLenum getType() const;
private:
GLboolean testQuery();
sw::Query* mQuery;
GLenum mType;
GLboolean mStatus;
GLint mResult;
};
}
#endif // LIBGLESV2_QUERY_H_
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
// that need to be reference counted for correct cross-context deletion. // that need to be reference counted for correct cross-context deletion.
// (Concretely, textures, buffers and renderbuffers.) // (Concretely, textures, buffers and renderbuffers.)
#ifndef LIBGLESV2_REFCOUNTOBJECT_H_ #ifndef LIBGLES_CM_REFCOUNTOBJECT_H_
#define LIBGLESV2_REFCOUNTOBJECT_H_ #define LIBGLES_CM_REFCOUNTOBJECT_H_
#include "common/debug.h" #include "common/debug.h"
#define GL_APICALL #define GL_APIL
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <cstddef> #include <cstddef>
...@@ -72,4 +72,4 @@ class BindingPointer : public RefCountObjectBindingPointer ...@@ -72,4 +72,4 @@ class BindingPointer : public RefCountObjectBindingPointer
} }
#endif // LIBGLESV2_REFCOUNTOBJECT_H_ #endif // LIBGLES_CM_REFCOUNTOBJECT_H_
...@@ -134,74 +134,6 @@ GLsizei RenderbufferTexture2D::getSamples() const ...@@ -134,74 +134,6 @@ GLsizei RenderbufferTexture2D::getSamples() const
return 0; return 0;
} }
///// RenderbufferTextureCubeMap Implementation ////////
RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target) : mTarget(target)
{
mTextureCubeMap.set(texture);
}
RenderbufferTextureCubeMap::~RenderbufferTextureCubeMap()
{
mTextureCubeMap.set(NULL);
}
// Textures need to maintain their own reference count for references via
// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
void RenderbufferTextureCubeMap::addProxyRef(const Renderbuffer *proxy)
{
mTextureCubeMap->addProxyRef(proxy);
}
void RenderbufferTextureCubeMap::releaseProxy(const Renderbuffer *proxy)
{
mTextureCubeMap->releaseProxy(proxy);
}
// Increments refcount on image.
// caller must release() the returned image
Image *RenderbufferTextureCubeMap::getRenderTarget()
{
return mTextureCubeMap->getRenderTarget(mTarget, 0);
}
// Increments refcount on image.
// caller must release() the returned image
Image *RenderbufferTextureCubeMap::createSharedImage()
{
return mTextureCubeMap->createSharedImage(mTarget, 0);
}
bool RenderbufferTextureCubeMap::isShared() const
{
return mTextureCubeMap->isShared(mTarget, 0);
}
GLsizei RenderbufferTextureCubeMap::getWidth() const
{
return mTextureCubeMap->getWidth(mTarget, 0);
}
GLsizei RenderbufferTextureCubeMap::getHeight() const
{
return mTextureCubeMap->getHeight(mTarget, 0);
}
GLenum RenderbufferTextureCubeMap::getFormat() const
{
return mTextureCubeMap->getFormat(mTarget, 0);
}
sw::Format RenderbufferTextureCubeMap::getInternalFormat() const
{
return mTextureCubeMap->getInternalFormat(mTarget, 0);
}
GLsizei RenderbufferTextureCubeMap::getSamples() const
{
return 0;
}
////// Renderbuffer Implementation ////// ////// Renderbuffer Implementation //////
Renderbuffer::Renderbuffer(GLuint id, RenderbufferInterface *instance) : RefCountObject(id) Renderbuffer::Renderbuffer(GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
...@@ -317,7 +249,7 @@ RenderbufferStorage::RenderbufferStorage() ...@@ -317,7 +249,7 @@ RenderbufferStorage::RenderbufferStorage()
{ {
mWidth = 0; mWidth = 0;
mHeight = 0; mHeight = 0;
format = GL_RGBA4; format = GL_RGBA4_OES;
internalFormat = sw::FORMAT_A8R8G8B8; internalFormat = sw::FORMAT_A8R8G8B8;
mSamples = 0; mSamples = 0;
} }
...@@ -510,9 +442,9 @@ Depthbuffer::Depthbuffer(Image *depthStencil) : DepthStencilbuffer(depthStencil) ...@@ -510,9 +442,9 @@ Depthbuffer::Depthbuffer(Image *depthStencil) : DepthStencilbuffer(depthStencil)
{ {
if(depthStencil) if(depthStencil)
{ {
format = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function format = GL_DEPTH_COMPONENT16_OES; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
} }
} }
...@@ -520,9 +452,9 @@ Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilb ...@@ -520,9 +452,9 @@ Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilb
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
format = GL_DEPTH_COMPONENT16; // If the renderbuffer parameters are queried, the calling function format = GL_DEPTH_COMPONENT16_OES; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
} }
} }
...@@ -534,9 +466,9 @@ Stencilbuffer::Stencilbuffer(Image *depthStencil) : DepthStencilbuffer(depthSten ...@@ -534,9 +466,9 @@ Stencilbuffer::Stencilbuffer(Image *depthStencil) : DepthStencilbuffer(depthSten
{ {
if(depthStencil) if(depthStencil)
{ {
format = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function format = GL_STENCIL_INDEX8_OES; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
} }
} }
...@@ -544,9 +476,9 @@ Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthSten ...@@ -544,9 +476,9 @@ Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthSten
{ {
if(mDepthStencil) if(mDepthStencil)
{ {
format = GL_STENCIL_INDEX8; // If the renderbuffer parameters are queried, the calling function format = GL_STENCIL_INDEX8_OES; // If the renderbuffer parameters are queried, the calling function
// will expect one of the valid renderbuffer formats for use in // will expect one of the valid renderbuffer formats for use in
// glRenderbufferStorage // glRenderbufferStorage
} }
} }
......
...@@ -14,19 +14,18 @@ ...@@ -14,19 +14,18 @@
// DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer // DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108. // objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
#ifndef LIBGLESV2_RENDERBUFFER_H_ #ifndef LIBGLES_CM_RENDERBUFFER_H_
#define LIBGLESV2_RENDERBUFFER_H_ #define LIBGLES_CM_RENDERBUFFER_H_
#include "RefCountObject.h" #include "RefCountObject.h"
#include "Image.hpp" #include "Image.hpp"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
namespace gl namespace gl
{ {
class Texture2D; class Texture2D;
class TextureCubeMap;
class Renderbuffer; class Renderbuffer;
class Colorbuffer; class Colorbuffer;
class DepthStencilbuffer; class DepthStencilbuffer;
...@@ -83,31 +82,6 @@ private: ...@@ -83,31 +82,6 @@ private:
BindingPointer<Texture2D> mTexture2D; BindingPointer<Texture2D> mTexture2D;
}; };
class RenderbufferTextureCubeMap : public RenderbufferInterface
{
public:
RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target);
virtual ~RenderbufferTextureCubeMap();
virtual void addProxyRef(const Renderbuffer *proxy);
virtual void releaseProxy(const Renderbuffer *proxy);
virtual Image *getRenderTarget();
virtual Image *createSharedImage();
virtual bool isShared() const;
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLenum getFormat() const;
virtual sw::Format getInternalFormat() const;
virtual GLsizei getSamples() const;
private:
BindingPointer<TextureCubeMap> mTextureCubeMap;
GLenum mTarget;
};
// A class derived from RenderbufferStorage is created whenever glRenderbufferStorage // A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
// is called. The specific concrete type depends on whether the internal format is // is called. The specific concrete type depends on whether the internal format is
// colour depth, stencil or packed depth/stencil. // colour depth, stencil or packed depth/stencil.
...@@ -226,4 +200,4 @@ public: ...@@ -226,4 +200,4 @@ public:
}; };
} }
#endif // LIBGLESV2_RENDERBUFFER_H_ #endif // LIBGLES_CM_RENDERBUFFER_H_
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
#include "ResourceManager.h" #include "ResourceManager.h"
#include "Buffer.h" #include "Buffer.h"
#include "Program.h"
#include "Renderbuffer.h" #include "Renderbuffer.h"
#include "Shader.h"
#include "Texture.h" #include "Texture.h"
namespace gl namespace gl
...@@ -34,16 +32,6 @@ ResourceManager::~ResourceManager() ...@@ -34,16 +32,6 @@ ResourceManager::~ResourceManager()
deleteBuffer(mBufferMap.begin()->first); deleteBuffer(mBufferMap.begin()->first);
} }
while(!mProgramMap.empty())
{
deleteProgram(mProgramMap.begin()->first);
}
while(!mShaderMap.empty())
{
deleteShader(mShaderMap.begin()->first);
}
while(!mRenderbufferMap.empty()) while(!mRenderbufferMap.empty())
{ {
deleteRenderbuffer(mRenderbufferMap.begin()->first); deleteRenderbuffer(mRenderbufferMap.begin()->first);
...@@ -78,34 +66,6 @@ GLuint ResourceManager::createBuffer() ...@@ -78,34 +66,6 @@ GLuint ResourceManager::createBuffer()
return handle; return handle;
} }
// Returns an unused shader/program name
GLuint ResourceManager::createShader(GLenum type)
{
GLuint handle = mProgramShaderHandleAllocator.allocate();
if(type == GL_VERTEX_SHADER)
{
mShaderMap[handle] = new VertexShader(this, handle);
}
else if(type == GL_FRAGMENT_SHADER)
{
mShaderMap[handle] = new FragmentShader(this, handle);
}
else UNREACHABLE();
return handle;
}
// Returns an unused program/shader name
GLuint ResourceManager::createProgram()
{
GLuint handle = mProgramShaderHandleAllocator.allocate();
mProgramMap[handle] = new Program(this, handle);
return handle;
}
// Returns an unused texture name // Returns an unused texture name
GLuint ResourceManager::createTexture() GLuint ResourceManager::createTexture()
{ {
...@@ -138,44 +98,6 @@ void ResourceManager::deleteBuffer(GLuint buffer) ...@@ -138,44 +98,6 @@ void ResourceManager::deleteBuffer(GLuint buffer)
} }
} }
void ResourceManager::deleteShader(GLuint shader)
{
ShaderMap::iterator shaderObject = mShaderMap.find(shader);
if(shaderObject != mShaderMap.end())
{
if(shaderObject->second->getRefCount() == 0)
{
mProgramShaderHandleAllocator.release(shaderObject->first);
delete shaderObject->second;
mShaderMap.erase(shaderObject);
}
else
{
shaderObject->second->flagForDeletion();
}
}
}
void ResourceManager::deleteProgram(GLuint program)
{
ProgramMap::iterator programObject = mProgramMap.find(program);
if(programObject != mProgramMap.end())
{
if(programObject->second->getRefCount() == 0)
{
mProgramShaderHandleAllocator.release(programObject->first);
delete programObject->second;
mProgramMap.erase(programObject);
}
else
{
programObject->second->flagForDeletion();
}
}
}
void ResourceManager::deleteTexture(GLuint texture) void ResourceManager::deleteTexture(GLuint texture)
{ {
TextureMap::iterator textureObject = mTextureMap.find(texture); TextureMap::iterator textureObject = mTextureMap.find(texture);
...@@ -214,20 +136,6 @@ Buffer *ResourceManager::getBuffer(unsigned int handle) ...@@ -214,20 +136,6 @@ Buffer *ResourceManager::getBuffer(unsigned int handle)
} }
} }
Shader *ResourceManager::getShader(unsigned int handle)
{
ShaderMap::iterator shader = mShaderMap.find(handle);
if(shader == mShaderMap.end())
{
return NULL;
}
else
{
return shader->second;
}
}
Texture *ResourceManager::getTexture(unsigned int handle) Texture *ResourceManager::getTexture(unsigned int handle)
{ {
if(handle == 0) return NULL; if(handle == 0) return NULL;
...@@ -244,20 +152,6 @@ Texture *ResourceManager::getTexture(unsigned int handle) ...@@ -244,20 +152,6 @@ Texture *ResourceManager::getTexture(unsigned int handle)
} }
} }
Program *ResourceManager::getProgram(unsigned int handle)
{
ProgramMap::iterator program = mProgramMap.find(handle);
if(program == mProgramMap.end())
{
return NULL;
}
else
{
return program->second;
}
}
Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle) Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
{ {
RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle); RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
...@@ -297,10 +191,6 @@ void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type) ...@@ -297,10 +191,6 @@ void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type)
{ {
textureObject = new Texture2D(texture); textureObject = new Texture2D(texture);
} }
else if(type == TEXTURE_CUBE)
{
textureObject = new TextureCubeMap(texture);
}
else if(type == TEXTURE_EXTERNAL) else if(type == TEXTURE_EXTERNAL)
{ {
textureObject = new TextureExternal(texture); textureObject = new TextureExternal(texture);
...@@ -320,7 +210,7 @@ void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer) ...@@ -320,7 +210,7 @@ void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer)
{ {
if(renderbuffer != 0 && !getRenderbuffer(renderbuffer)) if(renderbuffer != 0 && !getRenderbuffer(renderbuffer))
{ {
Renderbuffer *renderbufferObject = new Renderbuffer(renderbuffer, new Colorbuffer(0, 0, GL_RGBA4, 0)); Renderbuffer *renderbufferObject = new Renderbuffer(renderbuffer, new Colorbuffer(0, 0, GL_RGBA4_OES, 0));
mRenderbufferMap[renderbuffer] = renderbufferObject; mRenderbufferMap[renderbuffer] = renderbufferObject;
renderbufferObject->addRef(); renderbufferObject->addRef();
} }
......
...@@ -12,21 +12,19 @@ ...@@ -12,21 +12,19 @@
// ResourceManager.h : Defines the ResourceManager class, which tracks objects // ResourceManager.h : Defines the ResourceManager class, which tracks objects
// shared by multiple GL contexts. // shared by multiple GL contexts.
#ifndef LIBGLESV2_RESOURCEMANAGER_H_ #ifndef LIBGLES_CM_RESOURCEMANAGER_H_
#define LIBGLESV2_RESOURCEMANAGER_H_ #define LIBGLES_CM_RESOURCEMANAGER_H_
#include "HandleAllocator.h" #include "HandleAllocator.h"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <map> #include <map>
namespace gl namespace gl
{ {
class Buffer; class Buffer;
class Shader;
class Program;
class Texture; class Texture;
class Renderbuffer; class Renderbuffer;
...@@ -50,20 +48,14 @@ class ResourceManager ...@@ -50,20 +48,14 @@ class ResourceManager
void release(); void release();
GLuint createBuffer(); GLuint createBuffer();
GLuint createShader(GLenum type);
GLuint createProgram();
GLuint createTexture(); GLuint createTexture();
GLuint createRenderbuffer(); GLuint createRenderbuffer();
void deleteBuffer(GLuint buffer); void deleteBuffer(GLuint buffer);
void deleteShader(GLuint shader);
void deleteProgram(GLuint program);
void deleteTexture(GLuint texture); void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer); void deleteRenderbuffer(GLuint renderbuffer);
Buffer *getBuffer(GLuint handle); Buffer *getBuffer(GLuint handle);
Shader *getShader(GLuint handle);
Program *getProgram(GLuint handle);
Texture *getTexture(GLuint handle); Texture *getTexture(GLuint handle);
Renderbuffer *getRenderbuffer(GLuint handle); Renderbuffer *getRenderbuffer(GLuint handle);
...@@ -79,14 +71,7 @@ class ResourceManager ...@@ -79,14 +71,7 @@ class ResourceManager
typedef std::map<GLint, Buffer*> BufferMap; typedef std::map<GLint, Buffer*> BufferMap;
BufferMap mBufferMap; BufferMap mBufferMap;
HandleAllocator mBufferHandleAllocator; HandleAllocator mBufferHandleAllocator;
typedef std::map<GLint, Shader*> ShaderMap;
ShaderMap mShaderMap;
typedef std::map<GLint, Program*> ProgramMap;
ProgramMap mProgramMap;
HandleAllocator mProgramShaderHandleAllocator;
typedef std::map<GLint, Texture*> TextureMap; typedef std::map<GLint, Texture*> TextureMap;
TextureMap mTextureMap; TextureMap mTextureMap;
HandleAllocator mTextureHandleAllocator; HandleAllocator mTextureHandleAllocator;
...@@ -98,4 +83,4 @@ class ResourceManager ...@@ -98,4 +83,4 @@ class ResourceManager
} }
#endif // LIBGLESV2_RESOURCEMANAGER_H_ #endif // LIBGLES_CM_RESOURCEMANAGER_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 "ResourceManager.h"
#include "compiler/TranslatorASM.h"
#define GL_APICALL
#include <GLES2/gl2.h>
#include <list>
#include <vector>
namespace sh
{
class OutputASM;
}
namespace gl
{
struct Varying
{
Varying(GLenum type, const std::string &name, int arraySize, int reg = -1, int col = -1)
: type(type), name(name), arraySize(arraySize), reg(reg), col(col)
{
}
bool isArray() const
{
return arraySize >= 1;
}
int size() const // Unify with gl::Uniform?
{
return arraySize > 0 ? arraySize : 1;
}
GLenum type;
std::string name;
int arraySize;
int reg; // First varying register, assigned during link
int col; // First register element, assigned during link
};
typedef std::list<Varying> VaryingList;
class Shader
{
friend class Program;
friend class sh::OutputASM;
public:
Shader(ResourceManager *manager, GLuint handle);
virtual ~Shader();
virtual GLenum getType() = 0;
GLuint getHandle() const;
void deleteSource();
void setSource(GLsizei count, const char **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();
virtual sw::Shader *getShader() const = 0;
virtual sw::PixelShader *getPixelShader() const;
virtual sw::VertexShader *getVertexShader() const;
void addRef();
void release();
unsigned int getRefCount() const;
bool isFlaggedForDeletion() const;
void flagForDeletion();
static void releaseCompiler();
protected:
TranslatorASM *createCompiler(ShShaderType type);
void clear();
static GLenum parseType(const std::string &type);
static bool compareVarying(const Varying &x, const Varying &y);
char *mSource;
char *mInfoLog;
VaryingList varyings;
sh::ActiveUniforms activeUniforms;
sh::ActiveAttributes activeAttributes;
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
ResourceManager *mResourceManager;
};
class VertexShader : public Shader
{
friend class Program;
public:
VertexShader(ResourceManager *manager, 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(ResourceManager *manager, 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_
...@@ -13,16 +13,16 @@ ...@@ -13,16 +13,16 @@
// classes Texture2D and TextureCubeMap. Implements GL texture objects and // classes Texture2D and TextureCubeMap. Implements GL texture objects and
// related functionality. [OpenGL ES 2.0.24] section 3.7 page 63. // related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
#ifndef LIBGLESV2_TEXTURE_H_ #ifndef LIBGLES_CM_TEXTURE_H_
#define LIBGLESV2_TEXTURE_H_ #define LIBGLES_CM_TEXTURE_H_
#include "Renderbuffer.h" #include "Renderbuffer.h"
#include "RefCountObject.h" #include "RefCountObject.h"
#include "utilities.h" #include "utilities.h"
#include "common/debug.h" #include "common/debug.h"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <vector> #include <vector>
...@@ -165,63 +165,6 @@ protected: ...@@ -165,63 +165,6 @@ protected:
unsigned int mProxyRefs; unsigned int mProxyRefs;
}; };
class TextureCubeMap : public Texture
{
public:
explicit TextureCubeMap(GLuint id);
virtual ~TextureCubeMap();
void addProxyRef(const Renderbuffer *proxy);
void releaseProxy(const Renderbuffer *proxy);
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);
void copyImage(GLenum target, GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
virtual bool isSamplerComplete() const;
virtual bool isCompressed(GLenum target, GLint level) const;
virtual bool isDepth(GLenum target, GLint level) const;
virtual void generateMipmaps();
virtual Renderbuffer *getRenderbuffer(GLenum target);
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];
// A specific internal reference count is kept for colorbuffer proxy references,
// because, as the renderbuffer acting as proxy will maintain a binding pointer
// back to this texture, there would be a circular reference if we used a binding
// pointer here. This reference count will cause the pointer to be set to NULL if
// the count drops to zero, but will not cause deletion of the Renderbuffer.
Renderbuffer *mFaceProxies[6];
unsigned int mFaceProxyRefs[6];
};
class TextureExternal : public Texture2D class TextureExternal : public Texture2D
{ {
public: public:
...@@ -235,4 +178,4 @@ public: ...@@ -235,4 +178,4 @@ public:
}; };
} }
#endif // LIBGLESV2_TEXTURE_H_ #endif // LIBGLES_CM_TEXTURE_H_
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
#include "VertexDataManager.h" #include "VertexDataManager.h"
#include "Buffer.h" #include "Buffer.h"
#include "Program.h"
#include "IndexDataManager.h" #include "IndexDataManager.h"
#include "common/debug.h" #include "common/debug.h"
#include <algorithm>
namespace namespace
{ {
enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024}; enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024};
...@@ -116,12 +117,11 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -116,12 +117,11 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
} }
const VertexAttributeArray &attribs = mContext->getVertexAttributes(); const VertexAttributeArray &attribs = mContext->getVertexAttributes();
Program *program = mContext->getCurrentProgram();
// Determine the required storage size per used buffer // Determine the required storage size per used buffer
for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++) for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{ {
if(program->getAttributeStream(i) != -1 && attribs[i].mArrayEnabled) if(attribs[i].mArrayEnabled)
{ {
if(!attribs[i].mBoundBuffer) if(!attribs[i].mBoundBuffer)
{ {
...@@ -135,71 +135,68 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -135,71 +135,68 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
// Perform the vertex data translations // Perform the vertex data translations
for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++) for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
{ {
if(program->getAttributeStream(i) != -1) if(attribs[i].mArrayEnabled)
{ {
if(attribs[i].mArrayEnabled) Buffer *buffer = attribs[i].mBoundBuffer.get();
if(!buffer && attribs[i].mPointer == NULL)
{
// This is an application error that would normally result in a crash, but we catch it and return an error
ERR("An enabled vertex array has no buffer and no pointer.");
return GL_INVALID_OPERATION;
}
sw::Resource *staticBuffer = buffer ? buffer->getResource() : NULL;
if(staticBuffer)
{
translated[i].vertexBuffer = staticBuffer;
translated[i].offset = start * attribs[i].stride() + attribs[i].mOffset;
translated[i].stride = attribs[i].stride();
}
else
{ {
Buffer *buffer = attribs[i].mBoundBuffer.get(); unsigned int streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]);
if(!buffer && attribs[i].mPointer == NULL) if(streamOffset == -1)
{
// This is an application error that would normally result in a crash, but we catch it and return an error
ERR("An enabled vertex array has no buffer and no pointer.");
return GL_INVALID_OPERATION;
}
sw::Resource *staticBuffer = buffer ? buffer->getResource() : NULL;
if(staticBuffer)
{
translated[i].vertexBuffer = staticBuffer;
translated[i].offset = start * attribs[i].stride() + attribs[i].mOffset;
translated[i].stride = attribs[i].stride();
}
else
{
unsigned int streamOffset = writeAttributeData(mStreamingBuffer, start, count, attribs[i]);
if(streamOffset == -1)
{
return GL_OUT_OF_MEMORY;
}
translated[i].vertexBuffer = mStreamingBuffer->getResource();
translated[i].offset = streamOffset;
translated[i].stride = attribs[i].typeSize();
}
switch(attribs[i].mType)
{ {
case GL_BYTE: translated[i].type = sw::STREAMTYPE_SBYTE; break; return GL_OUT_OF_MEMORY;
case GL_UNSIGNED_BYTE: translated[i].type = sw::STREAMTYPE_BYTE; break;
case GL_SHORT: translated[i].type = sw::STREAMTYPE_SHORT; break;
case GL_UNSIGNED_SHORT: translated[i].type = sw::STREAMTYPE_USHORT; break;
case GL_FIXED: translated[i].type = sw::STREAMTYPE_FIXED; break;
case GL_FLOAT: translated[i].type = sw::STREAMTYPE_FLOAT; break;
default: UNREACHABLE(); translated[i].type = sw::STREAMTYPE_FLOAT; break;
} }
translated[i].count = attribs[i].mSize; translated[i].vertexBuffer = mStreamingBuffer->getResource();
translated[i].normalized = attribs[i].mNormalized; translated[i].offset = streamOffset;
translated[i].stride = attribs[i].typeSize();
} }
else
switch(attribs[i].mType)
{
case GL_BYTE: translated[i].type = sw::STREAMTYPE_SBYTE; break;
case GL_UNSIGNED_BYTE: translated[i].type = sw::STREAMTYPE_BYTE; break;
case GL_SHORT: translated[i].type = sw::STREAMTYPE_SHORT; break;
case GL_UNSIGNED_SHORT: translated[i].type = sw::STREAMTYPE_USHORT; break;
case GL_FIXED: translated[i].type = sw::STREAMTYPE_FIXED; break;
case GL_FLOAT: translated[i].type = sw::STREAMTYPE_FLOAT; break;
default: UNREACHABLE(); translated[i].type = sw::STREAMTYPE_FLOAT; break;
}
translated[i].count = attribs[i].mSize;
translated[i].normalized = attribs[i].mNormalized;
}
else
{
if(mDirtyCurrentValue[i])
{ {
if(mDirtyCurrentValue[i]) delete mCurrentValueBuffer[i];
{ mCurrentValueBuffer[i] = new ConstantVertexBuffer(attribs[i].mCurrentValue[0], attribs[i].mCurrentValue[1], attribs[i].mCurrentValue[2], attribs[i].mCurrentValue[3]);
delete mCurrentValueBuffer[i]; mDirtyCurrentValue[i] = false;
mCurrentValueBuffer[i] = new ConstantVertexBuffer(attribs[i].mCurrentValue[0], attribs[i].mCurrentValue[1], attribs[i].mCurrentValue[2], attribs[i].mCurrentValue[3]);
mDirtyCurrentValue[i] = false;
}
translated[i].vertexBuffer = mCurrentValueBuffer[i]->getResource();
translated[i].type = sw::STREAMTYPE_FLOAT;
translated[i].count = 4;
translated[i].stride = 0;
translated[i].offset = 0;
} }
translated[i].vertexBuffer = mCurrentValueBuffer[i]->getResource();
translated[i].type = sw::STREAMTYPE_FLOAT;
translated[i].count = 4;
translated[i].stride = 0;
translated[i].offset = 0;
} }
} }
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
// VertexDataManager.h: Defines the VertexDataManager, a class that // VertexDataManager.h: Defines the VertexDataManager, a class that
// runs the Buffer translation process. // runs the Buffer translation process.
#ifndef LIBGLESV2_VERTEXDATAMANAGER_H_ #ifndef LIBGLES_CM_VERTEXDATAMANAGER_H_
#define LIBGLESV2_VERTEXDATAMANAGER_H_ #define LIBGLES_CM_VERTEXDATAMANAGER_H_
#include "Context.h" #include "Context.h"
#include "Device.hpp" #include "Device.hpp"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
namespace gl namespace gl
{ {
...@@ -96,4 +96,4 @@ class VertexDataManager ...@@ -96,4 +96,4 @@ class VertexDataManager
} }
#endif // LIBGLESV2_VERTEXDATAMANAGER_H_ #endif // LIBGLES_CM_VERTEXDATAMANAGER_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
LIBRARY libGLESv2 LIBRARY libGLES_CM
EXPORTS EXPORTS
glActiveTexture @1 glActiveTexture
glAttachShader @2 glAlphaFunc
glBindAttribLocation @3 glAlphaFuncx
glBindBuffer @4 glBindBuffer
glBindFramebuffer @5 glBindTexture
glBindRenderbuffer @6 glBlendFunc
glBindTexture @7 glBufferData
glBlendColor @8 glBufferSubData
glBlendEquation @9 glClear
glBlendEquationSeparate @10 glClearColor
glBlendFunc @11 glClearColorx
glBlendFuncSeparate @12 glClearDepthf
glBufferData @13 glClearDepthx
glBufferSubData @14 glClearStencil
glCheckFramebufferStatus @15 glClientActiveTexture
glClear @16 glClipPlanef
glClearColor @17 glClipPlanex
glClearDepthf @18 glColor4f
glClearStencil @19 glColor4ub
glColorMask @20 glColor4x
glCompileShader @21 glColorMask
glCompressedTexImage2D @22 glColorPointer
glCompressedTexSubImage2D @23 glCompressedTexImage2D
glCopyTexImage2D @24 glCompressedTexSubImage2D
glCopyTexSubImage2D @25 glCopyTexImage2D
glCreateProgram @26 glCopyTexSubImage2D
glCreateShader @27 glCullFace
glCullFace @28 glDeleteBuffers
glDeleteBuffers @29 glDeleteTextures
glDeleteFramebuffers @30 glDepthFunc
glDeleteProgram @32 glDepthMask
glDeleteRenderbuffers @33 glDepthRangef
glDeleteShader @34 glDepthRangex
glDeleteTextures @31 glDisable
glDepthFunc @36 glDisableClientState
glDepthMask @37 glDrawArrays
glDepthRangef @38 glDrawElements
glDetachShader @35 glEnable
glDisable @39 glEnableClientState
glDisableVertexAttribArray @40 glFinish
glDrawArrays @41 glFlush
glDrawElements @42 glFogf
glEnable @43 glFogfv
glEnableVertexAttribArray @44 glFogx
glFinish @45 glFogxv
glFlush @46 glFrontFace
glFramebufferRenderbuffer @47 glFrustumf
glFramebufferTexture2D @48 glFrustumx
glFrontFace @49 glGenBuffers
glGenBuffers @50 glGenTextures
glGenFramebuffers @52 glGetBooleanv
glGenRenderbuffers @53 glGetBufferParameteriv
glGenTextures @54 glGetClipPlanef
glGenerateMipmap @51 glGetClipPlanex
glGetActiveAttrib @55 glGetError
glGetActiveUniform @56 glGetFixedv
glGetAttachedShaders @57 glGetFloatv
glGetAttribLocation @58 glGetIntegerv
glGetBooleanv @59 glGetLightfv
glGetBufferParameteriv @60 glGetLightxv
glGetError @61 glGetMaterialfv
glGetFloatv @62 glGetMaterialxv
glGetFramebufferAttachmentParameteriv @63 glGetPointerv
glGetIntegerv @64 glGetString
glGetProgramInfoLog @66 glGetTexEnvfv
glGetProgramiv @65 glGetTexEnviv
glGetRenderbufferParameteriv @67 glGetTexEnvxv
glGetShaderInfoLog @69 glGetTexParameterfv
glGetShaderPrecisionFormat @70 glGetTexParameteriv
glGetShaderSource @71 glGetTexParameterxv
glGetShaderiv @68 glHint
glGetString @72 glIsBuffer
glGetTexParameterfv @73 glIsEnabled
glGetTexParameteriv @74 glIsTexture
glGetUniformLocation @77 glLightModelf
glGetUniformfv @75 glLightModelfv
glGetUniformiv @76 glLightModelx
glGetVertexAttribPointerv @80 glLightModelxv
glGetVertexAttribfv @78 glLightf
glGetVertexAttribiv @79 glLightfv
glHint @81 glLightx
glIsBuffer @82 glLightxv
glIsEnabled @83 glLineWidth
glIsFramebuffer @84 glLineWidthx
glIsProgram @85 glLoadIdentity
glIsRenderbuffer @86 glLoadMatrixf
glIsShader @87 glLoadMatrixx
glIsTexture @88 glLogicOp
glLineWidth @89 glMaterialf
glLinkProgram @90 glMaterialfv
glPixelStorei @91 glMaterialx
glPolygonOffset @92 glMaterialxv
glReadPixels @93 glMatrixMode
glReleaseShaderCompiler @94 glMultMatrixf
glRenderbufferStorage @95 glMultMatrixx
glSampleCoverage @96 glMultiTexCoord4f
glScissor @97 glMultiTexCoord4x
glShaderBinary @98 glNormal3f
glShaderSource @99 glNormal3x
glStencilFunc @100 glNormalPointer
glStencilFuncSeparate @101 glOrthof
glStencilMask @102 glOrthox
glStencilMaskSeparate @103 glPixelStorei
glStencilOp @104 glPointParameterf
glStencilOpSeparate @105 glPointParameterfv
glTexImage2D @106 glPointParameterx
glTexParameterf @107 glPointParameterxv
glTexParameterfv @108 glPointSize
glTexParameteri @109 glPointSizex
glTexParameteriv @110 glPolygonOffset
glTexSubImage2D @111 glPolygonOffsetx
glUniform1f @112 glPopMatrix
glUniform1fv @113 glPushMatrix
glUniform1i @114 glReadPixels
glUniform1iv @115 glRotatef
glUniform2f @116 glRotatex
glUniform2fv @117 glSampleCoverage
glUniform2i @118 glSampleCoveragex
glUniform2iv @119 glScalef
glUniform3f @120 glScalex
glUniform3fv @121 glScissor
glUniform3i @122 glShadeModel
glUniform3iv @123 glStencilFunc
glUniform4f @124 glStencilMask
glUniform4fv @125 glStencilOp
glUniform4i @126 glTexCoordPointer
glUniform4iv @127 glTexEnvf
glUniformMatrix2fv @128 glTexEnvfv
glUniformMatrix3fv @129 glTexEnvi
glUniformMatrix4fv @130 glTexEnviv
glUseProgram @131 glTexEnvx
glValidateProgram @132 glTexEnvxv
glVertexAttrib1f @133 glTexImage2D
glVertexAttrib1fv @134 glTexParameterf
glVertexAttrib2f @135 glTexParameterfv
glVertexAttrib2fv @136 glTexParameteri
glVertexAttrib3f @137 glTexParameteriv
glVertexAttrib3fv @138 glTexParameterx
glVertexAttrib4f @139 glTexParameterxv
glVertexAttrib4fv @140 glTexSubImage2D
glVertexAttribPointer @141 glTranslatef
glViewport @142 glTranslatex
glVertexPointer
; Extensions glViewport
glTexImage3DOES @143
glBlitFramebufferANGLE @149
glRenderbufferStorageMultisampleANGLE @150
glDeleteFencesNV @151
glFinishFenceNV @152
glGenFencesNV @153
glGetFenceivNV @154
glIsFenceNV @155
glSetFenceNV @156
glTestFenceNV @157
;glGetTranslatedShaderSourceANGLE @159
;glTexStorage2DEXT @160
glGetGraphicsResetStatusEXT @161
glReadnPixelsEXT @162
glGetnUniformfvEXT @163
glGetnUniformivEXT @164
glGenQueriesEXT @165
glDeleteQueriesEXT @166
glIsQueryEXT @167
glBeginQueryEXT @168
glEndQueryEXT @169
glGetQueryivEXT @170
glGetQueryObjectuivEXT @171
; EGL dependencies ; EGL dependencies
glCreateContext @144 glCreateContext @144
......
...@@ -70,13 +70,13 @@ BEGIN ...@@ -70,13 +70,13 @@ BEGIN
BEGIN BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "FileDescription", "SwiftShader libGLESv2 Dynamic Link Library" VALUE "FileDescription", "SwiftShader libGLES_CM Dynamic Link Library"
VALUE "FileVersion", VERSION_STRING VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", "libGLESv2" VALUE "InternalName", "libGLES_CM"
VALUE "LegalCopyright", "Copyright (C) 2012 TransGaming Inc." VALUE "LegalCopyright", "Copyright (C) 2012 TransGaming Inc."
VALUE "OriginalFilename", "libGLESv2.dll" VALUE "OriginalFilename", "libGLES_CM.dll"
VALUE "PrivateBuild", VERSION_STRING VALUE "PrivateBuild", VERSION_STRING
VALUE "ProductName", "SwiftShader libGLESv2 Dynamic Link Library" VALUE "ProductName", "SwiftShader libGLES_CM Dynamic Link Library"
VALUE "ProductVersion", VERSION_STRING VALUE "ProductVersion", VERSION_STRING
END END
END END
......
...@@ -164,19 +164,15 @@ copy "$(OutDir)libGLES_CM.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Co ...@@ -164,19 +164,15 @@ copy "$(OutDir)libGLES_CM.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Co
<ClCompile Include="Context.cpp" /> <ClCompile Include="Context.cpp" />
<ClCompile Include="..\common\debug.cpp" /> <ClCompile Include="..\common\debug.cpp" />
<ClCompile Include="Device.cpp" /> <ClCompile Include="Device.cpp" />
<ClCompile Include="Fence.cpp" />
<ClCompile Include="Framebuffer.cpp" /> <ClCompile Include="Framebuffer.cpp" />
<ClCompile Include="HandleAllocator.cpp" /> <ClCompile Include="HandleAllocator.cpp" />
<ClCompile Include="Image.cpp" /> <ClCompile Include="Image.cpp" />
<ClCompile Include="IndexDataManager.cpp" /> <ClCompile Include="IndexDataManager.cpp" />
<ClCompile Include="libGLES_CM.cpp" /> <ClCompile Include="libGLES_CM.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
<ClCompile Include="Program.cpp" />
<ClCompile Include="Query.cpp" />
<ClCompile Include="RefCountObject.cpp" /> <ClCompile Include="RefCountObject.cpp" />
<ClCompile Include="Renderbuffer.cpp" /> <ClCompile Include="Renderbuffer.cpp" />
<ClCompile Include="ResourceManager.cpp" /> <ClCompile Include="ResourceManager.cpp" />
<ClCompile Include="Shader.cpp" />
<ClCompile Include="Texture.cpp" /> <ClCompile Include="Texture.cpp" />
<ClCompile Include="utilities.cpp" /> <ClCompile Include="utilities.cpp" />
<ClCompile Include="VertexDataManager.cpp" /> <ClCompile Include="VertexDataManager.cpp" />
...@@ -189,20 +185,16 @@ copy "$(OutDir)libGLES_CM.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Co ...@@ -189,20 +185,16 @@ copy "$(OutDir)libGLES_CM.dll" "$(ProjectDir)..\..\..\lib\$(Configuration)\"</Co
<ClInclude Include="Buffer.h" /> <ClInclude Include="Buffer.h" />
<ClInclude Include="Context.h" /> <ClInclude Include="Context.h" />
<ClInclude Include="Device.hpp" /> <ClInclude Include="Device.hpp" />
<ClInclude Include="Fence.h" />
<ClInclude Include="Framebuffer.h" /> <ClInclude Include="Framebuffer.h" />
<ClInclude Include="HandleAllocator.h" /> <ClInclude Include="HandleAllocator.h" />
<ClInclude Include="Image.hpp" /> <ClInclude Include="Image.hpp" />
<ClInclude Include="IndexDataManager.h" /> <ClInclude Include="IndexDataManager.h" />
<ClInclude Include="main.h" /> <ClInclude Include="main.h" />
<ClInclude Include="mathutil.h" /> <ClInclude Include="mathutil.h" />
<ClInclude Include="Program.h" />
<ClInclude Include="Query.h" />
<ClInclude Include="RefCountObject.h" /> <ClInclude Include="RefCountObject.h" />
<ClInclude Include="Renderbuffer.h" /> <ClInclude Include="Renderbuffer.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<ClInclude Include="ResourceManager.h" /> <ClInclude Include="ResourceManager.h" />
<ClInclude Include="Shader.h" />
<ClInclude Include="Texture.h" /> <ClInclude Include="Texture.h" />
<ClInclude Include="utilities.h" /> <ClInclude Include="utilities.h" />
<ClInclude Include="VertexDataManager.h" /> <ClInclude Include="VertexDataManager.h" />
......
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
<ClCompile Include="..\common\debug.cpp"> <ClCompile Include="..\common\debug.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Fence.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Framebuffer.cpp"> <ClCompile Include="Framebuffer.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
...@@ -35,9 +32,6 @@ ...@@ -35,9 +32,6 @@
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Program.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RefCountObject.cpp"> <ClCompile Include="RefCountObject.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
...@@ -47,9 +41,6 @@ ...@@ -47,9 +41,6 @@
<ClCompile Include="ResourceManager.cpp"> <ClCompile Include="ResourceManager.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Shader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Texture.cpp"> <ClCompile Include="Texture.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
...@@ -65,9 +56,6 @@ ...@@ -65,9 +56,6 @@
<ClCompile Include="Image.cpp"> <ClCompile Include="Image.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Query.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="libGLES_CM.cpp"> <ClCompile Include="libGLES_CM.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
...@@ -79,9 +67,6 @@ ...@@ -79,9 +67,6 @@
<ClInclude Include="Context.h"> <ClInclude Include="Context.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Fence.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Framebuffer.h"> <ClInclude Include="Framebuffer.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
...@@ -97,9 +82,6 @@ ...@@ -97,9 +82,6 @@
<ClInclude Include="mathutil.h"> <ClInclude Include="mathutil.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Program.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RefCountObject.h"> <ClInclude Include="RefCountObject.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
...@@ -112,9 +94,6 @@ ...@@ -112,9 +94,6 @@
<ClInclude Include="ResourceManager.h"> <ClInclude Include="ResourceManager.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Shader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Texture.h"> <ClInclude Include="Texture.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
...@@ -139,9 +118,6 @@ ...@@ -139,9 +118,6 @@
<ClInclude Include="..\include\GLES2\gl2platform.h"> <ClInclude Include="..\include\GLES2\gl2platform.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Query.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\common\debug.h"> <ClInclude Include="..\common\debug.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
......
...@@ -179,7 +179,7 @@ void error(GLenum errorCode) ...@@ -179,7 +179,7 @@ void error(GLenum errorCode)
context->recordOutOfMemory(); context->recordOutOfMemory();
TRACE("\t! Error generated: out of memory\n"); TRACE("\t! Error generated: out of memory\n");
break; break;
case GL_INVALID_FRAMEBUFFER_OPERATION: case GL_INVALID_FRAMEBUFFER_OPERATION_OES:
context->recordInvalidFramebufferOperation(); context->recordInvalidFramebufferOperation();
TRACE("\t! Error generated: invalid framebuffer operation\n"); TRACE("\t! Error generated: invalid framebuffer operation\n");
break; break;
......
...@@ -11,17 +11,18 @@ ...@@ -11,17 +11,18 @@
// main.h: Management of thread-local data. // main.h: Management of thread-local data.
#ifndef LIBGLESV2_MAIN_H_ #ifndef LIBGLES_CM_MAIN_H_
#define LIBGLESV2_MAIN_H_ #define LIBGLES_CM_MAIN_H_
#include "Context.h" #include "Context.h"
#include "Device.hpp" #include "Device.hpp"
#include "common/debug.h" #include "common/debug.h"
#include "libEGL/Display.h" #include "libEGL/Display.h"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <GLES2/gl2ext.h> #define GL_GLEXT_PROTOTYPES
#include <GLES/glext.h>
namespace gl namespace gl
{ {
...@@ -49,4 +50,4 @@ const T &error(GLenum errorCode, const T &returnValue) ...@@ -49,4 +50,4 @@ const T &error(GLenum errorCode, const T &returnValue)
return returnValue; return returnValue;
} }
#endif // LIBGLESV2_MAIN_H_ #endif // LIBGLES_CM_MAIN_H_
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
// mathutil.h: Math and bit manipulation functions. // mathutil.h: Math and bit manipulation functions.
#ifndef LIBGLESV2_MATHUTIL_H_ #ifndef LIBGLES_CM_MATHUTIL_H_
#define LIBGLESV2_MATHUTIL_H_ #define LIBGLES_CM_MATHUTIL_H_
#include "common/debug.h" #include "common/debug.h"
...@@ -76,4 +76,4 @@ inline unsigned int unorm(float x) ...@@ -76,4 +76,4 @@ inline unsigned int unorm(float x)
} }
} }
#endif // LIBGLESV2_MATHUTIL_H_ #endif // LIBGLES_CM_MATHUTIL_H_
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // Microsoft Visual C++ generated include file.
// Used by libGLESv2.rc // Used by libGLES_CM.rc
// Next default values for new objects // Next default values for new objects
// //
......
...@@ -11,16 +11,17 @@ ...@@ -11,16 +11,17 @@
// utilities.h: Conversion functions and other utility routines. // utilities.h: Conversion functions and other utility routines.
#ifndef LIBGLESV2_UTILITIES_H #ifndef LIBGLES_CM_UTILITIES_H
#define LIBGLESV2_UTILITIES_H #define LIBGLES_CM_UTILITIES_H
#include "Device.hpp" #include "Device.hpp"
#include "Image.hpp" #include "Image.hpp"
#include "Texture.h" #include "Texture.h"
#define GL_APICALL #define GL_API
#include <GLES2/gl2.h> #include <GLES/gl.h>
#include <GLES2/gl2ext.h> #define GL_GLEXT_PROTOTYPES
#include <GLES/glext.h>
#include <string> #include <string>
...@@ -28,14 +29,6 @@ namespace gl ...@@ -28,14 +29,6 @@ namespace gl
{ {
struct Color; 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); int ComputePixelSize(GLenum format, GLenum type);
GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment); GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment);
GLsizei ComputeCompressedPitch(GLsizei width, GLenum format); GLsizei ComputeCompressedPitch(GLsizei width, GLenum format);
...@@ -83,4 +76,4 @@ namespace sw2es ...@@ -83,4 +76,4 @@ namespace sw2es
GLenum ConvertDepthStencilFormat(sw::Format format); GLenum ConvertDepthStencilFormat(sw::Format format);
} }
#endif // LIBGLESV2_UTILITIES_H #endif // LIBGLES_CM_UTILITIES_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