mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
Add dedicated min soft GPU backend
Intended for slow FPU less systems like GBA/32x
This commit is contained in:
parent
8198a50fd6
commit
9d2b38d972
15
src/Core.h
15
src/Core.h
@ -146,6 +146,7 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_GFX_BACKEND_D3D11 5
|
||||
#define CC_GFX_BACKEND_VULKAN 6
|
||||
#define CC_GFX_BACKEND_GL11 7
|
||||
#define CC_GFX_BACKEND_SOFTMIN 8
|
||||
|
||||
#define CC_SSL_BACKEND_NONE 1
|
||||
#define CC_SSL_BACKEND_BEARSSL 2
|
||||
@ -490,20 +491,19 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_NOFPU
|
||||
#undef CC_BUILD_RESOURCES
|
||||
#undef CC_BUILD_NETWORKING
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#undef CC_BUILD_FILESYSTEM
|
||||
#define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_UI
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#undef CC_BUILD_FILESYSTEM
|
||||
#define CC_DISABLE_EXTRA_MODELS
|
||||
#define SOFTGPU_DISABLE_ZBUFFER
|
||||
#undef CC_VAR
|
||||
#define CC_VAR __attribute__((visibility("default"), section(".ewram")))
|
||||
#undef CC_BIG_VAR
|
||||
#define CC_BIG_VAR __attribute__((section(".ewram")))
|
||||
#define DEFAULT_NET_BACKEND CC_NET_BACKEND_BUILTIN
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_NULL
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_SOFTGPU
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_SOFTMIN
|
||||
#elif defined PLAT_NDS
|
||||
#define CC_BUILD_NDS
|
||||
#define CC_BUILD_CONSOLE
|
||||
@ -591,14 +591,13 @@ typedef cc_uint8 cc_bool;
|
||||
#define CC_BUILD_NOFPU
|
||||
#undef CC_BUILD_RESOURCES
|
||||
#undef CC_BUILD_NETWORKING
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#undef CC_BUILD_FILESYSTEM
|
||||
#define CC_DISABLE_ANIMATIONS /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_HELDBLOCK /* Very costly in FPU less system */
|
||||
#define CC_DISABLE_UI
|
||||
#undef CC_BUILD_ADVLIGHTING
|
||||
#undef CC_BUILD_FILESYSTEM
|
||||
#define CC_DISABLE_EXTRA_MODELS
|
||||
#define SOFTGPU_DISABLE_ZBUFFER
|
||||
#define CC_GFX_BACKEND CC_GFX_BACKEND_SOFTGPU
|
||||
#define DEFAULT_GFX_BACKEND CC_GFX_BACKEND_SOFTMIN
|
||||
#define DEFAULT_AUD_BACKEND CC_AUD_BACKEND_NULL
|
||||
#elif defined __SYMBIAN32__
|
||||
#define CC_BUILD_SYMBIAN
|
||||
|
@ -704,6 +704,7 @@ static CC_NOINLINE void BuildMapSides(void) {
|
||||
struct VertexTextured* data;
|
||||
|
||||
if (!World.Loaded) return;
|
||||
/*if (Gfx.Limitations & GFX_LIMIT_WORLD_ONLY) return;*/
|
||||
block = Env.SidesBlock;
|
||||
|
||||
if (Blocks.Draw[block] == DRAW_GAS) return;
|
||||
@ -756,6 +757,7 @@ static CC_NOINLINE void BuildMapEdges(void) {
|
||||
struct VertexTextured* data;
|
||||
|
||||
if (!World.Loaded) return;
|
||||
/*if (Gfx.Limitations & GFX_LIMIT_WORLD_ONLY) return;*/
|
||||
block = Env.EdgeBlock;
|
||||
|
||||
if (Blocks.Draw[block] == DRAW_GAS) return;
|
||||
|
@ -103,6 +103,8 @@ CC_VAR extern struct _GfxData {
|
||||
#define GFX_LIMIT_MAX_VERTEX_SIZE 0x04
|
||||
/* Whether the graphics backend is minimal (no fog, clouds, sky) */
|
||||
#define GFX_LIMIT_MINIMAL 0x08
|
||||
/* Whether the graphics backend shouldn't have horizon/border drawn */
|
||||
#define GFX_LIMIT_WORLD_ONLY 0x10
|
||||
|
||||
extern const cc_string Gfx_LowPerfMessage;
|
||||
|
||||
|
@ -39,14 +39,8 @@ void Gfx_FreeState(void) {
|
||||
}
|
||||
|
||||
void Gfx_Create(void) {
|
||||
#if defined CC_BUILD_32X || defined CC_BUILD_GBA
|
||||
Gfx.MaxTexWidth = 16;
|
||||
Gfx.MaxTexHeight = 16;
|
||||
#else
|
||||
Gfx.MaxTexWidth = 4096;
|
||||
Gfx.MaxTexHeight = 4096;
|
||||
#endif
|
||||
|
||||
Gfx.Created = true;
|
||||
Gfx.BackendType = CC_GFX_BACKEND_SOFTGPU;
|
||||
Gfx.Limitations = GFX_LIMIT_MINIMAL;
|
||||
@ -166,10 +160,8 @@ static void ClearColorBuffer(void) {
|
||||
}
|
||||
|
||||
static void ClearDepthBuffer(void) {
|
||||
#ifndef SOFTGPU_DISABLE_ZBUFFER
|
||||
int i, size = fb_width * fb_height;
|
||||
for (i = 0; i < size; i++) depthBuffer[i] = 100000000.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Gfx_ClearBuffers(GfxBuffers buffers) {
|
||||
@ -664,15 +656,11 @@ static void DrawTriangle3D(Vertex* V0, Vertex* V1, Vertex* V2) {
|
||||
float w = 1 / (ic0 * w0 + ic1 * w1 + ic2 * w2);
|
||||
float z = (ic0 * z0 + ic1 * z1 + ic2 * z2) * w;
|
||||
|
||||
#ifndef SOFTGPU_DISABLE_ZBUFFER
|
||||
if (depthTest && (z < 0 || z > depthBuffer[db_index])) continue;
|
||||
if (!colWrite) {
|
||||
if (depthWrite) depthBuffer[db_index] = z;
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
if (!colWrite) continue;
|
||||
#endif
|
||||
|
||||
if (texturing) {
|
||||
float u = (ic0 * u0 + ic1 * u1 + ic2 * u2) * w;
|
||||
@ -687,9 +675,7 @@ static void DrawTriangle3D(Vertex* V0, Vertex* V1, Vertex* V2) {
|
||||
}
|
||||
|
||||
if (gfx_alphaTest && A < 0x80) continue;
|
||||
#ifndef SOFTGPU_DISABLE_ZBUFFER
|
||||
if (depthWrite) depthBuffer[db_index] = z;
|
||||
#endif
|
||||
int cb_index = y * cb_stride + x;
|
||||
|
||||
if (!gfx_alphaBlend) {
|
||||
@ -1084,10 +1070,8 @@ void Gfx_OnWindowResize(void) {
|
||||
colorBuffer = fb_bmp.scan0;
|
||||
cb_stride = fb_bmp.width;
|
||||
|
||||
#ifndef SOFTGPU_DISABLE_ZBUFFER
|
||||
depthBuffer = Mem_Alloc(fb_width * fb_height, 4, "depth buffer");
|
||||
db_stride = fb_width;
|
||||
#endif
|
||||
|
||||
Gfx_SetViewport(0, 0, Game.Width, Game.Height);
|
||||
Gfx_SetScissor (0, 0, Game.Width, Game.Height);
|
||||
|
1043
src/Graphics_SoftMin.c
Normal file
1043
src/Graphics_SoftMin.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user