Skip to content

Commit e5f3983

Browse files
committed
Upgrade SOIL2.
Allow to disable GLEW dependency, it will now be disabled by default so we can test. The idea is to remove the dependency completely once this is confirmed to work.
1 parent 7709986 commit e5f3983

22 files changed

Lines changed: 806 additions & 221 deletions

include/eepp/config.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@
195195
#endif
196196

197197
#if ( EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_MACOS || \
198-
defined( EE_X11_PLATFORM ) ) && \
199-
!defined( EE_GLES )
198+
defined( EE_X11_PLATFORM ) ) && \
199+
!defined( EE_GLES ) && !defined( EE_DISABLE_GLEW )
200200
#define EE_GLEW_AVAILABLE
201201
#endif
202202

@@ -317,9 +317,9 @@ typedef unsigned long long Uint64;
317317
#endif
318318

319319
#if defined( __x86_64__ ) || defined( _M_X64 )
320-
#define EE_ARCH_X86_64
320+
#define EE_ARCH_X86_64
321321
#elif defined( __aarch64__ ) || defined( _M_ARM64 )
322-
#define EE_ARCH_ARM64
322+
#define EE_ARCH_ARM64
323323
#endif
324324

325325
#if defined( EE_LINUX_64 ) || defined( EE_SPARC_64 ) || defined( __osf__ ) || \

include/eepp/graphics/renderer/opengl.hpp

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@
1616
#include <OpenGL/gl.h>
1717
#else
1818
#if EE_PLATFORM == EE_PLATFORM_WIN
19+
#ifndef APIENTRY
1920
#define APIENTRY __stdcall
21+
#endif
22+
#ifndef WINGDIAPI
2023
#define WINGDIAPI __declspec( dllimport )
2124
#endif
25+
#endif
2226

2327
#include <GL/gl.h>
2428
#endif
@@ -28,6 +32,120 @@
2832
#include <GL/glext.h>
2933
#elif EE_PLATFORM == EE_PLATFORM_MACOS
3034
#include <OpenGL/glext.h>
35+
#elif EE_PLATFORM == EE_PLATFORM_HAIKU || EE_PLATFORM == EE_PLATFORM_BSD || \
36+
EE_PLATFORM == EE_PLATFORM_SOLARIS
37+
#include <GL/glext.h>
38+
#elif EE_PLATFORM == EE_PLATFORM_WIN
39+
typedef char GLchar;
40+
41+
#ifndef GL_TEXTURE0
42+
#define GL_TEXTURE0 0x84C0
43+
#endif
44+
#ifndef GL_COMPRESSED_RGBA
45+
#define GL_COMPRESSED_RGBA 0x84EE
46+
#endif
47+
#ifndef GL_TEXTURE_COMPRESSED_IMAGE_SIZE
48+
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
49+
#endif
50+
#ifndef GL_TEXTURE_COMPRESSED
51+
#define GL_TEXTURE_COMPRESSED 0x86A1
52+
#endif
53+
#ifndef GL_ARRAY_BUFFER
54+
#define GL_ARRAY_BUFFER 0x8892
55+
#endif
56+
#ifndef GL_ELEMENT_ARRAY_BUFFER
57+
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
58+
#endif
59+
#ifndef GL_STREAM_DRAW
60+
#define GL_STREAM_DRAW 0x88E0
61+
#endif
62+
#ifndef GL_STATIC_DRAW
63+
#define GL_STATIC_DRAW 0x88E4
64+
#endif
65+
#ifndef GL_DYNAMIC_DRAW
66+
#define GL_DYNAMIC_DRAW 0x88E8
67+
#endif
68+
#ifndef GL_FRAGMENT_SHADER
69+
#define GL_FRAGMENT_SHADER 0x8B30
70+
#endif
71+
#ifndef GL_VERTEX_SHADER
72+
#define GL_VERTEX_SHADER 0x8B31
73+
#endif
74+
#ifndef GL_COMPILE_STATUS
75+
#define GL_COMPILE_STATUS 0x8B81
76+
#endif
77+
#ifndef GL_LINK_STATUS
78+
#define GL_LINK_STATUS 0x8B82
79+
#endif
80+
#ifndef GL_INFO_LOG_LENGTH
81+
#define GL_INFO_LOG_LENGTH 0x8B84
82+
#endif
83+
#ifndef GL_SHADING_LANGUAGE_VERSION
84+
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
85+
#endif
86+
#ifndef GL_VERTEX_PROGRAM_POINT_SIZE
87+
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
88+
#endif
89+
#ifndef GL_FUNC_ADD
90+
#define GL_FUNC_ADD 0x8006
91+
#endif
92+
#ifndef GL_FUNC_SUBTRACT
93+
#define GL_FUNC_SUBTRACT 0x800A
94+
#endif
95+
#ifndef GL_FUNC_REVERSE_SUBTRACT
96+
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
97+
#endif
98+
#ifndef GL_POINT_SPRITE
99+
#define GL_POINT_SPRITE 0x8861
100+
#endif
101+
#ifndef GL_COORD_REPLACE
102+
#define GL_COORD_REPLACE 0x8862
103+
#endif
104+
#ifndef GL_FRAMEBUFFER
105+
#define GL_FRAMEBUFFER 0x8D40
106+
#endif
107+
#ifndef GL_RENDERBUFFER
108+
#define GL_RENDERBUFFER 0x8D41
109+
#endif
110+
#ifndef GL_FRAMEBUFFER_COMPLETE
111+
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
112+
#endif
113+
#ifndef GL_COLOR_ATTACHMENT0
114+
#define GL_COLOR_ATTACHMENT0 0x8CE0
115+
#endif
116+
#ifndef GL_DEPTH_ATTACHMENT
117+
#define GL_DEPTH_ATTACHMENT 0x8D00
118+
#endif
119+
#ifndef GL_STENCIL_ATTACHMENT
120+
#define GL_STENCIL_ATTACHMENT 0x8D20
121+
#endif
122+
#ifndef GL_FRAMEBUFFER_BINDING
123+
#define GL_FRAMEBUFFER_BINDING 0x8CA6
124+
#endif
125+
#ifndef GL_RENDERBUFFER_BINDING
126+
#define GL_RENDERBUFFER_BINDING 0x8CA7
127+
#endif
128+
#ifndef GL_READ_FRAMEBUFFER
129+
#define GL_READ_FRAMEBUFFER 0x8CA8
130+
#endif
131+
#ifndef GL_DRAW_FRAMEBUFFER
132+
#define GL_DRAW_FRAMEBUFFER 0x8CA9
133+
#endif
134+
#ifndef GL_STENCIL_INDEX8
135+
#define GL_STENCIL_INDEX8 0x8D48
136+
#endif
137+
#ifndef GL_RGBA8
138+
#define GL_RGBA8 0x8058
139+
#endif
140+
#ifndef GL_RGB8
141+
#define GL_RGB8 0x8051
142+
#endif
143+
#ifndef GL_VERTEX_ARRAY_BINDING
144+
#define GL_VERTEX_ARRAY_BINDING 0x85B5
145+
#endif
146+
#ifndef GL_NUM_EXTENSIONS
147+
#define GL_NUM_EXTENSIONS 0x821D
148+
#endif
31149
#endif
32150
#endif
33151

@@ -245,6 +363,10 @@ typedef char GLchar;
245363
#define GL_STENCIL_INDEX GL_STENCIL_INDEX8_OES
246364
#endif
247365

366+
#ifndef GL_STENCIL_INDEX8
367+
#define GL_STENCIL_INDEX8 GL_STENCIL_INDEX
368+
#endif
369+
248370
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
249371
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
250372
#define GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_OES
@@ -277,7 +399,7 @@ typedef char GLchar;
277399
#endif
278400

279401
#ifndef GL_MULTISAMPLE
280-
#define GL_MULTISAMPLE 0x809D
402+
#define GL_MULTISAMPLE 0x809D
281403
#endif
282404

283405
#include <eepp/graphics/renderer/rendererhelper.hpp>

include/eepp/graphics/renderer/renderer.hpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ class EE_API Renderer {
9696

9797
void activeTexture( unsigned int texture );
9898

99+
void clientActiveTextureImpl( unsigned int texture );
100+
99101
void blendFunc( unsigned int sfactor, unsigned int dfactor );
100102

101103
void blendFuncSeparate( unsigned int sfactorRGB, unsigned int dfactorRGB,
@@ -241,6 +243,73 @@ class EE_API Renderer {
241243

242244
void genVertexArrays( int n, unsigned int* arrays );
243245

246+
void genBuffers( int n, unsigned int* buffers );
247+
248+
void deleteBuffers( int n, const unsigned int* buffers );
249+
250+
void bindBuffer( unsigned int target, unsigned int buffer );
251+
252+
void bufferData( unsigned int target, IntPtr size, const void* data, unsigned int usage );
253+
254+
void bufferSubData( unsigned int target, IntPtr offset, IntPtr size, const void* data );
255+
256+
void vertexAttribPointer( unsigned int index, int size, unsigned int type, bool normalized,
257+
int stride, const void* pointer );
258+
259+
void enableVertexAttribArray( unsigned int index );
260+
261+
void disableVertexAttribArray( unsigned int index );
262+
263+
unsigned int createShader( unsigned int type );
264+
265+
void deleteShader( unsigned int shader );
266+
267+
void shaderSource( unsigned int shader, int count, const char* const* strings,
268+
const int* lengths );
269+
270+
void compileShader( unsigned int shader );
271+
272+
void getShaderiv( unsigned int shader, unsigned int pname, int* params );
273+
274+
void getShaderInfoLog( unsigned int shader, int maxLength, int* length, char* infoLog );
275+
276+
unsigned int createProgram();
277+
278+
void deleteProgram( unsigned int program );
279+
280+
void attachShader( unsigned int program, unsigned int shader );
281+
282+
void linkProgram( unsigned int program );
283+
284+
void useProgram( unsigned int program );
285+
286+
void getProgramiv( unsigned int program, unsigned int pname, int* params );
287+
288+
void getProgramInfoLog( unsigned int program, int maxLength, int* length, char* infoLog );
289+
290+
int getUniformLocation( unsigned int program, const char* name );
291+
292+
int getAttribLocation( unsigned int program, const char* name );
293+
294+
void uniform1i( int location, int value );
295+
296+
void uniform1f( int location, float value );
297+
298+
void uniform2fv( int location, int count, const float* value );
299+
300+
void uniform3fv( int location, int count, const float* value );
301+
302+
void uniform4f( int location, float x, float y, float z, float w );
303+
304+
void uniform4fv( int location, int count, const float* value );
305+
306+
void uniformMatrix4fv( int location, int count, bool transpose, const float* value );
307+
308+
void compressedTexImage2D( unsigned int target, int level, unsigned int internalFormat,
309+
int width, int height, int border, int imageSize, const void* data );
310+
311+
void getCompressedTexImage( unsigned int target, int level, void* pixels );
312+
244313
const bool& quadsSupported() const;
245314

246315
const int& quadVertex() const;

include/eepp/graphics/renderer/rendererhelper.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ enum GraphicsLibraryExtension {
3131
EEGL_IMG_texture_compression_pvrtc,
3232
EEGL_OES_compressed_ETC1_RGB8_texture,
3333
EEGL_EXT_blend_minmax,
34-
EEGL_EXT_blend_subtract
34+
EEGL_EXT_blend_subtract,
35+
EEGL_ARB_ES3_compatibility,
3536
};
3637

3738
/// Graphics Library Renderer version available.

premake4.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,8 @@ solution "eepp"
11161116
generate_os_links()
11171117
parse_args()
11181118

1119+
defines { "EE_DISABLE_GLEW" }
1120+
11191121
if os.is_real("macosx") then
11201122
defines { "GL_SILENCE_DEPRECATION" }
11211123
elseif os.is_real("ios") then

premake5.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,9 @@ workspace "eepp"
10681068
select_backend()
10691069
generate_os_links()
10701070
parse_args()
1071+
1072+
defines { "EE_DISABLE_GLEW" }
1073+
10711074
location("./make/" .. os.target() .. "/")
10721075
objdir("obj/" .. os.target() .. "/")
10731076

src/eepp/graphics/image.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,12 @@ bool Image::isImageExtension( const std::string& path ) {
647647
return ( ext == "png" || ext == "tga" || ext == "bmp" || ext == "jpg" || ext == "gif" ||
648648
ext == "jpeg" || ext == "dds" || ext == "psd" || ext == "hdr" || ext == "pic" ||
649649
ext == "pvr" || ext == "pkm" || ext == "svg" || ext == "qoi" || ext == "webp" ||
650-
ext == "jpe" );
650+
ext == "jpe" || ext == "astc" );
651651
}
652652

653653
std::vector<std::string> Image::getImageExtensionsSupported() {
654-
return std::vector<std::string>{ "png", "tga", "bmp", "jpg", "gif", "jpeg", "dds", "psd",
655-
"hdr", "pic", "pvr", "pkm", "svg", "qoi", "webp", "jpe" };
654+
return std::vector<std::string>{ "png", "tga", "bmp", "jpg", "gif", "jpeg", "dds", "psd", "hdr",
655+
"pic", "pvr", "pkm", "svg", "qoi", "webp", "jpe", "astc" };
656656
}
657657

658658
std::string Image::getLastFailureReason() {

0 commit comments

Comments
 (0)