forked from MoonsideGames/Refresh
Compare commits
18 Commits
ca3c84d7fb
...
main
Author | SHA1 | Date |
---|---|---|
Caleb Cornett | f5b3e466a8 | |
cosmonaut | 2fb9a6931b | |
Hazel Stagner | c01ff21359 | |
cosmonaut | e5da75d33a | |
cosmonaut | 99e9dc5b8c | |
cosmonaut | 0e7720ccf6 | |
cosmonaut | 488cb8c535 | |
cosmonaut | 3007b4c989 | |
cosmonaut | 163adfb5cd | |
cosmonaut | f0b970496e | |
cosmonaut | 38d14fd99d | |
cosmonaut | 4bba0f99f9 | |
cosmonaut | acefc530fd | |
cosmonaut | 3820d458fe | |
cosmonaut | 7a0b0f5709 | |
cosmonaut | ce34f4a435 | |
TheSpydog | eb5617f40e | |
cosmonaut | 0380a96817 |
|
@ -8,8 +8,8 @@ option(BUILD_SHARED_LIBS "Build shared library" ON)
|
|||
|
||||
# Version
|
||||
SET(LIB_MAJOR_VERSION "1")
|
||||
SET(LIB_MINOR_VERSION "2")
|
||||
SET(LIB_REVISION "1")
|
||||
SET(LIB_MINOR_VERSION "5")
|
||||
SET(LIB_REVISION "0")
|
||||
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
|
||||
|
||||
# Build Type
|
||||
|
|
|
@ -55,8 +55,8 @@ extern "C" {
|
|||
/* Version API */
|
||||
|
||||
#define REFRESH_MAJOR_VERSION 1
|
||||
#define REFRESH_MINOR_VERSION 2
|
||||
#define REFRESH_PATCH_VERSION 1
|
||||
#define REFRESH_MINOR_VERSION 5
|
||||
#define REFRESH_PATCH_VERSION 0
|
||||
|
||||
#define REFRESH_COMPILED_VERSION ( \
|
||||
(REFRESH_MAJOR_VERSION * 100 * 100) + \
|
||||
|
@ -107,15 +107,6 @@ typedef enum Refresh_StoreOp
|
|||
REFRESH_STOREOP_DONT_CARE
|
||||
} Refresh_StoreOp;
|
||||
|
||||
typedef enum Refresh_ClearOptionsBits
|
||||
{
|
||||
REFRESH_CLEAROPTIONS_COLOR = 0x00000001,
|
||||
REFRESH_CLEAROPTIONS_DEPTH = 0x00000002,
|
||||
REFRESH_CLEAROPTIONS_STENCIL = 0x00000004,
|
||||
} Refresh_ClearOptionsBits;
|
||||
|
||||
typedef uint32_t Refresh_ClearOptions;
|
||||
|
||||
typedef enum Refresh_IndexElementSize
|
||||
{
|
||||
REFRESH_INDEXELEMENTSIZE_16BIT,
|
||||
|
@ -133,6 +124,7 @@ typedef enum Refresh_TextureFormat
|
|||
REFRESH_TEXTUREFORMAT_BC1,
|
||||
REFRESH_TEXTUREFORMAT_BC2,
|
||||
REFRESH_TEXTUREFORMAT_BC3,
|
||||
REFRESH_TEXTUREFORMAT_BC7,
|
||||
REFRESH_TEXTUREFORMAT_R8G8_SNORM,
|
||||
REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM,
|
||||
REFRESH_TEXTUREFORMAT_A2R10G10B10,
|
||||
|
@ -193,7 +185,8 @@ typedef uint32_t Refresh_BufferUsageFlags;
|
|||
|
||||
typedef enum Refresh_VertexElementFormat
|
||||
{
|
||||
REFRESH_VERTEXELEMENTFORMAT_SINGLE,
|
||||
REFRESH_VERTEXELEMENTFORMAT_UINT,
|
||||
REFRESH_VERTEXELEMENTFORMAT_FLOAT,
|
||||
REFRESH_VERTEXELEMENTFORMAT_VECTOR2,
|
||||
REFRESH_VERTEXELEMENTFORMAT_VECTOR3,
|
||||
REFRESH_VERTEXELEMENTFORMAT_VECTOR4,
|
||||
|
@ -495,7 +488,6 @@ typedef struct Refresh_RasterizerState
|
|||
float depthBiasConstantFactor;
|
||||
float depthBiasClamp;
|
||||
float depthBiasSlopeFactor;
|
||||
float lineWidth;
|
||||
} Refresh_RasterizerState;
|
||||
|
||||
typedef struct Refresh_MultisampleState
|
||||
|
@ -607,30 +599,6 @@ REFRESHAPI void Refresh_DestroyDevice(Refresh_Device *device);
|
|||
|
||||
/* Drawing */
|
||||
|
||||
/* Clears the targets of the currently bound framebuffer.
|
||||
* If fewer colors are passed than the number of color targets in the
|
||||
* framebuffer, this function will clear the first n color targets.
|
||||
*
|
||||
* NOTE:
|
||||
* It is generally recommended to clear in BeginRenderPass
|
||||
* rather than by calling this function unless necessary.
|
||||
*
|
||||
* clearRect: Area to clear.
|
||||
* options: Bitflags to specify color/depth/stencil buffers for clearing.
|
||||
* colors: An array of color values for the cleared color buffers.
|
||||
* colorCount: The number of colors in the above array.
|
||||
* depthStencil: Depth and stencil values for the cleared depth stencil buffer.
|
||||
*/
|
||||
REFRESHAPI void Refresh_Clear(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Rect *clearRect,
|
||||
Refresh_ClearOptions options,
|
||||
Refresh_Vec4 *colors,
|
||||
uint32_t colorCount,
|
||||
Refresh_DepthStencilValue depthStencil
|
||||
);
|
||||
|
||||
/* Draws data from vertex/index buffers with instancing enabled.
|
||||
*
|
||||
* baseVertex: The starting offset to read from the vertex buffer.
|
||||
|
@ -988,6 +956,7 @@ REFRESHAPI void Refresh_QueueDestroyGraphicsPipeline(
|
|||
* The area affected by the render pass.
|
||||
* All load, store and resolve operations are restricted
|
||||
* to the given rectangle.
|
||||
* If NULL, a sensible default will be chosen.
|
||||
* colorAttachmentInfos:
|
||||
* A pointer to an array of Refresh_ColorAttachmentInfo structures
|
||||
* that contains render targets and clear values. May be NULL.
|
||||
|
@ -1135,17 +1104,22 @@ REFRESHAPI Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
|
|||
|
||||
/* Acquires a texture to use for presentation.
|
||||
* May return NULL under certain conditions.
|
||||
* If NULL, the user must ensure to not present.
|
||||
* If NULL, the user must ensure to not use the texture.
|
||||
* Once a swapchain texture is acquired,
|
||||
* it will automatically be presented on command buffer submission.
|
||||
*
|
||||
* NOTE:
|
||||
* It is not recommended to hold a reference to this texture long term.
|
||||
*
|
||||
* pWidth: A pointer to a uint32 that will be filled with the texture width.
|
||||
* pHeight: A pointer to a uint32 that will be filled with the texture height.
|
||||
*/
|
||||
REFRESHAPI Refresh_Texture* Refresh_AcquireSwapchainTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *windowHandle
|
||||
void *windowHandle,
|
||||
uint32_t *pWidth,
|
||||
uint32_t *pHeight
|
||||
);
|
||||
|
||||
/* Returns the format of the swapchain for the given window. */
|
||||
|
|
|
@ -34,7 +34,12 @@
|
|||
/* Drivers */
|
||||
|
||||
static const Refresh_Driver *drivers[] = {
|
||||
#ifdef REFRESH_DRIVER_VULKAN
|
||||
&VulkanDriver,
|
||||
#endif
|
||||
#ifdef REFRESH_DRIVER_PS5
|
||||
&PS5Driver,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -147,27 +152,6 @@ void Refresh_DestroyDevice(Refresh_Device *device)
|
|||
device->DestroyDevice(device);
|
||||
}
|
||||
|
||||
void Refresh_Clear(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Rect *clearRect,
|
||||
Refresh_ClearOptions options,
|
||||
Refresh_Vec4 *colors,
|
||||
uint32_t colorCount,
|
||||
Refresh_DepthStencilValue depthStencil
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->Clear(
|
||||
device->driverData,
|
||||
commandBuffer,
|
||||
clearRect,
|
||||
options,
|
||||
colors,
|
||||
colorCount,
|
||||
depthStencil
|
||||
);
|
||||
}
|
||||
|
||||
void Refresh_DrawIndexedPrimitives(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
|
@ -729,13 +713,17 @@ Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
|
|||
Refresh_Texture* Refresh_AcquireSwapchainTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *windowHandle
|
||||
void *windowHandle,
|
||||
uint32_t *pWidth,
|
||||
uint32_t *pHeight
|
||||
) {
|
||||
NULL_RETURN_NULL(device);
|
||||
return device->AcquireSwapchainTexture(
|
||||
device->driverData,
|
||||
commandBuffer,
|
||||
windowHandle
|
||||
windowHandle,
|
||||
pWidth,
|
||||
pHeight
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,15 @@
|
|||
|
||||
/* Logging */
|
||||
|
||||
extern void Refresh_LogInfo(const char *fmt, ...);
|
||||
extern void Refresh_LogWarn(const char *fmt, ...);
|
||||
extern void Refresh_LogError(const char *fmt, ...);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void Refresh_LogInfo(const char *fmt, ...);
|
||||
void Refresh_LogWarn(const char *fmt, ...);
|
||||
void Refresh_LogError(const char *fmt, ...);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Internal Helper Utilities */
|
||||
|
||||
|
@ -51,6 +57,7 @@ static inline uint32_t Texture_GetFormatSize(
|
|||
return 8;
|
||||
case REFRESH_TEXTUREFORMAT_BC2:
|
||||
case REFRESH_TEXTUREFORMAT_BC3:
|
||||
case REFRESH_TEXTUREFORMAT_BC7:
|
||||
return 16;
|
||||
case REFRESH_TEXTUREFORMAT_R8:
|
||||
return 1;
|
||||
|
@ -117,7 +124,8 @@ static inline uint32_t BytesPerRow(
|
|||
|
||||
if ( format == REFRESH_TEXTUREFORMAT_BC1 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC2 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 )
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC7 )
|
||||
{
|
||||
blocksPerRow = (width + 3) / 4;
|
||||
}
|
||||
|
@ -135,7 +143,8 @@ static inline int32_t BytesPerImage(
|
|||
|
||||
if ( format == REFRESH_TEXTUREFORMAT_BC1 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC2 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 )
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC7 )
|
||||
{
|
||||
blocksPerRow = (width + 3) / 4;
|
||||
blocksPerColumn = (height + 3) / 4;
|
||||
|
@ -168,16 +177,6 @@ struct Refresh_Device
|
|||
|
||||
/* Drawing */
|
||||
|
||||
void (*Clear)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Rect *clearRect,
|
||||
Refresh_ClearOptions options,
|
||||
Refresh_Vec4 *colors,
|
||||
uint32_t colorCount,
|
||||
Refresh_DepthStencilValue depthStencil
|
||||
);
|
||||
|
||||
void (*DrawInstancedPrimitives)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
|
@ -451,7 +450,9 @@ struct Refresh_Device
|
|||
Refresh_Texture* (*AcquireSwapchainTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *windowHandle
|
||||
void *windowHandle,
|
||||
uint32_t *pWidth,
|
||||
uint32_t *pHeight
|
||||
);
|
||||
|
||||
Refresh_TextureFormat (*GetSwapchainFormat)(
|
||||
|
@ -477,7 +478,6 @@ struct Refresh_Device
|
|||
result->func = name##_##func;
|
||||
#define ASSIGN_DRIVER(name) \
|
||||
ASSIGN_DRIVER_FUNC(DestroyDevice, name) \
|
||||
ASSIGN_DRIVER_FUNC(Clear, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
|
||||
|
@ -531,6 +531,7 @@ typedef struct Refresh_Driver
|
|||
} Refresh_Driver;
|
||||
|
||||
extern Refresh_Driver VulkanDriver;
|
||||
extern Refresh_Driver PS5Driver;
|
||||
|
||||
#endif /* REFRESH_DRIVER_H */
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
static TEMPLATE_SURFACE_FORMAT_TYPE RefreshToTEMPLATE_SurfaceFormat[] =
|
||||
{
|
||||
0, /* R8G8B8A8 */
|
||||
0 /* B8G8R8A8 */
|
||||
0, /* B8G8R8A8 */
|
||||
0, /* R5G6B5 */
|
||||
0, /* A1R5G5B5 */
|
||||
0, /* B4G4R4A4 */
|
||||
|
@ -97,7 +97,6 @@ static TEMPLATE_POLYGON_MODE_TYPE RefreshToTEMPLATE_PolygonMode[] =
|
|||
{
|
||||
0, /* FILL */
|
||||
0, /* LINE */
|
||||
0 /* POINT */
|
||||
};
|
||||
|
||||
static TEMPLATE_CULL_MODE_TYPE RefreshToTEMPLATE_CullMode[] =
|
||||
|
@ -105,7 +104,6 @@ static TEMPLATE_CULL_MODE_TYPE RefreshToTEMPLATE_CullMode[] =
|
|||
0, /* NONE */
|
||||
0, /* FRONT */
|
||||
0, /* BACK */
|
||||
0 /* FRONT_AND_BACK */
|
||||
};
|
||||
|
||||
static TEMPLATE_FRONT_FACE_TYPE RefreshToTEMPLATE_FrontFace[] =
|
||||
|
@ -128,8 +126,6 @@ static TEMPLATE_BLEND_FACTOR_TYPE RefreshToTEMPLATE_BlendFactor[] =
|
|||
0, /* ONE_MINUS_DST_ALPHA */
|
||||
0, /* CONSTANT_COLOR */
|
||||
0, /* ONE_MINUS_CONSTANT_COLOR */
|
||||
0, /* CONSTANT_ALPHA */
|
||||
0, /* ONE_MINUS_CONSTANT_ALPHA */
|
||||
0, /* SRC_ALPHA_SATURATE */
|
||||
0, /* SRC1_COLOR */
|
||||
0, /* ONE_MINUS_SRC1_COLOR */
|
||||
|
@ -146,26 +142,6 @@ static TEMPLATE_BLEND_OP_TYPE RefreshToTEMPLATE_BlendOp[] =
|
|||
0 /* MAX */
|
||||
};
|
||||
|
||||
static TEMPLATE_LOGIC_OP_TYPE RefreshToTEMPLATE_LogicOp[] =
|
||||
{
|
||||
0, /* CLEAR */
|
||||
0, /* AND */
|
||||
0, /* AND_REVERSE */
|
||||
0, /* COPY */
|
||||
0, /* AND_INVERTED */
|
||||
0, /* NO_OP */
|
||||
0, /* XOR */
|
||||
0, /* OR */
|
||||
0, /* NOR */
|
||||
0, /* EQUIVALENT */
|
||||
0, /* INVERT */
|
||||
0, /* OR_REVERSE */
|
||||
0, /* COPY_INVERTED */
|
||||
0, /* OR_INVERTED */
|
||||
0, /* NAND */
|
||||
0 /* SET */
|
||||
};
|
||||
|
||||
static TEMPLATE_COMPARE_OP_TYPE RefreshToTEMPLATE_CompareOp[] =
|
||||
{
|
||||
0, /* NEVER */
|
||||
|
@ -224,7 +200,6 @@ static TEMPLATE_FILTER_TYPE RefreshToTEMPLATE_Filter[] =
|
|||
{
|
||||
0, /* NEAREST */
|
||||
0, /* LINEAR */
|
||||
0 /* CUBIC */
|
||||
};
|
||||
|
||||
static TEMPLATE_SAMPLER_MIPMAP_MODE_TYPE RefreshToTEMPLATE_SamplerMipmapMode[] =
|
||||
|
@ -261,18 +236,6 @@ static void TEMPLATE_DestroyDevice(
|
|||
|
||||
/* Drawing */
|
||||
|
||||
static void TEMPLATE_Clear(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Rect *clearRect,
|
||||
Refresh_ClearOptions options,
|
||||
Refresh_Vec4 *colors,
|
||||
uint32_t colorCount,
|
||||
Refresh_DepthStencilValue depthStencil
|
||||
) {
|
||||
NOT_IMPLEMENTED
|
||||
}
|
||||
|
||||
static void TEMPLATE_DrawInstancedPrimitives(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
|
@ -623,7 +586,9 @@ static Refresh_CommandBuffer* TEMPLATE_AcquireCommandBuffer(
|
|||
Refresh_Texture* TEMPLATE_AcquireSwapchainTexture(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *windowHandle
|
||||
void *windowHandle,
|
||||
uint32_t *pWidth,
|
||||
uint32_t *pHeight
|
||||
) {
|
||||
NOT_IMPLEMENTED
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue