Repaired OpenGL / Dreamcast build

This commit is contained in:
mrq 2024-12-03 19:00:47 -06:00 committed by ecker
parent a521f045ba
commit 6b37b2fa0e
16 changed files with 36 additions and 25 deletions

View File

@ -120,7 +120,7 @@ ifneq (,$(findstring imgui,$(REQ_DEPS)))
INCS += -I./dep/include/imgui/ INCS += -I./dep/include/imgui/
INCS += -I./dep/include/imgui/backends INCS += -I./dep/include/imgui/backends
endif endif
ifneq (,$(findstring imgui,$(REQ_DEPS))) ifneq (,$(findstring cpptrace,$(REQ_DEPS)))
DEPS += -lcpptrace DEPS += -lcpptrace
endif endif
ifneq (,$(findstring json,$(REQ_DEPS))) ifneq (,$(findstring json,$(REQ_DEPS)))

View File

@ -245,19 +245,26 @@
} }
}, },
"opengl": { "opengl": {
"validation": { "enabled": false }, "validation": { "enabled": true },
"framebuffer": { "size": 1, "msaa": 1 }, "framebuffer": { "size": 1, "msaa": 1 },
"experimental": { "experimental": {
"rebuild on tick begin": true "rebuild on tick begin": false
}, },
"pipelines": { "pipelines": {
"culling": true "culling": false
}, },
"experimental": { "experimental": {
"rebuild on tick begin": true "rebuild on tick begin": false,
"batch queue submissions": true,
"dedicated thread": false,
"memory budget": false,
"register render modes": false
}, },
"invariant": { "invariant": {
"multithreaded recording": false "default stage buffers": true,
"default defer buffer destroy": true,
"default command buffer immediate": true,
"multithreaded recording": true
}, },
"formats": { "formats": {
"depth": "D32_SFLOAT", "depth": "D32_SFLOAT",

View File

@ -1,8 +1,8 @@
{ {
"import": "./base_sourceengine.json", "import": "./base_sourceengine.json",
"assets": [ "assets": [
{ "filename": "./models/animal_crossing.glb" }, // { "filename": "./models/animal_crossing.glb" },
// { "filename": "./models/animal_crossing/graph.json" }, { "filename": "./models/animal_crossing/graph.json" },
// { "filename": "./models/animal_crossing_small.glb" }, // { "filename": "./models/animal_crossing_small.glb" },
// { "filename": "./models/animal_crossing_small/graph.json" }, // { "filename": "./models/animal_crossing_small/graph.json" },

View File

@ -11,12 +11,12 @@
// exact matches // exact matches
"worldspawn": { "worldspawn": {
"physics": { "type": "mesh", "static": true }, "physics": { "type": "mesh", "static": true },
"grid": { "size": [16,1,16], "epsilon": 0.001, "cleanup": true, "print": true }, "grid": { "size": [8,1,8], "epsilon": 0.001, "cleanup": true, "print": true },
"optimize meshlets": { "simplify": 0.125, "print": false }, "optimize meshlets": { "simplify": 0.125, "print": false },
"unwrap mesh": true "unwrap mesh": true
}, },
"worldspawn_skybox": { "worldspawn_skybox": {
"grid": { "size": [16,1,16], "epsilon": 0.001, "cleanup": true, "print": true }, "grid": { "size": [8,1,8], "epsilon": 0.001, "cleanup": true, "print": true },
"optimize meshlets": { "simplify": 0.125, "print": false }, "optimize meshlets": { "simplify": 0.125, "print": false },
"unwrap mesh": true "unwrap mesh": true
}, },

View File

@ -1,8 +1,8 @@
{ {
"import": "./base_sourceengine.json", "import": "./base_sourceengine.json",
"assets": [ "assets": [
{ "filename": "./models/ss2_medsci1_small.glb" } // { "filename": "./models/ss2_medsci1_smallish.glb" }
// { "filename": "./models/ss2_medsci1_small/graph.json" } { "filename": "./models/ss2_medsci1_smallish/graph.json" }
], ],
"metadata": { "metadata": {
"graph": { "graph": {

View File

@ -5,7 +5,7 @@
"matrix": { "reverseInfinite": true }, "matrix": { "reverseInfinite": true },
"meshes": { "interleaved": false }, "meshes": { "interleaved": false },
"lights": { "enabled": true, "lights": { "enabled": true,
"useLightmaps": false, "useLightmaps": true,
"max": 1, "max": 1,
"shadows": { "shadows": {
"enabled": false, "enabled": false,

View File

@ -65,7 +65,7 @@ namespace ext {
// RAII // RAII
~Buffer(); ~Buffer();
void initialize( Device& device ); void initialize( Device& device );
void destroy(); void destroy(bool=false);
}; };
struct UF_API Buffers { struct UF_API Buffers {
uf::stl::vector<Buffer> buffers; uf::stl::vector<Buffer> buffers;
@ -74,7 +74,7 @@ namespace ext {
// ~Buffers(); // ~Buffers();
// //
void initialize( Device& device ); void initialize( Device& device );
void destroy(); void destroy(bool=false);
// //
size_t initializeBuffer( const void*, GLsizeiptr, GLenum, bool = false ); size_t initializeBuffer( const void*, GLsizeiptr, GLenum, bool = false );

View File

@ -83,4 +83,6 @@
#else #else
#define GL_MUTEX_LOCK(); #define GL_MUTEX_LOCK();
#define GL_MUTEX_UNLOCK(); #define GL_MUTEX_UNLOCK();
#endif #endif
#define GL_DEFAULT_DEFER_BUFFER_DESTROY ext::opengl::settings::defaultDeferBufferDestroy

View File

@ -34,6 +34,7 @@ namespace ext {
extern UF_API bool dedicatedThread; extern UF_API bool dedicatedThread;
extern UF_API bool rebuildOnTickBegin; extern UF_API bool rebuildOnTickBegin;
extern UF_API bool batchQueueSubmissions; extern UF_API bool batchQueueSubmissions;
extern UF_API bool registerRenderMode;
} }
namespace validation { namespace validation {

View File

@ -6,4 +6,4 @@
// include universal // include universal
#include "universal.h" #include "universal.h"
// defines which implementation to use // defines which implementation to use
#include UF_ENV_HEADER #include UF_ENV_HEADER

View File

@ -6,4 +6,4 @@
// include universal // include universal
#include "universal.h" #include "universal.h"
// defines which implementation to use // defines which implementation to use
#include UF_ENV_HEADER #include UF_ENV_HEADER

View File

@ -6,4 +6,4 @@
// include universal // include universal
#include "universal.h" #include "universal.h"
// defines which implementation to use // defines which implementation to use
#include UF_ENV_HEADER #include UF_ENV_HEADER

View File

@ -6,4 +6,4 @@
// include universal // include universal
#include "universal.h" #include "universal.h"
// defines which implementation to use // defines which implementation to use
#include UF_ENV_HEADER #include UF_ENV_HEADER

View File

@ -112,7 +112,7 @@ ext::opengl::Buffer::~Buffer() {
void ext::opengl::Buffer::initialize( Device& device ) { void ext::opengl::Buffer::initialize( Device& device ) {
this->device = &device; this->device = &device;
} }
void ext::opengl::Buffer::destroy() { void ext::opengl::Buffer::destroy( bool defer ) {
if ( device && buffer ) device->destroyBuffer( buffer ); if ( device && buffer ) device->destroyBuffer( buffer );
device = NULL; device = NULL;
buffer = NULL; buffer = NULL;
@ -124,8 +124,8 @@ void ext::opengl::Buffers::initialize( Device& device ) {
this->device = &device; this->device = &device;
} }
void ext::opengl::Buffers::destroy() { void ext::opengl::Buffers::destroy( bool defer ) {
for ( auto& buffer : buffers ) buffer.destroy(); for ( auto& buffer : buffers ) buffer.destroy(defer);
buffers.clear(); buffers.clear();
} }

View File

@ -431,10 +431,10 @@ void ext::opengl::Graphic::record( CommandBuffer& commandBuffer, const GraphicDe
drawCommandInfo.descriptor.inputs.vertex.first = drawCommand.vertexID; drawCommandInfo.descriptor.inputs.vertex.first = drawCommand.vertexID;
drawCommandInfo.descriptor.inputs.vertex.count = drawCommand.vertices; drawCommandInfo.descriptor.inputs.vertex.count = drawCommand.vertices;
drawCommandInfo.attributes.instance.pointer = &instance; drawCommandInfo.attributes.instance.pointer = (uint8_t*) (void*) &instance;
drawCommandInfo.attributes.instance.length = sizeof(instance); drawCommandInfo.attributes.instance.length = sizeof(instance);
drawCommandInfo.attributes.indirect.pointer = &drawCommand; drawCommandInfo.attributes.indirect.pointer = (uint8_t*) (void*) &drawCommand;
drawCommandInfo.attributes.indirect.length = sizeof(drawCommand); drawCommandInfo.attributes.indirect.length = sizeof(drawCommand);
drawCommandInfo.matrices.model = &instance.model; drawCommandInfo.matrices.model = &instance.model;

View File

@ -50,6 +50,7 @@ bool ext::opengl::settings::experimental::dedicatedThread = true;
#endif #endif
bool ext::opengl::settings::experimental::rebuildOnTickBegin = false; bool ext::opengl::settings::experimental::rebuildOnTickBegin = false;
bool ext::opengl::settings::experimental::batchQueueSubmissions = false; bool ext::opengl::settings::experimental::batchQueueSubmissions = false;
bool ext::opengl::settings::experimental::registerRenderMode = true;
// not so experimental // not so experimental
bool ext::opengl::settings::invariant::waitOnRenderEnd = false; bool ext::opengl::settings::invariant::waitOnRenderEnd = false;