srp
software rendering pipeline
Loading...
Searching...
No Matches
defines.h
Go to the documentation of this file.
1// Software Rendering Pipeline (SRP) library
2// Licensed under GNU GPLv3
3
7#pragma once
8
11#if defined(SRP_MALLOC) && defined(SRP_FREE) && defined(SRP_REALLOC)
12 // ok
13#elif !defined(SRP_MALLOC) && !defined(SRP_FREE) && !defined(SRP_REALLOC)
14 #include <stdlib.h>
15 #include "memory/alloc.h"
16 #define SRP_MALLOC(s) srpMalloc(s)
17 #define SRP_REALLOC(p, s) srpRealloc(p, s)
18 #define SRP_FREE(p) free(p)
19#else
20 #error "Must define all or none of SRP_MALLOC, SRP_FREE, and SRP_REALLOC"
21#endif
// ingroup Memory_allocation
23
26#ifndef SRP_FORCEINLINE
27 #if defined(__clang__) // clang
28 #define SRP_FORCEINLINE inline
29 #elif defined(__GNUC__) // gcc
30 #define SRP_FORCEINLINE __attribute__((always_inline)) inline
31 #elif defined(_MSC_VER) // msvc
32 #define SRP_FORCEINLINE __forceinline
33 #else
34 #define SRP_FORCEINLINE inline
35 #warning \
36 "Unrecognized compiler - setting `SRP_FORCEINLINE` to just `inline` \
37 (it is not forced anymore!)"
38 #endif
39#endif
// ingroup Various_internal