Compare commits

..

No commits in common. "abi_break" and "main" have entirely different histories.

7 changed files with 3762 additions and 3698 deletions

File diff suppressed because it is too large Load Diff

View File

@ -63,20 +63,6 @@ REFRESHAPI uint8_t* Refresh_Image_Load(
int32_t *len int32_t *len
); );
/* Get image dimensions without fully decoding the image.
*
* w: Filled with the width of the image.
* h: Filled with the height of the image.
* len: Filled with the length of pixel data in bytes.
*/
REFRESHAPI uint8_t Refresh_Image_Info(
uint8_t *bufferPtr,
int32_t bufferLength,
int32_t *w,
int32_t *h,
int32_t *len
);
/* Frees memory returned by Refresh_Image_Load. Do NOT free the memory yourself! /* Frees memory returned by Refresh_Image_Load. Do NOT free the memory yourself!
* *
* mem: A pointer previously returned by Refresh_Image_LoadPNG. * mem: A pointer previously returned by Refresh_Image_LoadPNG.

View File

@ -2,9 +2,9 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<TargetName>refreshc</TargetName> <TargetName>refreshc</TargetName>
<PublishAot>true</PublishAot> <PublishAot>true</PublishAot>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -196,7 +196,110 @@ void Refresh_DestroyDevice(Refresh_Device *device)
device->DestroyDevice(device); device->DestroyDevice(device);
} }
/* State Creation */ 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_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,
@ -295,31 +398,215 @@ Refresh_Texture* Refresh_CreateTexture(
); );
} }
Refresh_GpuBuffer* Refresh_CreateGpuBuffer( Refresh_Buffer* Refresh_CreateBuffer(
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->CreateGpuBuffer( return device->CreateBuffer(
device->driverData, device->driverData,
usageFlags, usageFlags,
sizeInBytes sizeInBytes
); );
} }
Refresh_TransferBuffer* Refresh_CreateTransferBuffer( void Refresh_SetTextureData(
Refresh_Device *device, Refresh_Device *device,
uint32_t sizeInBytes Refresh_CommandBuffer *commandBuffer,
Refresh_TextureSlice *textureSlice,
void *data,
uint32_t dataLengthInBytes
) { ) {
NULL_RETURN_NULL(device); NULL_RETURN(device);
return device->CreateTransferBuffer( device->SetTextureData(
device->driverData, device->driverData,
sizeInBytes commandBuffer,
textureSlice,
data,
dataLengthInBytes
); );
} }
/* Disposal */ void Refresh_SetTextureDataYUV(
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,
@ -343,25 +630,14 @@ void Refresh_QueueDestroySampler(
); );
} }
void Refresh_QueueDestroyGpuBuffer( void Refresh_QueueDestroyBuffer(
Refresh_Device *device, Refresh_Device *device,
Refresh_GpuBuffer *gpuBuffer Refresh_Buffer *buffer
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->QueueDestroyGpuBuffer( device->QueueDestroyBuffer(
device->driverData, device->driverData,
gpuBuffer buffer
);
}
void Refresh_QueueDestroyTransferBuffer(
Refresh_Device *device,
Refresh_TransferBuffer *transferBuffer
) {
NULL_RETURN(device);
device->QueueDestroyTransferBuffer(
device->driverData,
transferBuffer
); );
} }
@ -398,8 +674,6 @@ void Refresh_QueueDestroyGraphicsPipeline(
); );
} }
/* Render Pass */
void Refresh_BeginRenderPass( void Refresh_BeginRenderPass(
Refresh_Device *device, Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
@ -417,16 +691,14 @@ void Refresh_BeginRenderPass(
); );
} }
void Refresh_BindGraphicsPipeline( void Refresh_EndRenderPass(
Refresh_Device *device, Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer
Refresh_GraphicsPipeline *graphicsPipeline
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindGraphicsPipeline( device->EndRenderPass(
device->driverData, device->driverData,
commandBuffer, commandBuffer
graphicsPipeline
); );
} }
@ -456,12 +728,26 @@ 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_BufferBinding *pBindings Refresh_Buffer **pBuffers,
uint64_t *pOffsets
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindVertexBuffers( device->BindVertexBuffers(
@ -469,175 +755,28 @@ void Refresh_BindVertexBuffers(
commandBuffer, commandBuffer,
firstBinding, firstBinding,
bindingCount, bindingCount,
pBindings pBuffers,
pOffsets
); );
} }
void Refresh_BindIndexBuffer( void Refresh_BindIndexBuffer(
Refresh_Device *device, Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
Refresh_BufferBinding *pBinding, Refresh_Buffer *buffer,
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,
pBinding, buffer,
offset,
indexElementSize indexElementSize
); );
} }
void Refresh_BindVertexSamplers(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureSamplerBinding *pBindings
) {
NULL_RETURN(device);
device->BindVertexSamplers(
device->driverData,
commandBuffer,
pBindings
);
}
void Refresh_BindFragmentSamplers(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureSamplerBinding *pBindings
) {
NULL_RETURN(device);
device->BindFragmentSamplers(
device->driverData,
commandBuffer,
pBindings
);
}
void Refresh_PushVertexShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
void *data,
uint32_t dataLengthInBytes
) {
NULL_RETURN(device);
device->PushVertexShaderUniforms(
device->driverData,
commandBuffer,
data,
dataLengthInBytes
);
}
void Refresh_PushFragmentShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
void *data,
uint32_t dataLengthInBytes
) {
NULL_RETURN(device);
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
) {
NULL_RETURN(device);
device->DrawInstancedPrimitives(
device->driverData,
commandBuffer,
baseVertex,
startIndex,
primitiveCount,
instanceCount
);
}
void Refresh_DrawIndexedPrimitives(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t startIndex,
uint32_t primitiveCount
) {
NULL_RETURN(device);
device->DrawIndexedPrimitives(
device->driverData,
commandBuffer,
baseVertex,
startIndex,
primitiveCount
);
}
void Refresh_DrawPrimitives(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
uint32_t vertexStart,
uint32_t primitiveCount
) {
NULL_RETURN(device);
device->DrawPrimitives(
device->driverData,
commandBuffer,
vertexStart,
primitiveCount
);
}
void Refresh_DrawPrimitivesIndirect(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *gpuBuffer,
uint32_t offsetInBytes,
uint32_t drawCount,
uint32_t stride
) {
NULL_RETURN(device);
device->DrawPrimitivesIndirect(
device->driverData,
commandBuffer,
gpuBuffer,
offsetInBytes,
drawCount,
stride
);
}
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,
Refresh_CommandBuffer *commandBuffer
) {
NULL_RETURN(device);
device->BeginComputePass(
device->driverData,
commandBuffer
);
}
void Refresh_BindComputePipeline( void Refresh_BindComputePipeline(
Refresh_Device *device, Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
@ -654,295 +793,29 @@ void Refresh_BindComputePipeline(
void Refresh_BindComputeBuffers( void Refresh_BindComputeBuffers(
Refresh_Device *device, Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
Refresh_ComputeBufferBinding *pBindings Refresh_Buffer **pBuffers
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindComputeBuffers( device->BindComputeBuffers(
device->driverData, device->driverData,
commandBuffer, commandBuffer,
pBindings pBuffers
); );
} }
void Refresh_BindComputeTextures( void Refresh_BindComputeTextures(
Refresh_Device *device, Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
Refresh_ComputeTextureBinding *pBindings Refresh_Texture **pTextures
) { ) {
NULL_RETURN(device); NULL_RETURN(device);
device->BindComputeTextures( device->BindComputeTextures(
device->driverData, device->driverData,
commandBuffer, commandBuffer,
pBindings pTextures
); );
} }
void Refresh_PushComputeShaderUniforms(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
void *data,
uint32_t dataLengthInBytes
) {
NULL_RETURN(device);
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
) {
NULL_RETURN(device);
device->DispatchCompute(
device->driverData,
commandBuffer,
groupCountX,
groupCountY,
groupCountZ
);
}
void Refresh_EndComputePass(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer
) {
NULL_RETURN(device);
device->EndComputePass(
device->driverData,
commandBuffer
);
}
/* TransferBuffer Set/Get */
void Refresh_SetTransferData(
Refresh_Device *device,
void* data,
Refresh_TransferBuffer *transferBuffer,
Refresh_BufferCopy *copyParams,
Refresh_TransferOptions transferOption
) {
NULL_RETURN(device);
device->SetTransferData(
device->driverData,
data,
transferBuffer,
copyParams,
transferOption
);
}
void Refresh_GetTransferData(
Refresh_Device *device,
Refresh_TransferBuffer *transferBuffer,
void* data,
Refresh_BufferCopy *copyParams
) {
NULL_RETURN(device);
device->GetTransferData(
device->driverData,
transferBuffer,
data,
copyParams
);
}
/* Copy Pass */
void Refresh_BeginCopyPass(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer
) {
NULL_RETURN(device);
device->BeginCopyPass(
device->driverData,
commandBuffer
);
}
void Refresh_UploadToTexture(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TransferBuffer *transferBuffer,
Refresh_TextureRegion *textureRegion,
Refresh_BufferImageCopy *copyParams,
Refresh_WriteOptions writeOption
) {
NULL_RETURN(device);
device->UploadToTexture(
device->driverData,
commandBuffer,
transferBuffer,
textureRegion,
copyParams,
writeOption
);
}
void Refresh_UploadToBuffer(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TransferBuffer *transferBuffer,
Refresh_GpuBuffer *gpuBuffer,
Refresh_BufferCopy *copyParams,
Refresh_WriteOptions writeOption
) {
NULL_RETURN(device);
device->UploadToBuffer(
device->driverData,
commandBuffer,
transferBuffer,
gpuBuffer,
copyParams,
writeOption
);
}
void Refresh_DownloadFromTexture(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureRegion *textureRegion,
Refresh_TransferBuffer *transferBuffer,
Refresh_BufferImageCopy *copyParams,
Refresh_TransferOptions transferOption
) {
NULL_RETURN(device);
device->DownloadFromTexture(
device->driverData,
commandBuffer,
textureRegion,
transferBuffer,
copyParams,
transferOption
);
}
void Refresh_DownloadFromBuffer(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *gpuBuffer,
Refresh_TransferBuffer *transferBuffer,
Refresh_BufferCopy *copyParams,
Refresh_TransferOptions transferOption
) {
NULL_RETURN(device);
device->DownloadFromBuffer(
device->driverData,
commandBuffer,
gpuBuffer,
transferBuffer,
copyParams,
transferOption
);
}
void Refresh_CopyTextureToTexture(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureRegion *source,
Refresh_TextureRegion *destination,
Refresh_WriteOptions writeOption
) {
NULL_RETURN(device);
device->CopyTextureToTexture(
device->driverData,
commandBuffer,
source,
destination,
writeOption
);
}
void Refresh_CopyTextureToBuffer(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureRegion *textureRegion,
Refresh_GpuBuffer *gpuBuffer,
Refresh_BufferImageCopy *copyParameters,
Refresh_WriteOptions writeOption
) {
NULL_RETURN(device);
device->CopyTextureToBuffer(
device->driverData,
commandBuffer,
textureRegion,
gpuBuffer,
copyParameters,
writeOption
);
}
void Refresh_CopyBufferToTexture(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *gpuBuffer,
Refresh_TextureRegion *textureRegion,
Refresh_BufferImageCopy *copyParams,
Refresh_WriteOptions writeOption
) {
NULL_RETURN(device);
device->CopyBufferToTexture(
device->driverData,
commandBuffer,
gpuBuffer,
textureRegion,
copyParams,
writeOption
);
}
void Refresh_CopyBufferToBuffer(
Refresh_Device *device,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *source,
Refresh_GpuBuffer *destination,
Refresh_BufferCopy *copyParams,
Refresh_WriteOptions writeOption
) {
NULL_RETURN(device);
device->CopyBufferToBuffer(
device->driverData,
commandBuffer,
source,
destination,
copyParams,
writeOption
);
}
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,
Refresh_CommandBuffer *commandBuffer
) {
NULL_RETURN(device);
device->EndCopyPass(
device->driverData,
commandBuffer
);
}
/* Submission/Presentation */
uint8_t Refresh_ClaimWindow( uint8_t Refresh_ClaimWindow(
Refresh_Device *device, Refresh_Device *device,
void *windowHandle, void *windowHandle,
@ -967,30 +840,6 @@ 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
) { ) {
@ -1017,6 +866,30 @@ 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

View File

@ -181,6 +181,58 @@ struct Refresh_Device
void (*DestroyDevice)(Refresh_Device *device); void (*DestroyDevice)(Refresh_Device *device);
/* Drawing */
void (*DrawInstancedPrimitives)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t startIndex,
uint32_t primitiveCount,
uint32_t instanceCount,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
);
void (*DrawIndexedPrimitives)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t startIndex,
uint32_t primitiveCount,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
);
void (*DrawPrimitives)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
uint32_t vertexStart,
uint32_t primitiveCount,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
);
void (*DrawPrimitivesIndirect)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Buffer *buffer,
uint32_t offsetInBytes,
uint32_t drawCount,
uint32_t stride,
uint32_t vertexParamOffset,
uint32_t fragmentParamOffset
);
void (*DispatchCompute)(
Refresh_Renderer *device,
Refresh_CommandBuffer *commandBuffer,
uint32_t groupCountX,
uint32_t groupCountY,
uint32_t groupCountZ,
uint32_t computeParamOffset
);
/* State Creation */ /* State Creation */
Refresh_ComputePipeline* (*CreateComputePipeline)( Refresh_ComputePipeline* (*CreateComputePipeline)(
@ -208,15 +260,107 @@ struct Refresh_Device
Refresh_TextureCreateInfo *textureCreateInfo Refresh_TextureCreateInfo *textureCreateInfo
); );
Refresh_GpuBuffer* (*CreateGpuBuffer)( Refresh_Buffer* (*CreateBuffer)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_BufferUsageFlags usageFlags, Refresh_BufferUsageFlags usageFlags,
uint32_t sizeInBytes uint32_t sizeInBytes
); );
Refresh_TransferBuffer* (*CreateTransferBuffer)( /* Setters */
void (*SetTextureData)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
uint32_t sizeInBytes 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 */ /* Disposal */
@ -231,14 +375,9 @@ struct Refresh_Device
Refresh_Sampler *sampler Refresh_Sampler *sampler
); );
void (*QueueDestroyGpuBuffer)( void (*QueueDestroyBuffer)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_GpuBuffer *gpuBuffer Refresh_Buffer *buffer
);
void (*QueueDestroyTransferBuffer)(
Refresh_Renderer *driverData,
Refresh_TransferBuffer *transferBuffer
); );
void (*QueueDestroyShaderModule)( void (*QueueDestroyShaderModule)(
@ -256,7 +395,7 @@ struct Refresh_Device
Refresh_GraphicsPipeline *graphicsPipeline Refresh_GraphicsPipeline *graphicsPipeline
); );
/* Render Pass */ /* Graphics State */
void (*BeginRenderPass)( void (*BeginRenderPass)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
@ -266,10 +405,9 @@ struct Refresh_Device
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
); );
void (*BindGraphicsPipeline)( void (*EndRenderPass)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer
Refresh_GraphicsPipeline *graphicsPipeline
); );
void (*SetViewport)( void (*SetViewport)(
@ -284,92 +422,29 @@ struct Refresh_Device
Refresh_Rect *scissor Refresh_Rect *scissor
); );
void (*BindGraphicsPipeline)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GraphicsPipeline *graphicsPipeline
);
void (*BindVertexBuffers)( void (*BindVertexBuffers)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
uint32_t firstBinding, uint32_t firstBinding,
uint32_t bindingCount, uint32_t bindingCount,
Refresh_BufferBinding *pBindings Refresh_Buffer **pBuffers,
uint64_t *pOffsets
); );
void (*BindIndexBuffer)( void (*BindIndexBuffer)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
Refresh_BufferBinding *pBinding, Refresh_Buffer *buffer,
uint64_t offset,
Refresh_IndexElementSize indexElementSize Refresh_IndexElementSize indexElementSize
); );
void (*BindVertexSamplers)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureSamplerBinding *pBindings
);
void (*BindFragmentSamplers)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureSamplerBinding *pBindings
);
void (*PushVertexShaderUniforms)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
void *data,
uint32_t dataLengthInBytes
);
void (*PushFragmentShaderUniforms)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
void *data,
uint32_t dataLengthInBytes
);
void (*DrawInstancedPrimitives)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t startIndex,
uint32_t primitiveCount,
uint32_t instanceCount
);
void (*DrawIndexedPrimitives)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
uint32_t baseVertex,
uint32_t startIndex,
uint32_t primitiveCount
);
void (*DrawPrimitives)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
uint32_t vertexStart,
uint32_t primitiveCount
);
void (*DrawPrimitivesIndirect)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *gpuBuffer,
uint32_t offsetInBytes,
uint32_t drawCount,
uint32_t stride
);
void (*EndRenderPass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer
);
/* Compute Pass */
void (*BeginComputePass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer
);
void (*BindComputePipeline)( void (*BindComputePipeline)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
@ -379,143 +454,15 @@ struct Refresh_Device
void (*BindComputeBuffers)( void (*BindComputeBuffers)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
Refresh_ComputeBufferBinding *pBindings Refresh_Buffer **pBuffers
); );
void (*BindComputeTextures)( void (*BindComputeTextures)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer, Refresh_CommandBuffer *commandBuffer,
Refresh_ComputeTextureBinding *pBindings Refresh_Texture **pTextures
); );
void (*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
);
void (*EndComputePass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer
);
/* TransferBuffer Set/Get */
void (*SetTransferData)(
Refresh_Renderer *driverData,
void* data,
Refresh_TransferBuffer *transferBuffer,
Refresh_BufferCopy *copyParams,
Refresh_TransferOptions transferOption
);
void (*GetTransferData)(
Refresh_Renderer *driverData,
Refresh_TransferBuffer *transferBuffer,
void* data,
Refresh_BufferCopy *copyParams
);
/* Copy Pass */
void (*BeginCopyPass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer
);
void (*UploadToTexture)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TransferBuffer *transferBuffer,
Refresh_TextureRegion *textureSlice,
Refresh_BufferImageCopy *copyParams,
Refresh_WriteOptions writeOption
);
void (*UploadToBuffer)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TransferBuffer *transferBuffer,
Refresh_GpuBuffer *gpuBuffer,
Refresh_BufferCopy *copyParams,
Refresh_WriteOptions writeOption
);
void (*DownloadFromTexture)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureRegion *textureSlice,
Refresh_TransferBuffer *transferBuffer,
Refresh_BufferImageCopy *copyParams,
Refresh_TransferOptions transferOption
);
void (*DownloadFromBuffer)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *gpuBuffer,
Refresh_TransferBuffer *transferBuffer,
Refresh_BufferCopy *copyParams,
Refresh_TransferOptions transferOption
);
void (*CopyTextureToTexture)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureRegion *source,
Refresh_TextureRegion *destination,
Refresh_WriteOptions writeOption
);
void (*CopyTextureToBuffer)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_TextureRegion *textureSlice,
Refresh_GpuBuffer *gpuBuffer,
Refresh_BufferImageCopy *copyParams,
Refresh_WriteOptions writeOption
);
void (*CopyBufferToTexture)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *gpuBuffer,
Refresh_TextureRegion *textureSlice,
Refresh_BufferImageCopy *copyParams,
Refresh_WriteOptions writeOption
);
void (*CopyBufferToBuffer)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_GpuBuffer *source,
Refresh_GpuBuffer *destination,
Refresh_BufferCopy *copyParams,
Refresh_WriteOptions writeOption
);
void (*GenerateMipmaps)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer,
Refresh_Texture *texture
);
void (*EndCopyPass)(
Refresh_Renderer *driverData,
Refresh_CommandBuffer *commandBuffer
);
/* Submission/Presentation */
uint8_t (*ClaimWindow)( uint8_t (*ClaimWindow)(
Refresh_Renderer *driverData, Refresh_Renderer *driverData,
void *windowHandle, void *windowHandle,
@ -527,17 +474,6 @@ 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
); );
@ -550,6 +486,17 @@ 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
@ -589,61 +536,50 @@ struct Refresh_Device
result->func = name##_##func; result->func = name##_##func;
#define ASSIGN_DRIVER(name) \ #define ASSIGN_DRIVER(name) \
ASSIGN_DRIVER_FUNC(DestroyDevice, name) \ ASSIGN_DRIVER_FUNC(DestroyDevice, name) \
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawPrimitivesIndirect, name) \
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \ ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \ ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(CreateSampler, name) \ ASSIGN_DRIVER_FUNC(CreateSampler, name) \
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \ ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
ASSIGN_DRIVER_FUNC(CreateTexture, name) \ ASSIGN_DRIVER_FUNC(CreateTexture, name) \
ASSIGN_DRIVER_FUNC(CreateGpuBuffer, name) \ ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
ASSIGN_DRIVER_FUNC(CreateTransferBuffer, name) \ ASSIGN_DRIVER_FUNC(SetTextureData, name) \
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \ ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyGpuBuffer, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyTransferBuffer, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \ ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \ ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \ ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
ASSIGN_DRIVER_FUNC(SetViewport, name) \ ASSIGN_DRIVER_FUNC(SetViewport, name) \
ASSIGN_DRIVER_FUNC(SetScissor, name) \ ASSIGN_DRIVER_FUNC(SetScissor, name) \
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \ ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \ ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
ASSIGN_DRIVER_FUNC(DrawPrimitivesIndirect, name) \
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
ASSIGN_DRIVER_FUNC(BeginComputePass, name) \
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \ ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \ ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \ ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
ASSIGN_DRIVER_FUNC(EndComputePass, name) \
ASSIGN_DRIVER_FUNC(SetTransferData, name) \
ASSIGN_DRIVER_FUNC(GetTransferData, name) \
ASSIGN_DRIVER_FUNC(BeginCopyPass, name) \
ASSIGN_DRIVER_FUNC(UploadToTexture, name) \
ASSIGN_DRIVER_FUNC(UploadToBuffer, name) \
ASSIGN_DRIVER_FUNC(DownloadFromTexture, name) \
ASSIGN_DRIVER_FUNC(DownloadFromBuffer, name) \
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
ASSIGN_DRIVER_FUNC(CopyBufferToTexture, name) \
ASSIGN_DRIVER_FUNC(CopyBufferToBuffer, name) \
ASSIGN_DRIVER_FUNC(GenerateMipmaps, name) \
ASSIGN_DRIVER_FUNC(EndCopyPass, name) \
ASSIGN_DRIVER_FUNC(ClaimWindow, name) \ ASSIGN_DRIVER_FUNC(ClaimWindow, name) \
ASSIGN_DRIVER_FUNC(UnclaimWindow, name) \ ASSIGN_DRIVER_FUNC(UnclaimWindow, name) \
ASSIGN_DRIVER_FUNC(SetSwapchainPresentMode, name) \
ASSIGN_DRIVER_FUNC(GetSwapchainFormat, name) \
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \ ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
ASSIGN_DRIVER_FUNC(AcquireSwapchainTexture, name) \ ASSIGN_DRIVER_FUNC(AcquireSwapchainTexture, name) \
ASSIGN_DRIVER_FUNC(GetSwapchainFormat, name) \
ASSIGN_DRIVER_FUNC(SetSwapchainPresentMode, name) \
ASSIGN_DRIVER_FUNC(Submit, name) \ ASSIGN_DRIVER_FUNC(Submit, name) \
ASSIGN_DRIVER_FUNC(SubmitAndAcquireFence, name) \ ASSIGN_DRIVER_FUNC(SubmitAndAcquireFence, name) \
ASSIGN_DRIVER_FUNC(Wait, name) \ ASSIGN_DRIVER_FUNC(Wait, name) \

File diff suppressed because it is too large Load Diff

View File

@ -218,7 +218,7 @@ uint8_t* Refresh_Image_Load(
* -flibit * -flibit
*/ */
pixels = result; pixels = result;
*len = (*w) * (*h) * 4; *len = (*w) * (*h) *4;
for (i = 0; i < *len; i += 4, pixels += 4) for (i = 0; i < *len; i += 4, pixels += 4)
{ {
if (pixels[3] == 0) if (pixels[3] == 0)
@ -232,34 +232,6 @@ uint8_t* Refresh_Image_Load(
return result; return result;
} }
uint8_t Refresh_Image_Info(
uint8_t *bufferPtr,
int32_t bufferLength,
int32_t *w,
int32_t *h,
int32_t *len
) {
int32_t format;
int32_t result;
result = stbi_info_from_memory(
bufferPtr,
bufferLength,
w,
h,
&format
);
if (result == 0)
{
SDL_LogWarn(SDL_LOG_CATEGORY_ERROR, "Image info failed: %s", stbi_failure_reason());
}
*len = (*w) * (*h) * 4;
return (uint8_t) result;
}
void Refresh_Image_Free(uint8_t *mem) void Refresh_Image_Free(uint8_t *mem)
{ {
SDL_SIMDFree(mem); SDL_SIMDFree(mem);