uncapitalize REFRESH in API calls

pull/1/head
cosmonaut 2021-01-05 15:00:51 -08:00 committed by thatcosmonaut
parent 2dbfab6b98
commit 4ca101099d
6 changed files with 1058 additions and 1058 deletions

File diff suppressed because it is too large Load Diff

View File

@ -50,21 +50,21 @@ extern "C" {
* h: Filled with the height of the image. * h: Filled with the height of the image.
* numChannels: Filled with the number of channels in the image. * numChannels: Filled with the number of channels in the image.
* *
* Returns a block of memory suitable for use with REFRESH_SetTextureData2D. * Returns a block of memory suitable for use with Refresh_SetTextureData2D.
* Be sure to free the memory with REFRESH_Image_Free after use! * Be sure to free the memory with Refresh_Image_Free after use!
*/ */
REFRESHAPI uint8_t* REFRESH_Image_Load( REFRESHAPI uint8_t* Refresh_Image_Load(
char const *filename, char const *filename,
int32_t *w, int32_t *w,
int32_t *h, int32_t *h,
int32_t *numChannels int32_t *numChannels
); );
/* Frees memory returned by REFRESH_Image_Load. (Do NOT free the memory yourself!) /* Frees memory returned by Refresh_Image_Load. (Do NOT free the memory yourself!)
* *
* mem: A pointer previously returned by REFRESH_Image_Load. * mem: A pointer previously returned by Refresh_Image_Load.
*/ */
REFRESHAPI void REFRESH_Image_Free(uint8_t *mem); REFRESHAPI void Refresh_Image_Free(uint8_t *mem);
/* Image Write API */ /* Image Write API */
@ -75,7 +75,7 @@ REFRESHAPI void REFRESH_Image_Free(uint8_t *mem);
* h: The height of the PNG data. * h: The height of the PNG data.
* data: The raw RGBA8 image data. * data: The raw RGBA8 image data.
*/ */
REFRESHAPI void REFRESH_Image_SavePNG( REFRESHAPI void Refresh_Image_SavePNG(
char const *filename, char const *filename,
int32_t w, int32_t w,
int32_t h, int32_t h,

View File

@ -33,14 +33,14 @@
/* Drivers */ /* Drivers */
static const REFRESH_Driver *drivers[] = { static const Refresh_Driver *drivers[] = {
&VulkanDriver, &VulkanDriver,
NULL NULL
}; };
/* Logging */ /* Logging */
static void REFRESH_Default_LogInfo(const char *msg) static void Refresh_Default_LogInfo(const char *msg)
{ {
SDL_LogInfo( SDL_LogInfo(
SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_APPLICATION,
@ -49,7 +49,7 @@ static void REFRESH_Default_LogInfo(const char *msg)
); );
} }
static void REFRESH_Default_LogWarn(const char *msg) static void Refresh_Default_LogWarn(const char *msg)
{ {
SDL_LogWarn( SDL_LogWarn(
SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_APPLICATION,
@ -58,7 +58,7 @@ static void REFRESH_Default_LogWarn(const char *msg)
); );
} }
static void REFRESH_Default_LogError(const char *msg) static void Refresh_Default_LogError(const char *msg)
{ {
SDL_LogError( SDL_LogError(
SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_APPLICATION,
@ -67,57 +67,57 @@ static void REFRESH_Default_LogError(const char *msg)
); );
} }
static REFRESH_LogFunc REFRESH_LogInfoFunc = REFRESH_Default_LogInfo; static Refresh_LogFunc Refresh_LogInfoFunc = Refresh_Default_LogInfo;
static REFRESH_LogFunc REFRESH_LogWarnFunc = REFRESH_Default_LogWarn; static Refresh_LogFunc Refresh_LogWarnFunc = Refresh_Default_LogWarn;
static REFRESH_LogFunc REFRESH_LogErrorFunc = REFRESH_Default_LogError; static Refresh_LogFunc Refresh_LogErrorFunc = Refresh_Default_LogError;
#define MAX_MESSAGE_SIZE 1024 #define MAX_MESSAGE_SIZE 1024
void REFRESH_LogInfo(const char *fmt, ...) void Refresh_LogInfo(const char *fmt, ...)
{ {
char msg[MAX_MESSAGE_SIZE]; char msg[MAX_MESSAGE_SIZE];
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
SDL_vsnprintf(msg, sizeof(msg), fmt, ap); SDL_vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap); va_end(ap);
REFRESH_LogInfoFunc(msg); Refresh_LogInfoFunc(msg);
} }
void REFRESH_LogWarn(const char *fmt, ...) void Refresh_LogWarn(const char *fmt, ...)
{ {
char msg[MAX_MESSAGE_SIZE]; char msg[MAX_MESSAGE_SIZE];
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
SDL_vsnprintf(msg, sizeof(msg), fmt, ap); SDL_vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap); va_end(ap);
REFRESH_LogWarnFunc(msg); Refresh_LogWarnFunc(msg);
} }
void REFRESH_LogError(const char *fmt, ...) void Refresh_LogError(const char *fmt, ...)
{ {
char msg[MAX_MESSAGE_SIZE]; char msg[MAX_MESSAGE_SIZE];
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
SDL_vsnprintf(msg, sizeof(msg), fmt, ap); SDL_vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap); va_end(ap);
REFRESH_LogErrorFunc(msg); Refresh_LogErrorFunc(msg);
} }
#undef MAX_MESSAGE_SIZE #undef MAX_MESSAGE_SIZE
void REFRESH_HookLogFunctions( void Refresh_HookLogFunctions(
REFRESH_LogFunc info, Refresh_LogFunc info,
REFRESH_LogFunc warn, Refresh_LogFunc warn,
REFRESH_LogFunc error Refresh_LogFunc error
) { ) {
REFRESH_LogInfoFunc = info; Refresh_LogInfoFunc = info;
REFRESH_LogWarnFunc = warn; Refresh_LogWarnFunc = warn;
REFRESH_LogErrorFunc = error; Refresh_LogErrorFunc = error;
} }
/* Version API */ /* Version API */
uint32_t REFRESH_LinkedVersion(void) uint32_t Refresh_LinkedVersion(void)
{ {
return REFRESH_COMPILED_VERSION; return REFRESH_COMPILED_VERSION;
} }
@ -126,8 +126,8 @@ uint32_t REFRESH_LinkedVersion(void)
static int32_t selectedDriver = 0; static int32_t selectedDriver = 0;
REFRESH_Device* REFRESH_CreateDevice( Refresh_Device* Refresh_CreateDevice(
REFRESH_PresentationParameters *presentationParameters, Refresh_PresentationParameters *presentationParameters,
uint8_t debugMode uint8_t debugMode
) { ) {
if (selectedDriver < 0) if (selectedDriver < 0)
@ -141,18 +141,18 @@ REFRESH_Device* REFRESH_CreateDevice(
); );
} }
void REFRESH_DestroyDevice(REFRESH_Device *device) void Refresh_DestroyDevice(Refresh_Device *device)
{ {
NULL_RETURN(device); NULL_RETURN(device);
device->DestroyDevice(device); device->DestroyDevice(device);
} }
void REFRESH_Clear( void Refresh_Clear(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Rect *clearRect, Refresh_Rect *clearRect,
REFRESH_ClearOptions options, Refresh_ClearOptions options,
REFRESH_Color *colors, Refresh_Color *colors,
uint32_t colorCount, uint32_t colorCount,
float depth, float depth,
int32_t stencil int32_t stencil
@ -170,16 +170,16 @@ void REFRESH_Clear(
); );
} }
void REFRESH_DrawIndexedPrimitives( void Refresh_DrawIndexedPrimitives(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex, uint32_t baseVertex,
uint32_t minVertexIndex, uint32_t minVertexIndex,
uint32_t numVertices, uint32_t numVertices,
uint32_t startIndex, uint32_t startIndex,
uint32_t primitiveCount, uint32_t primitiveCount,
REFRESH_Buffer *indices, Refresh_Buffer *indices,
REFRESH_IndexElementSize indexElementSize, Refresh_IndexElementSize indexElementSize,
uint32_t vertexParamOffset, uint32_t vertexParamOffset,
uint32_t fragmentParamOffset uint32_t fragmentParamOffset
) { ) {
@ -199,17 +199,17 @@ void REFRESH_DrawIndexedPrimitives(
); );
} }
void REFRESH_DrawInstancedPrimitives( void Refresh_DrawInstancedPrimitives(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex, uint32_t baseVertex,
uint32_t minVertexIndex, uint32_t minVertexIndex,
uint32_t numVertices, uint32_t numVertices,
uint32_t startIndex, uint32_t startIndex,
uint32_t primitiveCount, uint32_t primitiveCount,
uint32_t instanceCount, uint32_t instanceCount,
REFRESH_Buffer *indices, Refresh_Buffer *indices,
REFRESH_IndexElementSize indexElementSize, Refresh_IndexElementSize indexElementSize,
uint32_t vertexParamOffset, uint32_t vertexParamOffset,
uint32_t fragmentParamOffset uint32_t fragmentParamOffset
) { ) {
@ -230,9 +230,9 @@ void REFRESH_DrawInstancedPrimitives(
); );
} }
void REFRESH_DrawPrimitives( void Refresh_DrawPrimitives(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t vertexStart, uint32_t vertexStart,
uint32_t primitiveCount, uint32_t primitiveCount,
uint32_t vertexParamOffset, uint32_t vertexParamOffset,
@ -249,9 +249,9 @@ void REFRESH_DrawPrimitives(
); );
} }
void REFRESH_DispatchCompute( void Refresh_DispatchCompute(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t groupCountX, uint32_t groupCountX,
uint32_t groupCountY, uint32_t groupCountY,
uint32_t groupCountZ, uint32_t groupCountZ,
@ -268,9 +268,9 @@ void REFRESH_DispatchCompute(
); );
} }
REFRESH_RenderPass* REFRESH_CreateRenderPass( Refresh_RenderPass* Refresh_CreateRenderPass(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_RenderPassCreateInfo *renderPassCreateInfo Refresh_RenderPassCreateInfo *renderPassCreateInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateRenderPass( return device->CreateRenderPass(
@ -279,9 +279,9 @@ REFRESH_RenderPass* REFRESH_CreateRenderPass(
); );
} }
REFRESH_ComputePipeline* REFRESH_CreateComputePipeline( Refresh_ComputePipeline* Refresh_CreateComputePipeline(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ComputePipelineCreateInfo *pipelineCreateInfo Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateComputePipeline( return device->CreateComputePipeline(
@ -290,9 +290,9 @@ REFRESH_ComputePipeline* REFRESH_CreateComputePipeline(
); );
} }
REFRESH_GraphicsPipeline* REFRESH_CreateGraphicsPipeline( Refresh_GraphicsPipeline* Refresh_CreateGraphicsPipeline(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_GraphicsPipelineCreateInfo *pipelineCreateInfo Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateGraphicsPipeline( return device->CreateGraphicsPipeline(
@ -301,9 +301,9 @@ REFRESH_GraphicsPipeline* REFRESH_CreateGraphicsPipeline(
); );
} }
REFRESH_Sampler* REFRESH_CreateSampler( Refresh_Sampler* Refresh_CreateSampler(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_SamplerStateCreateInfo *samplerStateCreateInfo Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateSampler( return device->CreateSampler(
@ -312,9 +312,9 @@ REFRESH_Sampler* REFRESH_CreateSampler(
); );
} }
REFRESH_Framebuffer* REFRESH_CreateFramebuffer( Refresh_Framebuffer* Refresh_CreateFramebuffer(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_FramebufferCreateInfo *framebufferCreateInfo Refresh_FramebufferCreateInfo *framebufferCreateInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateFramebuffer( return device->CreateFramebuffer(
@ -323,9 +323,9 @@ REFRESH_Framebuffer* REFRESH_CreateFramebuffer(
); );
} }
REFRESH_ShaderModule* REFRESH_CreateShaderModule( Refresh_ShaderModule* Refresh_CreateShaderModule(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ShaderModuleCreateInfo *shaderModuleCreateInfo Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateShaderModule( return device->CreateShaderModule(
@ -334,13 +334,13 @@ REFRESH_ShaderModule* REFRESH_CreateShaderModule(
); );
} }
REFRESH_Texture* REFRESH_CreateTexture2D( Refresh_Texture* Refresh_CreateTexture2D(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ColorFormat format, Refresh_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags Refresh_TextureUsageFlags usageFlags
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateTexture2D( return device->CreateTexture2D(
@ -353,14 +353,14 @@ REFRESH_Texture* REFRESH_CreateTexture2D(
); );
} }
REFRESH_Texture* REFRESH_CreateTexture3D( Refresh_Texture* Refresh_CreateTexture3D(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ColorFormat format, Refresh_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t depth, uint32_t depth,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags Refresh_TextureUsageFlags usageFlags
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateTexture3D( return device->CreateTexture3D(
@ -374,12 +374,12 @@ REFRESH_Texture* REFRESH_CreateTexture3D(
); );
} }
REFRESH_Texture* REFRESH_CreateTextureCube( Refresh_Texture* Refresh_CreateTextureCube(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ColorFormat format, Refresh_ColorFormat format,
uint32_t size, uint32_t size,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags Refresh_TextureUsageFlags usageFlags
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateTextureCube( return device->CreateTextureCube(
@ -391,10 +391,10 @@ REFRESH_Texture* REFRESH_CreateTextureCube(
); );
} }
REFRESH_ColorTarget* REFRESH_CreateColorTarget( Refresh_ColorTarget* Refresh_CreateColorTarget(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_SampleCount multisampleCount, Refresh_SampleCount multisampleCount,
REFRESH_TextureSlice *textureSlice Refresh_TextureSlice *textureSlice
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateColorTarget( return device->CreateColorTarget(
@ -404,11 +404,11 @@ REFRESH_ColorTarget* REFRESH_CreateColorTarget(
); );
} }
REFRESH_DepthStencilTarget* REFRESH_CreateDepthStencilTarget( Refresh_DepthStencilTarget* Refresh_CreateDepthStencilTarget(
REFRESH_Device *device, Refresh_Device *device,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
REFRESH_DepthFormat format Refresh_DepthFormat format
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
return device->CreateDepthStencilTarget( return device->CreateDepthStencilTarget(
@ -419,9 +419,9 @@ REFRESH_DepthStencilTarget* REFRESH_CreateDepthStencilTarget(
); );
} }
REFRESH_Buffer* REFRESH_CreateBuffer( Refresh_Buffer* Refresh_CreateBuffer(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_BufferUsageFlags usageFlags, Refresh_BufferUsageFlags usageFlags,
uint32_t sizeInBytes uint32_t sizeInBytes
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
@ -432,9 +432,9 @@ REFRESH_Buffer* REFRESH_CreateBuffer(
); );
} }
void REFRESH_SetTextureData( void Refresh_SetTextureData(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_TextureSlice *textureSlice, Refresh_TextureSlice *textureSlice,
void *data, void *data,
uint32_t dataLengthInBytes uint32_t dataLengthInBytes
) { ) {
@ -447,11 +447,11 @@ void REFRESH_SetTextureData(
); );
} }
void REFRESH_SetTextureDataYUV( void Refresh_SetTextureDataYUV(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Texture *y, Refresh_Texture *y,
REFRESH_Texture *u, Refresh_Texture *u,
REFRESH_Texture *v, Refresh_Texture *v,
uint32_t yWidth, uint32_t yWidth,
uint32_t yHeight, uint32_t yHeight,
uint32_t uvWidth, uint32_t uvWidth,
@ -474,12 +474,12 @@ void REFRESH_SetTextureDataYUV(
); );
} }
void REFRESH_CopyTextureToTexture( void Refresh_CopyTextureToTexture(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *sourceTextureSlice, Refresh_TextureSlice *sourceTextureSlice,
REFRESH_TextureSlice *destinationTextureSlice, Refresh_TextureSlice *destinationTextureSlice,
REFRESH_Filter filter Refresh_Filter filter
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->CopyTextureToTexture( device->CopyTextureToTexture(
@ -491,11 +491,11 @@ void REFRESH_CopyTextureToTexture(
); );
} }
void REFRESH_CopyTextureToBuffer( void Refresh_CopyTextureToBuffer(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *textureSlice, Refresh_TextureSlice *textureSlice,
REFRESH_Buffer *buffer Refresh_Buffer *buffer
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->CopyTextureToBuffer( device->CopyTextureToBuffer(
@ -506,9 +506,9 @@ void REFRESH_CopyTextureToBuffer(
); );
} }
void REFRESH_SetBufferData( void Refresh_SetBufferData(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Buffer *buffer, Refresh_Buffer *buffer,
uint32_t offsetInBytes, uint32_t offsetInBytes,
void* data, void* data,
uint32_t dataLength uint32_t dataLength
@ -523,9 +523,9 @@ void REFRESH_SetBufferData(
); );
} }
uint32_t REFRESH_PushVertexShaderParams( uint32_t Refresh_PushVertexShaderParams(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
void *data, void *data,
uint32_t elementCount uint32_t elementCount
) { ) {
@ -538,9 +538,9 @@ uint32_t REFRESH_PushVertexShaderParams(
); );
} }
uint32_t REFRESH_PushFragmentShaderParams( uint32_t Refresh_PushFragmentShaderParams(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
void *data, void *data,
uint32_t elementCount uint32_t elementCount
) { ) {
@ -553,9 +553,9 @@ uint32_t REFRESH_PushFragmentShaderParams(
); );
} }
uint32_t REFRESH_PushComputeShaderParams( uint32_t Refresh_PushComputeShaderParams(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
void *data, void *data,
uint32_t elementCount uint32_t elementCount
) { ) {
@ -568,11 +568,11 @@ uint32_t REFRESH_PushComputeShaderParams(
); );
} }
void REFRESH_SetVertexSamplers( void Refresh_SetVertexSamplers(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures, Refresh_Texture **pTextures,
REFRESH_Sampler **pSamplers Refresh_Sampler **pSamplers
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->SetVertexSamplers( device->SetVertexSamplers(
@ -583,11 +583,11 @@ void REFRESH_SetVertexSamplers(
); );
} }
void REFRESH_SetFragmentSamplers( void Refresh_SetFragmentSamplers(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures, Refresh_Texture **pTextures,
REFRESH_Sampler **pSamplers Refresh_Sampler **pSamplers
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->SetFragmentSamplers( device->SetFragmentSamplers(
@ -598,9 +598,9 @@ void REFRESH_SetFragmentSamplers(
); );
} }
void REFRESH_GetBufferData( void Refresh_GetBufferData(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Buffer *buffer, Refresh_Buffer *buffer,
void *data, void *data,
uint32_t dataLengthInBytes uint32_t dataLengthInBytes
) { ) {
@ -613,9 +613,9 @@ void REFRESH_GetBufferData(
); );
} }
void REFRESH_AddDisposeTexture( void Refresh_AddDisposeTexture(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Texture *texture Refresh_Texture *texture
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeTexture( device->AddDisposeTexture(
@ -624,9 +624,9 @@ void REFRESH_AddDisposeTexture(
); );
} }
void REFRESH_AddDisposeSampler( void Refresh_AddDisposeSampler(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Sampler *sampler Refresh_Sampler *sampler
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeSampler( device->AddDisposeSampler(
@ -635,9 +635,9 @@ void REFRESH_AddDisposeSampler(
); );
} }
void REFRESH_AddDisposeBuffer( void Refresh_AddDisposeBuffer(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Buffer *buffer Refresh_Buffer *buffer
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeBuffer( device->AddDisposeBuffer(
@ -646,9 +646,9 @@ void REFRESH_AddDisposeBuffer(
); );
} }
void REFRESH_AddDisposeColorTarget( void Refresh_AddDisposeColorTarget(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ColorTarget *colorTarget Refresh_ColorTarget *colorTarget
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeColorTarget( device->AddDisposeColorTarget(
@ -657,9 +657,9 @@ void REFRESH_AddDisposeColorTarget(
); );
} }
void REFRESH_AddDisposeDepthStencilTarget( void Refresh_AddDisposeDepthStencilTarget(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_DepthStencilTarget *depthStencilTarget Refresh_DepthStencilTarget *depthStencilTarget
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeDepthStencilTarget( device->AddDisposeDepthStencilTarget(
@ -668,9 +668,9 @@ void REFRESH_AddDisposeDepthStencilTarget(
); );
} }
void REFRESH_AddDisposeFramebuffer( void Refresh_AddDisposeFramebuffer(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_Framebuffer *frameBuffer Refresh_Framebuffer *frameBuffer
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeFramebuffer( device->AddDisposeFramebuffer(
@ -679,9 +679,9 @@ void REFRESH_AddDisposeFramebuffer(
); );
} }
void REFRESH_AddDisposeShaderModule( void Refresh_AddDisposeShaderModule(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ShaderModule *shaderModule Refresh_ShaderModule *shaderModule
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeShaderModule( device->AddDisposeShaderModule(
@ -690,9 +690,9 @@ void REFRESH_AddDisposeShaderModule(
); );
} }
void REFRESH_AddDisposeRenderPass( void Refresh_AddDisposeRenderPass(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_RenderPass *renderPass Refresh_RenderPass *renderPass
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeRenderPass( device->AddDisposeRenderPass(
@ -701,9 +701,9 @@ void REFRESH_AddDisposeRenderPass(
); );
} }
void REFRESH_AddDisposeComputePipeline( void Refresh_AddDisposeComputePipeline(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_ComputePipeline *computePipeline Refresh_ComputePipeline *computePipeline
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeComputePipeline( device->AddDisposeComputePipeline(
@ -712,9 +712,9 @@ void REFRESH_AddDisposeComputePipeline(
); );
} }
void REFRESH_AddDisposeGraphicsPipeline( void Refresh_AddDisposeGraphicsPipeline(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_GraphicsPipeline *graphicsPipeline Refresh_GraphicsPipeline *graphicsPipeline
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->AddDisposeGraphicsPipeline( device->AddDisposeGraphicsPipeline(
@ -723,15 +723,15 @@ void REFRESH_AddDisposeGraphicsPipeline(
); );
} }
void REFRESH_BeginRenderPass( void Refresh_BeginRenderPass(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_RenderPass *renderPass, Refresh_RenderPass *renderPass,
REFRESH_Framebuffer *framebuffer, Refresh_Framebuffer *framebuffer,
REFRESH_Rect renderArea, Refresh_Rect renderArea,
REFRESH_Color *pColorClearValues, Refresh_Color *pColorClearValues,
uint32_t colorClearCount, uint32_t colorClearCount,
REFRESH_DepthStencilValue *depthStencilClearValue Refresh_DepthStencilValue *depthStencilClearValue
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BeginRenderPass( device->BeginRenderPass(
@ -746,9 +746,9 @@ void REFRESH_BeginRenderPass(
); );
} }
void REFRESH_EndRenderPass( void Refresh_EndRenderPass(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer Refresh_CommandBuffer *commandBuffer
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->EndRenderPass( device->EndRenderPass(
@ -757,10 +757,10 @@ void REFRESH_EndRenderPass(
); );
} }
void REFRESH_BindGraphicsPipeline( void Refresh_BindGraphicsPipeline(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_GraphicsPipeline *graphicsPipeline Refresh_GraphicsPipeline *graphicsPipeline
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindGraphicsPipeline( device->BindGraphicsPipeline(
@ -770,12 +770,12 @@ void REFRESH_BindGraphicsPipeline(
); );
} }
void REFRESH_BindVertexBuffers( void Refresh_BindVertexBuffers(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t firstBinding, uint32_t firstBinding,
uint32_t bindingCount, uint32_t bindingCount,
REFRESH_Buffer **pBuffers, Refresh_Buffer **pBuffers,
uint64_t *pOffsets uint64_t *pOffsets
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
@ -789,12 +789,12 @@ void REFRESH_BindVertexBuffers(
); );
} }
void REFRESH_BindIndexBuffer( void Refresh_BindIndexBuffer(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Buffer *buffer, Refresh_Buffer *buffer,
uint64_t offset, uint64_t offset,
REFRESH_IndexElementSize indexElementSize Refresh_IndexElementSize indexElementSize
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindIndexBuffer( device->BindIndexBuffer(
@ -806,10 +806,10 @@ void REFRESH_BindIndexBuffer(
); );
} }
void REFRESH_BindComputePipeline( void Refresh_BindComputePipeline(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_ComputePipeline *computePipeline Refresh_ComputePipeline *computePipeline
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindComputePipeline( device->BindComputePipeline(
@ -819,10 +819,10 @@ void REFRESH_BindComputePipeline(
); );
} }
void REFRESH_BindComputeBuffers( void Refresh_BindComputeBuffers(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Buffer **pBuffers Refresh_Buffer **pBuffers
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindComputeBuffers( device->BindComputeBuffers(
@ -832,10 +832,10 @@ void REFRESH_BindComputeBuffers(
); );
} }
void REFRESH_BindComputeTextures( void Refresh_BindComputeTextures(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures Refresh_Texture **pTextures
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindComputeTextures( device->BindComputeTextures(
@ -845,8 +845,8 @@ void REFRESH_BindComputeTextures(
); );
} }
REFRESH_CommandBuffer* REFRESH_AcquireCommandBuffer( Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
REFRESH_Device *device, Refresh_Device *device,
uint8_t fixed uint8_t fixed
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN_NULL(device);
@ -856,12 +856,12 @@ REFRESH_CommandBuffer* REFRESH_AcquireCommandBuffer(
); );
} }
void REFRESH_QueuePresent( void Refresh_QueuePresent(
REFRESH_Device *device, Refresh_Device *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_TextureSlice* textureSlice, Refresh_TextureSlice* textureSlice,
REFRESH_Rect *destinationRectangle, Refresh_Rect *destinationRectangle,
REFRESH_Filter filter Refresh_Filter filter
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->QueuePresent( device->QueuePresent(
@ -873,10 +873,10 @@ void REFRESH_QueuePresent(
); );
} }
void REFRESH_Submit( void Refresh_Submit(
REFRESH_Device *device, Refresh_Device *device,
uint32_t commandBufferCount, uint32_t commandBufferCount,
REFRESH_CommandBuffer **pCommandBuffers Refresh_CommandBuffer **pCommandBuffers
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->Submit( device->Submit(
@ -886,8 +886,8 @@ void REFRESH_Submit(
); );
} }
void REFRESH_Wait( void Refresh_Wait(
REFRESH_Device *device Refresh_Device *device
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->Wait( device->Wait(

View File

@ -36,14 +36,14 @@
/* Logging */ /* Logging */
extern void REFRESH_LogInfo(const char *fmt, ...); extern void Refresh_LogInfo(const char *fmt, ...);
extern void REFRESH_LogWarn(const char *fmt, ...); extern void Refresh_LogWarn(const char *fmt, ...);
extern void REFRESH_LogError(const char *fmt, ...); extern void Refresh_LogError(const char *fmt, ...);
/* Internal Helper Utilities */ /* Internal Helper Utilities */
static inline uint32_t Texture_GetFormatSize( static inline uint32_t Texture_GetFormatSize(
REFRESH_ColorFormat format Refresh_ColorFormat format
) { ) {
switch (format) switch (format)
{ {
@ -73,7 +73,7 @@ static inline uint32_t Texture_GetFormatSize(
case REFRESH_COLORFORMAT_R32G32B32A32_SFLOAT: case REFRESH_COLORFORMAT_R32G32B32A32_SFLOAT:
return 16; return 16;
default: default:
REFRESH_LogError( Refresh_LogError(
"Unrecognized SurfaceFormat!" "Unrecognized SurfaceFormat!"
); );
return 0; return 0;
@ -81,7 +81,7 @@ static inline uint32_t Texture_GetFormatSize(
} }
static inline uint32_t PrimitiveVerts( static inline uint32_t PrimitiveVerts(
REFRESH_PrimitiveType primitiveType, Refresh_PrimitiveType primitiveType,
uint32_t primitiveCount uint32_t primitiveCount
) { ) {
switch (primitiveType) switch (primitiveType)
@ -97,21 +97,21 @@ static inline uint32_t PrimitiveVerts(
case REFRESH_PRIMITIVETYPE_POINTLIST: case REFRESH_PRIMITIVETYPE_POINTLIST:
return primitiveCount; return primitiveCount;
default: default:
REFRESH_LogError( Refresh_LogError(
"Unrecognized primitive type!" "Unrecognized primitive type!"
); );
return 0; return 0;
} }
} }
static inline uint32_t IndexSize(REFRESH_IndexElementSize size) static inline uint32_t IndexSize(Refresh_IndexElementSize size)
{ {
return (size == REFRESH_INDEXELEMENTSIZE_16BIT) ? 2 : 4; return (size == REFRESH_INDEXELEMENTSIZE_16BIT) ? 2 : 4;
} }
static inline uint32_t BytesPerRow( static inline uint32_t BytesPerRow(
int32_t width, int32_t width,
REFRESH_ColorFormat format Refresh_ColorFormat format
) { ) {
uint32_t blocksPerRow = width; uint32_t blocksPerRow = width;
@ -128,7 +128,7 @@ static inline uint32_t BytesPerRow(
static inline int32_t BytesPerImage( static inline int32_t BytesPerImage(
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
REFRESH_ColorFormat format Refresh_ColorFormat format
) { ) {
uint32_t blocksPerRow = width; uint32_t blocksPerRow = width;
uint32_t blocksPerColumn = height; uint32_t blocksPerColumn = height;
@ -155,61 +155,61 @@ static inline int32_t BytesPerImage(
#define MAX_COLOR_TARGET_BINDINGS 4 #define MAX_COLOR_TARGET_BINDINGS 4
/* REFRESH_Device Definition */ /* Refresh_Device Definition */
typedef struct REFRESH_Renderer REFRESH_Renderer; typedef struct Refresh_Renderer Refresh_Renderer;
struct REFRESH_Device struct Refresh_Device
{ {
/* Quit */ /* Quit */
void (*DestroyDevice)(REFRESH_Device *device); void (*DestroyDevice)(Refresh_Device *device);
/* Drawing */ /* Drawing */
void (*Clear)( void (*Clear)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Rect *clearRect, Refresh_Rect *clearRect,
REFRESH_ClearOptions options, Refresh_ClearOptions options,
REFRESH_Color *colors, Refresh_Color *colors,
uint32_t colorCount, uint32_t colorCount,
float depth, float depth,
int32_t stencil int32_t stencil
); );
void (*DrawInstancedPrimitives)( void (*DrawInstancedPrimitives)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex, uint32_t baseVertex,
uint32_t minVertexIndex, uint32_t minVertexIndex,
uint32_t numVertices, uint32_t numVertices,
uint32_t startIndex, uint32_t startIndex,
uint32_t primitiveCount, uint32_t primitiveCount,
uint32_t instanceCount, uint32_t instanceCount,
REFRESH_Buffer *indices, Refresh_Buffer *indices,
REFRESH_IndexElementSize indexElementSize, Refresh_IndexElementSize indexElementSize,
uint32_t vertexParamOffset, uint32_t vertexParamOffset,
uint32_t fragmentParamOffset uint32_t fragmentParamOffset
); );
void (*DrawIndexedPrimitives)( void (*DrawIndexedPrimitives)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex, uint32_t baseVertex,
uint32_t minVertexIndex, uint32_t minVertexIndex,
uint32_t numVertices, uint32_t numVertices,
uint32_t startIndex, uint32_t startIndex,
uint32_t primitiveCount, uint32_t primitiveCount,
REFRESH_Buffer *indices, Refresh_Buffer *indices,
REFRESH_IndexElementSize indexElementSize, Refresh_IndexElementSize indexElementSize,
uint32_t vertexParamOffset, uint32_t vertexParamOffset,
uint32_t fragmentParamOffset uint32_t fragmentParamOffset
); );
void (*DrawPrimitives)( void (*DrawPrimitives)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t vertexStart, uint32_t vertexStart,
uint32_t primitiveCount, uint32_t primitiveCount,
uint32_t vertexParamOffset, uint32_t vertexParamOffset,
@ -217,8 +217,8 @@ struct REFRESH_Device
); );
void (*DispatchCompute)( void (*DispatchCompute)(
REFRESH_Renderer *device, Refresh_Renderer *device,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t groupCountX, uint32_t groupCountX,
uint32_t groupCountY, uint32_t groupCountY,
uint32_t groupCountZ, uint32_t groupCountZ,
@ -227,96 +227,96 @@ struct REFRESH_Device
/* State Creation */ /* State Creation */
REFRESH_RenderPass* (*CreateRenderPass)( Refresh_RenderPass* (*CreateRenderPass)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_RenderPassCreateInfo *renderPassCreateInfo Refresh_RenderPassCreateInfo *renderPassCreateInfo
); );
REFRESH_ComputePipeline* (*CreateComputePipeline)( Refresh_ComputePipeline* (*CreateComputePipeline)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ComputePipelineCreateInfo *pipelineCreateInfo Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
); );
REFRESH_GraphicsPipeline* (*CreateGraphicsPipeline)( Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_GraphicsPipelineCreateInfo *pipelineCreateInfo Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
); );
REFRESH_Sampler* (*CreateSampler)( Refresh_Sampler* (*CreateSampler)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_SamplerStateCreateInfo *samplerStateCreateInfo Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
); );
REFRESH_Framebuffer* (*CreateFramebuffer)( Refresh_Framebuffer* (*CreateFramebuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_FramebufferCreateInfo *framebufferCreateInfo Refresh_FramebufferCreateInfo *framebufferCreateInfo
); );
REFRESH_ShaderModule* (*CreateShaderModule)( Refresh_ShaderModule* (*CreateShaderModule)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ShaderModuleCreateInfo *shaderModuleCreateInfo Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
); );
REFRESH_Texture* (*CreateTexture2D)( Refresh_Texture* (*CreateTexture2D)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ColorFormat format, Refresh_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags Refresh_TextureUsageFlags usageFlags
); );
REFRESH_Texture* (*CreateTexture3D)( Refresh_Texture* (*CreateTexture3D)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ColorFormat format, Refresh_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t depth, uint32_t depth,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags Refresh_TextureUsageFlags usageFlags
); );
REFRESH_Texture* (*CreateTextureCube)( Refresh_Texture* (*CreateTextureCube)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ColorFormat format, Refresh_ColorFormat format,
uint32_t size, uint32_t size,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags Refresh_TextureUsageFlags usageFlags
); );
REFRESH_ColorTarget* (*CreateColorTarget)( Refresh_ColorTarget* (*CreateColorTarget)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_SampleCount multisampleCount, Refresh_SampleCount multisampleCount,
REFRESH_TextureSlice *textureSlice Refresh_TextureSlice *textureSlice
); );
REFRESH_DepthStencilTarget* (*CreateDepthStencilTarget)( Refresh_DepthStencilTarget* (*CreateDepthStencilTarget)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
REFRESH_DepthFormat format Refresh_DepthFormat format
); );
REFRESH_Buffer* (*CreateBuffer)( Refresh_Buffer* (*CreateBuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_BufferUsageFlags usageFlags, Refresh_BufferUsageFlags usageFlags,
uint32_t sizeInBytes uint32_t sizeInBytes
); );
/* Setters */ /* Setters */
void(*SetTextureData)( void(*SetTextureData)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_TextureSlice *textureSlice, Refresh_TextureSlice *textureSlice,
void *data, void *data,
uint32_t dataLengthInBytes uint32_t dataLengthInBytes
); );
void(*SetTextureDataYUV)( void(*SetTextureDataYUV)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Texture *y, Refresh_Texture *y,
REFRESH_Texture *u, Refresh_Texture *u,
REFRESH_Texture *v, Refresh_Texture *v,
uint32_t yWidth, uint32_t yWidth,
uint32_t yHeight, uint32_t yHeight,
uint32_t uvWidth, uint32_t uvWidth,
@ -326,68 +326,68 @@ struct REFRESH_Device
); );
void(*CopyTextureToTexture)( void(*CopyTextureToTexture)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *sourceTextureSlice, Refresh_TextureSlice *sourceTextureSlice,
REFRESH_TextureSlice *destinationTextureSlice, Refresh_TextureSlice *destinationTextureSlice,
REFRESH_Filter filter Refresh_Filter filter
); );
void(*CopyTextureToBuffer)( void(*CopyTextureToBuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *textureSlice, Refresh_TextureSlice *textureSlice,
REFRESH_Buffer *buffer Refresh_Buffer *buffer
); );
void(*SetBufferData)( void(*SetBufferData)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Buffer *buffer, Refresh_Buffer *buffer,
uint32_t offsetInBytes, uint32_t offsetInBytes,
void* data, void* data,
uint32_t dataLength uint32_t dataLength
); );
uint32_t(*PushVertexShaderParams)( uint32_t(*PushVertexShaderParams)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
void *data, void *data,
uint32_t elementCount uint32_t elementCount
); );
uint32_t(*PushFragmentShaderParams)( uint32_t(*PushFragmentShaderParams)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
void *data, void *data,
uint32_t elementCount uint32_t elementCount
); );
uint32_t (*PushComputeShaderParams)( uint32_t (*PushComputeShaderParams)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
void *data, void *data,
uint32_t elementCount uint32_t elementCount
); );
void(*SetVertexSamplers)( void(*SetVertexSamplers)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures, Refresh_Texture **pTextures,
REFRESH_Sampler **pSamplers Refresh_Sampler **pSamplers
); );
void(*SetFragmentSamplers)( void(*SetFragmentSamplers)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures, Refresh_Texture **pTextures,
REFRESH_Sampler **pSamplers Refresh_Sampler **pSamplers
); );
/* Getters */ /* Getters */
void(*GetBufferData)( void(*GetBufferData)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Buffer *buffer, Refresh_Buffer *buffer,
void *data, void *data,
uint32_t dataLengthInBytes uint32_t dataLengthInBytes
); );
@ -395,139 +395,139 @@ struct REFRESH_Device
/* Disposal */ /* Disposal */
void(*AddDisposeTexture)( void(*AddDisposeTexture)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Texture *texture Refresh_Texture *texture
); );
void(*AddDisposeSampler)( void(*AddDisposeSampler)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Sampler *sampler Refresh_Sampler *sampler
); );
void(*AddDisposeBuffer)( void(*AddDisposeBuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Buffer *buffer Refresh_Buffer *buffer
); );
void(*AddDisposeColorTarget)( void(*AddDisposeColorTarget)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ColorTarget *colorTarget Refresh_ColorTarget *colorTarget
); );
void(*AddDisposeDepthStencilTarget)( void(*AddDisposeDepthStencilTarget)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_DepthStencilTarget *depthStencilTarget Refresh_DepthStencilTarget *depthStencilTarget
); );
void(*AddDisposeFramebuffer)( void(*AddDisposeFramebuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_Framebuffer *frameBuffer Refresh_Framebuffer *frameBuffer
); );
void(*AddDisposeShaderModule)( void(*AddDisposeShaderModule)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ShaderModule *shaderModule Refresh_ShaderModule *shaderModule
); );
void(*AddDisposeRenderPass)( void(*AddDisposeRenderPass)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_RenderPass *renderPass Refresh_RenderPass *renderPass
); );
void(*AddDisposeComputePipeline)( void(*AddDisposeComputePipeline)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_ComputePipeline *computePipeline Refresh_ComputePipeline *computePipeline
); );
void(*AddDisposeGraphicsPipeline)( void(*AddDisposeGraphicsPipeline)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_GraphicsPipeline *graphicsPipeline Refresh_GraphicsPipeline *graphicsPipeline
); );
/* Graphics State */ /* Graphics State */
void(*BeginRenderPass)( void(*BeginRenderPass)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_RenderPass *renderPass, Refresh_RenderPass *renderPass,
REFRESH_Framebuffer *framebuffer, Refresh_Framebuffer *framebuffer,
REFRESH_Rect renderArea, Refresh_Rect renderArea,
REFRESH_Color *pColorClearValues, Refresh_Color *pColorClearValues,
uint32_t colorClearCount, uint32_t colorClearCount,
REFRESH_DepthStencilValue *depthStencilClearValue Refresh_DepthStencilValue *depthStencilClearValue
); );
void(*EndRenderPass)( void(*EndRenderPass)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer Refresh_CommandBuffer *commandBuffer
); );
void(*BindGraphicsPipeline)( void(*BindGraphicsPipeline)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_GraphicsPipeline *graphicsPipeline Refresh_GraphicsPipeline *graphicsPipeline
); );
void(*BindVertexBuffers)( void(*BindVertexBuffers)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t firstBinding, uint32_t firstBinding,
uint32_t bindingCount, uint32_t bindingCount,
REFRESH_Buffer **pBuffers, Refresh_Buffer **pBuffers,
uint64_t *pOffsets uint64_t *pOffsets
); );
void(*BindIndexBuffer)( void(*BindIndexBuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Buffer *buffer, Refresh_Buffer *buffer,
uint64_t offset, uint64_t offset,
REFRESH_IndexElementSize indexElementSize Refresh_IndexElementSize indexElementSize
); );
void(*BindComputePipeline)( void(*BindComputePipeline)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_ComputePipeline *computePipeline Refresh_ComputePipeline *computePipeline
); );
void(*BindComputeBuffers)( void(*BindComputeBuffers)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Buffer **pBuffers Refresh_Buffer **pBuffers
); );
void(*BindComputeTextures)( void(*BindComputeTextures)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_Texture **pTextures Refresh_Texture **pTextures
); );
REFRESH_CommandBuffer* (*AcquireCommandBuffer)( Refresh_CommandBuffer* (*AcquireCommandBuffer)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
uint8_t fixed uint8_t fixed
); );
void(*QueuePresent)( void(*QueuePresent)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *textureSlice, Refresh_TextureSlice *textureSlice,
REFRESH_Rect *destinationRectangle, Refresh_Rect *destinationRectangle,
REFRESH_Filter filter Refresh_Filter filter
); );
void(*Submit)( void(*Submit)(
REFRESH_Renderer *driverData, Refresh_Renderer *driverData,
uint32_t commandBufferCount, uint32_t commandBufferCount,
REFRESH_CommandBuffer **pCommandBuffers Refresh_CommandBuffer **pCommandBuffers
); );
void(*Wait)( void(*Wait)(
REFRESH_Renderer *driverData Refresh_Renderer *driverData
); );
/* Opaque pointer for the Driver */ /* Opaque pointer for the Driver */
REFRESH_Renderer *driverData; Refresh_Renderer *driverData;
}; };
#define ASSIGN_DRIVER_FUNC(func, name) \ #define ASSIGN_DRIVER_FUNC(func, name) \
@ -585,16 +585,16 @@ struct REFRESH_Device
ASSIGN_DRIVER_FUNC(Submit, name) \ ASSIGN_DRIVER_FUNC(Submit, name) \
ASSIGN_DRIVER_FUNC(Wait, name) ASSIGN_DRIVER_FUNC(Wait, name)
typedef struct REFRESH_Driver typedef struct Refresh_Driver
{ {
const char *Name; const char *Name;
REFRESH_Device* (*CreateDevice)( Refresh_Device* (*CreateDevice)(
REFRESH_PresentationParameters *presentationParameters, Refresh_PresentationParameters *presentationParameters,
uint8_t debugMode uint8_t debugMode
); );
} REFRESH_Driver; } Refresh_Driver;
extern REFRESH_Driver VulkanDriver; extern Refresh_Driver VulkanDriver;
#endif /* REFRESH_DRIVER_H */ #endif /* REFRESH_DRIVER_H */

File diff suppressed because it is too large Load Diff

View File

@ -189,7 +189,7 @@ static unsigned char* dgibson_stbi_zlib_compress(
/* Image Read API */ /* Image Read API */
uint8_t* REFRESH_Image_Load( uint8_t* Refresh_Image_Load(
char const *filename, char const *filename,
int32_t *w, int32_t *w,
int32_t *h, int32_t *h,
@ -198,14 +198,14 @@ uint8_t* REFRESH_Image_Load(
return stbi_load(filename, w, h, numChannels, STBI_rgb_alpha); return stbi_load(filename, w, h, numChannels, STBI_rgb_alpha);
} }
void REFRESH_Image_Free(uint8_t *mem) void Refresh_Image_Free(uint8_t *mem)
{ {
stbi_image_free(mem); stbi_image_free(mem);
} }
/* Image Write API */ /* Image Write API */
void REFRESH_Image_SavePNG( void Refresh_Image_SavePNG(
const char *filename, const char *filename,
int32_t w, int32_t w,
int32_t h, int32_t h,