proposed API revision
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
b78d01592b
commit
6f31f17be1
|
@ -69,7 +69,8 @@ REFRESHAPI uint32_t Refresh_LinkedVersion(void);
|
||||||
/* Type Declarations */
|
/* Type Declarations */
|
||||||
|
|
||||||
typedef struct Refresh_Device Refresh_Device;
|
typedef struct Refresh_Device Refresh_Device;
|
||||||
typedef struct Refresh_Buffer Refresh_Buffer;
|
typedef struct Refresh_GpuBuffer Refresh_GpuBuffer;
|
||||||
|
typedef struct Refresh_CpuBuffer Refresh_CpuBuffer;
|
||||||
typedef struct Refresh_Texture Refresh_Texture;
|
typedef struct Refresh_Texture Refresh_Texture;
|
||||||
typedef struct Refresh_Sampler Refresh_Sampler;
|
typedef struct Refresh_Sampler Refresh_Sampler;
|
||||||
typedef struct Refresh_ShaderModule Refresh_ShaderModule;
|
typedef struct Refresh_ShaderModule Refresh_ShaderModule;
|
||||||
|
@ -371,12 +372,31 @@ typedef struct Refresh_Viewport
|
||||||
typedef struct Refresh_TextureSlice
|
typedef struct Refresh_TextureSlice
|
||||||
{
|
{
|
||||||
Refresh_Texture *texture;
|
Refresh_Texture *texture;
|
||||||
Refresh_Rect rectangle;
|
uint32_t mipLevel;
|
||||||
uint32_t depth; /* 0 unless 3D */
|
uint32_t baseLayer; /* either 0-5 for cubemap or 0-n for 3D texture */
|
||||||
uint32_t layer; /* 0 unless cube */
|
uint32_t layerCount;
|
||||||
uint32_t level;
|
uint32_t x;
|
||||||
|
uint32_t y;
|
||||||
|
uint32_t z;
|
||||||
|
uint32_t w;
|
||||||
|
uint32_t h;
|
||||||
|
uint32_t d;
|
||||||
} Refresh_TextureSlice;
|
} Refresh_TextureSlice;
|
||||||
|
|
||||||
|
typedef struct Refresh_BufferImageCopy
|
||||||
|
{
|
||||||
|
uint32_t bufferOffset;
|
||||||
|
uint32_t bufferStride;
|
||||||
|
uint32_t bufferImageHeight;
|
||||||
|
} Refresh_BufferImageCopy;
|
||||||
|
|
||||||
|
typedef struct Refresh_BufferCopy
|
||||||
|
{
|
||||||
|
uint32_t srcOffset;
|
||||||
|
uint32_t dstOffset;
|
||||||
|
uint32_t size;
|
||||||
|
} Refresh_BufferCopy;
|
||||||
|
|
||||||
typedef struct Refresh_IndirectDrawCommand
|
typedef struct Refresh_IndirectDrawCommand
|
||||||
{
|
{
|
||||||
uint32_t vertexCount;
|
uint32_t vertexCount;
|
||||||
|
@ -512,8 +532,7 @@ typedef struct Refresh_DepthStencilState
|
||||||
Refresh_CompareOp compareOp;
|
Refresh_CompareOp compareOp;
|
||||||
uint8_t depthBoundsTestEnable;
|
uint8_t depthBoundsTestEnable;
|
||||||
uint8_t stencilTestEnable;
|
uint8_t stencilTestEnable;
|
||||||
Refresh_StencilOpState frontStencilState;
|
Refresh_StencilOpState stencilState;
|
||||||
Refresh_StencilOpState backStencilState;
|
|
||||||
float minDepthBounds;
|
float minDepthBounds;
|
||||||
float maxDepthBounds;
|
float maxDepthBounds;
|
||||||
} Refresh_DepthStencilState;
|
} Refresh_DepthStencilState;
|
||||||
|
@ -618,6 +637,263 @@ REFRESHAPI Refresh_Device* Refresh_CreateDevice(
|
||||||
/* Destroys a rendering context previously returned by Refresh_CreateDevice. */
|
/* Destroys a rendering context previously returned by Refresh_CreateDevice. */
|
||||||
REFRESHAPI void Refresh_DestroyDevice(Refresh_Device *device);
|
REFRESHAPI void Refresh_DestroyDevice(Refresh_Device *device);
|
||||||
|
|
||||||
|
/* State Creation */
|
||||||
|
|
||||||
|
/* Returns an allocated ComputePipeline* object. */
|
||||||
|
REFRESHAPI Refresh_ComputePipeline* Refresh_CreateComputePipeline(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_ComputeShaderInfo *computeShaderInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Returns an allocated GraphicsPipeline* object. */
|
||||||
|
REFRESHAPI Refresh_GraphicsPipeline* Refresh_CreateGraphicsPipeline(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Returns an allocated Sampler* object. */
|
||||||
|
REFRESHAPI Refresh_Sampler* Refresh_CreateSampler(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Returns an allocated ShaderModule* object. */
|
||||||
|
REFRESHAPI Refresh_ShaderModule* Refresh_CreateShaderModule(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Returns an allocated Refresh_Texture* object. Note that the contents of
|
||||||
|
* the texture are undefined until SetData is called.
|
||||||
|
*/
|
||||||
|
REFRESHAPI Refresh_Texture* Refresh_CreateTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_TextureCreateInfo *textureCreateInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Creates a GpuBuffer.
|
||||||
|
*
|
||||||
|
* usageFlags: Specifies how the buffer will be used.
|
||||||
|
* sizeInBytes: The length of the buffer.
|
||||||
|
*/
|
||||||
|
REFRESHAPI Refresh_GpuBuffer* Refresh_CreateGpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_BufferUsageFlags usageFlags,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Creates a CpuBuffer.
|
||||||
|
*
|
||||||
|
* sizeInBytes: The length of the buffer.
|
||||||
|
*/
|
||||||
|
REFRESHAPI Refresh_CpuBuffer* Refresh_CreateCpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Disposal */
|
||||||
|
|
||||||
|
/* Sends a texture to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
||||||
|
* this is not called from the main thread (for example, if a garbage collector
|
||||||
|
* deletes the resource instead of the programmer).
|
||||||
|
*
|
||||||
|
* texture: The Refresh_Texture to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroyTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_Texture *texture
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sends a sampler to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
||||||
|
* this is not called from the main thread (for example, if a garbage collector
|
||||||
|
* deletes the resource instead of the programmer).
|
||||||
|
*
|
||||||
|
* texture: The Refresh_Sampler to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroySampler(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_Sampler *sampler
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sends a buffer to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer.
|
||||||
|
*
|
||||||
|
* buffer: The Refresh_GpuBuffer to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroyGpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_GpuBuffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sends a buffer to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer.
|
||||||
|
*
|
||||||
|
* buffer: The Refresh_CpuBuffer to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroyCpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CpuBuffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sends a shader module to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer.
|
||||||
|
*
|
||||||
|
* shaderModule: The Refresh_ShaderModule to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroyShaderModule(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_ShaderModule *shaderModule
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sends a compute pipeline to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer.
|
||||||
|
*
|
||||||
|
* computePipeline: The Refresh_ComputePipeline to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroyComputePipeline(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_ComputePipeline *computePipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sends a graphics pipeline to be destroyed by the renderer. Note that we call it
|
||||||
|
* "QueueDestroy" because it may not be immediately destroyed by the renderer.
|
||||||
|
*
|
||||||
|
* graphicsPipeline: The Refresh_GraphicsPipeline to be destroyed.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_QueueDestroyGraphicsPipeline(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Graphics State */
|
||||||
|
|
||||||
|
/* Begins a render pass.
|
||||||
|
* This will also set a default viewport and scissor state.
|
||||||
|
*
|
||||||
|
* colorAttachmentInfos:
|
||||||
|
* A pointer to an array of Refresh_ColorAttachmentInfo structures
|
||||||
|
* that contains render targets and clear values. May be NULL.
|
||||||
|
* colorAttachmentCount: The amount of structs in the above array.
|
||||||
|
* depthStencilAttachmentInfo: The depth/stencil render target and clear value. May be NULL.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_BeginRenderPass(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
||||||
|
uint32_t colorAttachmentCount,
|
||||||
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Binds a graphics pipeline to the graphics bind point. */
|
||||||
|
REFRESHAPI void Refresh_BindGraphicsPipeline(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sets the current viewport state. */
|
||||||
|
REFRESHAPI void Refresh_SetViewport(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Viewport *viewport
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sets the current scissor state. */
|
||||||
|
REFRESHAPI void Refresh_SetScissor(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Rect *scissor
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Binds vertex buffers for use with subsequent draw calls.
|
||||||
|
* Note that this may only be called after binding a graphics pipeline.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_BindVertexBuffers(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t firstBinding,
|
||||||
|
uint32_t bindingCount,
|
||||||
|
Refresh_GpuBuffer **pBuffers,
|
||||||
|
uint64_t *pOffsets
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Binds an index buffer for use with subsequent draw calls. */
|
||||||
|
REFRESHAPI void Refresh_BindIndexBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
uint64_t offset,
|
||||||
|
Refresh_IndexElementSize indexElementSize
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sets textures/samplers for use with the currently bound vertex shader.
|
||||||
|
*
|
||||||
|
* NOTE:
|
||||||
|
* The length of the passed arrays must be equal to the number
|
||||||
|
* of sampler bindings specified by the pipeline.
|
||||||
|
*
|
||||||
|
* textures: A pointer to an array of textures.
|
||||||
|
* samplers: A pointer to an array of samplers.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_BindVertexSamplers(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture **pTextures,
|
||||||
|
Refresh_Sampler **pSamplers
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Sets textures/samplers for use with the currently bound fragment shader.
|
||||||
|
*
|
||||||
|
* NOTE:
|
||||||
|
* The length of the passed arrays must be equal to the number
|
||||||
|
* of sampler bindings specified by the pipeline.
|
||||||
|
*
|
||||||
|
* textures: A pointer to an array of textures.
|
||||||
|
* samplers: A pointer to an array of samplers.
|
||||||
|
*/
|
||||||
|
REFRESHAPI void Refresh_BindFragmentSamplers(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture **pTextures,
|
||||||
|
Refresh_Sampler **pSamplers
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Pushes vertex shader params to the device.
|
||||||
|
* Returns a starting offset value to be used with draw calls.
|
||||||
|
*
|
||||||
|
* NOTE:
|
||||||
|
* A pipeline must be bound.
|
||||||
|
* Will use the block size of the currently bound vertex shader.
|
||||||
|
*
|
||||||
|
* data: The client data to write into the buffer.
|
||||||
|
* dataLengthInBytes: The length of the data to write.
|
||||||
|
*/
|
||||||
|
REFRESHAPI uint32_t Refresh_PushVertexShaderUniforms(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer * commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Pushes fragment shader params to the device.
|
||||||
|
* Returns a starting offset value to be used with draw calls.
|
||||||
|
*
|
||||||
|
* NOTE:
|
||||||
|
* A graphics pipeline must be bound.
|
||||||
|
* Will use the block size of the currently bound fragment shader.
|
||||||
|
*
|
||||||
|
* data: The client data to write into the buffer.
|
||||||
|
* dataLengthInBytes: The length of the data to write.
|
||||||
|
*/
|
||||||
|
REFRESHAPI uint32_t Refresh_PushFragmentShaderUniforms(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
/* Drawing */
|
/* Drawing */
|
||||||
|
|
||||||
/* Draws data from vertex/index buffers with instancing enabled.
|
/* Draws data from vertex/index buffers with instancing enabled.
|
||||||
|
@ -687,7 +963,7 @@ REFRESHAPI void Refresh_DrawPrimitives(
|
||||||
REFRESHAPI void Refresh_DrawPrimitivesIndirect(
|
REFRESHAPI void Refresh_DrawPrimitivesIndirect(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_GpuBuffer *buffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
uint32_t drawCount,
|
uint32_t drawCount,
|
||||||
uint32_t stride,
|
uint32_t stride,
|
||||||
|
@ -695,206 +971,51 @@ REFRESHAPI void Refresh_DrawPrimitivesIndirect(
|
||||||
uint32_t fragmentParamOffset
|
uint32_t fragmentParamOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Dispatches work compute items.
|
/* Ends the current render pass. */
|
||||||
*
|
REFRESHAPI void Refresh_EndRenderPass(
|
||||||
* groupCountX: Number of local workgroups to dispatch in the X dimension.
|
Refresh_Device *device,
|
||||||
* groupCountY: Number of local workgroups to dispatch in the Y dimension.
|
Refresh_CommandBuffer *commandBuffer
|
||||||
* groupCountZ: Number of local workgroups to dispatch in the Z dimension.
|
);
|
||||||
* computeParamOffset: The offset of the compute shader param data.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_DispatchCompute(
|
/* Begins a compute pass. */
|
||||||
|
REFRESHAPI void Refresh_BeginComputePass(Refresh_Device *device);
|
||||||
|
|
||||||
|
/* Binds a compute pipeline to the compute bind point. */
|
||||||
|
REFRESHAPI void Refresh_BindComputePipeline(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
uint32_t groupCountX,
|
Refresh_ComputePipeline *computePipeline
|
||||||
uint32_t groupCountY,
|
|
||||||
uint32_t groupCountZ,
|
|
||||||
uint32_t computeParamOffset
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* State Creation */
|
/* Binds buffers for use with the currently bound compute pipeline.
|
||||||
|
*
|
||||||
/* Returns an allocated ComputePipeline* object. */
|
* pBuffers: An array of buffers to bind.
|
||||||
REFRESHAPI Refresh_ComputePipeline* Refresh_CreateComputePipeline(
|
* Length must be equal to the number of buffers
|
||||||
Refresh_Device *device,
|
* specified by the compute pipeline.
|
||||||
Refresh_ComputeShaderInfo *computeShaderInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Returns an allocated GraphicsPipeline* object. */
|
|
||||||
REFRESHAPI Refresh_GraphicsPipeline* Refresh_CreateGraphicsPipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Returns an allocated Sampler* object. */
|
|
||||||
REFRESHAPI Refresh_Sampler* Refresh_CreateSampler(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Returns an allocated ShaderModule* object. */
|
|
||||||
REFRESHAPI Refresh_ShaderModule* Refresh_CreateShaderModule(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Returns an allocated Refresh_Texture* object. Note that the contents of
|
|
||||||
* the texture are undefined until SetData is called.
|
|
||||||
*/
|
*/
|
||||||
REFRESHAPI Refresh_Texture* Refresh_CreateTexture(
|
REFRESHAPI void Refresh_BindComputeBuffers(
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_TextureCreateInfo *textureCreateInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Creates a buffer.
|
|
||||||
*
|
|
||||||
* usageFlags: Specifies how the buffer will be used.
|
|
||||||
* sizeInBytes: The length of the buffer.
|
|
||||||
*/
|
|
||||||
REFRESHAPI Refresh_Buffer* Refresh_CreateBuffer(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_BufferUsageFlags usageFlags,
|
|
||||||
uint32_t sizeInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Setters */
|
|
||||||
|
|
||||||
/* Uploads image data to a texture object.
|
|
||||||
*
|
|
||||||
* NOTE:
|
|
||||||
* DO NOT expect this to execute in sequence relative to other commands!
|
|
||||||
* Calling SetTextureData in a command buffer that also references the
|
|
||||||
* texture may result in undefined behavior.
|
|
||||||
*
|
|
||||||
* textureSlice: The texture slice to be updated.
|
|
||||||
* data: A pointer to the image data.
|
|
||||||
* dataLengthInBytes: The size of the image data.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_SetTextureData(
|
|
||||||
Refresh_Device *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Uploads YUV image data to three R8 texture objects.
|
|
||||||
*
|
|
||||||
* y: The texture storing the Y data.
|
|
||||||
* u: The texture storing the U (Cb) data.
|
|
||||||
* v: The texture storing the V (Cr) data.
|
|
||||||
* yWidth: The width of the Y plane.
|
|
||||||
* yHeight: The height of the Y plane.
|
|
||||||
* uvWidth: The width of the U/V planes.
|
|
||||||
* uvHeight: The height of the U/V planes.
|
|
||||||
* yData: A pointer to the raw Y image data.
|
|
||||||
* uData: A pointer to the raw U image data.
|
|
||||||
* vData: A pointer to the raw V image data.
|
|
||||||
* yDataLength: The size of the Y image data in bytes.
|
|
||||||
* uvDataLength: The size of the UV image data in bytes.
|
|
||||||
* yStride: The length of a Y image data row in bytes.
|
|
||||||
* uvStride: The length of a UV image data row in bytes.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_SetTextureDataYUV(
|
|
||||||
Refresh_Device *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 *yDataPtr,
|
|
||||||
void *uDataPtr,
|
|
||||||
void *vDataPtr,
|
|
||||||
uint32_t yDataLength,
|
|
||||||
uint32_t uvDataLength,
|
|
||||||
uint32_t yStride,
|
|
||||||
uint32_t uvStride
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Performs an asynchronous texture-to-texture copy.
|
|
||||||
*
|
|
||||||
* sourceTextureSlice: The texture slice from which to copy.
|
|
||||||
* destinationTextureSlice: The texture slice to copy to.
|
|
||||||
* filter: The filter that will be used if the copy requires scaling.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_CopyTextureToTexture(
|
|
||||||
Refresh_Device *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *sourceTextureSlice,
|
|
||||||
Refresh_TextureSlice *destinationTextureSlice,
|
|
||||||
Refresh_Filter filter
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Asynchronously copies image data from a texture slice into a buffer.
|
|
||||||
*
|
|
||||||
* NOTE:
|
|
||||||
* The buffer will not contain correct data until the command buffer
|
|
||||||
* is submitted and completed.
|
|
||||||
*
|
|
||||||
* textureSlice: The texture object being copied.
|
|
||||||
* buffer: The buffer being filled with the image data.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_CopyTextureToBuffer(
|
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_TextureSlice *textureSlice,
|
Refresh_GpuBuffer **pBuffers
|
||||||
Refresh_Buffer *buffer
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Sets a region of the buffer with client data.
|
/* Binds textures for use with the currently bound compute pipeline.
|
||||||
*
|
*
|
||||||
* NOTE:
|
* pTextures: An array of textures to bind.
|
||||||
* Calling this function on a buffer after the buffer
|
* Length must be equal to the number of buffers
|
||||||
* has been bound without calling Submit first is an error.
|
* specified by the compute pipeline.
|
||||||
*
|
*
|
||||||
* buffer: The vertex buffer to be updated.
|
* pLevels: An array of levels to bind,
|
||||||
* offsetInBytes: The starting offset of the buffer to write into.
|
* corresponding to the indices in pTextures.
|
||||||
* data: The client data to write into the buffer.
|
* Length must be equal to the number of buffers
|
||||||
* dataLength: The length of data from the client buffer to write.
|
* specified by the compute pipeline.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void Refresh_SetBufferData(
|
REFRESHAPI void Refresh_BindComputeTextures(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_Texture **pTextures,
|
||||||
uint32_t offsetInBytes,
|
uint32_t **pLevels
|
||||||
void* data,
|
|
||||||
uint32_t dataLength
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Pushes vertex shader params to the device.
|
|
||||||
* Returns a starting offset value to be used with draw calls.
|
|
||||||
*
|
|
||||||
* NOTE:
|
|
||||||
* A pipeline must be bound.
|
|
||||||
* Will use the block size of the currently bound vertex shader.
|
|
||||||
*
|
|
||||||
* data: The client data to write into the buffer.
|
|
||||||
* dataLengthInBytes: The length of the data to write.
|
|
||||||
*/
|
|
||||||
REFRESHAPI uint32_t Refresh_PushVertexShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer * commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Pushes fragment shader params to the device.
|
|
||||||
* Returns a starting offset value to be used with draw calls.
|
|
||||||
*
|
|
||||||
* NOTE:
|
|
||||||
* A graphics pipeline must be bound.
|
|
||||||
* Will use the block size of the currently bound fragment shader.
|
|
||||||
*
|
|
||||||
* data: The client data to write into the buffer.
|
|
||||||
* dataLengthInBytes: The length of the data to write.
|
|
||||||
*/
|
|
||||||
REFRESHAPI uint32_t Refresh_PushFragmentShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Pushes compute shader params to the device.
|
/* Pushes compute shader params to the device.
|
||||||
|
@ -914,225 +1035,149 @@ REFRESHAPI uint32_t Refresh_PushComputeShaderUniforms(
|
||||||
uint32_t dataLengthInBytes
|
uint32_t dataLengthInBytes
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Getters */
|
/* Dispatches work compute items.
|
||||||
|
|
||||||
/* Synchronously copies data from a buffer to a pointer.
|
|
||||||
* You probably want to wait for a sync point to call this.
|
|
||||||
*
|
*
|
||||||
* buffer: The buffer to copy data from.
|
* groupCountX: Number of local workgroups to dispatch in the X dimension.
|
||||||
* data: The pointer to copy data to.
|
* groupCountY: Number of local workgroups to dispatch in the Y dimension.
|
||||||
* dataLengthInBytes: The length of data to copy.
|
* groupCountZ: Number of local workgroups to dispatch in the Z dimension.
|
||||||
|
* computeParamOffset: The offset of the compute shader param data.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void Refresh_GetBufferData(
|
REFRESHAPI void Refresh_DispatchCompute(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
void *data,
|
uint32_t groupCountX,
|
||||||
uint32_t dataLengthInBytes
|
uint32_t groupCountY,
|
||||||
|
uint32_t groupCountZ,
|
||||||
|
uint32_t computeParamOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Disposal */
|
/* Ends the current compute pass. */
|
||||||
|
REFRESHAPI void Refresh_EndComputePass(Refresh_Device *device);
|
||||||
|
|
||||||
/* Sends a texture to be destroyed by the renderer. Note that we call it
|
/* CpuBuffer Map */
|
||||||
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
|
||||||
* this is not called from the main thread (for example, if a garbage collector
|
/* Maps a CpuBuffer to host memory. Returns a pointer that can be copied to.
|
||||||
* deletes the resource instead of the programmer).
|
|
||||||
*
|
*
|
||||||
* texture: The Refresh_Texture to be destroyed.
|
* offsetInBytes: The offset of the buffer to map.
|
||||||
|
* sizeInBytes: The number of bytes of memory to map.
|
||||||
*/
|
*/
|
||||||
REFRESHAPI void Refresh_QueueDestroyTexture(
|
REFRESHAPI void* Refresh_MapCpuBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
|
Refresh_CpuBuffer *buffer,
|
||||||
|
uint32_t offsetInBytes,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Unmaps a mapped CpuBuffer. Call this when you are done copying data. */
|
||||||
|
REFRESHAPI void Refresh_UnmapCpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CpuBuffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Copy Pass */
|
||||||
|
|
||||||
|
/* Begins a copy pass. */
|
||||||
|
REFRESHAPI void Refresh_BeginCopyPass(Refresh_Device *device);
|
||||||
|
|
||||||
|
/* CPU-to-GPU copies occur on the GPU timeline.
|
||||||
|
*
|
||||||
|
* You MUST NOT alter the data until the command buffer
|
||||||
|
* has finished execution.
|
||||||
|
*
|
||||||
|
* You MAY assume that the copy has finished for subsequent commands.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Uploads data from a CpuBuffer to a texture. */
|
||||||
|
REFRESHAPI void Refresh_UploadToTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams,
|
||||||
|
Refresh_TextureSlice *textureSlice
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Uploads data from a CpuBuffer to a GpuBuffer. */
|
||||||
|
REFRESHAPI void Refresh_UploadToBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
/* GPU-to-CPU copies occur on the GPU timeline.
|
||||||
|
*
|
||||||
|
* You may NOT assume that the data in the CpuBuffer is valid
|
||||||
|
* until the command buffer has finished execution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Downloads data from a texture to a CpuBuffer. */
|
||||||
|
REFRESHAPI void Refresh_DownloadFromTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Downloads data from a GpuBuffer object. */
|
||||||
|
REFRESHAPI void Refresh_DownloadFromBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
/* GPU-to-GPU copies occur on the GPU timeline,
|
||||||
|
* and you may assume the copy has finished in subsequent commands.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Performs a texture-to-texture copy. */
|
||||||
|
REFRESHAPI void Refresh_CopyTextureToTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *source,
|
||||||
|
Refresh_TextureSlice *destination
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Copies image data from a texture slice into a buffer. */
|
||||||
|
REFRESHAPI void Refresh_CopyTextureToBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
Refresh_BufferImageCopy *copyParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Copies data from a buffer to a texture slice. */
|
||||||
|
REFRESHAPI void Refresh_CopyBufferToTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams,
|
||||||
|
Refresh_TextureSlice *textureSlice
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Copies data from a buffer to a buffer. */
|
||||||
|
REFRESHAPI void Refresh_CopyBufferToBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *source,
|
||||||
|
Refresh_GpuBuffer *destination,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Generate mipmaps for the given texture. */
|
||||||
|
REFRESHAPI void Refresh_GenerateMipmaps(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Texture *texture
|
Refresh_Texture *texture
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Sends a sampler to be destroyed by the renderer. Note that we call it
|
REFRESHAPI void Refresh_EndCopyPass(Refresh_Device *device);
|
||||||
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
|
||||||
* this is not called from the main thread (for example, if a garbage collector
|
|
||||||
* deletes the resource instead of the programmer).
|
|
||||||
*
|
|
||||||
* texture: The Refresh_Sampler to be destroyed.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_QueueDestroySampler(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_Sampler *sampler
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sends a buffer to be destroyed by the renderer. Note that we call it
|
/* Ends a copy pass. */
|
||||||
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
|
||||||
* this is not called from the main thread (for example, if a garbage collector
|
|
||||||
* deletes the resource instead of the programmer).
|
|
||||||
*
|
|
||||||
* buffer: The Refresh_Buffer to be destroyed.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_QueueDestroyBuffer(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_Buffer *buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sends a shader module to be destroyed by the renderer. Note that we call it
|
|
||||||
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
|
||||||
* this is not called from the main thread (for example, if a garbage collector
|
|
||||||
* deletes the resource instead of the programmer).
|
|
||||||
*
|
|
||||||
* shaderModule: The Refresh_ShaderModule to be destroyed.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_QueueDestroyShaderModule(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_ShaderModule *shaderModule
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sends a compute pipeline to be destroyed by the renderer. Note that we call it
|
|
||||||
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
|
||||||
* this is not called from the main thread (for example, if a garbage collector
|
|
||||||
* deletes the resource instead of the programmer).
|
|
||||||
*
|
|
||||||
* computePipeline: The Refresh_ComputePipeline to be destroyed.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_QueueDestroyComputePipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_ComputePipeline *computePipeline
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sends a graphics pipeline to be destroyed by the renderer. Note that we call it
|
|
||||||
* "QueueDestroy" because it may not be immediately destroyed by the renderer if
|
|
||||||
* this is not called from the main thread (for example, if a garbage collector
|
|
||||||
* deletes the resource instead of the programmer).
|
|
||||||
*
|
|
||||||
* graphicsPipeline: The Refresh_GraphicsPipeline to be destroyed.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_QueueDestroyGraphicsPipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Graphics State */
|
|
||||||
|
|
||||||
/* Begins a render pass.
|
|
||||||
* This will also set a default viewport and scissor state.
|
|
||||||
*
|
|
||||||
* colorAttachmentInfos:
|
|
||||||
* A pointer to an array of Refresh_ColorAttachmentInfo structures
|
|
||||||
* that contains render targets and clear values. May be NULL.
|
|
||||||
* colorAttachmentCount: The amount of structs in the above array.
|
|
||||||
* depthStencilAttachmentInfo: The depth/stencil render target and clear value. May be NULL.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_BeginRenderPass(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
||||||
uint32_t colorAttachmentCount,
|
|
||||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Ends the current render pass. */
|
|
||||||
REFRESHAPI void Refresh_EndRenderPass(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Binds a graphics pipeline to the graphics bind point. */
|
|
||||||
REFRESHAPI void Refresh_BindGraphicsPipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sets the current viewport state. */
|
|
||||||
REFRESHAPI void Refresh_SetViewport(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Viewport *viewport
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sets the current scissor state. */
|
|
||||||
REFRESHAPI void Refresh_SetScissor(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Rect *scissor
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Binds vertex buffers for use with subsequent draw calls.
|
|
||||||
* Note that this may only be called after binding a graphics pipeline.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_BindVertexBuffers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t firstBinding,
|
|
||||||
uint32_t bindingCount,
|
|
||||||
Refresh_Buffer **pBuffers,
|
|
||||||
uint64_t *pOffsets
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Binds an index buffer for use with subsequent draw calls. */
|
|
||||||
REFRESHAPI void Refresh_BindIndexBuffer(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint64_t offset,
|
|
||||||
Refresh_IndexElementSize indexElementSize
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sets textures/samplers for use with the currently bound vertex shader.
|
|
||||||
*
|
|
||||||
* NOTE:
|
|
||||||
* The length of the passed arrays must be equal to the number
|
|
||||||
* of sampler bindings specified by the pipeline.
|
|
||||||
*
|
|
||||||
* textures: A pointer to an array of textures.
|
|
||||||
* samplers: A pointer to an array of samplers.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_BindVertexSamplers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Sets textures/samplers for use with the currently bound fragment shader.
|
|
||||||
*
|
|
||||||
* NOTE:
|
|
||||||
* The length of the passed arrays must be equal to the number
|
|
||||||
* of sampler bindings specified by the pipeline.
|
|
||||||
*
|
|
||||||
* textures: A pointer to an array of textures.
|
|
||||||
* samplers: A pointer to an array of samplers.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_BindFragmentSamplers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Binds a compute pipeline to the compute bind point. */
|
|
||||||
REFRESHAPI void Refresh_BindComputePipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_ComputePipeline *computePipeline
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Binds buffers for use with the currently bound compute pipeline.
|
|
||||||
*
|
|
||||||
* pBuffers: An array of buffers to bind.
|
|
||||||
* Length must be equal to the number of buffers
|
|
||||||
* specified by the compute pipeline.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_BindComputeBuffers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer **pBuffers
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Binds textures for use with the currently bound compute pipeline.
|
|
||||||
*
|
|
||||||
* pTextures: An array of textures to bind.
|
|
||||||
* Length must be equal to the number of buffers
|
|
||||||
* specified by the compute pipeline.
|
|
||||||
*/
|
|
||||||
REFRESHAPI void Refresh_BindComputeTextures(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Submission/Presentation */
|
/* Submission/Presentation */
|
||||||
|
|
||||||
|
|
815
src/Refresh.c
815
src/Refresh.c
|
@ -196,110 +196,7 @@ void Refresh_DestroyDevice(Refresh_Device *device)
|
||||||
device->DestroyDevice(device);
|
device->DestroyDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_DrawIndexedPrimitives(
|
/* State Creation */
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawIndexedPrimitives(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
baseVertex,
|
|
||||||
startIndex,
|
|
||||||
primitiveCount,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DrawInstancedPrimitives(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
uint32_t instanceCount,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawInstancedPrimitives(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
baseVertex,
|
|
||||||
startIndex,
|
|
||||||
primitiveCount,
|
|
||||||
instanceCount,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DrawPrimitives(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t vertexStart,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawPrimitives(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
vertexStart,
|
|
||||||
primitiveCount,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DrawPrimitivesIndirect(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint32_t offsetInBytes,
|
|
||||||
uint32_t drawCount,
|
|
||||||
uint32_t stride,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawPrimitivesIndirect(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
buffer,
|
|
||||||
offsetInBytes,
|
|
||||||
drawCount,
|
|
||||||
stride,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DispatchCompute(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t groupCountX,
|
|
||||||
uint32_t groupCountY,
|
|
||||||
uint32_t groupCountZ,
|
|
||||||
uint32_t computeParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DispatchCompute(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
groupCountX,
|
|
||||||
groupCountY,
|
|
||||||
groupCountZ,
|
|
||||||
computeParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Refresh_ComputePipeline* Refresh_CreateComputePipeline(
|
Refresh_ComputePipeline* Refresh_CreateComputePipeline(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
|
@ -398,215 +295,31 @@ Refresh_Texture* Refresh_CreateTexture(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh_Buffer* Refresh_CreateBuffer(
|
Refresh_GpuBuffer* Refresh_CreateGpuBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_BufferUsageFlags usageFlags,
|
Refresh_BufferUsageFlags usageFlags,
|
||||||
uint32_t sizeInBytes
|
uint32_t sizeInBytes
|
||||||
) {
|
) {
|
||||||
NULL_RETURN_NULL(device);
|
NULL_RETURN_NULL(device);
|
||||||
return device->CreateBuffer(
|
return device->CreateGpuBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
usageFlags,
|
usageFlags,
|
||||||
sizeInBytes
|
sizeInBytes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_SetTextureData(
|
Refresh_CpuBuffer* Refresh_CreateCpuBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
uint32_t sizeInBytes
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN_NULL(device);
|
||||||
device->SetTextureData(
|
return device->CreateCpuBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer,
|
sizeInBytes
|
||||||
textureSlice,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_SetTextureDataYUV(
|
/* Disposal */
|
||||||
Refresh_Device *device,
|
|
||||||
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 *yDataPtr,
|
|
||||||
void *uDataPtr,
|
|
||||||
void *vDataPtr,
|
|
||||||
uint32_t yDataLength,
|
|
||||||
uint32_t uvDataLength,
|
|
||||||
uint32_t yStride,
|
|
||||||
uint32_t uvStride
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->SetTextureDataYUV(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
y,
|
|
||||||
u,
|
|
||||||
v,
|
|
||||||
yWidth,
|
|
||||||
yHeight,
|
|
||||||
uvWidth,
|
|
||||||
uvHeight,
|
|
||||||
yDataPtr,
|
|
||||||
uDataPtr,
|
|
||||||
vDataPtr,
|
|
||||||
yDataLength,
|
|
||||||
uvDataLength,
|
|
||||||
yStride,
|
|
||||||
uvStride
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_CopyTextureToTexture(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *sourceTextureSlice,
|
|
||||||
Refresh_TextureSlice *destinationTextureSlice,
|
|
||||||
Refresh_Filter filter
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->CopyTextureToTexture(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
sourceTextureSlice,
|
|
||||||
destinationTextureSlice,
|
|
||||||
filter
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_CopyTextureToBuffer(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
Refresh_Buffer *buffer
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->CopyTextureToBuffer(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
textureSlice,
|
|
||||||
buffer
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_SetBufferData(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint32_t offsetInBytes,
|
|
||||||
void* data,
|
|
||||||
uint32_t dataLength
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->SetBufferData(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
buffer,
|
|
||||||
offsetInBytes,
|
|
||||||
data,
|
|
||||||
dataLength
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Refresh_PushVertexShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->PushVertexShaderUniforms(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Refresh_PushFragmentShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->PushFragmentShaderUniforms(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Refresh_PushComputeShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->PushComputeShaderUniforms(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_BindVertexSamplers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->BindVertexSamplers(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
pTextures,
|
|
||||||
pSamplers
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_BindFragmentSamplers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->BindFragmentSamplers(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
pTextures,
|
|
||||||
pSamplers
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_GetBufferData(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->GetBufferData(
|
|
||||||
device->driverData,
|
|
||||||
buffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_QueueDestroyTexture(
|
void Refresh_QueueDestroyTexture(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
|
@ -630,12 +343,23 @@ void Refresh_QueueDestroySampler(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_QueueDestroyBuffer(
|
void Refresh_QueueDestroyGpuBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_Buffer *buffer
|
Refresh_GpuBuffer *buffer
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->QueueDestroyBuffer(
|
device->QueueDestroyGpuBuffer(
|
||||||
|
device->driverData,
|
||||||
|
buffer
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_QueueDestroyCpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CpuBuffer *buffer
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->QueueDestroyCpuBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
|
@ -674,6 +398,8 @@ void Refresh_QueueDestroyGraphicsPipeline(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Render Pass */
|
||||||
|
|
||||||
void Refresh_BeginRenderPass(
|
void Refresh_BeginRenderPass(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
@ -691,14 +417,16 @@ void Refresh_BeginRenderPass(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_EndRenderPass(
|
void Refresh_BindGraphicsPipeline(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->EndRenderPass(
|
device->BindGraphicsPipeline(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer
|
commandBuffer,
|
||||||
|
graphicsPipeline
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,25 +456,12 @@ void Refresh_SetScissor(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_BindGraphicsPipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->BindGraphicsPipeline(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
graphicsPipeline
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_BindVertexBuffers(
|
void Refresh_BindVertexBuffers(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
uint32_t firstBinding,
|
uint32_t firstBinding,
|
||||||
uint32_t bindingCount,
|
uint32_t bindingCount,
|
||||||
Refresh_Buffer **pBuffers,
|
Refresh_GpuBuffer **pBuffers,
|
||||||
uint64_t *pOffsets
|
uint64_t *pOffsets
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
|
@ -763,7 +478,7 @@ void Refresh_BindVertexBuffers(
|
||||||
void Refresh_BindIndexBuffer(
|
void Refresh_BindIndexBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_GpuBuffer *buffer,
|
||||||
uint64_t offset,
|
uint64_t offset,
|
||||||
Refresh_IndexElementSize indexElementSize
|
Refresh_IndexElementSize indexElementSize
|
||||||
) {
|
) {
|
||||||
|
@ -777,6 +492,174 @@ void Refresh_BindIndexBuffer(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Refresh_BindVertexSamplers(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture **pTextures,
|
||||||
|
Refresh_Sampler **pSamplers
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->BindVertexSamplers(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
pTextures,
|
||||||
|
pSamplers
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_BindFragmentSamplers(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture **pTextures,
|
||||||
|
Refresh_Sampler **pSamplers
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->BindFragmentSamplers(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
pTextures,
|
||||||
|
pSamplers
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Refresh_PushVertexShaderUniforms(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
) {
|
||||||
|
if (device == NULL) { return 0; }
|
||||||
|
return device->PushVertexShaderUniforms(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
data,
|
||||||
|
dataLengthInBytes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Refresh_PushFragmentShaderUniforms(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
) {
|
||||||
|
if (device == NULL) { return 0; }
|
||||||
|
return device->PushFragmentShaderUniforms(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
data,
|
||||||
|
dataLengthInBytes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DrawInstancedPrimitives(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t baseVertex,
|
||||||
|
uint32_t startIndex,
|
||||||
|
uint32_t primitiveCount,
|
||||||
|
uint32_t instanceCount,
|
||||||
|
uint32_t vertexParamOffset,
|
||||||
|
uint32_t fragmentParamOffset
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DrawInstancedPrimitives(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
baseVertex,
|
||||||
|
startIndex,
|
||||||
|
primitiveCount,
|
||||||
|
instanceCount,
|
||||||
|
vertexParamOffset,
|
||||||
|
fragmentParamOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DrawIndexedPrimitives(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t baseVertex,
|
||||||
|
uint32_t startIndex,
|
||||||
|
uint32_t primitiveCount,
|
||||||
|
uint32_t vertexParamOffset,
|
||||||
|
uint32_t fragmentParamOffset
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DrawIndexedPrimitives(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
baseVertex,
|
||||||
|
startIndex,
|
||||||
|
primitiveCount,
|
||||||
|
vertexParamOffset,
|
||||||
|
fragmentParamOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DrawPrimitives(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t vertexStart,
|
||||||
|
uint32_t primitiveCount,
|
||||||
|
uint32_t vertexParamOffset,
|
||||||
|
uint32_t fragmentParamOffset
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DrawPrimitives(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
vertexStart,
|
||||||
|
primitiveCount,
|
||||||
|
vertexParamOffset,
|
||||||
|
fragmentParamOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DrawPrimitivesIndirect(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
uint32_t offsetInBytes,
|
||||||
|
uint32_t drawCount,
|
||||||
|
uint32_t stride,
|
||||||
|
uint32_t vertexParamOffset,
|
||||||
|
uint32_t fragmentParamOffset
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DrawPrimitivesIndirect(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
buffer,
|
||||||
|
offsetInBytes,
|
||||||
|
drawCount,
|
||||||
|
stride,
|
||||||
|
vertexParamOffset,
|
||||||
|
fragmentParamOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_EndRenderPass(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->EndRenderPass(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute Pass */
|
||||||
|
|
||||||
|
void Refresh_BeginComputePass(
|
||||||
|
Refresh_Device *device
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->BeginComputePass(
|
||||||
|
device->driverData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void Refresh_BindComputePipeline(
|
void Refresh_BindComputePipeline(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
@ -793,7 +676,7 @@ void Refresh_BindComputePipeline(
|
||||||
void Refresh_BindComputeBuffers(
|
void Refresh_BindComputeBuffers(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer **pBuffers
|
Refresh_GpuBuffer **pBuffers
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BindComputeBuffers(
|
device->BindComputeBuffers(
|
||||||
|
@ -806,16 +689,258 @@ void Refresh_BindComputeBuffers(
|
||||||
void Refresh_BindComputeTextures(
|
void Refresh_BindComputeTextures(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Texture **pTextures
|
Refresh_Texture **pTextures,
|
||||||
|
uint32_t **pLevels
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BindComputeTextures(
|
device->BindComputeTextures(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer,
|
commandBuffer,
|
||||||
pTextures
|
pTextures,
|
||||||
|
pLevels
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Refresh_PushComputeShaderUniforms(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
) {
|
||||||
|
if (device == NULL) { return 0; }
|
||||||
|
return device->PushComputeShaderUniforms(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
data,
|
||||||
|
dataLengthInBytes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DispatchCompute(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t groupCountX,
|
||||||
|
uint32_t groupCountY,
|
||||||
|
uint32_t groupCountZ,
|
||||||
|
uint32_t computeParamOffset
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DispatchCompute(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
groupCountX,
|
||||||
|
groupCountY,
|
||||||
|
groupCountZ,
|
||||||
|
computeParamOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_EndComputePass(
|
||||||
|
Refresh_Device *device
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->EndComputePass(
|
||||||
|
device->driverData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CpuBuffer Map */
|
||||||
|
|
||||||
|
void* Refresh_MapCpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CpuBuffer *buffer,
|
||||||
|
uint32_t offsetInBytes,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
) {
|
||||||
|
NULL_RETURN_NULL(device);
|
||||||
|
return device->MapCpuBuffer(
|
||||||
|
device->driverData,
|
||||||
|
buffer,
|
||||||
|
offsetInBytes,
|
||||||
|
sizeInBytes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_UnmapCpuBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CpuBuffer *buffer
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->UnmapCpuBuffer(
|
||||||
|
device->driverData,
|
||||||
|
buffer
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy Pass */
|
||||||
|
|
||||||
|
void Refresh_BeginCopyPass(
|
||||||
|
Refresh_Device *device
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->BeginCopyPass(
|
||||||
|
device->driverData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_UploadToTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams,
|
||||||
|
Refresh_TextureSlice *textureSlice
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->UploadToTexture(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
cpuBuffer,
|
||||||
|
copyParams,
|
||||||
|
textureSlice
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_UploadToBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->UploadToBuffer(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
cpuBuffer,
|
||||||
|
gpuBuffer,
|
||||||
|
copyParams
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DownloadFromTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DownloadFromTexture(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
textureSlice,
|
||||||
|
cpuBuffer,
|
||||||
|
copyParams
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_DownloadFromBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->DownloadFromBuffer(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
gpuBuffer,
|
||||||
|
cpuBuffer,
|
||||||
|
copyParams
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_CopyTextureToTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *sourceTextureSlice,
|
||||||
|
Refresh_TextureSlice *destinationTextureSlice
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->CopyTextureToTexture(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
sourceTextureSlice,
|
||||||
|
destinationTextureSlice
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_CopyTextureToBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
Refresh_BufferImageCopy *copyParameters
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->CopyTextureToBuffer(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
textureSlice,
|
||||||
|
buffer,
|
||||||
|
copyParameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_CopyBufferToTexture(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams,
|
||||||
|
Refresh_TextureSlice *textureSlice
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->CopyBufferToTexture(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
buffer,
|
||||||
|
copyParams,
|
||||||
|
textureSlice
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_CopyBufferToBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *source,
|
||||||
|
Refresh_GpuBuffer *destination,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->CopyBufferToBuffer(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
source,
|
||||||
|
destination,
|
||||||
|
copyParams
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_GenerateMipmaps(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture *texture
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->GenerateMipmaps(
|
||||||
|
device->driverData,
|
||||||
|
commandBuffer,
|
||||||
|
texture
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_EndCopyPass(
|
||||||
|
Refresh_Device *device
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->EndCopyPass(
|
||||||
|
device->driverData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Submission/Presentation */
|
||||||
|
|
||||||
uint8_t Refresh_ClaimWindow(
|
uint8_t Refresh_ClaimWindow(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
void *windowHandle,
|
void *windowHandle,
|
||||||
|
@ -840,6 +965,30 @@ void Refresh_UnclaimWindow(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Refresh_SetSwapchainPresentMode(
|
||||||
|
Refresh_Device *device,
|
||||||
|
void *windowHandle,
|
||||||
|
Refresh_PresentMode presentMode
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->SetSwapchainPresentMode(
|
||||||
|
device->driverData,
|
||||||
|
windowHandle,
|
||||||
|
presentMode
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh_TextureFormat Refresh_GetSwapchainFormat(
|
||||||
|
Refresh_Device *device,
|
||||||
|
void *windowHandle
|
||||||
|
) {
|
||||||
|
if (device == NULL) { return 0; }
|
||||||
|
return device->GetSwapchainFormat(
|
||||||
|
device->driverData,
|
||||||
|
windowHandle
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
|
Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
|
||||||
Refresh_Device *device
|
Refresh_Device *device
|
||||||
) {
|
) {
|
||||||
|
@ -866,30 +1015,6 @@ Refresh_Texture* Refresh_AcquireSwapchainTexture(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh_TextureFormat Refresh_GetSwapchainFormat(
|
|
||||||
Refresh_Device *device,
|
|
||||||
void *windowHandle
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->GetSwapchainFormat(
|
|
||||||
device->driverData,
|
|
||||||
windowHandle
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_SetSwapchainPresentMode(
|
|
||||||
Refresh_Device *device,
|
|
||||||
void *windowHandle,
|
|
||||||
Refresh_PresentMode presentMode
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->SetSwapchainPresentMode(
|
|
||||||
device->driverData,
|
|
||||||
windowHandle,
|
|
||||||
presentMode
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_Submit(
|
void Refresh_Submit(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer
|
||||||
|
|
|
@ -181,7 +181,153 @@ struct Refresh_Device
|
||||||
|
|
||||||
void (*DestroyDevice)(Refresh_Device *device);
|
void (*DestroyDevice)(Refresh_Device *device);
|
||||||
|
|
||||||
/* Drawing */
|
/* State Creation */
|
||||||
|
|
||||||
|
Refresh_ComputePipeline* (*CreateComputePipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_ComputeShaderInfo *computeShaderInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
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_GpuBuffer* (*CreateGpuBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_BufferUsageFlags usageFlags,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_CpuBuffer* (*CreateCpuBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Disposal */
|
||||||
|
|
||||||
|
void (*QueueDestroyTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_Texture *texture
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroySampler)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_Sampler *sampler
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroyGpuBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_GpuBuffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroyCpuBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CpuBuffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroyShaderModule)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_ShaderModule *shaderModule
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroyComputePipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_ComputePipeline *computePipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroyGraphicsPipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Render Pass */
|
||||||
|
|
||||||
|
void (*BeginRenderPass)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
||||||
|
uint32_t colorAttachmentCount,
|
||||||
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*BindGraphicsPipeline)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*SetViewport)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Viewport *viewport
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*SetScissor)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Rect *scissor
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*BindVertexBuffers)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t firstBinding,
|
||||||
|
uint32_t bindingCount,
|
||||||
|
Refresh_GpuBuffer **pBuffers,
|
||||||
|
uint64_t *pOffsets
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*BindIndexBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
uint64_t offset,
|
||||||
|
Refresh_IndexElementSize indexElementSize
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
void (*DrawInstancedPrimitives)(
|
void (*DrawInstancedPrimitives)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
|
@ -216,7 +362,7 @@ struct Refresh_Device
|
||||||
void (*DrawPrimitivesIndirect)(
|
void (*DrawPrimitivesIndirect)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_GpuBuffer *buffer,
|
||||||
uint32_t offsetInBytes,
|
uint32_t offsetInBytes,
|
||||||
uint32_t drawCount,
|
uint32_t drawCount,
|
||||||
uint32_t stride,
|
uint32_t stride,
|
||||||
|
@ -224,225 +370,15 @@ struct Refresh_Device
|
||||||
uint32_t fragmentParamOffset
|
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_ComputeShaderInfo *computeShaderInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
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_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 *yDataPtr,
|
|
||||||
void *uDataPtr,
|
|
||||||
void *vDataPtr,
|
|
||||||
uint32_t yDataLength,
|
|
||||||
uint32_t uvDataLength,
|
|
||||||
uint32_t yStride,
|
|
||||||
uint32_t uvStride
|
|
||||||
);
|
|
||||||
|
|
||||||
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_Texture *texture
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*QueueDestroySampler)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_Sampler *sampler
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*QueueDestroyBuffer)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_Buffer *buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*QueueDestroyShaderModule)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_ShaderModule *shaderModule
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*QueueDestroyComputePipeline)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_ComputePipeline *computePipeline
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*QueueDestroyGraphicsPipeline)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Graphics State */
|
|
||||||
|
|
||||||
void (*BeginRenderPass)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
||||||
uint32_t colorAttachmentCount,
|
|
||||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*EndRenderPass)(
|
void (*EndRenderPass)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*SetViewport)(
|
/* Compute Pass */
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Viewport *viewport
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*SetScissor)(
|
void (*BeginComputePass)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Rect *scissor
|
|
||||||
);
|
|
||||||
|
|
||||||
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 (*BindIndexBuffer)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint64_t offset,
|
|
||||||
Refresh_IndexElementSize indexElementSize
|
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*BindComputePipeline)(
|
void (*BindComputePipeline)(
|
||||||
|
@ -454,15 +390,131 @@ struct Refresh_Device
|
||||||
void (*BindComputeBuffers)(
|
void (*BindComputeBuffers)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer **pBuffers
|
Refresh_GpuBuffer **pBuffers
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*BindComputeTextures)(
|
void (*BindComputeTextures)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Texture **pTextures
|
Refresh_Texture **pTextures,
|
||||||
|
uint32_t **pLevels
|
||||||
);
|
);
|
||||||
|
|
||||||
|
uint32_t (*PushComputeShaderUniforms)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
void *data,
|
||||||
|
uint32_t dataLengthInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*DispatchCompute)(
|
||||||
|
Refresh_Renderer *device,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
uint32_t groupCountX,
|
||||||
|
uint32_t groupCountY,
|
||||||
|
uint32_t groupCountZ,
|
||||||
|
uint32_t computeParamOffset
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*EndComputePass)(
|
||||||
|
Refresh_Renderer *driverData
|
||||||
|
);
|
||||||
|
|
||||||
|
/* CpuBuffer map/unmap */
|
||||||
|
|
||||||
|
void* (*MapCpuBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CpuBuffer *buffer,
|
||||||
|
uint32_t offsetInBytes,
|
||||||
|
uint32_t sizeInBytes
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*UnmapCpuBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CpuBuffer *buffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Copy Pass */
|
||||||
|
|
||||||
|
void (*BeginCopyPass)(
|
||||||
|
Refresh_Renderer *driverData
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*UploadToTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams,
|
||||||
|
Refresh_TextureSlice *textureSlice
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*UploadToBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*DownloadFromTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*DownloadFromBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *gpuBuffer,
|
||||||
|
Refresh_CpuBuffer *cpuBuffer,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*CopyTextureToTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *source,
|
||||||
|
Refresh_TextureSlice *destination
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*CopyTextureToBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_TextureSlice *textureSlice,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
Refresh_BufferImageCopy *copyParameters
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*CopyBufferToTexture)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *buffer,
|
||||||
|
Refresh_BufferImageCopy *copyParams,
|
||||||
|
Refresh_TextureSlice *textureSlice
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*CopyBufferToBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GpuBuffer *source,
|
||||||
|
Refresh_GpuBuffer *destination,
|
||||||
|
Refresh_BufferCopy *copyParams
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*GenerateMipmaps)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_Texture *texture
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*EndCopyPass)(
|
||||||
|
Refresh_Renderer *driverData
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Submission/Presentation */
|
||||||
|
|
||||||
uint8_t (*ClaimWindow)(
|
uint8_t (*ClaimWindow)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
void *windowHandle,
|
void *windowHandle,
|
||||||
|
@ -474,6 +526,17 @@ struct Refresh_Device
|
||||||
void *windowHandle
|
void *windowHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void (*SetSwapchainPresentMode)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
void *windowHandle,
|
||||||
|
Refresh_PresentMode presentMode
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_TextureFormat (*GetSwapchainFormat)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
void *windowHandle
|
||||||
|
);
|
||||||
|
|
||||||
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
||||||
Refresh_Renderer *driverData
|
Refresh_Renderer *driverData
|
||||||
);
|
);
|
||||||
|
@ -486,17 +549,6 @@ struct Refresh_Device
|
||||||
uint32_t *pHeight
|
uint32_t *pHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
Refresh_TextureFormat (*GetSwapchainFormat)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
void *windowHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*SetSwapchainPresentMode)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
void *windowHandle,
|
|
||||||
Refresh_PresentMode presentMode
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*Submit)(
|
void (*Submit)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer
|
||||||
|
|
Loading…
Reference in New Issue