Haiku: Fix default build

Minorly simplify OpenGL context code too
This commit is contained in:
UnknownShadow200 2022-10-31 23:42:57 +11:00
parent 25a783dd27
commit b714af1fe0
6 changed files with 14 additions and 18 deletions

View File

@ -162,7 +162,7 @@ Install libexecinfo, curl and openal-soft package if needed
Install openal_devel and libexecinfo_devel package if needed Install openal_devel and libexecinfo_devel package if needed
```cc *.c -o ClassiCube -lm -lexecinfo -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker``` ```cc *.c Window_Haiku.cpp -o ClassiCube -lm -lexecinfo -lGL -lnetwork -lstdc++ -lbe -lgame -ltracker```
#### SerenityOS #### SerenityOS

View File

@ -245,7 +245,6 @@ Thus it is **NOT SAFE** to allocate a string on the stack. */
#define CC_BUILD_GL #define CC_BUILD_GL
#define CC_BUILD_CURL #define CC_BUILD_CURL
#define CC_BUILD_OPENAL #define CC_BUILD_OPENAL
#define CC_BUILD_SDL
#elif defined __EMSCRIPTEN__ #elif defined __EMSCRIPTEN__
#define CC_BUILD_WEB #define CC_BUILD_WEB
#define CC_BUILD_GL #define CC_BUILD_GL

View File

@ -1009,7 +1009,7 @@ void imdct_init(struct imdct_state* state, int n) {
} }
void imdct_calc(float* in, float* out, struct imdct_state* state) { void imdct_calc(float* in, float* out, struct imdct_state* state) {
int k, k2, k4, k8, n = state->n; int k, k2, k4, n = state->n;
int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, n3_4 = n - n4; int n2 = n >> 1, n4 = n >> 2, n8 = n >> 3, n3_4 = n - n4;
int l, log2_n; int l, log2_n;
cc_uint32* reversed; cc_uint32* reversed;
@ -1025,7 +1025,7 @@ void imdct_calc(float* in, float* out, struct imdct_state* state) {
float x_1, x_2, y_1, y_2; float x_1, x_2, y_1, y_2;
/* spectral coefficients, step 1, step 2 */ /* spectral coefficients, step 1, step 2 */ /* TODO avoid k */
for (k = 0, k2 = 0, k4 = 0; k < n8; k++, k2 += 2, k4 += 4) { for (k = 0, k2 = 0, k4 = 0; k < n8; k++, k2 += 2, k4 += 4) {
e_1 = -in[k4+3]; e_2 = -in[k4+1]; e_1 = -in[k4+3]; e_2 = -in[k4+1];
g_1 = e_1 * A[n2-1-k2] + e_2 * A[n2-2-k2]; g_1 = e_1 * A[n2-1-k2] + e_2 * A[n2-2-k2];
@ -1071,7 +1071,7 @@ void imdct_calc(float* in, float* out, struct imdct_state* state) {
/* step 4, step 5, step 6, step 7, step 8, output */ /* step 4, step 5, step 6, step 7, step 8, output */
reversed = state->reversed; reversed = state->reversed;
for (k = 0, k2 = 0, k8 = 0; k < n8; k++, k2 += 2, k8 += 8) { for (k = 0, k2 = 0; k < n8; k++, k2 += 2) {
cc_uint32 j = reversed[k], j4 = j << 2; cc_uint32 j = reversed[k], j4 = j << 2;
e_1 = u[n2-j4-1]; e_2 = u[n2-j4-2]; e_1 = u[n2-j4-1]; e_2 = u[n2-j4-2];
f_1 = u[j4+1]; f_2 = u[j4+0]; f_1 = u[j4+1]; f_2 = u[j4+0];

View File

@ -179,6 +179,7 @@ void Window_UpdateRawMouse(void);
/* Cursor will also be unhidden and moved back to window centre. */ /* Cursor will also be unhidden and moved back to window centre. */
void Window_DisableRawMouse(void); void Window_DisableRawMouse(void);
/* OpenGL contexts are heavily tied to the window, so for simplicitly are also provided here */
#ifdef CC_BUILD_GL #ifdef CC_BUILD_GL
#define GLCONTEXT_DEFAULT_DEPTH 24 #define GLCONTEXT_DEFAULT_DEPTH 24
/* Creates an OpenGL context, then makes it the active context. */ /* Creates an OpenGL context, then makes it the active context. */

View File

@ -22,6 +22,13 @@
/*########################################################################################################################* /*########################################################################################################################*
*---------------------------------------------------------General---------------------------------------------------------* *---------------------------------------------------------General---------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
static void GLContext_GetAll(const struct DynamicLibSym* syms, int count) {
int i;
for (i = 0; i < count; i++) {
*syms[i].symAddr = GLContext_GetAddress(syms[i].name);
}
}
static void GL_UpdateVsync(void) { static void GL_UpdateVsync(void) {
GLContext_SetFpsLimit(gfx_vsync, gfx_minFrameMs); GLContext_SetFpsLimit(gfx_vsync, gfx_minFrameMs);
} }

View File

@ -105,21 +105,11 @@ static void InitGraphicsMode(struct GraphicsMode* m) {
} }
} }
#ifdef CC_BUILD_GL /* EGL is window system agnostic, other OpenGL context backends are tied to one windowing system */
/* OpenGL contexts are heavily tied to the window, so for simplicitly are also included here */ #if defined CC_BUILD_GL && defined CC_BUILD_EGL
/* EGL is window system agnostic, other OpenGL context backends are tied to one windowing system. */
void GLContext_GetAll(const struct DynamicLibSym* syms, int count) {
int i;
for (i = 0; i < count; i++) {
*syms[i].symAddr = GLContext_GetAddress(syms[i].name);
}
}
/*########################################################################################################################* /*########################################################################################################################*
*-------------------------------------------------------EGL OpenGL--------------------------------------------------------* *-------------------------------------------------------EGL OpenGL--------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
#if defined CC_BUILD_EGL
#include <EGL/egl.h> #include <EGL/egl.h>
static EGLDisplay ctx_display; static EGLDisplay ctx_display;
static EGLContext ctx_context; static EGLContext ctx_context;
@ -225,4 +215,3 @@ void GLContext_SetFpsLimit(cc_bool vsync, float minFrameMs) {
} }
void GLContext_GetApiInfo(cc_string* info) { } void GLContext_GetApiInfo(cc_string* info) { }
#endif #endif
#endif