shengine pre-release
shengine by mrsinho
Loading...
Searching...
No Matches
shEngine.h File Reference

Declares the ShEngine structure and associated functions for managing the engine. More...

#include "shengine/shEngineVkCore.h"
#include "shengine/shWindow.h"
#include "shengine/shTime.h"
#include "shengine/shProfiling.h"
#include "shengine/shInput.h"
#include "shengine/shScene.h"
#include "shengine/shEngineUI.h"
#include "shapplication-host/shApplicationHost.h"
#include "shenvironment/shEnvironment.h"
#include "shenvironment/shFileUtilities.h"
#include <shthreads/shthreads.h>
#include <smd/smd.h>

Go to the source code of this file.

Data Structures

struct  ShEngine
 Represents the ShEngine structure, which is the main instance of the engine. More...
 

Macros

#define SH_ENGINE_SWAPCHAIN_IMAGE_COUNT   2
 Number of swapchain images in the engine.
 
#define SH_ENGINE_MAX_SWAPCHAIN_IMAGE_COUNT   6
 Maximum number of swapchain images in the engine.
 
#define SH_ENGINE_RENDERPASS_ATTACHMENT_COUNT   3
 Number of renderpass attachments in the engine.
 
#define SH_ENGINE_SUBPASS_COLOR_ATTACHMENT_COUNT   1
 Number of color attachments in a subpass in the engine.
 
#define SH_TRUE   1
 Boolean value representing true.
 
#define SH_FALSE   0
 Boolean value representing false.
 
#define shAllocateEngine()   (ShEngine*)calloc(1, sizeof(ShEngine));
 Allocates memory for a new ShEngine instance.
 
#define shFreeEngine(p_engine)   free(p_engine); (p_engine) = NULL
 Frees the memory of a ShEngine instance.
 
#define shEngineError(condition, msg, failure_expression)    if ((int)(condition)) { printf("shengine error: %s.\n", msg); failure_expression; }
 Generates an error message for the shengine module.
 
#define shApplicationError(condition, msg, failure_expression)    if ((int)(condition)) { printf("shapplication error: %s. \n", msg); failure_expression; }
 Generates an error message for the ShApplication.
 
#define SH_ENGINE_READY   1
 Represents the engine being ready.
 
#define SH_ENGINE_NOT_READY   0
 Represents the engine not being ready.
 

Typedefs

typedef struct ShEngine ShEngine
 

Functions

uint8_t shEngineSetupVulkan (ShEngine *p_engine)
 Sets up Vulkan for the shengine module.
 
uint8_t shAllocateProfilingHandle (ShEngine *p_engine)
 Allocates a profiling handle for the shengine module.
 
uint8_t shSetEngineState (ShEngine *p_engine)
 Sets the state of the shengine module.
 
uint8_t shResetEngineState (ShEngine *p_engine)
 Resets the state of the shengine module.
 
uint8_t shEngineSafeState (ShEngine *p_engine)
 Safely sets the state of the shengine module.
 
uint8_t shEngineFrameResize (ShEngine *p_engine)
 Resizes the frame in the shengine module.
 
uint8_t shEngineProfilingUpdate (ShEngine *p_engine)
 Updates the profiling in the shengine module.
 
uint8_t shEngineVulkanUpdate (ShEngine *p_engine)
 Updates Vulkan in the shengine module.
 
uint8_t shEngineUpdateState (ShEngine *p_engine)
 Updates the state of the shengine module.
 
uint8_t shEngineManageState (ShEngine *p_engine, uint8_t ready)
 Manages the state of the shengine module.
 
uint8_t shEngineVulkanRelease (ShEngine *p_engine)
 Releases Vulkan resources in the shengine module.
 
uint8_t shEngineRelease (ShEngine *p_engine)
 Releases resources in the shengine module.
 
void shEngineShutdown (ShEngine *p_engine)
 Shuts down the shengine module.
 

Detailed Description

Declares the ShEngine structure and associated functions for managing the engine.

It contains and manages the main information about the engine state, window properties, timing, profiling, and various other configurations.

Macro Definition Documentation

◆ SH_ENGINE_MAX_SWAPCHAIN_IMAGE_COUNT

#define SH_ENGINE_MAX_SWAPCHAIN_IMAGE_COUNT   6

Maximum number of swapchain images in the engine.

◆ SH_ENGINE_NOT_READY

#define SH_ENGINE_NOT_READY   0

Represents the engine not being ready.

◆ SH_ENGINE_READY

#define SH_ENGINE_READY   1

Represents the engine being ready.

◆ SH_ENGINE_RENDERPASS_ATTACHMENT_COUNT

#define SH_ENGINE_RENDERPASS_ATTACHMENT_COUNT   3

Number of renderpass attachments in the engine.

◆ SH_ENGINE_SUBPASS_COLOR_ATTACHMENT_COUNT

#define SH_ENGINE_SUBPASS_COLOR_ATTACHMENT_COUNT   1

Number of color attachments in a subpass in the engine.

◆ SH_ENGINE_SWAPCHAIN_IMAGE_COUNT

#define SH_ENGINE_SWAPCHAIN_IMAGE_COUNT   2

Number of swapchain images in the engine.

◆ SH_FALSE

#define SH_FALSE   0

Boolean value representing false.

◆ SH_TRUE

#define SH_TRUE   1

Boolean value representing true.

◆ shAllocateEngine

#define shAllocateEngine ( )    (ShEngine*)calloc(1, sizeof(ShEngine));

Allocates memory for a new ShEngine instance.

Returns
A pointer to the allocated ShEngine structure.

◆ shApplicationError

#define shApplicationError (   condition,
  msg,
  failure_expression 
)     if ((int)(condition)) { printf("shapplication error: %s. \n", msg); failure_expression; }

Generates an error message for the ShApplication.

Parameters
conditionThe condition to check.
msgThe error message.
failure_expressionThe expression to execute in case of failure.

◆ shEngineError

#define shEngineError (   condition,
  msg,
  failure_expression 
)     if ((int)(condition)) { printf("shengine error: %s.\n", msg); failure_expression; }

Generates an error message for the shengine module.

Parameters
conditionThe condition to check.
msgThe error message.
failure_expressionThe expression to execute in case of failure.

◆ shFreeEngine

#define shFreeEngine (   p_engine)    free(p_engine); (p_engine) = NULL

Frees the memory of a ShEngine instance.

Parameters
p_engineValid pointer to a ShEngine structure.

Typedef Documentation

◆ ShEngine

typedef struct ShEngine ShEngine

Function Documentation

◆ shAllocateProfilingHandle()

uint8_t shAllocateProfilingHandle ( ShEngine p_engine)
extern

Allocates a profiling handle for the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineFrameResize()

uint8_t shEngineFrameResize ( ShEngine p_engine)
extern

Resizes the frame in the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineManageState()

uint8_t shEngineManageState ( ShEngine p_engine,
uint8_t  ready 
)
extern

Manages the state of the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
readyState of the engine.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineProfilingUpdate()

uint8_t shEngineProfilingUpdate ( ShEngine p_engine)
extern

Updates the profiling in the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineRelease()

uint8_t shEngineRelease ( ShEngine p_engine)
extern

Releases resources in the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.

◆ shEngineSafeState()

uint8_t shEngineSafeState ( ShEngine p_engine)
extern

Safely sets the state of the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineSetupVulkan()

uint8_t shEngineSetupVulkan ( ShEngine p_engine)
extern

Sets up Vulkan for the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineShutdown()

void shEngineShutdown ( ShEngine p_engine)
extern

Shuts down the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.

◆ shEngineUpdateState()

uint8_t shEngineUpdateState ( ShEngine p_engine)
extern

Updates the state of the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineVulkanRelease()

uint8_t shEngineVulkanRelease ( ShEngine p_engine)
extern

Releases Vulkan resources in the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shEngineVulkanUpdate()

uint8_t shEngineVulkanUpdate ( ShEngine p_engine)
extern

Updates Vulkan in the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shResetEngineState()

uint8_t shResetEngineState ( ShEngine p_engine)
extern

Resets the state of the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.

◆ shSetEngineState()

uint8_t shSetEngineState ( ShEngine p_engine)
extern

Sets the state of the shengine module.

Parameters
p_engineValid pointer to a ShEngine structure.
Returns
Integer status code indicating the success or failure of the operation.