Resource containers, new bindings API, WriteOptions #51
			
				
			
		
		
		
	|  | @ -327,11 +327,17 @@ typedef enum Refresh_BorderColor | ||||||
| 	REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE | 	REFRESH_BORDERCOLOR_INT_OPAQUE_WHITE | ||||||
| } Refresh_BorderColor; | } Refresh_BorderColor; | ||||||
| 
 | 
 | ||||||
| typedef enum Refresh_SetDataOptions | typedef enum Refresh_TransferOptions | ||||||
| { | { | ||||||
| 	REFRESH_SETDATAOPTIONS_SAFEDISCARD, | 	REFRESH_TRANSFEROPTIONS_SAFEDISCARD, | ||||||
| 	REFRESH_SETDATAOPTIONS_OVERWRITE | 	REFRESH_TRANSFEROPTIONS_OVERWRITE | ||||||
| } Refresh_SetDataOptions; | } Refresh_TransferOptions; | ||||||
|  | 
 | ||||||
|  | typedef enum Refresh_WriteOptions | ||||||
|  | { | ||||||
|  | 	REFRESH_WRITEOPTIONS_SAFEDISCARD, | ||||||
|  | 	REFRESH_WRITEOPTIONS_SAFEOVERWRITE | ||||||
|  | } Refresh_WriteOptions; | ||||||
| 
 | 
 | ||||||
| typedef enum Refresh_Backend | typedef enum Refresh_Backend | ||||||
| { | { | ||||||
|  | @ -379,15 +385,19 @@ typedef struct Refresh_TextureSlice | ||||||
| { | { | ||||||
| 	Refresh_Texture *texture; | 	Refresh_Texture *texture; | ||||||
| 	uint32_t mipLevel; | 	uint32_t mipLevel; | ||||||
| 	uint32_t baseLayer; | 	uint32_t layer; | ||||||
| 	uint32_t layerCount; | } Refresh_TextureSlice; | ||||||
|  | 
 | ||||||
|  | typedef struct Refresh_TextureRegion | ||||||
|  | { | ||||||
|  | 	Refresh_TextureSlice textureSlice; | ||||||
| 	uint32_t x; | 	uint32_t x; | ||||||
| 	uint32_t y; | 	uint32_t y; | ||||||
| 	uint32_t z; | 	uint32_t z; | ||||||
| 	uint32_t w; | 	uint32_t w; | ||||||
| 	uint32_t h; | 	uint32_t h; | ||||||
| 	uint32_t d; | 	uint32_t d; | ||||||
| } Refresh_TextureSlice; | } Refresh_TextureRegion; | ||||||
| 
 | 
 | ||||||
| typedef struct Refresh_BufferImageCopy | typedef struct Refresh_BufferImageCopy | ||||||
| { | { | ||||||
|  | @ -489,6 +499,7 @@ typedef struct Refresh_TextureCreateInfo | ||||||
| 	uint32_t height; | 	uint32_t height; | ||||||
| 	uint32_t depth; | 	uint32_t depth; | ||||||
| 	uint8_t isCube; | 	uint8_t isCube; | ||||||
|  | 	uint32_t layerCount; | ||||||
| 	uint32_t levelCount; | 	uint32_t levelCount; | ||||||
| 	Refresh_SampleCount sampleCount; | 	Refresh_SampleCount sampleCount; | ||||||
| 	Refresh_TextureFormat format; | 	Refresh_TextureFormat format; | ||||||
|  | @ -572,30 +583,91 @@ typedef struct Refresh_GraphicsPipelineCreateInfo | ||||||
| 
 | 
 | ||||||
| /* Render pass structures */ | /* Render pass structures */ | ||||||
| 
 | 
 | ||||||
|  | /* These structures define how textures will be read/written in a render pass.
 | ||||||
|  |  * | ||||||
|  |  * loadOp: Determines what is done with the texture slice at the beginning of the render pass. | ||||||
|  |  * | ||||||
|  |  *   LOAD: | ||||||
|  |  *     Loads the data currently in the texture slice. | ||||||
|  |  * | ||||||
|  |  *   CLEAR: | ||||||
|  |  *     Clears the texture slice to a single color. | ||||||
|  |  * | ||||||
|  |  *   DONT_CARE: | ||||||
|  |  *     The driver will do whatever it wants with the texture slice memory. | ||||||
|  |  *     This is a good option if you know that every single pixel will be touched in the render pass. | ||||||
|  |  * | ||||||
|  |  * storeOp: Determines what is done with the texture slice at the end of the render pass. | ||||||
|  |  * | ||||||
|  |  *   STORE: | ||||||
|  |  *     Stores the results of the render pass in the texture slice. | ||||||
|  |  * | ||||||
|  |  *   DONT_CARE: | ||||||
|  |  *     The driver will do whatever it wants with the texture slice memory. | ||||||
|  |  *     This is often a good option for depth/stencil textures. | ||||||
|  |  * | ||||||
|  |  * | ||||||
|  |  * writeOption is ignored if loadOp is LOAD and is implicitly assumed to be SAFEOVERWRITE. | ||||||
|  |  * Interleaving LOAD and SAFEDISCARD successively on the same texture (not slice!) is undefined behavior. | ||||||
|  |  * | ||||||
|  |  * writeOption: | ||||||
|  |  *  SAFEDISCARD: | ||||||
|  |  *    If this texture slice has been used in commands that have not completed, | ||||||
|  |  *    this option will prevent a data dependency at the cost of increased memory usage. | ||||||
|  |  *    You may NOT assume that any of the previous texture data is retained. | ||||||
|  |  *    If the texture slice was not in use, this option is equivalent to SAFEOVERWRITE. | ||||||
|  |  *    This is a good option to prevent stalls when frequently reusing a texture slice in rendering. | ||||||
|  |  * | ||||||
|  |  *  SAFEOVERWRITE: | ||||||
|  |  *    Overwrites the data safely using a GPU memory barrier. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| typedef struct Refresh_ColorAttachmentInfo | typedef struct Refresh_ColorAttachmentInfo | ||||||
| { | { | ||||||
| 	Refresh_Texture *texture; /* We can't use TextureSlice because render passes take a single rectangle. */ | 	Refresh_TextureSlice textureSlice; | ||||||
| 	uint32_t depth; | 	Refresh_Vec4 clearColor; /* Can be ignored by RenderPass if CLEAR is not used */ | ||||||
| 	uint32_t layer; |  | ||||||
| 	uint32_t level; |  | ||||||
| 	Refresh_Vec4 clearColor; /* Can be ignored by RenderPass */ |  | ||||||
| 	Refresh_LoadOp loadOp; | 	Refresh_LoadOp loadOp; | ||||||
| 	Refresh_StoreOp storeOp; | 	Refresh_StoreOp storeOp; | ||||||
|  | 	Refresh_WriteOptions writeOption; | ||||||
| } Refresh_ColorAttachmentInfo; | } Refresh_ColorAttachmentInfo; | ||||||
| 
 | 
 | ||||||
| typedef struct Refresh_DepthStencilAttachmentInfo | typedef struct Refresh_DepthStencilAttachmentInfo | ||||||
| { | { | ||||||
| 	Refresh_Texture *texture; /* We can't use TextureSlice because render passes take a single rectangle. */ | 	Refresh_TextureSlice textureSlice; | ||||||
| 	uint32_t depth; | 	Refresh_DepthStencilValue depthStencilClearValue; /* Can be ignored by RenderPass if CLEAR is not used */ | ||||||
| 	uint32_t layer; |  | ||||||
| 	uint32_t level; |  | ||||||
| 	Refresh_DepthStencilValue depthStencilClearValue; /* Can be ignored by RenderPass */ |  | ||||||
| 	Refresh_LoadOp loadOp; | 	Refresh_LoadOp loadOp; | ||||||
| 	Refresh_StoreOp storeOp; | 	Refresh_StoreOp storeOp; | ||||||
| 	Refresh_LoadOp stencilLoadOp; | 	Refresh_LoadOp stencilLoadOp; | ||||||
| 	Refresh_StoreOp stencilStoreOp; | 	Refresh_StoreOp stencilStoreOp; | ||||||
|  | 	Refresh_WriteOptions writeOption; | ||||||
| } Refresh_DepthStencilAttachmentInfo; | } Refresh_DepthStencilAttachmentInfo; | ||||||
| 
 | 
 | ||||||
|  | /* Binding structs */ | ||||||
|  | 
 | ||||||
|  | typedef struct Refresh_BufferBinding | ||||||
|  | { | ||||||
|  | 	Refresh_GpuBuffer *gpuBuffer; | ||||||
|  | 	uint32_t offset; | ||||||
|  | } Refresh_BufferBinding; | ||||||
|  | 
 | ||||||
|  | typedef struct Refresh_TextureSamplerBinding | ||||||
|  | { | ||||||
|  | 	Refresh_Texture *texture; | ||||||
|  | 	Refresh_Sampler *sampler; | ||||||
|  | } Refresh_TextureSamplerBinding; | ||||||
|  | 
 | ||||||
|  | typedef struct Refresh_ComputeBufferBinding | ||||||
|  | { | ||||||
|  | 	Refresh_GpuBuffer *gpuBuffer; | ||||||
|  | 	Refresh_WriteOptions writeOption; | ||||||
|  | } Refresh_ComputeBufferBinding; | ||||||
|  | 
 | ||||||
|  | typedef struct Refresh_ComputeTextureBinding | ||||||
|  | { | ||||||
|  | 	Refresh_TextureSlice textureSlice; | ||||||
|  | 	Refresh_WriteOptions writeOption; | ||||||
|  | } Refresh_ComputeTextureBinding; | ||||||
|  | 
 | ||||||
| /* Functions */ | /* Functions */ | ||||||
| 
 | 
 | ||||||
| /* Logging */ | /* Logging */ | ||||||
|  | @ -821,49 +893,43 @@ REFRESHAPI void Refresh_BindVertexBuffers( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	uint32_t firstBinding, | 	uint32_t firstBinding, | ||||||
| 	uint32_t bindingCount, | 	uint32_t bindingCount, | ||||||
| 	Refresh_GpuBuffer **pBuffers, | 	Refresh_BufferBinding *pBindings | ||||||
| 	uint64_t *pOffsets |  | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Binds an index buffer for use with subsequent draw calls. */ | /* Binds an index buffer for use with subsequent draw calls. */ | ||||||
| REFRESHAPI void Refresh_BindIndexBuffer( | REFRESHAPI void Refresh_BindIndexBuffer( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_BufferBinding *pBinding, | ||||||
| 	uint64_t offset, |  | ||||||
| 	Refresh_IndexElementSize indexElementSize | 	Refresh_IndexElementSize indexElementSize | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Sets textures/samplers for use with the currently bound vertex shader.
 | /* Sets textures/samplers for use with the currently bound vertex shader.
 | ||||||
|  * |  * | ||||||
|  * NOTE: |  * NOTE: | ||||||
|  * 		The length of the passed arrays must be equal to the number |  * 		The length of the bindings array must be equal to the number | ||||||
|  * 		of sampler bindings specified by the pipeline. |  * 		of sampler bindings specified by the pipeline. | ||||||
|  * |  * | ||||||
|  * textures:	A pointer to an array of textures. |  * pBindings:  A pointer to an array of TextureSamplerBindings. | ||||||
|  * samplers:	A pointer to an array of samplers. |  | ||||||
|  */ |  */ | ||||||
| REFRESHAPI void Refresh_BindVertexSamplers( | REFRESHAPI void Refresh_BindVertexSamplers( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_Texture **pTextures, | 	Refresh_TextureSamplerBinding *pBindings | ||||||
| 	Refresh_Sampler **pSamplers |  | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Sets textures/samplers for use with the currently bound fragment shader.
 | /* Sets textures/samplers for use with the currently bound fragment shader.
 | ||||||
|  * |  * | ||||||
|  * NOTE: |  * NOTE: | ||||||
|  *		The length of the passed arrays must be equal to the number |  *		The length of the bindings array must be equal to the number | ||||||
|  * 		of sampler bindings specified by the pipeline. |  * 		of sampler bindings specified by the pipeline. | ||||||
|  * |  * | ||||||
|  * textures: 	A pointer to an array of textures. |  * pBindings:  A pointer to an array of TextureSamplerBindings. | ||||||
|  * samplers:	A pointer to an array of samplers. |  | ||||||
|  */ |  */ | ||||||
| REFRESHAPI void Refresh_BindFragmentSamplers( | REFRESHAPI void Refresh_BindFragmentSamplers( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_Texture **pTextures, | 	Refresh_TextureSamplerBinding *pBindings | ||||||
| 	Refresh_Sampler **pSamplers |  | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Pushes vertex shader uniforms to the device.
 | /* Pushes vertex shader uniforms to the device.
 | ||||||
|  | @ -984,32 +1050,28 @@ REFRESHAPI void Refresh_BindComputePipeline( | ||||||
| 
 | 
 | ||||||
| /* Binds buffers for use with the currently bound compute pipeline.
 | /* Binds buffers for use with the currently bound compute pipeline.
 | ||||||
|  * |  * | ||||||
|  * pBuffers: An array of buffers to bind. |  * pBindings: | ||||||
|  |  *   An array of ComputeBufferBinding structs. | ||||||
|  *   Length must be equal to the number of buffers |  *   Length must be equal to the number of buffers | ||||||
|  *   specified by the compute pipeline. |  *   specified by the compute pipeline. | ||||||
|  */ |  */ | ||||||
| REFRESHAPI void Refresh_BindComputeBuffers( | REFRESHAPI void Refresh_BindComputeBuffers( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer **pBuffers | 	Refresh_ComputeBufferBinding *pBindings | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Binds textures for use with the currently bound compute pipeline.
 | /* Binds textures for use with the currently bound compute pipeline.
 | ||||||
|  * |  * | ||||||
|  * pTextures: An array of textures to bind. |  * pBindings: | ||||||
|  * 	Length must be equal to the number of buffers |  *   An array of ComputeTextureBinding structs. | ||||||
|  * 	specified by the compute pipeline. |  *   Length must be equal to the number of textures | ||||||
|  * |  | ||||||
|  * pLevels: An array of levels to bind, |  | ||||||
|  *   corresponding to the indices in pTextures. |  | ||||||
|  *   Length must be equal to the number of buffers |  | ||||||
|  *   specified by the compute pipeline. |  *   specified by the compute pipeline. | ||||||
|  */ |  */ | ||||||
| REFRESHAPI void Refresh_BindComputeTextures( | REFRESHAPI void Refresh_BindComputeTextures( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_Texture **pTextures, | 	Refresh_ComputeTextureBinding *pBindings | ||||||
| 	uint32_t **pLevels |  | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Pushes compute shader params to the device.
 | /* Pushes compute shader params to the device.
 | ||||||
|  | @ -1053,27 +1115,29 @@ REFRESHAPI void Refresh_EndComputePass( | ||||||
| 
 | 
 | ||||||
| /* Immediately copies data from a pointer into a TransferBuffer.
 | /* Immediately copies data from a pointer into a TransferBuffer.
 | ||||||
|  * |  * | ||||||
|  * option: |  * transferOption: | ||||||
|  *  SAFEDISCARD: |  *  SAFEDISCARD: | ||||||
|  *    If this TransferBuffer has been used in a copy command that has not completed, |  *    If this TransferBuffer has been used in commands that have not completed, | ||||||
|  *    the issued copy commands will still be valid at the cost of increased memory usage. |  *    the issued commands will still be valid at the cost of increased memory usage. | ||||||
|  *    Otherwise the data will overwrite. |  *    You may NOT assume that any of the previous data is retained. | ||||||
|  |  *    If the TransferBuffer was not in use, this option is equivalent to OVERWRITE. | ||||||
|  |  *    This is a good option to prevent stalls when frequently updating data. | ||||||
|  *    It is not recommended to use this option with large TransferBuffers. |  *    It is not recommended to use this option with large TransferBuffers. | ||||||
|  * |  * | ||||||
|  *  OVERWRITE: |  *  OVERWRITE: | ||||||
|  *    Overwrites the data regardless of whether a copy has been issued. |  *    Overwrites the data regardless of whether a command has been issued. | ||||||
|  *    Use this option with great care, as it can cause data races to occur! |  *    Use this option with great care, as it can cause data races to occur! | ||||||
|  */ |  */ | ||||||
| REFRESHAPI void Refresh_SetData( | REFRESHAPI void Refresh_SetTransferData( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	void* data, | 	void* data, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_BufferCopy *copyParams, | 	Refresh_BufferCopy *copyParams, | ||||||
| 	Refresh_SetDataOptions option | 	Refresh_TransferOptions transferOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Immediately copies data from a TransferBuffer into a pointer. */ | /* Immediately copies data from a TransferBuffer into a pointer. */ | ||||||
| REFRESHAPI void Refresh_GetData( | REFRESHAPI void Refresh_GetTransferData( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	void* data, | 	void* data, | ||||||
|  | @ -1093,13 +1157,28 @@ REFRESHAPI void Refresh_BeginCopyPass( | ||||||
|  * You MAY assume that the copy has finished for subsequent commands. |  * You MAY assume that the copy has finished for subsequent commands. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * writeOption: | ||||||
|  |  *  SAFEDISCARD: | ||||||
|  |  *    If the destination resource has been used in commands that have not completed, | ||||||
|  |  *    this option will prevent a data dependency at the cost of increased memory usage. | ||||||
|  |  *    You may NOT assume that any of the previous data is retained. | ||||||
|  |  *    If the destination resource was not in use, this option is equivalent to SAFEOVERWRITE. | ||||||
|  |  * 	  This is a good option to prevent stalls on resources with frequent updates. | ||||||
|  |  *    It is not recommended to use this option with large resources. | ||||||
|  |  * | ||||||
|  |  *  SAFEOVERWRITE: | ||||||
|  |  *    Overwrites the data safely using a GPU memory barrier. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| /* Uploads data from a TransferBuffer to a texture. */ | /* Uploads data from a TransferBuffer to a texture. */ | ||||||
| REFRESHAPI void Refresh_UploadToTexture( | REFRESHAPI void Refresh_UploadToTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Uploads data from a TransferBuffer to a GpuBuffer. */ | /* Uploads data from a TransferBuffer to a GpuBuffer. */ | ||||||
|  | @ -1108,7 +1187,8 @@ REFRESHAPI void Refresh_UploadToBuffer( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* GPU-to-CPU copies occur on the GPU timeline.
 | /* GPU-to-CPU copies occur on the GPU timeline.
 | ||||||
|  | @ -1117,13 +1197,28 @@ REFRESHAPI void Refresh_UploadToBuffer( | ||||||
|  * until the command buffer has finished execution. |  * until the command buffer has finished execution. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * transferOption: | ||||||
|  |  *  SAFEDISCARD: | ||||||
|  |  *    If this TransferBuffer has been used in commands that have not completed, | ||||||
|  |  *    the issued commands will still be valid at the cost of increased memory usage. | ||||||
|  |  *    You may NOT assume that any of the previous data is retained. | ||||||
|  |  *    If the TransferBuffer was not in use, this option is equivalent to OVERWRITE. | ||||||
|  |  *    It is not recommended to use this option with large TransferBuffers. | ||||||
|  |  * | ||||||
|  |  *  OVERWRITE: | ||||||
|  |  *    Overwrites the data regardless of whether a command has been issued. | ||||||
|  |  *    Use this option with great care, as it can cause data races to occur! | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| /* Downloads data from a texture to a TransferBuffer. */ | /* Downloads data from a texture to a TransferBuffer. */ | ||||||
| REFRESHAPI void Refresh_DownloadFromTexture( | REFRESHAPI void Refresh_DownloadFromTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_TransferOptions transferOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Downloads data from a GpuBuffer object. */ | /* Downloads data from a GpuBuffer object. */ | ||||||
|  | @ -1132,28 +1227,45 @@ REFRESHAPI void Refresh_DownloadFromBuffer( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams, | ||||||
|  | 	Refresh_TransferOptions transferOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* GPU-to-GPU copies occur on the GPU timeline,
 | /* GPU-to-GPU copies occur on the GPU timeline,
 | ||||||
|  * and you may assume the copy has finished in subsequent commands. |  * and you may assume the copy has finished in subsequent commands. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * writeOption: | ||||||
|  |  *  SAFEDISCARD: | ||||||
|  |  *    If the destination resource has been used in commands that have not completed, | ||||||
|  |  *    this option will prevent a data dependency at the cost of increased memory usage. | ||||||
|  |  *    You may NOT assume that any of the previous data is retained. | ||||||
|  |  *    If the destination resource was not in use, this option is equivalent to SAFEOVERWRITE. | ||||||
|  |  * 	  This is a good option to prevent stalls on resources with frequent updates. | ||||||
|  |  *    It is not recommended to use this option with large resources. | ||||||
|  |  * | ||||||
|  |  *  SAFEOVERWRITE: | ||||||
|  |  *    Overwrites the data safely using a GPU memory barrier. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| /* Performs a texture-to-texture copy. */ | /* Performs a texture-to-texture copy. */ | ||||||
| REFRESHAPI void Refresh_CopyTextureToTexture( | REFRESHAPI void Refresh_CopyTextureToTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TextureSlice *source, | 	Refresh_TextureRegion *source, | ||||||
| 	Refresh_TextureSlice *destination | 	Refresh_TextureRegion *destination, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Copies image data from a texture slice into a buffer. */ | /* Copies image data from a texture slice into a buffer. */ | ||||||
| REFRESHAPI void Refresh_CopyTextureToBuffer( | REFRESHAPI void Refresh_CopyTextureToBuffer( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Copies data from a buffer to a texture slice. */ | /* Copies data from a buffer to a texture slice. */ | ||||||
|  | @ -1161,8 +1273,9 @@ REFRESHAPI void Refresh_CopyBufferToTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Copies data from a buffer to a buffer. */ | /* Copies data from a buffer to a buffer. */ | ||||||
|  | @ -1171,7 +1284,8 @@ REFRESHAPI void Refresh_CopyBufferToBuffer( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *source, | 	Refresh_GpuBuffer *source, | ||||||
| 	Refresh_GpuBuffer *destination, | 	Refresh_GpuBuffer *destination, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ); | ); | ||||||
| 
 | 
 | ||||||
| /* Generate mipmaps for the given texture. */ | /* Generate mipmaps for the given texture. */ | ||||||
|  |  | ||||||
							
								
								
									
										114
									
								
								src/Refresh.c
								
								
								
								
							
							
						
						
									
										114
									
								
								src/Refresh.c
								
								
								
								
							|  | @ -461,8 +461,7 @@ void Refresh_BindVertexBuffers( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	uint32_t firstBinding, | 	uint32_t firstBinding, | ||||||
| 	uint32_t bindingCount, | 	uint32_t bindingCount, | ||||||
| 	Refresh_GpuBuffer **pBuffers, | 	Refresh_BufferBinding *pBindings | ||||||
| 	uint64_t *pOffsets |  | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->BindVertexBuffers( | 	device->BindVertexBuffers( | ||||||
|  | @ -470,24 +469,21 @@ void Refresh_BindVertexBuffers( | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		firstBinding, | 		firstBinding, | ||||||
| 		bindingCount, | 		bindingCount, | ||||||
| 		pBuffers, | 		pBindings | ||||||
| 		pOffsets |  | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_BindIndexBuffer( | void Refresh_BindIndexBuffer( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_BufferBinding *pBinding, | ||||||
| 	uint64_t offset, |  | ||||||
| 	Refresh_IndexElementSize indexElementSize | 	Refresh_IndexElementSize indexElementSize | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->BindIndexBuffer( | 	device->BindIndexBuffer( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		gpuBuffer, | 		pBinding, | ||||||
| 		offset, |  | ||||||
| 		indexElementSize | 		indexElementSize | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
|  | @ -495,30 +491,26 @@ void Refresh_BindIndexBuffer( | ||||||
| void Refresh_BindVertexSamplers( | void Refresh_BindVertexSamplers( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_Texture **pTextures, | 	Refresh_TextureSamplerBinding *pBindings | ||||||
| 	Refresh_Sampler **pSamplers |  | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->BindVertexSamplers( | 	device->BindVertexSamplers( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		pTextures, | 		pBindings | ||||||
| 		pSamplers |  | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_BindFragmentSamplers( | void Refresh_BindFragmentSamplers( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_Texture **pTextures, | 	Refresh_TextureSamplerBinding *pBindings | ||||||
| 	Refresh_Sampler **pSamplers |  | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->BindFragmentSamplers( | 	device->BindFragmentSamplers( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		pTextures, | 		pBindings | ||||||
| 		pSamplers |  | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -662,28 +654,26 @@ void Refresh_BindComputePipeline( | ||||||
| void Refresh_BindComputeBuffers( | void Refresh_BindComputeBuffers( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer **pBuffers | 	Refresh_ComputeBufferBinding *pBindings | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->BindComputeBuffers( | 	device->BindComputeBuffers( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		pBuffers | 		pBindings | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_BindComputeTextures( | void Refresh_BindComputeTextures( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_Texture **pTextures, | 	Refresh_ComputeTextureBinding *pBindings | ||||||
| 	uint32_t **pLevels |  | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->BindComputeTextures( | 	device->BindComputeTextures( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		pTextures, | 		pBindings | ||||||
| 		pLevels |  | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -732,31 +722,31 @@ void Refresh_EndComputePass( | ||||||
| 
 | 
 | ||||||
| /* TransferBuffer Set/Get */ | /* TransferBuffer Set/Get */ | ||||||
| 
 | 
 | ||||||
| void Refresh_SetData( | void Refresh_SetTransferData( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	void* data, | 	void* data, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_BufferCopy *copyParams, | 	Refresh_BufferCopy *copyParams, | ||||||
| 	Refresh_SetDataOptions option | 	Refresh_TransferOptions transferOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->SetData( | 	device->SetTransferData( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		data, | 		data, | ||||||
| 		transferBuffer, | 		transferBuffer, | ||||||
| 		copyParams, | 		copyParams, | ||||||
| 		option | 		transferOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_GetData( | void Refresh_GetTransferData( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	void* data, | 	void* data, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->GetData( | 	device->GetTransferData( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		transferBuffer, | 		transferBuffer, | ||||||
| 		data, | 		data, | ||||||
|  | @ -781,16 +771,18 @@ void Refresh_UploadToTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->UploadToTexture( | 	device->UploadToTexture( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		transferBuffer, | 		transferBuffer, | ||||||
| 		textureSlice, | 		textureRegion, | ||||||
| 		copyParams | 		copyParams, | ||||||
|  | 		writeOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -799,7 +791,8 @@ void Refresh_UploadToBuffer( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->UploadToBuffer( | 	device->UploadToBuffer( | ||||||
|  | @ -807,24 +800,27 @@ void Refresh_UploadToBuffer( | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		transferBuffer, | 		transferBuffer, | ||||||
| 		gpuBuffer, | 		gpuBuffer, | ||||||
| 		copyParams | 		copyParams, | ||||||
|  | 		writeOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_DownloadFromTexture( | void Refresh_DownloadFromTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_TransferOptions transferOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->DownloadFromTexture( | 	device->DownloadFromTexture( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		textureSlice, | 		textureRegion, | ||||||
| 		transferBuffer, | 		transferBuffer, | ||||||
| 		copyParams | 		copyParams, | ||||||
|  | 		transferOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -833,7 +829,8 @@ void Refresh_DownloadFromBuffer( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_TransferBuffer *transferBuffer, | 	Refresh_TransferBuffer *transferBuffer, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams, | ||||||
|  | 	Refresh_TransferOptions transferOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->DownloadFromBuffer( | 	device->DownloadFromBuffer( | ||||||
|  | @ -841,39 +838,44 @@ void Refresh_DownloadFromBuffer( | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		gpuBuffer, | 		gpuBuffer, | ||||||
| 		transferBuffer, | 		transferBuffer, | ||||||
| 		copyParams | 		copyParams, | ||||||
|  | 		transferOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_CopyTextureToTexture( | void Refresh_CopyTextureToTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TextureSlice *sourceTextureSlice, | 	Refresh_TextureRegion *source, | ||||||
| 	Refresh_TextureSlice *destinationTextureSlice | 	Refresh_TextureRegion *destination, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->CopyTextureToTexture( | 	device->CopyTextureToTexture( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		sourceTextureSlice, | 		source, | ||||||
| 		destinationTextureSlice | 		destination, | ||||||
|  | 		writeOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Refresh_CopyTextureToBuffer( | void Refresh_CopyTextureToBuffer( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_BufferImageCopy *copyParameters | 	Refresh_BufferImageCopy *copyParameters, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->CopyTextureToBuffer( | 	device->CopyTextureToBuffer( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		textureSlice, | 		textureRegion, | ||||||
| 		gpuBuffer, | 		gpuBuffer, | ||||||
| 		copyParameters | 		copyParameters, | ||||||
|  | 		writeOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -881,16 +883,18 @@ void Refresh_CopyBufferToTexture( | ||||||
| 	Refresh_Device *device, | 	Refresh_Device *device, | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *gpuBuffer, | 	Refresh_GpuBuffer *gpuBuffer, | ||||||
| 	Refresh_TextureSlice *textureSlice, | 	Refresh_TextureRegion *textureRegion, | ||||||
| 	Refresh_BufferImageCopy *copyParams | 	Refresh_BufferImageCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->CopyBufferToTexture( | 	device->CopyBufferToTexture( | ||||||
| 		device->driverData, | 		device->driverData, | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		gpuBuffer, | 		gpuBuffer, | ||||||
| 		textureSlice, | 		textureRegion, | ||||||
| 		copyParams | 		copyParams, | ||||||
|  | 		writeOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -899,7 +903,8 @@ void Refresh_CopyBufferToBuffer( | ||||||
| 	Refresh_CommandBuffer *commandBuffer, | 	Refresh_CommandBuffer *commandBuffer, | ||||||
| 	Refresh_GpuBuffer *source, | 	Refresh_GpuBuffer *source, | ||||||
| 	Refresh_GpuBuffer *destination, | 	Refresh_GpuBuffer *destination, | ||||||
| 	Refresh_BufferCopy *copyParams | 	Refresh_BufferCopy *copyParams, | ||||||
|  | 	Refresh_WriteOptions writeOption | ||||||
| ) { | ) { | ||||||
| 	NULL_RETURN(device); | 	NULL_RETURN(device); | ||||||
| 	device->CopyBufferToBuffer( | 	device->CopyBufferToBuffer( | ||||||
|  | @ -907,7 +912,8 @@ void Refresh_CopyBufferToBuffer( | ||||||
| 		commandBuffer, | 		commandBuffer, | ||||||
| 		source, | 		source, | ||||||
| 		destination, | 		destination, | ||||||
| 		copyParams | 		copyParams, | ||||||
|  | 		writeOption | ||||||
| 	); | 	); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -289,30 +289,26 @@ struct Refresh_Device | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		uint32_t firstBinding, | 		uint32_t firstBinding, | ||||||
| 		uint32_t bindingCount, | 		uint32_t bindingCount, | ||||||
| 		Refresh_GpuBuffer **pBuffers, | 		Refresh_BufferBinding *pBindings | ||||||
| 		uint64_t *pOffsets |  | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*BindIndexBuffer)( | 	void (*BindIndexBuffer)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_GpuBuffer *gpuBuffer, | 		Refresh_BufferBinding *pBinding, | ||||||
| 		uint64_t offset, |  | ||||||
| 		Refresh_IndexElementSize indexElementSize | 		Refresh_IndexElementSize indexElementSize | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*BindVertexSamplers)( | 	void (*BindVertexSamplers)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_Texture **pTextures, | 		Refresh_TextureSamplerBinding *pBindings | ||||||
| 		Refresh_Sampler **pSamplers |  | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*BindFragmentSamplers)( | 	void (*BindFragmentSamplers)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_Texture **pTextures, | 		Refresh_TextureSamplerBinding *pBindings | ||||||
| 		Refresh_Sampler **pSamplers |  | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*PushVertexShaderUniforms)( | 	void (*PushVertexShaderUniforms)( | ||||||
|  | @ -383,14 +379,13 @@ struct Refresh_Device | ||||||
| 	void (*BindComputeBuffers)( | 	void (*BindComputeBuffers)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_GpuBuffer **pBuffers | 		Refresh_ComputeBufferBinding *pBindings | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*BindComputeTextures)( | 	void (*BindComputeTextures)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_Texture **pTextures, | 		Refresh_ComputeTextureBinding *pBindings | ||||||
| 		uint32_t **pLevels |  | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*PushComputeShaderUniforms)( | 	void (*PushComputeShaderUniforms)( | ||||||
|  | @ -415,15 +410,15 @@ struct Refresh_Device | ||||||
| 
 | 
 | ||||||
| 	/* TransferBuffer Set/Get */ | 	/* TransferBuffer Set/Get */ | ||||||
| 
 | 
 | ||||||
| 	void (*SetData)( | 	void (*SetTransferData)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		void* data, | 		void* data, | ||||||
| 		Refresh_TransferBuffer *transferBuffer, | 		Refresh_TransferBuffer *transferBuffer, | ||||||
| 		Refresh_BufferCopy *copyParams, | 		Refresh_BufferCopy *copyParams, | ||||||
| 		Refresh_SetDataOptions option | 		Refresh_TransferOptions transferOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*GetData)( | 	void (*GetTransferData)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_TransferBuffer *transferBuffer, | 		Refresh_TransferBuffer *transferBuffer, | ||||||
| 		void* data, | 		void* data, | ||||||
|  | @ -441,8 +436,9 @@ struct Refresh_Device | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_TransferBuffer *transferBuffer, | 		Refresh_TransferBuffer *transferBuffer, | ||||||
| 		Refresh_TextureSlice *textureSlice, | 		Refresh_TextureRegion *textureSlice, | ||||||
| 		Refresh_BufferImageCopy *copyParams | 		Refresh_BufferImageCopy *copyParams, | ||||||
|  | 		Refresh_WriteOptions writeOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*UploadToBuffer)( | 	void (*UploadToBuffer)( | ||||||
|  | @ -450,15 +446,17 @@ struct Refresh_Device | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_TransferBuffer *transferBuffer, | 		Refresh_TransferBuffer *transferBuffer, | ||||||
| 		Refresh_GpuBuffer *gpuBuffer, | 		Refresh_GpuBuffer *gpuBuffer, | ||||||
| 		Refresh_BufferCopy *copyParams | 		Refresh_BufferCopy *copyParams, | ||||||
|  | 		Refresh_WriteOptions writeOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*DownloadFromTexture)( | 	void (*DownloadFromTexture)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_TextureSlice *textureSlice, | 		Refresh_TextureRegion *textureSlice, | ||||||
| 		Refresh_TransferBuffer *transferBuffer, | 		Refresh_TransferBuffer *transferBuffer, | ||||||
| 		Refresh_BufferImageCopy *copyParams | 		Refresh_BufferImageCopy *copyParams, | ||||||
|  | 		Refresh_TransferOptions transferOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*DownloadFromBuffer)( | 	void (*DownloadFromBuffer)( | ||||||
|  | @ -466,30 +464,34 @@ struct Refresh_Device | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_GpuBuffer *gpuBuffer, | 		Refresh_GpuBuffer *gpuBuffer, | ||||||
| 		Refresh_TransferBuffer *transferBuffer, | 		Refresh_TransferBuffer *transferBuffer, | ||||||
| 		Refresh_BufferCopy *copyParams | 		Refresh_BufferCopy *copyParams, | ||||||
|  | 		Refresh_TransferOptions transferOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*CopyTextureToTexture)( | 	void (*CopyTextureToTexture)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_TextureSlice *source, | 		Refresh_TextureRegion *source, | ||||||
| 		Refresh_TextureSlice *destination | 		Refresh_TextureRegion *destination, | ||||||
|  | 		Refresh_WriteOptions writeOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*CopyTextureToBuffer)( | 	void (*CopyTextureToBuffer)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_TextureSlice *textureSlice, | 		Refresh_TextureRegion *textureSlice, | ||||||
| 		Refresh_GpuBuffer *gpuBuffer, | 		Refresh_GpuBuffer *gpuBuffer, | ||||||
| 		Refresh_BufferImageCopy *copyParams | 		Refresh_BufferImageCopy *copyParams, | ||||||
|  | 		Refresh_WriteOptions writeOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*CopyBufferToTexture)( | 	void (*CopyBufferToTexture)( | ||||||
| 		Refresh_Renderer *driverData, | 		Refresh_Renderer *driverData, | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_GpuBuffer *gpuBuffer, | 		Refresh_GpuBuffer *gpuBuffer, | ||||||
| 		Refresh_TextureSlice *textureSlice, | 		Refresh_TextureRegion *textureSlice, | ||||||
| 		Refresh_BufferImageCopy *copyParams | 		Refresh_BufferImageCopy *copyParams, | ||||||
|  | 		Refresh_WriteOptions writeOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*CopyBufferToBuffer)( | 	void (*CopyBufferToBuffer)( | ||||||
|  | @ -497,7 +499,8 @@ struct Refresh_Device | ||||||
| 		Refresh_CommandBuffer *commandBuffer, | 		Refresh_CommandBuffer *commandBuffer, | ||||||
| 		Refresh_GpuBuffer *source, | 		Refresh_GpuBuffer *source, | ||||||
| 		Refresh_GpuBuffer *destination, | 		Refresh_GpuBuffer *destination, | ||||||
| 		Refresh_BufferCopy *copyParams | 		Refresh_BufferCopy *copyParams, | ||||||
|  | 		Refresh_WriteOptions writeOption | ||||||
| 	); | 	); | ||||||
| 
 | 
 | ||||||
| 	void (*GenerateMipmaps)( | 	void (*GenerateMipmaps)( | ||||||
|  | @ -622,8 +625,8 @@ struct Refresh_Device | ||||||
| 	ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \ | 	ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(DispatchCompute, name) \ | 	ASSIGN_DRIVER_FUNC(DispatchCompute, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(EndComputePass, name) \ | 	ASSIGN_DRIVER_FUNC(EndComputePass, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(SetData, name) \ | 	ASSIGN_DRIVER_FUNC(SetTransferData, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(GetData, name) \ | 	ASSIGN_DRIVER_FUNC(GetTransferData, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(BeginCopyPass, name) \ | 	ASSIGN_DRIVER_FUNC(BeginCopyPass, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(UploadToTexture, name) \ | 	ASSIGN_DRIVER_FUNC(UploadToTexture, name) \ | ||||||
| 	ASSIGN_DRIVER_FUNC(UploadToBuffer, name) \ | 	ASSIGN_DRIVER_FUNC(UploadToBuffer, name) \ | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue