From 03bc758be75674e3918635f1cb297c187168fca1 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Wed, 18 Mar 2020 20:47:12 +0000 Subject: [PATCH] Allow enabling fsaa via the GLdcConfig struct --- GL/flush.c | 8 +++++--- GL/version.h | 3 ++- include/glkos.h | 3 +++ samples/lights/main.c | 7 ++++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/GL/flush.c b/GL/flush.c index 408c680..95a6dde 100644 --- a/GL/flush.c +++ b/GL/flush.c @@ -39,13 +39,13 @@ static void pvr_list_submit(void *src, int n) { d[0] = d[8] = 0; } -static void _glInitPVR(GLboolean autosort) { +static void _glInitPVR(GLboolean autosort, GLboolean fsaa) { pvr_init_params_t params = { /* Enable opaque and translucent polygons with size 32 and 32 */ {PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_32}, PVR_VERTEX_BUF_SIZE, /* Vertex buffer size */ 0, /* No DMA */ - 0, /* No FSAA */ + fsaa, /* No FSAA */ (autosort) ? 0 : 1 /* Disable translucent auto-sorting to match traditional GL */ }; @@ -78,6 +78,8 @@ void APIENTRY glFinish() { void APIENTRY glKosInitConfig(GLdcConfig* config) { config->autosort_enabled = GL_FALSE; + config->fsaa_enabled = GL_FALSE; + config->initial_op_capacity = 1024; config->initial_pt_capacity = 512; config->initial_tr_capacity = 1024; @@ -90,7 +92,7 @@ void APIENTRY glKosInitEx(GLdcConfig* config) { printf("\nWelcome to GLdc! Git revision: %s\n\n", GLDC_VERSION); - _glInitPVR(config->autosort_enabled); + _glInitPVR(config->autosort_enabled, config->fsaa_enabled); _glInitMatrices(); _glInitAttributePointers(); diff --git a/GL/version.h b/GL/version.h index a151a30..c2cd018 100644 --- a/GL/version.h +++ b/GL/version.h @@ -1,2 +1,3 @@ #pragma once -#define GLDC_VERSION "1.1-master" +#define GLDC_VERSION "1.1-102-g71c25-dirty" + diff --git a/include/glkos.h b/include/glkos.h index 5af510b..4f2aaf8 100644 --- a/include/glkos.h +++ b/include/glkos.h @@ -42,6 +42,9 @@ typedef struct { /* If GL_TRUE, enables pvr autosorting, this *will* break glDepthFunc/glDepthTest */ GLboolean autosort_enabled; + /* If GL_TRUE, enables the PVR FSAA */ + GLboolean fsaa_enabled; + /* The internal format for paletted textures, must be GL_RGBA4 (default) or GL_RGBA8 */ GLenum internal_palette_format; diff --git a/samples/lights/main.c b/samples/lights/main.c index c6c2609..04f664b 100644 --- a/samples/lights/main.c +++ b/samples/lights/main.c @@ -283,7 +283,12 @@ void DrawGLScene() int main(int argc, char **argv) { - glKosInit(); + GLdcConfig config; + + glKosInitConfig(&config); + config.fsaa_enabled = GL_TRUE; + + glKosInitEx(&config); InitGL(640, 480); ReSizeGLScene(640, 480);