mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-18 19:12:44 +03:00
feat(gx): add incomplete 'CGxDeviceGLSDL' (#2)
* chore(build): add vendored SDL 3.0.0 library * chore(build): add vendored glew-cmake-2.2.0 library * feat(console): in the presence of -opengl launch flag, change GxApi to OpenGl * feat(gx): add uncompleted CGxDeviceGLSDL targeting Windows and Linux * chore(build): change SDL3 linkage from shared (bad) to to static (good)
This commit is contained in:
parent
934e0fb600
commit
706c8903a1
@ -198,6 +198,10 @@ void ConsoleDeviceInitialize(const char* title) {
|
||||
EGxApi api = GxApi_OpenGl;
|
||||
#if defined(WHOA_SYSTEM_WIN)
|
||||
api = GxApi_D3d9;
|
||||
|
||||
if (CmdLineGetBool(CMD_OPENGL)) {
|
||||
api = GxApi_OpenGl;
|
||||
}
|
||||
#elif defined(WHOA_SYSTEM_MAC)
|
||||
api = GxApi_GLL;
|
||||
#endif
|
||||
|
@ -14,6 +14,10 @@
|
||||
#include "gx/d3d/CGxDeviceD3d.hpp"
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_LINUX) || defined(WHOA_SYSTEM_WIN)
|
||||
#include "gx/glsdl/CGxDeviceGLSDL.hpp"
|
||||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC)
|
||||
#include "gx/gll/CGxDeviceGLL.hpp"
|
||||
#endif
|
||||
@ -119,13 +123,13 @@ CGxDevice* CGxDevice::NewGLL() {
|
||||
}
|
||||
#endif
|
||||
|
||||
CGxDevice* CGxDevice::NewOpenGl() {
|
||||
// TODO
|
||||
// auto m = SMemAlloc(sizeof(CGxDeviceOpenGl), __FILE__, __LINE__, 0x0);
|
||||
// return new (m) CGxDeviceOpenGl();
|
||||
|
||||
return nullptr;
|
||||
#if defined(WHOA_SYSTEM_WIN) || defined(WHOA_SYSTEM_LINUX)
|
||||
CGxDevice* CGxDevice::NewOpenGl() {
|
||||
auto m = SMemAlloc(sizeof(CGxDeviceGLSDL), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CGxDeviceGLSDL();
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t CGxDevice::PrimCalcCount(EGxPrim primType, uint32_t count) {
|
||||
auto div = CGxDevice::s_primVtxDiv[primType];
|
||||
|
@ -19,6 +19,12 @@ if(WHOA_SYSTEM_MAC)
|
||||
list(APPEND GX_SOURCES ${GLL_SOURCES})
|
||||
endif()
|
||||
|
||||
# Build OpenGL/SDL graphics device on Windows and Linux
|
||||
if(WHOA_SYSTEM_WIN OR WHOA_SYSTEM_LINUX)
|
||||
file(GLOB GLSDL_SOURCES "glsdl/*.cpp")
|
||||
list(APPEND GX_SOURCES ${GLSDL_SOURCES})
|
||||
endif()
|
||||
|
||||
add_library(gx STATIC ${GX_SOURCES})
|
||||
|
||||
target_include_directories(gx
|
||||
@ -47,6 +53,15 @@ if(WHOA_SYSTEM_WIN)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link SDL3 and GLEW for Windows and Linux
|
||||
if (WHOA_SYSTEM_WIN OR WHOA_SYSTEM_LINUX)
|
||||
target_link_libraries(gx
|
||||
PRIVATE
|
||||
SDL3::SDL3-static
|
||||
libglew_static
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WHOA_SYSTEM_MAC)
|
||||
target_link_libraries(gx
|
||||
PRIVATE
|
||||
|
1326
src/gx/glsdl/CGxDeviceGLSDL.cpp
Normal file
1326
src/gx/glsdl/CGxDeviceGLSDL.cpp
Normal file
File diff suppressed because it is too large
Load Diff
82
src/gx/glsdl/CGxDeviceGLSDL.hpp
Normal file
82
src/gx/glsdl/CGxDeviceGLSDL.hpp
Normal file
@ -0,0 +1,82 @@
|
||||
#ifndef GX_GL_SDL_C_GX_DEVICE_GL_SDL_HPP
|
||||
#define GX_GL_SDL_C_GX_DEVICE_GL_SDL_HPP
|
||||
|
||||
#include "gx/CGxDevice.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include "gx/glsdl/GLSDLWindow.hpp"
|
||||
|
||||
class CGxBatch;
|
||||
class CGxShader;
|
||||
|
||||
class CGxDeviceGLSDL : public CGxDevice {
|
||||
public:
|
||||
// Static variables
|
||||
static GLEnum s_glCubeMapFaces[];
|
||||
static GLEnum s_glDstBlend[];
|
||||
static GLEnum s_glSrcBlend[];
|
||||
static GLTextureFormat s_gxTexFmtToGLSDLFmt[];
|
||||
static GLEnum s_poolTarget2BufferFormat[];
|
||||
static GLEnum s_poolTarget2BufferType[];
|
||||
static GLEnum s_poolUsage2BufferUsage[];
|
||||
static GLEnum s_primitiveConversion[];
|
||||
|
||||
// Member variables
|
||||
GLSDLDevice m_GLSDLDevice;
|
||||
GLSDLWindow m_GLSDLWindow;
|
||||
GLVertexFormat m_glFormats[GxVertexBufferFormats_Last] = {};
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ITexMarkAsUpdated(CGxTex*);
|
||||
virtual void IRsSendToHw(EGxRenderState);
|
||||
virtual int32_t DeviceCreate(int32_t (*windowProc)(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam), const CGxFormat&);
|
||||
virtual int32_t DeviceSetFormat(const CGxFormat&);
|
||||
virtual void* DeviceWindow();
|
||||
virtual void DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) {};
|
||||
virtual void CapsWindowSize(CRect&);
|
||||
virtual void CapsWindowSizeInScreenCoords(CRect& dst);
|
||||
virtual void ScenePresent();
|
||||
virtual void SceneClear(uint32_t, CImVector);
|
||||
virtual void XformSetProjection(const C44Matrix&);
|
||||
virtual void XformSetView(const C44Matrix&);
|
||||
virtual void Draw(CGxBatch* batch, int32_t indexed);
|
||||
virtual void PoolSizeSet(CGxPool*, uint32_t);
|
||||
virtual char* BufLock(CGxBuf*);
|
||||
virtual int32_t BufUnlock(CGxBuf*, uint32_t);
|
||||
virtual void BufData(CGxBuf* buf, const void* data, size_t size, uintptr_t offset);
|
||||
virtual void TexDestroy(CGxTex* texId);
|
||||
virtual void IShaderCreate(CGxShader*);
|
||||
virtual void ShaderCreate(CGxShader*[], EGxShTarget, const char*, const char*, int32_t);
|
||||
virtual int32_t StereoEnabled();
|
||||
|
||||
// Member functions
|
||||
CGxDeviceGLSDL();
|
||||
char* IBufLock(CGxBuf*);
|
||||
int32_t IBufUnlock(CGxBuf*);
|
||||
void ISceneBegin();
|
||||
void ISetCaps(const CGxFormat& format);
|
||||
void IShaderBindPixel(CGxShader*);
|
||||
void IShaderBindVertex(CGxShader*);
|
||||
void IShaderConstantsFlush();
|
||||
void IShaderCreatePixel(CGxShader*);
|
||||
void IShaderCreateVertex(CGxShader*);
|
||||
void IStateSetGLSDLDefaults();
|
||||
void IStateSync();
|
||||
void IStateSyncEnables();
|
||||
void IStateSyncIndexPtr();
|
||||
void IStateSyncLights();
|
||||
void IStateSyncMaterial();
|
||||
void IStateSyncScissorRect();
|
||||
void IStateSyncVertexPtrs();
|
||||
void IStateSyncXforms();
|
||||
void ITexCreate(CGxTex*);
|
||||
void ITexSetFlags(CGxTex*);
|
||||
void ITexUpload(CGxTex*);
|
||||
void IXformSetProjection(const C44Matrix&);
|
||||
void IXformSetView(const C44Matrix&);
|
||||
void IXformSetViewport();
|
||||
void PatchPixelShader(CGxShader*);
|
||||
void PatchVertexShader(CGxShader*);
|
||||
void Resize(uint32_t width, uint32_t height);
|
||||
};
|
||||
|
||||
#endif
|
50
src/gx/glsdl/GL.cpp
Normal file
50
src/gx/glsdl/GL.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
|
||||
TextureFormatInfo k_TextureFormatInfo[GLTF_NUM_TEXTURE_FORMATS] = {
|
||||
{ 0, 0, 0, 0, 0, "GLTF INVALID!!" },
|
||||
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, 4, "ARGB8888" },
|
||||
{ GL_RGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, 4, "XRGB8888" },
|
||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, 0, 4, "RGBA8888" },
|
||||
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, 4, "ABGR8888" },
|
||||
{ GL_RGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, 4, "ARGB0888" },
|
||||
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, 0, 3, "RGB888" },
|
||||
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, 0, 3, "BGR888" },
|
||||
{ GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT, 0, 16, "RGBA32F" },
|
||||
{ GL_RGBA16F_ARB, GL_RGBA, GL_HALF_FLOAT, 0, 8, "RGBA16F" },
|
||||
{ GL_RGB16F_ARB, GL_RGB, GL_HALF_FLOAT, 0, 6, "RG16F" },
|
||||
{ GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, 4, "D32" },
|
||||
{ GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, 4, "D24" },
|
||||
{ GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, 2, "D16" },
|
||||
{ GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_HALF_FLOAT, 0, 4, "DF" },
|
||||
{ GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0, 4, "D24S8" },
|
||||
{ GL_ALPHA8, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, 0, 1, "S8" },
|
||||
{ GL_RGBA4, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 0, 2, "ARGB4444" },
|
||||
{ GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 0, 2, "ARGB1555" },
|
||||
{ GL_RGB5, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 0, 2, "ARGB0555" },
|
||||
{ GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0, 2, "RGB565" },
|
||||
{ GL_RGBA, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, 0, 4, "A2RGB10" },
|
||||
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, 0, 6, "RGB16" },
|
||||
{ GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0, 1, "L8" },
|
||||
{ GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE, 0, 1, "A8" },
|
||||
{ GL_LUMINANCE8_ALPHA8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, 2, "A8L8" },
|
||||
{ GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 1, 8, "DXT1" },
|
||||
{ GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 1, 16, "DXT3" },
|
||||
{ GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, 1, 16, "DXT5" }
|
||||
};
|
||||
|
||||
VertexTypeInfo k_VertexTypeInfo[GLVT_NUM_VERTEX_TYPES] = {
|
||||
{ 0, 0, 0, 0, "INVALID" },
|
||||
{ GL_FLOAT, 1, 0, 4, "FLOAT1" },
|
||||
{ GL_FLOAT, 2, 0, 8, "FLOAT2" },
|
||||
{ GL_FLOAT, 3, 0, 12, "FLOAT3" },
|
||||
{ GL_FLOAT, 4, 0, 16, "FLOAT4" },
|
||||
{ GL_UNSIGNED_BYTE, 4, 0, 4, "UBYTE4" },
|
||||
{ GL_UNSIGNED_BYTE, 4, 1, 4, "UBYTE4N" },
|
||||
{ GL_SHORT, 1, 0, 2, "SHORT" },
|
||||
{ GL_SHORT, 2, 0, 4, "SHORT2" },
|
||||
{ GL_SHORT, 4, 0, 8, "SHORT4" },
|
||||
{ GL_SHORT, 2, 1, 4, "SHORT2N" },
|
||||
{ GL_SHORT, 4, 1, 8, "SHORT4N" },
|
||||
{ GL_UNSIGNED_SHORT, 2, 1, 4, "USHORT2N" },
|
||||
{ GL_UNSIGNED_SHORT, 4, 1, 8, "USHORT4N" }
|
||||
};
|
33
src/gx/glsdl/GL.hpp
Normal file
33
src/gx/glsdl/GL.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef GX_GL_SDL_GL_HPP
|
||||
#define GX_GL_SDL_GL_HPP
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
|
||||
typedef GLenum GLEnum;
|
||||
|
||||
#define kMAX_VERTEX_ATTRIBS 16
|
||||
|
||||
struct TextureFormatInfo {
|
||||
GLenum m_InternalFormat;
|
||||
GLenum m_DataFormat;
|
||||
GLenum m_DataType;
|
||||
int32_t m_IsCompressed;
|
||||
int32_t m_BytePerPixel;
|
||||
char m_Name[16];
|
||||
};
|
||||
|
||||
struct VertexTypeInfo {
|
||||
GLenum m_Type;
|
||||
GLint m_Size;
|
||||
GLboolean m_Normalized;
|
||||
GLint m_ByteSize;
|
||||
const char* m_Name;
|
||||
};
|
||||
|
||||
extern TextureFormatInfo k_TextureFormatInfo[GLTF_NUM_TEXTURE_FORMATS];
|
||||
extern VertexTypeInfo k_VertexTypeInfo[GLVT_NUM_VERTEX_TYPES];
|
||||
|
||||
#endif
|
45
src/gx/glsdl/GLBatch.hpp
Normal file
45
src/gx/glsdl/GLBatch.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef GX_GL_SDL_GL_BATCH_HPP
|
||||
#define GX_GL_SDL_GL_BATCH_HPP
|
||||
|
||||
#include "gx/glsdl/GLBuffer.hpp"
|
||||
#include "gx/glsdl/GLShader.hpp"
|
||||
#include "gx/glsdl/GLTexture.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include "gx/glsdl/GLVertexFormat.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class GLBatch {
|
||||
public:
|
||||
GLShader* var0;
|
||||
GLShader* var1;
|
||||
GLTexture* textures[16];
|
||||
GLBuffer* var3;
|
||||
GLBuffer* var4[4];
|
||||
uint32_t var5[4];
|
||||
uint32_t var6[4];
|
||||
GLVertexFormat* var7;
|
||||
uint32_t var8;
|
||||
uint32_t var9;
|
||||
uint32_t var10;
|
||||
uint32_t var11;
|
||||
uint32_t var12;
|
||||
uint32_t var13;
|
||||
uint32_t var14;
|
||||
int32_t var15;
|
||||
bool var16;
|
||||
bool var17;
|
||||
GLStates var18;
|
||||
GLTexture2D* colorBuffer[4];
|
||||
GLTexture2D* var20;
|
||||
uint32_t var21[128];
|
||||
char var22[64];
|
||||
char var23[1024];
|
||||
uint32_t var24;
|
||||
bool var25;
|
||||
int64_t var26;
|
||||
int64_t var27;
|
||||
float var28[4096];
|
||||
float var29[1024];
|
||||
};
|
||||
|
||||
#endif
|
130
src/gx/glsdl/GLBuffer.cpp
Normal file
130
src/gx/glsdl/GLBuffer.cpp
Normal file
@ -0,0 +1,130 @@
|
||||
#include "gx/glsdl/GLBuffer.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include "gx/glsdl/GLPool.hpp"
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
#include <bc/Memory.hpp>
|
||||
|
||||
bool GLBuffer::m_UsingVBO = 1;
|
||||
|
||||
GLEnum GLBuffer::s_FlagToAccess[] = {
|
||||
GL_READ_WRITE, // GLMap_None
|
||||
GL_WRITE_ONLY, // GLMap_Unk1
|
||||
GL_WRITE_ONLY, // GLMap_Unk2
|
||||
GL_READ_ONLY // GLMap_Unk3
|
||||
};
|
||||
|
||||
GLBuffer* GLBuffer::Create(GLEnum type, uint32_t size, const void* a3, GLEnum usage, GLEnum format) {
|
||||
GLBuffer* buffer = GLPool<GLBuffer>::Get()->GetNextObject();
|
||||
|
||||
buffer->m_Type = type;
|
||||
buffer->m_Size = size;
|
||||
buffer->m_Usage = usage;
|
||||
buffer->m_IndexFormat = format;
|
||||
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
device->BindBuffer(buffer, GL_ZERO);
|
||||
|
||||
if (GLBuffer::m_UsingVBO) {
|
||||
glBufferData(buffer->m_Type, buffer->m_Size, a3, buffer->m_Usage);
|
||||
// glBufferParameteriAPPLE(buffer->m_Type, GL_BUFFER_SERIALIZED_MODIFY_APPLE, buffer->m_Usage - GL_DYNAMIC_DRAW > 1);
|
||||
// glBufferParameteriAPPLE(buffer->m_Type, GL_BUFFER_FLUSHING_UNMAP_APPLE, 0);
|
||||
} else {
|
||||
Blizzard::Memory::Free(buffer->m_Data);
|
||||
|
||||
void* data = Blizzard::Memory::Allocate(size);
|
||||
if (a3) {
|
||||
memcpy(data, a3, size);
|
||||
}
|
||||
|
||||
buffer->m_Data = reinterpret_cast<char*>(data);
|
||||
}
|
||||
|
||||
// TODO
|
||||
// buffer->m_TimeStamp = Blizzard::Time::GetTimestamp();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
GLBuffer::GLBuffer() : GLObject() {
|
||||
if (GLBuffer::m_UsingVBO) {
|
||||
this->m_BufferID = GLPool<GLBuffer>::Get()->GetNextName();
|
||||
}
|
||||
}
|
||||
|
||||
char* GLBuffer::Map(uint32_t offset, uint32_t size, eMapFlag flag) {
|
||||
BLIZZARD_ASSERT((offset + size) <= this->m_Size);
|
||||
BLIZZARD_ASSERT(this->m_Usage == GL_STATIC_DRAW || flag != GLMap_None);
|
||||
BLIZZARD_ASSERT(this->m_MapFlag == GLMap_NotMapped);
|
||||
BLIZZARD_ASSERT(flag >= GLMap_None && flag < GLMap_Count);
|
||||
|
||||
this->m_MapOffset = offset;
|
||||
this->m_MapSize = offset + size == 0 ? this->m_Size : size;
|
||||
this->m_MapFlag = flag;
|
||||
|
||||
if (GLBuffer::m_UsingVBO) {
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
device->BindBuffer(this, GL_ZERO);
|
||||
|
||||
if (flag == GLMap_Unk2) {
|
||||
if (this->m_Usage - GL_DYNAMIC_DRAW <= 1) {
|
||||
BLIZZARD_ASSERT(offset == 0);
|
||||
}
|
||||
|
||||
glBufferData(this->m_Type, this->m_Size, nullptr, this->m_Usage);
|
||||
}
|
||||
|
||||
void* data = glMapBuffer(this->m_Type, GLBuffer::s_FlagToAccess[flag]);
|
||||
this->m_Data = reinterpret_cast<char*>(data);
|
||||
|
||||
BLIZZARD_ASSERT(this->m_Data != nullptr);
|
||||
}
|
||||
|
||||
return this->m_Data + offset;
|
||||
}
|
||||
|
||||
void GLBuffer::ReleaseObject() {
|
||||
if (GLBuffer::m_UsingVBO) {
|
||||
if (this->m_Type) {
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
device->BindBuffer(this, GL_ZERO);
|
||||
|
||||
glBufferData(this->m_Type, 1, nullptr, this->m_Usage);
|
||||
|
||||
// TODO GLPool<GLBuffer>::GLObjectPool::Push((GLPool<GLBuffer>::m_pool + 32776), this);
|
||||
} else {
|
||||
// TODO GLPool<GLBuffer>::GLObjectPool::Push((GLPool<GLBuffer>::m_pool + 32776), this);
|
||||
}
|
||||
} else {
|
||||
Blizzard::Memory::Free(this->m_Data);
|
||||
this->m_Data = nullptr;
|
||||
|
||||
// TODO GLPool<GLBuffer>::GLObjectPool::Push((GLPool<GLBuffer>::m_pool + 32776), this);
|
||||
}
|
||||
}
|
||||
|
||||
void GLBuffer::Unmap(uint32_t size) {
|
||||
BLIZZARD_ASSERT((this->m_MapOffset + size) <= m_Size);
|
||||
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
device->BindBuffer(this, GL_ZERO);
|
||||
|
||||
if (this->m_MapFlag != 3) {
|
||||
if (GLBuffer::m_UsingVBO) {
|
||||
glFlushMappedBufferRange(this->m_Type, this->m_MapOffset, size ? size : this->m_MapSize);
|
||||
}
|
||||
|
||||
// TODO
|
||||
// this->m_TimeStamp = Blizzard::Time::GetTimestamp();
|
||||
}
|
||||
|
||||
if (!GLBuffer::m_UsingVBO) {
|
||||
this->m_MapFlag = GLMap_NotMapped;
|
||||
return;
|
||||
}
|
||||
|
||||
GLboolean result = glUnmapBuffer(this->m_Type);
|
||||
BLIZZARD_ASSERT(result);
|
||||
|
||||
this->m_MapFlag = GLMap_NotMapped;
|
||||
}
|
47
src/gx/glsdl/GLBuffer.hpp
Normal file
47
src/gx/glsdl/GLBuffer.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef GX_GL_SDL_GL_BUFFER_HPP
|
||||
#define GX_GL_SDL_GL_BUFFER_HPP
|
||||
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
|
||||
class GLBuffer : public GLObject {
|
||||
public:
|
||||
// Types
|
||||
enum eMapFlag {
|
||||
GLMap_NotMapped = -1,
|
||||
GLMap_None = 0,
|
||||
GLMap_Unk1 = 1,
|
||||
GLMap_Unk2 = 2,
|
||||
GLMap_Unk3 = 3,
|
||||
GLMap_Count = 4
|
||||
};
|
||||
|
||||
// Static variables
|
||||
static bool m_UsingVBO;
|
||||
static GLEnum s_FlagToAccess[];
|
||||
|
||||
// Static functions
|
||||
static GLBuffer* Create(GLEnum, uint32_t, const void*, GLEnum, GLEnum);
|
||||
|
||||
// Member variables
|
||||
uint32_t m_Size = 0;
|
||||
GLEnum m_Type = 0;
|
||||
GLEnum m_Usage = 0;
|
||||
uint32_t m_BufferID = 0;
|
||||
GLEnum m_IndexFormat = 0;
|
||||
char* m_Data = nullptr;
|
||||
uint32_t m_MapOffset = 0;
|
||||
uint32_t m_MapSize = 0;
|
||||
uint32_t m_MapFlag = GLMap_NotMapped;
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ReleaseObject();
|
||||
|
||||
// Member functions
|
||||
GLBuffer();
|
||||
char* Map(uint32_t, uint32_t, eMapFlag);
|
||||
void Unmap(uint32_t);
|
||||
};
|
||||
|
||||
#endif
|
8
src/gx/glsdl/GLBufferPool.hpp
Normal file
8
src/gx/glsdl/GLBufferPool.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GX_GL_SDL_GL_BUFFER_POOL_HPP
|
||||
#define GX_GL_SDL_GL_BUFFER_POOL_HPP
|
||||
|
||||
class GLBufferPool {
|
||||
public:
|
||||
};
|
||||
|
||||
#endif
|
8
src/gx/glsdl/GLDebugMipmap2D.hpp
Normal file
8
src/gx/glsdl/GLDebugMipmap2D.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GX_GL_SDL_GL_DEBUG_MIPMAP_2D_HPP
|
||||
#define GX_GL_SDL_GL_DEBUG_MIPMAP_2D_HPP
|
||||
|
||||
class GLDebugMipmap2D {
|
||||
public:
|
||||
};
|
||||
|
||||
#endif
|
150
src/gx/glsdl/GLFramebuffer.cpp
Normal file
150
src/gx/glsdl/GLFramebuffer.cpp
Normal file
@ -0,0 +1,150 @@
|
||||
#include "gx/glsdl/GLFramebuffer.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include "gx/glsdl/GLMipmap.hpp"
|
||||
#include "gx/glsdl/GLPool.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
GLFramebuffer* GLFramebuffer::Create(bool a1) {
|
||||
GLFramebuffer* framebuffer = new GLFramebuffer(a1);
|
||||
|
||||
if (!a1) {
|
||||
// TODO
|
||||
// BLIZZARD_ASSERT(framebuffer->m_FramebufferID >= PoolStats<GLFramebuffer>::NAME_POOL_FIRST_NAME);
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(framebuffer->m_NumAttach == 0);
|
||||
|
||||
framebuffer->m_Width = 0;
|
||||
framebuffer->m_Height = 0;
|
||||
framebuffer->m_Device = GLSDLDevice::Get();
|
||||
|
||||
return framebuffer;
|
||||
}
|
||||
|
||||
GLFramebuffer::GLFramebuffer(bool a1) : GLObject() {
|
||||
if (!a1) {
|
||||
this->m_FramebufferID = GLPool<GLFramebuffer>::Get()->GetNextName();
|
||||
}
|
||||
}
|
||||
|
||||
void GLFramebuffer::Attach(GLMipmap* image, GLenum a3, int32_t a4) {
|
||||
BLIZZARD_ASSERT(this->m_Device == GLSDLDevice::Get());
|
||||
|
||||
if (!image) {
|
||||
this->Detach(a3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (a3 == GL_DEPTH_STENCIL) {
|
||||
BLIZZARD_ASSERT(image->GetFormat() == GLTF_D24S8);
|
||||
|
||||
this->Attach(image, GL_DEPTH_ATTACHMENT, 0);
|
||||
this->Attach(image, GL_STENCIL_ATTACHMENT, 0);
|
||||
|
||||
(*image->m_AttachPoints)[this->m_FramebufferID].point = GL_DEPTH_STENCIL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t index;
|
||||
|
||||
if (a3 == GL_DEPTH_ATTACHMENT) {
|
||||
index = 4;
|
||||
} else if (a3 == GL_STENCIL_ATTACHMENT) {
|
||||
index = 5;
|
||||
} else {
|
||||
index = a3 - GL_COLOR_ATTACHMENT0;
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(index < MAX_ATTACHMENT);
|
||||
|
||||
GLMipmap* oldImage = this->m_Attachments[index];
|
||||
|
||||
if (image != oldImage) {
|
||||
if (oldImage) {
|
||||
oldImage->Detach(this, a3, true);
|
||||
} else {
|
||||
++this->m_NumAttach;
|
||||
}
|
||||
|
||||
this->m_Attachments[index] = image;
|
||||
|
||||
this->m_Width = image->m_Width;
|
||||
this->m_Height = image->m_Height;
|
||||
|
||||
image->Attach(this, a3, a4);
|
||||
this->m_Device->Sub38460(0);
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT((*image->m_AttachPoints)[m_FramebufferID].framebuffer == this);
|
||||
}
|
||||
|
||||
void GLFramebuffer::Detach(GLenum a2) {
|
||||
int32_t v2 = a2;
|
||||
int32_t index;
|
||||
|
||||
if (a2 == GL_DEPTH_STENCIL) {
|
||||
index = 5;
|
||||
v2 = GL_STENCIL_ATTACHMENT;
|
||||
this->Detach(GL_DEPTH_ATTACHMENT);
|
||||
} else if (a2 == GL_DEPTH_ATTACHMENT) {
|
||||
index = 4;
|
||||
} else if (a2 == GL_STENCIL_ATTACHMENT) {
|
||||
index = 5;
|
||||
} else {
|
||||
index = a2 - GL_COLOR_ATTACHMENT0;
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(index < MAX_ATTACHMENT);
|
||||
|
||||
GLMipmap* oldImage = this->m_Attachments[index];
|
||||
|
||||
if (oldImage) {
|
||||
oldImage->Detach(this, v2, 0);
|
||||
|
||||
--this->m_NumAttach;
|
||||
|
||||
this->m_Attachments[index] = 0;
|
||||
|
||||
if (this->m_Device == GLSDLDevice::Get()) {
|
||||
this->m_Device->Sub38460(0);
|
||||
}
|
||||
|
||||
if (this->m_NumAttach == 0) {
|
||||
this->m_Width = 0;
|
||||
this->m_Height = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GLMipmap* GLFramebuffer::GetAttachment(GLEnum a2) {
|
||||
int32_t index;
|
||||
|
||||
if (a2 == GL_DEPTH_ATTACHMENT) {
|
||||
index = 4;
|
||||
} else if (a2 == GL_STENCIL_ATTACHMENT) {
|
||||
index = 5;
|
||||
} else {
|
||||
index = a2 - GL_COLOR_ATTACHMENT0;
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(index < MAX_ATTACHMENT);
|
||||
|
||||
return this->m_Attachments[index];
|
||||
}
|
||||
|
||||
int32_t GLFramebuffer::GetSampleCount() {
|
||||
return this->m_FramebufferID
|
||||
? 1
|
||||
: this->m_Device->m_Context.GetSampleCount();
|
||||
}
|
||||
|
||||
bool GLFramebuffer::IsValid() {
|
||||
auto status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
|
||||
return status == GL_FRAMEBUFFER_COMPLETE;
|
||||
}
|
||||
|
||||
void GLFramebuffer::ReleaseObject() {
|
||||
// TODO
|
||||
}
|
38
src/gx/glsdl/GLFramebuffer.hpp
Normal file
38
src/gx/glsdl/GLFramebuffer.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef GX_GL_SDL_GL_FRAMEBUFFER_HPP
|
||||
#define GX_GL_SDL_GL_FRAMEBUFFER_HPP
|
||||
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
#define MAX_ATTACHMENT 6
|
||||
|
||||
class GLSDLDevice;
|
||||
class GLMipmap;
|
||||
|
||||
class GLFramebuffer : public GLObject {
|
||||
public:
|
||||
// Static functions
|
||||
static GLFramebuffer* Create(bool);
|
||||
|
||||
// Member variables
|
||||
int32_t m_Width = 0;
|
||||
int32_t m_Height = 0;
|
||||
uint32_t m_FramebufferID = 0;
|
||||
GLSDLDevice* m_Device;
|
||||
GLMipmap* m_Attachments[6] = {};
|
||||
uint32_t m_NumAttach = 0;
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ReleaseObject();
|
||||
|
||||
// Member functions
|
||||
GLFramebuffer(bool);
|
||||
void Attach(GLMipmap*, GLenum, int32_t);
|
||||
void Detach(GLenum);
|
||||
GLMipmap* GetAttachment(GLEnum);
|
||||
int32_t GetSampleCount(void);
|
||||
bool IsValid();
|
||||
};
|
||||
|
||||
#endif
|
7
src/gx/glsdl/GLGLSLProgram.cpp
Normal file
7
src/gx/glsdl/GLGLSLProgram.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "gx/glsdl/GLGLSLProgram.hpp"
|
||||
#include "gx/glsdl/GLShader.hpp"
|
||||
|
||||
GLGLSLProgram* GLGLSLProgram::Find(GLShader* a1, GLShader* a2) {
|
||||
// TODO
|
||||
return nullptr;
|
||||
}
|
14
src/gx/glsdl/GLGLSLProgram.hpp
Normal file
14
src/gx/glsdl/GLGLSLProgram.hpp
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef GX_GL_SDL_GL_GLSL_PROGRAM_HPP
|
||||
#define GX_GL_SDL_GL_GLSL_PROGRAM_HPP
|
||||
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
|
||||
class GLShader;
|
||||
|
||||
class GLGLSLProgram : public GLObject {
|
||||
public:
|
||||
// Static functions
|
||||
static GLGLSLProgram* Find(GLShader*, GLShader*);
|
||||
};
|
||||
|
||||
#endif
|
480
src/gx/glsdl/GLMipmap.cpp
Normal file
480
src/gx/glsdl/GLMipmap.cpp
Normal file
@ -0,0 +1,480 @@
|
||||
#include "gx/glsdl/GLMipmap.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include "gx/glsdl/GLFramebuffer.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
int32_t GLMipmap::GetDepthBits() {
|
||||
return this->m_DepthBits;
|
||||
}
|
||||
|
||||
void GLMipmap::Attach(GLFramebuffer* framebuffer, GLenum attachPoint, int32_t a4) {
|
||||
if (!this->m_AttachPoints) {
|
||||
this->m_AttachPoints = new std::vector<GLAttachPoint>();
|
||||
}
|
||||
|
||||
auto& attachPoints = *this->m_AttachPoints;
|
||||
auto framebufferID = framebuffer->m_FramebufferID;
|
||||
|
||||
if (framebufferID >= attachPoints.size()) {
|
||||
attachPoints.resize(framebufferID + 1);
|
||||
} else {
|
||||
BLIZZARD_ASSERT(attachPoints[framebufferID].framebuffer != framebuffer || attachPoints[framebufferID].point != attachPoint);
|
||||
|
||||
auto& attach = attachPoints[framebufferID];
|
||||
|
||||
if (
|
||||
attach.point
|
||||
&& (attach.point != GL_DEPTH_ATTACHMENT || attachPoint != GL_STENCIL_ATTACHMENT)
|
||||
&& (attach.point != GL_STENCIL_ATTACHMENT || attachPoint != GL_DEPTH_ATTACHMENT)
|
||||
) {
|
||||
framebuffer->Detach(attach.point);
|
||||
}
|
||||
}
|
||||
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
|
||||
auto currentTarget = device->GetCurrentTarget();
|
||||
device->BindFramebuffer(framebuffer);
|
||||
|
||||
if (framebufferID) {
|
||||
if (this->m_Target == GL_TEXTURE_3D) {
|
||||
glFramebufferTexture3DEXT(
|
||||
GL_FRAMEBUFFER,
|
||||
attachPoint,
|
||||
GL_TEXTURE_3D,
|
||||
this->m_Texture->m_TextureID,
|
||||
this->m_Level,
|
||||
a4
|
||||
);
|
||||
} else {
|
||||
glFramebufferTexture2DEXT(
|
||||
GL_FRAMEBUFFER,
|
||||
attachPoint,
|
||||
this->m_Target,
|
||||
this->m_Texture->m_TextureID,
|
||||
this->m_Level
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (attachPoint == GL_DEPTH_ATTACHMENT && !this->m_DepthBits) {
|
||||
GLint depthBits = 0;
|
||||
glGetIntegerv(GL_DEPTH_BITS, &depthBits);
|
||||
this->m_DepthBits = depthBits;
|
||||
}
|
||||
|
||||
device->BindFramebuffer(currentTarget);
|
||||
|
||||
auto& attach = attachPoints[framebufferID];
|
||||
attach.framebuffer = framebuffer;
|
||||
attach.zOffset = a4;
|
||||
|
||||
if (
|
||||
(attach.point != GL_DEPTH_ATTACHMENT || attachPoint != GL_STENCIL_ATTACHMENT)
|
||||
&& (attach.point != GL_STENCIL_ATTACHMENT || attachPoint != GL_DEPTH_ATTACHMENT)
|
||||
) {
|
||||
attach.point = attachPoint;
|
||||
} else {
|
||||
attach.point = GL_DEPTH_STENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
void GLMipmap::Detach(GLFramebuffer* framebuffer, GLenum attachPoint, bool a4) {
|
||||
GLuint framebufferID = framebuffer->m_FramebufferID;
|
||||
|
||||
auto& attachPoints = *this->m_AttachPoints;
|
||||
|
||||
BLIZZARD_ASSERT(attachPoints.size() >= framebufferID);
|
||||
BLIZZARD_ASSERT(attachPoints[framebufferID].framebuffer == framebuffer);
|
||||
|
||||
if (!a4 && framebufferID) {
|
||||
GLSDLDevice* v12 = GLSDLDevice::Get();
|
||||
GLFramebuffer* v14 = v12->GetCurrentTarget();
|
||||
v12->BindFramebuffer(framebuffer);
|
||||
|
||||
if (this->m_Target == GL_TEXTURE_3D) {
|
||||
glFramebufferTexture3DEXT(GL_FRAMEBUFFER, attachPoint, GL_TEXTURE_3D, 0, 0, 0);
|
||||
} else {
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER, attachPoint, this->m_Target, 0, 0);
|
||||
}
|
||||
|
||||
v12->BindFramebuffer(v14);
|
||||
}
|
||||
|
||||
GLAttachPoint* v9 = &attachPoints[framebufferID];
|
||||
|
||||
if (v9->point == GL_DEPTH_STENCIL) {
|
||||
BLIZZARD_ASSERT(this->GetFormat() == GLTF_D24S8);
|
||||
|
||||
if (attachPoint == GL_DEPTH_ATTACHMENT) {
|
||||
v9->point = GL_STENCIL_ATTACHMENT;
|
||||
} else if (attachPoint == GL_STENCIL_ATTACHMENT) {
|
||||
v9->point = GL_DEPTH_ATTACHMENT;
|
||||
} else {
|
||||
BLIZZARD_ASSERT(false);
|
||||
}
|
||||
} else {
|
||||
BLIZZARD_ASSERT(attachPoints[framebufferID].point == attachPoint);
|
||||
|
||||
v9->framebuffer = 0;
|
||||
v9->point = 0;
|
||||
v9->zOffset = 0;
|
||||
|
||||
// TODO
|
||||
// this->m_Texture->m_TimeStamp = Blizzard::Time::GetTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
void GLMipmap::DetachAll() {
|
||||
if (!this->m_AttachPoints) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto& attachPoints = *this->m_AttachPoints;
|
||||
for (int32_t i = 0; i < attachPoints.size(); i++) {
|
||||
BLIZZARD_ASSERT(attachPoints[i].point != GL_ZERO);
|
||||
BLIZZARD_ASSERT(attachPoints[i].framebuffer->m_FramebufferID == i);
|
||||
|
||||
attachPoints[i].framebuffer->Detach(attachPoints[i].point);
|
||||
}
|
||||
}
|
||||
|
||||
GLTextureFormat GLMipmap::GetFormat() {
|
||||
return this->m_Texture->GetFormat();
|
||||
}
|
||||
|
||||
TextureFormatInfo& GLMipmap::GetFormatInfo() {
|
||||
return this->m_Texture->GetFormatInfo();
|
||||
};
|
||||
|
||||
uint16_t GLMipmap::GetHeight() {
|
||||
return this->m_Height;
|
||||
}
|
||||
|
||||
int32_t GLMipmap::GetPitch() {
|
||||
int32_t bpp = this->GetFormatInfo().m_BytePerPixel;
|
||||
int32_t v4 = this->m_Texture->var12 >> this->m_Level;
|
||||
return v4 >= bpp ? v4 : bpp;
|
||||
}
|
||||
|
||||
GLTexture* GLMipmap::GetTexture() {
|
||||
return this->m_Texture;
|
||||
}
|
||||
|
||||
uint32_t GLMipmap::GetTextureID() {
|
||||
return this->m_Texture->m_TextureID;
|
||||
}
|
||||
|
||||
uint16_t GLMipmap::GetWidth() {
|
||||
return this->m_Width;
|
||||
}
|
||||
|
||||
void* GLMipmap::Map(GLEnum mode, const GLBox* area) {
|
||||
BLIZZARD_ASSERT(!this->m_Texture->IsSystemBuffer());
|
||||
BLIZZARD_ASSERT(this->m_Data != nullptr);
|
||||
BLIZZARD_ASSERT(!this->m_Texture->IsRenderTarget());
|
||||
BLIZZARD_ASSERT(mode != GL_ZERO);
|
||||
BLIZZARD_ASSERT(this->m_MapParams == nullptr);
|
||||
|
||||
if (mode != GL_READ_ONLY) {
|
||||
this->m_Texture->m_MappedMipmaps++;
|
||||
}
|
||||
|
||||
MapParams* mapParams = new MapParams();
|
||||
this->m_MapParams = mapParams;
|
||||
|
||||
if (area) {
|
||||
BLIZZARD_ASSERT(area->width > 0);
|
||||
BLIZZARD_ASSERT(area->height > 0);
|
||||
BLIZZARD_ASSERT(area->depth > 0);
|
||||
BLIZZARD_ASSERT(!this->GetFormatInfo().m_IsCompressed || ((area->top & 0x3) == 0 && (area->left & 0x3) == 0 && (area->width & 0x3) == 0 && (area->height & 0x3) == 0));
|
||||
BLIZZARD_ASSERT((area->height + area->top) <= this->m_Height);
|
||||
BLIZZARD_ASSERT((area->depth + area->front) <= this->m_Depth);
|
||||
BLIZZARD_ASSERT((area->width + area->left) <= this->m_Width);
|
||||
|
||||
mapParams->m_MapArea = {
|
||||
area->left,
|
||||
area->top,
|
||||
area->front,
|
||||
area->width,
|
||||
area->height,
|
||||
area->depth
|
||||
};
|
||||
|
||||
int32_t size = this->GetFormatInfo().m_BytePerPixel
|
||||
* this->m_Width
|
||||
* mapParams->m_MapArea.depth
|
||||
* mapParams->m_MapArea.height;
|
||||
|
||||
mapParams->m_Size = this->GetFormatInfo().m_IsCompressed
|
||||
? size >> 4
|
||||
: size;
|
||||
|
||||
mapParams->m_Unk7 = (this->GetFormatInfo().m_BytePerPixel * mapParams->m_MapArea.left)
|
||||
>> this->GetFormatInfo().m_IsCompressed ? 2 : 0;
|
||||
} else {
|
||||
mapParams->m_MapArea = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
this->m_Width,
|
||||
this->m_Height,
|
||||
this->m_Depth
|
||||
};
|
||||
|
||||
mapParams->m_Size = this->m_Size;
|
||||
|
||||
mapParams->m_Unk7 = 0;
|
||||
}
|
||||
|
||||
mapParams->m_MapMode = mode;
|
||||
|
||||
int32_t rowPitch = this->GetPitch();
|
||||
|
||||
BLIZZARD_ASSERT(((mapParams->m_MapArea.top * rowPitch) + mapParams->m_MapArea.left * this->GetFormatInfo().m_BytePerPixel) < (this->GetFormatInfo().m_IsCompressed ? this->m_Size << 4 : this->m_Size));
|
||||
|
||||
int32_t v22 = rowPitch * this->m_Height;
|
||||
if (this->GetFormatInfo().m_IsCompressed) {
|
||||
v22 >>= 2;
|
||||
}
|
||||
|
||||
unsigned char* v24 = this->m_Data
|
||||
+ ((mapParams->m_MapArea.top * rowPitch) >> (this->GetFormatInfo().m_IsCompressed ? 2 : 0))
|
||||
+ (mapParams->m_MapArea.front * v22);
|
||||
|
||||
mapParams->m_Unk8 = v24;
|
||||
|
||||
return v24 + mapParams->m_Unk7;
|
||||
}
|
||||
|
||||
void* GLMipmap::Map(GLEnum mode, const GLRect* rect) {
|
||||
if (rect) {
|
||||
GLBox area = {
|
||||
rect->left,
|
||||
rect->top,
|
||||
0,
|
||||
rect->width,
|
||||
rect->height,
|
||||
1
|
||||
};
|
||||
|
||||
return this->Map(mode, &area);
|
||||
} else {
|
||||
return this->Map(mode, static_cast<GLBox*>(nullptr));
|
||||
}
|
||||
}
|
||||
|
||||
void GLMipmap::ReleaseObject() {
|
||||
BLIZZARD_ASSERT(this->m_MapParams == nullptr);
|
||||
|
||||
this->RemoveDebugMipmap();
|
||||
this->DetachAll();
|
||||
|
||||
if (this->m_AttachPoints) {
|
||||
delete this->m_AttachPoints;
|
||||
}
|
||||
|
||||
this->m_AttachPoints = nullptr;
|
||||
this->m_Unk24 = 0;
|
||||
}
|
||||
|
||||
void GLMipmap::RemoveDebugMipmap() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLMipmap::ResetData(GLEnum target, int32_t level, unsigned char* data) {
|
||||
BLIZZARD_ASSERT(this->m_Target != GL_TEXTURE_3D || !this->GetFormatInfo().m_IsCompressed);
|
||||
|
||||
this->m_Target = target;
|
||||
this->m_Level = level;
|
||||
this->m_Data = data;
|
||||
|
||||
BLIZZARD_ASSERT(this->GetFormat() != GLTF_INVALID);
|
||||
BLIZZARD_ASSERT(this->GetFormat() < GLTF_NUM_TEXTURE_FORMATS);
|
||||
|
||||
if (!this->m_Texture->IsSystemBuffer() && this->m_Texture->IsRenderTarget()) {
|
||||
BLIZZARD_ASSERT(!this->GetFormatInfo().m_IsCompressed);
|
||||
|
||||
this->TexImage(nullptr);
|
||||
this->m_Unk24 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void GLMipmap::ResetSize(uint32_t width, uint32_t height, uint32_t depth) {
|
||||
this->m_Width = width ? width : 1;
|
||||
this->m_Height = height ? height : 1;
|
||||
this->m_Depth = depth ? depth : 1;
|
||||
|
||||
if (this->GetFormatInfo().m_IsCompressed) {
|
||||
BLIZZARD_ASSERT(this->m_Depth == 1);
|
||||
|
||||
this->m_Width = (this->m_Width + 3) & 0xFFFC;
|
||||
this->m_Height = (this->m_Height + 3) & 0xFFFC;
|
||||
}
|
||||
|
||||
uint32_t v11 = this->GetFormatInfo().m_BytePerPixel;
|
||||
uint32_t v20 = this->m_Texture->var12 >> this->m_Level;
|
||||
|
||||
if (v20 >= v11) {
|
||||
v11 = v20;
|
||||
}
|
||||
|
||||
uint32_t v15 = v11 * this->m_Height;
|
||||
uint32_t v12;
|
||||
|
||||
if (this->GetFormatInfo().m_IsCompressed) {
|
||||
v12 = v15 >> 2;
|
||||
} else {
|
||||
v12 = v15;
|
||||
}
|
||||
|
||||
this->m_Size = this->m_Depth * v12;
|
||||
}
|
||||
|
||||
void GLMipmap::TexImage(const void* pixels) {
|
||||
BLIZZARD_ASSERT((this->m_Texture->IsRenderTarget() || pixels != nullptr) && GLSDLDevice::Get()->GetVertexArrayStates().buffers[eGLBT_PIXEL_UNPACK] == 0);
|
||||
|
||||
if (this->m_Target == GL_TEXTURE_3D) {
|
||||
glTexImage3D(
|
||||
GL_TEXTURE_3D,
|
||||
this->m_Level,
|
||||
this->GetFormatInfo().m_InternalFormat,
|
||||
this->m_Width,
|
||||
this->m_Height,
|
||||
this->m_Depth,
|
||||
0,
|
||||
this->GetFormatInfo().m_DataFormat,
|
||||
this->GetFormatInfo().m_DataType,
|
||||
pixels
|
||||
);
|
||||
} else if (this->GetFormatInfo().m_IsCompressed) {
|
||||
glCompressedTexImage2D(
|
||||
this->m_Target,
|
||||
this->m_Level,
|
||||
this->GetFormatInfo().m_InternalFormat,
|
||||
this->m_Width,
|
||||
this->m_Height,
|
||||
0,
|
||||
this->m_Size,
|
||||
pixels
|
||||
);
|
||||
} else {
|
||||
glTexImage2D(
|
||||
this->m_Target,
|
||||
this->m_Level,
|
||||
this->GetFormatInfo().m_InternalFormat,
|
||||
this->m_Width,
|
||||
this->m_Height,
|
||||
0,
|
||||
this->GetFormatInfo().m_DataFormat,
|
||||
this->GetFormatInfo().m_DataType,
|
||||
pixels
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void GLMipmap::TexSubImage(const GLBox& a2, int32_t size, const void* pixels) {
|
||||
BLIZZARD_ASSERT(!this->m_Texture->IsRenderTarget() && pixels != nullptr && GLSDLDevice::Get()->GetVertexArrayStates().buffers[eGLBT_PIXEL_UNPACK] == 0);
|
||||
|
||||
if (this->m_Target == GL_TEXTURE_3D) {
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, this->m_Width);
|
||||
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, this->m_Height);
|
||||
|
||||
glTexSubImage3D(
|
||||
this->m_Target,
|
||||
this->m_Level,
|
||||
a2.left,
|
||||
a2.top,
|
||||
a2.front,
|
||||
a2.width,
|
||||
a2.height,
|
||||
a2.depth,
|
||||
this->GetFormatInfo().m_DataFormat,
|
||||
this->GetFormatInfo().m_DataType,
|
||||
pixels
|
||||
);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
|
||||
} else if (this->GetFormatInfo().m_IsCompressed) {
|
||||
glCompressedTexSubImage2D(
|
||||
this->m_Target,
|
||||
this->m_Level,
|
||||
0,
|
||||
a2.top,
|
||||
this->m_Width,
|
||||
a2.height,
|
||||
this->GetFormatInfo().m_InternalFormat,
|
||||
size,
|
||||
pixels
|
||||
);
|
||||
} else {
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, this->m_Width);
|
||||
|
||||
glTexSubImage2D(
|
||||
this->m_Target,
|
||||
this->m_Level,
|
||||
a2.left,
|
||||
a2.top,
|
||||
a2.width,
|
||||
a2.height,
|
||||
this->GetFormatInfo().m_DataFormat,
|
||||
this->GetFormatInfo().m_DataType,
|
||||
pixels
|
||||
);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GLMipmap::Unmap() {
|
||||
BLIZZARD_ASSERT(!this->m_Texture->IsRenderTarget());
|
||||
BLIZZARD_ASSERT(!this->m_Texture->IsSystemBuffer());
|
||||
BLIZZARD_ASSERT(this->m_MapParams != nullptr);
|
||||
|
||||
if (this->m_MapParams->m_MapMode == GL_READ_ONLY) {
|
||||
delete this->m_MapParams;
|
||||
this->m_MapParams = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
|
||||
BLIZZARD_ASSERT(this->m_Texture->m_MappedMipmaps > 0);
|
||||
|
||||
this->Unmap(this->m_MapParams);
|
||||
|
||||
this->m_MapParams = nullptr;
|
||||
}
|
||||
|
||||
void GLMipmap::Unmap(MapParams* mapParams) {
|
||||
BLIZZARD_ASSERT(mapParams != nullptr);
|
||||
|
||||
this->m_Texture->Bind(nullptr, 0);
|
||||
|
||||
if (this->m_Unk24) {
|
||||
if (this->GetFormatInfo().m_IsCompressed) {
|
||||
GLBox area = {
|
||||
0,
|
||||
mapParams->m_MapArea.top,
|
||||
mapParams->m_MapArea.front,
|
||||
this->m_Width,
|
||||
mapParams->m_MapArea.height,
|
||||
mapParams->m_MapArea.depth
|
||||
};
|
||||
|
||||
this->TexSubImage(area, mapParams->m_Size, mapParams->m_Unk8);
|
||||
} else {
|
||||
this->TexSubImage(mapParams->m_MapArea, mapParams->m_Size, mapParams->m_Unk8 + mapParams->m_Unk7);
|
||||
}
|
||||
} else {
|
||||
this->TexImage(this->m_Data);
|
||||
this->m_Unk24 = 1;
|
||||
}
|
||||
|
||||
delete mapParams;
|
||||
|
||||
// TODO
|
||||
|
||||
this->m_Texture->m_MappedMipmaps--;
|
||||
}
|
62
src/gx/glsdl/GLMipmap.hpp
Normal file
62
src/gx/glsdl/GLMipmap.hpp
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef GX_GL_SDL_GL_MIPMAP_HPP
|
||||
#define GX_GL_SDL_GL_MIPMAP_HPP
|
||||
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
class GLFramebuffer;
|
||||
class GLTexture;
|
||||
|
||||
class GLMipmap {
|
||||
public:
|
||||
// Types
|
||||
struct MapParams {
|
||||
GLBox m_MapArea;
|
||||
int32_t m_MapMode = 0;
|
||||
int32_t m_Unk7 = 0;
|
||||
unsigned char* m_Unk8 = nullptr;
|
||||
int32_t m_Size = 0;
|
||||
};
|
||||
|
||||
// Member variables
|
||||
GLTexture* m_Texture = nullptr;
|
||||
uint16_t m_Width = 0;
|
||||
uint16_t m_Height = 0;
|
||||
uint16_t m_Depth = 0;
|
||||
uint8_t m_Level = 0;
|
||||
uint8_t m_DepthBits = 0;
|
||||
uint32_t m_Size = 0;
|
||||
int32_t m_Target = 0;
|
||||
unsigned char* m_Data = nullptr; // TODO proper type
|
||||
MapParams* m_MapParams = nullptr;
|
||||
std::vector<GLAttachPoint>* m_AttachPoints = nullptr;
|
||||
uint32_t m_Unk20 = 0;
|
||||
uint32_t m_Unk24 = 0;
|
||||
|
||||
// Member functions
|
||||
void Attach(GLFramebuffer*, GLenum, int32_t);
|
||||
void Detach(GLFramebuffer*, GLenum, bool);
|
||||
void DetachAll();
|
||||
int32_t GetDepthBits(void);
|
||||
GLTextureFormat GetFormat(void);
|
||||
TextureFormatInfo& GetFormatInfo(void);
|
||||
uint16_t GetHeight(void);
|
||||
int32_t GetPitch(void);
|
||||
GLTexture* GetTexture();
|
||||
uint32_t GetTextureID(void);
|
||||
uint16_t GetWidth(void);
|
||||
void* Map(GLEnum, const GLBox*);
|
||||
void* Map(GLEnum, const GLRect*);
|
||||
void ReleaseObject();
|
||||
void RemoveDebugMipmap();
|
||||
void ResetData(GLEnum, int32_t, unsigned char*);
|
||||
void ResetSize(uint32_t, uint32_t, uint32_t);
|
||||
void TexImage(const void*);
|
||||
void TexSubImage(const GLBox&, int32_t, const void*);
|
||||
void Unmap(void);
|
||||
void Unmap(MapParams*);
|
||||
};
|
||||
|
||||
#endif
|
22
src/gx/glsdl/GLObject.cpp
Normal file
22
src/gx/glsdl/GLObject.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
void GLObject::AddRefTwin() {
|
||||
}
|
||||
|
||||
uint32_t GLObject::Release() {
|
||||
BLIZZARD_ASSERT(this->m_RefCount > 0);
|
||||
|
||||
this->m_RefCount--;
|
||||
|
||||
if (this->m_RefCount == 0) {
|
||||
this->ReleaseObject();
|
||||
}
|
||||
|
||||
this->ReleaseTwin();
|
||||
|
||||
return this->m_RefCount;
|
||||
}
|
||||
|
||||
void GLObject::ReleaseTwin() {
|
||||
}
|
22
src/gx/glsdl/GLObject.hpp
Normal file
22
src/gx/glsdl/GLObject.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef GX_GL_SDL_GL_OBJECT_HPP
|
||||
#define GX_GL_SDL_GL_OBJECT_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class GLObject {
|
||||
public:
|
||||
// Member variables
|
||||
GLObject* m_Next;
|
||||
uint32_t m_RefCount;
|
||||
int64_t m_TimeStamp;
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ReleaseObject() = 0;
|
||||
virtual void AddRefTwin();
|
||||
virtual void ReleaseTwin();
|
||||
|
||||
// Member functions
|
||||
uint32_t Release();
|
||||
};
|
||||
|
||||
#endif
|
17
src/gx/glsdl/GLPixelShader.cpp
Normal file
17
src/gx/glsdl/GLPixelShader.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "gx/glsdl/GLPixelShader.hpp"
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
|
||||
GLPixelShader* GLPixelShader::Create() {
|
||||
// TODO
|
||||
// GLPool stuff
|
||||
|
||||
GLPixelShader* shader = new GLPixelShader();
|
||||
|
||||
shader->m_ShaderID = 0;
|
||||
shader->m_RefCount = 1;
|
||||
shader->m_ShaderType = ePixelShader;
|
||||
shader->m_UsingGLSL = 0;
|
||||
shader->var5 = GL_FRAGMENT_PROGRAM_ARB;
|
||||
|
||||
return shader;
|
||||
}
|
12
src/gx/glsdl/GLPixelShader.hpp
Normal file
12
src/gx/glsdl/GLPixelShader.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef GX_SDL_GL_PIXEL_SHADER_HPP
|
||||
#define GX_SDL_GL_PIXEL_SHADER_HPP
|
||||
|
||||
#include "gx/glsdl/GLShader.hpp"
|
||||
|
||||
class GLPixelShader : public GLShader {
|
||||
public:
|
||||
// Static functions
|
||||
static GLPixelShader* Create(void);
|
||||
};
|
||||
|
||||
#endif
|
57
src/gx/glsdl/GLPool.hpp
Normal file
57
src/gx/glsdl/GLPool.hpp
Normal file
@ -0,0 +1,57 @@
|
||||
#ifndef GX_GL_SDL_GL_POOL_HPP
|
||||
#define GX_GL_SDL_GL_POOL_HPP
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
|
||||
template<class T>
|
||||
class GLPool {
|
||||
public:
|
||||
// Static variables
|
||||
static GLPool<T>* m_pool;
|
||||
|
||||
// Static functions
|
||||
static GLPool<T>* Get(void);
|
||||
static void Init(void);
|
||||
|
||||
// Member variables
|
||||
std::atomic<uint32_t> m_NextName;
|
||||
|
||||
// Member functions
|
||||
uint32_t GetNextName(void);
|
||||
T* GetNextObject(void);
|
||||
void SetNextName(uint32_t);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
GLPool<T>* GLPool<T>::m_pool;
|
||||
|
||||
template<class T>
|
||||
GLPool<T>* GLPool<T>::Get() {
|
||||
return GLPool<T>::m_pool;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void GLPool<T>::Init() {
|
||||
GLPool<T>::m_pool = new GLPool<T>();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
uint32_t GLPool<T>::GetNextName() {
|
||||
return this->m_NextName++;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T* GLPool<T>::GetNextObject() {
|
||||
// TODO
|
||||
// - pop off of GLObjectPool
|
||||
|
||||
return new T();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void GLPool<T>::SetNextName(uint32_t name) {
|
||||
this->m_NextName = name;
|
||||
}
|
||||
|
||||
#endif
|
48
src/gx/glsdl/GLSDLContext.cpp
Normal file
48
src/gx/glsdl/GLSDLContext.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include "gx/glsdl/GLSDLContext.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
#include <storm/Error.hpp>
|
||||
|
||||
static bool s_GLEW_Initialized = false;
|
||||
|
||||
void GLSDLContext::Create(GLSDLWindow* window) {
|
||||
BLIZZARD_ASSERT(this->m_sdlGLContext == nullptr);
|
||||
|
||||
this->m_sdlGLContext = SDL_GL_CreateContext(window->m_sdlWindow);
|
||||
|
||||
BLIZZARD_ASSERT(this->m_sdlGLContext != nullptr);
|
||||
|
||||
if (s_GLEW_Initialized == false) {
|
||||
glewExperimental = true;
|
||||
|
||||
auto glewError = glewInit();
|
||||
|
||||
if (glewError != GLEW_OK) {
|
||||
SErrDisplayAppFatal("Error initializing GLEW: %s\n", glewGetErrorString(glewError));
|
||||
}
|
||||
|
||||
s_GLEW_Initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
void GLSDLContext::Destroy() {
|
||||
BLIZZARD_ASSERT(this->m_sdlGLContext != nullptr);
|
||||
|
||||
SDL_GL_DeleteContext(this->m_sdlGLContext);
|
||||
this->m_sdlGLContext = nullptr;
|
||||
}
|
||||
|
||||
bool GLSDLContext::IsCurrentContext() {
|
||||
return this->m_sdlGLContext == SDL_GL_GetCurrentContext();
|
||||
}
|
||||
|
||||
void GLSDLContext::MakeCurrent(GLSDLWindow* window) {
|
||||
auto status = SDL_GL_MakeCurrent(window->m_sdlWindow, this->m_sdlGLContext);
|
||||
BLIZZARD_ASSERT(status == 0);
|
||||
}
|
||||
|
||||
int32_t GLSDLContext::GetSampleCount() {
|
||||
int samples;
|
||||
auto status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &samples);
|
||||
BLIZZARD_ASSERT(status == 0);
|
||||
return static_cast<int32_t>(samples);
|
||||
}
|
20
src/gx/glsdl/GLSDLContext.hpp
Normal file
20
src/gx/glsdl/GLSDLContext.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef GX_GL_SDL_GL_SDL_CONTEXT_HPP
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "gx/glsdl/GLSDLWindow.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
|
||||
class GLSDLContext {
|
||||
public:
|
||||
SDL_GLContext m_sdlGLContext = nullptr;
|
||||
|
||||
GLSDLContext() = default;
|
||||
void Create(GLSDLWindow* window);
|
||||
void Destroy();
|
||||
bool IsCurrentContext();
|
||||
void MakeCurrent(GLSDLWindow* window);
|
||||
int32_t GetSampleCount();
|
||||
};
|
||||
|
||||
#endif
|
2769
src/gx/glsdl/GLSDLDevice.cpp
Normal file
2769
src/gx/glsdl/GLSDLDevice.cpp
Normal file
File diff suppressed because it is too large
Load Diff
190
src/gx/glsdl/GLSDLDevice.hpp
Normal file
190
src/gx/glsdl/GLSDLDevice.hpp
Normal file
@ -0,0 +1,190 @@
|
||||
#ifndef GX_GL_SDL_GL_SDL_DEVICE_HPP
|
||||
#define GX_GL_SDL_GL_SDL_DEVICE_HPP
|
||||
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include "gx/glsdl/GLSDLWindow.hpp"
|
||||
#include "gx/glsdl/GLBatch.hpp"
|
||||
#include "gx/glsdl/GLBufferPool.hpp"
|
||||
#include "gx/glsdl/GLSDLContext.hpp"
|
||||
#include "gx/glsdl/GLDebugMipmap2D.hpp"
|
||||
#include "gx/glsdl/GLFramebuffer.hpp"
|
||||
#include "gx/glsdl/GLGLSLProgram.hpp"
|
||||
#include "gx/glsdl/GLMipmap.hpp"
|
||||
#include "gx/glsdl/GLShader.hpp"
|
||||
#include "gx/glsdl/GLTexture.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include "gx/glsdl/GLVertexArray.hpp"
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <bc/Thread.hpp>
|
||||
|
||||
class GLSDLDevice {
|
||||
public:
|
||||
// Types
|
||||
enum GLSDLDeviceOption {
|
||||
eUseMTGL = 0,
|
||||
eUseVertexArray = 1,
|
||||
eUseGLSL = 2,
|
||||
eCheckGLStates = 3,
|
||||
eFlushBeforeDraw = 4,
|
||||
eDeviceOption5 = 5,
|
||||
eUseHybridShader = 6,
|
||||
eDeviceOption7 = 7,
|
||||
eDeviceOption8 = 8,
|
||||
eShaderConstantBindings = 9
|
||||
};
|
||||
|
||||
struct RendererInfo {
|
||||
uint8_t init = 0;
|
||||
uint32_t vendor_id;
|
||||
uint32_t renderer_id;
|
||||
uint32_t max_color_attachments;
|
||||
uint32_t unk36; // max clip planes
|
||||
uint32_t unk100;
|
||||
};
|
||||
|
||||
// Static variables
|
||||
static Blizzard::Thread::TLSSlot m_CurrentDevice;
|
||||
static std::vector<GLSDLDevice*> m_Devices;
|
||||
static bool m_ExtARBShadow;
|
||||
static bool m_ExtColorMaskIndexed;
|
||||
static RendererInfo m_RendererInfo;
|
||||
static bool m_ShaderConstantBindings;
|
||||
static int32_t m_StaticResourcesRefCount;
|
||||
static bool m_UseHybridShader;
|
||||
static GLBuffer* m_BlitQuadVBO;
|
||||
static GLShader* m_DeviceShaders[];
|
||||
static GLTexture* m_DeviceTextures[];
|
||||
static GLVertexFormat m_NormalBlitVF;
|
||||
static GLVertexFormat m_InvertedBlitVF;
|
||||
static GLFramebuffer* m_F8330C;
|
||||
|
||||
// Static functions
|
||||
static GLSDLDevice* Get();
|
||||
static void Set(GLSDLDevice* device);
|
||||
static void InitPools();
|
||||
static RendererInfo GetRendererInfo();
|
||||
static void InitRendererInfo();
|
||||
static void SetOption(GLSDLDeviceOption option, bool enable);
|
||||
static void StaticInit();
|
||||
|
||||
// Member variables
|
||||
std::string m_DebugName;
|
||||
GLStates m_States;
|
||||
GLTexture* m_Textures[16] = {};
|
||||
GLShader* m_PixelShader = nullptr;
|
||||
GLShader* m_VertexShader = nullptr;
|
||||
GLGLSLProgram* m_GLSLProgram = nullptr;
|
||||
GLVertexArray* m_VertexArrayObject = &m_DefaultVertexArrayObject;
|
||||
GLFramebuffer* m_SystemTarget = nullptr;
|
||||
GLFramebuffer* m_FBOTarget = nullptr;
|
||||
GLFramebuffer* m_CurrentTarget = nullptr;
|
||||
GLMipmap* m_CurrentTargetColor[4] = {};
|
||||
GLMipmap* m_CurrentTargetDepth = nullptr;
|
||||
GLMipmap* m_CurrentTargetStencil = nullptr;
|
||||
GLMipmap* m_CurrentDepthBuffer = nullptr;
|
||||
GLTexture2D* m_BackBufferColor = nullptr;
|
||||
GLTexture2D* m_BackBufferDepth = nullptr;
|
||||
GLTexture2D* m_BackBufferStencil = nullptr;
|
||||
GLSDLWindow* m_Window = nullptr;
|
||||
GLBufferPool* m_PBOPool = nullptr;
|
||||
GLSDLContext m_Context;
|
||||
GLTexture* m_BoundTextures[4][16] = {};
|
||||
GLVertexArray m_DefaultVertexArrayObject;
|
||||
GLDirtyRange m_DirtyVertexShaderConsts;
|
||||
GLDirtyRange m_DirtyPixelShaderConsts;
|
||||
float m_ConstantDepthBias = 0.0f;
|
||||
float m_SlopeScaledDepthBias = 0.0f;
|
||||
bool m_Init = 0;
|
||||
uint32_t m_DrawCount = 0;
|
||||
uint32_t m_ID = -1;
|
||||
std::list<GLTexture*> m_TextureList;
|
||||
std::list<GLTexture*>::iterator m_OldestActiveTexture;
|
||||
uint32_t m_TextureTotalSize = 0;
|
||||
uint32_t m_FrameNumber = 1;
|
||||
std::list<GLDebugMipmap2D*> m_DebugMipmaps;
|
||||
bool m_BatchViewerEnabled = 0;
|
||||
bool m_UseWindowSystemBuffer = 0;
|
||||
bool m_FlippedSystemBuffer = 0;
|
||||
bool m_ShaderCompiler = 0;
|
||||
bool m_WorkerDevice;
|
||||
GLStates m_DefaultStates;
|
||||
std::vector<GLBatch>* m_FrameBatches;
|
||||
bool m_CaptureOnlyOneFrame = 0;
|
||||
bool m_StopCapturingBatches = 0;
|
||||
bool m_CaptureBatches = 0;
|
||||
int32_t m_IndentLevel = 0;
|
||||
|
||||
// Member functions
|
||||
GLSDLDevice();
|
||||
void ApplyGLBindings(const GLStates& states, bool a3);
|
||||
void ApplyGLStates(const GLStates& states, bool force);
|
||||
void ApplyShaderConstants();
|
||||
void ApplyTransforms();
|
||||
void BindBuffer(GLBuffer* buffer, GLEnum target);
|
||||
void BindFramebuffer(GLFramebuffer* framebuffer);
|
||||
void BindGLSLProgram(GLGLSLProgram* a2);
|
||||
void BindShader(GLShader* shader);
|
||||
void BindTexture(GLEnum textureType, GLTexture* texture);
|
||||
void BindVertexArray(GLVertexArray* a2);
|
||||
void BlitFramebuffer(GLMipmap* src, const GLRect* srcRect, GLMipmap* dst, const GLRect* dstRect, GLEnum mask, GLEnum filter);
|
||||
void CheckDepthTarget();
|
||||
void Clear(uint32_t clearMask, const GLColor4f& clearColor, double clearDepth, int32_t clearStencil);
|
||||
void CopyTex(uint32_t a2, uint32_t a3, GLMipmap* dst, const GLRect* framebufferRect);
|
||||
GLBuffer* CreateBuffer(GLEnum type, uint32_t a3, const void* a4, GLEnum usage, GLEnum format);
|
||||
GLShader* CreateShader(GLShader::ShaderType type, const void* buf, int32_t codeLen, const char* name);
|
||||
GLTexture* CreateTexture2D(uint32_t width, uint32_t height, uint32_t numMipMap, GLTextureFormat format, uint32_t flags);
|
||||
GLTexture* CreateTextureCubeMap(uint32_t size, uint32_t numMipMap, GLTextureFormat format, uint32_t flags);
|
||||
void Draw(GLEnum primitive, uint32_t a3, uint32_t a4);
|
||||
void DrawIndexed(GLEnum primitive, uint32_t a3, uint32_t a4, uint32_t a5, uint32_t a6, uint32_t count);
|
||||
void DrawRect();
|
||||
GLFramebuffer* GetCurrentTarget(); // invented name
|
||||
uint32_t GetID();
|
||||
GLShader* GetShader(GLShader::ShaderType shaderType);
|
||||
const GLStates::VertexArrayObject& GetVertexArrayStates();
|
||||
void GLSDLDraw(GLEnum mode, uint32_t start, uint32_t end, uint32_t a5, uint32_t a6, uint32_t count);
|
||||
void Init(GLSDLWindow* a2, const char* a3, uint32_t a4);
|
||||
void LoadDefaultStates();
|
||||
void ResetBackbuffer(uint32_t width, uint32_t height, GLTextureFormat colorFormat, GLTextureFormat depthFormat,uint32_t sampleCount);
|
||||
void Resize(uint32_t width, uint32_t height);
|
||||
void RestoreTextures();
|
||||
void SetActiveTexture(uint32_t a2);
|
||||
void SetAlphaBlend(GLEnum srcBlend, GLEnum dstBlend, GLEnum blendOp);
|
||||
void SetAlphaBlendEnable(bool enable);
|
||||
void SetAlphaTest(GLEnum func, float ref);
|
||||
void SetAlphaTestEnable(bool enable);
|
||||
void SetClearColor(const GLColor4f& clearColor);
|
||||
void SetClearDepth(double clearDepth);
|
||||
void SetClearStencil(int32_t clearStencil);
|
||||
void SetColorWriteMask(bool red, bool green, bool blue, bool alpha, uint32_t index);
|
||||
void SetCullMode(GLEnum cullMode);
|
||||
void SetDepthBias(float constantBias, float slopeScaledBias);
|
||||
void SetDepthTestEnable(bool enable);
|
||||
void SetDepthTestFunc(GLEnum func);
|
||||
void SetDepthWriteMask(bool enable);
|
||||
void SetDisplay(uint32_t width, uint32_t height, GLTextureFormat colorFormat, GLTextureFormat depthFormat, uint32_t refreshRate, bool windowed, bool captureDisplay, uint32_t sampleCount);
|
||||
void SetFogColor(float r, float g, float b, float a);
|
||||
void SetFogEnable(bool enable);
|
||||
void SetFogParam(GLEnum param, float value);
|
||||
void SetIndexBuffer(GLBuffer* buffer);
|
||||
void SetLightingEnable(bool enable);
|
||||
void SetModelView(GLEnum transform);
|
||||
void SetScissor(bool a2, const GLRect& a3);
|
||||
void SetShader(GLShader::ShaderType shaderType, GLShader* shader);
|
||||
void SetShaderConstants(GLShader::ShaderType shaderType, uint32_t index, const float* constants, uint32_t count);
|
||||
void SetShaderConstantsInternal(GLShader::ShaderType shaderType, uint32_t index, const float* constants, uint32_t count);
|
||||
void SetTexture(uint32_t stage, GLTexture* texture);
|
||||
void SetTransform(GLEnum transform, const float* a3);
|
||||
void SetUnpackClientStorage(bool enable);
|
||||
void SetVertexBuffer(uint32_t index, GLBuffer* buffer, uint32_t offset, uint32_t stride);
|
||||
void SetVertexFormat(GLVertexFormat* format);
|
||||
void SetViewport(const GLRect& viewport, double zNear, double zFar);
|
||||
void Sub34BB0(GLEnum a2, GLMipmap* a3, uint32_t index);
|
||||
void Sub38460(bool a2);
|
||||
void Swap();
|
||||
void UpdateFFPTexturing();
|
||||
};
|
||||
|
||||
#endif
|
131
src/gx/glsdl/GLSDLWindow.cpp
Normal file
131
src/gx/glsdl/GLSDLWindow.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
#include "gx/glsdl/GLSDLWindow.hpp"
|
||||
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
static bool s_GLSDL_Initialized = false;
|
||||
|
||||
void GLSDLWindow::Create(const char* title, const GLSDLWindowRect& rect, GLTextureFormat depthFormat, uint32_t sampleCount) {
|
||||
BLIZZARD_ASSERT(this->m_sdlWindow == nullptr);
|
||||
|
||||
if (!s_GLSDL_Initialized) {
|
||||
// Initialize SDL video context
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
||||
// Set GL version profile
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
|
||||
s_GLSDL_Initialized = true;
|
||||
}
|
||||
|
||||
// Set depth and stencil size according to format
|
||||
uint32_t depthSize = 0;
|
||||
uint32_t stencilSize = 0;
|
||||
|
||||
switch (depthFormat) {
|
||||
case GLTF_INVALID:
|
||||
break;
|
||||
case GLTF_D32:
|
||||
depthSize = 32;
|
||||
break;
|
||||
case GLTF_D24:
|
||||
depthSize = 24;
|
||||
break;
|
||||
case GLTF_D16:
|
||||
depthSize = 16;
|
||||
break;
|
||||
case GLTF_D24S8:
|
||||
depthSize = 24;
|
||||
stencilSize = 8;
|
||||
break;
|
||||
default:
|
||||
BLIZZARD_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthSize);
|
||||
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilSize);
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
||||
|
||||
// Set multisampling
|
||||
if (sampleCount >= 1) {
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, sampleCount);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||
}
|
||||
|
||||
this->m_sdlWindow = SDL_CreateWindow(
|
||||
title,
|
||||
static_cast<int>(rect.size.width), static_cast<int>(rect.size.height),
|
||||
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
|
||||
);
|
||||
|
||||
BLIZZARD_ASSERT(this->m_sdlWindow != nullptr);
|
||||
}
|
||||
|
||||
void GLSDLWindow::Swap() {
|
||||
SDL_GL_SwapWindow(this->m_sdlWindow);
|
||||
}
|
||||
|
||||
void GLSDLWindow::Destroy() {
|
||||
SDL_DestroyWindow(this->m_sdlWindow);
|
||||
this->m_sdlWindow = nullptr;
|
||||
}
|
||||
|
||||
GLSDLWindowRect GLSDLWindow::GetRect() {
|
||||
// Default rectangle
|
||||
GLSDLWindowRect rect;
|
||||
|
||||
int origin_x = 0;
|
||||
int origin_y = 0;
|
||||
if (SDL_GetWindowPosition(this->m_sdlWindow, &origin_x, &origin_y) == 0) {
|
||||
rect.origin.x = static_cast<int32_t>(origin_x);
|
||||
rect.origin.y = static_cast<int32_t>(origin_y);
|
||||
}
|
||||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
if (SDL_GetWindowSize(this->m_sdlWindow, &width, &height) == 0) {
|
||||
rect.size.width = static_cast<int32_t>(width);
|
||||
rect.size.height = static_cast<int32_t>(height);
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
GLSDLWindowRect GLSDLWindow::GetBackingRect() {
|
||||
// Default rectangle
|
||||
GLSDLWindowRect rect;
|
||||
|
||||
// Query backing width/height
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
if (SDL_GetWindowSizeInPixels(this->m_sdlWindow, &width, &height) == 0) {
|
||||
rect.size.width = static_cast<int32_t>(width);
|
||||
rect.size.height = static_cast<int32_t>(height);
|
||||
}
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
void GLSDLWindow::Resize(const GLSDLWindowRect& rect) {
|
||||
auto current = this->GetBackingRect();
|
||||
|
||||
if (current.size.width != rect.size.width || current.size.height != rect.size.width) {
|
||||
auto status = SDL_SetWindowSize(this->m_sdlWindow, rect.size.width, rect.size.height);
|
||||
BLIZZARD_ASSERT(status == 0);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t GLSDLWindow::GetWidth() {
|
||||
return this->GetBackingRect().size.width;
|
||||
}
|
||||
|
||||
int32_t GLSDLWindow::GetHeight() {
|
||||
return this->GetBackingRect().size.height;
|
||||
}
|
||||
|
44
src/gx/glsdl/GLSDLWindow.hpp
Normal file
44
src/gx/glsdl/GLSDLWindow.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
#ifndef GX_GL_SDL_GL_SDL_WINDOW_HPP
|
||||
#define GX_GL_SDL_GL_SDL_WINDOW_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
|
||||
class GLSDLWindowRect {
|
||||
public:
|
||||
struct Point {
|
||||
int32_t x = 0;
|
||||
int32_t y = 0;
|
||||
};
|
||||
|
||||
struct Size {
|
||||
int32_t width = 0;
|
||||
int32_t height = 0;
|
||||
};
|
||||
|
||||
Point origin;
|
||||
Size size;
|
||||
};
|
||||
|
||||
class GLSDLWindow {
|
||||
public:
|
||||
SDL_Window* m_sdlWindow = nullptr;
|
||||
|
||||
// Create an SDL window with the requested OpenGL attributes
|
||||
void Create(const char* title, const GLSDLWindowRect& rect, GLTextureFormat depthFormat, uint32_t sampleCount);
|
||||
void Destroy();
|
||||
void Swap();
|
||||
void Resize(const GLSDLWindowRect& rect);
|
||||
|
||||
GLSDLWindowRect GetRect();
|
||||
GLSDLWindowRect GetBackingRect();
|
||||
|
||||
int32_t GetWidth();
|
||||
int32_t GetHeight();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
135
src/gx/glsdl/GLShader.cpp
Normal file
135
src/gx/glsdl/GLShader.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
#include "gx/glsdl/GLShader.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include "gx/glsdl/GLPixelShader.hpp"
|
||||
#include "gx/glsdl/GLPool.hpp"
|
||||
#include "gx/glsdl/GLVertexShader.hpp"
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
// TODO
|
||||
// - threaded compiler support
|
||||
// - glsl support
|
||||
// - hybrid support
|
||||
GLShader* GLShader::Create(ShaderType shaderType, bool hybrid, bool usingCG, const char* a4, const void* buf, int32_t codeLen, const char* a7, const char* name, GLShaderLogInfo* logInfo) {
|
||||
const char* shaderCode = reinterpret_cast<const char*>(buf);
|
||||
|
||||
if (*reinterpret_cast<const int32_t*>(buf) == 'GSL1') {
|
||||
BLIZZARD_ASSERT(!usingCG);
|
||||
|
||||
const ShaderDataHeader header = *reinterpret_cast<const ShaderDataHeader*>(buf);
|
||||
|
||||
BLIZZARD_ASSERT(header.shaderType == shaderType);
|
||||
BLIZZARD_ASSERT(header.size == codeLen);
|
||||
BLIZZARD_ASSERT(header.codePos >= sizeof(ShaderDataHeader));
|
||||
BLIZZARD_ASSERT(header.codeSize > 0);
|
||||
|
||||
shaderCode = &reinterpret_cast<const char*>(buf)[header.codePos];
|
||||
}
|
||||
|
||||
GLShader* shader = nullptr;
|
||||
|
||||
if (shaderType == ePixelShader) {
|
||||
shader = GLPixelShader::Create();
|
||||
} else if (shaderType == eVertexShader) {
|
||||
shader = GLVertexShader::Create();
|
||||
} else {
|
||||
// TODO
|
||||
// sub_1C5E0(&v38, "Unknown shader type %d!", shaderType);
|
||||
}
|
||||
|
||||
shader->m_UsingCG = usingCG;
|
||||
|
||||
if (usingCG) {
|
||||
shader->CompileCG(a4, shaderCode, codeLen, a7, logInfo);
|
||||
} else {
|
||||
shader->m_Code.assign(shaderCode, codeLen);
|
||||
|
||||
// TODO
|
||||
// sub_5CD10(shader);
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
bool GLShader::CheckErrorsARB(GLShaderLogInfo* logInfo) {
|
||||
GLint errorPos;
|
||||
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
|
||||
const GLubyte* errorStr = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
|
||||
|
||||
// TODO
|
||||
// Blizzard::Debug::VAssert(logInfo != 0 || errorPos == -1, errorStr);
|
||||
|
||||
return errorPos == -1;
|
||||
}
|
||||
|
||||
void GLShader::Compile(GLShaderLogInfo* logInfo) {
|
||||
this->ImmediateCompile(logInfo);
|
||||
}
|
||||
|
||||
void GLShader::CompileCG(const char* a2, const void* shaderCode, int32_t codeLen, const char* a5, GLShaderLogInfo* logInfo) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLShader::FlushUniforms(GLGLSLProgram* program) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
std::string& GLShader::GetCode() {
|
||||
return this->m_Code;
|
||||
}
|
||||
|
||||
int32_t GLShader::GetShaderType() {
|
||||
return this->m_ShaderType;
|
||||
}
|
||||
|
||||
void GLShader::ImmediateCompile(GLShaderLogInfo* logInfo) {
|
||||
BLIZZARD_ASSERT(!this->GetCode().empty());
|
||||
|
||||
this->m_Device = GLSDLDevice::Get();
|
||||
|
||||
if (!this->m_UsingGLSL) {
|
||||
if (!this->m_ShaderID) {
|
||||
if (this->m_ShaderType == eVertexShader) {
|
||||
this->m_ShaderID = GLPool<GLVertexShader>::Get()->GetNextName();
|
||||
} else {
|
||||
this->m_ShaderID = GLPool<GLPixelShader>::Get()->GetNextName();
|
||||
}
|
||||
}
|
||||
|
||||
this->m_Device->BindShader(this);
|
||||
|
||||
const char* arbCode = this->GetCode().c_str();
|
||||
size_t arbLen = strlen(arbCode);
|
||||
|
||||
glProgramStringARB(this->var5, GL_PROGRAM_FORMAT_ASCII_ARB, arbLen, arbCode);
|
||||
|
||||
BLIZZARD_ASSERT(this->CheckErrorsARB(logInfo));
|
||||
} else {
|
||||
// TODO
|
||||
// - handle GLSL shaders
|
||||
// - handle hybrid shaders
|
||||
}
|
||||
|
||||
if (logInfo) {
|
||||
// TODO
|
||||
// this->var20 = logInfo[0];
|
||||
} else {
|
||||
this->var20 = 1;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// this->m_TimeStamp = Blizzard::Time::GetTimestamp();
|
||||
}
|
||||
|
||||
bool GLShader::IsEnabled() {
|
||||
return this->m_Enabled;
|
||||
}
|
||||
|
||||
void GLShader::ReleaseObject() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLShader::SetShaderConstants(ShaderType shaderType, uint32_t index, const float* constants, uint32_t count) {
|
||||
// TODO
|
||||
}
|
75
src/gx/glsdl/GLShader.hpp
Normal file
75
src/gx/glsdl/GLShader.hpp
Normal file
@ -0,0 +1,75 @@
|
||||
#ifndef GX_GL_SDL_GL_SHADER_HPP
|
||||
#define GX_GL_SDL_GL_SHADER_HPP
|
||||
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
#include "gx/glsdl/GLShaderInput.hpp"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class GLSDLDevice;
|
||||
class GLGLSLProgram;
|
||||
class GLShaderLogInfo;
|
||||
|
||||
class GLShader : public GLObject {
|
||||
public:
|
||||
// Types
|
||||
enum ShaderType {
|
||||
eVertexShader = 1,
|
||||
ePixelShader = 2,
|
||||
eShaderTypeCount = 3
|
||||
};
|
||||
|
||||
struct ShaderDataHeader {
|
||||
uint32_t signature;
|
||||
uint32_t size;
|
||||
ShaderType shaderType;
|
||||
uint32_t codePos;
|
||||
uint32_t codeSize;
|
||||
uint32_t unk1;
|
||||
uint32_t unk2;
|
||||
uint32_t unk3;
|
||||
};
|
||||
|
||||
// Static functions
|
||||
static GLShader* Create(ShaderType, bool, bool, const char*, const void*, int32_t, const char*, const char*, GLShaderLogInfo*);
|
||||
|
||||
// Member variables
|
||||
int32_t m_ShaderType = 0;
|
||||
int32_t var5 = 0;
|
||||
uint32_t m_ShaderID = 0;
|
||||
bool m_UsingCG = false;
|
||||
bool m_UsingGLSL = false;
|
||||
uint32_t m_UniformRegisterCount = 0;
|
||||
GLShaderInput** var10 = nullptr;
|
||||
float* var11 = nullptr;
|
||||
bool var12 = false;
|
||||
uint32_t var13 = 0;
|
||||
uint32_t var14 = 0;
|
||||
std::vector<GLShaderInput*, std::allocator<GLShaderInput*>> var15;
|
||||
std::vector<GLShaderInput*, std::allocator<GLShaderInput*>> var16;
|
||||
std::vector<GLShaderInput*, std::allocator<GLShaderInput*>> var17;
|
||||
GLShader* var18 = nullptr;
|
||||
GLSDLDevice* m_Device = nullptr;
|
||||
bool var20 = 0;
|
||||
bool m_Enabled = true;
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char>> m_Code;
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char>> var23;
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ReleaseObject();
|
||||
|
||||
// Member functions
|
||||
bool CheckErrorsARB(GLShaderLogInfo*);
|
||||
bool CheckErrorsGLSL(GLShaderLogInfo*);
|
||||
void Compile(GLShaderLogInfo*);
|
||||
void CompileCG(const char*, const void*, int32_t, const char*, GLShaderLogInfo*);
|
||||
void FlushUniforms(GLGLSLProgram*);
|
||||
std::string& GetCode(void);
|
||||
int32_t GetShaderType(void);
|
||||
void ImmediateCompile(GLShaderLogInfo*);
|
||||
bool IsEnabled(void);
|
||||
void SetShaderConstants(ShaderType, uint32_t, const float*, uint32_t);
|
||||
};
|
||||
|
||||
#endif
|
33
src/gx/glsdl/GLShaderInput.hpp
Normal file
33
src/gx/glsdl/GLShaderInput.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef GX_GL_SDL_GL_SHADER_INPUT_HPP
|
||||
#define GX_GL_SDL_GL_SHADER_INPUT_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
class GLShader;
|
||||
|
||||
class GLShaderInput {
|
||||
public:
|
||||
// Member variables
|
||||
GLShader *m_Shader;
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char>> m_Name;
|
||||
std::basic_string<char, std::char_traits<char>, std::allocator<char>> var2;
|
||||
int16_t m_MapIndex;
|
||||
int16_t var4;
|
||||
int16_t var5;
|
||||
int16_t m_UsedSize;
|
||||
int16_t var7;
|
||||
int16_t var8;
|
||||
GLShaderInput *m_Parent;
|
||||
int32_t var10;
|
||||
int32_t var11;
|
||||
int32_t var12;
|
||||
int8_t m_ChildrenCount;
|
||||
int8_t var14;
|
||||
uint16_t var15;
|
||||
int8_t var16;
|
||||
int8_t m_Variability;
|
||||
int8_t var18;
|
||||
int8_t var19;
|
||||
};
|
||||
|
||||
#endif
|
632
src/gx/glsdl/GLTexture.cpp
Normal file
632
src/gx/glsdl/GLTexture.cpp
Normal file
@ -0,0 +1,632 @@
|
||||
#include "gx/glsdl/GLTexture.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include "gx/glsdl/GLPool.hpp"
|
||||
#include "gx/glsdl/GLUtil.hpp"
|
||||
#include "gx/texture/CGxTex.hpp"
|
||||
#include <deque>
|
||||
#include <bc/Debug.hpp>
|
||||
#include <bc/Memory.hpp>
|
||||
|
||||
Blizzard::Thread::TLSSlot GLTexture::m_Bindings[4];
|
||||
|
||||
void* GLTexture::CreateBindings(void* ptr) {
|
||||
return new std::deque<std::vector<Binding>>;
|
||||
}
|
||||
|
||||
void GLTexture::DestroyBindings(void* ptr) {
|
||||
delete static_cast<std::deque<std::vector<Binding>>*>(ptr);
|
||||
}
|
||||
|
||||
void GLTexture::Bind(GLSDLDevice* device, bool force) {
|
||||
BLIZZARD_ASSERT(!this->IsSystemBuffer());
|
||||
BLIZZARD_ASSERT(this->m_Depth != 0);
|
||||
|
||||
if (!device) {
|
||||
device = GLSDLDevice::Get();
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(device != nullptr);
|
||||
|
||||
auto& bindings = this->GetBindings();
|
||||
uint32_t deviceID = device->GetID();
|
||||
|
||||
if (deviceID >= bindings.size()) {
|
||||
bindings.resize(deviceID + 1);
|
||||
}
|
||||
|
||||
bindings[deviceID].device = device;
|
||||
|
||||
uint32_t currentActiveTexture = device->m_States.binding.currentActiveTexture;
|
||||
|
||||
if (bindings[deviceID].boundStages[currentActiveTexture]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (force) {
|
||||
bindings[deviceID].boundStages[currentActiveTexture] = 1;
|
||||
device->BindTexture(this->m_TextureType, this);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < 16; i++) {
|
||||
if (bindings[deviceID].boundStages[i]) {
|
||||
device->SetActiveTexture(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bindings[deviceID].boundStages[currentActiveTexture] = 1;
|
||||
device->BindTexture(this->m_TextureType, this);
|
||||
}
|
||||
|
||||
void GLTexture::FreeTexture() {
|
||||
auto device = GLSDLDevice::Get();
|
||||
|
||||
int32_t numFace = this->m_TextureType == GL_TEXTURE_CUBE_MAP ? 6 : 1;
|
||||
for (int32_t face = 0; face < numFace; face++) {
|
||||
if (this->m_Mipmaps[face]) {
|
||||
delete[] this->m_Mipmaps[face];
|
||||
}
|
||||
}
|
||||
|
||||
if (this->m_Mipmaps) {
|
||||
delete[] this->m_Mipmaps;
|
||||
}
|
||||
|
||||
this->m_Mipmaps = nullptr;
|
||||
this->m_Depth = 0;
|
||||
|
||||
// TODO this->Sub690D0();
|
||||
|
||||
glDeleteTextures(1, &this->m_TextureID);
|
||||
|
||||
this->m_GenerateMipmaps = 0;
|
||||
this->m_MaxMipmapLevel = 1000;
|
||||
this->m_BaseMipmapLevel = 0;
|
||||
this->m_CompareMode = 0;
|
||||
|
||||
this->m_Sampler.mipmapBias = 0.0f;
|
||||
this->m_Sampler.borderColor = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
this->m_Sampler.addressModeS = GL_REPEAT;
|
||||
this->m_Sampler.addressModeT = GL_REPEAT;
|
||||
this->m_Sampler.addressModeR = GL_REPEAT;
|
||||
this->m_Sampler.magFilterMode = GL_LINEAR;
|
||||
this->m_Sampler.minFilterMode = GL_NEAREST_MIPMAP_LINEAR;
|
||||
this->m_Sampler.maxAnisotropy = 1.0f;
|
||||
|
||||
Blizzard::Memory::Free(this->m_Data);
|
||||
this->m_Data = nullptr;
|
||||
|
||||
switch (this->m_TextureType) {
|
||||
case GL_TEXTURE_3D:
|
||||
// TODO GLPool<GLTexture3D>::GLObjectPool::Push(GLPool<GLTexture3D>::m_pool + 264, this);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
// TODO GLPool<GLTextureCubeMap>::GLObjectPool::Push(GLPool<GLTextureCubeMap>::m_pool + 520, this);
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_2D:
|
||||
// TODO GLPool<GLTexture2D>::GLObjectPool::Push(GLPool<GLTexture2D>::m_pool + 131080, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<GLTexture::Binding>& GLTexture::GetBindings() {
|
||||
uint32_t index = GLSDLTextureTypeToIndex(this->m_TextureType);
|
||||
|
||||
uint32_t id;
|
||||
|
||||
if (index == 0) {
|
||||
id = this->m_TextureID - 33;
|
||||
} else if (index == 1) {
|
||||
id = this->m_TextureID - 32801;
|
||||
} else if (index == 2) {
|
||||
id = this->m_TextureID - 32865;
|
||||
} else if (index == 3) {
|
||||
id = this->m_TextureID - 1;
|
||||
}
|
||||
|
||||
auto target = static_cast<std::deque<std::vector<Binding>>*>(
|
||||
Blizzard::Thread::RegisterLocalStorage(
|
||||
&GLTexture::m_Bindings[index],
|
||||
GLTexture::CreateBindings,
|
||||
nullptr,
|
||||
GLTexture::DestroyBindings
|
||||
)
|
||||
);
|
||||
|
||||
if (id >= target->size()) {
|
||||
target->resize(id + 1);
|
||||
}
|
||||
|
||||
return (*target)[id];
|
||||
}
|
||||
|
||||
GLTextureFormat GLTexture::GetFormat() {
|
||||
return this->m_Format;
|
||||
}
|
||||
|
||||
TextureFormatInfo& GLTexture::GetFormatInfo() {
|
||||
return k_TextureFormatInfo[this->m_Format];
|
||||
}
|
||||
|
||||
GLMipmap* GLTexture::GetMipmap(uint32_t level, GLEnum face) {
|
||||
BLIZZARD_ASSERT(face >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
|
||||
BLIZZARD_ASSERT(level < this->m_NumMipmap);
|
||||
BLIZZARD_ASSERT(this->m_Mipmaps != nullptr);
|
||||
BLIZZARD_ASSERT(this->m_Mipmaps[face - GL_TEXTURE_CUBE_MAP_POSITIVE_X] != nullptr);
|
||||
|
||||
return &this->m_Mipmaps[face - GL_TEXTURE_CUBE_MAP_POSITIVE_X][level];
|
||||
}
|
||||
|
||||
bool GLTexture::IsRenderTarget() {
|
||||
return this->m_Flags & GLTFLAG_RENDERTARGET;
|
||||
}
|
||||
|
||||
bool GLTexture::IsSystemBuffer() {
|
||||
return this->m_Flags & GLTFLAG_SYSTEM_BUFFER;
|
||||
}
|
||||
|
||||
bool GLTexture::IsValid() {
|
||||
return this->m_Depth;
|
||||
}
|
||||
|
||||
void* GLTexture::Map(uint32_t level, const GLRect* a3, uint32_t& a4, GLEnum a5) {
|
||||
BLIZZARD_ASSERT(this->m_TextureType != GL_TEXTURE_3D);
|
||||
|
||||
auto mipmap = this->GetMipmap(level, GL_TEXTURE_CUBE_MAP_POSITIVE_X);
|
||||
a4 = mipmap->GetPitch();
|
||||
return mipmap->Map(a5, a3);
|
||||
}
|
||||
|
||||
void GLTexture::RecreateGLTexture() {
|
||||
if (this->m_TextureType == GL_TEXTURE_RECTANGLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool isCubeMap = this->m_TextureType == GL_TEXTURE_CUBE_MAP;
|
||||
int32_t numFace = isCubeMap ? 6 : 1;
|
||||
|
||||
for (int32_t face = 0; face < numFace; face++) {
|
||||
for (int32_t level = 0; level < this->m_NumMipmap; level++) {
|
||||
this->m_Mipmaps[face][level].Map(GL_WRITE_ONLY, static_cast<GLBox*>(nullptr));
|
||||
this->m_Mipmaps[face][level].Unmap();
|
||||
}
|
||||
}
|
||||
|
||||
glTexParameterf(this->m_TextureType, GL_TEXTURE_LOD_BIAS, this->m_Sampler.mipmapBias);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_S, this->m_Sampler.addressModeS);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_T, this->m_Sampler.addressModeT);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_R, this->m_Sampler.addressModeR);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_MIN_FILTER, this->m_Sampler.minFilterMode);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_MAG_FILTER, this->m_Sampler.magFilterMode);
|
||||
glTexParameterf(this->m_TextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT, this->m_Sampler.maxAnisotropy);
|
||||
glTexParameterfv(this->m_TextureType, GL_TEXTURE_BORDER_COLOR, reinterpret_cast<GLfloat*>(&this->m_Sampler.borderColor));
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_MAX_LEVEL, this->m_MaxMipmapLevel);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_BASE_LEVEL, this->m_BaseMipmapLevel);
|
||||
glTexParameteri(this->m_TextureType, GL_GENERATE_MIPMAP, this->m_GenerateMipmaps);
|
||||
}
|
||||
|
||||
void GLTexture::ResizeMipmaps() {
|
||||
BLIZZARD_ASSERT(this->m_Mipmaps == nullptr);
|
||||
|
||||
int32_t numFace = this->m_TextureType == GL_TEXTURE_CUBE_MAP ? 6 : 1;
|
||||
|
||||
this->m_Mipmaps = new GLMipmap*[numFace];
|
||||
|
||||
for (int32_t face = 0; face < numFace; face++) {
|
||||
this->m_Mipmaps[face] = new GLMipmap[this->m_NumMipmap];
|
||||
}
|
||||
}
|
||||
|
||||
void GLTexture::SetAddressModeR(GLEnum mode) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLTexture::SetAddressModeS(GLEnum mode) {
|
||||
if (this->m_Sampler.addressModeS == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == GL_CLAMP_TO_EDGE) {
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_S, mode);
|
||||
this->m_Sampler.addressModeS = mode;
|
||||
} else {
|
||||
// Workaround for buggy GPU (possibly ATI Radeon X1900)
|
||||
if (GLSDLDevice::GetRendererInfo().renderer_id == 0x21900) {
|
||||
if (this->m_Width & (this->m_Width - 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->m_Height & (this->m_Height - 1)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_S, mode);
|
||||
this->m_Sampler.addressModeS = mode;
|
||||
}
|
||||
}
|
||||
|
||||
void GLTexture::SetAddressModeT(GLEnum mode) {
|
||||
if (this->m_Sampler.addressModeT == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == GL_CLAMP_TO_EDGE) {
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_T, mode);
|
||||
this->m_Sampler.addressModeT = mode;
|
||||
} else {
|
||||
// Workaround for buggy GPU (possibly ATI Radeon X1900)
|
||||
if (GLSDLDevice::GetRendererInfo().renderer_id == 0x21900) {
|
||||
if (this->m_Width & (this->m_Width - 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->m_Height & (this->m_Height - 1)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_WRAP_T, mode);
|
||||
this->m_Sampler.addressModeT = mode;
|
||||
}
|
||||
}
|
||||
|
||||
void GLTexture::SetBorderColor(const GLColor4f& color) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLTexture::SetCompareMode(GLEnum compareMode) {
|
||||
BLIZZARD_ASSERT(
|
||||
this->GetFormatInfo().m_DataFormat == GL_DEPTH_COMPONENT
|
||||
|| this->GetFormatInfo().m_DataFormat == GL_DEPTH_STENCIL_EXT
|
||||
|| compareMode == GL_NONE
|
||||
);
|
||||
|
||||
if (this->m_CompareMode != compareMode) {
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_COMPARE_MODE, compareMode);
|
||||
this->m_CompareMode = compareMode;
|
||||
}
|
||||
}
|
||||
|
||||
void GLTexture::SetMagFilterMode(GLEnum mode) {
|
||||
if (this->m_Sampler.magFilterMode == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GLSDLDevice::GetRendererInfo().vendor_id == 2 && this->IsRenderTarget() && mode != GL_LINEAR) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_MAG_FILTER, mode);
|
||||
this->m_Sampler.magFilterMode = mode;
|
||||
}
|
||||
|
||||
void GLTexture::SetMaxAnisotropy(int32_t maxAnisotropy) {
|
||||
if (this->m_Sampler.maxAnisotropy == maxAnisotropy) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameterf(this->m_TextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy);
|
||||
this->m_Sampler.maxAnisotropy = maxAnisotropy;
|
||||
}
|
||||
|
||||
void GLTexture::SetMinFilterMode(GLEnum mode) {
|
||||
if (this->m_Sampler.minFilterMode == mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GLSDLDevice::GetRendererInfo().vendor_id == 2 && this->IsRenderTarget() && mode != GL_LINEAR) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_MIN_FILTER, mode);
|
||||
this->m_Sampler.minFilterMode = mode;
|
||||
}
|
||||
|
||||
void GLTexture::SetupTexture() {
|
||||
BLIZZARD_ASSERT(this->m_NumMipmap == 1 || (this->m_Flags & GLTFLAG_AUTOGEN_MIPMAP) == 0);
|
||||
BLIZZARD_ASSERT(!this->IsRenderTarget() || this->m_NumMipmap == 1);
|
||||
BLIZZARD_ASSERT(!this->IsRenderTarget() || (this->m_Flags & GLTFLAG_READ_ACCESS) == 0);
|
||||
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
|
||||
if (this->GetFormatInfo().m_IsCompressed) {
|
||||
int32_t smallestDim = std::min(this->m_Width, this->m_Height);
|
||||
|
||||
BLIZZARD_ASSERT(smallestDim >= 4);
|
||||
|
||||
if (smallestDim == 4) {
|
||||
this->m_NumMipmap = 1;
|
||||
} else if (smallestDim == 8) {
|
||||
this->m_NumMipmap = 2;
|
||||
} else if (smallestDim == 16) {
|
||||
this->m_NumMipmap = 3;
|
||||
} else if (smallestDim == 32) {
|
||||
this->m_NumMipmap = 4;
|
||||
} else if (smallestDim == 64) {
|
||||
this->m_NumMipmap = 5;
|
||||
} else if (smallestDim == 128) {
|
||||
this->m_NumMipmap = 6;
|
||||
} else if (smallestDim == 256) {
|
||||
this->m_NumMipmap = 7;
|
||||
} else if (smallestDim == 512) {
|
||||
this->m_NumMipmap = 8;
|
||||
} else if (smallestDim == 1024) {
|
||||
this->m_NumMipmap = 9;
|
||||
} else if (smallestDim == 2048) {
|
||||
this->m_NumMipmap = 10;
|
||||
} else if (smallestDim == 4096) {
|
||||
this->m_NumMipmap = 11;
|
||||
} else {
|
||||
int32_t i = smallestDim >> 1;
|
||||
int32_t n = 0;
|
||||
|
||||
while (i) {
|
||||
i >>= 1;
|
||||
n++;
|
||||
}
|
||||
|
||||
this->m_NumMipmap = n - 1;
|
||||
}
|
||||
} else {
|
||||
int32_t largestDim = std::max(this->m_Width, this->m_Height);
|
||||
|
||||
if (largestDim == 1) {
|
||||
this->m_NumMipmap = 1;
|
||||
} else if (largestDim == 2) {
|
||||
this->m_NumMipmap = 2;
|
||||
} else if (largestDim == 4) {
|
||||
this->m_NumMipmap = 3;
|
||||
} else if (largestDim == 8) {
|
||||
this->m_NumMipmap = 4;
|
||||
} else if (largestDim == 16) {
|
||||
this->m_NumMipmap = 5;
|
||||
} else if (largestDim == 32) {
|
||||
this->m_NumMipmap = 6;
|
||||
} else if (largestDim == 64) {
|
||||
this->m_NumMipmap = 7;
|
||||
} else if (largestDim == 128) {
|
||||
this->m_NumMipmap = 8;
|
||||
} else if (largestDim == 256) {
|
||||
this->m_NumMipmap = 9;
|
||||
} else if (largestDim == 512) {
|
||||
this->m_NumMipmap = 10;
|
||||
} else if (largestDim == 1024) {
|
||||
this->m_NumMipmap = 11;
|
||||
} else if (largestDim == 2048) {
|
||||
this->m_NumMipmap = 12;
|
||||
} else if (largestDim == 4096) {
|
||||
this->m_NumMipmap = 13;
|
||||
} else {
|
||||
int32_t i = largestDim >> 1;
|
||||
int32_t n = 0;
|
||||
|
||||
while (i) {
|
||||
i >>= 1;
|
||||
n++;
|
||||
}
|
||||
|
||||
this->m_NumMipmap = n + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(this->m_Flags & GLTFLAG_SYSTEM_BUFFER)) {
|
||||
BLIZZARD_ASSERT(this->m_RequestedNumMipmaps != 0);
|
||||
|
||||
this->m_NumMipmap = std::min(this->m_NumMipmap, this->m_RequestedNumMipmaps);
|
||||
}
|
||||
|
||||
this->var12 = this->GetFormatInfo().m_BytePerPixel * this->m_Width;
|
||||
if (this->GetFormatInfo().m_IsCompressed) {
|
||||
this->var12 >>= 2;
|
||||
}
|
||||
|
||||
this->ResizeMipmaps();
|
||||
|
||||
bool isCubeMap = this->m_TextureType == GL_TEXTURE_CUBE_MAP;
|
||||
|
||||
this->m_Size = 0;
|
||||
|
||||
int32_t numFace = isCubeMap ? 6 : 1;
|
||||
|
||||
for (int32_t face = 0; face < numFace; face++) {
|
||||
for (int32_t level = 0; level < this->m_NumMipmap; level++) {
|
||||
GLMipmap* mip = this->GetMipmap(level, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face);
|
||||
|
||||
mip->m_Level = level;
|
||||
mip->m_Texture = this;
|
||||
mip->ResetSize(this->m_Width >> level, this->m_Height >> level, this->m_Depth >> level);
|
||||
|
||||
this->m_Size += mip->m_Size;
|
||||
}
|
||||
}
|
||||
|
||||
this->var7 = GLSDLDevice::m_Devices[0]->m_TextureList.begin();
|
||||
|
||||
if (this->m_Flags & GLTFLAG_SYSTEM_BUFFER) {
|
||||
return;
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(this->m_Data == nullptr);
|
||||
|
||||
if (!this->IsRenderTarget()) {
|
||||
this->m_Data = static_cast<char*>(Blizzard::Memory::Allocate(this->m_Size));
|
||||
}
|
||||
|
||||
this->Bind(nullptr, 0);
|
||||
|
||||
if (this->IsRenderTarget()) {
|
||||
this->SetAddressModeR(GL_CLAMP_TO_EDGE);
|
||||
this->SetAddressModeS(GL_CLAMP_TO_EDGE);
|
||||
this->SetAddressModeT(GL_CLAMP_TO_EDGE);
|
||||
this->SetMinFilterMode(GL_LINEAR);
|
||||
this->SetMagFilterMode(GL_LINEAR);
|
||||
|
||||
// glTexParameteri(this->m_TextureType, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_CACHED_APPLE);
|
||||
} else {
|
||||
this->SetAddressModeR(GL_REPEAT);
|
||||
this->SetAddressModeS(GL_REPEAT);
|
||||
this->SetAddressModeT(GL_REPEAT);
|
||||
this->SetMinFilterMode(GL_NEAREST_MIPMAP_NEAREST);
|
||||
this->SetMagFilterMode(GL_NEAREST);
|
||||
}
|
||||
|
||||
if (this->GetFormatInfo().m_DataFormat == GL_DEPTH_COMPONENT || this->GetFormatInfo().m_DataFormat == GL_DEPTH_STENCIL) {
|
||||
this->SetCompareMode(GLSDLDevice::m_ExtARBShadow >= 1 ? GL_COMPARE_R_TO_TEXTURE : 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||
glTexParameteri(this->m_TextureType, GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE);
|
||||
} else {
|
||||
this->SetCompareMode(0);
|
||||
}
|
||||
|
||||
this->SetMaxAnisotropy(1);
|
||||
|
||||
this->SetBorderColor(GLColor4f::ZERO);
|
||||
|
||||
int32_t autogenMipmap = this->m_Flags & GLTFLAG_AUTOGEN_MIPMAP;
|
||||
if (autogenMipmap != this->m_GenerateMipmaps) {
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_GENERATE_MIPMAP, autogenMipmap);
|
||||
this->m_GenerateMipmaps = autogenMipmap;
|
||||
}
|
||||
|
||||
int32_t maxMipmapLevel = this->m_NumMipmap - 1;
|
||||
if (maxMipmapLevel != this->m_MaxMipmapLevel) {
|
||||
this->Bind(nullptr, 0);
|
||||
glTexParameteri(this->m_TextureType, GL_TEXTURE_MAX_LEVEL, maxMipmapLevel);
|
||||
this->m_MaxMipmapLevel = maxMipmapLevel;
|
||||
}
|
||||
|
||||
if (this->m_TextureType == GL_TEXTURE_RECTANGLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->IsRenderTarget()) {
|
||||
device->SetUnpackClientStorage(0);
|
||||
}
|
||||
|
||||
unsigned char* data = reinterpret_cast<unsigned char*>(this->m_Data);
|
||||
|
||||
for (int32_t face = 0; face < numFace; face++) {
|
||||
for (int32_t level = 0; level < this->m_NumMipmap; level++) {
|
||||
GLMipmap* mip = this->GetMipmap(level, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face);
|
||||
|
||||
if (this->m_TextureType == GL_TEXTURE_CUBE_MAP) {
|
||||
mip->ResetData(face, level, data);
|
||||
} else {
|
||||
mip->ResetData(this->m_TextureType, level, data);
|
||||
}
|
||||
|
||||
if (data) {
|
||||
data += mip->m_Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
// this->m_TimeStamp = Blizzard::Time::GetTimestamp();
|
||||
|
||||
if (this->IsRenderTarget()) {
|
||||
device->SetUnpackClientStorage(1);
|
||||
}
|
||||
}
|
||||
|
||||
void GLTexture::Unbind(GLSDLDevice* device, uint32_t stage) {
|
||||
auto& bindings = this->GetBindings();
|
||||
|
||||
BLIZZARD_ASSERT(device->GetID() < bindings.size());
|
||||
BLIZZARD_ASSERT(bindings[device->GetID()].device == device);
|
||||
BLIZZARD_ASSERT(bindings[device->GetID()].boundStages[stage]);
|
||||
|
||||
bindings[device->GetID()].boundStages[stage] = 0;
|
||||
}
|
||||
|
||||
void GLTexture::Unmap(uint32_t level, GLEnum face) {
|
||||
auto mipmap = this->GetMipmap(level, face);
|
||||
mipmap->Unmap();
|
||||
}
|
||||
|
||||
GLTexture2D* GLTexture2D::Create(uint32_t width, uint32_t height, uint32_t numMipMap, GLTextureFormat format, uint32_t flags) {
|
||||
GLTexture2D* tex;
|
||||
|
||||
// TODO
|
||||
// tex = GLPool<GLTexture2D>::GLObjectPool::Pop(GLPool<GLTexture2D>::m_pool + 131080);
|
||||
tex = nullptr;
|
||||
|
||||
if (!tex) {
|
||||
tex = new GLTexture2D();
|
||||
}
|
||||
|
||||
// TODO
|
||||
// Blizzard::Debug::Assert(tex->m_refCount == 0);
|
||||
|
||||
tex->m_RefCount = 1;
|
||||
|
||||
// TODO
|
||||
// Blizzard::Debug::Assert(tex->m_TextureID >= PoolStats<GLTexture2D>::NAME_POOL_FIRST_NAME);
|
||||
|
||||
tex->m_TextureType = GL_TEXTURE_2D;
|
||||
tex->m_Width = width;
|
||||
tex->m_Depth = 1;
|
||||
tex->m_Height = height;
|
||||
tex->m_Format = format;
|
||||
tex->m_NumMipmap = numMipMap;
|
||||
tex->m_RequestedNumMipmaps = numMipMap;
|
||||
tex->m_Flags = flags;
|
||||
|
||||
tex->SetupTexture();
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
GLTexture2D::GLTexture2D() : GLTexture() {
|
||||
this->m_TextureType = GL_TEXTURE_2D;
|
||||
this->m_TextureID = GLPool<GLTexture2D>::Get()->GetNextName();
|
||||
|
||||
// TODO
|
||||
// Blizzard::Debug::Assert(this->m_TextureID >= PoolStats<GLTexture2D>::NAME_POOL_FIRST_NAME);
|
||||
}
|
||||
|
||||
void GLTexture2D::ReleaseObject() {
|
||||
BLIZZARD_ASSERT(this->m_TextureType == GL_TEXTURE_2D);
|
||||
this->FreeTexture();
|
||||
}
|
||||
|
||||
void GLSDLTexSetFlags(CGxTex* texId, GLTexture* a2) {
|
||||
static GLEnum convertMagFilterToOgl[] = {
|
||||
GL_NEAREST,
|
||||
GL_LINEAR,
|
||||
GL_NEAREST,
|
||||
GL_LINEAR,
|
||||
GL_LINEAR,
|
||||
GL_LINEAR
|
||||
};
|
||||
|
||||
static GLEnum convertMinFilterToOgl[] = {
|
||||
GL_NEAREST,
|
||||
GL_LINEAR,
|
||||
GL_NEAREST_MIPMAP_NEAREST,
|
||||
GL_LINEAR_MIPMAP_NEAREST,
|
||||
GL_LINEAR_MIPMAP_LINEAR,
|
||||
GL_LINEAR_MIPMAP_LINEAR
|
||||
};
|
||||
|
||||
a2->SetMagFilterMode(convertMagFilterToOgl[texId->m_flags.m_filter]);
|
||||
a2->SetMinFilterMode(convertMinFilterToOgl[texId->m_flags.m_filter]);
|
||||
|
||||
a2->SetAddressModeS(texId->m_flags.m_wrapU ? GL_REPEAT : GL_CLAMP_TO_EDGE);
|
||||
a2->SetAddressModeT(texId->m_flags.m_wrapV ? GL_REPEAT : GL_CLAMP_TO_EDGE);
|
||||
|
||||
a2->SetMaxAnisotropy(texId->m_flags.m_maxAnisotropy);
|
||||
}
|
101
src/gx/glsdl/GLTexture.hpp
Normal file
101
src/gx/glsdl/GLTexture.hpp
Normal file
@ -0,0 +1,101 @@
|
||||
#ifndef GX_GL_SDL_GL_TEXTURE_HPP
|
||||
#define GX_GL_SDL_GL_TEXTURE_HPP
|
||||
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <bc/Thread.hpp>
|
||||
|
||||
#define GLTFLAG_RENDERTARGET 0x1
|
||||
#define GLTFLAG_DEPTH 0x2
|
||||
#define GLTFLAG_STENCIL 0x4
|
||||
#define GLTFLAG_AUTOGEN_MIPMAP 0x8
|
||||
#define GLTFLAG_READ_ACCESS 0x10
|
||||
#define GLTFLAG_SYSTEM_BUFFER 0x20
|
||||
|
||||
class CGxTex;
|
||||
class GLMipmap;
|
||||
class GLSDLDevice;
|
||||
|
||||
class GLTexture : public GLObject {
|
||||
public:
|
||||
// Types
|
||||
struct Binding {
|
||||
uint8_t boundStages[16];
|
||||
GLSDLDevice* device;
|
||||
};
|
||||
|
||||
// Static variables
|
||||
static Blizzard::Thread::TLSSlot m_Bindings[4];
|
||||
|
||||
// Static functions
|
||||
static void* CreateBindings(void*);
|
||||
static void DestroyBindings(void*);
|
||||
|
||||
// Member variables
|
||||
uint32_t m_TextureID = 0;
|
||||
GLEnum m_TextureType = 0;
|
||||
GLMipmap** m_Mipmaps = nullptr;
|
||||
std::list<GLTexture*>::iterator var7;
|
||||
uint32_t m_LastFrameUsed;
|
||||
uint32_t m_Width = 0;
|
||||
uint32_t m_Height = 0;
|
||||
uint32_t m_Depth = 0;
|
||||
uint32_t var12 = 0;
|
||||
uint32_t m_Size = 0;
|
||||
GLTextureFormat m_Format = GLTF_INVALID;
|
||||
uint32_t m_Flags = 0;
|
||||
uint32_t m_NumMipmap = 0;
|
||||
uint32_t m_RequestedNumMipmaps;
|
||||
char* m_Data = nullptr;
|
||||
std::atomic<int32_t> m_MappedMipmaps = { 0 };
|
||||
GLStates::Sampler m_Sampler;
|
||||
bool m_GenerateMipmaps = 0;
|
||||
int32_t m_MaxMipmapLevel = 1000;
|
||||
int32_t m_BaseMipmapLevel = 0;
|
||||
int32_t m_CompareMode = 0;
|
||||
|
||||
// Member functions
|
||||
void Bind(GLSDLDevice*, bool);
|
||||
void FreeTexture();
|
||||
std::vector<Binding>& GetBindings(void); // invented name
|
||||
GLTextureFormat GetFormat(void);
|
||||
TextureFormatInfo& GetFormatInfo(void);
|
||||
GLMipmap* GetMipmap(uint32_t, GLEnum);
|
||||
bool IsRenderTarget(void);
|
||||
bool IsSystemBuffer(void);
|
||||
bool IsValid(void);
|
||||
void* Map(uint32_t, const GLRect*, uint32_t&, GLEnum);
|
||||
void RecreateGLTexture(void);
|
||||
void ResizeMipmaps(void);
|
||||
void SetAddressModeR(GLEnum);
|
||||
void SetAddressModeS(GLEnum);
|
||||
void SetAddressModeT(GLEnum);
|
||||
void SetBorderColor(const GLColor4f&);
|
||||
void SetCompareMode(GLEnum);
|
||||
void SetMagFilterMode(GLEnum);
|
||||
void SetMaxAnisotropy(int32_t);
|
||||
void SetMinFilterMode(GLEnum);
|
||||
void SetupTexture(void);
|
||||
void Unbind(GLSDLDevice*, uint32_t); // invented name
|
||||
void Unmap(uint32_t level, GLEnum face);
|
||||
};
|
||||
|
||||
class GLTexture2D : public GLTexture {
|
||||
public:
|
||||
// Static functions
|
||||
static GLTexture2D* Create(uint32_t, uint32_t, uint32_t, GLTextureFormat, uint32_t);
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ReleaseObject();
|
||||
|
||||
// Member functions
|
||||
GLTexture2D();
|
||||
};
|
||||
|
||||
void GLSDLTexSetFlags(CGxTex*, GLTexture*);
|
||||
|
||||
#endif
|
58
src/gx/glsdl/GLTypes.cpp
Normal file
58
src/gx/glsdl/GLTypes.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include <cstring>
|
||||
|
||||
GLColor4f GLColor4f::ZERO = { 0.0, 0.0, 0.0, 0.0 };
|
||||
GLColor4f GLColor4f::WHITE = { 1.0, 1.0, 1.0, 1.0 };
|
||||
GLColor4f GLColor4f::BLACK = { 0.0, 0.0, 0.0, 1.0 };
|
||||
|
||||
bool GLTransform::operator==(const float m[16]) const {
|
||||
return this->m[0] == m[0]
|
||||
&& this->m[1] == m[1]
|
||||
&& this->m[2] == m[2]
|
||||
&& this->m[3] == m[3]
|
||||
&& this->m[4] == m[4]
|
||||
&& this->m[5] == m[5]
|
||||
&& this->m[6] == m[6]
|
||||
&& this->m[7] == m[7]
|
||||
&& this->m[8] == m[8]
|
||||
&& this->m[9] == m[9]
|
||||
&& this->m[10] == m[10]
|
||||
&& this->m[11] == m[11]
|
||||
&& this->m[12] == m[12]
|
||||
&& this->m[13] == m[13]
|
||||
&& this->m[14] == m[14]
|
||||
&& this->m[15] == m[15];
|
||||
}
|
||||
|
||||
bool GLTransform::operator!=(const float m[16]) const {
|
||||
return !(*this == m);
|
||||
}
|
||||
|
||||
void GLTransform::Set(const float m[16]) {
|
||||
memcpy(this->m, m, sizeof(this->m));
|
||||
this->isDirty = true;
|
||||
this->isIdentity = this->a0 == 1.0f
|
||||
&& this->a1 == 0.0f
|
||||
&& this->a2 == 0.0f
|
||||
&& this->a3 == 0.0f
|
||||
&& this->b0 == 0.0f
|
||||
&& this->b1 == 1.0f
|
||||
&& this->b2 == 0.0f
|
||||
&& this->b3 == 0.0f
|
||||
&& this->c0 == 0.0f
|
||||
&& this->c1 == 0.0f
|
||||
&& this->c2 == 1.0f
|
||||
&& this->c3 == 0.0f
|
||||
&& this->d0 == 0.0f
|
||||
&& this->d1 == 0.0f
|
||||
&& this->d2 == 0.0f
|
||||
&& this->d3 == 1.0f;
|
||||
}
|
||||
|
||||
void GLTransform::SetIdentity() {
|
||||
memset(this->m, 0, sizeof(this->m));
|
||||
this->a0 = 1.0f;
|
||||
this->b1 = 1.0f;
|
||||
this->c2 = 1.0f;
|
||||
this->d3 = 1.0f;
|
||||
}
|
376
src/gx/glsdl/GLTypes.hpp
Normal file
376
src/gx/glsdl/GLTypes.hpp
Normal file
@ -0,0 +1,376 @@
|
||||
#ifndef GX_GL_SDL_GL_TYPES_HPP
|
||||
#define GX_GL_SDL_GL_TYPES_HPP
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
class GLBuffer;
|
||||
class GLFramebuffer;
|
||||
|
||||
enum GLTextureFormat {
|
||||
GLTF_INVALID = 0,
|
||||
GLTF_ARGB8888 = 1,
|
||||
GLTF_XRGB8888 = 2,
|
||||
GLTF_RGBA8888 = 3,
|
||||
GLTF_ABGR8888 = 4,
|
||||
GLTF_ARGB0888 = 5,
|
||||
GLTF_RGB888 = 6,
|
||||
GLTF_BGR888 = 7,
|
||||
GLTF_RGBA32F = 8,
|
||||
GLTF_RGBA16F = 9,
|
||||
GLTF_RG16F = 10,
|
||||
GLTF_D32 = 11,
|
||||
GLTF_D24 = 12,
|
||||
GLTF_D16 = 13,
|
||||
GLTF_DF = 14,
|
||||
GLTF_D24S8 = 15,
|
||||
GLTF_S8 = 16,
|
||||
GLTF_ARGB4444 = 17,
|
||||
GLTF_ARGB1555 = 18,
|
||||
GLTF_ARGB0555 = 19,
|
||||
GLTF_RGB565 = 20,
|
||||
GLTF_A2RGB10 = 21,
|
||||
GLTF_RGB16 = 22,
|
||||
GLTF_L8 = 23,
|
||||
GLTF_A8 = 24,
|
||||
GLTF_A8L8 = 25,
|
||||
GLTF_DXT1 = 26,
|
||||
GLTF_DXT3 = 27,
|
||||
GLTF_DXT5 = 28,
|
||||
GLTF_NUM_TEXTURE_FORMATS = 29
|
||||
};
|
||||
|
||||
enum GLVertexType {
|
||||
GLVT_INVALID = 0,
|
||||
GLVT_FLOAT1 = 1,
|
||||
GLVT_FLOAT2 = 2,
|
||||
GLVT_FLOAT3 = 3,
|
||||
GLVT_FLOAT4 = 4,
|
||||
GLVT_UBYTE4 = 5,
|
||||
GLVT_UBYTE4N = 6,
|
||||
GLVT_SHORT = 7,
|
||||
GLVT_SHORT2 = 8,
|
||||
GLVT_SHORT4 = 9,
|
||||
GLVT_SHORT2N = 10,
|
||||
GLVT_SHORT4N = 11,
|
||||
GLVT_USHORT2N = 12,
|
||||
GLVT_USHORT4N = 13,
|
||||
GLVT_NUM_VERTEX_TYPES = 14
|
||||
};
|
||||
|
||||
enum GLBufferType {
|
||||
eGLBT_PIXEL_UNPACK = 3,
|
||||
};
|
||||
|
||||
struct GLAttachPoint {
|
||||
GLFramebuffer* framebuffer;
|
||||
int32_t point; // TODO GLenum?
|
||||
int32_t zOffset; // TODO check type
|
||||
};
|
||||
|
||||
struct GLBox {
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t front;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t depth;
|
||||
};
|
||||
|
||||
struct GLColor4f {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
|
||||
static GLColor4f ZERO;
|
||||
static GLColor4f WHITE;
|
||||
static GLColor4f BLACK;
|
||||
};
|
||||
|
||||
struct GLDirtyRange {
|
||||
uint16_t start;
|
||||
uint16_t end;
|
||||
};
|
||||
|
||||
struct GLfloat4 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
struct GLRect {
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
};
|
||||
|
||||
struct GLTransform {
|
||||
bool isDirty;
|
||||
|
||||
union {
|
||||
struct {
|
||||
float a0;
|
||||
float a1;
|
||||
float a2;
|
||||
float a3;
|
||||
float b0;
|
||||
float b1;
|
||||
float b2;
|
||||
float b3;
|
||||
float c0;
|
||||
float c1;
|
||||
float c2;
|
||||
float c3;
|
||||
float d0;
|
||||
float d1;
|
||||
float d2;
|
||||
float d3;
|
||||
};
|
||||
|
||||
struct {
|
||||
float rows[4][4];
|
||||
};
|
||||
|
||||
float m[16];
|
||||
};
|
||||
|
||||
bool isIdentity;
|
||||
|
||||
bool operator==(const float m[16]) const;
|
||||
bool operator!=(const float m[16]) const;
|
||||
void Set(const float m[16]);
|
||||
void SetIdentity();
|
||||
};
|
||||
|
||||
struct GLStates {
|
||||
struct Depth {
|
||||
bool testEnable;
|
||||
int32_t compareFunc;
|
||||
bool writeMask;
|
||||
};
|
||||
|
||||
struct Stencil {
|
||||
struct StencilFace {
|
||||
int32_t compareFunc;
|
||||
int32_t opFail;
|
||||
int32_t opZFail;
|
||||
int32_t opZPass;
|
||||
};
|
||||
|
||||
bool testEnable;
|
||||
int32_t ref;
|
||||
uint32_t mask;
|
||||
uint32_t writeMask;
|
||||
bool useTwoSidedStencil;
|
||||
StencilFace front;
|
||||
StencilFace back;
|
||||
};
|
||||
|
||||
struct Rasterizer {
|
||||
struct ClipPlane {
|
||||
double plane[4];
|
||||
};
|
||||
|
||||
int32_t cullMode;
|
||||
int32_t cullFaceMode;
|
||||
int32_t fillMode;
|
||||
float constantDepthBias;
|
||||
float slopeScaledDepthBias;
|
||||
GLRect viewport;
|
||||
double zNear;
|
||||
double zFar;
|
||||
bool scissorEnable;
|
||||
GLRect scissor;
|
||||
uint32_t clipPlaneMask;
|
||||
ClipPlane clipPlanes[6];
|
||||
};
|
||||
|
||||
struct Blend {
|
||||
struct ColorMask {
|
||||
bool red;
|
||||
bool green;
|
||||
bool blue;
|
||||
bool alpha;
|
||||
};
|
||||
|
||||
ColorMask colorMask[4];
|
||||
bool alphaBlend;
|
||||
int32_t srcBlendFactor;
|
||||
int32_t destBlendFactor;
|
||||
int32_t blendOp;
|
||||
GLColor4f blendColor;
|
||||
};
|
||||
|
||||
struct Clear {
|
||||
GLColor4f clearColor;
|
||||
double clearDepth;
|
||||
int32_t clearStencil;
|
||||
};
|
||||
|
||||
struct FixedFunc {
|
||||
struct TexOp {
|
||||
int32_t texturing;
|
||||
GLColor4f constant;
|
||||
int32_t colorOp;
|
||||
float colorScale;
|
||||
int32_t colorArg0;
|
||||
int32_t colorArg1;
|
||||
int32_t colorArg2;
|
||||
int32_t alphaOp;
|
||||
float alphaScale;
|
||||
int32_t alphaArg0;
|
||||
int32_t alphaArg1;
|
||||
int32_t alphaArg2;
|
||||
};
|
||||
|
||||
struct Light {
|
||||
bool enable;
|
||||
GLfloat4 position;
|
||||
GLTransform view;
|
||||
float constantAttenuation;
|
||||
float linearAttenuation;
|
||||
float quadraticAttenuation;
|
||||
GLColor4f ambient;
|
||||
GLColor4f diffuse;
|
||||
GLColor4f specular;
|
||||
};
|
||||
|
||||
struct Material {
|
||||
bool colorTracking;
|
||||
int32_t materialSource;
|
||||
GLColor4f ambient;
|
||||
GLColor4f diffuse;
|
||||
GLColor4f specular;
|
||||
float shininess;
|
||||
GLColor4f emission;
|
||||
};
|
||||
|
||||
struct Lighting {
|
||||
bool enable;
|
||||
GLColor4f sceneAmbient;
|
||||
Light lights[8];
|
||||
Material material;
|
||||
};
|
||||
|
||||
struct Transforms {
|
||||
int32_t matrixMode;
|
||||
int32_t modelviewStatus;
|
||||
GLTransform modelView;
|
||||
GLTransform world;
|
||||
GLTransform view;
|
||||
GLTransform projection;
|
||||
GLTransform texture[8];
|
||||
};
|
||||
|
||||
struct TexGen {
|
||||
int32_t S;
|
||||
int32_t T;
|
||||
int32_t R;
|
||||
int32_t Q;
|
||||
};
|
||||
|
||||
struct PointSprite {
|
||||
bool enable;
|
||||
float size;
|
||||
float attenuation[3];
|
||||
float min;
|
||||
float max;
|
||||
};
|
||||
|
||||
bool fogEnable;
|
||||
GLColor4f fogColor;
|
||||
int32_t fogMode;
|
||||
float fogStart;
|
||||
float fogEnd;
|
||||
float fogDensity;
|
||||
bool alphaTestEnable;
|
||||
int32_t alphaTestFunc;
|
||||
float alphaTestRef;
|
||||
TexOp texOp[8];
|
||||
Lighting lighting;
|
||||
Transforms transforms;
|
||||
int32_t texCoordIndex[8];
|
||||
TexGen texGen[8];
|
||||
PointSprite pointSprite;
|
||||
bool normalizeNormal;
|
||||
};
|
||||
|
||||
struct Sampler {
|
||||
float mipmapBias;
|
||||
int32_t addressModeS;
|
||||
int32_t addressModeT;
|
||||
int32_t addressModeR;
|
||||
int32_t magFilterMode;
|
||||
int32_t minFilterMode;
|
||||
float maxAnisotropy;
|
||||
GLColor4f borderColor;
|
||||
};
|
||||
|
||||
struct Shader {
|
||||
bool vertexShaderEnable;
|
||||
GLfloat4 vertexShaderConst[256];
|
||||
bool pixelShaderEnable;
|
||||
GLfloat4 pixelShaderConst[64];
|
||||
};
|
||||
|
||||
struct Binding {
|
||||
uint32_t currentActiveTexture;
|
||||
uint32_t texture[4][16];
|
||||
uint32_t framebuffer;
|
||||
uint32_t renderbuffer;
|
||||
uint32_t vertexProgram;
|
||||
uint32_t pixelProgram;
|
||||
uint32_t glslProgram;
|
||||
uint32_t vertexArrayObject;
|
||||
};
|
||||
|
||||
struct Misc {
|
||||
bool unpackClientStorage;
|
||||
int32_t drawBuffers[4];
|
||||
int32_t readBuffer;
|
||||
};
|
||||
|
||||
struct VertexArrayObject {
|
||||
struct VertexAttrib {
|
||||
bool enable = 0;
|
||||
uint32_t size = 4;
|
||||
int32_t type = GL_FLOAT;
|
||||
bool normalized = 0;
|
||||
uint32_t stride = 0;
|
||||
void* offset = nullptr;
|
||||
GLBuffer* buffer = nullptr;
|
||||
};
|
||||
|
||||
uint32_t buffers[4] = {};
|
||||
VertexAttrib vertexAttribs[16];
|
||||
VertexAttrib position;
|
||||
VertexAttrib normal;
|
||||
VertexAttrib color0;
|
||||
VertexAttrib color1;
|
||||
VertexAttrib texCoord[8];
|
||||
};
|
||||
|
||||
Depth depth;
|
||||
Stencil stencil;
|
||||
Rasterizer rasterizer;
|
||||
Blend blend;
|
||||
Clear clear;
|
||||
FixedFunc fixedFunc;
|
||||
Sampler samplers[16];
|
||||
Shader shader;
|
||||
Binding binding;
|
||||
Misc misc;
|
||||
};
|
||||
|
||||
struct GLVertexAttrib {
|
||||
uint32_t stream;
|
||||
int32_t slot;
|
||||
int32_t type;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
#endif
|
22
src/gx/glsdl/GLUtil.cpp
Normal file
22
src/gx/glsdl/GLUtil.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "gx/glsdl/GLUtil.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
uint32_t GLSDLTextureTypeToIndex(GLEnum textureType) {
|
||||
uint32_t index;
|
||||
|
||||
if (textureType == GL_TEXTURE_2D) {
|
||||
index = 0;
|
||||
} else if (textureType == GL_TEXTURE_3D) {
|
||||
index = 1;
|
||||
} else if (textureType == GL_TEXTURE_CUBE_MAP) {
|
||||
index = 2;
|
||||
} else if (textureType == GL_TEXTURE_RECTANGLE) {
|
||||
index = 3;
|
||||
} else {
|
||||
index = 5;
|
||||
|
||||
BLIZZARD_ASSERT(false);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
9
src/gx/glsdl/GLUtil.hpp
Normal file
9
src/gx/glsdl/GLUtil.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef GX_GL_SDL_GL_UTIL_HPP
|
||||
#define GX_GL_SDL_GL_UTIL_HPP
|
||||
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
uint32_t GLSDLTextureTypeToIndex(GLEnum textureType);
|
||||
|
||||
#endif
|
316
src/gx/glsdl/GLVertexArray.cpp
Normal file
316
src/gx/glsdl/GLVertexArray.cpp
Normal file
@ -0,0 +1,316 @@
|
||||
#include "gx/glsdl/GLVertexArray.hpp"
|
||||
#include "gx/glsdl/GLSDLDevice.hpp"
|
||||
#include <bc/Debug.hpp>
|
||||
|
||||
bool GLVertexArray::s_VertexArrayEnable = false;
|
||||
|
||||
GLVertexArray::GLVertexArray(bool a2) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLVertexArray::FindVertexArray(GLSDLDevice* a1, GLVertexArray& a2) {
|
||||
if (GLVertexArray::s_VertexArrayEnable) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
a2.ApplyVertexFormat(a1);
|
||||
}
|
||||
|
||||
void GLVertexArray::ApplyGLStates(GLStates::VertexArrayObject& vao) {
|
||||
GLSDLDevice* device = GLSDLDevice::Get();
|
||||
|
||||
device->BindVertexArray(this);
|
||||
|
||||
for (int32_t i = 0; i < kMAX_VERTEX_ATTRIBS; i++) {
|
||||
auto& attrib = vao.vertexAttribs[i];
|
||||
|
||||
if (attrib.enable) {
|
||||
glBindBuffer(attrib.buffer->m_Type, attrib.buffer->m_BufferID);
|
||||
|
||||
glVertexAttribPointerARB(
|
||||
i,
|
||||
attrib.size,
|
||||
attrib.type,
|
||||
attrib.normalized,
|
||||
attrib.stride,
|
||||
reinterpret_cast<void*>(attrib.offset)
|
||||
);
|
||||
|
||||
glEnableVertexAttribArrayARB(i);
|
||||
} else {
|
||||
glDisableVertexAttribArrayARB(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (vao.position.enable) {
|
||||
glBindBuffer(vao.position.buffer->m_Type, vao.position.buffer->m_BufferID);
|
||||
glVertexPointer(vao.position.size, vao.position.type, vao.position.stride, vao.position.offset);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
} else {
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
}
|
||||
|
||||
if (vao.normal.enable) {
|
||||
glBindBuffer(vao.normal.buffer->m_Type, vao.normal.buffer->m_BufferID);
|
||||
glNormalPointer(vao.normal.type, vao.normal.stride, vao.normal.offset);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
} else {
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
}
|
||||
|
||||
if (vao.color0.enable) {
|
||||
glBindBuffer(vao.color0.buffer->m_Type, vao.color0.buffer->m_BufferID);
|
||||
glColorPointer(vao.color0.size, vao.color0.type, vao.color0.stride, vao.color0.offset);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
} else {
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (vao.color1.enable) {
|
||||
glBindBuffer(vao.color1.buffer->m_Type, vao.color1.buffer->m_BufferID);
|
||||
glColorPointer(vao.color1.size, vao.color1.type, vao.color1.stride, vao.color1.offset);
|
||||
glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
} else {
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < 8; i++) {
|
||||
glClientActiveTextureARB(GL_TEXTURE0 + i);
|
||||
|
||||
if (vao.texCoord[i].enable) {
|
||||
glBindBuffer(vao.texCoord[i].buffer->m_Type, vao.texCoord[0].buffer->m_BufferID);
|
||||
glTexCoordPointer(vao.texCoord[i].size, vao.texCoord[i].type, vao.texCoord[i].stride, vao.texCoord[i].offset);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
} else {
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vao.buffers[0]);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vao.buffers[1]);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, vao.buffers[2]);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, vao.buffers[3]);
|
||||
|
||||
this->m_GLStates = vao;
|
||||
}
|
||||
|
||||
void GLVertexArray::ApplyVertexFormat(GLSDLDevice* device) {
|
||||
if (GLVertexArray::s_VertexArrayEnable) {
|
||||
device->BindVertexArray(this);
|
||||
}
|
||||
|
||||
auto indexBuffer = this->m_Properties.m_IndexBuffer;
|
||||
uint32_t indexBufferID = indexBuffer ? indexBuffer->m_BufferID : 0;
|
||||
|
||||
if (this->m_GLStates.buffers[1] != indexBufferID) {
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBufferID);
|
||||
this->m_GLStates.buffers[1] = indexBufferID;
|
||||
}
|
||||
|
||||
BLIZZARD_ASSERT(this->GetProperties().m_VertexBufferFormat != nullptr);
|
||||
|
||||
auto& properties = this->GetProperties();
|
||||
bool attribEnable[16] = {};
|
||||
|
||||
bool useVertexShader = device->GetShader(GLShader::eVertexShader) != nullptr;
|
||||
|
||||
for (int32_t index = 0; index < this->GetProperties().m_VertexBufferFormat->m_Size; index++) {
|
||||
BLIZZARD_ASSERT(index < kMAX_VERTEX_ATTRIBS);
|
||||
|
||||
auto& attrib = this->GetProperties().m_VertexBufferFormat->m_Attribs[index];
|
||||
|
||||
BLIZZARD_ASSERT(attrib.type != GLVT_INVALID);
|
||||
BLIZZARD_ASSERT(attrib.type < GLVT_NUM_VERTEX_TYPES);
|
||||
|
||||
auto vertexBuffer = this->GetProperties().m_VertexBuffer[attrib.stream];
|
||||
|
||||
if (useVertexShader || static_cast<uint32_t>(attrib.slot - 1) > 1) {
|
||||
if (this->m_GLStates.buffers[0] != vertexBuffer->m_BufferID) {
|
||||
glBindBuffer(vertexBuffer->m_Type, vertexBuffer->m_BufferID);
|
||||
this->m_GLStates.buffers[0] = vertexBuffer->m_BufferID;
|
||||
}
|
||||
|
||||
attribEnable[attrib.slot] = 1;
|
||||
|
||||
int32_t stride = properties.m_VertexBufferStride[attrib.stream];
|
||||
int32_t offset = attrib.offset
|
||||
+ properties.m_VertexBufferOffset[attrib.stream]
|
||||
+ properties.m_VertexBase * stride;
|
||||
|
||||
if (useVertexShader) {
|
||||
glVertexAttribPointerARB(
|
||||
attrib.slot,
|
||||
k_VertexTypeInfo[attrib.type].m_Size,
|
||||
k_VertexTypeInfo[attrib.type].m_Type,
|
||||
k_VertexTypeInfo[attrib.type].m_Normalized,
|
||||
stride,
|
||||
reinterpret_cast<void*>(offset)
|
||||
);
|
||||
} else {
|
||||
switch (attrib.slot) {
|
||||
case 0: {
|
||||
glVertexPointer(
|
||||
k_VertexTypeInfo[attrib.type].m_Size,
|
||||
k_VertexTypeInfo[attrib.type].m_Type,
|
||||
stride,
|
||||
reinterpret_cast<void*>(offset)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
glNormalPointer(
|
||||
k_VertexTypeInfo[attrib.type].m_Type,
|
||||
stride,
|
||||
reinterpret_cast<void*>(offset)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4: {
|
||||
glColorPointer(
|
||||
k_VertexTypeInfo[attrib.type].m_Size,
|
||||
k_VertexTypeInfo[attrib.type].m_Type,
|
||||
stride,
|
||||
reinterpret_cast<void*>(offset)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: {
|
||||
glSecondaryColorPointer(
|
||||
k_VertexTypeInfo[attrib.type].m_Size,
|
||||
k_VertexTypeInfo[attrib.type].m_Type,
|
||||
stride,
|
||||
reinterpret_cast<void*>(offset)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13: {
|
||||
auto tmu = attrib.slot - 6;
|
||||
auto texCoordIndex = device->m_States.fixedFunc.texCoordIndex[tmu];
|
||||
glClientActiveTextureARB(GL_TEXTURE0 + texCoordIndex);
|
||||
glTexCoordPointer(
|
||||
k_VertexTypeInfo[attrib.type].m_Size,
|
||||
k_VertexTypeInfo[attrib.type].m_Type,
|
||||
stride,
|
||||
reinterpret_cast<void*>(offset)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t s = 0; s < 16; s++) {
|
||||
// Shader
|
||||
if (useVertexShader) {
|
||||
auto prevAttribEnable = &this->m_GLStates.vertexAttribs[s].enable;
|
||||
|
||||
if (*prevAttribEnable != attribEnable[s]) {
|
||||
if (attribEnable[s]) {
|
||||
glEnableVertexAttribArrayARB(s);
|
||||
} else {
|
||||
glDisableVertexAttribArrayARB(s);
|
||||
}
|
||||
}
|
||||
|
||||
*prevAttribEnable = attribEnable[s];
|
||||
|
||||
// FFP
|
||||
} else {
|
||||
bool* prevAttribEnable = nullptr;
|
||||
GLenum glArray = GL_NONE;
|
||||
|
||||
switch (s) {
|
||||
case 0: {
|
||||
prevAttribEnable = &this->m_GLStates.position.enable;
|
||||
glArray = GL_VERTEX_ARRAY;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
prevAttribEnable = &this->m_GLStates.normal.enable;
|
||||
glArray = GL_NORMAL_ARRAY;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4: {
|
||||
prevAttribEnable = &this->m_GLStates.color0.enable;
|
||||
glArray = GL_COLOR_ARRAY;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: {
|
||||
prevAttribEnable = &this->m_GLStates.color1.enable;
|
||||
glArray = GL_SECONDARY_COLOR_ARRAY;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13: {
|
||||
auto tmu = s - 6;
|
||||
auto texCoordIndex = device->m_States.fixedFunc.texCoordIndex[tmu];
|
||||
|
||||
prevAttribEnable = &this->m_GLStates.texCoord[texCoordIndex].enable;
|
||||
glArray = GL_TEXTURE_COORD_ARRAY;
|
||||
|
||||
glClientActiveTextureARB(GL_TEXTURE0 + texCoordIndex);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (prevAttribEnable) {
|
||||
if (*prevAttribEnable != attribEnable[s]) {
|
||||
if (attribEnable[s]) {
|
||||
glEnableClientState(glArray);
|
||||
} else {
|
||||
glDisableClientState(glArray);
|
||||
}
|
||||
}
|
||||
|
||||
*prevAttribEnable = attribEnable[s];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!useVertexShader) {
|
||||
// TODO device->SetColorMaterial(this->m_GLStates.color0.enable);
|
||||
}
|
||||
}
|
||||
|
||||
GLVertexArray::Properties& GLVertexArray::GetProperties() {
|
||||
return this->m_Properties;
|
||||
}
|
||||
|
||||
void GLVertexArray::ReleaseObject() {
|
||||
// TODO
|
||||
}
|
46
src/gx/glsdl/GLVertexArray.hpp
Normal file
46
src/gx/glsdl/GLVertexArray.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef GX_GL_SDL_GL_VERTEX_ARRAY_HPP
|
||||
#define GX_GL_SDL_GL_VERTEX_ARRAY_HPP
|
||||
|
||||
#include "gx/glsdl/GLBuffer.hpp"
|
||||
#include "gx/glsdl/GLObject.hpp"
|
||||
#include "gx/glsdl/GLVertexFormat.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class GLSDLDevice;
|
||||
|
||||
class GLVertexArray : public GLObject {
|
||||
public:
|
||||
// Types
|
||||
struct Properties {
|
||||
GLVertexFormat* m_VertexBufferFormat = nullptr;
|
||||
GLBuffer* m_IndexBuffer = nullptr;
|
||||
GLBuffer* m_PixelPackBuffer = nullptr;
|
||||
GLBuffer* m_PixelUnpackBuffer = nullptr;
|
||||
GLBuffer* m_VertexBuffer[4] = {};
|
||||
uint32_t m_VertexBase = 0;
|
||||
uint32_t m_VertexBufferOffset[4] = {};
|
||||
uint32_t m_VertexBufferStride[4] = {};
|
||||
};
|
||||
|
||||
// Static variables
|
||||
static bool s_VertexArrayEnable;
|
||||
|
||||
// Static functions
|
||||
static void FindVertexArray(GLSDLDevice*, GLVertexArray&);
|
||||
|
||||
// Member variables
|
||||
Properties m_Properties;
|
||||
GLStates::VertexArrayObject m_GLStates;
|
||||
uint32_t m_VertexArrayID = 0;
|
||||
|
||||
// Virtual member functions
|
||||
virtual void ReleaseObject();
|
||||
|
||||
// Member functions
|
||||
GLVertexArray(bool);
|
||||
void ApplyGLStates(GLStates::VertexArrayObject&);
|
||||
void ApplyVertexFormat(GLSDLDevice*);
|
||||
Properties& GetProperties(void);
|
||||
};
|
||||
|
||||
#endif
|
13
src/gx/glsdl/GLVertexFormat.hpp
Normal file
13
src/gx/glsdl/GLVertexFormat.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef GX_GL_SDL_GL_VERTEX_FORMAT_HPP
|
||||
#define GX_GL_SDL_GL_VERTEX_FORMAT_HPP
|
||||
|
||||
#include "gx/glsdl/GLTypes.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
class GLVertexFormat {
|
||||
public:
|
||||
uint32_t m_Size;
|
||||
GLVertexAttrib m_Attribs[16];
|
||||
};
|
||||
|
||||
#endif
|
17
src/gx/glsdl/GLVertexShader.cpp
Normal file
17
src/gx/glsdl/GLVertexShader.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "gx/glsdl/GLVertexShader.hpp"
|
||||
#include "gx/glsdl/GL.hpp"
|
||||
|
||||
GLVertexShader* GLVertexShader::Create() {
|
||||
// TODO
|
||||
// GLPool stuff
|
||||
|
||||
GLVertexShader* shader = new GLVertexShader();
|
||||
|
||||
shader->m_ShaderID = 0;
|
||||
shader->m_RefCount = 1;
|
||||
shader->m_ShaderType = eVertexShader;
|
||||
shader->m_UsingGLSL = 0;
|
||||
shader->var5 = GL_VERTEX_PROGRAM_ARB;
|
||||
|
||||
return shader;
|
||||
}
|
12
src/gx/glsdl/GLVertexShader.hpp
Normal file
12
src/gx/glsdl/GLVertexShader.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef GX_GL_SDL_GL_VERTEX_SHADER_HPP
|
||||
#define GX_GL_SDL_GL_VERTEX_SHADER_HPP
|
||||
|
||||
#include "gx/glsdl/GLShader.hpp"
|
||||
|
||||
class GLVertexShader : public GLShader {
|
||||
public:
|
||||
// Static functions
|
||||
static GLVertexShader* Create(void);
|
||||
};
|
||||
|
||||
#endif
|
10
vendor/CMakeLists.txt
vendored
10
vendor/CMakeLists.txt
vendored
@ -1,6 +1,16 @@
|
||||
add_subdirectory(freetype-2.0.9)
|
||||
add_subdirectory(lua-5.1.3)
|
||||
|
||||
if (WHOA_SYSTEM_WIN OR WHOA_SYSTEM_LINUX)
|
||||
set(SDL_SHARED OFF)
|
||||
set(SDL_STATIC ON)
|
||||
add_subdirectory(sdl-3.0.0)
|
||||
|
||||
set(glew-cmake_BUILD_SHARED OFF)
|
||||
set(glew-cmake_BUILD_STATIC ON)
|
||||
add_subdirectory(glew-cmake-2.2.0)
|
||||
endif()
|
||||
|
||||
# FMOD Ex
|
||||
set(FMODEX_DIR "./fmodex-4.32.09")
|
||||
add_library(fmodex SHARED IMPORTED)
|
||||
|
6
vendor/glew-cmake-2.2.0/.gitattributes
vendored
Normal file
6
vendor/glew-cmake-2.2.0/.gitattributes
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
* text eol=lf
|
||||
*.png binary
|
||||
*.pdf binary
|
||||
build/*/* text eol=crlf
|
||||
CMakeLists.txt text eol=lf
|
||||
build/cmake/* text eol=lf
|
217
vendor/glew-cmake-2.2.0/.github/workflows/cmake.yml
vendored
Normal file
217
vendor/glew-cmake-2.2.0/.github/workflows/cmake.yml
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
name: CMake
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: apt update && DEBIAN_FRONTEND=noninteractive apt install -y cmake gcc g++ libglu1-mesa-dev pkg-config libx11-dev libxext-dev
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: |
|
||||
mkdir build_test
|
||||
mkdir from_installed
|
||||
mkdir pkg-config
|
||||
mkdir as_subdirectory
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: build_test
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build test
|
||||
working-directory: build_test
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $BUILD_TYPE
|
||||
|
||||
- name: Install test
|
||||
shell: bash
|
||||
working-directory: from_installed
|
||||
run: |
|
||||
mkdir -p ext_project/build
|
||||
cp $GITHUB_WORKSPACE/src/glewinfo.c ext_project/
|
||||
cmake $GITHUB_WORKSPACE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/glew-root-cmake
|
||||
cmake --build . --target install
|
||||
|
||||
cd ext_project
|
||||
cp $GITHUB_WORKSPACE/glew-cmake/cmake-install-test.cmake CMakeLists.txt
|
||||
cmake -DCMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/glew-root-cmake/ .
|
||||
cmake --build .
|
||||
|
||||
- name: Package config test
|
||||
shell: bash
|
||||
working-directory: pkg-config
|
||||
run: |
|
||||
mkdir -p ext_project
|
||||
cp $GITHUB_WORKSPACE/src/glewinfo.c ext_project/
|
||||
cmake $GITHUB_WORKSPACE -DPKG_CONFIG_REPRESENTATIVE_TARGET=libglew_static -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/glew-root-pkg-config
|
||||
cmake --build . --target install
|
||||
|
||||
cd ext_project
|
||||
gcc $GITHUB_WORKSPACE/src/glewinfo.c $(PKG_CONFIG_PATH=$GITHUB_WORKSPACE/glew-root-pkg-config/lib/pkgconfig pkg-config --libs --cflags glew) -o glewinfo
|
||||
|
||||
- name: Subdirectory test
|
||||
shell: bash
|
||||
working-directory: as_subdirectory
|
||||
run: |
|
||||
cp $GITHUB_WORKSPACE/src/glewinfo.c ./
|
||||
cp $GITHUB_WORKSPACE/glew-cmake/sub-directory-test.cmake CMakeLists.txt
|
||||
cmake .
|
||||
cmake --build .
|
||||
|
||||
build_2_8:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:14.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: apt update && apt install -y cmake gcc libgl1-mesa-dev libx11-dev libxext-dev
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build test
|
||||
shell: bash
|
||||
run: cmake --build .
|
||||
|
||||
- name: Check alias
|
||||
shell: bash
|
||||
run: test -e lib/libGLEW.a
|
||||
|
||||
build_3_10:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: apt update && apt install -y cmake gcc libgl1-mesa-dev libx11-dev libxext-dev
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build test
|
||||
shell: bash
|
||||
run: cmake --build .
|
||||
|
||||
- name: Check alias
|
||||
shell: bash
|
||||
run: test -e lib/libGLEW.a
|
||||
|
||||
build_latest:
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: apt update && apt install -y python3 python3-pip gcc libgl1-mesa-dev libx11-dev libxext-dev && pip install cmake
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build test
|
||||
shell: bash
|
||||
run: cmake --build .
|
||||
|
||||
- name: Check alias
|
||||
shell: bash
|
||||
run: test -e lib/libGLEW.a
|
||||
|
||||
build_mingw:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: apt update && apt install -y cmake g++-mingw-w64-x86-64 make libgl1-mesa-dev libx11-dev libxext-dev
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/glew-cmake/mingw.cmake"
|
||||
|
||||
- name: Build test
|
||||
shell: bash
|
||||
run: cmake --build .
|
||||
|
||||
|
||||
build_mac:
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build test
|
||||
shell: bash
|
||||
run: cmake --build .
|
||||
|
||||
build_windows:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: cmake . -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build test
|
||||
shell: bash
|
||||
run: cmake --build .
|
25
vendor/glew-cmake-2.2.0/.gitignore
vendored
Normal file
25
vendor/glew-cmake-2.2.0/.gitignore
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
*.pc
|
||||
/src/*.c
|
||||
/include/GL/*.h
|
||||
/build/vc6/*.rc
|
||||
/build/*.rc
|
||||
/build/*/*.sdf
|
||||
/build/*/*.suo
|
||||
/build/*/*.db
|
||||
/build/*/*.vcxproj.user
|
||||
/build/*/.vs/
|
||||
/build/*/tmp/
|
||||
/build/cmake/CMakeFiles/
|
||||
/build/cmake/CMakeCache.txt
|
||||
/build/cmake/cmake_install.cmake
|
||||
/build/cmake/Makefile
|
||||
/auto/extensions
|
||||
/auto/registry
|
||||
/bin
|
||||
/lib
|
||||
/tmp
|
||||
/out
|
||||
.DS_Store*
|
||||
auto/EGL-Registry
|
||||
auto/OpenGL-Registry
|
||||
auto/glfixes
|
12
vendor/glew-cmake-2.2.0/.lgtm.yml
vendored
Normal file
12
vendor/glew-cmake-2.2.0/.lgtm.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
extraction:
|
||||
cpp:
|
||||
prepare:
|
||||
packages:
|
||||
- "build-essential"
|
||||
- "libxmu-dev"
|
||||
- "libxi-dev"
|
||||
- "libgl-dev"
|
||||
index:
|
||||
build_command:
|
||||
- "cd auto; make all -j8; cd .."
|
||||
- "make all -j8"
|
27
vendor/glew-cmake-2.2.0/.travis.yml
vendored
Normal file
27
vendor/glew-cmake-2.2.0/.travis.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
language: cpp
|
||||
dist: trusty
|
||||
install:
|
||||
script:
|
||||
- make -C auto clobber
|
||||
- make extensions
|
||||
- make dist-src
|
||||
- make clean && SYSTEM=linux make
|
||||
- make clean && SYSTEM=linux-osmesa make
|
||||
- make clean && SYSTEM=linux-egl make
|
||||
- make clean && SYSTEM=linux-clang make
|
||||
- make clean && SYSTEM=linux-clang-egl make
|
||||
- pushd build/cmake && git clean -xdf . && cmake -G 'Unix Makefiles' . && make && popd
|
||||
- pushd build/cmake && git clean -xdf . && cmake -G 'Unix Makefiles' -DGLEW_OSMESA=ON . && make && popd
|
||||
- pushd build/cmake && git clean -xdf . && cmake -G 'Unix Makefiles' -DGLEW_EGL=ON -DGLEW_X11=OFF . && make && popd
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- git
|
||||
- cmake
|
||||
- dos2unix
|
||||
- libosmesa6-dev
|
||||
- libegl1-mesa-dev
|
||||
artifacts:
|
||||
paths:
|
||||
- $(ls *.zip *.tgz | tr "\n" ":")
|
||||
- $(find doc -type f | tr "\n" ":")
|
287
vendor/glew-cmake-2.2.0/CMakeLists.txt
vendored
Normal file
287
vendor/glew-cmake-2.2.0/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,287 @@
|
||||
cmake_minimum_required(VERSION 2.8.12...3.5)
|
||||
|
||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_MAJOR_STRING REGEX "GLEW_MAJOR[ ]*=[ ]*[0-9]+.*")
|
||||
string(REGEX REPLACE "GLEW_MAJOR[ ]*=[ ]*([0-9]+)" "\\1" MAJOR_VERSION ${_VERSION_MAJOR_STRING})
|
||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_MINOR_STRING REGEX "GLEW_MINOR[ ]*=[ ]*[0-9]+.*")
|
||||
string(REGEX REPLACE "GLEW_MINOR[ ]*=[ ]*([0-9]+)" "\\1" MINOR_VERSION ${_VERSION_MINOR_STRING})
|
||||
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[ ]*=[ ]*[0-9]+.*")
|
||||
string(REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" PATCH_VERSION ${_VERSION_PATCH_STRING})
|
||||
set(GLEW_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
project("glew" VERSION ${GLEW_VERSION} LANGUAGES C)
|
||||
else()
|
||||
project("glew" C)
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${MAJOR_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${MAJOR_VERSION})
|
||||
endif()
|
||||
|
||||
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set(INCLUDE_DIR "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>$<INSTALL_INTERFACE:include>")
|
||||
set(RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||
|
||||
include("GeneratePkgConfig.cmake")
|
||||
|
||||
if (POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
|
||||
option(glew-cmake_BUILD_SHARED "Build the shared glew library" ON)
|
||||
option(glew-cmake_BUILD_STATIC "Build the static glew library" ON)
|
||||
option(USE_GLU "Use GLU" OFF)
|
||||
option(GLEW_OSMESA "Off-screen Mesa mode" OFF)
|
||||
option(PKG_CONFIG_REPRESENTATIVE_TARGET "Generate pc file for specified target as glew. libglew_static|libglew_shared" OFF)
|
||||
option(ONLY_LIBS "Do not build executables" OFF)
|
||||
|
||||
set(LIBGLEW_SRCS ${SRC_DIR}/glew.c)
|
||||
|
||||
set(DEFINITIONS)
|
||||
if(WIN32)
|
||||
list(APPEND DEFINITIONS -DWIN32_MEAN_AND_LEAN -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
list(APPEND LIBGLEW_SRCS ${RC_DIR}/glew.rc)
|
||||
endif()
|
||||
|
||||
# Use namespaced libraries when supported
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.14)
|
||||
set(USE_NAMESPACED_LIB YES)
|
||||
else()
|
||||
set(USE_NAMESPACED_LIB NO)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0028)
|
||||
cmake_policy(SET CMP0028 NEW)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0072)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
endif()
|
||||
|
||||
if(NOT (WIN32 OR APPLE))
|
||||
message("Try to find OpenGL with GLVND")
|
||||
find_package(OpenGL REQUIRED
|
||||
COMPONENTS OpenGL GLX)
|
||||
endif()
|
||||
|
||||
if(OPENGL_FOUND AND OpenGL_GLX_FOUND AND TARGET OpenGL::OpenGL)
|
||||
set(USE_GLVND YES)
|
||||
else()
|
||||
message("GLVND not supported. Try find OpenGL legacy")
|
||||
find_package(OpenGL REQUIRED)
|
||||
set(USE_GLVND NO)
|
||||
endif()
|
||||
|
||||
set(pc_requires)
|
||||
|
||||
if(NOT USE_GLU)
|
||||
list(APPEND DEFINITIONS -DGLEW_NO_GLU)
|
||||
else()
|
||||
if(NOT OPENGL_GLU_FOUND)
|
||||
message(FATAL_ERROR "GLU is not found. but GLU option is enabled")
|
||||
endif()
|
||||
|
||||
list(APPEND pc_requires glu)
|
||||
|
||||
if(USE_NAMESPACED_LIB)
|
||||
list(APPEND LIBRARIES OpenGL::GLU)
|
||||
else()
|
||||
list(APPEND LIBRARIES ${OPENGL_glu_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND pc_requires gl)
|
||||
if(USE_NAMESPACED_LIB)
|
||||
if(USE_GLVND)
|
||||
list(APPEND LIBRARIES OpenGL::OpenGL)
|
||||
else()
|
||||
list(APPEND LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
else()
|
||||
if(USE_GLVND)
|
||||
list(APPEND LIBRARIES ${OPENGL_opengl_LIBRARY})
|
||||
else()
|
||||
list(APPEND LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OS Specific dependencies
|
||||
if(APPLE)
|
||||
find_library(AGL_LIBRARY AGL REQUIRED)
|
||||
list(APPEND LIBRARIES ${AGL_LIBRARY})
|
||||
elseif(NOT WIN32)
|
||||
if(GLEW_OSMESA)
|
||||
find_library(OSMESA_LIBRARY OSMesa REQUIRED)
|
||||
list(APPEND LIBRARIES ${OSMESA_LIBRARY})
|
||||
list(APPEND DEFINITIONS -DGLEW_OSMESA)
|
||||
list(APPEND pc_requires osmesa)
|
||||
else()
|
||||
if(USE_GLVND)
|
||||
if(NOT OpenGL_GLX_FOUND)
|
||||
message(FATAL_ERROR "GLX is not found. Try with PREFER_GLVND=NO")
|
||||
endif()
|
||||
|
||||
if(USE_NAMESPACED_LIB)
|
||||
list(APPEND LIBRARIES OpenGL::GLX)
|
||||
else()
|
||||
list(APPEND LIBRARIES ${OPENGL_glx_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
list(APPEND pc_requires x11 xext)
|
||||
if(USE_NAMESPACED_LIB)
|
||||
list(APPEND LIBRARIES X11::X11 X11::Xext)
|
||||
else()
|
||||
list(APPEND LIBRARIES ${X11_X11_LIB} ${X11_Xext_LIB})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(GLEW_TARGETS)
|
||||
|
||||
if(NOT CMAKE_INSTALL_LIBDIR)
|
||||
set(INSTALL_LIBDIR lib)
|
||||
else()
|
||||
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/test_fs_support_case_sensitivity
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/test_fs_support_CASE_sensitivity)
|
||||
file(GLOB TEST_FILE_LIST ${CMAKE_BINARY_DIR}/test_fs_support_*_sensitivity)
|
||||
list(LENGTH TEST_FILE_LIST TEST_FILE_COUNT)
|
||||
if(TEST_FILE_COUNT EQUAL 2)
|
||||
set(SUPPORT_CASE_SENSITIVE_FS YES)
|
||||
else()
|
||||
set(SUPPORT_CASE_SENSITIVE_FS NO)
|
||||
endif()
|
||||
|
||||
function(set_representative_target TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
OUTPUT_NAME "glew"
|
||||
DEBUG_POSTFIX d)
|
||||
|
||||
# Windows & macOS use case-insensetive FS. do not create symbolic link
|
||||
if(SUPPORT_CASE_SENSITIVE_FS)
|
||||
get_target_property(TARGET_TYPE ${TARGET} TYPE)
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
|
||||
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug" AND NOT ANDROID)
|
||||
set(GLEW_DEBUG_SUFFIX "d")
|
||||
else()
|
||||
set(GLEW_DEBUG_SUFFIX "")
|
||||
endif()
|
||||
if(TARGET_TYPE STREQUAL STATIC_LIBRARY)
|
||||
set(EXT ".a")
|
||||
get_target_property(OUT_DIR ${TARGET} ARCHIVE_OUTPUT_DIRECTORY)
|
||||
else()
|
||||
set(EXT ".so")
|
||||
get_target_property(OUT_DIR ${TARGET} LIBRARY_OUTPUT_DIRECTORY)
|
||||
endif()
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS 3.0)
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink libglew${GLEW_DEBUG_SUFFIX}${EXT} libGLEW${GLEW_DEBUG_SUFFIX}${EXT}
|
||||
WORKING_DIRECTORY ${OUT_DIR}
|
||||
BYPRODUCTS ${OUT_DIR}/libGLEW${GLEW_DEBUG_SUFFIX}${EXT}
|
||||
COMMENT "create libGLEW${GLEW_DEBUG_SUFFIX} symbolic link")
|
||||
else()
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND bash ARGS -c "( test ! -e ${OUT_DIR}/libGLEW${GLEW_DEBUG_SUFFIX}${EXT} && cd ${OUT_DIR} && ${CMAKE_COMMAND} -E create_symlink libglew${GLEW_DEBUG_SUFFIX}${EXT} libGLEW${GLEW_DEBUG_SUFFIX}${EXT} ) || true"
|
||||
COMMENT "create libGLEW${GLEW_DEBUG_SUFFIX} symbolic link"
|
||||
VERBATIM)
|
||||
endif()
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS 3.14)
|
||||
install(FILES ${OUT_DIR}/libGLEW${GLEW_DEBUG_SUFFIX}${EXT} TYPE LIB)
|
||||
else()
|
||||
install(FILES ${OUT_DIR}/libGLEW${GLEW_DEBUG_SUFFIX}${EXT} DESTINATION ${INSTALL_LIBDIR})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(glew-cmake_BUILD_STATIC)
|
||||
add_library(libglew_static STATIC ${LIBGLEW_SRCS})
|
||||
|
||||
set_representative_target(libglew_static)
|
||||
|
||||
target_compile_definitions(libglew_static PUBLIC GLEW_STATIC)
|
||||
list(APPEND GLEW_TARGETS libglew_static)
|
||||
endif()
|
||||
|
||||
if(glew-cmake_BUILD_SHARED)
|
||||
add_library(libglew_shared SHARED ${LIBGLEW_SRCS})
|
||||
|
||||
if(glew-cmake_BUILD_STATIC)
|
||||
set_target_properties(libglew_shared PROPERTIES
|
||||
OUTPUT_NAME "glew-shared"
|
||||
DEBUG_POSTFIX d)
|
||||
else()
|
||||
set_representative_target(libglew_shared)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(libglew_shared PRIVATE GLEW_BUILD)
|
||||
if(MINGW)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
|
||||
target_link_options(libglew_shared PRIVATE -nostdlib)
|
||||
else()
|
||||
target_link_libraries(libglew_shared PRIVATE -nostdlib)
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND GLEW_TARGETS libglew_shared)
|
||||
endif()
|
||||
|
||||
foreach(GLEW_TARGET ${GLEW_TARGETS})
|
||||
target_compile_definitions(${GLEW_TARGET} PUBLIC ${DEFINITIONS})
|
||||
target_include_directories(${GLEW_TARGET} PUBLIC ${INCLUDE_DIR})
|
||||
target_link_libraries(${GLEW_TARGET} PUBLIC ${LIBRARIES})
|
||||
set_target_properties(${GLEW_TARGET} PROPERTIES VERSION ${GLEW_VERSION})
|
||||
endforeach()
|
||||
|
||||
if(PKG_CONFIG_REPRESENTATIVE_TARGET)
|
||||
GeneratePkgConfigFile(${PKG_CONFIG_REPRESENTATIVE_TARGET} "The OpenGL Extension Wrangler library"
|
||||
NAME "glew"
|
||||
LIBRARY_DIR ${INSTALL_LIBDIR}
|
||||
REQUIRES ${pc_requires})
|
||||
endif()
|
||||
|
||||
install(TARGETS ${GLEW_TARGETS} EXPORT glew-cmake
|
||||
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${INSTALL_LIBDIR})
|
||||
install(EXPORT glew-cmake DESTINATION ${INSTALL_LIBDIR}/cmake/glew FILE glewConfig.cmake)
|
||||
|
||||
file(GLOB PUBLIC_HEADERS "include/GL/*.h")
|
||||
install(FILES ${PUBLIC_HEADERS} DESTINATION include/GL/)
|
||||
|
||||
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR} AND NOT ONLY_LIBS)
|
||||
set(GLEWINFO_SRCS ${SRC_DIR}/glewinfo.c)
|
||||
set(VISUALINFO_SRCS ${SRC_DIR}/visualinfo.c)
|
||||
if(MSVS)
|
||||
list(APPEND GLEWINFO_SRCS ${RC_DIR}/glewinfo.rc)
|
||||
list(APPEND VISUALINFO_SRCS ${RC_DIR}/visualinfo.rc)
|
||||
endif()
|
||||
|
||||
add_executable(glewinfo ${GLEWINFO_SRCS})
|
||||
add_executable(visualinfo ${VISUALINFO_SRCS})
|
||||
|
||||
if(glew-cmake_BUILD_STATIC)
|
||||
target_link_libraries(glewinfo libglew_static)
|
||||
target_link_libraries(visualinfo libglew_static)
|
||||
else()
|
||||
target_link_libraries(glewinfo libglew_shared)
|
||||
target_link_libraries(visualinfo libglew_shared)
|
||||
endif()
|
||||
|
||||
install(TARGETS glewinfo visualinfo DESTINATION bin)
|
||||
endif()
|
62
vendor/glew-cmake-2.2.0/GeneratePkgConfig.cmake
vendored
Normal file
62
vendor/glew-cmake-2.2.0/GeneratePkgConfig.cmake
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
function(GeneratePkgConfigFile target description)
|
||||
cmake_parse_arguments(pc "" "NAME;LIBRARY_DIR" "REQUIRES" ${ARGV})
|
||||
if(NOT pc_LIBRARY_DIR)
|
||||
set(pc_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
if(WIN32)
|
||||
set(PKGCONFIG_INSTALL_DIR)
|
||||
else()
|
||||
set(PKGCONFIG_INSTALL_DIR ${pc_LIBRARY_DIR}/pkgconfig)
|
||||
endif()
|
||||
if(NOT pc_NAME)
|
||||
set(pc_NAME ${target})
|
||||
endif()
|
||||
|
||||
get_property(raw_definitions TARGET ${target} PROPERTY INTERFACE_COMPILE_DEFINITIONS)
|
||||
set(definitions "")
|
||||
foreach(def IN LISTS raw_definitions)
|
||||
if(def MATCHES "-D")
|
||||
list(APPEND definitions ${def})
|
||||
else()
|
||||
list(APPEND definitions "-D${def}")
|
||||
endif()
|
||||
endforeach()
|
||||
list(JOIN definitions " " definitions)
|
||||
|
||||
get_property(target_output TARGET ${target} PROPERTY OUTPUT_NAME)
|
||||
get_filename_component(target_output ${target_output} NAME)
|
||||
set(links "-l${target_output}")
|
||||
get_property(raw_links TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||
foreach(link IN LISTS raw_links)
|
||||
if(link MATCHES "-l")
|
||||
list(APPEND links ${link})
|
||||
elseif(TARGET ${link})
|
||||
get_property(is_imported TARGET ${link} PROPERTY IMPORTED)
|
||||
if(NOT is_imported)
|
||||
get_property(link_target TARGET ${link} PROPERTY OUTPUT_NAME)
|
||||
list(APPEND links ${link_target})
|
||||
endif()
|
||||
else()
|
||||
list(APPEND links "-l${link}")
|
||||
endif()
|
||||
endforeach()
|
||||
list(JOIN links " " links)
|
||||
get_property(version TARGET ${target} PROPERTY VERSION)
|
||||
|
||||
set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${pc_NAME}.pc")
|
||||
file(WRITE ${out_file} "prefix=${CMAKE_INSTALL_PREFIX}\n")
|
||||
file(APPEND ${out_file} "exec_prefix=\${prefix}\n")
|
||||
file(APPEND ${out_file} "libdir=\${prefix}/${pc_LIBRARY_DIR}\n")
|
||||
file(APPEND ${out_file} "includedir=\${prefix}/include\n")
|
||||
file(APPEND ${out_file} "\n")
|
||||
file(APPEND ${out_file} "Name: ${pc_NAME}\n")
|
||||
file(APPEND ${out_file} "Description: ${description}\n")
|
||||
file(APPEND ${out_file} "Version: ${version}\n")
|
||||
file(APPEND ${out_file} "Cflags: -I\${includedir} ${definitions}\n")
|
||||
file(APPEND ${out_file} "Libs: -L\${libdir} ${links}\n")
|
||||
if(pc_REQUIRES)
|
||||
string(REPLACE ";" " " REQUIRES "${pc_REQUIRES}")
|
||||
file(APPEND ${out_file} "Requires: ${REQUIRES}")
|
||||
endif()
|
||||
install(FILES ${out_file} DESTINATION "${PKGCONFIG_INSTALL_DIR}")
|
||||
endfunction()
|
73
vendor/glew-cmake-2.2.0/LICENSE.txt
vendored
Normal file
73
vendor/glew-cmake-2.2.0/LICENSE.txt
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
The OpenGL Extension Wrangler Library
|
||||
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
Copyright (C) 2002, Lev Povalahev
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of the author may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Mesa 3-D graphics library
|
||||
Version: 7.0
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Copyright (c) 2007 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
357
vendor/glew-cmake-2.2.0/Makefile
vendored
Normal file
357
vendor/glew-cmake-2.2.0/Makefile
vendored
Normal file
@ -0,0 +1,357 @@
|
||||
#!gmake
|
||||
## The OpenGL Extension Wrangler Library
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002, Lev Povalahev
|
||||
## All rights reserved.
|
||||
##
|
||||
## Redistribution and use in source and binary forms, with or without
|
||||
## modification, are permitted provided that the following conditions are met:
|
||||
##
|
||||
## * Redistributions of source code must retain the above copyright notice,
|
||||
## this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright notice,
|
||||
## this list of conditions and the following disclaimer in the documentation
|
||||
## and/or other materials provided with the distribution.
|
||||
## * The name of the author may be used to endorse or promote products
|
||||
## derived from this software without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
## THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include config/version
|
||||
|
||||
SHELL = /bin/sh
|
||||
SYSTEM ?= $(shell config/config.guess | cut -d - -f 3 | sed -e 's/[0-9\.]//g;')
|
||||
SYSTEM.SUPPORTED = $(shell test -f config/Makefile.$(SYSTEM) && echo 1)
|
||||
|
||||
ifeq ($(SYSTEM.SUPPORTED), 1)
|
||||
include config/Makefile.$(SYSTEM)
|
||||
else
|
||||
$(error "Platform '$(SYSTEM)' not supported")
|
||||
endif
|
||||
|
||||
GLEW_PREFIX ?= /usr/local
|
||||
GLEW_DEST ?= /usr/local
|
||||
BINDIR ?= $(GLEW_DEST)/bin
|
||||
LIBDIR ?= $(GLEW_DEST)/lib
|
||||
INCDIR ?= $(GLEW_DEST)/include/GL
|
||||
PKGDIR ?= $(GLEW_DEST)/lib/pkgconfig
|
||||
|
||||
ifneq ($(GLEW_NO_GLU), -DGLEW_NO_GLU)
|
||||
LIBGLU = glu
|
||||
endif
|
||||
|
||||
DIST_NAME ?= glew-$(GLEW_VERSION)
|
||||
DIST_SRC_ZIP ?= $(shell pwd)/$(DIST_NAME).zip
|
||||
DIST_SRC_TGZ ?= $(shell pwd)/$(DIST_NAME).tgz
|
||||
DIST_WIN32 ?= $(shell pwd)/$(DIST_NAME)-win32.zip
|
||||
|
||||
DIST_DIR := $(shell mktemp -d /tmp/glew.XXXXXX)/$(DIST_NAME)
|
||||
|
||||
# To disable stripping of linked binaries either:
|
||||
# - use STRIP= on gmake command-line
|
||||
# - edit this makefile to set STRIP to the empty string
|
||||
#
|
||||
# To disable symlinks:
|
||||
# - use LN= on gmake command-line
|
||||
|
||||
AR ?= ar
|
||||
ARFLAGS ?= cr
|
||||
INSTALL ?= install
|
||||
STRIP ?= strip
|
||||
RM ?= rm -f
|
||||
LN ?= ln -sf
|
||||
UNIX2DOS ?= unix2dos -q
|
||||
DOS2UNIX ?= dos2unix -q
|
||||
|
||||
ifneq (,$(filter debug,$(MAKECMDGOALS)))
|
||||
OPT = -g
|
||||
STRIP :=
|
||||
else
|
||||
OPT = $(POPT)
|
||||
endif
|
||||
INCLUDE = -Iinclude
|
||||
CFLAGS = $(OPT) $(WARN) $(INCLUDE) $(CFLAGS.EXTRA)
|
||||
|
||||
all debug: glew.lib glew.bin
|
||||
|
||||
# GLEW shared and static libraries
|
||||
|
||||
LIB.LDFLAGS := $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||
LIB.LIBS := $(GL_LDFLAGS)
|
||||
LIB.SHARED.DIR ?= lib
|
||||
|
||||
LIB.SRCS := src/glew.c
|
||||
LIB.SRCS.NAMES := $(notdir $(LIB.SRCS))
|
||||
|
||||
LIB.OBJS := $(addprefix tmp/$(SYSTEM)/default/static/,$(LIB.SRCS.NAMES))
|
||||
LIB.OBJS := $(LIB.OBJS:.c=.o)
|
||||
LIB.SOBJS := $(addprefix tmp/$(SYSTEM)/default/shared/,$(LIB.SRCS.NAMES))
|
||||
LIB.SOBJS := $(LIB.SOBJS:.c=.o)
|
||||
|
||||
glew.lib: glew.lib.shared glew.lib.static
|
||||
|
||||
glew.lib.shared: lib $(LIB.SHARED.DIR) $(LIB.SHARED.DIR)/$(LIB.SHARED) glew.pc
|
||||
glew.lib.static: lib lib/$(LIB.STATIC) glew.pc
|
||||
|
||||
.PHONY: glew.lib glew.lib.shared glew.lib.static
|
||||
|
||||
lib:
|
||||
mkdir lib
|
||||
|
||||
lib/$(LIB.STATIC): $(LIB.OBJS)
|
||||
ifneq ($(AR),)
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
else ifneq ($(LIBTOOL),)
|
||||
$(LIBTOOL) $@ $^
|
||||
endif
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
$(LIB.SHARED.DIR)/$(LIB.SHARED): $(LIB.SOBJS)
|
||||
$(LD) $(LDFLAGS.SO) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS)
|
||||
ifneq ($(LN),)
|
||||
$(LN) $(LIB.SHARED) $(LIB.SHARED.DIR)/$(LIB.SONAME)
|
||||
$(LN) $(LIB.SHARED) $(LIB.SHARED.DIR)/$(LIB.DEVLNK)
|
||||
endif
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
tmp/$(SYSTEM)/default/static/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_STATIC $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/default/shared/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_BUILD $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
# Force re-write of glew.pc, GLEW_DEST can vary
|
||||
|
||||
.PHONY: glew.pc
|
||||
|
||||
glew.pc: glew.pc.in
|
||||
sed \
|
||||
-e "s|@prefix@|$(GLEW_PREFIX)|g" \
|
||||
-e "s|@libdir@|$(LIBDIR)|g" \
|
||||
-e "s|@exec_prefix@|$(BINDIR)|g" \
|
||||
-e "s|@includedir@|$(INCDIR)|g" \
|
||||
-e "s|@version@|$(GLEW_VERSION)|g" \
|
||||
-e "s|@cflags@||g" \
|
||||
-e "s|@libname@|$(NAME)|g" \
|
||||
-e "s|@libgl@|$(LDFLAGS.GL)|g" \
|
||||
-e "s|@requireslib@|$(LIBGLU)|g" \
|
||||
< $< > $@
|
||||
|
||||
# GLEW utility programs
|
||||
|
||||
BIN.LIBS = -Llib $(LDFLAGS.DYNAMIC) -l$(NAME) $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||
|
||||
GLEWINFO.BIN := glewinfo$(BIN.SUFFIX)
|
||||
GLEWINFO.BIN.SRC := src/glewinfo.c
|
||||
GLEWINFO.BIN.OBJ := $(addprefix tmp/$(SYSTEM)/default/shared/,$(notdir $(GLEWINFO.BIN.SRC)))
|
||||
GLEWINFO.BIN.OBJ := $(GLEWINFO.BIN.OBJ:.c=.o)
|
||||
|
||||
VISUALINFO.BIN := visualinfo$(BIN.SUFFIX)
|
||||
VISUALINFO.BIN.SRC := src/visualinfo.c
|
||||
VISUALINFO.BIN.OBJ := $(addprefix tmp/$(SYSTEM)/default/shared/,$(notdir $(VISUALINFO.BIN.SRC)))
|
||||
VISUALINFO.BIN.OBJ := $(VISUALINFO.BIN.OBJ:.c=.o)
|
||||
|
||||
# Don't build glewinfo or visualinfo for NaCL, yet.
|
||||
|
||||
ifneq ($(filter nacl%,$(SYSTEM)),)
|
||||
glew.bin: glew.lib
|
||||
else
|
||||
glew.bin: glew.lib bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN)
|
||||
endif
|
||||
|
||||
bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJ) $(BIN.LIBS)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJ) $(BIN.LIBS)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
$(GLEWINFO.BIN.OBJ): $(GLEWINFO.BIN.SRC) include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
$(VISUALINFO.BIN.OBJ): $(VISUALINFO.BIN.SRC) include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
# Install targets
|
||||
|
||||
install.all: install install.bin
|
||||
|
||||
install: install.include install.lib install.pkgconfig
|
||||
|
||||
install.lib: glew.lib
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(LIBDIR)"
|
||||
# runtime
|
||||
ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(BINDIR)"
|
||||
$(INSTALL) -m 0755 $(LIB.SHARED.DIR)/$(LIB.SHARED) "$(DESTDIR)$(BINDIR)/"
|
||||
else
|
||||
$(INSTALL) -m 0644 $(LIB.SHARED.DIR)/$(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/"
|
||||
endif
|
||||
ifneq ($(LN),)
|
||||
$(LN) $(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/$(LIB.SONAME)"
|
||||
endif
|
||||
|
||||
# development files
|
||||
ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
$(INSTALL) -m 0644 lib/$(LIB.DEVLNK) "$(DESTDIR)$(LIBDIR)/"
|
||||
endif
|
||||
ifneq ($(LN),)
|
||||
$(LN) $(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/$(LIB.DEVLNK)"
|
||||
endif
|
||||
$(INSTALL) -m 0644 lib/$(LIB.STATIC) "$(DESTDIR)$(LIBDIR)/"
|
||||
|
||||
install.bin: glew.bin
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(BINDIR)"
|
||||
$(INSTALL) -m 0755 bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) "$(DESTDIR)$(BINDIR)/"
|
||||
|
||||
install.include:
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(INCDIR)"
|
||||
$(INSTALL) -m 0644 include/GL/wglew.h "$(DESTDIR)$(INCDIR)/"
|
||||
$(INSTALL) -m 0644 include/GL/glew.h "$(DESTDIR)$(INCDIR)/"
|
||||
$(INSTALL) -m 0644 include/GL/glxew.h "$(DESTDIR)$(INCDIR)/"
|
||||
$(INSTALL) -m 0644 include/GL/eglew.h "$(DESTDIR)$(INCDIR)/"
|
||||
|
||||
install.pkgconfig: glew.pc
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(PKGDIR)"
|
||||
$(INSTALL) -d -m 0755 "$(DESTDIR)$(PKGDIR)"
|
||||
$(INSTALL) -m 0644 glew.pc "$(DESTDIR)$(PKGDIR)/"
|
||||
|
||||
uninstall:
|
||||
$(RM) "$(DESTDIR)$(INCDIR)/wglew.h"
|
||||
$(RM) "$(DESTDIR)$(INCDIR)/glew.h"
|
||||
$(RM) "$(DESTDIR)$(INCDIR)/glxew.h"
|
||||
$(RM) "$(DESTDIR)$(LIBDIR)/$(LIB.DEVLNK)"
|
||||
ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
$(RM) "$(DESTDIR)$(BINDIR)/$(LIB.SHARED)"
|
||||
else
|
||||
$(RM) "$(DESTDIR)$(LIBDIR)/$(LIB.SONAME)"
|
||||
$(RM) "$(DESTDIR)$(LIBDIR)/$(LIB.SHARED)"
|
||||
endif
|
||||
$(RM) "$(DESTDIR)$(LIBDIR)/$(LIB.STATIC)"
|
||||
$(RM) "$(DESTDIR)$(BINDIR)/$(GLEWINFO.BIN)" "$(DESTDIR)$(BINDIR)/$(VISUALINFO.BIN)"
|
||||
|
||||
clean:
|
||||
$(RM) -r tmp/
|
||||
$(RM) -r lib/
|
||||
$(RM) -r bin/
|
||||
$(RM) glew.pc
|
||||
|
||||
distclean: clean
|
||||
find . -name \*~ | xargs $(RM)
|
||||
find . -name .\*.sw\? | xargs $(RM)
|
||||
|
||||
# Distributions
|
||||
|
||||
dist-win32:
|
||||
$(RM) -r $(DIST_DIR)
|
||||
mkdir -p $(DIST_DIR)
|
||||
cp -a include $(DIST_DIR)
|
||||
cp -a doc $(DIST_DIR)
|
||||
cp -a *.txt $(DIST_DIR)
|
||||
cp -a bin $(DIST_DIR)
|
||||
cp -a lib $(DIST_DIR)
|
||||
$(RM) -f $(DIST_DIR)/bin/*/*/*.pdb $(DIST_DIR)/bin/*/*/*.exp
|
||||
$(RM) -f $(DIST_DIR)/bin/*/*/glewinfo-*.exe $(DIST_DIR)/bin/*/*/visualinfo-*.exe
|
||||
$(RM) -f $(DIST_DIR)/lib/*/*/*.pdb $(DIST_DIR)/lib/*/*/*.exp
|
||||
$(UNIX2DOS) $(DIST_DIR)/include/GL/*.h
|
||||
$(UNIX2DOS) $(DIST_DIR)/doc/*.txt
|
||||
$(UNIX2DOS) $(DIST_DIR)/doc/*.html
|
||||
$(UNIX2DOS) $(DIST_DIR)/*.txt
|
||||
rm -f $(DIST_WIN32)
|
||||
cd $(DIST_DIR)/.. && zip -rq9 $(DIST_WIN32) $(DIST_NAME)
|
||||
$(RM) -r $(DIST_DIR)
|
||||
|
||||
dist-src:
|
||||
$(RM) -r $(DIST_DIR)
|
||||
mkdir -p $(DIST_DIR)
|
||||
mkdir -p $(DIST_DIR)/bin
|
||||
mkdir -p $(DIST_DIR)/lib
|
||||
cp -a auto $(DIST_DIR)
|
||||
$(RM) -Rf $(DIST_DIR)/auto/registry
|
||||
$(RM) -Rf $(DIST_DIR)/auto/glfixes
|
||||
$(RM) -Rf $(DIST_DIR)/auto/OpenGL-Registry
|
||||
$(RM) -Rf $(DIST_DIR)/auto/EGL-Registry
|
||||
cp -a build $(DIST_DIR)
|
||||
cp -a config $(DIST_DIR)
|
||||
cp -a src $(DIST_DIR)
|
||||
cp -a doc $(DIST_DIR)
|
||||
cp -a include $(DIST_DIR)
|
||||
cp -a *.md $(DIST_DIR)
|
||||
cp -a *.txt $(DIST_DIR)
|
||||
cp -a Makefile $(DIST_DIR)
|
||||
cp -a glew.pc.in $(DIST_DIR)
|
||||
find $(DIST_DIR) -name '*.o' | xargs $(RM) -r
|
||||
find $(DIST_DIR) -name '*~' | xargs $(RM) -r
|
||||
find $(DIST_DIR) -name CVS -o -name .cvsignore | xargs $(RM) -r
|
||||
find $(DIST_DIR) -name .svn | xargs $(RM) -r
|
||||
find $(DIST_DIR) -name "*.patch" | xargs $(RM) -r
|
||||
$(DOS2UNIX) $(DIST_DIR)/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/config/*
|
||||
$(UNIX2DOS) $(DIST_DIR)/auto/core/*
|
||||
$(UNIX2DOS) $(DIST_DIR)/auto/extensions/*
|
||||
find $(DIST_DIR) -name '*.h' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.c' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.md' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.txt' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.html' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.css' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.sh' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.pl' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name 'Makefile' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.in' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.pm' | xargs $(UNIX2DOS)
|
||||
find $(DIST_DIR) -name '*.rc' | xargs $(UNIX2DOS)
|
||||
rm -f $(DIST_SRC_ZIP)
|
||||
cd $(DIST_DIR)/.. && zip -rq9 $(DIST_SRC_ZIP) $(DIST_NAME)
|
||||
$(DOS2UNIX) $(DIST_DIR)/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/Makefile
|
||||
$(DOS2UNIX) $(DIST_DIR)/config/*
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/core/*
|
||||
$(DOS2UNIX) $(DIST_DIR)/auto/extensions/*
|
||||
find $(DIST_DIR) -name '*.h' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.c' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.md' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.txt' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.html' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.css' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.sh' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.pl' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name 'Makefile' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.in' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.pm' | xargs $(DOS2UNIX)
|
||||
find $(DIST_DIR) -name '*.rc' | xargs $(DOS2UNIX)
|
||||
rm -f $(DIST_SRC_TGZ)
|
||||
cd $(DIST_DIR)/.. && env GZIP=-9 tar czf $(DIST_SRC_TGZ) $(DIST_NAME)
|
||||
$(RM) -r $(DIST_DIR)
|
||||
|
||||
extensions:
|
||||
$(MAKE) -C auto
|
||||
|
||||
.PHONY: clean distclean tardist dist-win32 dist-src
|
29
vendor/glew-cmake-2.2.0/README.md
vendored
Normal file
29
vendor/glew-cmake-2.2.0/README.md
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# GLEW-cmake - nightly pre-generated snapshot with old unofficial cmake support
|
||||
|
||||
[GLEW](https://github.com/nigels-com/glew) is upstream of this project.
|
||||
But *GLEW* repository does not contain generated sources. Only releases include generated sources.
|
||||
|
||||
*GLEW-cmake* has generated sources based on the latest *GLEW*. Sources are generated nightly.
|
||||
If you need only the latest snapshot of *GLEW*, try the build system of *GLEW*. It is placed under the `build` directory. Official `CMakeLists.txt` is placed in `build/cmake`.
|
||||
Please check [README_glew.md](./README_glew.md) for using build system of *GLEW*.
|
||||
|
||||
Also, *GLEW-cmake* has unofficial cmake support - It is created when the official CMake support of *GLEW* does not exist.
|
||||
You can see some CMake script examples in [`glew-cmake`](./glew-cmake/) directory. But, I **strongly** recommend using official CMakeLists of *GLEW*.
|
||||
|
||||
## Usage
|
||||
|
||||
This project provide `libglew_static` and `libglew_shared` library targets and `glewinfo` and `visualinfo` executable targets.
|
||||
|
||||
`libglew_static` provides a static library, and `libglew_shared` provides a shared library.
|
||||
*glew-cmake* does not affected by [BUILD_SHARED_LIBS](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html).
|
||||
|
||||
You can disable each library target by setting `glew-cmake_BUILD_SHARED` or `glew-cmake_BUILD_STATIC` falsy value (ex. `NO`, `FALSE`).
|
||||
|
||||
If you need only libraries, Please set `ONLY_LIBS` to `ON`. Otherwise, cmake generates executable targets also.
|
||||
|
||||
You can get pkg-config fils by setting `PKG_CONFIG_REPRESENTATIVE_TARGET` to `libglew_static` or `libglew_shared`.
|
||||
|
||||
Simply specify dependency of your target with `libglew_static` or `libglew_shared` by `target_link_libraries`.
|
||||
It will set the additional include directory & the libraries to link to your target.
|
||||
|
||||
If you are not familiar with cmake, Some `sub-directory-test.cmake`, `fetch-content.cmake` in [`glew-cmake`](./glew-cmake/) could be helpful.
|
255
vendor/glew-cmake-2.2.0/README_glew.md
vendored
Normal file
255
vendor/glew-cmake-2.2.0/README_glew.md
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
# GLEW - The OpenGL Extension Wrangler Library
|
||||
|
||||
The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform. OpenGL core and extension functionality is exposed in a single header file. GLEW has been tested on a variety of operating systems, including Windows, Linux, Mac OS X, FreeBSD, Irix, and Solaris.
|
||||
|
||||

|
||||
|
||||
http://glew.sourceforge.net/
|
||||
|
||||
https://github.com/nigels-com/glew
|
||||
|
||||
[](https://gitter.im/nigels-com/glew?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[](https://sourceforge.net/projects/glew/files/latest/download)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Downloads](#downloads)
|
||||
* [Recent snapshots](#recent-snapshots)
|
||||
* [Build](#build)
|
||||
* [Linux and Mac](#linux-and-mac)
|
||||
* [Using GNU Make](#using-gnu-make)
|
||||
* [Install build tools](#install-build-tools)
|
||||
* [Build](#build-1)
|
||||
* [Linux EGL](#linux-egl)
|
||||
* [Linux OSMesa](#linux-osmesa)
|
||||
* [Linux mingw-w64](#linux-mingw-w64)
|
||||
* [Using cmake](#using-cmake)
|
||||
* [Install build tools](#install-build-tools-1)
|
||||
* [Build](#build-2)
|
||||
* [Windows](#windows)
|
||||
* [Visual Studio](#visual-studio)
|
||||
* [MSYS/Mingw](#msysmingw)
|
||||
* [MSYS2/Mingw-w64](#msys2mingw-w64)
|
||||
* [glewinfo](#glewinfo)
|
||||
* [Code Generation](#code-generation)
|
||||
* [Authors](#authors)
|
||||
* [Contributions](#contributions)
|
||||
* [Copyright and Licensing](#copyright-and-licensing)
|
||||
|
||||
## Downloads
|
||||
|
||||
Current release is [2.2.0](https://github.com/nigels-com/glew/releases/tag/glew-2.2.0).
|
||||
[(Change Log)](http://glew.sourceforge.net/log.html)
|
||||
|
||||
Sources available as
|
||||
[ZIP](https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.zip) or
|
||||
[TGZ](https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.tgz).
|
||||
|
||||
Windows binaries for [32-bit and 64-bit](https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0-win32.zip).
|
||||
|
||||
### Recent snapshots
|
||||
|
||||
Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases.
|
||||
|
||||
[glew-20220402.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20220402.tgz/download) *GLEW 2.2.0 - with fix for glCreateProgressFenceNVX*
|
||||
|
||||
## Build
|
||||
|
||||
It is highly recommended to build from a tgz or zip release snapshot.
|
||||
The code generation workflow is a complex brew of gnu make, perl and python, that works best on Linux or Mac.
|
||||
The code generation is known to work on Windows using [MSYS2](https://www.msys2.org/).
|
||||
For most end-users of GLEW the official releases are the best choice, with first class support.
|
||||
|
||||
### Linux and Mac
|
||||
|
||||
#### Using GNU Make
|
||||
|
||||
GNU make is the primary build system for GLEW, historically.
|
||||
It includes targets for building the sources and headers, for maintenance purposes.
|
||||
|
||||
##### Install build tools
|
||||
|
||||
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev`
|
||||
|
||||
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel`
|
||||
|
||||
FreeBSD: `# pkg install xorg lang/gcc git cmake gmake bash python perl5`
|
||||
|
||||
##### Build
|
||||
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ make clean
|
||||
|
||||
Targets: `all, glew.lib (sub-targets: glew.lib.shared, glew.lib.static), glew.bin, clean, install, uninstall`
|
||||
|
||||
Variables: `SYSTEM=linux-clang, GLEW_DEST=/usr/local, STRIP=`
|
||||
|
||||
_Note: you may need to call `make` in the **auto** folder first_
|
||||
|
||||
##### Linux EGL
|
||||
|
||||
$ sudo apt install libegl1-mesa-dev
|
||||
$ make SYSTEM=linux-egl
|
||||
|
||||
##### Linux OSMesa
|
||||
|
||||
$ sudo apt install libosmesa-dev
|
||||
$ make SYSTEM=linux-osmesa
|
||||
|
||||
##### Linux mingw-w64
|
||||
|
||||
$ sudo apt install mingw-w64
|
||||
$ make SYSTEM=linux-mingw32
|
||||
$ make SYSTEM=linux-mingw64
|
||||
|
||||
#### Using cmake
|
||||
|
||||
The cmake build is mostly contributor maintained.
|
||||
Due to the multitude of use cases this is maintained on a _best effort_ basis.
|
||||
Pull requests are welcome.
|
||||
|
||||
*CMake 3.16 or higher is required.*
|
||||
|
||||
##### Install build tools
|
||||
|
||||
Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev cmake git`
|
||||
|
||||
RedHat/CentOS/Fedora: `$ sudo yum install libXmu-devel libXi-devel libGL-devel cmake git`
|
||||
|
||||
##### Build
|
||||
|
||||
$ cd build
|
||||
$ cmake ./cmake
|
||||
$ make -j4
|
||||
|
||||
| Target | Description |
|
||||
| ---------- | ----------- |
|
||||
| glew | Build the glew shared library. |
|
||||
| glew_s | Build the glew static library. |
|
||||
| glewinfo | Build the `glewinfo` executable (requires `BUILD_UTILS` to be `ON`). |
|
||||
| visualinfo | Build the `visualinfo` executable (requires `BUILD_UTILS` to be `ON`). |
|
||||
| install | Install all enabled targets into `CMAKE_INSTALL_PREFIX`. |
|
||||
| clean | Clean up build artifacts. |
|
||||
| all | Build all enabled targets (default target). |
|
||||
|
||||
| Variables | Description |
|
||||
| --------------- | ----------- |
|
||||
| BUILD_UTILS | Build the `glewinfo` and `visualinfo` executables. |
|
||||
| GLEW_REGAL | Build in Regal mode. |
|
||||
| GLEW_OSMESA | Build in off-screen Mesa mode. |
|
||||
| BUILD_FRAMEWORK | Build as MacOSX Framework. Setting `CMAKE_INSTALL_PREFIX` to `/Library/Frameworks` is recommended. |
|
||||
|
||||
### Windows
|
||||
|
||||
#### Visual Studio
|
||||
|
||||
Use the provided Visual Studio project file in build/vc15/
|
||||
|
||||
Projects for vc6, vc10, vc12 and vc14 are also provided
|
||||
|
||||
#### MSYS/Mingw
|
||||
|
||||
Available from [Mingw](http://www.mingw.org/)
|
||||
|
||||
Requirements: bash, make, gcc
|
||||
|
||||
$ mingw32-make
|
||||
$ mingw32-make install
|
||||
$ mingw32-make install.all
|
||||
|
||||
Alternative toolchain: `SYSTEM=mingw-win32`
|
||||
|
||||
#### MSYS2/Mingw-w64
|
||||
|
||||
Available from [Msys2](http://msys2.github.io/) and/or [Mingw-w64](http://mingw-w64.org/)
|
||||
|
||||
Requirements: bash, make, gcc
|
||||
|
||||
$ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc
|
||||
$ make
|
||||
$ make install
|
||||
$ make install.all
|
||||
|
||||
Alternative toolchain: `SYSTEM=msys, SYSTEM=msys-win32, SYSTEM=msys-win64`
|
||||
|
||||
## glewinfo
|
||||
|
||||
`glewinfo` is a command-line tool useful for inspecting the capabilities of an
|
||||
OpenGL implementation and GLEW support for that. Please include `glewinfo.txt`
|
||||
with bug reports, as appropriate.
|
||||
|
||||
---------------------------
|
||||
GLEW Extension Info
|
||||
---------------------------
|
||||
|
||||
GLEW version 2.0.0
|
||||
Reporting capabilities of pixelformat 3
|
||||
Running on a Intel(R) HD Graphics 3000 from Intel
|
||||
OpenGL version 3.1.0 - Build 9.17.10.4229 is supported
|
||||
|
||||
GL_VERSION_1_1: OK
|
||||
---------------
|
||||
|
||||
GL_VERSION_1_2: OK
|
||||
---------------
|
||||
glCopyTexSubImage3D: OK
|
||||
glDrawRangeElements: OK
|
||||
glTexImage3D: OK
|
||||
glTexSubImage3D: OK
|
||||
|
||||
...
|
||||
|
||||
## Code Generation
|
||||
|
||||
A Unix or Mac environment is needed for building GLEW from scratch to
|
||||
include new extensions, or customize the code generation. The extension
|
||||
data is regenerated from the top level source directory with:
|
||||
|
||||
make extensions
|
||||
|
||||
An alternative to generating the GLEW sources from scratch is to
|
||||
download a pre-generated (unsupported) snapshot:
|
||||
|
||||
https://sourceforge.net/projects/glew/files/glew/snapshots/
|
||||
|
||||
## Authors
|
||||
|
||||
GLEW is currently maintained by [Nigel Stewart](https://github.com/nigels-com)
|
||||
with bug fixes, new OpenGL extension support and new releases.
|
||||
|
||||
GLEW was developed by [Milan Ikits](http://www.cs.utah.edu/~ikits/)
|
||||
and [Marcelo Magallon](http://wwwvis.informatik.uni-stuttgart.de/~magallon/).
|
||||
Aaron Lefohn, Joe Kniss, and Chris Wyman were the first users and also
|
||||
assisted with the design and debugging process.
|
||||
|
||||
The acronym GLEW originates from Aaron Lefohn.
|
||||
Pasi Kärkkäinen identified and fixed several problems with
|
||||
GLX and SDL. Nate Robins created the `wglinfo` utility, to
|
||||
which modifications were made by Michael Wimmer.
|
||||
|
||||
## Contributions
|
||||
|
||||
GLEW welcomes community contributions. Typically these are co-ordinated
|
||||
via [Issues](https://github.com/nigels-com/glew/issues) or
|
||||
[Pull Requests](https://github.com/nigels-com/glew/pulls) in the
|
||||
GitHub web interface.
|
||||
|
||||
Be sure to mention platform and compiler toolchain details when filing
|
||||
a bug report. The output of `glewinfo` can be quite useful for discussion
|
||||
also.
|
||||
|
||||
Generally GLEW is usually released once a year, around the time of the Siggraph
|
||||
computer graphics conference. If you're not using the current release
|
||||
version of GLEW, be sure to check if the issue or bug is fixed there.
|
||||
|
||||
## Copyright and Licensing
|
||||
|
||||
GLEW is originally derived from the EXTGL project by Lev Povalahev.
|
||||
The source code is licensed under the
|
||||
[Modified BSD License](http://glew.sourceforge.net/glew.txt), the
|
||||
[Mesa 3-D License](http://glew.sourceforge.net/mesa.txt) (MIT) and the
|
||||
[Khronos License](http://glew.sourceforge.net/khronos.txt) (MIT).
|
||||
|
||||
The automatic code generation scripts are released under the
|
||||
[GNU GPL](http://glew.sourceforge.net/gpl.txt).
|
365
vendor/glew-cmake-2.2.0/auto/Makefile
vendored
Normal file
365
vendor/glew-cmake-2.2.0/auto/Makefile
vendored
Normal file
@ -0,0 +1,365 @@
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
include ../config/version
|
||||
|
||||
#GLEW_SPLIT_SOURCE = yes
|
||||
|
||||
SHELL = bash
|
||||
PYTHON ?= python
|
||||
|
||||
EXT = extensions/gl
|
||||
CORE = core/gl
|
||||
|
||||
REPO_OPENGL ?= https://github.com/KhronosGroup/OpenGL-Registry.git
|
||||
REPO_EGL ?= https://github.com/KhronosGroup/EGL-Registry.git
|
||||
REPO_GLFIXES ?= https://github.com/nigels-com/glfixes
|
||||
|
||||
BIN = bin
|
||||
SRC = src
|
||||
BLACKLIST = blacklist
|
||||
|
||||
GL_CORE_SPEC := $(CORE)/GL_VERSION*
|
||||
GLX_CORE_SPEC := $(CORE)/GLX_VERSION*
|
||||
EGL_CORE_SPEC := $(CORE)/EGL_VERSION*
|
||||
ifeq (custom,$(MAKECMDGOALS))
|
||||
#GL_CORE_SPEC := $(shell grep GL_VERSION custom.txt | perl -pi -e "s=^=$(CORE)/=g;")
|
||||
GL_EXT_SPEC := $(shell grep "^[ \t]*GL_" custom.txt | grep -v GL_VERSION | perl -pi -e "s=^=$(EXT)/=g;")
|
||||
WGL_EXT_SPEC := $(shell grep "^[ \t]*WGL_" custom.txt | perl -pi -e "s=^=$(EXT)/=g;")
|
||||
#GLX_CORE_SPEC := $(shell grep GLX_VERSION custom.txt | perl -pi -e "s=^=$(CORE)/=g;")
|
||||
GLX_EXT_SPEC := $(shell grep "^[ \t]*GLX_" custom.txt | grep -v GLX_VERSION | perl -pi -e "s=^=$(EXT)/=g;")
|
||||
EGL_EXT_SPEC := $(shell grep "^[ \t]*EGL_" custom.txt | grep -v EGL_VERSION | perl -pi -e "s=^=$(EXT)/=g;")
|
||||
else
|
||||
GL_EXT_SPEC := $(EXT)/GL_*
|
||||
WGL_EXT_SPEC := $(EXT)/WGL_*
|
||||
GLX_EXT_SPEC := $(EXT)/GLX_*
|
||||
EGL_EXT_SPEC := $(EXT)/EGL_*
|
||||
endif
|
||||
|
||||
PARSE_SPEC = parse_spec.pl
|
||||
SYSTEM = $(strip $(shell uname -s))
|
||||
|
||||
TOP = ..
|
||||
I.DEST = $(TOP)/include/GL
|
||||
S.DEST = $(TOP)/src
|
||||
D.DEST = $(TOP)/doc
|
||||
B.DEST = $(TOP)/build
|
||||
|
||||
I.TARGETS = \
|
||||
$(I.DEST)/glew.h \
|
||||
$(I.DEST)/wglew.h \
|
||||
$(I.DEST)/glxew.h \
|
||||
$(I.DEST)/eglew.h
|
||||
|
||||
ifeq (yes,$(GLEW_SPLIT_SOURCE))
|
||||
S.TARGETS = \
|
||||
$(S.DEST)/glew_def.c \
|
||||
$(S.DEST)/glew_init.c \
|
||||
$(S.DEST)/glew_str.c \
|
||||
$(S.DEST)/glewinfo.c
|
||||
else
|
||||
S.TARGETS = \
|
||||
$(S.DEST)/glew.c \
|
||||
$(S.DEST)/glewinfo.c
|
||||
endif
|
||||
|
||||
D.TARGETS = \
|
||||
$(D.DEST)/index.html \
|
||||
$(D.DEST)/install.html \
|
||||
$(D.DEST)/basic.html \
|
||||
$(D.DEST)/advanced.html \
|
||||
$(D.DEST)/build.html \
|
||||
$(D.DEST)/credits.html \
|
||||
$(D.DEST)/log.html \
|
||||
$(D.DEST)/glew.html \
|
||||
$(D.DEST)/wglew.html \
|
||||
$(D.DEST)/glxew.html
|
||||
|
||||
B.TARGETS = \
|
||||
$(B.DEST)/glew.rc \
|
||||
$(B.DEST)/glewinfo.rc \
|
||||
$(B.DEST)/visualinfo.rc
|
||||
|
||||
all custom: $(I.TARGETS) $(S.TARGETS) $(D.TARGETS) $(B.TARGETS)
|
||||
|
||||
ext: $(EXT)/.dummy
|
||||
|
||||
OpenGL-Registry/.dummy:
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Downloading OpenGL-Registry"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
git clone --depth=1 $(REPO_OPENGL) OpenGL-Registry
|
||||
git clone --depth=1 --branch glew $(REPO_GLFIXES) glfixes
|
||||
touch $@
|
||||
|
||||
EGL-Registry/.dummy:
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Downloading EGL-Registry"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
git clone --depth=1 $(REPO_EGL) EGL-Registry
|
||||
touch $@
|
||||
|
||||
$(EXT)/.dummy: OpenGL-Registry/.dummy EGL-Registry/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "OpenGL descriptors"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
rm -rf $(EXT)
|
||||
cp -r glfixes/gl/specs/ANGLE OpenGL-Registry/extensions
|
||||
cp -r glfixes/gl/specs/REGAL OpenGL-Registry/extensions
|
||||
$(BIN)/update_ext.sh $(EXT) OpenGL-Registry/extensions $(BLACKLIST)
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "WGL descriptors"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
rm -f $(EXT)/WGL_*
|
||||
$(PYTHON) $(BIN)/parse_xml.py OpenGL-Registry/xml/wgl.xml --api wgl --extensions extensions/gl
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "GLX descriptors"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
rm -f $(EXT)/GLX_*
|
||||
$(PYTHON) $(BIN)/parse_xml.py OpenGL-Registry/xml/glx.xml --api glx --extensions extensions/gl
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "EGL descriptors"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
$(PYTHON) $(BIN)/parse_xml.py EGL-Registry/api/egl.xml --api egl --extensions extensions/gl
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "filter descriptors"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
$(BIN)/filter_gl_ext.sh $(EXT)
|
||||
ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin)
|
||||
find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \
|
||||
xargs -J % cp % $(EXT)
|
||||
else
|
||||
find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \
|
||||
xargs -I % -n 1 cp % $(EXT)
|
||||
endif
|
||||
touch $@
|
||||
|
||||
$(I.DEST)/glew.h: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating glew.h"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
test -d $(I.DEST) || mkdir -p $(I.DEST)
|
||||
cp -f $(SRC)/glew_license.h $@
|
||||
cat $(SRC)/mesa_license.h >> $@
|
||||
cat $(SRC)/khronos_license.h >> $@
|
||||
cat $(SRC)/glew_head.h >> $@
|
||||
$(BIN)/make_header.pl GLAPIENTRY GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_header.pl GLAPIENTRY GL $(GL_EXT_SPEC) >> $@
|
||||
echo -e "/* ------------------------------------------------------------------------- */\n\n" >> $@
|
||||
$(BIN)/make_struct_fun.pl GLEW_FUN_EXPORT $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_struct_var.pl GLEW_VAR_EXPORT $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
|
||||
perl -e "s/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;/" -pi $@
|
||||
cat $(SRC)/glew_tail.h >> $@
|
||||
perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
|
||||
perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@
|
||||
perl -e "s/GLEW_VERSION_MINOR_STRING/$(GLEW_MINOR)/g" -pi $@
|
||||
perl -e "s/GLEW_VERSION_MICRO_STRING/$(GLEW_MICRO)/g" -pi $@
|
||||
rm -f $@.bak
|
||||
|
||||
$(I.DEST)/wglew.h: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating wglew.h"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/glew_license.h $@
|
||||
cat $(SRC)/khronos_license.h >> $@
|
||||
cat $(SRC)/wglew_head.h >> $@
|
||||
$(BIN)/make_header.pl WINAPI WGL $(WGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/wglew_mid.h >> $@
|
||||
$(BIN)/make_struct_fun.pl WGLEW_FUN_EXPORT $(WGL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_struct_var.pl WGLEW_VAR_EXPORT $(WGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/wglew_tail.h >> $@
|
||||
|
||||
$(I.DEST)/glxew.h: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating glxew.h"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/glew_license.h $@
|
||||
cat $(SRC)/mesa_license.h >> $@
|
||||
cat $(SRC)/khronos_license.h >> $@
|
||||
cat $(SRC)/glxew_head.h >> $@
|
||||
$(BIN)/make_header.pl "" GLX $(GLX_CORE_SPEC) >> $@
|
||||
$(BIN)/make_header.pl "" GLX $(GLX_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glxew_mid.h >> $@
|
||||
$(BIN)/make_struct_fun.pl GLXEW_FUN_EXPORT $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
|
||||
$(BIN)/make_struct_var.pl GLXEW_VAR_EXPORT $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
|
||||
perl -e "s/GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;/GLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLXEW_VAR_EXPORT GLboolean __GLXEW_VERSION_1_2;/" -pi $@
|
||||
cat $(SRC)/glxew_tail.h >> $@
|
||||
|
||||
$(I.DEST)/eglew.h: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating eglew.h"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/glew_license.h $@
|
||||
cat $(SRC)/mesa_license.h >> $@
|
||||
cat $(SRC)/khronos_license.h >> $@
|
||||
cat $(SRC)/eglew_head.h >> $@
|
||||
$(BIN)/make_header.pl "" EGL $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_header.pl "" EGL $(EGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/eglew_mid.h >> $@
|
||||
$(BIN)/make_struct_fun.pl EGLEW_FUN_EXPORT $(EGL_CORE_SPEC) $(EGL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_struct_var.pl EGLEW_VAR_EXPORT $(EGL_CORE_SPEC) $(EGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/eglew_tail.h >> $@
|
||||
|
||||
$(S.DEST)/glew.c: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating glew.c"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/glew_license.h $@
|
||||
cat $(SRC)/glew_head.c >> $@
|
||||
$(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@
|
||||
echo -e "\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@
|
||||
$(BIN)/make_def_var.pl GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_var.pl GL $(GL_EXT_SPEC) >> $@
|
||||
echo -e "\nstatic const char * _glewExtensionLookup[] = {" >> $@;
|
||||
$(BIN)/make_index.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
|
||||
echo -e " NULL\n};\n\n" >> $@;
|
||||
$(BIN)/make_enable_index.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_initd.pl GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_initd.pl GL $(GL_EXT_SPEC) >> $@
|
||||
echo -e "" >> $@;
|
||||
$(BIN)/make_init.pl GL $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_init.pl GL $(GL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_init_gl.c >> $@
|
||||
$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
|
||||
$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_list2.pl $(GL_EXT_SPEC) >> $@
|
||||
echo -e "\n return GLEW_OK;\n}\n" >> $@
|
||||
echo -e "\n#if defined(GLEW_OSMESA)" >> $@
|
||||
echo -e "\n#elif defined(GLEW_EGL)" >> $@
|
||||
$(BIN)/make_def_fun.pl EGL $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_fun.pl EGL $(EGL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_def_var.pl EGL $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_var.pl EGL $(EGL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_init.pl EGL $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_init.pl EGL $(EGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_init_egl.c >> $@
|
||||
$(BIN)/make_list.pl $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_list.pl $(EGL_EXT_SPEC) >> $@
|
||||
echo -e "\n return GLEW_OK;\n}" >> $@
|
||||
echo -e "\n#elif defined(_WIN32)" >> $@
|
||||
$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@
|
||||
$(BIN)/make_init.pl WGL $(WGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_init_wgl.c >> $@
|
||||
$(BIN)/make_list.pl $(WGL_EXT_SPEC) >> $@
|
||||
echo -e "\n return GLEW_OK;\n}" >> $@;
|
||||
echo -e "\n#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))" >> $@
|
||||
$(BIN)/make_def_fun.pl GLX $(GLX_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_fun.pl GLX $(GLX_EXT_SPEC) >> $@
|
||||
echo -e "\nGLboolean __GLXEW_VERSION_1_0 = GL_FALSE;" >> $@
|
||||
echo -e "GLboolean __GLXEW_VERSION_1_1 = GL_FALSE;" >> $@
|
||||
$(BIN)/make_def_var.pl GLX $(GLX_CORE_SPEC) >> $@
|
||||
$(BIN)/make_def_var.pl GLX $(GLX_EXT_SPEC) >> $@
|
||||
$(BIN)/make_init.pl GLX $(GLX_CORE_SPEC) >> $@
|
||||
$(BIN)/make_init.pl GLX $(GLX_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_init_glx.c >> $@
|
||||
$(BIN)/make_list.pl $(CORE)/GLX_VERSION_1_3 | grep -v '\"GLX_VERSION' >> $@
|
||||
$(BIN)/make_list.pl $(GLX_EXT_SPEC) >> $@
|
||||
echo -e "\n return GLEW_OK;\n}" >> $@
|
||||
echo -e "\n#endif /* !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) */\n" >> $@;
|
||||
cat $(SRC)/glew_init_tail.c >> $@
|
||||
cat $(SRC)/glew_str_head.c >> $@
|
||||
$(BIN)/make_str.pl $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_str_wgl.c >> $@
|
||||
$(BIN)/make_str.pl $(WGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_str_glx.c >> $@
|
||||
$(BIN)/make_str.pl $(GLX_CORE_SPEC) $(GLX_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_str_egl.c >> $@
|
||||
$(BIN)/make_str.pl $(EGL_CORE_SPEC) $(EGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glew_str_tail.c >> $@
|
||||
perl -e "s/GLEW_VERSION_STRING/$(GLEW_VERSION)/g" -pi $@
|
||||
perl -e "s/GLEW_VERSION_MAJOR_STRING/$(GLEW_MAJOR)/g" -pi $@
|
||||
perl -e "s/GLEW_VERSION_MINOR_STRING/$(GLEW_MINOR)/g" -pi $@
|
||||
perl -e "s/GLEW_VERSION_MICRO_STRING/$(GLEW_MICRO)/g" -pi $@
|
||||
perl -e "s/GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader\(\);/{ GLEW_ARB_vertex_shader = !_glewInit_GL_ARB_vertex_shader(); _glewInit_GL_ARB_vertex_program(); }/g" -pi $@
|
||||
perl -e "s/\(\(glColorSubTable = /((glBlendEquation = (PFNGLBLENDEQUATIONPROC)glewGetProcAddress((const GLubyte*)\"glBlendEquation\")) == NULL) || r;\n r = ((glColorSubTable = /g" -pi $@
|
||||
rm -f $@.bak
|
||||
|
||||
$(S.DEST)/glewinfo.c: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating glewinfo.c"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/glew_license.h $@
|
||||
cat $(SRC)/glewinfo_head.c >> $@
|
||||
$(BIN)/make_info.pl $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_info.pl $(GL_EXT_SPEC) >> $@
|
||||
echo -e "#if defined(GLEW_EGL)\n" >> $@
|
||||
$(BIN)/make_info.pl $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_info.pl $(EGL_EXT_SPEC) >> $@
|
||||
echo -e "#elif _WIN32\n" >> $@
|
||||
$(BIN)/make_info.pl $(WGL_EXT_SPEC) >> $@
|
||||
echo -e "#else /* _UNIX */\n" >> $@
|
||||
$(BIN)/make_info.pl $(GLX_CORE_SPEC) >> $@
|
||||
$(BIN)/make_info.pl $(GLX_EXT_SPEC) >> $@
|
||||
echo -e "#endif /* _WIN32 */\n" >> $@
|
||||
|
||||
cat $(SRC)/glewinfo_gl.c >> $@
|
||||
$(BIN)/make_info_list.pl $(GL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_info_list.pl $(GL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glewinfo_wgl.c >> $@
|
||||
$(BIN)/make_info_list.pl $(WGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glewinfo_glx.c >> $@
|
||||
$(BIN)/make_info_list.pl $(GLX_CORE_SPEC) >> $@
|
||||
$(BIN)/make_info_list.pl $(GLX_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glewinfo_egl.c >> $@
|
||||
$(BIN)/make_info_list.pl $(EGL_CORE_SPEC) >> $@
|
||||
$(BIN)/make_info_list.pl $(EGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/glewinfo_tail.c >> $@
|
||||
perl -e 's/"glColorSubTable"/"glBlendEquation", glBlendEquation == NULL);\n glewInfoFunc(fi, "glColorSubTable"/g' -pi $@
|
||||
rm -f $@.bak
|
||||
|
||||
# Update documentation
|
||||
|
||||
$(D.DEST)/%.html: doc/%.html
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating $(@F)"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cat $(SRC)/header.html $< $(SRC)/footer.html | \
|
||||
perl -pe 's#<a href="$(@F)">(.*)</a>#\1#' > $@
|
||||
|
||||
$(D.DEST)/glew.html: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating glew.html"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/header.html $@
|
||||
echo -e "<h2>Supported OpenGL Extensions</h2>\n" >> $@
|
||||
$(BIN)/make_html.pl $(GL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/footer.html >> $@
|
||||
perl -i -pe 's#<a href="$(@F)">(.*)</a>#\1#' $@
|
||||
|
||||
$(D.DEST)/wglew.html: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating wglew.html"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/header.html $@
|
||||
echo -e "<h2>Supported WGL Extensions</h2>\n" >> $@
|
||||
$(BIN)/make_html.pl $(WGL_EXT_SPEC) >> $@
|
||||
cat $(SRC)/footer.html >> $@
|
||||
perl -i -pe 's#<a href="$(@F)">(.*)</a>#\1#' $@
|
||||
|
||||
$(D.DEST)/glxew.html: $(EXT)/.dummy
|
||||
@echo "--------------------------------------------------------------------"
|
||||
@echo "Creating glxew.html"
|
||||
@echo "--------------------------------------------------------------------"
|
||||
cp -f $(SRC)/header.html $@
|
||||
echo -e "<h2>Supported GLX Extensions</h2>\n" >> $@
|
||||
$(BIN)/make_html.pl $(GLX_EXT_SPEC) >> $@
|
||||
cat $(SRC)/footer.html >> $@
|
||||
perl -i -pe 's#<a href="$(@F)">(.*)</a>#\1#' $@
|
||||
|
||||
$(B.DEST)/%.rc: src/%.rc $(EXT)/.dummy
|
||||
perl -e "s/GLEW_MAJOR/$(GLEW_MAJOR)/g;s/GLEW_MINOR/$(GLEW_MINOR)/g;s/GLEW_MICRO/$(GLEW_MICRO)/g;" -p $< > $@
|
||||
|
||||
clean:
|
||||
rm -rf $(I.TARGETS) $(S.TARGETS) $(D.TARGETS) $(B.TARGETS)
|
||||
|
||||
clobber: clean
|
||||
rm -rf $(EXT)
|
||||
|
||||
destroy: clobber
|
||||
rm -rf registry
|
614
vendor/glew-cmake-2.2.0/auto/bin/filter_gl_ext.sh
vendored
Normal file
614
vendor/glew-cmake-2.2.0/auto/bin/filter_gl_ext.sh
vendored
Normal file
@ -0,0 +1,614 @@
|
||||
#!/usr/bin/env bash
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
##
|
||||
## Parameters:
|
||||
##
|
||||
## $1: Extensions directory
|
||||
|
||||
set -e
|
||||
|
||||
# fix GL_NV_texture_compression_vtc
|
||||
grep -v EXT $1/GL_NV_texture_compression_vtc > tmp
|
||||
mv tmp $1/GL_NV_texture_compression_vtc
|
||||
|
||||
# remove duplicates from GL_ARB_vertex_program and GL_ARB_fragment_program
|
||||
tail -n +5 $1/GL_ARB_vertex_program > patterns
|
||||
grep -v -F -f patterns $1/GL_ARB_fragment_program > tmp
|
||||
mv tmp $1/GL_ARB_fragment_program
|
||||
|
||||
# remove duplicates from GLX_EXT_visual_rating and GLX_EXT_visual_info
|
||||
tail -n +5 $1/GLX_EXT_visual_info > patterns
|
||||
grep -v -F -f patterns $1/GLX_EXT_visual_rating > tmp
|
||||
mv tmp $1/GLX_EXT_visual_rating
|
||||
|
||||
# GL_EXT_draw_buffers2 and GL_EXT_transform_feedback both define glGetBooleanIndexedvEXT but with different parameter names
|
||||
grep -v glGetBooleanIndexedvEXT $1/GL_EXT_transform_feedback > tmp
|
||||
mv tmp $1/GL_EXT_transform_feedback
|
||||
|
||||
# GL_EXT_draw_buffers2 and GL_EXT_transform_feedback both define glGetIntegerIndexedvEXT but with different parameter names
|
||||
grep -v glGetIntegerIndexedvEXT $1/GL_EXT_transform_feedback > tmp
|
||||
mv tmp $1/GL_EXT_transform_feedback
|
||||
|
||||
# remove duplicates from GL_NV_video_capture and GLX_NV_video_capture
|
||||
grep -v glX $1/GL_NV_video_capture > tmp
|
||||
mv tmp $1/GL_NV_video_capture
|
||||
|
||||
# add missing functions to GL_NV_video_capture
|
||||
cat >> $1/GL_NV_video_capture <<EOT
|
||||
void glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params)
|
||||
void glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params)
|
||||
void glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params)
|
||||
void glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params)
|
||||
void glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params)
|
||||
void glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params)
|
||||
EOT
|
||||
|
||||
# fix WGL_NV_video_capture
|
||||
cat >> $1/WGL_NV_video_capture <<EOT
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
EOT
|
||||
|
||||
# fix GLX_NV_video_capture
|
||||
cat >> $1/GLX_NV_video_capture <<EOT
|
||||
typedef XID GLXVideoCaptureDeviceNV
|
||||
EOT
|
||||
|
||||
# remove duplicates from GL_NV_present_video and GLX_NV_present_video
|
||||
tail -n +5 $1/GLX_NV_present_video > patterns
|
||||
grep -v -F -f patterns $1/GL_NV_present_video > tmp
|
||||
mv tmp $1/GL_NV_present_video
|
||||
|
||||
# fix WGL_NV_present_video
|
||||
cat >> $1/WGL_NV_present_video <<EOT
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
EOT
|
||||
|
||||
# fix WGL_NV_video_output
|
||||
cat >> $1/WGL_NV_video_output <<EOT
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
EOT
|
||||
|
||||
# fix GL_NV_occlusion_query and GL_HP_occlusion_test
|
||||
grep -v '_HP' $1/GL_NV_occlusion_query > tmp
|
||||
mv tmp $1/GL_NV_occlusion_query
|
||||
|
||||
# add deprecated constants to GL_ATI_fragment_shader
|
||||
cat >> $1/GL_ATI_fragment_shader <<EOT
|
||||
GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
|
||||
GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
|
||||
GL_NUM_PASSES_ATI 0x8970
|
||||
GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
|
||||
GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
|
||||
GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
|
||||
GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
|
||||
GL_COLOR_ALPHA_PAIRING_ATI 0x8975
|
||||
GL_SWIZZLE_STRQ_ATI 0x897A
|
||||
GL_SWIZZLE_STRQ_DQ_ATI 0x897B
|
||||
EOT
|
||||
|
||||
# add deprecated constants to GL_NV_texture_shader
|
||||
cat >> $1/GL_NV_texture_shader <<EOT
|
||||
GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1
|
||||
GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3
|
||||
GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2
|
||||
EOT
|
||||
|
||||
# fix WGL_ATI_pixel_format_float
|
||||
cat >> $1/WGL_ATI_pixel_format_float <<EOT
|
||||
GL_RGBA_FLOAT_MODE_ATI 0x8820
|
||||
GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
|
||||
EOT
|
||||
|
||||
# fix WGL_ARB_make_current_read
|
||||
cat >> $1/WGL_ARB_make_current_read <<EOT
|
||||
ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
EOT
|
||||
|
||||
# fix WGL_EXT_make_current_read
|
||||
cat >> $1/WGL_EXT_make_current_read <<EOT
|
||||
ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
EOT
|
||||
|
||||
# add typedefs to GL_ARB_vertex_buffer_object; (from personal communication
|
||||
# with Marco Fabbricatore).
|
||||
#
|
||||
# Rationale. The spec says:
|
||||
#
|
||||
# "Both types are defined as signed integers large enough to contain
|
||||
# any pointer value [...] The idea of making these types unsigned was
|
||||
# considered, but was ultimately rejected ..."
|
||||
cat >> $1/GL_ARB_vertex_buffer_object <<EOT
|
||||
typedef ptrdiff_t GLsizeiptrARB
|
||||
typedef ptrdiff_t GLintptrARB
|
||||
EOT
|
||||
|
||||
# add typedefs to GLX_EXT_import_context
|
||||
cat >> $1/GLX_EXT_import_context <<EOT
|
||||
typedef XID GLXContextID
|
||||
EOT
|
||||
|
||||
# add tokens to GLX_OML_swap_method
|
||||
cat >> $1/GLX_OML_swap_method <<EOT
|
||||
GLX_SWAP_EXCHANGE_OML 0x8061
|
||||
GLX_SWAP_COPY_OML 0x8062
|
||||
GLX_SWAP_UNDEFINED_OML 0x8063
|
||||
EOT
|
||||
|
||||
# add typedefs to GLX_SGIX_fbconfig
|
||||
cat >> $1/GLX_SGIX_fbconfig <<EOT
|
||||
typedef XID GLXFBConfigIDSGIX
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX
|
||||
EOT
|
||||
|
||||
# Skip GLX_SGIX_dmbuffer and GLX_SGIX_video_source
|
||||
# unknown DMparams, DMbuffer, etc
|
||||
rm -f $1/GLX_SGIX_dmbuffer
|
||||
rm -f $1/GLX_SGIX_video_source
|
||||
|
||||
# add typedefs to GLX_SGIX_pbuffer
|
||||
cat >> $1/GLX_SGIX_pbuffer <<EOT
|
||||
typedef XID GLXPbufferSGIX
|
||||
typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX
|
||||
EOT
|
||||
|
||||
# add typedef to GL_NV_half_float
|
||||
cat >> $1/GL_NV_half_float <<EOT
|
||||
typedef unsigned short GLhalf
|
||||
EOT
|
||||
|
||||
# add handle to WGL_ARB_pbuffer
|
||||
cat >> $1/WGL_ARB_pbuffer <<EOT
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
EOT
|
||||
|
||||
# add handle to WGL_EXT_pbuffer
|
||||
cat >> $1/WGL_EXT_pbuffer <<EOT
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
EOT
|
||||
|
||||
# get rid of GL_SUN_multi_draw_arrays
|
||||
rm -f $1/GL_SUN_multi_draw_arrays
|
||||
|
||||
# change variable names in GL_ARB_vertex_shader
|
||||
perl -e 's/v0/x/g' -pi $1/GL_ARB_vertex_shader
|
||||
perl -e 's/v1/y/g' -pi $1/GL_ARB_vertex_shader
|
||||
perl -e 's/v2/z/g' -pi $1/GL_ARB_vertex_shader
|
||||
perl -e 's/v3/w/g' -pi $1/GL_ARB_vertex_shader
|
||||
|
||||
# remove triplicates in GL_ARB_shader_objects, GL_ARB_fragment_shader,
|
||||
# and GL_ARB_vertex_shader
|
||||
tail -n +5 $1/GL_ARB_shader_objects > patterns
|
||||
grep -v -F -f patterns $1/GL_ARB_fragment_shader > tmp
|
||||
mv tmp $1/GL_ARB_fragment_shader
|
||||
grep -v -F -f patterns $1/GL_ARB_vertex_shader > tmp
|
||||
mv tmp $1/GL_ARB_vertex_shader
|
||||
|
||||
# remove duplicates in GL_ARB_vertex_program and GL_ARB_vertex_shader
|
||||
tail -n +5 $1/GL_ARB_vertex_program > patterns
|
||||
grep -v -F -f patterns $1/GL_ARB_vertex_shader > tmp
|
||||
mv tmp $1/GL_ARB_vertex_shader
|
||||
|
||||
# remove triplicates in GL_ARB_fragment_program, GL_ARB_fragment_shader,
|
||||
# and GL_ARB_vertex_shader
|
||||
tail -n +5 $1/GL_ARB_fragment_program > patterns
|
||||
grep -v -F -f patterns $1/GL_ARB_fragment_shader > tmp
|
||||
mv tmp $1/GL_ARB_fragment_shader
|
||||
grep -v -F -f patterns $1/GL_ARB_vertex_shader > tmp
|
||||
mv tmp $1/GL_ARB_vertex_shader
|
||||
|
||||
# remove duplicates in GL_EXT_direct_state_access
|
||||
grep -v "glGetBooleanIndexedvEXT" $1/GL_EXT_direct_state_access > tmp
|
||||
mv tmp $1/GL_EXT_direct_state_access
|
||||
grep -v "glGetIntegerIndexedvEXT" $1/GL_EXT_direct_state_access > tmp
|
||||
mv tmp $1/GL_EXT_direct_state_access
|
||||
grep -v "glDisableIndexedEXT" $1/GL_EXT_direct_state_access > tmp
|
||||
mv tmp $1/GL_EXT_direct_state_access
|
||||
grep -v "glEnableIndexedEXT" $1/GL_EXT_direct_state_access > tmp
|
||||
mv tmp $1/GL_EXT_direct_state_access
|
||||
grep -v "glIsEnabledIndexedEXT" $1/GL_EXT_direct_state_access > tmp
|
||||
mv tmp $1/GL_EXT_direct_state_access
|
||||
|
||||
# remove duplicates in GL_NV_explicit_multisample
|
||||
grep -v "glGetBooleanIndexedvEXT" $1/GL_NV_explicit_multisample > tmp
|
||||
mv tmp $1/GL_NV_explicit_multisample
|
||||
grep -v "glGetIntegerIndexedvEXT" $1/GL_NV_explicit_multisample > tmp
|
||||
mv tmp $1/GL_NV_explicit_multisample
|
||||
|
||||
# fix bugs in GL_ARB_vertex_shader
|
||||
grep -v "GL_FLOAT" $1/GL_ARB_vertex_shader > tmp
|
||||
mv tmp $1/GL_ARB_vertex_shader
|
||||
perl -e 's/handle /GLhandleARB /g' -pi $1/GL_ARB_vertex_shader
|
||||
|
||||
# fix bugs in GL_ARB_shader_objects
|
||||
grep -v "GL_FLOAT " $1/GL_ARB_shader_objects > tmp
|
||||
mv tmp $1/GL_ARB_shader_objects
|
||||
grep -v "GL_INT " $1/GL_ARB_shader_objects > tmp
|
||||
mv tmp $1/GL_ARB_shader_objects
|
||||
|
||||
# add typedefs to GL_ARB_shader_objects
|
||||
cat >> $1/GL_ARB_shader_objects <<EOT
|
||||
typedef char GLcharARB
|
||||
typedef unsigned int GLhandleARB
|
||||
EOT
|
||||
|
||||
# add missing functions to GL_ARB_transpose_matrix
|
||||
cat >> $1/GL_ARB_transpose_matrix <<EOT
|
||||
void glLoadTransposeMatrixfARB (GLfloat m[16])
|
||||
void glLoadTransposeMatrixdARB (GLdouble m[16])
|
||||
void glMultTransposeMatrixfARB (GLfloat m[16])
|
||||
void glMultTransposeMatrixdARB (GLdouble m[16])
|
||||
EOT
|
||||
|
||||
# add missing tokens to GL_EXT_framebuffer_multisample
|
||||
cat >> $1/GL_EXT_framebuffer_multisample <<EOT
|
||||
GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
|
||||
GL_MAX_SAMPLES_EXT 0x8D57
|
||||
EOT
|
||||
|
||||
# Filter out GL_NV_gpu_program_fp64 enums and functions
|
||||
head -n4 $1/GL_NV_gpu_program_fp64 > tmp
|
||||
mv tmp $1/GL_NV_gpu_program_fp64
|
||||
|
||||
# Filter glGetUniformui64vNV from GL_NV_shader_buffer_load
|
||||
grep -v "glGetUniformui64vNV" $1/GL_NV_shader_buffer_load > tmp
|
||||
mv tmp $1/GL_NV_shader_buffer_load
|
||||
|
||||
# Filter out profile enumerations from GLX_ARB_create_context
|
||||
grep -v "_PROFILE_" $1/GLX_ARB_create_context > tmp
|
||||
mv tmp $1/GLX_ARB_create_context
|
||||
|
||||
# Filter only profile related enumerations for GLX_ARB_create_context_profile
|
||||
head -n4 $1/GLX_ARB_create_context_profile > tmp
|
||||
grep "_PROFILE_" $1/GLX_ARB_create_context_profile >> tmp
|
||||
mv tmp $1/GLX_ARB_create_context_profile
|
||||
|
||||
# Filter out profile enumerations from WGL_ARB_create_context
|
||||
grep -v "_PROFILE_" $1/WGL_ARB_create_context > tmp
|
||||
mv tmp $1/WGL_ARB_create_context
|
||||
|
||||
# Filter only profile related enumerations for WGL_ARB_create_context_profile
|
||||
head -n4 $1/WGL_ARB_create_context_profile > tmp
|
||||
grep "_PROFILE_" $1/WGL_ARB_create_context_profile >> tmp
|
||||
mv tmp $1/WGL_ARB_create_context_profile
|
||||
|
||||
# add missing function to GLX_NV_copy_image
|
||||
cat >> $1/GLX_NV_copy_image <<EOT
|
||||
void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth)
|
||||
EOT
|
||||
|
||||
# add missing function to WGL_NV_copy_image
|
||||
cat >> $1/WGL_NV_copy_image <<EOT
|
||||
BOOL wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth)
|
||||
EOT
|
||||
|
||||
# Filter glProgramUniform from GL_EXT_separate_shader_objects
|
||||
cat $1/GL_EXT_separate_shader_objects | grep -v "glProgramUniform" | grep -v "glProgramParameteri" > tmp
|
||||
mv tmp $1/GL_EXT_separate_shader_objects
|
||||
|
||||
# Filter out EXT functions from GL_ARB_viewport_array
|
||||
grep -v "EXT" $1/GL_ARB_viewport_array > tmp
|
||||
mv tmp $1/GL_ARB_viewport_array
|
||||
|
||||
# Additional enumerations for GL_NV_vertex_buffer_unified_memory
|
||||
# These are mentioned in GL_ARB_draw_indirect.txt
|
||||
|
||||
cat >> $1/GL_NV_vertex_buffer_unified_memory <<EOT
|
||||
GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
|
||||
GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
|
||||
GL_DRAW_INDIRECT_LENGTH_NV 0x8F42
|
||||
EOT
|
||||
|
||||
# Filter glGetPointerv from GL_ARB_debug_output
|
||||
# It's part of OpenGL 1.1, after all
|
||||
|
||||
grep -v "glGetPointerv" $1/GL_ARB_debug_output > tmp
|
||||
mv tmp $1/GL_ARB_debug_output
|
||||
|
||||
# Filter glGetPointerv from GL_EXT_vertex_array
|
||||
# It's part of OpenGL 1.1, after all
|
||||
|
||||
grep -v "glGetPointerv" $1/GL_EXT_vertex_array > tmp
|
||||
mv tmp $1/GL_EXT_vertex_array
|
||||
|
||||
# add typedef to GL_AMD_debug_output
|
||||
# parse_spec.pl can't parse typedefs from New Types section, but ought to
|
||||
cat >> $1/GL_AMD_debug_output <<EOT
|
||||
typedef void (GLAPIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, void* userParam)
|
||||
EOT
|
||||
|
||||
# add typedef to GL_ARB_debug_output
|
||||
# parse_spec.pl can't parse typedefs from New Types section, but ought to
|
||||
cat >> $1/GL_ARB_debug_output <<EOT
|
||||
typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
||||
EOT
|
||||
|
||||
# add typedef to GL_KHR_debug
|
||||
# parse_spec.pl can't parse typedefs from New Types section, but ought to
|
||||
cat >> $1/GL_KHR_debug <<EOT
|
||||
typedef void (GLAPIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
|
||||
EOT
|
||||
|
||||
# Remove glGetPointerv from GL_KHR_debug
|
||||
grep -v "glGetPointerv" $1/GL_KHR_debug > tmp
|
||||
mv tmp $1/GL_KHR_debug
|
||||
|
||||
# add typedefs to GL_ARB_cl_event
|
||||
# parse_spec.pl can't parse typedefs from New Types section, but ought to
|
||||
cat >> $1/GL_ARB_cl_event <<EOT
|
||||
typedef struct _cl_context *cl_context
|
||||
typedef struct _cl_event *cl_event
|
||||
EOT
|
||||
|
||||
# Filter out EXT functions from GL_ARB_gpu_shader_fp64
|
||||
grep -v 'EXT ' $1/GL_ARB_gpu_shader_fp64 > tmp
|
||||
mv tmp $1/GL_ARB_gpu_shader_fp64
|
||||
|
||||
# add missing functions to GL_EXT_direct_state_access (GL_ARB_gpu_shader_fp64 related)
|
||||
cat >> $1/GL_EXT_direct_state_access <<EOT
|
||||
void glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x)
|
||||
void glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y)
|
||||
void glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z)
|
||||
void glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
|
||||
void glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
|
||||
void glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
|
||||
void glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
|
||||
void glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
|
||||
void glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
void glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
|
||||
EOT
|
||||
|
||||
# add missing functions to GL_EXT_direct_state_access (GL_ARB_instanced_arrays related)
|
||||
# https://sourceforge.net/p/glew/bugs/242/
|
||||
cat >> $1/GL_EXT_direct_state_access <<EOT
|
||||
void glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor)
|
||||
EOT
|
||||
|
||||
# Filter out GL_UNSIGNED_INT and GL_FLOAT from GL_AMD_performance_monitor
|
||||
grep -v 'GL_UNSIGNED_INT ' $1/GL_AMD_performance_monitor > tmp
|
||||
mv tmp $1/GL_AMD_performance_monitor
|
||||
grep -v 'GL_FLOAT ' $1/GL_AMD_performance_monitor > tmp
|
||||
mv tmp $1/GL_AMD_performance_monitor
|
||||
|
||||
# Filter out GL_STORAGE_CACHED_APPLE and GL_STORAGE_SHARED_APPLE from GL_APPLE_texture_range
|
||||
grep -v 'GL_STORAGE_CACHED_APPLE ' $1/GL_APPLE_texture_range > tmp
|
||||
mv tmp $1/GL_APPLE_texture_range
|
||||
grep -v 'GL_STORAGE_SHARED_APPLE ' $1/GL_APPLE_texture_range > tmp
|
||||
mv tmp $1/GL_APPLE_texture_range
|
||||
|
||||
# Filter out GL_RED from GL_ARB_texture_rg
|
||||
grep -v 'GL_RED ' $1/GL_ARB_texture_rg > tmp
|
||||
mv tmp $1/GL_ARB_texture_rg
|
||||
|
||||
# Filter out _EXT enums from GL_ARB_texture_storage
|
||||
grep -v '_EXT ' $1/GL_ARB_texture_storage > tmp
|
||||
mv tmp $1/GL_ARB_texture_storage
|
||||
|
||||
# Filter out TEXTURE_3D enums from GL_EXT_paletted_texture
|
||||
grep -v 'TEXTURE_3D' $1/GL_EXT_paletted_texture > tmp
|
||||
mv tmp $1/GL_EXT_paletted_texture
|
||||
|
||||
# Filter out GL_VERSION_1_1 enums from GL_AMD_stencil_operation_extended
|
||||
grep -v '0x150' $1/GL_AMD_stencil_operation_extended > tmp
|
||||
mv tmp $1/GL_AMD_stencil_operation_extended
|
||||
|
||||
# Filter out from GL_APPLE_ycbcr_422
|
||||
grep -v 'GL_UNSIGNED_SHORT_8_8_APPLE' $1/GL_APPLE_ycbcr_422 > tmp
|
||||
mv tmp $1/GL_APPLE_ycbcr_422
|
||||
grep -v 'GL_UNSIGNED_SHORT_8_8_REV_APPLE' $1/GL_APPLE_ycbcr_422 > tmp
|
||||
mv tmp $1/GL_APPLE_ycbcr_422
|
||||
|
||||
# Filter out GL_FRAGMENT_DEPTH_EXT from GL_EXT_light_texture
|
||||
grep -v 'GL_FRAGMENT_DEPTH_EXT' $1/GL_EXT_light_texture > tmp
|
||||
mv tmp $1/GL_EXT_light_texture
|
||||
|
||||
# Filter out GL_MULTISAMPLE_BIT_EXT from GL_SGIS_multisample
|
||||
grep -v 'GL_MULTISAMPLE_BIT_EXT' $1/GL_SGIS_multisample > tmp
|
||||
mv tmp $1/GL_SGIS_multisample
|
||||
|
||||
# Filter out GL_COMPRESSED_RGB_S3TC_DXT1_EXT from GL_EXT_texture_compression_dxt1
|
||||
grep -v 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT' $1/GL_EXT_texture_compression_dxt1 > tmp
|
||||
mv tmp $1/GL_EXT_texture_compression_dxt1
|
||||
|
||||
# Filter out GL_COMPRESSED_RGBA_S3TC_DXT1_EXT from GL_EXT_texture_compression_dxt1
|
||||
grep -v 'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT' $1/GL_EXT_texture_compression_dxt1 > tmp
|
||||
mv tmp $1/GL_EXT_texture_compression_dxt1
|
||||
|
||||
# Append GLfixed to GL_ARB_ES2_compatibility
|
||||
# Probably ought to be explicitly mentioned in the spec language
|
||||
|
||||
cat >> $1/GL_ARB_ES2_compatibility <<EOT
|
||||
typedef int GLfixed
|
||||
EOT
|
||||
|
||||
# Append GLclampx to GL_REGAL_ES1_0_compatibility
|
||||
# Probably ought to be explicitly mentioned in the spec language
|
||||
|
||||
cat >> $1/GL_REGAL_ES1_0_compatibility <<EOT
|
||||
typedef int GLclampx
|
||||
EOT
|
||||
|
||||
# Append GLLOGPROCREGAL to GL_REGAL_log
|
||||
# Probably ought to be explicitly mentioned in the spec language
|
||||
|
||||
cat >> $1/GL_REGAL_log <<EOT
|
||||
typedef void (APIENTRY *LOGPROCREGAL)(GLenum stream, GLsizei length, const GLchar *message, void *context)
|
||||
EOT
|
||||
|
||||
# Fixup LOGPROCREGAL -> GLLOGPROCREGAL
|
||||
perl -e 's/LOGPROCREGAL/GLLOGPROCREGAL/g' -pi $1/GL_REGAL_log
|
||||
|
||||
# Filter out GL_BYTE from GL_OES_byte_coordinates
|
||||
grep -v 'GL_BYTE' $1/GL_OES_byte_coordinates > tmp
|
||||
mv tmp $1/GL_OES_byte_coordinates
|
||||
|
||||
# Filter out fp64 (not widely supported) from GL_EXT_direct_state_access
|
||||
egrep -v 'glProgramUniform.*[1234]d[v]?EXT' $1/GL_EXT_direct_state_access > tmp
|
||||
mv tmp $1/GL_EXT_direct_state_access
|
||||
|
||||
# Filter out all enums from GL_ANGLE_depth_texture
|
||||
grep -v '0x' $1/GL_ANGLE_depth_texture > tmp
|
||||
mv tmp $1/GL_ANGLE_depth_texture
|
||||
|
||||
# Filter out GL_NONE enum from GL_ANGLE_depth_texture
|
||||
grep -v 'GL_NONE' $1/GL_ANGLE_texture_usage > tmp
|
||||
mv tmp $1/GL_ANGLE_texture_usage
|
||||
|
||||
# Fixup REGAL and ANGLE urls
|
||||
|
||||
for i in $1/GL_REGAL_*; do perl -e 's#http://www.opengl.org/registry/specs/REGAL/.*#https://github.com/p3/regal/tree/master/doc/extensions#g' -pi $i; done
|
||||
for i in $1/GL_ANGLE_*; do perl -e 's#http://www.opengl.org/registry/specs/ANGLE/.*#https://code.google.com/p/angleproject/source/browse/\#git%2Fextensions#g' -pi $i; done
|
||||
|
||||
# Filter out GL_NV_blend_equation_advanced_coherent enums and functions
|
||||
head -n4 $1/GL_NV_blend_equation_advanced_coherent > tmp
|
||||
mv tmp $1/GL_NV_blend_equation_advanced_coherent
|
||||
|
||||
# Filter out GL_AMD_gpu_shader_int64 enums and functions
|
||||
head -n4 $1/GL_AMD_gpu_shader_int64 > tmp
|
||||
mv tmp $1/GL_AMD_gpu_shader_int64
|
||||
|
||||
# Filter out GL_NO_ERROR enum and glGetGraphicsResetStatus from GL_KHR_robustness
|
||||
grep -v 'GL_NO_ERROR' $1/GL_KHR_robustness |
|
||||
grep -v 'glGetGraphicsResetStatus' > tmp
|
||||
mv tmp $1/GL_KHR_robustness
|
||||
|
||||
# Filter out all enums from GL_KHR_blend_equation_advanced_coherent
|
||||
grep -v '0x' $1/GL_KHR_blend_equation_advanced_coherent > tmp
|
||||
mv tmp $1/GL_KHR_blend_equation_advanced_coherent
|
||||
|
||||
# Filter out glBlendBarrierKHR enum from GL_KHR_blend_equation_advanced_coherent
|
||||
grep -v 'glBlendBarrierKHR' $1/GL_KHR_blend_equation_advanced_coherent > tmp
|
||||
mv tmp $1/GL_KHR_blend_equation_advanced_coherent
|
||||
|
||||
# Filter out GL_NONE enum from GL_KHR_context_flush_control
|
||||
grep -v 'GL_NONE' $1/GL_KHR_context_flush_control > tmp
|
||||
mv tmp $1/GL_KHR_context_flush_control
|
||||
|
||||
# Filter out CoverageModulation from NV_framebuffer_mixed_samples
|
||||
# Superset of EXT_raster_multisample
|
||||
|
||||
grep -v "CoverageModulation" $1/GL_NV_framebuffer_mixed_samples > tmp
|
||||
mv tmp $1/GL_NV_framebuffer_mixed_samples
|
||||
|
||||
# Filter out glRasterSamplesEXT from NV_framebuffer_mixed_samples
|
||||
# Superset of EXT_raster_multisample
|
||||
|
||||
grep -v "RasterSamplesEXT" $1/GL_NV_framebuffer_mixed_samples > tmp
|
||||
mv tmp $1/GL_NV_framebuffer_mixed_samples
|
||||
|
||||
# Filter out glNamedBufferStorageEXT from GL_ARB_buffer_storage
|
||||
|
||||
grep -v "glNamedBufferStorageEXT" $1/GL_ARB_buffer_storage > tmp
|
||||
mv tmp $1/GL_ARB_buffer_storage
|
||||
|
||||
# Filter out glFramebufferTextureEXT from GL_EXT_geometry_point_size
|
||||
# and GL_EXT_geometry_shader
|
||||
|
||||
grep -v "glFramebufferTextureEXT" $1/GL_EXT_geometry_point_size > tmp
|
||||
mv tmp $1/GL_EXT_geometry_point_size
|
||||
|
||||
grep -v "glFramebufferTextureEXT" $1/GL_EXT_geometry_shader > tmp
|
||||
mv tmp $1/GL_EXT_geometry_shader
|
||||
|
||||
# Filter out glBindFragDataLocationEXT from GL_EXT_blend_func_extended
|
||||
|
||||
grep -v "glBindFragDataLocationEXT" $1/GL_EXT_blend_func_extended > tmp
|
||||
mv tmp $1/GL_EXT_blend_func_extended
|
||||
|
||||
# Filter out glDrawArraysInstancedEXT and glDrawElementsInstancedEXT from GL_EXT_blend_func_extended
|
||||
|
||||
grep -v "glDrawArraysInstancedEXT" $1/GL_EXT_instanced_arrays > tmp
|
||||
mv tmp $1/GL_EXT_instanced_arrays
|
||||
|
||||
grep -v "glDrawElementsInstancedEXT" $1/GL_EXT_instanced_arrays > tmp
|
||||
mv tmp $1/GL_EXT_instanced_arrays
|
||||
|
||||
# Filter out glRenderbufferStorageMultisampleEXT from GL_EXT_multisampled_render_to_texture
|
||||
|
||||
grep -v "glRenderbufferStorageMultisampleEXT" $1/GL_EXT_multisampled_render_to_texture > tmp
|
||||
mv tmp $1/GL_EXT_multisampled_render_to_texture
|
||||
|
||||
# Filter out glTexturePageCommitmentEXT from GL_ARB_sparse_texture
|
||||
|
||||
grep -v "glTexturePageCommitmentEXT" $1/GL_ARB_sparse_texture > tmp
|
||||
mv tmp $1/GL_ARB_sparse_texture
|
||||
|
||||
# Filter out TextureStorage* from GL_ARB_texture_storage
|
||||
|
||||
grep -v "TextureStorage" $1/GL_ARB_texture_storage > tmp
|
||||
mv tmp $1/GL_ARB_texture_storage
|
||||
|
||||
# Filter out functions from GL_EXT_occlusion_query_boolean
|
||||
|
||||
grep -v "(" $1/GL_EXT_occlusion_query_boolean > tmp
|
||||
mv tmp $1/GL_EXT_occlusion_query_boolean
|
||||
|
||||
# Filter out duplicate enums from GL_EXT_protected_textures
|
||||
|
||||
cat $1/GL_EXT_protected_textures | grep -v GL_TRUE | grep -v GL_FALSE > tmp
|
||||
mv tmp $1/GL_EXT_protected_textures
|
||||
|
||||
# Filter out duplicate enums from GL_EXT_robustness
|
||||
|
||||
cat $1/GL_EXT_robustness | grep -v GL_NO_ERROR > tmp
|
||||
mv tmp $1/GL_EXT_robustness
|
||||
|
||||
# Filter GL_EXT_shader_framebuffer_fetch_non_coherent
|
||||
|
||||
grep -v "FramebufferFetchBarrierEXT" $1/GL_EXT_shader_framebuffer_fetch_non_coherent > tmp
|
||||
mv tmp $1/GL_EXT_shader_framebuffer_fetch_non_coherent
|
||||
|
||||
# Filter GL_EXT_tessellation_shader
|
||||
|
||||
grep -v "PatchParameteriEXT" $1/GL_EXT_tessellation_shader > tmp
|
||||
mv tmp $1/GL_EXT_tessellation_shader
|
||||
|
||||
# Filter GL_EXT_texture_buffer
|
||||
|
||||
grep -v "TexBuffer" $1/GL_EXT_texture_buffer > tmp
|
||||
mv tmp $1/GL_EXT_texture_buffer
|
||||
|
||||
# Filter GL_EXT_texture_border_clamp
|
||||
|
||||
grep -v "TexParameter" $1/GL_EXT_texture_border_clamp > tmp
|
||||
mv tmp $1/GL_EXT_texture_border_clamp
|
||||
|
||||
# Filter GL_EXT_disjoint_timer_query
|
||||
|
||||
cat $1/GL_EXT_disjoint_timer_query | grep -v GetQueryObjecti64v | grep -v GetQueryObjectui64v > tmp
|
||||
mv tmp $1/GL_EXT_disjoint_timer_query
|
||||
|
||||
# Filter GL_NV_read_buffer_front
|
||||
|
||||
grep -v "ReadBufferNV" $1/GL_NV_read_buffer_front > tmp
|
||||
mv tmp $1/GL_NV_read_buffer_front
|
||||
|
||||
# Append GLVULKANPROCNV to GL_NV_draw_vulkan_image
|
||||
# Probably ought to be explicitly mentioned in the spec language
|
||||
|
||||
cat >> $1/GL_NV_draw_vulkan_image <<EOT
|
||||
typedef void (APIENTRY *GLVULKANPROCNV)(void)
|
||||
EOT
|
||||
|
||||
# GLU extensions are not relevant here
|
||||
rm -f $1/GL_GLU_*
|
||||
|
||||
# Not complete
|
||||
rm -f $1/GL_SGIX_color_type
|
||||
|
||||
# clean up
|
||||
rm -f patterns $1/*.bak
|
20
vendor/glew-cmake-2.2.0/auto/bin/filter_gles_ext.sh
vendored
Normal file
20
vendor/glew-cmake-2.2.0/auto/bin/filter_gles_ext.sh
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
##
|
||||
## Parameters:
|
||||
##
|
||||
## $1: Extensions directory
|
||||
## $2: Registry directory
|
||||
## $3: The black list
|
||||
|
||||
set -e
|
||||
|
||||
# clean up
|
||||
rm -f $1/*.bak
|
38
vendor/glew-cmake-2.2.0/auto/bin/filter_spec.py
vendored
Normal file
38
vendor/glew-cmake-2.2.0/auto/bin/filter_spec.py
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import re
|
||||
|
||||
section = re.compile('^(Name|Name Strings?|Contact|Notice|Number|Dependencies|Overview|Issues|IP Status|Status|Version|New Procedures and Functions|New Tokens|Additions to .*|Changes to .*|Modifications to .*|Add new Section .*)\s*$')
|
||||
token = re.compile('^\s+(([A-Z0-9][A-Z0-9_x]*):?\s+((?:0x)?[0-9A-F]+)([^\?]*))?\s*$')
|
||||
match = [ 'Name', 'Name String', 'Contact', 'Notice', 'Name Strings', 'Version', 'Number', 'Dependencies', 'New Procedures and Functions', 'New Tokens']
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
|
||||
parser = OptionParser('usage: %prog [options] [SOURCES...]')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
for i in args:
|
||||
lines = open(i).readlines()
|
||||
f = open(i,'w')
|
||||
|
||||
# Keep track of the current section as we iterate over the input
|
||||
current = ''
|
||||
for j in lines:
|
||||
|
||||
# Detect the start of a new section
|
||||
m = section.match(j)
|
||||
if m:
|
||||
current = m.group(1).strip()
|
||||
if current in match:
|
||||
print >>f, j,
|
||||
continue
|
||||
|
||||
if current=='New Tokens':
|
||||
if token.match(j):
|
||||
print >>f, j,
|
||||
elif current in match:
|
||||
print >>f, j,
|
||||
|
224
vendor/glew-cmake-2.2.0/auto/bin/make.pl
vendored
Normal file
224
vendor/glew-cmake-2.2.0/auto/bin/make.pl
vendored
Normal file
@ -0,0 +1,224 @@
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
my %regex = (
|
||||
extname => qr/^[A-Z][A-Za-z0-9_]+$/,
|
||||
exturl => qr/^http.+$/,
|
||||
function => qr/^(.+) ([a-z][a-z0-9_]*) \((.*)\)$/i,
|
||||
token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+(u(ll)?)?|[A-Z][A-Z0-9_]*)$/,
|
||||
type => qr/^typedef\s+(.+)$/,
|
||||
exact => qr/.*;$/,
|
||||
);
|
||||
|
||||
# prefix function name with glew
|
||||
sub prefixname($)
|
||||
{
|
||||
my $name = $_[0];
|
||||
$name =~ s/^(.*?)gl/__$1glew/;
|
||||
return $name;
|
||||
}
|
||||
|
||||
# prefix function name with glew
|
||||
sub prefix_varname($)
|
||||
{
|
||||
my $name = $_[0];
|
||||
$name =~ s/^(.*?)GL(X*?)EW/__$1GL$2EW/;
|
||||
return $name;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
sub make_exact($)
|
||||
{
|
||||
my $exact = $_[0];
|
||||
$exact =~ s/(; |{)/$1\n/g;
|
||||
return $exact;
|
||||
}
|
||||
|
||||
sub make_separator($)
|
||||
{
|
||||
my $extname = $_[0];
|
||||
my $l = length $extname;
|
||||
my $s = (71 - $l)/2;
|
||||
print "/* ";
|
||||
my $j = 3;
|
||||
for (my $i = 0; $i < $s; $i++)
|
||||
{
|
||||
print "-";
|
||||
$j++;
|
||||
}
|
||||
print " $_[0] ";
|
||||
$j += $l + 2;
|
||||
while ($j < 76)
|
||||
{
|
||||
print "-";
|
||||
$j++;
|
||||
}
|
||||
print " */\n\n";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
sub parse_ext($)
|
||||
{
|
||||
my $filename = shift;
|
||||
my %functions = ();
|
||||
my %tokens = ();
|
||||
my @reuse = (); # Extensions to reuse
|
||||
my @types = ();
|
||||
my @exacts = ();
|
||||
my $extname = ""; # Full extension name GL_FOO_extension
|
||||
my $exturl = ""; # Info URL
|
||||
my $extstring = ""; # Relevant extension string
|
||||
|
||||
open EXT, "<$filename" or return;
|
||||
|
||||
# As of GLEW 1.14.0 the first four lines _must_ be
|
||||
# the extension name, the URL and the GL extension
|
||||
# string (which might be different to the name),
|
||||
# and the reused extensions
|
||||
#
|
||||
# For example GL_NV_geometry_program4 is available
|
||||
# iff GL_NV_gpu_program4 appears in the extension
|
||||
# string.
|
||||
#
|
||||
# For core OpenGL versions, the third line should
|
||||
# be blank.
|
||||
#
|
||||
# If the URL is unknown, the second line should be
|
||||
# blank.
|
||||
|
||||
$extname = readline(*EXT);
|
||||
$exturl = readline(*EXT);
|
||||
$extstring = readline(*EXT);
|
||||
@reuse = split(" ", readline(*EXT));
|
||||
|
||||
chomp($extname);
|
||||
chomp($exturl);
|
||||
chomp($extstring);
|
||||
|
||||
while(<EXT>)
|
||||
{
|
||||
chomp;
|
||||
if (s/^\s+//)
|
||||
{
|
||||
if (/$regex{exact}/)
|
||||
{
|
||||
push @exacts, $_;
|
||||
}
|
||||
elsif (/$regex{type}/)
|
||||
{
|
||||
push @types, $_;
|
||||
}
|
||||
elsif (/$regex{token}/)
|
||||
{
|
||||
my ($name, $value) = ($1, $2);
|
||||
$tokens{$name} = $value;
|
||||
}
|
||||
elsif (/$regex{function}/)
|
||||
{
|
||||
my ($return, $name, $parms) = ($1, $2, $3);
|
||||
$functions{$name} = {
|
||||
rtype => $return,
|
||||
parms => $parms,
|
||||
};
|
||||
} else {
|
||||
print STDERR "'$_' matched no regex.\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close EXT;
|
||||
|
||||
return ($extname, $exturl, $extstring, \@reuse, \@types, \%tokens, \%functions, \@exacts);
|
||||
}
|
||||
|
||||
sub output_tokens($$)
|
||||
{
|
||||
my ($tbl, $fnc) = @_;
|
||||
if (keys %{$tbl})
|
||||
{
|
||||
local $, = "\n";
|
||||
print "\n";
|
||||
print map { &{$fnc}($_, $tbl->{$_}) } sort {
|
||||
if (${$tbl}{$a} eq ${$tbl}{$b}) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
if (${$tbl}{$a} =~ /_/) {
|
||||
if (${$tbl}{$b} =~ /_/) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
} else {
|
||||
if (${$tbl}{$b} =~ /_/) {
|
||||
1
|
||||
} else {
|
||||
if (hex ${$tbl}{$a} eq hex ${$tbl}{$b}) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
hex ${$tbl}{$a} <=> hex ${$tbl}{$b}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} keys %{$tbl};
|
||||
print "\n";
|
||||
} else {
|
||||
print STDERR "no keys in table!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub output_types($$)
|
||||
{
|
||||
my ($tbl, $fnc) = @_;
|
||||
if (scalar @{$tbl})
|
||||
{
|
||||
local $, = "\n";
|
||||
print "\n";
|
||||
print map { &{$fnc}($_) } sort @{$tbl};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub output_decls($$)
|
||||
{
|
||||
my ($tbl, $fnc) = @_;
|
||||
if (keys %{$tbl})
|
||||
{
|
||||
local $, = "\n";
|
||||
print "\n";
|
||||
print map { &{$fnc}($_, $tbl->{$_}) } sort keys %{$tbl};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub output_exacts($$)
|
||||
{
|
||||
my ($tbl, $fnc) = @_;
|
||||
if (scalar @{$tbl})
|
||||
{
|
||||
local $, = "\n";
|
||||
print "\n";
|
||||
print map { &{$fnc}($_) } sort @{$tbl};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub output_reuse($$)
|
||||
{
|
||||
my ($tbl, $fnc) = @_;
|
||||
if (scalar @{$tbl})
|
||||
{
|
||||
local $, = "\n";
|
||||
print "\n";
|
||||
print map { &{$fnc}($_) } sort @{$tbl};
|
||||
print "\n";
|
||||
}
|
||||
}
|
37
vendor/glew-cmake-2.2.0/auto/bin/make_def_fun.pl
vendored
Normal file
37
vendor/glew-cmake-2.2.0/auto/bin/make_def_fun.pl
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
# function pointer declaration
|
||||
sub make_pfn_decl($%)
|
||||
{
|
||||
return "PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . " = NULL;";
|
||||
}
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $type = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
output_decls($functions, \&make_pfn_decl);
|
||||
}
|
||||
}
|
33
vendor/glew-cmake-2.2.0/auto/bin/make_def_var.pl
vendored
Normal file
33
vendor/glew-cmake-2.2.0/auto/bin/make_def_var.pl
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $type = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
print "GLboolean " . prefix_varname($extvar) . " = GL_FALSE;\n";
|
||||
}
|
||||
}
|
48
vendor/glew-cmake-2.2.0/auto/bin/make_enable_index.pl
vendored
Normal file
48
vendor/glew-cmake-2.2.0/auto/bin/make_enable_index.pl
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
##
|
||||
## Make Extension-enabled Index
|
||||
##
|
||||
|
||||
my @extlist = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
print "/* Detected in the extension string or strings */\n";
|
||||
print "static GLboolean _glewExtensionString[" . scalar @extlist . "];\n";
|
||||
|
||||
print "/* Detected via extension string or experimental mode */\n";
|
||||
print "static GLboolean* _glewExtensionEnabled[] = {\n";;
|
||||
|
||||
foreach my $ext (sort { basename($a) cmp basename($b) } @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " &__$extvar,\n";
|
||||
print "#endif\n";
|
||||
}
|
||||
|
||||
print " NULL\n};\n\n";
|
||||
}
|
73
vendor/glew-cmake-2.2.0/auto/bin/make_header.pl
vendored
Normal file
73
vendor/glew-cmake-2.2.0/auto/bin/make_header.pl
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
# token
|
||||
sub make_define($$)
|
||||
{
|
||||
return "#define $_[0] $_[1]"
|
||||
}
|
||||
|
||||
# type declaration
|
||||
sub make_type($$)
|
||||
{
|
||||
return "@_;"
|
||||
}
|
||||
|
||||
# function pointer type declaration
|
||||
sub make_pfn_type($%)
|
||||
{
|
||||
our $api;
|
||||
return join(' ', "typedef", $_[1]->{rtype},
|
||||
"($api * PFN" . (uc $_[0]) . "PROC)",
|
||||
"(" . $_[1]->{parms} . ")") . ";";
|
||||
}
|
||||
|
||||
# function name alias
|
||||
sub make_pfn_alias($%)
|
||||
{
|
||||
our $type;
|
||||
return join(" ", "#define", $_[0], $type . "EW_GET_FUN(" . prefixname($_[0]) . ")")
|
||||
}
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $api = shift;
|
||||
our $type = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
|
||||
make_separator($extname);
|
||||
print "#ifndef $extname\n#define $extname 1\n";
|
||||
output_tokens($tokens, \&make_define);
|
||||
output_types($types, \&make_type);
|
||||
output_exacts($exacts, \&make_exact);
|
||||
output_decls($functions, \&make_pfn_type);
|
||||
output_decls($functions, \&make_pfn_alias);
|
||||
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
|
||||
print "\n#define $extvar " . $type . "EW_GET_VAR(" . prefix_varname($extvar) . ")\n";
|
||||
print "\n#endif /* $extname */\n\n";
|
||||
}
|
||||
}
|
57
vendor/glew-cmake-2.2.0/auto/bin/make_html.pl
vendored
Normal file
57
vendor/glew-cmake-2.2.0/auto/bin/make_html.pl
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
my $group = "";
|
||||
my $cur_group = "";
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
my $n = 1;
|
||||
print "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" align=\"center\">\n";
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
$cur_group = $extname;
|
||||
$cur_group =~ s/^(?:W?)GL(?:X?)_([A-Z0-9]+?)_.*$/$1/;
|
||||
$extname =~ s/^(?:W?)GL(?:X?)_(.*)$/$1/;
|
||||
if ($cur_group ne $group)
|
||||
{
|
||||
if ($group ne "")
|
||||
{
|
||||
print "<tr><td><br></td><td></td><td></td></tr>\n";
|
||||
}
|
||||
$group = $cur_group;
|
||||
}
|
||||
|
||||
{
|
||||
if ($exturl)
|
||||
{
|
||||
print "<tr><td class=\"num\">$n</td><td> </td><td><a href=\"$exturl\">$extname</a></td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr><td class=\"num\">$n</td><td> </td><td>$extname</td></tr>\n";
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
print "</table>\n"
|
||||
}
|
41
vendor/glew-cmake-2.2.0/auto/bin/make_index.pl
vendored
Normal file
41
vendor/glew-cmake-2.2.0/auto/bin/make_index.pl
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Basename;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
##
|
||||
## Make Index
|
||||
##
|
||||
## Output sorted array of extension strings for indexing into extension
|
||||
## enable/disable flags. This provides a way to convert an extension string
|
||||
## into an integer index.
|
||||
##
|
||||
|
||||
my @extlist = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort { basename($a) cmp basename($b) } @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " \"$extname\",\n";
|
||||
print "#endif\n";
|
||||
}
|
||||
}
|
71
vendor/glew-cmake-2.2.0/auto/bin/make_info.pl
vendored
Normal file
71
vendor/glew-cmake-2.2.0/auto/bin/make_info.pl
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
# function pointer definition
|
||||
sub make_pfn_info($%)
|
||||
{
|
||||
my $name = $_[0];
|
||||
return " glewInfoFunc(fi, \"$_[0]\", $name == NULL);";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
my $extpre = $extname;
|
||||
$extpre =~ s/(GLX|GLW|GL).*/$1/;
|
||||
$extpre = lc $extpre;
|
||||
|
||||
#make_separator($extname);
|
||||
print "#ifdef $extname\n\n";
|
||||
print "static void _glewInfo_$extname (void)\n{\n";
|
||||
|
||||
if (! %$functions)
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " GLboolean fi = ";
|
||||
}
|
||||
|
||||
if ($extvar =~ /VERSION/)
|
||||
{
|
||||
print "glewPrintExt(\"$extname\", $extvar, $extvar, $extvar);\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "glewPrintExt(\"$extname\", $extvar, $extpre" .
|
||||
"ewIsSupported(\"$extname\"), $extpre" .
|
||||
"ewGetExtension(\"$extstring\"));\n";
|
||||
}
|
||||
output_decls($functions, \&make_pfn_info);
|
||||
print "}\n\n";
|
||||
print "#endif /* $extname */\n\n";
|
||||
}
|
||||
}
|
49
vendor/glew-cmake-2.2.0/auto/bin/make_info_list.pl
vendored
Normal file
49
vendor/glew-cmake-2.2.0/auto/bin/make_info_list.pl
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
# function pointer definition
|
||||
sub make_pfn_def($%)
|
||||
{
|
||||
return "PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . " = NULL;";
|
||||
}
|
||||
|
||||
# function pointer definition
|
||||
sub make_init_call($%)
|
||||
{
|
||||
my $name = prefixname($_[0]);
|
||||
return " r = r || (" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $name . "\")) == NULL;";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " _glewInfo_$extname();\n";
|
||||
print "#endif /* $extname */\n";
|
||||
}
|
||||
}
|
61
vendor/glew-cmake-2.2.0/auto/bin/make_init.pl
vendored
Normal file
61
vendor/glew-cmake-2.2.0/auto/bin/make_init.pl
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
# function pointer definition
|
||||
sub make_pfn_def_init($%)
|
||||
{
|
||||
#my $name = prefixname($_[0]);
|
||||
return " r = ((" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $_[0] . "\")) == NULL) || r;";
|
||||
}
|
||||
|
||||
sub make_reuse_call($%)
|
||||
{
|
||||
return " r = _glewInit_" . $_[0] . "() || r;";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $type = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
#make_separator($extname);
|
||||
my $extvar = $extname;
|
||||
my $extvardef = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
if (keys %$functions or keys @$reuse)
|
||||
{
|
||||
print "#ifdef $extname\n\n";
|
||||
print "static GLboolean _glewInit_$extname ()\n{\n GLboolean r = GL_FALSE;\n";
|
||||
output_reuse($reuse, \&make_reuse_call);
|
||||
output_decls($functions, \&make_pfn_def_init);
|
||||
print "\n return r;\n}\n\n";
|
||||
print "#endif /* $extname */\n\n";
|
||||
}
|
||||
}
|
||||
}
|
45
vendor/glew-cmake-2.2.0/auto/bin/make_initd.pl
vendored
Normal file
45
vendor/glew-cmake-2.2.0/auto/bin/make_initd.pl
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
## Output declarations for the _glewInit_[extension] functions defined
|
||||
## by make_init.pl script. These are necessary for for initializers to
|
||||
## call each other, such as a core GL 3 context that depends on certain
|
||||
## extensions.
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $type = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) =
|
||||
parse_ext($ext);
|
||||
|
||||
#print "#ifdef $extname\n\n";
|
||||
if (keys %$functions)
|
||||
{
|
||||
print "static GLboolean _glewInit_$extname ();\n";
|
||||
}
|
||||
#print "#endif /* $extname */\n\n";
|
||||
}
|
||||
}
|
75
vendor/glew-cmake-2.2.0/auto/bin/make_list.pl
vendored
Normal file
75
vendor/glew-cmake-2.2.0/auto/bin/make_list.pl
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
# function pointer definition
|
||||
sub make_init_call($%)
|
||||
{
|
||||
my $name = prefixname($_[0]);
|
||||
return " r = r || (" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $name . "\")) == NULL;";
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
|
||||
my $extpre = $extname;
|
||||
$extpre =~ s/^(W?E?)GL(X?).*$/\l$1gl\l$2ew/;
|
||||
|
||||
#my $pextvar = prefix_varname($extvar);
|
||||
|
||||
if (length($extstring) && $extstring !~ /^GL_/ || keys %$functions)
|
||||
{
|
||||
print "#ifdef $extname\n";
|
||||
}
|
||||
|
||||
if (length($extstring) && $extstring !~ /^GL_/)
|
||||
{
|
||||
print " " . $extvar . " = _glewSearchExtension(\"$extstring\", extStart, extEnd);\n";
|
||||
}
|
||||
|
||||
if (keys %$functions)
|
||||
{
|
||||
if ($extname =~ /WGL_.*/)
|
||||
{
|
||||
print " if (glewExperimental || " . $extvar . "|| crippled) " . $extvar . "= !_glewInit_$extname();\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname();\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (length($extstring) && $extstring !~ /^GL_/ || keys %$functions)
|
||||
{
|
||||
print "#endif /* $extname */\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
46
vendor/glew-cmake-2.2.0/auto/bin/make_list2.pl
vendored
Normal file
46
vendor/glew-cmake-2.2.0/auto/bin/make_list2.pl
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
# Extensions that depend on others can be enabled once we know
|
||||
# if the one it depends on, is enabled.
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
|
||||
if ($extname ne $extstring && length($extstring))
|
||||
{
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
|
||||
my $parent = $extstring;
|
||||
$parent =~ s/GL(X*)_/GL$1EW_/;
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " $extvar = $parent;\n";
|
||||
print "#endif /* $extname */\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
55
vendor/glew-cmake-2.2.0/auto/bin/make_str.pl
vendored
Normal file
55
vendor/glew-cmake-2.2.0/auto/bin/make_str.pl
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
my $curexttype = "";
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
my $exttype = $extname;
|
||||
$exttype =~ s/(W?E?)GL(X?)_(.*?_)(.*)/$3/;
|
||||
my $extrem = $extname;
|
||||
$extrem =~ s/(W?E?)GL(X?)_(.*?_)(.*)/$4/;
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/(W?E?)GL(X?)_/$1GL$2EW_/;
|
||||
if(!($exttype =~ $curexttype))
|
||||
{
|
||||
if(length($curexttype) > 0)
|
||||
{
|
||||
print " }\n";
|
||||
}
|
||||
print " if (_glewStrSame2(&pos, &len, (const GLubyte*)\"$exttype\", " . length($exttype) . "))\n";
|
||||
print " {\n";
|
||||
$curexttype = $exttype;
|
||||
}
|
||||
print "#ifdef $extname\n";
|
||||
print " if (_glewStrSame3(&pos, &len, (const GLubyte*)\"$extrem\", ". length($extrem) . "))\n";
|
||||
#print " return $extvar;\n";
|
||||
print " {\n";
|
||||
print " ret = $extvar;\n";
|
||||
print " continue;\n";
|
||||
print " }\n";
|
||||
print "#endif\n";
|
||||
}
|
||||
|
||||
print " }\n";
|
||||
}
|
38
vendor/glew-cmake-2.2.0/auto/bin/make_struct_fun.pl
vendored
Normal file
38
vendor/glew-cmake-2.2.0/auto/bin/make_struct_fun.pl
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
# function pointer declaration
|
||||
sub make_pfn_decl($%)
|
||||
{
|
||||
our $export;
|
||||
return $export . " PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . ";";
|
||||
}
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $export = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
output_decls($functions, \&make_pfn_decl);
|
||||
}
|
||||
}
|
33
vendor/glew-cmake-2.2.0/auto/bin/make_struct_var.pl
vendored
Normal file
33
vendor/glew-cmake-2.2.0/auto/bin/make_struct_var.pl
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use lib '.';
|
||||
do 'bin/make.pl';
|
||||
|
||||
my @extlist = ();
|
||||
my %extensions = ();
|
||||
|
||||
our $export = shift;
|
||||
|
||||
if (@ARGV)
|
||||
{
|
||||
@extlist = @ARGV;
|
||||
|
||||
foreach my $ext (sort @extlist)
|
||||
{
|
||||
my ($extname, $exturl, $extstring, $reuse, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
||||
my $extvar = $extname;
|
||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||
print $export . " GLboolean " . prefix_varname($extvar) . ";\n";
|
||||
}
|
||||
}
|
410
vendor/glew-cmake-2.2.0/auto/bin/parse_spec.pl
vendored
Normal file
410
vendor/glew-cmake-2.2.0/auto/bin/parse_spec.pl
vendored
Normal file
@ -0,0 +1,410 @@
|
||||
#!/usr/bin/env perl
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub compile_regex
|
||||
{
|
||||
my $regex = join('', @_);
|
||||
return qr/$regex/
|
||||
}
|
||||
|
||||
my @sections = (
|
||||
"Name",
|
||||
"Name Strings?",
|
||||
"New Procedures and Functions",
|
||||
"New Tokens.*", # Optional (GL/WGL/GLX/...) suffix
|
||||
"Additions to Chapter.*",
|
||||
);
|
||||
|
||||
my %typemap = (
|
||||
bitfield => "GLbitfield",
|
||||
boolean => "GLboolean",
|
||||
# fsck up in EXT_vertex_array
|
||||
Boolean => "GLboolean",
|
||||
byte => "GLbyte",
|
||||
clampd => "GLclampd",
|
||||
clampf => "GLclampf",
|
||||
double => "GLdouble",
|
||||
enum => "GLenum",
|
||||
# Intel fsck up
|
||||
Glenum => "GLenum",
|
||||
float => "GLfloat",
|
||||
half => "GLhalf",
|
||||
int => "GLint",
|
||||
short => "GLshort",
|
||||
sizei => "GLsizei",
|
||||
ubyte => "GLubyte",
|
||||
uint => "GLuint",
|
||||
ushort => "GLushort",
|
||||
DMbuffer => "void *",
|
||||
# Nvidia video output fsck up
|
||||
int64EXT => "GLint64EXT",
|
||||
uint64EXT=> "GLuint64EXT",
|
||||
|
||||
# ARB VBO introduces these.
|
||||
|
||||
sizeiptr => "GLsizeiptr",
|
||||
intptr => "GLintptr",
|
||||
sizeiptrARB => "GLsizeiptrARB",
|
||||
intptrARB => "GLintptrARB",
|
||||
|
||||
# ARB shader objects introduces these, charARB is at least 8 bits,
|
||||
# handleARB is at least 32 bits
|
||||
charARB => "GLcharARB",
|
||||
handleARB => "GLhandleARB",
|
||||
|
||||
char => "GLchar",
|
||||
|
||||
# OpenGL 3.2 and GL_ARB_sync
|
||||
|
||||
int64 => "GLint64",
|
||||
uint64 => "GLuint64",
|
||||
sync => "GLsync",
|
||||
|
||||
# GL_EXT_EGL_image_storage
|
||||
|
||||
eglImageOES => "GLeglImageOES",
|
||||
|
||||
# AMD_debug_output
|
||||
|
||||
DEBUGPROCAMD => "GLDEBUGPROCAMD",
|
||||
|
||||
# ARB_debug_output
|
||||
|
||||
DEBUGPROCARB => "GLDEBUGPROCARB",
|
||||
|
||||
# KHR_debug
|
||||
|
||||
DEBUGPROC => "GLDEBUGPROC",
|
||||
|
||||
VULKANPROCNV => "GLVULKANPROCNV",
|
||||
|
||||
vdpauSurfaceNV => "GLvdpauSurfaceNV",
|
||||
|
||||
# GLX 1.3 defines new types which might not be available at compile time
|
||||
|
||||
#GLXFBConfig => "void*",
|
||||
#GLXFBConfigID => "XID",
|
||||
#GLXContextID => "XID",
|
||||
#GLXWindow => "XID",
|
||||
#GLXPbuffer => "XID",
|
||||
|
||||
# Weird stuff to some SGIX extension
|
||||
|
||||
#GLXFBConfigSGIX => "void*",
|
||||
#GLXFBConfigIDSGIX => "XID",
|
||||
|
||||
);
|
||||
|
||||
my %voidtypemap = (
|
||||
void => "GLvoid",
|
||||
);
|
||||
|
||||
my %taboo_tokens = (
|
||||
GL_ZERO => 1,
|
||||
);
|
||||
|
||||
# list of function definitions to be ignored, unless they are being defined in
|
||||
# the given spec. This is an ugly hack around the fact that people writing
|
||||
# spec files seem to shut down all brain activity while they are at this task.
|
||||
#
|
||||
# This will be moved to its own file eventually.
|
||||
#
|
||||
# (mem, 2003-03-19)
|
||||
|
||||
my %fnc_ignore_list = (
|
||||
"BindProgramARB" => "ARB_vertex_program",
|
||||
"ColorSubTableEXT" => "EXT_color_subtable",
|
||||
"DeleteProgramsARB" => "ARB_vertex_program",
|
||||
"GenProgramsARB" => "ARB_vertex_program",
|
||||
"GetProgramEnvParameterdvARB" => "ARB_vertex_program",
|
||||
"GetProgramEnvParameterfvARB" => "ARB_vertex_program",
|
||||
"GetProgramLocalParameterdvARB" => "ARB_vertex_program",
|
||||
"GetProgramLocalParameterfvARB" => "ARB_vertex_program",
|
||||
"GetProgramStringARB" => "ARB_vertex_program",
|
||||
"GetProgramivARB" => "ARB_vertex_program",
|
||||
"IsProgramARB" => "ARB_vertex_program",
|
||||
"ProgramEnvParameter4dARB" => "ARB_vertex_program",
|
||||
"ProgramEnvParameter4dvARB" => "ARB_vertex_program",
|
||||
"ProgramEnvParameter4fARB" => "ARB_vertex_program",
|
||||
"ProgramEnvParameter4fvARB" => "ARB_vertex_program",
|
||||
"ProgramLocalParameter4dARB" => "ARB_vertex_program",
|
||||
"ProgramLocalParameter4dvARB" => "ARB_vertex_program",
|
||||
"ProgramLocalParameter4fARB" => "ARB_vertex_program",
|
||||
"ProgramLocalParameter4fvARB" => "ARB_vertex_program",
|
||||
"ProgramStringARB" => "ARB_vertex_program",
|
||||
"EGLImageTargetTexture2DOES" => "OES_EGL_image",
|
||||
"FramebufferTextureOES" => "GL_OES_geometry_shader",
|
||||
"PatchParameteriOES" => "GL_OES_tessellation_shader",
|
||||
"PointSizePointerOES" => "GL_OES_point_size_array",
|
||||
"LockArraysEXT" => "EXT_compiled_vertex_array",
|
||||
"UnlockArraysEXT" => "EXT_compiled_vertex_array",
|
||||
"CoverageMaskNV" => "NV_coverage_sample",
|
||||
"CoverageOperationNV" => "NV_coverage_sample",
|
||||
"glXCreateContextAttribsARB" => "ARB_create_context_profile",
|
||||
"wglCreateContextAttribsARB" => "WGL_ARB_create_context_profile",
|
||||
);
|
||||
|
||||
my %regex = (
|
||||
eofnc => qr/(?:\);?$|^$)/, # )$ | );$ | ^$
|
||||
extname => qr/^[A-Z][A-Za-z0-9_]+$/,
|
||||
none => qr/^\(none\)$/,
|
||||
function => qr/^(.+) ([a-z][a-z0-9_]*) \((.*)\)$/i,
|
||||
prefix => qr/^(?:[aw]?gl|glX|egl)/, # gl | agl | wgl | glX
|
||||
tprefix => qr/^(?:[AW]?GL|GLX|EGL)_/, # GL_ | AGL_ | WGL_ | GLX_
|
||||
section => compile_regex('^(', join('|', @sections), ')$'), # sections in spec
|
||||
token => qr/^([A-Z0-9][A-Z0-9_x]*):?\s+((?:0x)?[0-9A-Fa-f]+(u(ll)?)?)(|\s[^\?]*)$/, # define tokens
|
||||
types => compile_regex('\b(', join('|', keys %typemap), ')\b'), # var types
|
||||
voidtype => compile_regex('\b(', keys %voidtypemap, ')\b '), # void type
|
||||
);
|
||||
|
||||
# reshapes the the function declaration from multiline to single line form
|
||||
sub normalize_prototype
|
||||
{
|
||||
local $_ = join(" ", @_);
|
||||
s/\s+/ /g; # multiple whitespace -> single space
|
||||
s/\<.*\>//g; # remove <comments> from direct state access extension
|
||||
s/\<.*$//g; # remove incomplete <comments> from direct state access extension
|
||||
s#/\*.*\*/##g; # remove /* ... */ comments
|
||||
s/\s*\(\s*/ \(/; # exactly one space before ( and none after
|
||||
s/\s*\)\s*/\)/; # no space before or after )
|
||||
s/\s*\*([a-zA-Z])/\* $1/; # "* identifier"
|
||||
s/\*wgl/\* wgl/; # "* wgl"
|
||||
s/\*glX/\* glX/; # "* glX"
|
||||
s/\.\.\./void/; # ... -> void
|
||||
s/;$//; # remove ; at the end of the line
|
||||
return $_;
|
||||
}
|
||||
|
||||
# Ugly hack to work around the fact that functions are declared in more
|
||||
# than one spec file.
|
||||
sub ignore_function($$)
|
||||
{
|
||||
return exists($fnc_ignore_list{$_[0]}) && $fnc_ignore_list{$_[0]} ne $_[1]
|
||||
}
|
||||
|
||||
sub parse_spec($)
|
||||
{
|
||||
my $filename = shift;
|
||||
my $extname = "";
|
||||
my $vendortag = "";
|
||||
my @extnames = ();
|
||||
my %functions = ();
|
||||
my %tokens = ();
|
||||
|
||||
my $section = "";
|
||||
my @fnc = ();
|
||||
|
||||
my %proc = (
|
||||
"Name" => sub {
|
||||
if (/^([a-z0-9]+)_([a-z0-9_]+)/i)
|
||||
{
|
||||
$extname = "$1_$2";
|
||||
$vendortag = $1;
|
||||
}
|
||||
},
|
||||
|
||||
"Name Strings" => sub {
|
||||
# Add extension name to extension list
|
||||
|
||||
# Initially use $extname if (none) specified
|
||||
if (/$regex{none}/)
|
||||
{
|
||||
$_ = $extname;
|
||||
}
|
||||
|
||||
if (/$regex{extname}/)
|
||||
{
|
||||
# prefix with "GL_" if prefix not present
|
||||
s/^/GL_/ unless /$regex{tprefix}/o;
|
||||
# Add extension name to extension list
|
||||
push @extnames, $_;
|
||||
}
|
||||
},
|
||||
|
||||
"New Procedures and Functions" => sub {
|
||||
# if line matches end of function
|
||||
if (/$regex{eofnc}/)
|
||||
{
|
||||
# add line to function declaration
|
||||
push @fnc, $_;
|
||||
|
||||
# if normalized version of function looks like a function
|
||||
if (normalize_prototype(@fnc) =~ /$regex{function}/)
|
||||
{
|
||||
# get return type, name, and arguments from regex
|
||||
my ($return, $name, $parms) = ($1, $2, $3);
|
||||
if (!ignore_function($name, $extname))
|
||||
{
|
||||
# prefix with "gl" if prefix not present
|
||||
$name =~ s/^/gl/ unless $name =~ /$regex{prefix}/;
|
||||
# is this a pure GL function?
|
||||
if ($name =~ /^gl/ && $name !~ /^glX/)
|
||||
{
|
||||
# apply typemaps
|
||||
$return =~ s/$regex{types}/$typemap{$1}/og;
|
||||
$return =~ s/GLvoid/void/og;
|
||||
$return =~ s/void\*/void */og;
|
||||
$parms =~ s/$regex{types}/$typemap{$1}/og;
|
||||
$parms =~ s/$regex{voidtype}/$voidtypemap{$1}/og;
|
||||
$parms =~ s/GLvoid/void/og;
|
||||
$parms =~ s/ void\* / void */og;
|
||||
if ($parms eq "")
|
||||
{
|
||||
$parms = "void"; # NVX_progress_fence and others
|
||||
}
|
||||
}
|
||||
# add to functions hash
|
||||
$functions{$name} = {
|
||||
rtype => $return,
|
||||
parms => $parms,
|
||||
};
|
||||
}
|
||||
}
|
||||
# reset function declaration
|
||||
@fnc = ();
|
||||
} elsif ($_ ne "" and $_ ne "None") {
|
||||
# if not eof, add line to function declaration
|
||||
push @fnc, $_
|
||||
}
|
||||
},
|
||||
|
||||
"New Tokens" => sub {
|
||||
if (/$regex{token}/)
|
||||
{
|
||||
my ($name, $value) = ($1, $2);
|
||||
# prefix with "GL_" if prefix not present
|
||||
$name =~ s/^/GL_/ unless $name =~ /$regex{tprefix}/;
|
||||
# Add (name, value) pair to tokens hash, unless it's taboo
|
||||
$tokens{$name} = $value unless exists $taboo_tokens{$name};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
# Some people can't read, the template clearly says "Name String_s_"
|
||||
$proc{"Name String"} = $proc{"Name Strings"};
|
||||
|
||||
# Open spec file
|
||||
open SPEC, "<$filename" or return;
|
||||
|
||||
# For each line of SPEC
|
||||
while(<SPEC>)
|
||||
{
|
||||
# Delete trailing newline character
|
||||
chomp;
|
||||
# Remove trailing white spaces
|
||||
s/\s+$//;
|
||||
# If starts with a capital letter, it must be a new section
|
||||
if (/^[A-Z]/)
|
||||
{
|
||||
# Match section name with one of the predefined names
|
||||
$section = /$regex{section}/o ? $1 : "default";
|
||||
} else {
|
||||
# Line is internal to a section
|
||||
# Remove leading whitespace
|
||||
s/^\s+//;
|
||||
# Call appropriate section processing function if it exists
|
||||
&{$proc{$section}} if exists $proc{$section};
|
||||
}
|
||||
}
|
||||
|
||||
close SPEC;
|
||||
|
||||
return ($extname, \@extnames, \%tokens, \%functions);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------------------
|
||||
|
||||
my @speclist = ();
|
||||
my %extensions = ();
|
||||
|
||||
my $ext_dir = shift;
|
||||
my $reg_http = "https://www.khronos.org/registry/OpenGL/extensions/";
|
||||
|
||||
# Take command line arguments or read list from file
|
||||
if (@ARGV)
|
||||
{
|
||||
@speclist = @ARGV;
|
||||
} else {
|
||||
local $/; #???
|
||||
@speclist = split "\n", (<>);
|
||||
}
|
||||
|
||||
foreach my $spec (sort @speclist)
|
||||
{
|
||||
my ($extname, $extnames, $tokens, $functions) = parse_spec($spec);
|
||||
|
||||
foreach my $ext (@{$extnames})
|
||||
{
|
||||
my $info = "$ext_dir/" . $ext;
|
||||
open EXT, ">$info";
|
||||
print EXT $ext . "\n"; # Extension name
|
||||
my $specname = $spec;
|
||||
$specname =~ s/OpenGL-Registry\/extensions\///;
|
||||
print EXT $reg_http . $specname . "\n"; # Extension info URL
|
||||
print EXT $ext . "\n"; # Extension string
|
||||
print EXT "\n"; # Resuses nothing by default
|
||||
|
||||
my $prefix = $ext;
|
||||
$prefix =~ s/^(.+?)(_.+)$/$1/;
|
||||
foreach my $token (sort {
|
||||
if (${$tokens}{$a} eq ${$tokens}{$b}) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
if (${$tokens}{$a} =~ /_/) {
|
||||
if (${$tokens}{$b} =~ /_/) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
} else {
|
||||
if (${$tokens}{$b} =~ /_/) {
|
||||
1
|
||||
} else {
|
||||
if (${$tokens}{$a} =~ /u(ll)?$/) {
|
||||
if (${$tokens}{$b} =~ /u(ll)?$/) {
|
||||
$a cmp $b
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
} else {
|
||||
if (${$tokens}{$b} =~ /u(ll)?$/) {
|
||||
1
|
||||
} else {
|
||||
if (hex ${$tokens}{$a} eq hex ${$tokens}{$b})
|
||||
{
|
||||
$a cmp $b
|
||||
} else {
|
||||
hex ${$tokens}{$a} <=> hex ${$tokens}{$b}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} keys %{$tokens})
|
||||
{
|
||||
if ($token =~ /^$prefix\_.*/i)
|
||||
{
|
||||
print EXT "\t" . $token . " " . ${\%{$tokens}}{$token} . "\n";
|
||||
}
|
||||
}
|
||||
foreach my $function (sort keys %{$functions})
|
||||
{
|
||||
if ($function =~ /^$prefix.*/i)
|
||||
{
|
||||
print EXT "\t" . ${$functions}{$function}{rtype} . " " . $function . " (" . ${$functions}{$function}{parms} . ")" . "\n";
|
||||
}
|
||||
}
|
||||
close EXT;
|
||||
}
|
||||
}
|
145
vendor/glew-cmake-2.2.0/auto/bin/parse_xml.py
vendored
Normal file
145
vendor/glew-cmake-2.2.0/auto/bin/parse_xml.py
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import re
|
||||
import sys
|
||||
from xml.dom.minidom import parse, Node
|
||||
|
||||
#
|
||||
# DOM traversal utility functions
|
||||
#
|
||||
|
||||
def findChildren(node, path):
|
||||
result = []
|
||||
if len(path)==1:
|
||||
for i in node.childNodes:
|
||||
if i.nodeType==Node.ELEMENT_NODE:
|
||||
if i.tagName==path[0]:
|
||||
result.append(i)
|
||||
else:
|
||||
for i in node.childNodes:
|
||||
if i.nodeType==Node.ELEMENT_NODE:
|
||||
if i.tagName==path[0]:
|
||||
result.extend(findChildren(i, path[1:]))
|
||||
return result
|
||||
|
||||
def findData(node, path):
|
||||
return [ i.firstChild.data for i in findChildren(node, path) ]
|
||||
|
||||
isPointer = re.compile('(.*)([ ]+)([*]+)')
|
||||
|
||||
def findParams(node):
|
||||
n = findData(node, ['name'])[0]
|
||||
t = ''
|
||||
for i in node.childNodes:
|
||||
if i.nodeType==Node.TEXT_NODE:
|
||||
t += i.data
|
||||
if i.nodeType==Node.ELEMENT_NODE and i.tagName=='ptype':
|
||||
t += i.firstChild.data
|
||||
|
||||
t.strip()
|
||||
m = isPointer.match(t)
|
||||
if m:
|
||||
t = ('%s%s'%(m.group(1), m.group(3))).strip()
|
||||
return ( t, n.strip())
|
||||
|
||||
def findEnums(dom):
|
||||
return {i.getAttribute('name'): i.getAttribute('value') for i in findChildren(dom, [ 'registry', 'enums', 'enum' ])}
|
||||
|
||||
def findCommands(dom):
|
||||
ret = {}
|
||||
for i in findChildren(dom, [ 'registry', 'commands', 'command' ]):
|
||||
r,n = findParams(findChildren(i, ['proto'])[0])
|
||||
p = [ findParams(j) for j in findChildren(i, ['param'])]
|
||||
ret[n] = (r, p)
|
||||
return ret
|
||||
|
||||
def findFeatures(dom):
|
||||
ret = {}
|
||||
for i in findChildren(dom, [ 'registry', 'feature' ]):
|
||||
n = i.getAttribute('name')
|
||||
e = [j.getAttribute("name") for j in findChildren(i, [ 'require', 'enum' ])]
|
||||
c = [j.getAttribute("name") for j in findChildren(i, [ 'require', 'command' ])]
|
||||
ret[n] = (e,c)
|
||||
return ret
|
||||
|
||||
def findExtensions(dom):
|
||||
ret = {}
|
||||
for i in findChildren(dom, [ 'registry', 'extensions', 'extension' ]):
|
||||
n = i.getAttribute('name')
|
||||
e = [j.getAttribute("name") for j in findChildren(i, [ 'require', 'enum' ])]
|
||||
c = [j.getAttribute("name") for j in findChildren(i, [ 'require', 'command' ])]
|
||||
ret[n] = (e,c)
|
||||
return ret
|
||||
|
||||
def findApi(dom, name):
|
||||
enums = findEnums(dom)
|
||||
commands = findCommands(dom)
|
||||
features = findFeatures(dom)
|
||||
extensions = findExtensions(dom)
|
||||
return (enums, commands, features, extensions)
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
isWGL = re.compile('WGL_([A-Z0-9]+)_.*')
|
||||
|
||||
def writeExtension(f, name, extension, enums, commands):
|
||||
f.write(('%s\n'%name).encode())
|
||||
|
||||
url = 'https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf'
|
||||
|
||||
m = isWGL.match(name)
|
||||
if m:
|
||||
url = 'https://www.khronos.org/registry/OpenGL/extensions/%s/%s.txt'%(m.group(1), name)
|
||||
|
||||
f.write(('%s\n'%(url)).encode())
|
||||
|
||||
if name.find('_VERSION_')==-1:
|
||||
f.write(('%s\n'%name).encode())
|
||||
else:
|
||||
f.write('\n'.encode())
|
||||
f.write('\n'.encode())
|
||||
|
||||
enums = [ (j, enums[j]) for j in extension[0] ]
|
||||
for e in sorted(enums, key=lambda i: i[1]):
|
||||
f.write(('\t%s %s\n'%(e[0], e[1])).encode())
|
||||
|
||||
commands = [ (j, commands[j]) for j in extension[1] ]
|
||||
for c in sorted(commands):
|
||||
params = ', '.join( [ '%s %s'%(j[0].strip(), j[1].strip()) for j in c[1][1] ] )
|
||||
if len(params)==0:
|
||||
params = 'void'
|
||||
f.write(('\t%s %s (%s)\n'%(c[1][0].strip(), c[0].strip(), params)).encode())
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
from argparse import ArgumentParser
|
||||
import os
|
||||
|
||||
parser = ArgumentParser(description='usage: %prog [options] [XML specs...]')
|
||||
parser.add_argument("--core", dest="core", help="location for core outputs", default='')
|
||||
parser.add_argument("--api", dest="name", help="API name: egl, wgl, glx, etc", default='')
|
||||
parser.add_argument("--extensions", dest="extensions", help="location for extensions outputs", default='')
|
||||
|
||||
(options, args) = parser.parse_known_args()
|
||||
options = vars(options)
|
||||
|
||||
for i in args:
|
||||
|
||||
dom = parse(i)
|
||||
api = findApi(dom, options['name'])
|
||||
|
||||
print('Found {} enums, {} commands, {} features and {} extensions.'.format(
|
||||
len(api[0]), len(api[1]), len(api[2]), len(api[3])))
|
||||
|
||||
if len(options['core']):
|
||||
for i in api[2].keys():
|
||||
with open(os.path.join(options['core'], i), 'wb') as f:
|
||||
writeExtension(f, i, api[2][i], api[0], api[1])
|
||||
|
||||
if len(options['extensions']):
|
||||
for i in api[3].keys():
|
||||
with open(os.path.join(options['extensions'], i), 'wb') as f:
|
||||
writeExtension(f, i, api[3][i], api[0], api[1])
|
||||
|
26
vendor/glew-cmake-2.2.0/auto/bin/update_ext.sh
vendored
Normal file
26
vendor/glew-cmake-2.2.0/auto/bin/update_ext.sh
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
##
|
||||
## Copyright (C) 2008-2019, Nigel Stewart <nigels[]users sourceforge net>
|
||||
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
|
||||
##
|
||||
## This program is distributed under the terms and conditions of the GNU
|
||||
## General Public License Version 2 as published by the Free Software
|
||||
## Foundation or, at your option, any later version.
|
||||
##
|
||||
## Parameters:
|
||||
##
|
||||
## $1: Extensions directory
|
||||
## $2: Registry directory
|
||||
## $3: The black list
|
||||
|
||||
set -e
|
||||
|
||||
if [ ! -d $1 ] ; then
|
||||
mkdir -p $1
|
||||
|
||||
# Parse each of the extensions in the registry
|
||||
find $2 -name doc -type d -prune -o -name "*.txt" -print | \
|
||||
grep -v -f $3 | sort | bin/parse_spec.pl $1
|
||||
|
||||
fi
|
27
vendor/glew-cmake-2.2.0/auto/blacklist
vendored
Normal file
27
vendor/glew-cmake-2.2.0/auto/blacklist
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
EXT/draw_range_elements.txt
|
||||
EXT/static_vertex_array.txt
|
||||
EXT/vertex_array_set.alt.txt
|
||||
EXT/vertex_array_set.txt
|
||||
EXT/nurbs_tessellator.txt
|
||||
EXT/object_space_tess.txt
|
||||
SGI/filter4_parameters.txt
|
||||
SGIS/SGIS_texture_color_mask.txt
|
||||
SGIX/SGIX_dmbuffer.txt
|
||||
SGIX/SGIX_instruments.txt
|
||||
SGIX/SGIX_video_source.txt
|
||||
SGIX/SGIX_hyperpipe_group.txt
|
||||
OES/OES_fixed_point.txt
|
||||
OES/OES_query_matrix.txt
|
||||
IMG/IMG_user_clip_plane.txt
|
||||
NV/NV_query_resource.txt
|
||||
NV/EGL_NV_coverage_sample.txt
|
||||
OES/OES_draw_elements_base_vertex.txt
|
||||
OES/OES_viewport_array.txt
|
||||
OES/EGL_KHR_fence_sync.txt
|
||||
EXT/EXT_texenv_op.txt
|
||||
EXT/EXT_transform_feedback2.txt
|
||||
EXT/EXT_vertex_array_set.txt
|
||||
EXT/EXT_separate_shader_objects.gles.txt
|
||||
IGLOO/IGLOO_swap_triangle_strip_vertex_pointerXXX.txt
|
||||
IGLOO/IGLOO_viewport_offsetXXX.txt
|
||||
IGLOO/IGLOO_toggle_color_and_lightXXX.txt
|
7
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_EXT_device_base
vendored
Normal file
7
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_EXT_device_base
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
EGL_EXT_device_base
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
EGL_EXT_device_base
|
||||
|
||||
EGL_BAD_DEVICE_EXT 0x322B
|
||||
EGL_DEVICE_EXT 0x322C
|
||||
EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0)
|
7
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_KHR_fence_sync
vendored
Normal file
7
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_KHR_fence_sync
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
EGL_KHR_fence_sync
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
EGL_KHR_fence_sync
|
||||
|
||||
EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
EGL_SYNC_FENCE_KHR 0x30F9
|
6
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_KHR_image_base
vendored
Normal file
6
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_KHR_image_base
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
EGL_KHR_image_base
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
EGL_KHR_image_base
|
||||
|
||||
EGL_IMAGE_PRESERVED_KHR 0x30D2
|
||||
EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
|
27
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_KHR_lock_surface3
vendored
Normal file
27
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_KHR_lock_surface3
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
EGL_KHR_lock_surface3
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
EGL_KHR_lock_surface3
|
||||
|
||||
EGL_READ_SURFACE_BIT_KHR 0x0001
|
||||
EGL_WRITE_SURFACE_BIT_KHR 0x0002
|
||||
EGL_LOCK_SURFACE_BIT_KHR 0x0080
|
||||
EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
|
||||
EGL_MATCH_FORMAT_KHR 0x3043
|
||||
EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
|
||||
EGL_FORMAT_RGB_565_KHR 0x30C1
|
||||
EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
|
||||
EGL_FORMAT_RGBA_8888_KHR 0x30C3
|
||||
EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
|
||||
EGL_LOCK_USAGE_HINT_KHR 0x30C5
|
||||
EGL_BITMAP_POINTER_KHR 0x30C6
|
||||
EGL_BITMAP_PITCH_KHR 0x30C7
|
||||
EGL_BITMAP_ORIGIN_KHR 0x30C8
|
||||
EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
|
||||
EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
|
||||
EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
|
||||
EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
|
||||
EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
|
||||
EGL_LOWER_LEFT_KHR 0x30CE
|
||||
EGL_UPPER_LEFT_KHR 0x30CF
|
||||
EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
||||
EGLBoolean eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR * value)
|
86
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_0
vendored
Normal file
86
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_0
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
EGL_VERSION_1_0
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
|
||||
|
||||
EGL_FALSE 0
|
||||
EGL_PBUFFER_BIT 0x0001
|
||||
EGL_PIXMAP_BIT 0x0002
|
||||
EGL_WINDOW_BIT 0x0004
|
||||
EGL_SUCCESS 0x3000
|
||||
EGL_NOT_INITIALIZED 0x3001
|
||||
EGL_BAD_ACCESS 0x3002
|
||||
EGL_BAD_ALLOC 0x3003
|
||||
EGL_BAD_ATTRIBUTE 0x3004
|
||||
EGL_BAD_CONFIG 0x3005
|
||||
EGL_BAD_CONTEXT 0x3006
|
||||
EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
EGL_BAD_DISPLAY 0x3008
|
||||
EGL_BAD_MATCH 0x3009
|
||||
EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
EGL_BAD_PARAMETER 0x300C
|
||||
EGL_BAD_SURFACE 0x300D
|
||||
EGL_BUFFER_SIZE 0x3020
|
||||
EGL_ALPHA_SIZE 0x3021
|
||||
EGL_BLUE_SIZE 0x3022
|
||||
EGL_GREEN_SIZE 0x3023
|
||||
EGL_RED_SIZE 0x3024
|
||||
EGL_DEPTH_SIZE 0x3025
|
||||
EGL_STENCIL_SIZE 0x3026
|
||||
EGL_CONFIG_CAVEAT 0x3027
|
||||
EGL_CONFIG_ID 0x3028
|
||||
EGL_LEVEL 0x3029
|
||||
EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
EGL_NATIVE_RENDERABLE 0x302D
|
||||
EGL_NATIVE_VISUAL_ID 0x302E
|
||||
EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
EGL_SAMPLES 0x3031
|
||||
EGL_SAMPLE_BUFFERS 0x3032
|
||||
EGL_SURFACE_TYPE 0x3033
|
||||
EGL_TRANSPARENT_TYPE 0x3034
|
||||
EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
EGL_NONE 0x3038
|
||||
EGL_SLOW_CONFIG 0x3050
|
||||
EGL_NON_CONFORMANT_CONFIG 0x3051
|
||||
EGL_TRANSPARENT_RGB 0x3052
|
||||
EGL_VENDOR 0x3053
|
||||
EGL_VERSION 0x3054
|
||||
EGL_EXTENSIONS 0x3055
|
||||
EGL_HEIGHT 0x3056
|
||||
EGL_WIDTH 0x3057
|
||||
EGL_LARGEST_PBUFFER 0x3058
|
||||
EGL_DRAW 0x3059
|
||||
EGL_READ 0x305A
|
||||
EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
EGL_TRUE 1
|
||||
EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
|
||||
EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
|
||||
EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
|
||||
EGL_DONT_CARE EGL_CAST(EGLint,-1)
|
||||
EGLBoolean eglChooseConfig (EGLDisplay dpy, const EGLint * attrib_list, EGLConfig * configs, EGLint config_size, EGLint * num_config)
|
||||
EGLBoolean eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
|
||||
EGLContext eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint * attrib_list)
|
||||
EGLSurface eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint * attrib_list)
|
||||
EGLSurface eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint * attrib_list)
|
||||
EGLSurface eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint * attrib_list)
|
||||
EGLBoolean eglDestroyContext (EGLDisplay dpy, EGLContext ctx)
|
||||
EGLBoolean eglDestroySurface (EGLDisplay dpy, EGLSurface surface)
|
||||
EGLBoolean eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value)
|
||||
EGLBoolean eglGetConfigs (EGLDisplay dpy, EGLConfig * configs, EGLint config_size, EGLint * num_config)
|
||||
EGLDisplay eglGetCurrentDisplay ( void )
|
||||
EGLSurface eglGetCurrentSurface (EGLint readdraw)
|
||||
EGLDisplay eglGetDisplay (EGLNativeDisplayType display_id)
|
||||
EGLint eglGetError ( void )
|
||||
EGLBoolean eglInitialize (EGLDisplay dpy, EGLint * major, EGLint * minor)
|
||||
EGLBoolean eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
|
||||
EGLBoolean eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint * value)
|
||||
const char * eglQueryString (EGLDisplay dpy, EGLint name)
|
||||
EGLBoolean eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint * value)
|
||||
EGLBoolean eglSwapBuffers (EGLDisplay dpy, EGLSurface surface)
|
||||
EGLBoolean eglTerminate (EGLDisplay dpy)
|
||||
EGLBoolean eglWaitGL ( void )
|
||||
EGLBoolean eglWaitNative (EGLint engine)
|
22
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_1
vendored
Normal file
22
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_1
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
EGL_VERSION_1_1
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
|
||||
|
||||
EGL_CONTEXT_LOST 0x300E
|
||||
EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
EGL_NO_TEXTURE 0x305C
|
||||
EGL_TEXTURE_RGB 0x305D
|
||||
EGL_TEXTURE_RGBA 0x305E
|
||||
EGL_TEXTURE_2D 0x305F
|
||||
EGL_TEXTURE_FORMAT 0x3080
|
||||
EGL_TEXTURE_TARGET 0x3081
|
||||
EGL_MIPMAP_TEXTURE 0x3082
|
||||
EGL_MIPMAP_LEVEL 0x3083
|
||||
EGL_BACK_BUFFER 0x3084
|
||||
EGLBoolean eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
||||
EGLBoolean eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer)
|
||||
EGLBoolean eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
|
||||
EGLBoolean eglSwapInterval (EGLDisplay dpy, EGLint interval)
|
38
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_2
vendored
Normal file
38
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_2
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
EGL_VERSION_1_2
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
|
||||
|
||||
EGL_OPENGL_ES_BIT 0x0001
|
||||
EGL_OPENVG_BIT 0x0002
|
||||
EGL_LUMINANCE_SIZE 0x303D
|
||||
EGL_ALPHA_MASK_SIZE 0x303E
|
||||
EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
EGL_RENDERABLE_TYPE 0x3040
|
||||
EGL_SINGLE_BUFFER 0x3085
|
||||
EGL_RENDER_BUFFER 0x3086
|
||||
EGL_COLORSPACE 0x3087
|
||||
EGL_ALPHA_FORMAT 0x3088
|
||||
EGL_COLORSPACE_sRGB 0x3089
|
||||
EGL_COLORSPACE_LINEAR 0x308A
|
||||
EGL_ALPHA_FORMAT_NONPRE 0x308B
|
||||
EGL_ALPHA_FORMAT_PRE 0x308C
|
||||
EGL_CLIENT_APIS 0x308D
|
||||
EGL_RGB_BUFFER 0x308E
|
||||
EGL_LUMINANCE_BUFFER 0x308F
|
||||
EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
EGL_VERTICAL_RESOLUTION 0x3091
|
||||
EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
EGL_SWAP_BEHAVIOR 0x3093
|
||||
EGL_BUFFER_PRESERVED 0x3094
|
||||
EGL_BUFFER_DESTROYED 0x3095
|
||||
EGL_OPENVG_IMAGE 0x3096
|
||||
EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
EGL_OPENGL_ES_API 0x30A0
|
||||
EGL_OPENVG_API 0x30A1
|
||||
EGL_DISPLAY_SCALING 10000
|
||||
EGL_UNKNOWN EGL_CAST(EGLint,-1)
|
||||
EGLBoolean eglBindAPI (EGLenum api)
|
||||
EGLSurface eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint * attrib_list)
|
||||
EGLenum eglQueryAPI ( void )
|
||||
EGLBoolean eglReleaseThread ( void )
|
||||
EGLBoolean eglWaitClient ( void )
|
16
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_3
vendored
Normal file
16
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_3
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
EGL_VERSION_1_3
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
|
||||
|
||||
EGL_OPENGL_ES2_BIT 0x0004
|
||||
EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
|
||||
EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
|
||||
EGL_MATCH_NATIVE_PIXMAP 0x3041
|
||||
EGL_CONFORMANT 0x3042
|
||||
EGL_VG_COLORSPACE 0x3087
|
||||
EGL_VG_ALPHA_FORMAT 0x3088
|
||||
EGL_VG_COLORSPACE_sRGB 0x3089
|
||||
EGL_VG_COLORSPACE_LINEAR 0x308A
|
||||
EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
|
||||
EGL_VG_ALPHA_FORMAT_PRE 0x308C
|
||||
EGL_CONTEXT_CLIENT_VERSION 0x3098
|
13
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_4
vendored
Normal file
13
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_4
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
EGL_VERSION_1_4
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
|
||||
|
||||
EGL_OPENGL_BIT 0x0008
|
||||
EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
|
||||
EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
|
||||
EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
|
||||
EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
|
||||
EGL_OPENGL_API 0x30A2
|
||||
EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
|
||||
EGLContext eglGetCurrentContext ( void )
|
59
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_5
vendored
Normal file
59
vendor/glew-cmake-2.2.0/auto/core/gl/EGL_VERSION_1_5
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
EGL_VERSION_1_5
|
||||
https://www.khronos.org/registry/egl/specs/eglspec.1.5.pdf
|
||||
|
||||
|
||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
|
||||
EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
EGL_OPENGL_ES3_BIT 0x00000040
|
||||
EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
|
||||
EGL_GL_COLORSPACE_SRGB 0x3089
|
||||
EGL_GL_COLORSPACE_LINEAR 0x308A
|
||||
EGL_CONTEXT_MAJOR_VERSION 0x3098
|
||||
EGL_CL_EVENT_HANDLE 0x309C
|
||||
EGL_GL_COLORSPACE 0x309D
|
||||
EGL_GL_TEXTURE_2D 0x30B1
|
||||
EGL_GL_TEXTURE_3D 0x30B2
|
||||
EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
|
||||
EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
|
||||
EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
|
||||
EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
|
||||
EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
|
||||
EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
|
||||
EGL_GL_RENDERBUFFER 0x30B9
|
||||
EGL_GL_TEXTURE_LEVEL 0x30BC
|
||||
EGL_GL_TEXTURE_ZOFFSET 0x30BD
|
||||
EGL_IMAGE_PRESERVED 0x30D2
|
||||
EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
|
||||
EGL_SYNC_STATUS 0x30F1
|
||||
EGL_SIGNALED 0x30F2
|
||||
EGL_UNSIGNALED 0x30F3
|
||||
EGL_TIMEOUT_EXPIRED 0x30F5
|
||||
EGL_CONDITION_SATISFIED 0x30F6
|
||||
EGL_SYNC_TYPE 0x30F7
|
||||
EGL_SYNC_CONDITION 0x30F8
|
||||
EGL_SYNC_FENCE 0x30F9
|
||||
EGL_CONTEXT_MINOR_VERSION 0x30FB
|
||||
EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
|
||||
EGL_SYNC_CL_EVENT 0x30FE
|
||||
EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
|
||||
EGL_CONTEXT_OPENGL_DEBUG 0x31B0
|
||||
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
|
||||
EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
|
||||
EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
|
||||
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
|
||||
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
|
||||
EGL_NO_RESET_NOTIFICATION 0x31BE
|
||||
EGL_LOSE_CONTEXT_ON_RESET 0x31BF
|
||||
EGL_FOREVER 0xFFFFFFFFFFFFFFFF
|
||||
EGL_NO_IMAGE EGL_CAST(EGLImage,0)
|
||||
EGL_NO_SYNC EGL_CAST(EGLSync,0)
|
||||
EGLint eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
|
||||
EGLImage eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib * attrib_list)
|
||||
EGLSurface eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void * native_pixmap, const EGLAttrib * attrib_list)
|
||||
EGLSurface eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list)
|
||||
EGLSync eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib * attrib_list)
|
||||
EGLBoolean eglDestroyImage (EGLDisplay dpy, EGLImage image)
|
||||
EGLBoolean eglDestroySync (EGLDisplay dpy, EGLSync sync)
|
||||
EGLDisplay eglGetPlatformDisplay (EGLenum platform, void * native_display, const EGLAttrib * attrib_list)
|
||||
EGLBoolean eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib * value)
|
||||
EGLBoolean eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags)
|
5
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_ARB_get_proc_address
vendored
Normal file
5
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_ARB_get_proc_address
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
GLX_ARB_get_proc_address
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/ARB/get_proc_address.txt
|
||||
GLX_ARB_get_proc_address
|
||||
|
||||
extern void ( * glXGetProcAddressARB (const GLubyte *procName)) (void);
|
5
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_ATI_pixel_format_float
vendored
Normal file
5
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_ATI_pixel_format_float
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
GLX_ATI_pixel_format_float
|
||||
|
||||
GLX_ATI_pixel_format_float
|
||||
|
||||
GLX_RGBA_FLOAT_ATI_BIT 0x00000100
|
42
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_ATI_render_texture
vendored
Normal file
42
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_ATI_render_texture
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
GLX_ATI_render_texture
|
||||
|
||||
GLX_ATI_render_texture
|
||||
|
||||
GLX_BIND_TO_TEXTURE_RGB_ATI 0x9800
|
||||
GLX_BIND_TO_TEXTURE_RGBA_ATI 0x9801
|
||||
GLX_TEXTURE_FORMAT_ATI 0x9802
|
||||
GLX_TEXTURE_TARGET_ATI 0x9803
|
||||
GLX_MIPMAP_TEXTURE_ATI 0x9804
|
||||
GLX_TEXTURE_RGB_ATI 0x9805
|
||||
GLX_TEXTURE_RGBA_ATI 0x9806
|
||||
GLX_NO_TEXTURE_ATI 0x9807
|
||||
GLX_TEXTURE_CUBE_MAP_ATI 0x9808
|
||||
GLX_TEXTURE_1D_ATI 0x9809
|
||||
GLX_TEXTURE_2D_ATI 0x980A
|
||||
GLX_MIPMAP_LEVEL_ATI 0x980B
|
||||
GLX_CUBE_MAP_FACE_ATI 0x980C
|
||||
GLX_TEXTURE_CUBE_MAP_POSITIVE_X_ATI 0x980D
|
||||
GLX_TEXTURE_CUBE_MAP_NEGATIVE_X_ATI 0x980E
|
||||
GLX_TEXTURE_CUBE_MAP_POSITIVE_Y_ATI 0x980F
|
||||
GLX_TEXTURE_CUBE_MAP_NEGATIVE_Y_ATI 0x9810
|
||||
GLX_TEXTURE_CUBE_MAP_POSITIVE_Z_ATI 0x9811
|
||||
GLX_TEXTURE_CUBE_MAP_NEGATIVE_Z_ATI 0x9812
|
||||
GLX_FRONT_LEFT_ATI 0x9813
|
||||
GLX_FRONT_RIGHT_ATI 0x9814
|
||||
GLX_BACK_LEFT_ATI 0x9815
|
||||
GLX_BACK_RIGHT_ATI 0x9816
|
||||
GLX_AUX0_ATI 0x9817
|
||||
GLX_AUX1_ATI 0x9818
|
||||
GLX_AUX2_ATI 0x9819
|
||||
GLX_AUX3_ATI 0x981A
|
||||
GLX_AUX4_ATI 0x981B
|
||||
GLX_AUX5_ATI 0x981C
|
||||
GLX_AUX6_ATI 0x981D
|
||||
GLX_AUX7_ATI 0x981E
|
||||
GLX_AUX8_ATI 0x981F
|
||||
GLX_AUX9_ATI 0x9820
|
||||
GLX_BIND_TO_TEXTURE_LUMINANCE_ATI 0x9821
|
||||
GLX_BIND_TO_TEXTURE_INTENSITY_ATI 0x9822
|
||||
void glXBindTexImageATI (Display *dpy, GLXPbuffer pbuf, int buffer)
|
||||
void glXReleaseTexImageATI (Display *dpy, GLXPbuffer pbuf, int buffer)
|
||||
void glXDrawableAttribATI (Display *dpy, GLXDrawable draw, const int *attrib_list)
|
4
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_EXT_scene_marker
vendored
Normal file
4
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_EXT_scene_marker
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
GLX_EXT_scene_marker
|
||||
https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_scene_marker.txt
|
||||
GLX_EXT_scene_marker
|
||||
|
6
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_NV_vertex_array_range
vendored
Normal file
6
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_NV_vertex_array_range
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
GLX_NV_vertex_array_range
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/NV/vertex_array_range.txt
|
||||
GLX_NV_vertex_array_range
|
||||
|
||||
void * glXAllocateMemoryNV (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority)
|
||||
void glXFreeMemoryNV (void *pointer)
|
4
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_SGIS_color_range
vendored
Normal file
4
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_SGIS_color_range
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
GLX_SGIS_color_range
|
||||
https://www.khronos.org/registry/OpenGL/extensions/SGIS/GLX_SGIS_color_range.txt
|
||||
GLX_SGIS_color_range
|
||||
|
26
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_SGIX_hyperpipe
vendored
Normal file
26
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_SGIX_hyperpipe
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
GLX_SGIX_hyperpipe
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/SGIX/hyperpipe_group.txt
|
||||
GLX_SGIX_hyperpipe
|
||||
|
||||
GLX_HYPERPIPE_ID_SGIX 0x8030
|
||||
GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
|
||||
GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
|
||||
GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
|
||||
GLX_PIPE_RECT_SGIX 0x00000001
|
||||
GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
|
||||
GLX_HYPERPIPE_STEREO_SGIX 0x00000003
|
||||
GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
|
||||
GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
|
||||
GLX_BAD_HYPERPIPE_SGIX 92
|
||||
typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int networkId; } GLXHyperpipeNetworkSGIX;
|
||||
typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int channel; unsigned int participationType; int timeSlice; } GLXHyperpipeConfigSGIX;
|
||||
typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int srcXOrigin; int srcYOrigin; int srcWidth; int srcHeight; int destXOrigin; int destYOrigin; int destWidth; int destHeight; } GLXPipeRect;
|
||||
typedef struct { char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; int XOrigin; int YOrigin; int maxHeight; int maxWidth; } GLXPipeRectLimits;
|
||||
GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes)
|
||||
int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId)
|
||||
GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes)
|
||||
int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId)
|
||||
int glXBindHyperpipeSGIX (Display *dpy, int hpId)
|
||||
int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList)
|
||||
int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList)
|
||||
int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList)
|
8
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_SUN_video_resize
vendored
Normal file
8
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_SUN_video_resize
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
GLX_SUN_video_resize
|
||||
http://wwws.sun.com/software/graphics/opengl/extensions/glx_sun_video_resize.txt
|
||||
GLX_SUN_video_resize
|
||||
|
||||
GL_VIDEO_RESIZE_COMPENSATION_SUN 0x85CD
|
||||
GLX_VIDEO_RESIZE_SUN 0x8171
|
||||
int glXVideoResizeSUN (Display* display, GLXDrawable window, float factor)
|
||||
int glXGetVideoResizeSUN (Display* display, GLXDrawable window, float* factor)
|
5
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_VERSION_1_2
vendored
Normal file
5
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_VERSION_1_2
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
GLX_VERSION_1_2
|
||||
http://www.opengl.org/documentation/specs/glx/glx1.2.ps
|
||||
GLX_VERSION_1_2
|
||||
|
||||
Display* glXGetCurrentDisplay (void)
|
83
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_VERSION_1_3
vendored
Normal file
83
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_VERSION_1_3
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
GLX_VERSION_1_3
|
||||
http://www.opengl.org/documentation/specs/glx/glx1.3.pdf
|
||||
GLX_VERSION_1_3
|
||||
|
||||
GLX_WINDOW_BIT 0x00000001
|
||||
GLX_PIXMAP_BIT 0x00000002
|
||||
GLX_PBUFFER_BIT 0x00000004
|
||||
GLX_RGBA_BIT 0x00000001
|
||||
GLX_COLOR_INDEX_BIT 0x00000002
|
||||
GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
||||
GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
GLX_CONFIG_CAVEAT 0x20
|
||||
GLX_X_VISUAL_TYPE 0x22
|
||||
GLX_TRANSPARENT_TYPE 0x23
|
||||
GLX_TRANSPARENT_INDEX_VALUE 0x24
|
||||
GLX_TRANSPARENT_RED_VALUE 0x25
|
||||
GLX_TRANSPARENT_GREEN_VALUE 0x26
|
||||
GLX_TRANSPARENT_BLUE_VALUE 0x27
|
||||
GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
||||
GLX_DONT_CARE 0xFFFFFFFF
|
||||
GLX_NONE 0x8000
|
||||
GLX_SLOW_CONFIG 0x8001
|
||||
GLX_TRUE_COLOR 0x8002
|
||||
GLX_DIRECT_COLOR 0x8003
|
||||
GLX_PSEUDO_COLOR 0x8004
|
||||
GLX_STATIC_COLOR 0x8005
|
||||
GLX_GRAY_SCALE 0x8006
|
||||
GLX_STATIC_GRAY 0x8007
|
||||
GLX_TRANSPARENT_RGB 0x8008
|
||||
GLX_TRANSPARENT_INDEX 0x8009
|
||||
GLX_VISUAL_ID 0x800B
|
||||
GLX_SCREEN 0x800C
|
||||
GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
GLX_DRAWABLE_TYPE 0x8010
|
||||
GLX_RENDER_TYPE 0x8011
|
||||
GLX_X_RENDERABLE 0x8012
|
||||
GLX_FBCONFIG_ID 0x8013
|
||||
GLX_RGBA_TYPE 0x8014
|
||||
GLX_COLOR_INDEX_TYPE 0x8015
|
||||
GLX_MAX_PBUFFER_WIDTH 0x8016
|
||||
GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
GLX_PRESERVED_CONTENTS 0x801B
|
||||
GLX_LARGEST_PBUFFER 0x801C
|
||||
GLX_WIDTH 0x801D
|
||||
GLX_HEIGHT 0x801E
|
||||
GLX_EVENT_MASK 0x801F
|
||||
GLX_DAMAGED 0x8020
|
||||
GLX_SAVED 0x8021
|
||||
GLX_WINDOW 0x8022
|
||||
GLX_PBUFFER 0x8023
|
||||
GLX_PBUFFER_HEIGHT 0x8040
|
||||
GLX_PBUFFER_WIDTH 0x8041
|
||||
GLXFBConfig* glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements)
|
||||
GLXFBConfig* glXGetFBConfigs (Display *dpy, int screen, int *nelements)
|
||||
XVisualInfo* glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config)
|
||||
int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value)
|
||||
GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list)
|
||||
void glXDestroyWindow (Display *dpy, GLXWindow win)
|
||||
GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list)
|
||||
void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap)
|
||||
GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list)
|
||||
void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf)
|
||||
void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
|
||||
GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
|
||||
Bool glXMakeContextCurrent (Display *display, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
|
||||
GLXDrawable glXGetCurrentReadDrawable (void)
|
||||
int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value)
|
||||
void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask)
|
||||
void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask)
|
||||
typedef XID GLXWindow
|
||||
typedef XID GLXPbuffer
|
||||
typedef XID GLXFBConfigID
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfig
|
||||
typedef struct { int event_type; int draw_type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; unsigned int buffer_mask; unsigned int aux_buffer; int x, y; int width, height; int count; } GLXPbufferClobberEvent;
|
||||
typedef union __GLXEvent { GLXPbufferClobberEvent glxpbufferclobber; long pad[24]; } GLXEvent;
|
7
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_VERSION_1_4
vendored
Normal file
7
vendor/glew-cmake-2.2.0/auto/core/gl/GLX_VERSION_1_4
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
GLX_VERSION_1_4
|
||||
http://www.opengl.org/documentation/specs/glx/glx1.4.pdf
|
||||
GLX_VERSION_1_4
|
||||
|
||||
GLX_SAMPLE_BUFFERS 100000
|
||||
GLX_SAMPLES 100001
|
||||
extern void ( * glXGetProcAddress (const GLubyte *procName)) (void);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user