forked from MoonsideGames/Refresh
convert all spaces to tabs
parent
5187093ddc
commit
517399f5d9
|
@ -0,0 +1,13 @@
|
||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{c,h}]
|
||||||
|
charset = utf-8-bom
|
||||||
|
max_line_length = 100
|
|
@ -74,7 +74,7 @@ typedef enum Refresh_PresentMode
|
||||||
|
|
||||||
typedef enum Refresh_PrimitiveType
|
typedef enum Refresh_PrimitiveType
|
||||||
{
|
{
|
||||||
REFRESH_PRIMITIVETYPE_POINTLIST,
|
REFRESH_PRIMITIVETYPE_POINTLIST,
|
||||||
REFRESH_PRIMITIVETYPE_LINELIST,
|
REFRESH_PRIMITIVETYPE_LINELIST,
|
||||||
REFRESH_PRIMITIVETYPE_LINESTRIP,
|
REFRESH_PRIMITIVETYPE_LINESTRIP,
|
||||||
REFRESH_PRIMITIVETYPE_TRIANGLELIST,
|
REFRESH_PRIMITIVETYPE_TRIANGLELIST,
|
||||||
|
@ -83,59 +83,59 @@ typedef enum Refresh_PrimitiveType
|
||||||
|
|
||||||
typedef enum Refresh_LoadOp
|
typedef enum Refresh_LoadOp
|
||||||
{
|
{
|
||||||
REFRESH_LOADOP_LOAD,
|
REFRESH_LOADOP_LOAD,
|
||||||
REFRESH_LOADOP_CLEAR,
|
REFRESH_LOADOP_CLEAR,
|
||||||
REFRESH_LOADOP_DONT_CARE
|
REFRESH_LOADOP_DONT_CARE
|
||||||
} Refresh_LoadOp;
|
} Refresh_LoadOp;
|
||||||
|
|
||||||
typedef enum Refresh_StoreOp
|
typedef enum Refresh_StoreOp
|
||||||
{
|
{
|
||||||
REFRESH_STOREOP_STORE,
|
REFRESH_STOREOP_STORE,
|
||||||
REFRESH_STOREOP_DONT_CARE
|
REFRESH_STOREOP_DONT_CARE
|
||||||
} Refresh_StoreOp;
|
} Refresh_StoreOp;
|
||||||
|
|
||||||
typedef enum Refresh_ClearOptionsBits
|
typedef enum Refresh_ClearOptionsBits
|
||||||
{
|
{
|
||||||
REFRESH_CLEAROPTIONS_COLOR = 0x00000001,
|
REFRESH_CLEAROPTIONS_COLOR = 0x00000001,
|
||||||
REFRESH_CLEAROPTIONS_DEPTH = 0x00000002,
|
REFRESH_CLEAROPTIONS_DEPTH = 0x00000002,
|
||||||
REFRESH_CLEAROPTIONS_STENCIL = 0x00000004,
|
REFRESH_CLEAROPTIONS_STENCIL = 0x00000004,
|
||||||
} Refresh_ClearOptionsBits;
|
} Refresh_ClearOptionsBits;
|
||||||
|
|
||||||
typedef uint32_t Refresh_ClearOptions;
|
typedef uint32_t Refresh_ClearOptions;
|
||||||
|
|
||||||
typedef enum Refresh_IndexElementSize
|
typedef enum Refresh_IndexElementSize
|
||||||
{
|
{
|
||||||
REFRESH_INDEXELEMENTSIZE_16BIT,
|
REFRESH_INDEXELEMENTSIZE_16BIT,
|
||||||
REFRESH_INDEXELEMENTSIZE_32BIT
|
REFRESH_INDEXELEMENTSIZE_32BIT
|
||||||
} Refresh_IndexElementSize;
|
} Refresh_IndexElementSize;
|
||||||
|
|
||||||
typedef enum Refresh_TextureFormat
|
typedef enum Refresh_TextureFormat
|
||||||
{
|
{
|
||||||
/* Color Formats */
|
/* Color Formats */
|
||||||
REFRESH_TEXTUREFORMAT_R8G8B8A8,
|
REFRESH_TEXTUREFORMAT_R8G8B8A8,
|
||||||
REFRESH_TEXTUREFORMAT_R5G6B5,
|
REFRESH_TEXTUREFORMAT_R5G6B5,
|
||||||
REFRESH_TEXTUREFORMAT_A1R5G5B5,
|
REFRESH_TEXTUREFORMAT_A1R5G5B5,
|
||||||
REFRESH_TEXTUREFORMAT_B4G4R4A4,
|
REFRESH_TEXTUREFORMAT_B4G4R4A4,
|
||||||
REFRESH_TEXTUREFORMAT_BC1,
|
REFRESH_TEXTUREFORMAT_BC1,
|
||||||
REFRESH_TEXTUREFORMAT_BC2,
|
REFRESH_TEXTUREFORMAT_BC2,
|
||||||
REFRESH_TEXTUREFORMAT_BC3,
|
REFRESH_TEXTUREFORMAT_BC3,
|
||||||
REFRESH_TEXTUREFORMAT_R8G8_SNORM,
|
REFRESH_TEXTUREFORMAT_R8G8_SNORM,
|
||||||
REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM,
|
REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM,
|
||||||
REFRESH_TEXTUREFORMAT_A2R10G10B10,
|
REFRESH_TEXTUREFORMAT_A2R10G10B10,
|
||||||
REFRESH_TEXTUREFORMAT_R16G16,
|
REFRESH_TEXTUREFORMAT_R16G16,
|
||||||
REFRESH_TEXTUREFORMAT_R16G16B16A16,
|
REFRESH_TEXTUREFORMAT_R16G16B16A16,
|
||||||
REFRESH_TEXTUREFORMAT_R8,
|
REFRESH_TEXTUREFORMAT_R8,
|
||||||
REFRESH_TEXTUREFORMAT_R32_SFLOAT,
|
REFRESH_TEXTUREFORMAT_R32_SFLOAT,
|
||||||
REFRESH_TEXTUREFORMAT_R32G32_SFLOAT,
|
REFRESH_TEXTUREFORMAT_R32G32_SFLOAT,
|
||||||
REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT,
|
REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT,
|
||||||
REFRESH_TEXTUREFORMAT_R16_SFLOAT,
|
REFRESH_TEXTUREFORMAT_R16_SFLOAT,
|
||||||
REFRESH_TEXTUREFORMAT_R16G16_SFLOAT,
|
REFRESH_TEXTUREFORMAT_R16G16_SFLOAT,
|
||||||
REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT,
|
REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT,
|
||||||
/* Depth Formats */
|
/* Depth Formats */
|
||||||
REFRESH_TEXTUREFORMAT_D16_UNORM,
|
REFRESH_TEXTUREFORMAT_D16_UNORM,
|
||||||
REFRESH_TEXTUREFORMAT_D32_SFLOAT,
|
REFRESH_TEXTUREFORMAT_D32_SFLOAT,
|
||||||
REFRESH_TEXTUREFORMAT_D16_UNORM_S8_UINT,
|
REFRESH_TEXTUREFORMAT_D16_UNORM_S8_UINT,
|
||||||
REFRESH_TEXTUREFORMAT_D32_SFLOAT_S8_UINT
|
REFRESH_TEXTUREFORMAT_D32_SFLOAT_S8_UINT
|
||||||
} Refresh_TextureFormat;
|
} Refresh_TextureFormat;
|
||||||
|
|
||||||
typedef enum Refresh_TextureUsageFlagBits
|
typedef enum Refresh_TextureUsageFlagBits
|
||||||
|
@ -160,12 +160,12 @@ typedef enum Refresh_SampleCount
|
||||||
|
|
||||||
typedef enum Refresh_CubeMapFace
|
typedef enum Refresh_CubeMapFace
|
||||||
{
|
{
|
||||||
REFRESH_CUBEMAPFACE_POSITIVEX,
|
REFRESH_CUBEMAPFACE_POSITIVEX,
|
||||||
REFRESH_CUBEMAPFACE_NEGATIVEX,
|
REFRESH_CUBEMAPFACE_NEGATIVEX,
|
||||||
REFRESH_CUBEMAPFACE_POSITIVEY,
|
REFRESH_CUBEMAPFACE_POSITIVEY,
|
||||||
REFRESH_CUBEMAPFACE_NEGATIVEY,
|
REFRESH_CUBEMAPFACE_NEGATIVEY,
|
||||||
REFRESH_CUBEMAPFACE_POSITIVEZ,
|
REFRESH_CUBEMAPFACE_POSITIVEZ,
|
||||||
REFRESH_CUBEMAPFACE_NEGATIVEZ
|
REFRESH_CUBEMAPFACE_NEGATIVEZ
|
||||||
} Refresh_CubeMapFace;
|
} Refresh_CubeMapFace;
|
||||||
|
|
||||||
typedef enum Refresh_BufferUsageFlagBits
|
typedef enum Refresh_BufferUsageFlagBits
|
||||||
|
@ -256,52 +256,52 @@ typedef enum Refresh_BlendOp
|
||||||
typedef enum Refresh_LogicOp
|
typedef enum Refresh_LogicOp
|
||||||
{
|
{
|
||||||
REFRESH_LOGICOP_CLEAR = 0,
|
REFRESH_LOGICOP_CLEAR = 0,
|
||||||
REFRESH_LOGICOP_AND = 1,
|
REFRESH_LOGICOP_AND = 1,
|
||||||
REFRESH_LOGICOP_AND_REVERSE = 2,
|
REFRESH_LOGICOP_AND_REVERSE = 2,
|
||||||
REFRESH_LOGICOP_COPY = 3,
|
REFRESH_LOGICOP_COPY = 3,
|
||||||
REFRESH_LOGICOP_AND_INVERTED = 4,
|
REFRESH_LOGICOP_AND_INVERTED = 4,
|
||||||
REFRESH_LOGICOP_NO_OP = 5,
|
REFRESH_LOGICOP_NO_OP = 5,
|
||||||
REFRESH_LOGICOP_XOR = 6,
|
REFRESH_LOGICOP_XOR = 6,
|
||||||
REFRESH_LOGICOP_OR = 7,
|
REFRESH_LOGICOP_OR = 7,
|
||||||
REFRESH_LOGICOP_NOR = 8,
|
REFRESH_LOGICOP_NOR = 8,
|
||||||
REFRESH_LOGICOP_EQUIVALENT = 9,
|
REFRESH_LOGICOP_EQUIVALENT = 9,
|
||||||
REFRESH_LOGICOP_INVERT = 10,
|
REFRESH_LOGICOP_INVERT = 10,
|
||||||
REFRESH_LOGICOP_OR_REVERSE = 11,
|
REFRESH_LOGICOP_OR_REVERSE = 11,
|
||||||
REFRESH_LOGICOP_COPY_INVERTED = 12,
|
REFRESH_LOGICOP_COPY_INVERTED = 12,
|
||||||
REFRESH_LOGICOP_OR_INVERTED = 13,
|
REFRESH_LOGICOP_OR_INVERTED = 13,
|
||||||
REFRESH_LOGICOP_NAND = 14,
|
REFRESH_LOGICOP_NAND = 14,
|
||||||
REFRESH_LOGICOP_SET = 15
|
REFRESH_LOGICOP_SET = 15
|
||||||
} Refresh_LogicOp;
|
} Refresh_LogicOp;
|
||||||
|
|
||||||
typedef enum Refresh_BlendFactor
|
typedef enum Refresh_BlendFactor
|
||||||
{
|
{
|
||||||
REFRESH_BLENDFACTOR_ZERO = 0,
|
REFRESH_BLENDFACTOR_ZERO = 0,
|
||||||
REFRESH_BLENDFACTOR_ONE = 1,
|
REFRESH_BLENDFACTOR_ONE = 1,
|
||||||
REFRESH_BLENDFACTOR_SRC_COLOR = 2,
|
REFRESH_BLENDFACTOR_SRC_COLOR = 2,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 3,
|
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 3,
|
||||||
REFRESH_BLENDFACTOR_DST_COLOR = 4,
|
REFRESH_BLENDFACTOR_DST_COLOR = 4,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_DST_COLOR = 5,
|
REFRESH_BLENDFACTOR_ONE_MINUS_DST_COLOR = 5,
|
||||||
REFRESH_BLENDFACTOR_SRC_ALPHA = 6,
|
REFRESH_BLENDFACTOR_SRC_ALPHA = 6,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 7,
|
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 7,
|
||||||
REFRESH_BLENDFACTOR_DST_ALPHA = 8,
|
REFRESH_BLENDFACTOR_DST_ALPHA = 8,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 9,
|
REFRESH_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 9,
|
||||||
REFRESH_BLENDFACTOR_CONSTANT_COLOR = 10,
|
REFRESH_BLENDFACTOR_CONSTANT_COLOR = 10,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR = 11,
|
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR = 11,
|
||||||
REFRESH_BLENDFACTOR_CONSTANT_ALPHA = 12,
|
REFRESH_BLENDFACTOR_CONSTANT_ALPHA = 12,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_ALPHA = 13,
|
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_ALPHA = 13,
|
||||||
REFRESH_BLENDFACTOR_SRC_ALPHA_SATURATE = 14,
|
REFRESH_BLENDFACTOR_SRC_ALPHA_SATURATE = 14,
|
||||||
REFRESH_BLENDFACTOR_SRC1_COLOR = 15,
|
REFRESH_BLENDFACTOR_SRC1_COLOR = 15,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_COLOR = 16,
|
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_COLOR = 16,
|
||||||
REFRESH_BLENDFACTOR_SRC1_ALPHA = 17,
|
REFRESH_BLENDFACTOR_SRC1_ALPHA = 17,
|
||||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_ALPHA = 18
|
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_ALPHA = 18
|
||||||
} Refresh_BlendFactor;
|
} Refresh_BlendFactor;
|
||||||
|
|
||||||
typedef enum Refresh_ColorComponentFlagBits
|
typedef enum Refresh_ColorComponentFlagBits
|
||||||
{
|
{
|
||||||
REFRESH_COLORCOMPONENT_R_BIT = 0x00000001,
|
REFRESH_COLORCOMPONENT_R_BIT = 0x00000001,
|
||||||
REFRESH_COLORCOMPONENT_G_BIT = 0x00000002,
|
REFRESH_COLORCOMPONENT_G_BIT = 0x00000002,
|
||||||
REFRESH_COLORCOMPONENT_B_BIT = 0x00000004,
|
REFRESH_COLORCOMPONENT_B_BIT = 0x00000004,
|
||||||
REFRESH_COLORCOMPONENT_A_BIT = 0x00000008
|
REFRESH_COLORCOMPONENT_A_BIT = 0x00000008
|
||||||
} Refresh_ColorComponentFlagBits;
|
} Refresh_ColorComponentFlagBits;
|
||||||
|
|
||||||
typedef uint32_t Refresh_ColorComponentFlags;
|
typedef uint32_t Refresh_ColorComponentFlags;
|
||||||
|
@ -336,12 +336,12 @@ typedef enum Refresh_SamplerAddressMode
|
||||||
/* FIXME: we should probably make a library-level decision about color types */
|
/* FIXME: we should probably make a library-level decision about color types */
|
||||||
typedef enum Refresh_BorderColor
|
typedef enum Refresh_BorderColor
|
||||||
{
|
{
|
||||||
REFRESH_BORDERCOLOR_FLOAT_TRANSPARENT_BLACK = 0,
|
REFRESH_BORDERCOLOR_FLOAT_TRANSPARENT_BLACK = 0,
|
||||||
REFRESH_BORDERCOLOR_INT_TRANSPARENT_BLACK = 1,
|
REFRESH_BORDERCOLOR_INT_TRANSPARENT_BLACK = 1,
|
||||||
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_BLACK = 2,
|
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_BLACK = 2,
|
||||||
REFRESH_BORDERCOLOR_INT_OPAQUE_BLACK = 3,
|
REFRESH_BORDERCOLOR_INT_OPAQUE_BLACK = 3,
|
||||||
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_WHITE = 4,
|
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_WHITE = 4,
|
||||||
REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE = 5
|
REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE = 5
|
||||||
} Refresh_BorderColor;
|
} Refresh_BorderColor;
|
||||||
|
|
||||||
/* Structures */
|
/* Structures */
|
||||||
|
|
|
@ -54,10 +54,10 @@ extern "C" {
|
||||||
* 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!)
|
||||||
|
@ -76,9 +76,9 @@ REFRESHAPI void Refresh_Image_Free(uint8_t *mem);
|
||||||
* 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,
|
||||||
uint8_t *data
|
uint8_t *data
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
720
src/Refresh.c
720
src/Refresh.c
File diff suppressed because it is too large
Load Diff
|
@ -151,7 +151,7 @@ static inline int32_t BytesPerImage(
|
||||||
#define MAX_VERTEXTEXTURE_SAMPLERS 4
|
#define MAX_VERTEXTEXTURE_SAMPLERS 4
|
||||||
#define MAX_TOTAL_SAMPLERS (MAX_TEXTURE_SAMPLERS + MAX_VERTEXTEXTURE_SAMPLERS)
|
#define MAX_TOTAL_SAMPLERS (MAX_TEXTURE_SAMPLERS + MAX_VERTEXTEXTURE_SAMPLERS)
|
||||||
|
|
||||||
#define MAX_BUFFER_BINDINGS 16
|
#define MAX_BUFFER_BINDINGS 16
|
||||||
|
|
||||||
#define MAX_COLOR_TARGET_BINDINGS 4
|
#define MAX_COLOR_TARGET_BINDINGS 4
|
||||||
|
|
||||||
|
@ -168,309 +168,309 @@ struct Refresh_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_Vec4 *colors,
|
Refresh_Vec4 *colors,
|
||||||
uint32_t colorCount,
|
uint32_t colorCount,
|
||||||
Refresh_DepthStencilValue depthStencil
|
Refresh_DepthStencilValue depthStencil
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*DrawInstancedPrimitives)(
|
void (*DrawInstancedPrimitives)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
uint32_t baseVertex,
|
uint32_t baseVertex,
|
||||||
uint32_t startIndex,
|
uint32_t startIndex,
|
||||||
uint32_t primitiveCount,
|
uint32_t primitiveCount,
|
||||||
uint32_t instanceCount,
|
uint32_t instanceCount,
|
||||||
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 startIndex,
|
uint32_t startIndex,
|
||||||
uint32_t primitiveCount,
|
uint32_t primitiveCount,
|
||||||
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,
|
||||||
uint32_t fragmentParamOffset
|
uint32_t fragmentParamOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*DispatchCompute)(
|
void (*DispatchCompute)(
|
||||||
Refresh_Renderer *device,
|
Refresh_Renderer *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t groupCountX,
|
|
||||||
uint32_t groupCountY,
|
|
||||||
uint32_t groupCountZ,
|
|
||||||
uint32_t computeParamOffset
|
|
||||||
);
|
|
||||||
|
|
||||||
/* State Creation */
|
|
||||||
|
|
||||||
Refresh_ComputePipeline* (*CreateComputePipeline)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
Refresh_Sampler* (*CreateSampler)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
Refresh_ShaderModule* (*CreateShaderModule)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
Refresh_Texture* (*CreateTexture)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_TextureCreateInfo *textureCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
Refresh_RenderTarget* (*CreateRenderTarget)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
Refresh_SampleCount multisampleCount
|
|
||||||
);
|
|
||||||
|
|
||||||
Refresh_Buffer* (*CreateBuffer)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_BufferUsageFlags usageFlags,
|
|
||||||
uint32_t sizeInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Setters */
|
|
||||||
|
|
||||||
void(*SetTextureData)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
void(*SetTextureDataYUV)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer* commandBuffer,
|
|
||||||
Refresh_Texture *y,
|
|
||||||
Refresh_Texture *u,
|
|
||||||
Refresh_Texture *v,
|
|
||||||
uint32_t yWidth,
|
|
||||||
uint32_t yHeight,
|
|
||||||
uint32_t uvWidth,
|
|
||||||
uint32_t uvHeight,
|
|
||||||
void* data,
|
|
||||||
uint32_t dataLength
|
|
||||||
);
|
|
||||||
|
|
||||||
void(*CopyTextureToTexture)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *sourceTextureSlice,
|
|
||||||
Refresh_TextureSlice *destinationTextureSlice,
|
|
||||||
Refresh_Filter filter
|
|
||||||
);
|
|
||||||
|
|
||||||
void(*CopyTextureToBuffer)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
Refresh_Buffer *buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
void(*SetBufferData)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint32_t offsetInBytes,
|
|
||||||
void* data,
|
|
||||||
uint32_t dataLength
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32_t(*PushVertexShaderUniforms)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32_t(*PushFragmentShaderUniforms)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
uint32_t (*PushComputeShaderUniforms)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
void(*BindVertexSamplers)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
);
|
|
||||||
|
|
||||||
void(*BindFragmentSamplers)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Getters */
|
|
||||||
|
|
||||||
void(*GetBufferData)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Disposal */
|
|
||||||
|
|
||||||
void(*QueueDestroyTexture)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Texture *texture
|
uint32_t groupCountX,
|
||||||
);
|
uint32_t groupCountY,
|
||||||
|
uint32_t groupCountZ,
|
||||||
|
uint32_t computeParamOffset
|
||||||
|
);
|
||||||
|
|
||||||
void(*QueueDestroySampler)(
|
/* State Creation */
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
|
Refresh_ComputePipeline* (*CreateComputePipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_Sampler* (*CreateSampler)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_ShaderModule* (*CreateShaderModule)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_Texture* (*CreateTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_TextureCreateInfo *textureCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_RenderTarget* (*CreateRenderTarget)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_SampleCount multisampleCount
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_Buffer* (*CreateBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_BufferUsageFlags usageFlags,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Setters */
|
||||||
|
|
||||||
|
void(*SetTextureData)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Sampler *sampler
|
Refresh_TextureSlice *textureSlice,
|
||||||
);
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
void(*QueueDestroyBuffer)(
|
void(*SetTextureDataYUV)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer* commandBuffer,
|
||||||
|
Refresh_Texture *y,
|
||||||
|
Refresh_Texture *u,
|
||||||
|
Refresh_Texture *v,
|
||||||
|
uint32_t yWidth,
|
||||||
|
uint32_t yHeight,
|
||||||
|
uint32_t uvWidth,
|
||||||
|
uint32_t uvHeight,
|
||||||
|
void* data,
|
||||||
|
uint32_t dataLength
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*CopyTextureToTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer
|
Refresh_TextureSlice *sourceTextureSlice,
|
||||||
);
|
Refresh_TextureSlice *destinationTextureSlice,
|
||||||
|
Refresh_Filter filter
|
||||||
|
);
|
||||||
|
|
||||||
void(*QueueDestroyRenderTarget)(
|
void(*CopyTextureToBuffer)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_RenderTarget *renderTarget
|
Refresh_TextureSlice *textureSlice,
|
||||||
);
|
Refresh_Buffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
void(*QueueDestroyShaderModule)(
|
void(*SetBufferData)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_ShaderModule *shaderModule
|
Refresh_Buffer *buffer,
|
||||||
);
|
uint32_t offsetInBytes,
|
||||||
|
void* data,
|
||||||
|
uint32_t dataLength
|
||||||
|
);
|
||||||
|
|
||||||
void(*QueueDestroyComputePipeline)(
|
uint32_t(*PushVertexShaderUniforms)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_ComputePipeline *computePipeline
|
void *data,
|
||||||
);
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
void(*QueueDestroyGraphicsPipeline)(
|
uint32_t(*PushFragmentShaderUniforms)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
void *data,
|
||||||
);
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
/* Graphics State */
|
uint32_t (*PushComputeShaderUniforms)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
void(*BeginRenderPass)(
|
void(*BindVertexSamplers)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture **pTextures,
|
||||||
|
Refresh_Sampler **pSamplers
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*BindFragmentSamplers)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture **pTextures,
|
||||||
|
Refresh_Sampler **pSamplers
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Getters */
|
||||||
|
|
||||||
|
void(*GetBufferData)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_Buffer *buffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Disposal */
|
||||||
|
|
||||||
|
void(*QueueDestroyTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture *texture
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*QueueDestroySampler)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Sampler *sampler
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*QueueDestroyBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Buffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*QueueDestroyRenderTarget)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_RenderTarget *renderTarget
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*QueueDestroyShaderModule)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_ShaderModule *shaderModule
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*QueueDestroyComputePipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_ComputePipeline *computePipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
void(*QueueDestroyGraphicsPipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Graphics State */
|
||||||
|
|
||||||
|
void(*BeginRenderPass)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Rect *renderArea,
|
Refresh_Rect *renderArea,
|
||||||
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
||||||
uint32_t colorAttachmentCount,
|
uint32_t colorAttachmentCount,
|
||||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
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 *windowHandle
|
void *windowHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
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;
|
||||||
|
@ -484,51 +484,51 @@ struct Refresh_Device
|
||||||
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
|
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
|
||||||
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
|
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
|
||||||
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
|
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
|
||||||
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
|
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
|
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateRenderTarget, name) \
|
ASSIGN_DRIVER_FUNC(CreateRenderTarget, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
|
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
|
||||||
ASSIGN_DRIVER_FUNC(SetTextureData, name) \
|
ASSIGN_DRIVER_FUNC(SetTextureData, name) \
|
||||||
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
|
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
|
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
|
||||||
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
|
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
|
||||||
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
|
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
|
||||||
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
|
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
|
||||||
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
|
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
|
||||||
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
|
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
|
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
|
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
|
||||||
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
|
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroyRenderTarget, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyRenderTarget, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
|
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
|
||||||
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
|
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
|
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
|
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
|
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
|
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
|
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
|
||||||
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
|
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
|
||||||
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
|
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
|
||||||
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
|
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
|
||||||
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;
|
||||||
|
|
||||||
|
|
|
@ -92,29 +92,29 @@ static uint32_t deviceExtensionCount = SDL_arraysize(deviceExtensionNames);
|
||||||
#define NULL_RENDER_PASS (Refresh_RenderPass*) 0
|
#define NULL_RENDER_PASS (Refresh_RenderPass*) 0
|
||||||
|
|
||||||
#define EXPAND_ELEMENTS_IF_NEEDED(arr, initialValue, type) \
|
#define EXPAND_ELEMENTS_IF_NEEDED(arr, initialValue, type) \
|
||||||
if (arr->count == arr->capacity) \
|
if (arr->count == arr->capacity) \
|
||||||
{ \
|
{ \
|
||||||
if (arr->capacity == 0) \
|
if (arr->capacity == 0) \
|
||||||
{ \
|
{ \
|
||||||
arr->capacity = initialValue; \
|
arr->capacity = initialValue; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
arr->capacity *= 2; \
|
arr->capacity *= 2; \
|
||||||
} \
|
} \
|
||||||
arr->elements = (type*) SDL_realloc( \
|
arr->elements = (type*) SDL_realloc( \
|
||||||
arr->elements, \
|
arr->elements, \
|
||||||
arr->capacity * sizeof(type) \
|
arr->capacity * sizeof(type) \
|
||||||
); \
|
); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EXPAND_ARRAY_IF_NEEDED(arr, elementType, newCount, capacity, newCapacity) \
|
#define EXPAND_ARRAY_IF_NEEDED(arr, elementType, newCount, capacity, newCapacity) \
|
||||||
if (newCount >= capacity) \
|
if (newCount >= capacity) \
|
||||||
{ \
|
{ \
|
||||||
capacity = newCapacity; \
|
capacity = newCapacity; \
|
||||||
arr = (elementType*) SDL_realloc( \
|
arr = (elementType*) SDL_realloc( \
|
||||||
arr, \
|
arr, \
|
||||||
sizeof(elementType) * capacity \
|
sizeof(elementType) * capacity \
|
||||||
); \
|
); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,24 +189,24 @@ static const uint8_t DEVICE_PRIORITY[] =
|
||||||
|
|
||||||
static VkFormat RefreshToVK_SurfaceFormat[] =
|
static VkFormat RefreshToVK_SurfaceFormat[] =
|
||||||
{
|
{
|
||||||
VK_FORMAT_R8G8B8A8_UNORM, /* R8G8B8A8 */
|
VK_FORMAT_R8G8B8A8_UNORM, /* R8G8B8A8 */
|
||||||
VK_FORMAT_R5G6B5_UNORM_PACK16, /* R5G6B5 */
|
VK_FORMAT_R5G6B5_UNORM_PACK16, /* R5G6B5 */
|
||||||
VK_FORMAT_A1R5G5B5_UNORM_PACK16, /* A1R5G5B5 */
|
VK_FORMAT_A1R5G5B5_UNORM_PACK16, /* A1R5G5B5 */
|
||||||
VK_FORMAT_B4G4R4A4_UNORM_PACK16, /* B4G4R4A4 */
|
VK_FORMAT_B4G4R4A4_UNORM_PACK16, /* B4G4R4A4 */
|
||||||
VK_FORMAT_BC1_RGBA_UNORM_BLOCK, /* BC1 */
|
VK_FORMAT_BC1_RGBA_UNORM_BLOCK, /* BC1 */
|
||||||
VK_FORMAT_BC2_UNORM_BLOCK, /* BC3 */
|
VK_FORMAT_BC2_UNORM_BLOCK, /* BC3 */
|
||||||
VK_FORMAT_BC3_UNORM_BLOCK, /* BC5 */
|
VK_FORMAT_BC3_UNORM_BLOCK, /* BC5 */
|
||||||
VK_FORMAT_R8G8_SNORM, /* R8G8_SNORM */
|
VK_FORMAT_R8G8_SNORM, /* R8G8_SNORM */
|
||||||
VK_FORMAT_R8G8B8A8_SNORM, /* R8G8B8A8_SNORM */
|
VK_FORMAT_R8G8B8A8_SNORM, /* R8G8B8A8_SNORM */
|
||||||
VK_FORMAT_A2R10G10B10_UNORM_PACK32, /* A2R10G10B10 */
|
VK_FORMAT_A2R10G10B10_UNORM_PACK32, /* A2R10G10B10 */
|
||||||
VK_FORMAT_R16G16_UNORM, /* R16G16 */
|
VK_FORMAT_R16G16_UNORM, /* R16G16 */
|
||||||
VK_FORMAT_R16G16B16A16_UNORM, /* R16G16B16A16 */
|
VK_FORMAT_R16G16B16A16_UNORM, /* R16G16B16A16 */
|
||||||
VK_FORMAT_R8_UNORM, /* R8 */
|
VK_FORMAT_R8_UNORM, /* R8 */
|
||||||
VK_FORMAT_R32_SFLOAT, /* R32_SFLOAT */
|
VK_FORMAT_R32_SFLOAT, /* R32_SFLOAT */
|
||||||
VK_FORMAT_R32G32_SFLOAT, /* R32G32_SFLOAT */
|
VK_FORMAT_R32G32_SFLOAT, /* R32G32_SFLOAT */
|
||||||
VK_FORMAT_R32G32B32A32_SFLOAT, /* R32G32B32A32_SFLOAT */
|
VK_FORMAT_R32G32B32A32_SFLOAT, /* R32G32B32A32_SFLOAT */
|
||||||
VK_FORMAT_R16_SFLOAT, /* R16_SFLOAT */
|
VK_FORMAT_R16_SFLOAT, /* R16_SFLOAT */
|
||||||
VK_FORMAT_R16G16_SFLOAT, /* R16G16_SFLOAT */
|
VK_FORMAT_R16G16_SFLOAT, /* R16G16_SFLOAT */
|
||||||
VK_FORMAT_R16G16B16A16_SFLOAT, /* R16G16B16A16_SFLOAT */
|
VK_FORMAT_R16G16B16A16_SFLOAT, /* R16G16B16A16_SFLOAT */
|
||||||
VK_FORMAT_D16_UNORM, /* D16 */
|
VK_FORMAT_D16_UNORM, /* D16 */
|
||||||
VK_FORMAT_D32_SFLOAT, /* D32 */
|
VK_FORMAT_D32_SFLOAT, /* D32 */
|
||||||
|
@ -344,26 +344,26 @@ static VkStencilOp RefreshToVK_StencilOp[] =
|
||||||
|
|
||||||
static VkAttachmentLoadOp RefreshToVK_LoadOp[] =
|
static VkAttachmentLoadOp RefreshToVK_LoadOp[] =
|
||||||
{
|
{
|
||||||
VK_ATTACHMENT_LOAD_OP_LOAD,
|
VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||||
VK_ATTACHMENT_LOAD_OP_CLEAR,
|
VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE
|
||||||
};
|
};
|
||||||
|
|
||||||
static VkAttachmentStoreOp RefreshToVK_StoreOp[] =
|
static VkAttachmentStoreOp RefreshToVK_StoreOp[] =
|
||||||
{
|
{
|
||||||
VK_ATTACHMENT_STORE_OP_STORE,
|
VK_ATTACHMENT_STORE_OP_STORE,
|
||||||
VK_ATTACHMENT_STORE_OP_DONT_CARE
|
VK_ATTACHMENT_STORE_OP_DONT_CARE
|
||||||
};
|
};
|
||||||
|
|
||||||
static VkSampleCountFlagBits RefreshToVK_SampleCount[] =
|
static VkSampleCountFlagBits RefreshToVK_SampleCount[] =
|
||||||
{
|
{
|
||||||
VK_SAMPLE_COUNT_1_BIT,
|
VK_SAMPLE_COUNT_1_BIT,
|
||||||
VK_SAMPLE_COUNT_2_BIT,
|
VK_SAMPLE_COUNT_2_BIT,
|
||||||
VK_SAMPLE_COUNT_4_BIT,
|
VK_SAMPLE_COUNT_4_BIT,
|
||||||
VK_SAMPLE_COUNT_8_BIT,
|
VK_SAMPLE_COUNT_8_BIT,
|
||||||
VK_SAMPLE_COUNT_16_BIT,
|
VK_SAMPLE_COUNT_16_BIT,
|
||||||
VK_SAMPLE_COUNT_32_BIT,
|
VK_SAMPLE_COUNT_32_BIT,
|
||||||
VK_SAMPLE_COUNT_64_BIT
|
VK_SAMPLE_COUNT_64_BIT
|
||||||
};
|
};
|
||||||
|
|
||||||
static VkVertexInputRate RefreshToVK_VertexInputRate[] =
|
static VkVertexInputRate RefreshToVK_VertexInputRate[] =
|
||||||
|
@ -528,9 +528,9 @@ static const VulkanResourceAccessInfo AccessMap[RESOURCE_ACCESS_TYPES_COUNT] =
|
||||||
},
|
},
|
||||||
|
|
||||||
/* RESOURCE_ACCESS_COMPUTE_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER */
|
/* RESOURCE_ACCESS_COMPUTE_SHADER_READ_SAMPLED_IMAGE_OR_UNIFORM_TEXEL_BUFFER */
|
||||||
{ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
{ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||||
VK_ACCESS_SHADER_READ_BIT,
|
VK_ACCESS_SHADER_READ_BIT,
|
||||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
||||||
},
|
},
|
||||||
|
|
||||||
/* RESOURCE_ACCESS_COMPUTE_SHADER_READ_OTHER */
|
/* RESOURCE_ACCESS_COMPUTE_SHADER_READ_OTHER */
|
||||||
|
@ -876,9 +876,9 @@ static inline VkDescriptorSetLayout DescriptorSetLayoutHashTable_Fetch(
|
||||||
for (i = 0; i < arr->count; i += 1)
|
for (i = 0; i < arr->count; i += 1)
|
||||||
{
|
{
|
||||||
const DescriptorSetLayoutHash *e = &arr->elements[i].key;
|
const DescriptorSetLayoutHash *e = &arr->elements[i].key;
|
||||||
if ( key.descriptorType == e->descriptorType &&
|
if ( key.descriptorType == e->descriptorType &&
|
||||||
key.bindingCount == e->bindingCount &&
|
key.bindingCount == e->bindingCount &&
|
||||||
key.stageFlag == e->stageFlag )
|
key.stageFlag == e->stageFlag )
|
||||||
{
|
{
|
||||||
return arr->elements[i].value;
|
return arr->elements[i].value;
|
||||||
}
|
}
|
||||||
|
@ -1499,14 +1499,14 @@ static inline void CommandPoolHashTable_Insert(
|
||||||
|
|
||||||
typedef struct VulkanRenderer
|
typedef struct VulkanRenderer
|
||||||
{
|
{
|
||||||
VkInstance instance;
|
VkInstance instance;
|
||||||
VkPhysicalDevice physicalDevice;
|
VkPhysicalDevice physicalDevice;
|
||||||
VkPhysicalDeviceProperties2 physicalDeviceProperties;
|
VkPhysicalDeviceProperties2 physicalDeviceProperties;
|
||||||
VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
|
VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
|
||||||
VkDevice logicalDevice;
|
VkDevice logicalDevice;
|
||||||
|
|
||||||
uint8_t supportsDebugUtils;
|
uint8_t supportsDebugUtils;
|
||||||
uint8_t debugMode;
|
uint8_t debugMode;
|
||||||
|
|
||||||
VulkanMemoryAllocator *memoryAllocator;
|
VulkanMemoryAllocator *memoryAllocator;
|
||||||
VkPhysicalDeviceMemoryProperties memoryProperties;
|
VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||||
|
@ -1515,7 +1515,7 @@ typedef struct VulkanRenderer
|
||||||
uint32_t swapchainDataCount;
|
uint32_t swapchainDataCount;
|
||||||
uint32_t swapchainDataCapacity;
|
uint32_t swapchainDataCapacity;
|
||||||
|
|
||||||
QueueFamilyIndices queueFamilyIndices;
|
QueueFamilyIndices queueFamilyIndices;
|
||||||
VkQueue graphicsQueue;
|
VkQueue graphicsQueue;
|
||||||
VkQueue presentQueue;
|
VkQueue presentQueue;
|
||||||
VkQueue computeQueue;
|
VkQueue computeQueue;
|
||||||
|
@ -1572,7 +1572,7 @@ typedef struct VulkanRenderer
|
||||||
SDL_mutex *renderPassFetchLock;
|
SDL_mutex *renderPassFetchLock;
|
||||||
SDL_mutex *framebufferFetchLock;
|
SDL_mutex *framebufferFetchLock;
|
||||||
|
|
||||||
#define VULKAN_INSTANCE_FUNCTION(ext, ret, func, params) \
|
#define VULKAN_INSTANCE_FUNCTION(ext, ret, func, params) \
|
||||||
vkfntype_##func func;
|
vkfntype_##func func;
|
||||||
#define VULKAN_DEVICE_FUNCTION(ext, ret, func, params) \
|
#define VULKAN_DEVICE_FUNCTION(ext, ret, func, params) \
|
||||||
vkfntype_##func func;
|
vkfntype_##func func;
|
||||||
|
@ -3706,22 +3706,22 @@ static uint8_t VULKAN_INTERNAL_ChooseSwapPresentMode(
|
||||||
Refresh_LogInfo(#m " unsupported.");
|
Refresh_LogInfo(#m " unsupported.");
|
||||||
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
if (desiredPresentInterval == REFRESH_PRESENTMODE_IMMEDIATE)
|
if (desiredPresentInterval == REFRESH_PRESENTMODE_IMMEDIATE)
|
||||||
{
|
{
|
||||||
CHECK_MODE(VK_PRESENT_MODE_IMMEDIATE_KHR)
|
CHECK_MODE(VK_PRESENT_MODE_IMMEDIATE_KHR)
|
||||||
}
|
}
|
||||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_MAILBOX)
|
else if (desiredPresentInterval == REFRESH_PRESENTMODE_MAILBOX)
|
||||||
{
|
{
|
||||||
CHECK_MODE(VK_PRESENT_MODE_MAILBOX_KHR)
|
CHECK_MODE(VK_PRESENT_MODE_MAILBOX_KHR)
|
||||||
}
|
}
|
||||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO)
|
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO)
|
||||||
{
|
{
|
||||||
CHECK_MODE(VK_PRESENT_MODE_FIFO_KHR)
|
CHECK_MODE(VK_PRESENT_MODE_FIFO_KHR)
|
||||||
}
|
}
|
||||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO_RELAXED)
|
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO_RELAXED)
|
||||||
{
|
{
|
||||||
CHECK_MODE(VK_PRESENT_MODE_FIFO_RELAXED_KHR)
|
CHECK_MODE(VK_PRESENT_MODE_FIFO_RELAXED_KHR)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Refresh_LogError(
|
Refresh_LogError(
|
||||||
|
@ -4203,7 +4203,7 @@ static void VULKAN_INTERNAL_EndCommandBuffer(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_DestroyDevice(
|
static void VULKAN_DestroyDevice(
|
||||||
Refresh_Device *device
|
Refresh_Device *device
|
||||||
) {
|
) {
|
||||||
VulkanRenderer* renderer = (VulkanRenderer*) device->driverData;
|
VulkanRenderer* renderer = (VulkanRenderer*) device->driverData;
|
||||||
CommandPoolHashArray commandPoolHashArray;
|
CommandPoolHashArray commandPoolHashArray;
|
||||||
|
@ -4724,165 +4724,165 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
||||||
uint32_t colorAttachmentCount,
|
uint32_t colorAttachmentCount,
|
||||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||||
) {
|
) {
|
||||||
VkResult vulkanResult;
|
VkResult vulkanResult;
|
||||||
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
||||||
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
||||||
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
||||||
VkAttachmentReference depthStencilAttachmentReference;
|
VkAttachmentReference depthStencilAttachmentReference;
|
||||||
VkRenderPassCreateInfo renderPassCreateInfo;
|
VkRenderPassCreateInfo renderPassCreateInfo;
|
||||||
VkSubpassDescription subpass;
|
VkSubpassDescription subpass;
|
||||||
VkRenderPass renderPass;
|
VkRenderPass renderPass;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint8_t multisampling = 0;
|
uint8_t multisampling = 0;
|
||||||
|
|
||||||
uint32_t attachmentDescriptionCount = 0;
|
uint32_t attachmentDescriptionCount = 0;
|
||||||
uint32_t colorAttachmentReferenceCount = 0;
|
uint32_t colorAttachmentReferenceCount = 0;
|
||||||
uint32_t resolveReferenceCount = 0;
|
uint32_t resolveReferenceCount = 0;
|
||||||
|
|
||||||
VulkanRenderTarget *colorTarget;
|
VulkanRenderTarget *colorTarget;
|
||||||
VulkanRenderTarget *depthStencilTarget;
|
VulkanRenderTarget *depthStencilTarget;
|
||||||
|
|
||||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||||
{
|
{
|
||||||
colorTarget = (VulkanRenderTarget*) colorAttachmentInfos[attachmentDescriptionCount].pRenderTarget;
|
colorTarget = (VulkanRenderTarget*) colorAttachmentInfos[attachmentDescriptionCount].pRenderTarget;
|
||||||
|
|
||||||
if (colorTarget->multisampleCount > VK_SAMPLE_COUNT_1_BIT)
|
if (colorTarget->multisampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||||
{
|
{
|
||||||
multisampling = 1;
|
multisampling = 1;
|
||||||
|
|
||||||
/* Resolve attachment and multisample attachment */
|
/* Resolve attachment and multisample attachment */
|
||||||
|
|
||||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||||
VK_SAMPLE_COUNT_1_BIT;
|
VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||||
colorAttachmentInfos[i].loadOp
|
colorAttachmentInfos[i].loadOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||||
colorAttachmentInfos[i].storeOp
|
colorAttachmentInfos[i].storeOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
resolveReferences[resolveReferenceCount].attachment =
|
resolveReferences[resolveReferenceCount].attachment =
|
||||||
attachmentDescriptionCount;
|
attachmentDescriptionCount;
|
||||||
resolveReferences[resolveReferenceCount].layout =
|
resolveReferences[resolveReferenceCount].layout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
resolveReferenceCount += 1;
|
resolveReferenceCount += 1;
|
||||||
|
|
||||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].samples = colorTarget->multisampleCount;
|
attachmentDescriptions[attachmentDescriptionCount].samples = colorTarget->multisampleCount;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||||
colorAttachmentInfos[i].loadOp
|
colorAttachmentInfos[i].loadOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||||
colorAttachmentInfos[i].storeOp
|
colorAttachmentInfos[i].storeOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment =
|
colorAttachmentReferences[colorAttachmentReferenceCount].attachment =
|
||||||
attachmentDescriptionCount;
|
attachmentDescriptionCount;
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
colorAttachmentReferenceCount += 1;
|
colorAttachmentReferenceCount += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||||
VK_SAMPLE_COUNT_1_BIT;
|
VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||||
colorAttachmentInfos[i].loadOp
|
colorAttachmentInfos[i].loadOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||||
colorAttachmentInfos[i].storeOp
|
colorAttachmentInfos[i].storeOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
|
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
colorAttachmentReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
colorAttachmentReferenceCount += 1;
|
colorAttachmentReferenceCount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||||
subpass.flags = 0;
|
subpass.flags = 0;
|
||||||
subpass.inputAttachmentCount = 0;
|
subpass.inputAttachmentCount = 0;
|
||||||
subpass.pInputAttachments = NULL;
|
subpass.pInputAttachments = NULL;
|
||||||
subpass.colorAttachmentCount = colorAttachmentCount;
|
subpass.colorAttachmentCount = colorAttachmentCount;
|
||||||
subpass.pColorAttachments = colorAttachmentReferences;
|
subpass.pColorAttachments = colorAttachmentReferences;
|
||||||
subpass.preserveAttachmentCount = 0;
|
subpass.preserveAttachmentCount = 0;
|
||||||
subpass.pPreserveAttachments = NULL;
|
subpass.pPreserveAttachments = NULL;
|
||||||
|
|
||||||
if (depthStencilAttachmentInfo == NULL)
|
if (depthStencilAttachmentInfo == NULL)
|
||||||
{
|
{
|
||||||
subpass.pDepthStencilAttachment = NULL;
|
subpass.pDepthStencilAttachment = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
depthStencilTarget = (VulkanRenderTarget*) depthStencilAttachmentInfo->pDepthStencilTarget;
|
depthStencilTarget = (VulkanRenderTarget*) depthStencilAttachmentInfo->pDepthStencilTarget;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].format = depthStencilTarget->texture->format;
|
attachmentDescriptions[attachmentDescriptionCount].format = depthStencilTarget->texture->format;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||||
VK_SAMPLE_COUNT_1_BIT; /* FIXME: do these take multisamples? */
|
VK_SAMPLE_COUNT_1_BIT; /* FIXME: do these take multisamples? */
|
||||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||||
depthStencilAttachmentInfo->loadOp
|
depthStencilAttachmentInfo->loadOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||||
depthStencilAttachmentInfo->storeOp
|
depthStencilAttachmentInfo->storeOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = RefreshToVK_LoadOp[
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = RefreshToVK_LoadOp[
|
||||||
depthStencilAttachmentInfo->stencilLoadOp
|
depthStencilAttachmentInfo->stencilLoadOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = RefreshToVK_StoreOp[
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = RefreshToVK_StoreOp[
|
||||||
depthStencilAttachmentInfo->stencilStoreOp
|
depthStencilAttachmentInfo->stencilStoreOp
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
depthStencilAttachmentReference.attachment =
|
depthStencilAttachmentReference.attachment =
|
||||||
attachmentDescriptionCount;
|
attachmentDescriptionCount;
|
||||||
depthStencilAttachmentReference.layout =
|
depthStencilAttachmentReference.layout =
|
||||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
subpass.pDepthStencilAttachment =
|
subpass.pDepthStencilAttachment =
|
||||||
&depthStencilAttachmentReference;
|
&depthStencilAttachmentReference;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multisampling)
|
if (multisampling)
|
||||||
{
|
{
|
||||||
|
@ -4893,22 +4893,22 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
||||||
subpass.pResolveAttachments = NULL;
|
subpass.pResolveAttachments = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||||
renderPassCreateInfo.pNext = NULL;
|
renderPassCreateInfo.pNext = NULL;
|
||||||
renderPassCreateInfo.flags = 0;
|
renderPassCreateInfo.flags = 0;
|
||||||
renderPassCreateInfo.pAttachments = attachmentDescriptions;
|
renderPassCreateInfo.pAttachments = attachmentDescriptions;
|
||||||
renderPassCreateInfo.attachmentCount = attachmentDescriptionCount;
|
renderPassCreateInfo.attachmentCount = attachmentDescriptionCount;
|
||||||
renderPassCreateInfo.subpassCount = 1;
|
renderPassCreateInfo.subpassCount = 1;
|
||||||
renderPassCreateInfo.pSubpasses = &subpass;
|
renderPassCreateInfo.pSubpasses = &subpass;
|
||||||
renderPassCreateInfo.dependencyCount = 0;
|
renderPassCreateInfo.dependencyCount = 0;
|
||||||
renderPassCreateInfo.pDependencies = NULL;
|
renderPassCreateInfo.pDependencies = NULL;
|
||||||
|
|
||||||
vulkanResult = renderer->vkCreateRenderPass(
|
vulkanResult = renderer->vkCreateRenderPass(
|
||||||
renderer->logicalDevice,
|
renderer->logicalDevice,
|
||||||
&renderPassCreateInfo,
|
&renderPassCreateInfo,
|
||||||
NULL,
|
NULL,
|
||||||
&renderPass
|
&renderPass
|
||||||
);
|
);
|
||||||
|
|
||||||
if (vulkanResult != VK_SUCCESS)
|
if (vulkanResult != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -4916,7 +4916,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
||||||
LogVulkanResultAsError("vkCreateRenderPass", vulkanResult);
|
LogVulkanResultAsError("vkCreateRenderPass", vulkanResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderPass;
|
return renderPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
||||||
|
@ -4928,13 +4928,13 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
||||||
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
||||||
VkAttachmentReference depthStencilAttachmentReference;
|
VkAttachmentReference depthStencilAttachmentReference;
|
||||||
Refresh_ColorAttachmentDescription attachmentDescription;
|
Refresh_ColorAttachmentDescription attachmentDescription;
|
||||||
VkSubpassDescription subpass;
|
VkSubpassDescription subpass;
|
||||||
VkRenderPassCreateInfo renderPassCreateInfo;
|
VkRenderPassCreateInfo renderPassCreateInfo;
|
||||||
VkRenderPass renderPass;
|
VkRenderPass renderPass;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
uint32_t multisampling = 0;
|
uint32_t multisampling = 0;
|
||||||
uint32_t attachmentDescriptionCount = 0;
|
uint32_t attachmentDescriptionCount = 0;
|
||||||
uint32_t colorAttachmentReferenceCount = 0;
|
uint32_t colorAttachmentReferenceCount = 0;
|
||||||
uint32_t resolveReferenceCount = 0;
|
uint32_t resolveReferenceCount = 0;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -4980,42 +4980,42 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment =
|
colorAttachmentReferences[colorAttachmentReferenceCount].attachment =
|
||||||
attachmentDescriptionCount;
|
attachmentDescriptionCount;
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
colorAttachmentReferenceCount += 1;
|
colorAttachmentReferenceCount += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
|
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
|
||||||
attachmentDescription.format
|
attachmentDescription.format
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||||
VK_SAMPLE_COUNT_1_BIT;
|
VK_SAMPLE_COUNT_1_BIT;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].loadOp =
|
attachmentDescriptions[attachmentDescriptionCount].loadOp =
|
||||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].storeOp =
|
attachmentDescriptions[attachmentDescriptionCount].storeOp =
|
||||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
|
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
colorAttachmentReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
||||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
colorAttachmentReferenceCount += 1;
|
colorAttachmentReferenceCount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||||
|
@ -5030,29 +5030,29 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
||||||
if (attachmentInfo.hasDepthStencilAttachment)
|
if (attachmentInfo.hasDepthStencilAttachment)
|
||||||
{
|
{
|
||||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
|
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
|
||||||
attachmentInfo.depthStencilFormat
|
attachmentInfo.depthStencilFormat
|
||||||
];
|
];
|
||||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||||
VK_SAMPLE_COUNT_1_BIT; /* FIXME: do these take multisamples? */
|
VK_SAMPLE_COUNT_1_BIT; /* FIXME: do these take multisamples? */
|
||||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
depthStencilAttachmentReference.attachment =
|
depthStencilAttachmentReference.attachment =
|
||||||
attachmentDescriptionCount;
|
attachmentDescriptionCount;
|
||||||
depthStencilAttachmentReference.layout =
|
depthStencilAttachmentReference.layout =
|
||||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
|
|
||||||
subpass.pDepthStencilAttachment =
|
subpass.pDepthStencilAttachment =
|
||||||
&depthStencilAttachmentReference;
|
&depthStencilAttachmentReference;
|
||||||
|
|
||||||
attachmentDescriptionCount += 1;
|
attachmentDescriptionCount += 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5068,15 +5068,15 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
||||||
subpass.pResolveAttachments = NULL;
|
subpass.pResolveAttachments = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||||
renderPassCreateInfo.pNext = NULL;
|
renderPassCreateInfo.pNext = NULL;
|
||||||
renderPassCreateInfo.flags = 0;
|
renderPassCreateInfo.flags = 0;
|
||||||
renderPassCreateInfo.pAttachments = attachmentDescriptions;
|
renderPassCreateInfo.pAttachments = attachmentDescriptions;
|
||||||
renderPassCreateInfo.attachmentCount = attachmentDescriptionCount;
|
renderPassCreateInfo.attachmentCount = attachmentDescriptionCount;
|
||||||
renderPassCreateInfo.subpassCount = 1;
|
renderPassCreateInfo.subpassCount = 1;
|
||||||
renderPassCreateInfo.pSubpasses = &subpass;
|
renderPassCreateInfo.pSubpasses = &subpass;
|
||||||
renderPassCreateInfo.dependencyCount = 0;
|
renderPassCreateInfo.dependencyCount = 0;
|
||||||
renderPassCreateInfo.pDependencies = NULL;
|
renderPassCreateInfo.pDependencies = NULL;
|
||||||
|
|
||||||
result = renderer->vkCreateRenderPass(
|
result = renderer->vkCreateRenderPass(
|
||||||
renderer->logicalDevice,
|
renderer->logicalDevice,
|
||||||
|
@ -8614,7 +8614,7 @@ static void VULKAN_INTERNAL_CleanCommandBuffer(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_Wait(
|
static void VULKAN_Wait(
|
||||||
Refresh_Renderer *driverData
|
Refresh_Renderer *driverData
|
||||||
) {
|
) {
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||||
VulkanCommandBuffer *commandBuffer;
|
VulkanCommandBuffer *commandBuffer;
|
||||||
|
@ -8643,7 +8643,7 @@ static void VULKAN_Wait(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VULKAN_Submit(
|
static void VULKAN_Submit(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
uint32_t commandBufferCount,
|
uint32_t commandBufferCount,
|
||||||
Refresh_CommandBuffer **pCommandBuffers
|
Refresh_CommandBuffer **pCommandBuffers
|
||||||
) {
|
) {
|
||||||
|
@ -8950,8 +8950,8 @@ static uint8_t VULKAN_INTERNAL_CheckValidationLayers(
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t VULKAN_INTERNAL_CreateInstance(
|
static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
VulkanRenderer *renderer,
|
VulkanRenderer *renderer,
|
||||||
void *deviceWindowHandle
|
void *deviceWindowHandle
|
||||||
) {
|
) {
|
||||||
VkResult vulkanResult;
|
VkResult vulkanResult;
|
||||||
VkApplicationInfo appInfo;
|
VkApplicationInfo appInfo;
|
||||||
|
@ -8968,18 +8968,18 @@ static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
appInfo.engineVersion = REFRESH_COMPILED_VERSION;
|
appInfo.engineVersion = REFRESH_COMPILED_VERSION;
|
||||||
appInfo.apiVersion = VK_MAKE_VERSION(1, 0, 0);
|
appInfo.apiVersion = VK_MAKE_VERSION(1, 0, 0);
|
||||||
|
|
||||||
if (!SDL_Vulkan_GetInstanceExtensions(
|
if (!SDL_Vulkan_GetInstanceExtensions(
|
||||||
(SDL_Window*) deviceWindowHandle,
|
(SDL_Window*) deviceWindowHandle,
|
||||||
&instanceExtensionCount,
|
&instanceExtensionCount,
|
||||||
NULL
|
NULL
|
||||||
)) {
|
)) {
|
||||||
Refresh_LogError(
|
Refresh_LogError(
|
||||||
"SDL_Vulkan_GetInstanceExtensions(): getExtensionCount: %s",
|
"SDL_Vulkan_GetInstanceExtensions(): getExtensionCount: %s",
|
||||||
SDL_GetError()
|
SDL_GetError()
|
||||||
);
|
);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extra space for the following extensions:
|
/* Extra space for the following extensions:
|
||||||
* VK_KHR_get_physical_device_properties2
|
* VK_KHR_get_physical_device_properties2
|
||||||
|
@ -9000,8 +9000,8 @@ static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
SDL_GetError()
|
SDL_GetError()
|
||||||
);
|
);
|
||||||
|
|
||||||
SDL_stack_free((char*) instanceExtensionNames);
|
SDL_stack_free((char*) instanceExtensionNames);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Core since 1.1 */
|
/* Core since 1.1 */
|
||||||
|
@ -9017,8 +9017,8 @@ static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
"Required Vulkan instance extensions not supported"
|
"Required Vulkan instance extensions not supported"
|
||||||
);
|
);
|
||||||
|
|
||||||
SDL_stack_free((char*) instanceExtensionNames);
|
SDL_stack_free((char*) instanceExtensionNames);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer->supportsDebugUtils)
|
if (renderer->supportsDebugUtils)
|
||||||
|
@ -9035,7 +9035,7 @@ static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
createInfo.pNext = NULL;
|
createInfo.pNext = NULL;
|
||||||
createInfo.flags = 0;
|
createInfo.flags = 0;
|
||||||
createInfo.pApplicationInfo = &appInfo;
|
createInfo.pApplicationInfo = &appInfo;
|
||||||
|
@ -9062,7 +9062,7 @@ static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
createInfo.enabledLayerCount = 0;
|
createInfo.enabledLayerCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
vulkanResult = vkCreateInstance(&createInfo, NULL, &renderer->instance);
|
vulkanResult = vkCreateInstance(&createInfo, NULL, &renderer->instance);
|
||||||
if (vulkanResult != VK_SUCCESS)
|
if (vulkanResult != VK_SUCCESS)
|
||||||
{
|
{
|
||||||
Refresh_LogError(
|
Refresh_LogError(
|
||||||
|
@ -9070,8 +9070,8 @@ static uint8_t VULKAN_INTERNAL_CreateInstance(
|
||||||
VkErrorMessages(vulkanResult)
|
VkErrorMessages(vulkanResult)
|
||||||
);
|
);
|
||||||
|
|
||||||
SDL_stack_free((char*) instanceExtensionNames);
|
SDL_stack_free((char*) instanceExtensionNames);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_stack_free((char*) instanceExtensionNames);
|
SDL_stack_free((char*) instanceExtensionNames);
|
||||||
|
@ -9524,8 +9524,8 @@ static Refresh_Device* VULKAN_CreateDevice(
|
||||||
VulkanRenderer *renderer = (VulkanRenderer*) SDL_malloc(sizeof(VulkanRenderer));
|
VulkanRenderer *renderer = (VulkanRenderer*) SDL_malloc(sizeof(VulkanRenderer));
|
||||||
VkSurfaceKHR surface;
|
VkSurfaceKHR surface;
|
||||||
|
|
||||||
Refresh_Device *result;
|
Refresh_Device *result;
|
||||||
VkResult vulkanResult;
|
VkResult vulkanResult;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
/* Variables: Descriptor set layouts */
|
/* Variables: Descriptor set layouts */
|
||||||
|
@ -9621,11 +9621,12 @@ static Refresh_Device* VULKAN_CreateDevice(
|
||||||
renderer->physicalDeviceDriverProperties.conformanceVersion.patch
|
renderer->physicalDeviceDriverProperties.conformanceVersion.patch
|
||||||
);
|
);
|
||||||
Refresh_LogWarn(
|
Refresh_LogWarn(
|
||||||
"\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
"\n"
|
||||||
"! Refresh Vulkan is still in development! !\n"
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
|
||||||
"! The API is unstable and subject to change! !\n"
|
"! Refresh Vulkan is still in development! !\n"
|
||||||
"! You have been warned! !\n"
|
"! The API is unstable and subject to change!\n"
|
||||||
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
"! You have been warned! !\n"
|
||||||
|
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!VULKAN_INTERNAL_CreateLogicalDevice(
|
if (!VULKAN_INTERNAL_CreateLogicalDevice(
|
||||||
|
@ -9639,9 +9640,9 @@ static Refresh_Device* VULKAN_CreateDevice(
|
||||||
|
|
||||||
/* FIXME: just move this into this function */
|
/* FIXME: just move this into this function */
|
||||||
result = (Refresh_Device*) SDL_malloc(sizeof(Refresh_Device));
|
result = (Refresh_Device*) SDL_malloc(sizeof(Refresh_Device));
|
||||||
ASSIGN_DRIVER(VULKAN)
|
ASSIGN_DRIVER(VULKAN)
|
||||||
|
|
||||||
result->driverData = (Refresh_Renderer*) renderer;
|
result->driverData = (Refresh_Renderer*) renderer;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create initial swapchain
|
* Create initial swapchain
|
||||||
|
@ -9989,12 +9990,12 @@ static Refresh_Device* VULKAN_CreateDevice(
|
||||||
renderer->transferBufferPool.availableBufferCount = 0;
|
renderer->transferBufferPool.availableBufferCount = 0;
|
||||||
renderer->transferBufferPool.availableBuffers = SDL_malloc(renderer->transferBufferPool.availableBufferCapacity * sizeof(VulkanTransferBuffer*));
|
renderer->transferBufferPool.availableBuffers = SDL_malloc(renderer->transferBufferPool.availableBufferCapacity * sizeof(VulkanTransferBuffer*));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh_Driver VulkanDriver = {
|
Refresh_Driver VulkanDriver = {
|
||||||
"Vulkan",
|
"Vulkan",
|
||||||
VULKAN_CreateDevice
|
VULKAN_CreateDevice
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //REFRESH_DRIVER_VULKAN
|
#endif //REFRESH_DRIVER_VULKAN
|
||||||
|
|
|
@ -89,53 +89,53 @@
|
||||||
static void *
|
static void *
|
||||||
SDL_SIMDRealloc(void *mem, const size_t len)
|
SDL_SIMDRealloc(void *mem, const size_t len)
|
||||||
{
|
{
|
||||||
const size_t alignment = SDL_SIMDGetAlignment();
|
const size_t alignment = SDL_SIMDGetAlignment();
|
||||||
const size_t padding = alignment - (len % alignment);
|
const size_t padding = alignment - (len % alignment);
|
||||||
const size_t padded = (padding != alignment) ? (len + padding) : len;
|
const size_t padded = (padding != alignment) ? (len + padding) : len;
|
||||||
Uint8 *retval = (Uint8*) mem;
|
Uint8 *retval = (Uint8*) mem;
|
||||||
void *oldmem = mem;
|
void *oldmem = mem;
|
||||||
size_t memdiff, ptrdiff;
|
size_t memdiff, ptrdiff;
|
||||||
Uint8 *ptr;
|
Uint8 *ptr;
|
||||||
|
|
||||||
if (mem) {
|
if (mem) {
|
||||||
void **realptr = (void **) mem;
|
void **realptr = (void **) mem;
|
||||||
realptr--;
|
realptr--;
|
||||||
mem = *(((void **) mem) - 1);
|
mem = *(((void **) mem) - 1);
|
||||||
|
|
||||||
/* Check the delta between the real pointer and user pointer */
|
/* Check the delta between the real pointer and user pointer */
|
||||||
memdiff = ((size_t) oldmem) - ((size_t) mem);
|
memdiff = ((size_t) oldmem) - ((size_t) mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = (Uint8 *) SDL_realloc(mem, padded + alignment + sizeof (void *));
|
ptr = (Uint8 *) SDL_realloc(mem, padded + alignment + sizeof (void *));
|
||||||
|
|
||||||
if (ptr == mem) {
|
if (ptr == mem) {
|
||||||
return retval; /* Pointer didn't change, nothing to do */
|
return retval; /* Pointer didn't change, nothing to do */
|
||||||
}
|
}
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
return NULL; /* Out of memory, bail! */
|
return NULL; /* Out of memory, bail! */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the actual malloc pointer right before our aligned pointer. */
|
/* Store the actual malloc pointer right before our aligned pointer. */
|
||||||
retval = ptr + sizeof (void *);
|
retval = ptr + sizeof (void *);
|
||||||
retval += alignment - (((size_t) retval) % alignment);
|
retval += alignment - (((size_t) retval) % alignment);
|
||||||
|
|
||||||
/* Make sure the delta is the same! */
|
/* Make sure the delta is the same! */
|
||||||
if (mem) {
|
if (mem) {
|
||||||
ptrdiff = ((size_t) retval) - ((size_t) ptr);
|
ptrdiff = ((size_t) retval) - ((size_t) ptr);
|
||||||
if (memdiff != ptrdiff) { /* Delta has changed, copy to new offset! */
|
if (memdiff != ptrdiff) { /* Delta has changed, copy to new offset! */
|
||||||
oldmem = (void*) (((size_t) ptr) + memdiff);
|
oldmem = (void*) (((size_t) ptr) + memdiff);
|
||||||
|
|
||||||
/* Even though the data past the old `len` is undefined, this is the
|
/* Even though the data past the old `len` is undefined, this is the
|
||||||
* only length value we have, and it guarantees that we copy all the
|
* only length value we have, and it guarantees that we copy all the
|
||||||
* previous memory anyhow.
|
* previous memory anyhow.
|
||||||
*/
|
*/
|
||||||
SDL_memmove(retval, oldmem, len);
|
SDL_memmove(retval, oldmem, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually store the malloc pointer, finally. */
|
/* Actually store the malloc pointer, finally. */
|
||||||
*(((void **) retval) - 1) = ptr;
|
*(((void **) retval) - 1) = ptr;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -190,28 +190,28 @@ 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,
|
||||||
int32_t *numChannels
|
int32_t *numChannels
|
||||||
) {
|
) {
|
||||||
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,
|
||||||
uint8_t *data
|
uint8_t *data
|
||||||
) {
|
) {
|
||||||
stbi_write_png(filename, w, h, 4, data, w * 4);
|
stbi_write_png(filename, w, h, 4, data, w * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */
|
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */
|
||||||
|
|
Loading…
Reference in New Issue