removed flecs and setted up vulkan building

This commit is contained in:
Lorenzo Torres 2025-11-02 14:49:06 +01:00
parent 7be714b81f
commit 1f594fbed7
8 changed files with 24 additions and 127415 deletions

View file

@ -0,0 +1,9 @@
vertex float4 basic_vertex( // 1
const device packed_float3* vertex_array [[ buffer(0) ]], // 2
unsigned int vid [[ vertex_id ]]) { // 3
return float4(vertex_array[vid], 1.0); // 4
}
fragment half4 basic_fragment() { // 1
return half4(1.0); // 2
}

View file

@ -3,7 +3,7 @@
CC := cc CC := cc
CFLAGS := -Wall -Wextra -std=c99 -pedantic -ggdb -O2 CFLAGS := -Wall -Wextra -std=c99 -pedantic -ggdb -O2
LIBS := -lm LIBS := -lm
# if this is set to gl, it will use OpenGL, otherwise it will use Vulkan # can be gl or vk
BACKEND := gl BACKEND := gl
PLATFORM := $(shell uname) PLATFORM := $(shell uname)
@ -11,14 +11,18 @@ PLATFORM := $(shell uname)
ifeq (${BACKEND},gl) ifeq (${BACKEND},gl)
CFLAGS += -DBACKEND_GL CFLAGS += -DBACKEND_GL
ifeq (${PLATFORM},Darwin) ifeq (${PLATFORM},Darwin)
LIBS += -framework Cocoa -framework CoreVideo -framework OpenGL -framework IOKit LIBS += -framework OpenGL
else else
LIBS += -lGL LIBS += -lGL
endif endif
else else
CFLAGS := -DBACKEND_VK LIBS += -lvulkan
CFLAGS += -DBACKEND_VK
endif endif
ifeq (${PLATFORM},Darwin) ifeq (${PLATFORM},Darwin)
CFLAGS += -DPLATFORM_MACOS CFLAGS += -DPLATFORM_MACOS
LIBS += -framework Cocoa -framework CoreVideo -framework IOKit
else ifeq (${PLATFORM},Linux)
CFLAGS += -DPLATFORM_LINUX
endif endif

91278
flecs.c

File diff suppressed because it is too large Load diff

36107
flecs.h

File diff suppressed because it is too large Load diff

View file

@ -2,11 +2,14 @@
include config.mk include config.mk
SRC:=topaz.c linear.c flecs.c SRC:=topaz.c linear.c
ifeq (${BACKEND},gl) ifeq (${BACKEND},gl)
SRC += gl/gl.c gl/platform.c SRC += gl/gl.c gl/platform.c
endif endif
ifeq (${BACKEND},vk)
SRC += vk/platform.c
endif
OBJ:=${SRC:.c=.o} OBJ:=${SRC:.c=.o}

View file

@ -9,6 +9,9 @@ struct mesh {
usize size; usize size;
}; };
struct renderer_context;
struct renderer_context *renderer_create_context(void);
struct mesh renderer_build_chunk_mesh(); struct mesh renderer_build_chunk_mesh();
void renderer_draw_mesh(struct mesh); void renderer_draw_mesh(struct mesh);
void renderer_draw_chunk(struct mesh); void renderer_draw_chunk(struct mesh);

26
rgfw.h
View file

@ -353,31 +353,7 @@ int main() {
#define RGFW_HEADER #define RGFW_HEADER
#include <stddef.h> #include "types.h"
#ifndef RGFW_INT_DEFINED
#ifdef RGFW_USE_INT /* optional for any system that might not have stdint.h */
typedef unsigned char u8;
typedef signed char i8;
typedef unsigned short u16;
typedef signed short i16;
typedef unsigned long int u32;
typedef signed long int i32;
typedef unsigned long long u64;
typedef signed long long i64;
#else /* use stdint standard types instead of c "standard" types */
#include <stdint.h>
typedef uint8_t u8;
typedef int8_t i8;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint64_t u64;
typedef int64_t i64;
#endif
#define RGFW_INT_DEFINED
#endif
typedef ptrdiff_t RGFW_ssize_t; typedef ptrdiff_t RGFW_ssize_t;

View file

@ -1,5 +1,4 @@
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
#ifndef TYPES_H #ifndef TYPES_H
#define TYPES_H #define TYPES_H