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
|
||||
{
|
||||
REFRESH_PRIMITIVETYPE_POINTLIST,
|
||||
REFRESH_PRIMITIVETYPE_POINTLIST,
|
||||
REFRESH_PRIMITIVETYPE_LINELIST,
|
||||
REFRESH_PRIMITIVETYPE_LINESTRIP,
|
||||
REFRESH_PRIMITIVETYPE_TRIANGLELIST,
|
||||
|
@ -83,59 +83,59 @@ typedef enum Refresh_PrimitiveType
|
|||
|
||||
typedef enum Refresh_LoadOp
|
||||
{
|
||||
REFRESH_LOADOP_LOAD,
|
||||
REFRESH_LOADOP_CLEAR,
|
||||
REFRESH_LOADOP_DONT_CARE
|
||||
REFRESH_LOADOP_LOAD,
|
||||
REFRESH_LOADOP_CLEAR,
|
||||
REFRESH_LOADOP_DONT_CARE
|
||||
} Refresh_LoadOp;
|
||||
|
||||
typedef enum Refresh_StoreOp
|
||||
{
|
||||
REFRESH_STOREOP_STORE,
|
||||
REFRESH_STOREOP_DONT_CARE
|
||||
REFRESH_STOREOP_STORE,
|
||||
REFRESH_STOREOP_DONT_CARE
|
||||
} Refresh_StoreOp;
|
||||
|
||||
typedef enum Refresh_ClearOptionsBits
|
||||
{
|
||||
REFRESH_CLEAROPTIONS_COLOR = 0x00000001,
|
||||
REFRESH_CLEAROPTIONS_DEPTH = 0x00000002,
|
||||
REFRESH_CLEAROPTIONS_STENCIL = 0x00000004,
|
||||
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,
|
||||
REFRESH_INDEXELEMENTSIZE_32BIT
|
||||
REFRESH_INDEXELEMENTSIZE_16BIT,
|
||||
REFRESH_INDEXELEMENTSIZE_32BIT
|
||||
} Refresh_IndexElementSize;
|
||||
|
||||
typedef enum Refresh_TextureFormat
|
||||
{
|
||||
/* Color Formats */
|
||||
REFRESH_TEXTUREFORMAT_R8G8B8A8,
|
||||
REFRESH_TEXTUREFORMAT_R5G6B5,
|
||||
REFRESH_TEXTUREFORMAT_A1R5G5B5,
|
||||
REFRESH_TEXTUREFORMAT_B4G4R4A4,
|
||||
REFRESH_TEXTUREFORMAT_BC1,
|
||||
REFRESH_TEXTUREFORMAT_BC2,
|
||||
REFRESH_TEXTUREFORMAT_BC3,
|
||||
REFRESH_TEXTUREFORMAT_R8G8_SNORM,
|
||||
REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM,
|
||||
REFRESH_TEXTUREFORMAT_A2R10G10B10,
|
||||
REFRESH_TEXTUREFORMAT_R16G16,
|
||||
REFRESH_TEXTUREFORMAT_R16G16B16A16,
|
||||
REFRESH_TEXTUREFORMAT_R8,
|
||||
REFRESH_TEXTUREFORMAT_R32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R32G32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R16_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R16G16_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R8G8B8A8,
|
||||
REFRESH_TEXTUREFORMAT_R5G6B5,
|
||||
REFRESH_TEXTUREFORMAT_A1R5G5B5,
|
||||
REFRESH_TEXTUREFORMAT_B4G4R4A4,
|
||||
REFRESH_TEXTUREFORMAT_BC1,
|
||||
REFRESH_TEXTUREFORMAT_BC2,
|
||||
REFRESH_TEXTUREFORMAT_BC3,
|
||||
REFRESH_TEXTUREFORMAT_R8G8_SNORM,
|
||||
REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM,
|
||||
REFRESH_TEXTUREFORMAT_A2R10G10B10,
|
||||
REFRESH_TEXTUREFORMAT_R16G16,
|
||||
REFRESH_TEXTUREFORMAT_R16G16B16A16,
|
||||
REFRESH_TEXTUREFORMAT_R8,
|
||||
REFRESH_TEXTUREFORMAT_R32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R32G32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R16_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R16G16_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT,
|
||||
/* Depth Formats */
|
||||
REFRESH_TEXTUREFORMAT_D16_UNORM,
|
||||
REFRESH_TEXTUREFORMAT_D32_SFLOAT,
|
||||
REFRESH_TEXTUREFORMAT_D16_UNORM_S8_UINT,
|
||||
REFRESH_TEXTUREFORMAT_D32_SFLOAT_S8_UINT
|
||||
REFRESH_TEXTUREFORMAT_D16_UNORM_S8_UINT,
|
||||
REFRESH_TEXTUREFORMAT_D32_SFLOAT_S8_UINT
|
||||
} Refresh_TextureFormat;
|
||||
|
||||
typedef enum Refresh_TextureUsageFlagBits
|
||||
|
@ -160,12 +160,12 @@ typedef enum Refresh_SampleCount
|
|||
|
||||
typedef enum Refresh_CubeMapFace
|
||||
{
|
||||
REFRESH_CUBEMAPFACE_POSITIVEX,
|
||||
REFRESH_CUBEMAPFACE_NEGATIVEX,
|
||||
REFRESH_CUBEMAPFACE_POSITIVEY,
|
||||
REFRESH_CUBEMAPFACE_NEGATIVEY,
|
||||
REFRESH_CUBEMAPFACE_POSITIVEZ,
|
||||
REFRESH_CUBEMAPFACE_NEGATIVEZ
|
||||
REFRESH_CUBEMAPFACE_POSITIVEX,
|
||||
REFRESH_CUBEMAPFACE_NEGATIVEX,
|
||||
REFRESH_CUBEMAPFACE_POSITIVEY,
|
||||
REFRESH_CUBEMAPFACE_NEGATIVEY,
|
||||
REFRESH_CUBEMAPFACE_POSITIVEZ,
|
||||
REFRESH_CUBEMAPFACE_NEGATIVEZ
|
||||
} Refresh_CubeMapFace;
|
||||
|
||||
typedef enum Refresh_BufferUsageFlagBits
|
||||
|
@ -256,52 +256,52 @@ typedef enum Refresh_BlendOp
|
|||
typedef enum Refresh_LogicOp
|
||||
{
|
||||
REFRESH_LOGICOP_CLEAR = 0,
|
||||
REFRESH_LOGICOP_AND = 1,
|
||||
REFRESH_LOGICOP_AND_REVERSE = 2,
|
||||
REFRESH_LOGICOP_COPY = 3,
|
||||
REFRESH_LOGICOP_AND_INVERTED = 4,
|
||||
REFRESH_LOGICOP_NO_OP = 5,
|
||||
REFRESH_LOGICOP_XOR = 6,
|
||||
REFRESH_LOGICOP_OR = 7,
|
||||
REFRESH_LOGICOP_NOR = 8,
|
||||
REFRESH_LOGICOP_EQUIVALENT = 9,
|
||||
REFRESH_LOGICOP_INVERT = 10,
|
||||
REFRESH_LOGICOP_OR_REVERSE = 11,
|
||||
REFRESH_LOGICOP_COPY_INVERTED = 12,
|
||||
REFRESH_LOGICOP_OR_INVERTED = 13,
|
||||
REFRESH_LOGICOP_NAND = 14,
|
||||
REFRESH_LOGICOP_SET = 15
|
||||
REFRESH_LOGICOP_AND = 1,
|
||||
REFRESH_LOGICOP_AND_REVERSE = 2,
|
||||
REFRESH_LOGICOP_COPY = 3,
|
||||
REFRESH_LOGICOP_AND_INVERTED = 4,
|
||||
REFRESH_LOGICOP_NO_OP = 5,
|
||||
REFRESH_LOGICOP_XOR = 6,
|
||||
REFRESH_LOGICOP_OR = 7,
|
||||
REFRESH_LOGICOP_NOR = 8,
|
||||
REFRESH_LOGICOP_EQUIVALENT = 9,
|
||||
REFRESH_LOGICOP_INVERT = 10,
|
||||
REFRESH_LOGICOP_OR_REVERSE = 11,
|
||||
REFRESH_LOGICOP_COPY_INVERTED = 12,
|
||||
REFRESH_LOGICOP_OR_INVERTED = 13,
|
||||
REFRESH_LOGICOP_NAND = 14,
|
||||
REFRESH_LOGICOP_SET = 15
|
||||
} Refresh_LogicOp;
|
||||
|
||||
typedef enum Refresh_BlendFactor
|
||||
{
|
||||
REFRESH_BLENDFACTOR_ZERO = 0,
|
||||
REFRESH_BLENDFACTOR_ONE = 1,
|
||||
REFRESH_BLENDFACTOR_SRC_COLOR = 2,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 3,
|
||||
REFRESH_BLENDFACTOR_DST_COLOR = 4,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_DST_COLOR = 5,
|
||||
REFRESH_BLENDFACTOR_SRC_ALPHA = 6,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 7,
|
||||
REFRESH_BLENDFACTOR_DST_ALPHA = 8,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 9,
|
||||
REFRESH_BLENDFACTOR_CONSTANT_COLOR = 10,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR = 11,
|
||||
REFRESH_BLENDFACTOR_CONSTANT_ALPHA = 12,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_ALPHA = 13,
|
||||
REFRESH_BLENDFACTOR_SRC_ALPHA_SATURATE = 14,
|
||||
REFRESH_BLENDFACTOR_SRC1_COLOR = 15,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_COLOR = 16,
|
||||
REFRESH_BLENDFACTOR_SRC1_ALPHA = 17,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_ALPHA = 18
|
||||
REFRESH_BLENDFACTOR_ZERO = 0,
|
||||
REFRESH_BLENDFACTOR_ONE = 1,
|
||||
REFRESH_BLENDFACTOR_SRC_COLOR = 2,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 3,
|
||||
REFRESH_BLENDFACTOR_DST_COLOR = 4,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_DST_COLOR = 5,
|
||||
REFRESH_BLENDFACTOR_SRC_ALPHA = 6,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 7,
|
||||
REFRESH_BLENDFACTOR_DST_ALPHA = 8,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 9,
|
||||
REFRESH_BLENDFACTOR_CONSTANT_COLOR = 10,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR = 11,
|
||||
REFRESH_BLENDFACTOR_CONSTANT_ALPHA = 12,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_CONSTANT_ALPHA = 13,
|
||||
REFRESH_BLENDFACTOR_SRC_ALPHA_SATURATE = 14,
|
||||
REFRESH_BLENDFACTOR_SRC1_COLOR = 15,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_COLOR = 16,
|
||||
REFRESH_BLENDFACTOR_SRC1_ALPHA = 17,
|
||||
REFRESH_BLENDFACTOR_ONE_MINUS_SRC1_ALPHA = 18
|
||||
} Refresh_BlendFactor;
|
||||
|
||||
typedef enum Refresh_ColorComponentFlagBits
|
||||
{
|
||||
REFRESH_COLORCOMPONENT_R_BIT = 0x00000001,
|
||||
REFRESH_COLORCOMPONENT_G_BIT = 0x00000002,
|
||||
REFRESH_COLORCOMPONENT_B_BIT = 0x00000004,
|
||||
REFRESH_COLORCOMPONENT_A_BIT = 0x00000008
|
||||
REFRESH_COLORCOMPONENT_R_BIT = 0x00000001,
|
||||
REFRESH_COLORCOMPONENT_G_BIT = 0x00000002,
|
||||
REFRESH_COLORCOMPONENT_B_BIT = 0x00000004,
|
||||
REFRESH_COLORCOMPONENT_A_BIT = 0x00000008
|
||||
} Refresh_ColorComponentFlagBits;
|
||||
|
||||
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 */
|
||||
typedef enum Refresh_BorderColor
|
||||
{
|
||||
REFRESH_BORDERCOLOR_FLOAT_TRANSPARENT_BLACK = 0,
|
||||
REFRESH_BORDERCOLOR_INT_TRANSPARENT_BLACK = 1,
|
||||
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_BLACK = 2,
|
||||
REFRESH_BORDERCOLOR_INT_OPAQUE_BLACK = 3,
|
||||
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_WHITE = 4,
|
||||
REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE = 5
|
||||
REFRESH_BORDERCOLOR_FLOAT_TRANSPARENT_BLACK = 0,
|
||||
REFRESH_BORDERCOLOR_INT_TRANSPARENT_BLACK = 1,
|
||||
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_BLACK = 2,
|
||||
REFRESH_BORDERCOLOR_INT_OPAQUE_BLACK = 3,
|
||||
REFRESH_BORDERCOLOR_FLOAT_OPAQUE_WHITE = 4,
|
||||
REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE = 5
|
||||
} Refresh_BorderColor;
|
||||
|
||||
/* Structures */
|
||||
|
|
|
@ -54,10 +54,10 @@ extern "C" {
|
|||
* Be sure to free the memory with Refresh_Image_Free after use!
|
||||
*/
|
||||
REFRESHAPI uint8_t* Refresh_Image_Load(
|
||||
char const *filename,
|
||||
char const *filename,
|
||||
int32_t *w,
|
||||
int32_t *h,
|
||||
int32_t *numChannels
|
||||
int32_t *numChannels
|
||||
);
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
REFRESHAPI void Refresh_Image_SavePNG(
|
||||
char const *filename,
|
||||
int32_t w,
|
||||
int32_t h,
|
||||
char const *filename,
|
||||
int32_t w,
|
||||
int32_t h,
|
||||
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_TOTAL_SAMPLERS (MAX_TEXTURE_SAMPLERS + MAX_VERTEXTEXTURE_SAMPLERS)
|
||||
|
||||
#define MAX_BUFFER_BINDINGS 16
|
||||
#define MAX_BUFFER_BINDINGS 16
|
||||
|
||||
#define MAX_COLOR_TARGET_BINDINGS 4
|
||||
|
||||
|
@ -168,309 +168,309 @@ 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
|
||||
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,
|
||||
uint32_t baseVertex,
|
||||
uint32_t startIndex,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t instanceCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t baseVertex,
|
||||
uint32_t startIndex,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t instanceCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DrawIndexedPrimitives)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t baseVertex,
|
||||
uint32_t startIndex,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t baseVertex,
|
||||
uint32_t startIndex,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DrawPrimitives)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t vertexStart,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t vertexStart,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DispatchCompute)(
|
||||
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,
|
||||
void (*DispatchCompute)(
|
||||
Refresh_Renderer *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture *texture
|
||||
);
|
||||
uint32_t groupCountX,
|
||||
uint32_t groupCountY,
|
||||
uint32_t groupCountZ,
|
||||
uint32_t computeParamOffset
|
||||
);
|
||||
|
||||
void(*QueueDestroySampler)(
|
||||
Refresh_Renderer *driverData,
|
||||
/* 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_Sampler *sampler
|
||||
);
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
void(*QueueDestroyBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
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_Buffer *buffer
|
||||
);
|
||||
Refresh_TextureSlice *sourceTextureSlice,
|
||||
Refresh_TextureSlice *destinationTextureSlice,
|
||||
Refresh_Filter filter
|
||||
);
|
||||
|
||||
void(*QueueDestroyRenderTarget)(
|
||||
Refresh_Renderer *driverData,
|
||||
void(*CopyTextureToBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_RenderTarget *renderTarget
|
||||
);
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_Buffer *buffer
|
||||
);
|
||||
|
||||
void(*QueueDestroyShaderModule)(
|
||||
Refresh_Renderer *driverData,
|
||||
void(*SetBufferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ShaderModule *shaderModule
|
||||
);
|
||||
Refresh_Buffer *buffer,
|
||||
uint32_t offsetInBytes,
|
||||
void* data,
|
||||
uint32_t dataLength
|
||||
);
|
||||
|
||||
void(*QueueDestroyComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint32_t(*PushVertexShaderUniforms)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
void(*QueueDestroyGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint32_t(*PushFragmentShaderUniforms)(
|
||||
Refresh_Renderer *driverData,
|
||||
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)(
|
||||
Refresh_Renderer *driverData,
|
||||
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_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_Rect *renderArea,
|
||||
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
||||
uint32_t colorAttachmentCount,
|
||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||
);
|
||||
);
|
||||
|
||||
void(*EndRenderPass)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
void(*EndRenderPass)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
void(*BindGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GraphicsPipeline *graphicsPipeline
|
||||
);
|
||||
void(*BindGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GraphicsPipeline *graphicsPipeline
|
||||
);
|
||||
|
||||
void(*BindVertexBuffers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t firstBinding,
|
||||
uint32_t bindingCount,
|
||||
Refresh_Buffer **pBuffers,
|
||||
uint64_t *pOffsets
|
||||
);
|
||||
void(*BindVertexBuffers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t firstBinding,
|
||||
uint32_t bindingCount,
|
||||
Refresh_Buffer **pBuffers,
|
||||
uint64_t *pOffsets
|
||||
);
|
||||
|
||||
void(*BindIndexBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
uint64_t offset,
|
||||
Refresh_IndexElementSize indexElementSize
|
||||
);
|
||||
void(*BindIndexBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
uint64_t offset,
|
||||
Refresh_IndexElementSize indexElementSize
|
||||
);
|
||||
|
||||
void(*BindComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
void(*BindComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
|
||||
void(*BindComputeBuffers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer **pBuffers
|
||||
);
|
||||
void(*BindComputeBuffers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer **pBuffers
|
||||
);
|
||||
|
||||
void(*BindComputeTextures)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture **pTextures
|
||||
);
|
||||
void(*BindComputeTextures)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture **pTextures
|
||||
);
|
||||
|
||||
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint8_t fixed
|
||||
);
|
||||
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint8_t fixed
|
||||
);
|
||||
|
||||
void(*QueuePresent)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_Rect *destinationRectangle,
|
||||
Refresh_Filter filter,
|
||||
void(*QueuePresent)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_Rect *destinationRectangle,
|
||||
Refresh_Filter filter,
|
||||
void *windowHandle
|
||||
);
|
||||
);
|
||||
|
||||
void(*Submit)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint32_t commandBufferCount,
|
||||
Refresh_CommandBuffer **pCommandBuffers
|
||||
);
|
||||
void(*Submit)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint32_t commandBufferCount,
|
||||
Refresh_CommandBuffer **pCommandBuffers
|
||||
);
|
||||
|
||||
void(*Wait)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
void(*Wait)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
|
||||
/* Opaque pointer for the Driver */
|
||||
Refresh_Renderer *driverData;
|
||||
|
@ -484,51 +484,51 @@ struct Refresh_Device
|
|||
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateRenderTarget, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureData, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyRenderTarget, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
|
||||
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
|
||||
ASSIGN_DRIVER_FUNC(Submit, name) \
|
||||
ASSIGN_DRIVER_FUNC(Wait, name)
|
||||
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateRenderTarget, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureData, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyRenderTarget, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
|
||||
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
|
||||
ASSIGN_DRIVER_FUNC(Submit, name) \
|
||||
ASSIGN_DRIVER_FUNC(Wait, name)
|
||||
|
||||
typedef struct Refresh_Driver
|
||||
{
|
||||
const char *Name;
|
||||
Refresh_Device* (*CreateDevice)(
|
||||
Refresh_PresentationParameters *presentationParameters,
|
||||
uint8_t debugMode
|
||||
uint8_t debugMode
|
||||
);
|
||||
} Refresh_Driver;
|
||||
|
||||
|
|
|
@ -92,29 +92,29 @@ static uint32_t deviceExtensionCount = SDL_arraysize(deviceExtensionNames);
|
|||
#define NULL_RENDER_PASS (Refresh_RenderPass*) 0
|
||||
|
||||
#define EXPAND_ELEMENTS_IF_NEEDED(arr, initialValue, type) \
|
||||
if (arr->count == arr->capacity) \
|
||||
{ \
|
||||
if (arr->capacity == 0) \
|
||||
{ \
|
||||
arr->capacity = initialValue; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
arr->capacity *= 2; \
|
||||
} \
|
||||
arr->elements = (type*) SDL_realloc( \
|
||||
arr->elements, \
|
||||
arr->capacity * sizeof(type) \
|
||||
); \
|
||||
if (arr->count == arr->capacity) \
|
||||
{ \
|
||||
if (arr->capacity == 0) \
|
||||
{ \
|
||||
arr->capacity = initialValue; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
arr->capacity *= 2; \
|
||||
} \
|
||||
arr->elements = (type*) SDL_realloc( \
|
||||
arr->elements, \
|
||||
arr->capacity * sizeof(type) \
|
||||
); \
|
||||
}
|
||||
|
||||
#define EXPAND_ARRAY_IF_NEEDED(arr, elementType, newCount, capacity, newCapacity) \
|
||||
if (newCount >= capacity) \
|
||||
{ \
|
||||
capacity = newCapacity; \
|
||||
arr = (elementType*) SDL_realloc( \
|
||||
arr = (elementType*) SDL_realloc( \
|
||||
arr, \
|
||||
sizeof(elementType) * capacity \
|
||||
sizeof(elementType) * capacity \
|
||||
); \
|
||||
}
|
||||
|
||||
|
@ -189,24 +189,24 @@ static const uint8_t DEVICE_PRIORITY[] =
|
|||
|
||||
static VkFormat RefreshToVK_SurfaceFormat[] =
|
||||
{
|
||||
VK_FORMAT_R8G8B8A8_UNORM, /* R8G8B8A8 */
|
||||
VK_FORMAT_R8G8B8A8_UNORM, /* R8G8B8A8 */
|
||||
VK_FORMAT_R5G6B5_UNORM_PACK16, /* R5G6B5 */
|
||||
VK_FORMAT_A1R5G5B5_UNORM_PACK16, /* A1R5G5B5 */
|
||||
VK_FORMAT_B4G4R4A4_UNORM_PACK16, /* B4G4R4A4 */
|
||||
VK_FORMAT_BC1_RGBA_UNORM_BLOCK, /* BC1 */
|
||||
VK_FORMAT_BC2_UNORM_BLOCK, /* BC3 */
|
||||
VK_FORMAT_BC3_UNORM_BLOCK, /* BC5 */
|
||||
VK_FORMAT_R8G8_SNORM, /* R8G8_SNORM */
|
||||
VK_FORMAT_R8G8B8A8_SNORM, /* R8G8B8A8_SNORM */
|
||||
VK_FORMAT_BC2_UNORM_BLOCK, /* BC3 */
|
||||
VK_FORMAT_BC3_UNORM_BLOCK, /* BC5 */
|
||||
VK_FORMAT_R8G8_SNORM, /* R8G8_SNORM */
|
||||
VK_FORMAT_R8G8B8A8_SNORM, /* R8G8B8A8_SNORM */
|
||||
VK_FORMAT_A2R10G10B10_UNORM_PACK32, /* A2R10G10B10 */
|
||||
VK_FORMAT_R16G16_UNORM, /* R16G16 */
|
||||
VK_FORMAT_R16G16_UNORM, /* R16G16 */
|
||||
VK_FORMAT_R16G16B16A16_UNORM, /* R16G16B16A16 */
|
||||
VK_FORMAT_R8_UNORM, /* R8 */
|
||||
VK_FORMAT_R32_SFLOAT, /* R32_SFLOAT */
|
||||
VK_FORMAT_R32G32_SFLOAT, /* R32G32_SFLOAT */
|
||||
VK_FORMAT_R8_UNORM, /* R8 */
|
||||
VK_FORMAT_R32_SFLOAT, /* R32_SFLOAT */
|
||||
VK_FORMAT_R32G32_SFLOAT, /* R32G32_SFLOAT */
|
||||
VK_FORMAT_R32G32B32A32_SFLOAT, /* R32G32B32A32_SFLOAT */
|
||||
VK_FORMAT_R16_SFLOAT, /* R16_SFLOAT */
|
||||
VK_FORMAT_R16G16_SFLOAT, /* R16G16_SFLOAT */
|
||||
VK_FORMAT_R16_SFLOAT, /* R16_SFLOAT */
|
||||
VK_FORMAT_R16G16_SFLOAT, /* R16G16_SFLOAT */
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT, /* R16G16B16A16_SFLOAT */
|
||||
VK_FORMAT_D16_UNORM, /* D16 */
|
||||
VK_FORMAT_D32_SFLOAT, /* D32 */
|
||||
|
@ -344,26 +344,26 @@ static VkStencilOp RefreshToVK_StencilOp[] =
|
|||
|
||||
static VkAttachmentLoadOp RefreshToVK_LoadOp[] =
|
||||
{
|
||||
VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE
|
||||
VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||
VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE
|
||||
};
|
||||
|
||||
static VkAttachmentStoreOp RefreshToVK_StoreOp[] =
|
||||
{
|
||||
VK_ATTACHMENT_STORE_OP_STORE,
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE
|
||||
VK_ATTACHMENT_STORE_OP_STORE,
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE
|
||||
};
|
||||
|
||||
static VkSampleCountFlagBits RefreshToVK_SampleCount[] =
|
||||
{
|
||||
VK_SAMPLE_COUNT_1_BIT,
|
||||
VK_SAMPLE_COUNT_2_BIT,
|
||||
VK_SAMPLE_COUNT_4_BIT,
|
||||
VK_SAMPLE_COUNT_8_BIT,
|
||||
VK_SAMPLE_COUNT_16_BIT,
|
||||
VK_SAMPLE_COUNT_32_BIT,
|
||||
VK_SAMPLE_COUNT_64_BIT
|
||||
VK_SAMPLE_COUNT_1_BIT,
|
||||
VK_SAMPLE_COUNT_2_BIT,
|
||||
VK_SAMPLE_COUNT_4_BIT,
|
||||
VK_SAMPLE_COUNT_8_BIT,
|
||||
VK_SAMPLE_COUNT_16_BIT,
|
||||
VK_SAMPLE_COUNT_32_BIT,
|
||||
VK_SAMPLE_COUNT_64_BIT
|
||||
};
|
||||
|
||||
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 */
|
||||
{ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
VK_ACCESS_SHADER_READ_BIT,
|
||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
||||
{ VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
VK_ACCESS_SHADER_READ_BIT,
|
||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
|
||||
},
|
||||
|
||||
/* RESOURCE_ACCESS_COMPUTE_SHADER_READ_OTHER */
|
||||
|
@ -876,9 +876,9 @@ static inline VkDescriptorSetLayout DescriptorSetLayoutHashTable_Fetch(
|
|||
for (i = 0; i < arr->count; i += 1)
|
||||
{
|
||||
const DescriptorSetLayoutHash *e = &arr->elements[i].key;
|
||||
if ( key.descriptorType == e->descriptorType &&
|
||||
if ( key.descriptorType == e->descriptorType &&
|
||||
key.bindingCount == e->bindingCount &&
|
||||
key.stageFlag == e->stageFlag )
|
||||
key.stageFlag == e->stageFlag )
|
||||
{
|
||||
return arr->elements[i].value;
|
||||
}
|
||||
|
@ -1499,14 +1499,14 @@ static inline void CommandPoolHashTable_Insert(
|
|||
|
||||
typedef struct VulkanRenderer
|
||||
{
|
||||
VkInstance instance;
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkPhysicalDeviceProperties2 physicalDeviceProperties;
|
||||
VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
|
||||
VkDevice logicalDevice;
|
||||
VkInstance instance;
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkPhysicalDeviceProperties2 physicalDeviceProperties;
|
||||
VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
|
||||
VkDevice logicalDevice;
|
||||
|
||||
uint8_t supportsDebugUtils;
|
||||
uint8_t debugMode;
|
||||
uint8_t supportsDebugUtils;
|
||||
uint8_t debugMode;
|
||||
|
||||
VulkanMemoryAllocator *memoryAllocator;
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||
|
@ -1515,7 +1515,7 @@ typedef struct VulkanRenderer
|
|||
uint32_t swapchainDataCount;
|
||||
uint32_t swapchainDataCapacity;
|
||||
|
||||
QueueFamilyIndices queueFamilyIndices;
|
||||
QueueFamilyIndices queueFamilyIndices;
|
||||
VkQueue graphicsQueue;
|
||||
VkQueue presentQueue;
|
||||
VkQueue computeQueue;
|
||||
|
@ -1572,7 +1572,7 @@ typedef struct VulkanRenderer
|
|||
SDL_mutex *renderPassFetchLock;
|
||||
SDL_mutex *framebufferFetchLock;
|
||||
|
||||
#define VULKAN_INSTANCE_FUNCTION(ext, ret, func, params) \
|
||||
#define VULKAN_INSTANCE_FUNCTION(ext, ret, func, params) \
|
||||
vkfntype_##func func;
|
||||
#define VULKAN_DEVICE_FUNCTION(ext, ret, func, params) \
|
||||
vkfntype_##func func;
|
||||
|
@ -3706,22 +3706,22 @@ static uint8_t VULKAN_INTERNAL_ChooseSwapPresentMode(
|
|||
Refresh_LogInfo(#m " unsupported.");
|
||||
|
||||
uint32_t i;
|
||||
if (desiredPresentInterval == REFRESH_PRESENTMODE_IMMEDIATE)
|
||||
if (desiredPresentInterval == REFRESH_PRESENTMODE_IMMEDIATE)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_IMMEDIATE_KHR)
|
||||
}
|
||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_MAILBOX)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_MAILBOX_KHR)
|
||||
}
|
||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_FIFO_KHR)
|
||||
}
|
||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO_RELAXED)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_FIFO_RELAXED_KHR)
|
||||
}
|
||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_MAILBOX)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_MAILBOX_KHR)
|
||||
}
|
||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_FIFO_KHR)
|
||||
}
|
||||
else if (desiredPresentInterval == REFRESH_PRESENTMODE_FIFO_RELAXED)
|
||||
{
|
||||
CHECK_MODE(VK_PRESENT_MODE_FIFO_RELAXED_KHR)
|
||||
}
|
||||
else
|
||||
{
|
||||
Refresh_LogError(
|
||||
|
@ -4203,7 +4203,7 @@ static void VULKAN_INTERNAL_EndCommandBuffer(
|
|||
}
|
||||
|
||||
static void VULKAN_DestroyDevice(
|
||||
Refresh_Device *device
|
||||
Refresh_Device *device
|
||||
) {
|
||||
VulkanRenderer* renderer = (VulkanRenderer*) device->driverData;
|
||||
CommandPoolHashArray commandPoolHashArray;
|
||||
|
@ -4724,165 +4724,165 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|||
uint32_t colorAttachmentCount,
|
||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||
) {
|
||||
VkResult vulkanResult;
|
||||
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
||||
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
||||
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
||||
VkAttachmentReference depthStencilAttachmentReference;
|
||||
VkResult vulkanResult;
|
||||
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
||||
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
||||
VkAttachmentReference resolveReferences[MAX_COLOR_TARGET_BINDINGS + 1];
|
||||
VkAttachmentReference depthStencilAttachmentReference;
|
||||
VkRenderPassCreateInfo renderPassCreateInfo;
|
||||
VkSubpassDescription subpass;
|
||||
VkRenderPass renderPass;
|
||||
uint32_t i;
|
||||
VkSubpassDescription subpass;
|
||||
VkRenderPass renderPass;
|
||||
uint32_t i;
|
||||
uint8_t multisampling = 0;
|
||||
|
||||
uint32_t attachmentDescriptionCount = 0;
|
||||
uint32_t colorAttachmentReferenceCount = 0;
|
||||
uint32_t resolveReferenceCount = 0;
|
||||
uint32_t attachmentDescriptionCount = 0;
|
||||
uint32_t colorAttachmentReferenceCount = 0;
|
||||
uint32_t resolveReferenceCount = 0;
|
||||
|
||||
VulkanRenderTarget *colorTarget;
|
||||
VulkanRenderTarget *depthStencilTarget;
|
||||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
colorTarget = (VulkanRenderTarget*) colorAttachmentInfos[attachmentDescriptionCount].pRenderTarget;
|
||||
|
||||
if (colorTarget->multisampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||
{
|
||||
if (colorTarget->multisampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||
{
|
||||
multisampling = 1;
|
||||
|
||||
/* Resolve attachment and multisample attachment */
|
||||
/* Resolve attachment and multisample attachment */
|
||||
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||
VK_SAMPLE_COUNT_1_BIT;
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
colorAttachmentInfos[i].loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
colorAttachmentInfos[i].storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||
VK_SAMPLE_COUNT_1_BIT;
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
colorAttachmentInfos[i].loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
colorAttachmentInfos[i].storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
resolveReferences[resolveReferenceCount].attachment =
|
||||
attachmentDescriptionCount;
|
||||
resolveReferences[resolveReferenceCount].layout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
resolveReferences[resolveReferenceCount].attachment =
|
||||
attachmentDescriptionCount;
|
||||
resolveReferences[resolveReferenceCount].layout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentDescriptionCount += 1;
|
||||
resolveReferenceCount += 1;
|
||||
attachmentDescriptionCount += 1;
|
||||
resolveReferenceCount += 1;
|
||||
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples = colorTarget->multisampleCount;
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
colorAttachmentInfos[i].loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
colorAttachmentInfos[i].storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples = colorTarget->multisampleCount;
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
colorAttachmentInfos[i].loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
colorAttachmentInfos[i].storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment =
|
||||
attachmentDescriptionCount;
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment =
|
||||
attachmentDescriptionCount;
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentDescriptionCount += 1;
|
||||
colorAttachmentReferenceCount += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||
VK_SAMPLE_COUNT_1_BIT;
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
colorAttachmentInfos[i].loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
colorAttachmentInfos[i].storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptionCount += 1;
|
||||
colorAttachmentReferenceCount += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = colorTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||
VK_SAMPLE_COUNT_1_BIT;
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
colorAttachmentInfos[i].loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
colorAttachmentInfos[i].storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
||||
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
||||
VK_ATTACHMENT_STORE_OP_DONT_CARE;
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].attachment = attachmentDescriptionCount;
|
||||
colorAttachmentReferences[colorAttachmentReferenceCount].layout =
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentDescriptionCount += 1;
|
||||
colorAttachmentReferenceCount += 1;
|
||||
}
|
||||
}
|
||||
attachmentDescriptionCount += 1;
|
||||
colorAttachmentReferenceCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||
subpass.flags = 0;
|
||||
subpass.inputAttachmentCount = 0;
|
||||
subpass.pInputAttachments = NULL;
|
||||
subpass.colorAttachmentCount = colorAttachmentCount;
|
||||
subpass.pColorAttachments = colorAttachmentReferences;
|
||||
subpass.preserveAttachmentCount = 0;
|
||||
subpass.pPreserveAttachments = NULL;
|
||||
subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||
subpass.flags = 0;
|
||||
subpass.inputAttachmentCount = 0;
|
||||
subpass.pInputAttachments = NULL;
|
||||
subpass.colorAttachmentCount = colorAttachmentCount;
|
||||
subpass.pColorAttachments = colorAttachmentReferences;
|
||||
subpass.preserveAttachmentCount = 0;
|
||||
subpass.pPreserveAttachments = NULL;
|
||||
|
||||
if (depthStencilAttachmentInfo == NULL)
|
||||
{
|
||||
subpass.pDepthStencilAttachment = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (depthStencilAttachmentInfo == NULL)
|
||||
{
|
||||
subpass.pDepthStencilAttachment = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
depthStencilTarget = (VulkanRenderTarget*) depthStencilAttachmentInfo->pDepthStencilTarget;
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = depthStencilTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||
VK_SAMPLE_COUNT_1_BIT; /* FIXME: do these take multisamples? */
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
depthStencilAttachmentInfo->loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
depthStencilAttachmentInfo->storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = RefreshToVK_LoadOp[
|
||||
depthStencilAttachmentInfo->stencilLoadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = RefreshToVK_StoreOp[
|
||||
depthStencilAttachmentInfo->stencilStoreOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = depthStencilTarget->texture->format;
|
||||
attachmentDescriptions[attachmentDescriptionCount].samples =
|
||||
VK_SAMPLE_COUNT_1_BIT; /* FIXME: do these take multisamples? */
|
||||
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
||||
depthStencilAttachmentInfo->loadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
||||
depthStencilAttachmentInfo->storeOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = RefreshToVK_LoadOp[
|
||||
depthStencilAttachmentInfo->stencilLoadOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp = RefreshToVK_StoreOp[
|
||||
depthStencilAttachmentInfo->stencilStoreOp
|
||||
];
|
||||
attachmentDescriptions[attachmentDescriptionCount].initialLayout =
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
attachmentDescriptions[attachmentDescriptionCount].finalLayout =
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
|
||||
depthStencilAttachmentReference.attachment =
|
||||
attachmentDescriptionCount;
|
||||
depthStencilAttachmentReference.layout =
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
depthStencilAttachmentReference.attachment =
|
||||
attachmentDescriptionCount;
|
||||
depthStencilAttachmentReference.layout =
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
|
||||
subpass.pDepthStencilAttachment =
|
||||
&depthStencilAttachmentReference;
|
||||
subpass.pDepthStencilAttachment =
|
||||
&depthStencilAttachmentReference;
|
||||
|
||||
attachmentDescriptionCount += 1;
|
||||
}
|
||||
attachmentDescriptionCount += 1;
|
||||
}
|
||||
|
||||
if (multisampling)
|
||||
{
|
||||
|
@ -4893,22 +4893,22 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|||
subpass.pResolveAttachments = NULL;
|
||||
}
|
||||
|
||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||
renderPassCreateInfo.pNext = NULL;
|
||||
renderPassCreateInfo.flags = 0;
|
||||
renderPassCreateInfo.pAttachments = attachmentDescriptions;
|
||||
renderPassCreateInfo.attachmentCount = attachmentDescriptionCount;
|
||||
renderPassCreateInfo.subpassCount = 1;
|
||||
renderPassCreateInfo.pSubpasses = &subpass;
|
||||
renderPassCreateInfo.dependencyCount = 0;
|
||||
renderPassCreateInfo.pDependencies = NULL;
|
||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||
renderPassCreateInfo.pNext = NULL;
|
||||
renderPassCreateInfo.flags = 0;
|
||||
renderPassCreateInfo.pAttachments = attachmentDescriptions;
|
||||
renderPassCreateInfo.attachmentCount = attachmentDescriptionCount;
|
||||
renderPassCreateInfo.subpassCount = 1;
|
||||
renderPassCreateInfo.pSubpasses = &subpass;
|
||||
renderPassCreateInfo.dependencyCount = 0;
|
||||
renderPassCreateInfo.pDependencies = NULL;
|
||||
|