Fix an assertion in debug, and building on PC

This commit is contained in:
Luke Benstead 2021-09-18 14:36:47 +01:00
parent cf996b9e80
commit dd16530a1f
4 changed files with 14 additions and 3 deletions

View File

@ -23,9 +23,12 @@ include_directories(include)
if(NOT PLATFORM_DREAMCAST) if(NOT PLATFORM_DREAMCAST)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
set(FIND_LIBRARY_USE_LIB32_PATHS true)
set(FIND_LIBRARY_USE_LIB64_PATHS false)
endif() endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 --fast-math -fexpensive-optimizations -funroll-all-loops") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 --fast-math -fexpensive-optimizations -funroll-all-loops")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g")
set( set(
SOURCES SOURCES
@ -60,7 +63,9 @@ configure_file(GL/version.c.in ${CMAKE_CURRENT_BINARY_DIR}/version.c)
if(PLATFORM_DREAMCAST) if(PLATFORM_DREAMCAST)
set(SOURCES ${SOURCES} GL/platforms/sh4.c) set(SOURCES ${SOURCES} GL/platforms/sh4.c)
else() else()
find_package(SDL2 REQUIRED) find_package(PkgConfig)
pkg_check_modules(SDL2 REQUIRED sdl2)
include_directories(${SDL2_INCLUDE_DIRS}) include_directories(${SDL2_INCLUDE_DIRS})
link_libraries(${SDL2_LIBRARIES}) link_libraries(${SDL2_LIBRARIES})
set( set(

View File

@ -209,6 +209,8 @@ static inline void markDead(Vertex* vert) {
#define MAX_CLIP_TRIANGLES 255 #define MAX_CLIP_TRIANGLES 255
void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) { void _glClipTriangleStrip(SubmissionTarget* target, uint8_t fladeShade) {
printf("WHAT");
static Triangle TO_CLIP[MAX_CLIP_TRIANGLES]; static Triangle TO_CLIP[MAX_CLIP_TRIANGLES];
static uint8_t CLIP_COUNT = 0; static uint8_t CLIP_COUNT = 0;

View File

@ -47,6 +47,8 @@ typedef struct {
void _glInitImmediateMode(GLuint initial_size) { void _glInitImmediateMode(GLuint initial_size) {
printf("WHAT WHAT");
aligned_vector_init(&VERTICES, sizeof(IMVertex)); aligned_vector_init(&VERTICES, sizeof(IMVertex));
aligned_vector_reserve(&VERTICES, initial_size); aligned_vector_reserve(&VERTICES, initial_size);

View File

@ -79,14 +79,16 @@ AV_FORCE_INLINE void* aligned_vector_resize(AlignedVector* vector, const unsigne
if(vector->capacity < element_count) { if(vector->capacity < element_count) {
/* If we didn't have capacity, increase capacity (slow) */ /* If we didn't have capacity, increase capacity (slow) */
vector->size = element_count;
ret = aligned_vector_reserve(vector, element_count); ret = aligned_vector_reserve(vector, element_count);
} else if(previousCount < element_count) { } else if(previousCount < element_count) {
/* So we grew, but had the capacity, just get a pointer to /* So we grew, but had the capacity, just get a pointer to
* where we were */ * where we were */
ret = aligned_vector_at(vector, previousCount);
}
vector->size = element_count; vector->size = element_count;
ret = aligned_vector_at(vector, previousCount);
} else {
vector->size = element_count;
}
return ret; return ret;
} }