Refresh/src/Refresh_Driver.h

647 lines
18 KiB
C
Raw Normal View History

2020-12-17 00:27:14 +00:00
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
*
* Copyright (c) 2020 Evan Hemsley
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software in a
* product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source distribution.
*
* Evan "cosmonaut" Hemsley <evan@moonside.games>
*
*/
#ifndef REFRESH_DRIVER_H
#define REFRESH_DRIVER_H
#include "Refresh.h"
/* Windows/Visual Studio cruft */
#ifdef _WIN32
#define inline __inline
#endif
2020-12-17 02:38:22 +00:00
/* Logging */
extern void REFRESH_LogInfo(const char *fmt, ...);
extern void REFRESH_LogWarn(const char *fmt, ...);
extern void REFRESH_LogError(const char *fmt, ...);
2020-12-17 00:27:14 +00:00
/* Internal Helper Utilities */
static inline uint32_t Texture_GetFormatSize(
REFRESH_SurfaceFormat format
) {
switch (format)
{
case REFRESH_SURFACEFORMAT_BC1:
return 8;
case REFRESH_SURFACEFORMAT_BC2:
case REFRESH_SURFACEFORMAT_BC3:
return 16;
case REFRESH_SURFACEFORMAT_R8:
return 1;
case REFRESH_SURFACEFORMAT_R5G6B5:
case REFRESH_SURFACEFORMAT_B4G4R4A4:
case REFRESH_SURFACEFORMAT_A1R5G5B5:
case REFRESH_SURFACEFORMAT_R16_SFLOAT:
case REFRESH_SURFACEFORMAT_R8G8_SNORM:
return 2;
case REFRESH_SURFACEFORMAT_R8G8B8A8:
case REFRESH_SURFACEFORMAT_R32_SFLOAT:
case REFRESH_SURFACEFORMAT_R16G16_SFLOAT:
case REFRESH_SURFACEFORMAT_R8G8B8A8_SNORM:
case REFRESH_SURFACEFORMAT_A2R10G10B10:
return 4;
case REFRESH_SURFACEFORMAT_R16G16B16A16_SFLOAT:
case REFRESH_SURFACEFORMAT_R16G16B16A16:
case REFRESH_SURFACEFORMAT_R32G32_SFLOAT:
return 8;
case REFRESH_SURFACEFORMAT_R32G32B32A32_SFLOAT:
return 16;
default:
2020-12-17 02:38:22 +00:00
REFRESH_LogError(
2020-12-17 00:27:14 +00:00
"Unrecognized SurfaceFormat!"
);
return 0;
}
}
static inline uint32_t PrimitiveVerts(
REFRESH_PrimitiveType primitiveType,
uint32_t primitiveCount
) {
switch (primitiveType)
{
case REFRESH_PRIMITIVETYPE_TRIANGLELIST:
return primitiveCount * 3;
case REFRESH_PRIMITIVETYPE_TRIANGLESTRIP:
return primitiveCount + 2;
case REFRESH_PRIMITIVETYPE_LINELIST:
return primitiveCount * 2;
case REFRESH_PRIMITIVETYPE_LINESTRIP:
return primitiveCount + 1;
case REFRESH_PRIMITIVETYPE_POINTLIST:
return primitiveCount;
default:
REFRESH_LogError(
"Unrecognized primitive type!"
);
return 0;
}
}
static inline uint32_t IndexSize(REFRESH_IndexElementSize size)
{
2020-12-17 02:12:20 +00:00
return (size == REFRESH_INDEXELEMENTSIZE_16BIT) ? 2 : 4;
2020-12-17 00:27:14 +00:00
}
static inline uint32_t BytesPerRow(
int32_t width,
REFRESH_SurfaceFormat format
) {
uint32_t blocksPerRow = width;
if ( format == REFRESH_SURFACEFORMAT_BC1 ||
format == REFRESH_SURFACEFORMAT_BC2 ||
format == REFRESH_SURFACEFORMAT_BC3 )
{
blocksPerRow = (width + 3) / 4;
}
return blocksPerRow * Texture_GetFormatSize(format);
}
static inline int32_t BytesPerImage(
uint32_t width,
uint32_t height,
REFRESH_SurfaceFormat format
) {
uint32_t blocksPerRow = width;
uint32_t blocksPerColumn = height;
if ( format == REFRESH_SURFACEFORMAT_BC1 ||
format == REFRESH_SURFACEFORMAT_BC2 ||
format == REFRESH_SURFACEFORMAT_BC3 )
{
blocksPerRow = (width + 3) / 4;
blocksPerColumn = (height + 3) / 4;
}
return blocksPerRow * blocksPerColumn * Texture_GetFormatSize(format);
}
/* XNA GraphicsDevice Limits */
/* TODO: can these be adjusted for modern low-end? */
#define MAX_TEXTURE_SAMPLERS 16
#define MAX_VERTEXTEXTURE_SAMPLERS 4
#define MAX_TOTAL_SAMPLERS (MAX_TEXTURE_SAMPLERS + MAX_VERTEXTEXTURE_SAMPLERS)
2020-12-30 00:53:10 +00:00
#define MAX_BUFFER_BINDINGS 16
2020-12-17 00:27:14 +00:00
2020-12-23 07:17:09 +00:00
#define MAX_COLOR_TARGET_BINDINGS 4
2020-12-17 00:27:14 +00:00
/* REFRESH_Device Definition */
typedef struct REFRESH_Renderer REFRESH_Renderer;
struct REFRESH_Device
{
/* Quit */
void (*DestroyDevice)(REFRESH_Device *device);
/* Drawing */
void (*Clear)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-29 06:19:46 +00:00
REFRESH_Rect *clearRect,
2020-12-17 00:27:14 +00:00
REFRESH_ClearOptions options,
2020-12-29 06:19:46 +00:00
REFRESH_Color *colors,
2020-12-17 00:27:14 +00:00
uint32_t colorCount,
float depth,
int32_t stencil
);
2020-12-20 09:29:15 +00:00
void (*DrawInstancedPrimitives)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 01:08:44 +00:00
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
uint32_t startIndex,
uint32_t primitiveCount,
2020-12-20 09:29:15 +00:00
uint32_t instanceCount,
2020-12-17 00:27:14 +00:00
REFRESH_Buffer *indices,
REFRESH_IndexElementSize indexElementSize,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
2020-12-17 00:27:14 +00:00
);
2020-12-20 09:29:15 +00:00
void (*DrawIndexedPrimitives)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 01:08:44 +00:00
uint32_t baseVertex,
uint32_t minVertexIndex,
uint32_t numVertices,
uint32_t startIndex,
uint32_t primitiveCount,
2020-12-17 00:27:14 +00:00
REFRESH_Buffer *indices,
REFRESH_IndexElementSize indexElementSize,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
2020-12-17 00:27:14 +00:00
);
2020-12-20 09:29:15 +00:00
2020-12-17 00:27:14 +00:00
void (*DrawPrimitives)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 01:08:44 +00:00
uint32_t vertexStart,
uint32_t primitiveCount,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
2020-12-17 00:27:14 +00:00
);
2020-12-30 01:31:39 +00:00
void (*DispatchCompute)(
REFRESH_Renderer *device,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-30 01:31:39 +00:00
uint32_t groupCountX,
uint32_t groupCountY,
2020-12-31 04:39:47 +00:00
uint32_t groupCountZ,
uint32_t computeParamOffset
2020-12-30 01:31:39 +00:00
);
2020-12-17 00:27:14 +00:00
/* State Creation */
2020-12-17 02:38:22 +00:00
REFRESH_RenderPass* (*CreateRenderPass)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_RenderPassCreateInfo *renderPassCreateInfo
);
2020-12-29 22:52:24 +00:00
REFRESH_ComputePipeline* (*CreateComputePipeline)(
REFRESH_Renderer *driverData,
REFRESH_ComputePipelineCreateInfo *pipelineCreateInfo
);
2020-12-17 02:38:22 +00:00
REFRESH_GraphicsPipeline* (*CreateGraphicsPipeline)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_GraphicsPipelineCreateInfo *pipelineCreateInfo
);
2020-12-17 02:38:22 +00:00
REFRESH_Sampler* (*CreateSampler)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_SamplerStateCreateInfo *samplerStateCreateInfo
);
2020-12-17 02:38:22 +00:00
REFRESH_Framebuffer* (*CreateFramebuffer)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_FramebufferCreateInfo *framebufferCreateInfo
);
2020-12-17 02:38:22 +00:00
REFRESH_ShaderModule* (*CreateShaderModule)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_ShaderModuleCreateInfo *shaderModuleCreateInfo
);
2020-12-17 02:38:22 +00:00
REFRESH_Texture* (*CreateTexture2D)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format,
uint32_t width,
uint32_t height,
2020-12-18 22:35:33 +00:00
uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags
2020-12-17 00:27:14 +00:00
);
2020-12-17 02:38:22 +00:00
REFRESH_Texture* (*CreateTexture3D)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format,
uint32_t width,
uint32_t height,
uint32_t depth,
2020-12-18 22:35:33 +00:00
uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags
2020-12-17 00:27:14 +00:00
);
2020-12-17 02:38:22 +00:00
REFRESH_Texture* (*CreateTextureCube)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format,
uint32_t size,
2020-12-18 22:35:33 +00:00
uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags
2020-12-18 22:35:33 +00:00
);
2020-12-21 23:50:12 +00:00
REFRESH_ColorTarget* (*CreateColorTarget)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2020-12-21 23:44:43 +00:00
REFRESH_SampleCount multisampleCount,
REFRESH_TextureSlice *textureSlice
2020-12-17 00:27:14 +00:00
);
2020-12-21 23:50:12 +00:00
REFRESH_DepthStencilTarget* (*CreateDepthStencilTarget)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
uint32_t width,
uint32_t height,
2020-12-19 00:39:03 +00:00
REFRESH_DepthFormat format
2020-12-17 00:27:14 +00:00
);
2020-12-31 04:39:47 +00:00
REFRESH_Buffer* (*CreateBuffer)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2020-12-31 04:39:47 +00:00
REFRESH_BufferUsageFlags usageFlags,
2020-12-17 00:27:14 +00:00
uint32_t sizeInBytes
);
/* Setters */
void(*SetTextureData2D)(
REFRESH_Renderer *driverData,
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
uint32_t w,
uint32_t h,
uint32_t level,
void *data,
uint32_t dataLengthInBytes
);
void(*SetTextureData3D)(
REFRESH_Renderer *driverData,
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
uint32_t z,
uint32_t w,
uint32_t h,
uint32_t d,
uint32_t level,
void* data,
uint32_t dataLength
);
void(*SetTextureDataCube)(
REFRESH_Renderer *driverData,
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
uint32_t w,
uint32_t h,
REFRESH_CubeMapFace cubeMapFace,
uint32_t level,
void* data,
uint32_t dataLength
);
void(*SetTextureDataYUV)(
REFRESH_Renderer *driverData,
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
);
2020-12-31 04:39:47 +00:00
void(*SetBufferData)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
REFRESH_Buffer *buffer,
uint32_t offsetInBytes,
void* data,
uint32_t dataLength
);
uint32_t(*PushVertexShaderParams)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
void *data,
2020-12-23 21:11:09 +00:00
uint32_t elementCount
);
uint32_t(*PushFragmentShaderParams)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 00:27:14 +00:00
void *data,
2020-12-23 21:11:09 +00:00
uint32_t elementCount
2020-12-17 00:27:14 +00:00
);
2020-12-31 04:39:47 +00:00
uint32_t (*PushComputeShaderParams)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-31 04:39:47 +00:00
void *data,
uint32_t elementCount
);
2020-12-17 00:27:14 +00:00
void(*SetVertexSamplers)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-19 05:35:21 +00:00
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
2020-12-17 00:27:14 +00:00
);
void(*SetFragmentSamplers)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-19 05:35:21 +00:00
REFRESH_Texture **pTextures,
REFRESH_Sampler **pSamplers
2020-12-17 00:27:14 +00:00
);
/* Getters */
2021-01-03 01:00:52 +00:00
void(*GetBufferData)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2021-01-03 01:00:52 +00:00
REFRESH_Buffer *buffer,
void *data,
uint32_t dataLengthInBytes
);
void(*CopyTextureData2D)(
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 00:27:14 +00:00
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
uint32_t w,
uint32_t h,
uint32_t level,
2021-01-03 01:00:52 +00:00
REFRESH_Buffer* buffer
2020-12-17 00:27:14 +00:00
);
2021-01-03 01:00:52 +00:00
void(*CopyTextureDataCube)(
2020-12-17 00:27:14 +00:00
REFRESH_Renderer *driverData,
2021-01-03 01:00:52 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 00:27:14 +00:00
REFRESH_Texture *texture,
uint32_t x,
uint32_t y,
uint32_t w,
uint32_t h,
REFRESH_CubeMapFace cubeMapFace,
uint32_t level,
2021-01-03 01:00:52 +00:00
REFRESH_Buffer* buffer
2020-12-17 00:27:14 +00:00
);
/* Disposal */
void(*AddDisposeTexture)(
REFRESH_Renderer *driverData,
REFRESH_Texture *texture
);
void(*AddDisposeSampler)(
REFRESH_Renderer *driverData,
REFRESH_Sampler *sampler
);
void(*AddDisposeVertexBuffer)(
REFRESH_Renderer *driverData,
REFRESH_Buffer *buffer
);
void(*AddDisposeIndexBuffer)(
REFRESH_Renderer *driverData,
REFRESH_Buffer *buffer
);
void(*AddDisposeColorTarget)(
REFRESH_Renderer *driverData,
REFRESH_ColorTarget *colorTarget
);
void(*AddDisposeDepthStencilTarget)(
REFRESH_Renderer *driverData,
REFRESH_DepthStencilTarget *depthStencilTarget
);
void(*AddDisposeFramebuffer)(
REFRESH_Renderer *driverData,
REFRESH_Framebuffer *frameBuffer
);
void(*AddDisposeShaderModule)(
REFRESH_Renderer *driverData,
REFRESH_ShaderModule *shaderModule
);
void(*AddDisposeRenderPass)(
REFRESH_Renderer *driverData,
REFRESH_RenderPass *renderPass
);
2020-12-29 22:52:24 +00:00
void(*AddDisposeComputePipeline)(
REFRESH_Renderer *driverData,
REFRESH_ComputePipeline *computePipeline
);
2020-12-17 00:27:14 +00:00
void(*AddDisposeGraphicsPipeline)(
REFRESH_Renderer *driverData,
REFRESH_GraphicsPipeline *graphicsPipeline
);
/* Graphics State */
void(*BeginRenderPass)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 00:27:14 +00:00
REFRESH_RenderPass *renderPass,
REFRESH_Framebuffer *framebuffer,
REFRESH_Rect renderArea,
2020-12-20 08:05:12 +00:00
REFRESH_Color *pColorClearValues,
uint32_t colorClearCount,
REFRESH_DepthStencilValue *depthStencilClearValue
2020-12-17 00:27:14 +00:00
);
void(*EndRenderPass)(
2021-01-02 21:31:17 +00:00
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer *commandBuffer
2020-12-17 00:27:14 +00:00
);
void(*BindGraphicsPipeline)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-17 00:27:14 +00:00
REFRESH_GraphicsPipeline *graphicsPipeline
);
2020-12-20 07:31:55 +00:00
void(*BindVertexBuffers)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-20 07:31:55 +00:00
uint32_t firstBinding,
uint32_t bindingCount,
REFRESH_Buffer **pBuffers,
uint64_t *pOffsets
);
void(*BindIndexBuffer)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-20 07:31:55 +00:00
REFRESH_Buffer *buffer,
uint64_t offset,
REFRESH_IndexElementSize indexElementSize
);
2020-12-30 01:31:39 +00:00
void(*BindComputePipeline)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-30 01:31:39 +00:00
REFRESH_ComputePipeline *computePipeline
);
void(*BindComputeBuffers)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-30 01:31:39 +00:00
REFRESH_Buffer **pBuffers
);
void(*BindComputeTextures)(
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
2020-12-30 01:31:39 +00:00
REFRESH_Texture **pTextures
);
2021-01-02 06:07:15 +00:00
REFRESH_CommandBuffer* (*AcquireCommandBuffer)(
REFRESH_Renderer *driverData,
uint8_t fixed
);
void(*QueuePresent)(
2020-12-17 04:19:11 +00:00
REFRESH_Renderer *driverData,
2021-01-02 21:31:17 +00:00
REFRESH_CommandBuffer *commandBuffer,
REFRESH_TextureSlice *textureSlice,
2020-12-17 04:19:11 +00:00
REFRESH_Rect *sourceRectangle,
REFRESH_Rect *destinationRectangle
);
2020-12-21 23:44:43 +00:00
void(*Submit)(
2021-01-02 21:31:17 +00:00
REFRESH_Renderer *driverData,
REFRESH_CommandBuffer **pCommandBuffers,
uint32_t commandBufferCount
2020-12-21 23:44:43 +00:00
);
2020-12-17 00:27:14 +00:00
/* Opaque pointer for the Driver */
REFRESH_Renderer *driverData;
};
#define ASSIGN_DRIVER_FUNC(func, name) \
result->func = name##_##func;
#define ASSIGN_DRIVER(name) \
ASSIGN_DRIVER_FUNC(DestroyDevice, name) \
ASSIGN_DRIVER_FUNC(Clear, name) \
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
2020-12-30 01:31:39 +00:00
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
2020-12-17 00:27:14 +00:00
ASSIGN_DRIVER_FUNC(CreateRenderPass, name) \
2020-12-29 22:52:24 +00:00
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
2020-12-17 00:27:14 +00:00
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
ASSIGN_DRIVER_FUNC(CreateFramebuffer, name) \
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
ASSIGN_DRIVER_FUNC(CreateTexture2D, name) \
ASSIGN_DRIVER_FUNC(CreateTexture3D, name) \
ASSIGN_DRIVER_FUNC(CreateTextureCube, name) \
2020-12-21 23:50:12 +00:00
ASSIGN_DRIVER_FUNC(CreateColorTarget, name) \
ASSIGN_DRIVER_FUNC(CreateDepthStencilTarget, name) \
2020-12-31 04:39:47 +00:00
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
2020-12-17 00:27:14 +00:00
ASSIGN_DRIVER_FUNC(SetTextureData2D, name) \
ASSIGN_DRIVER_FUNC(SetTextureData3D, name) \
ASSIGN_DRIVER_FUNC(SetTextureDataCube, name) \
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
2020-12-31 04:39:47 +00:00
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
ASSIGN_DRIVER_FUNC(PushVertexShaderParams, name) \
ASSIGN_DRIVER_FUNC(PushFragmentShaderParams, name) \
2020-12-31 04:39:47 +00:00
ASSIGN_DRIVER_FUNC(PushComputeShaderParams, name) \
2020-12-17 00:27:14 +00:00
ASSIGN_DRIVER_FUNC(SetVertexSamplers, name) \
ASSIGN_DRIVER_FUNC(SetFragmentSamplers, name) \
2021-01-03 01:00:52 +00:00
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
ASSIGN_DRIVER_FUNC(CopyTextureData2D, name) \
ASSIGN_DRIVER_FUNC(CopyTextureDataCube, name) \
2020-12-17 00:27:14 +00:00
ASSIGN_DRIVER_FUNC(AddDisposeTexture, name) \
ASSIGN_DRIVER_FUNC(AddDisposeSampler, name) \
ASSIGN_DRIVER_FUNC(AddDisposeVertexBuffer, name) \
ASSIGN_DRIVER_FUNC(AddDisposeIndexBuffer, name) \
ASSIGN_DRIVER_FUNC(AddDisposeColorTarget, name) \
ASSIGN_DRIVER_FUNC(AddDisposeDepthStencilTarget, name) \
ASSIGN_DRIVER_FUNC(AddDisposeFramebuffer, name) \
ASSIGN_DRIVER_FUNC(AddDisposeShaderModule, name) \
ASSIGN_DRIVER_FUNC(AddDisposeRenderPass, name) \
2020-12-29 22:52:24 +00:00
ASSIGN_DRIVER_FUNC(AddDisposeComputePipeline, name) \
2020-12-17 00:27:14 +00:00
ASSIGN_DRIVER_FUNC(AddDisposeGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
2020-12-17 04:19:11 +00:00
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
2020-12-20 07:31:55 +00:00
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
2020-12-30 01:31:39 +00:00
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
2021-01-02 06:07:15 +00:00
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
ASSIGN_DRIVER_FUNC(QueuePresent, name) \
2020-12-21 23:44:43 +00:00
ASSIGN_DRIVER_FUNC(Submit, name)
2020-12-17 00:27:14 +00:00
typedef struct REFRESH_Driver
{
const char *Name;
REFRESH_Device* (*CreateDevice)(
2020-12-22 00:18:21 +00:00
REFRESH_PresentationParameters *presentationParameters,
2020-12-17 03:28:02 +00:00
uint8_t debugMode
2020-12-17 00:27:14 +00:00
);
} REFRESH_Driver;
extern REFRESH_Driver VulkanDriver;
2020-12-17 19:44:34 +00:00
#endif /* REFRESH_DRIVER_H */
2020-12-17 00:27:14 +00:00
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */