Compare commits
No commits in common. "d3d11" and "main" have entirely different histories.
|
@ -41,12 +41,6 @@ add_definitions(
|
||||||
-DREFRESH_DRIVER_VULKAN
|
-DREFRESH_DRIVER_VULKAN
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
add_definitions(
|
|
||||||
-DREFRESH_DRIVER_D3D11
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Source lists
|
# Source lists
|
||||||
add_library(Refresh
|
add_library(Refresh
|
||||||
# Public Headers
|
# Public Headers
|
||||||
|
@ -55,10 +49,8 @@ add_library(Refresh
|
||||||
# Internal Headers
|
# Internal Headers
|
||||||
src/Refresh_Driver.h
|
src/Refresh_Driver.h
|
||||||
src/Refresh_Driver_Vulkan_vkfuncs.h
|
src/Refresh_Driver_Vulkan_vkfuncs.h
|
||||||
src/Refresh_Driver_D3D11_cdefines.h
|
|
||||||
# Source Files
|
# Source Files
|
||||||
src/Refresh.c
|
src/Refresh.c
|
||||||
src/Refresh_Driver_D3D11.c
|
|
||||||
src/Refresh_Driver_Vulkan.c
|
src/Refresh_Driver_Vulkan.c
|
||||||
src/Refresh_Image.c
|
src/Refresh_Image.c
|
||||||
)
|
)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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.
|
||||||
|
|
|
@ -194,37 +194,26 @@ partial class Program
|
||||||
// Magic
|
// Magic
|
||||||
writer.Write(new char[] { 'R', 'F', 'S', 'H'});
|
writer.Write(new char[] { 'R', 'F', 'S', 'H'});
|
||||||
|
|
||||||
// Type
|
|
||||||
uint shaderTypeIndex;
|
|
||||||
switch (shaderType)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case ".vert": shaderTypeIndex = 0; break;
|
|
||||||
case ".frag": shaderTypeIndex = 1; break;
|
|
||||||
case ".comp": shaderTypeIndex = 2; break;
|
|
||||||
}
|
|
||||||
writer.Write(shaderTypeIndex);
|
|
||||||
|
|
||||||
if (data.vulkan)
|
if (data.vulkan)
|
||||||
{
|
{
|
||||||
string inputPath = Path.Combine(tempDir, $"{shaderName}.spv");
|
string inputPath = Path.Combine(tempDir, $"{shaderName}.spv");
|
||||||
WriteShaderBlob(writer, inputPath, 1);
|
WriteShaderBlob(writer, inputPath, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.d3d11)
|
|
||||||
{
|
|
||||||
string inputPath = Path.Combine(tempDir, $"{shaderName}.hlsl");
|
|
||||||
WriteShaderBlob(writer, inputPath, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if PS5
|
#if PS5
|
||||||
if (data.ps5)
|
if (data.ps5)
|
||||||
{
|
{
|
||||||
string ext = GetPS5ShaderFileExtension();
|
string ext = GetPS5ShaderFileExtension();
|
||||||
string inputPath = Path.Combine(tempDir, $"{shaderName}{ext}");
|
string inputPath = Path.Combine(tempDir, $"{shaderName}{ext}");
|
||||||
WriteShaderBlob(writer, inputPath, 3);
|
WriteShaderBlob(writer, inputPath, 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (data.d3d11)
|
||||||
|
{
|
||||||
|
string inputPath = Path.Combine(tempDir, $"{shaderName}.hlsl");
|
||||||
|
WriteShaderBlob(writer, inputPath, 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +254,7 @@ partial class Program
|
||||||
{
|
{
|
||||||
Process spirvcross = Process.Start(
|
Process spirvcross = Process.Start(
|
||||||
"spirv-cross",
|
"spirv-cross",
|
||||||
$"\"{spirvPath}\" --hlsl --flip-vert-y --shader-model 50 --output \"{outputPath}\""
|
$"\"{spirvPath}\" --hlsl --shader-model 50 --output \"{outputPath}\""
|
||||||
);
|
);
|
||||||
spirvcross.WaitForExit();
|
spirvcross.WaitForExit();
|
||||||
if (spirvcross.ExitCode != 0)
|
if (spirvcross.ExitCode != 0)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<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>
|
||||||
|
|
820
src/Refresh.c
820
src/Refresh.c
|
@ -39,12 +39,6 @@
|
||||||
#define VULKAN_DRIVER NULL
|
#define VULKAN_DRIVER NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REFRESH_DRIVER_D3D11
|
|
||||||
#define D3D11_DRIVER &D3D11Driver
|
|
||||||
#else
|
|
||||||
#define D3D11_DRIVER NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef REFRESH_DRIVER_PS5
|
#ifdef REFRESH_DRIVER_PS5
|
||||||
#define PS5_DRIVER &PS5Driver
|
#define PS5_DRIVER &PS5Driver
|
||||||
#else
|
#else
|
||||||
|
@ -54,7 +48,6 @@
|
||||||
static const Refresh_Driver *backends[] = {
|
static const Refresh_Driver *backends[] = {
|
||||||
NULL,
|
NULL,
|
||||||
VULKAN_DRIVER,
|
VULKAN_DRIVER,
|
||||||
D3D11_DRIVER,
|
|
||||||
PS5_DRIVER
|
PS5_DRIVER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -203,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,
|
||||||
|
@ -242,7 +338,7 @@ Refresh_ShaderModule* Refresh_CreateShaderModule(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
) {
|
) {
|
||||||
Refresh_Driver_ShaderModuleCreateInfo driverSpecificCreateInfo = { 0, NULL, 0 };
|
Refresh_ShaderModuleCreateInfo driverSpecificCreateInfo = { 0, NULL };
|
||||||
uint8_t *bytes;
|
uint8_t *bytes;
|
||||||
uint32_t i, size;
|
uint32_t i, size;
|
||||||
|
|
||||||
|
@ -252,24 +348,12 @@ Refresh_ShaderModule* Refresh_CreateShaderModule(
|
||||||
bytes = (uint8_t*) shaderModuleCreateInfo->byteCode;
|
bytes = (uint8_t*) shaderModuleCreateInfo->byteCode;
|
||||||
if (bytes[0] != 'R' || bytes[1] != 'F' || bytes[2] != 'S' || bytes[3] != 'H')
|
if (bytes[0] != 'R' || bytes[1] != 'F' || bytes[2] != 'S' || bytes[3] != 'H')
|
||||||
{
|
{
|
||||||
Refresh_LogError("Cannot parse malformed Refresh shader blob: Incorrect magic number");
|
Refresh_LogError("Cannot parse malformed Refresh shader blob!");
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the type of shader */
|
|
||||||
driverSpecificCreateInfo.type = (Refresh_Driver_ShaderType) *((uint32_t*) &bytes[4]);
|
|
||||||
if ( driverSpecificCreateInfo.type < 0 ||
|
|
||||||
driverSpecificCreateInfo.type > REFRESH_DRIVER_SHADERTYPE_COMPUTE )
|
|
||||||
{
|
|
||||||
Refresh_LogError(
|
|
||||||
"Cannot parse malformed Refresh shader blob: Unknown shader type (%d)",
|
|
||||||
driverSpecificCreateInfo.type
|
|
||||||
);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find the code for the selected backend */
|
/* find the code for the selected backend */
|
||||||
i = 8;
|
i = 4;
|
||||||
while (i < shaderModuleCreateInfo->codeSize)
|
while (i < shaderModuleCreateInfo->codeSize)
|
||||||
{
|
{
|
||||||
size = *((uint32_t*) &bytes[i + 1]);
|
size = *((uint32_t*) &bytes[i + 1]);
|
||||||
|
@ -314,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,
|
||||||
|
@ -362,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
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,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,
|
||||||
|
@ -436,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
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,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(
|
||||||
|
@ -488,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,
|
||||||
|
@ -673,219 +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_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_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,
|
||||||
|
@ -910,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
|
||||||
) {
|
) {
|
||||||
|
@ -960,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
|
||||||
|
@ -1010,7 +940,9 @@ int Refresh_QueryFence(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_Fence *fence
|
Refresh_Fence *fence
|
||||||
) {
|
) {
|
||||||
if (device == NULL) { return 0; }
|
if (device == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return device->QueryFence(
|
return device->QueryFence(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
|
@ -1029,38 +961,4 @@ void Refresh_ReleaseFence(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_DownloadFromTexture(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_TextureRegion *textureRegion,
|
|
||||||
Refresh_TransferBuffer *transferBuffer,
|
|
||||||
Refresh_BufferImageCopy *copyParams,
|
|
||||||
Refresh_TransferOptions transferOption
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DownloadFromTexture(
|
|
||||||
device->driverData,
|
|
||||||
textureRegion,
|
|
||||||
transferBuffer,
|
|
||||||
copyParams,
|
|
||||||
transferOption
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DownloadFromBuffer(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_GpuBuffer *gpuBuffer,
|
|
||||||
Refresh_TransferBuffer *transferBuffer,
|
|
||||||
Refresh_BufferCopy *copyParams,
|
|
||||||
Refresh_TransferOptions transferOption
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DownloadFromBuffer(
|
|
||||||
device->driverData,
|
|
||||||
gpuBuffer,
|
|
||||||
transferBuffer,
|
|
||||||
copyParams,
|
|
||||||
transferOption
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */
|
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */
|
||||||
|
|
|
@ -48,46 +48,6 @@ void Refresh_LogError(const char *fmt, ...);
|
||||||
|
|
||||||
/* Internal Helper Utilities */
|
/* Internal Helper Utilities */
|
||||||
|
|
||||||
static inline int32_t Texture_GetBlockSize(
|
|
||||||
Refresh_TextureFormat format
|
|
||||||
) {
|
|
||||||
switch (format)
|
|
||||||
{
|
|
||||||
case REFRESH_TEXTUREFORMAT_BC1:
|
|
||||||
case REFRESH_TEXTUREFORMAT_BC2:
|
|
||||||
case REFRESH_TEXTUREFORMAT_BC3:
|
|
||||||
case REFRESH_TEXTUREFORMAT_BC7:
|
|
||||||
return 4;
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8_UINT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R5G6B5:
|
|
||||||
case REFRESH_TEXTUREFORMAT_B4G4R4A4:
|
|
||||||
case REFRESH_TEXTUREFORMAT_A1R5G5B5:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16_SFLOAT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8G8_SNORM:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8G8_UINT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16_UINT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R32_SFLOAT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16G16_SFLOAT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM:
|
|
||||||
case REFRESH_TEXTUREFORMAT_A2R10G10B10:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_UINT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16G16_UINT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R32G32_SFLOAT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16_UINT:
|
|
||||||
case REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT:
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
Refresh_LogError(
|
|
||||||
"Unrecognized TextureFormat!"
|
|
||||||
);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint32_t Texture_GetFormatSize(
|
static inline uint32_t Texture_GetFormatSize(
|
||||||
Refresh_TextureFormat format
|
Refresh_TextureFormat format
|
||||||
) {
|
) {
|
||||||
|
@ -127,7 +87,7 @@ static inline uint32_t Texture_GetFormatSize(
|
||||||
return 16;
|
return 16;
|
||||||
default:
|
default:
|
||||||
Refresh_LogError(
|
Refresh_LogError(
|
||||||
"Unrecognized TextureFormat!"
|
"Unrecognized SurfaceFormat!"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -211,22 +171,6 @@ static inline int32_t BytesPerImage(
|
||||||
#define MAX_COLOR_TARGET_BINDINGS 4
|
#define MAX_COLOR_TARGET_BINDINGS 4
|
||||||
#define MAX_PRESENT_COUNT 16
|
#define MAX_PRESENT_COUNT 16
|
||||||
|
|
||||||
/* Internal Shader Module Create Info */
|
|
||||||
|
|
||||||
typedef enum Refresh_Driver_ShaderType
|
|
||||||
{
|
|
||||||
REFRESH_DRIVER_SHADERTYPE_VERTEX,
|
|
||||||
REFRESH_DRIVER_SHADERTYPE_FRAGMENT,
|
|
||||||
REFRESH_DRIVER_SHADERTYPE_COMPUTE
|
|
||||||
} Refresh_Driver_ShaderType;
|
|
||||||
|
|
||||||
typedef struct Refresh_Driver_ShaderModuleCreateInfo
|
|
||||||
{
|
|
||||||
size_t codeSize;
|
|
||||||
const uint32_t* byteCode;
|
|
||||||
Refresh_Driver_ShaderType type;
|
|
||||||
} Refresh_Driver_ShaderModuleCreateInfo;
|
|
||||||
|
|
||||||
/* Refresh_Device Definition */
|
/* Refresh_Device Definition */
|
||||||
|
|
||||||
typedef struct Refresh_Renderer Refresh_Renderer;
|
typedef struct Refresh_Renderer Refresh_Renderer;
|
||||||
|
@ -237,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)(
|
||||||
|
@ -256,7 +252,7 @@ struct Refresh_Device
|
||||||
|
|
||||||
Refresh_ShaderModule* (*CreateShaderModule)(
|
Refresh_ShaderModule* (*CreateShaderModule)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_Driver_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
Refresh_Texture* (*CreateTexture)(
|
Refresh_Texture* (*CreateTexture)(
|
||||||
|
@ -264,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 */
|
||||||
|
@ -287,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)(
|
||||||
|
@ -312,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,
|
||||||
|
@ -322,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)(
|
||||||
|
@ -340,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,
|
||||||
|
@ -435,107 +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 (*CopyTextureToTexture)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureRegion *source,
|
|
||||||
Refresh_TextureRegion *destination,
|
|
||||||
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,
|
||||||
|
@ -547,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
|
||||||
);
|
);
|
||||||
|
@ -570,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
|
||||||
|
@ -601,22 +528,6 @@ struct Refresh_Device
|
||||||
Refresh_Fence *fence
|
Refresh_Fence *fence
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*DownloadFromTexture)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_TextureRegion *textureSlice,
|
|
||||||
Refresh_TransferBuffer *transferBuffer,
|
|
||||||
Refresh_BufferImageCopy *copyParams,
|
|
||||||
Refresh_TransferOptions transferOption
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*DownloadFromBuffer)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
Refresh_GpuBuffer *gpuBuffer,
|
|
||||||
Refresh_TransferBuffer *transferBuffer,
|
|
||||||
Refresh_BufferCopy *copyParams,
|
|
||||||
Refresh_TransferOptions transferOption
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Opaque pointer for the Driver */
|
/* Opaque pointer for the Driver */
|
||||||
Refresh_Renderer *driverData;
|
Refresh_Renderer *driverData;
|
||||||
};
|
};
|
||||||
|
@ -625,59 +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(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) \
|
||||||
|
@ -695,7 +597,6 @@ typedef struct Refresh_Driver
|
||||||
} Refresh_Driver;
|
} Refresh_Driver;
|
||||||
|
|
||||||
extern Refresh_Driver VulkanDriver;
|
extern Refresh_Driver VulkanDriver;
|
||||||
extern Refresh_Driver D3D11Driver;
|
|
||||||
extern Refresh_Driver PS5Driver;
|
extern Refresh_Driver PS5Driver;
|
||||||
|
|
||||||
#endif /* REFRESH_DRIVER_H */
|
#endif /* REFRESH_DRIVER_H */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,42 +0,0 @@
|
||||||
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020 Evan Hemsley
|
|
||||||
*
|
|
||||||
* This software is provided 'as-is', without any express or implied warranty.
|
|
||||||
* In no event will the authors be held liable for any damages arising from
|
|
||||||
* the use of this software.
|
|
||||||
*
|
|
||||||
* Permission is granted to anyone to use this software for any purpose,
|
|
||||||
* including commercial applications, and to alter it and redistribute it
|
|
||||||
* freely, subject to the following restrictions:
|
|
||||||
*
|
|
||||||
* 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
* claim that you wrote the original software. If you use this software in a
|
|
||||||
* product, an acknowledgment in the product documentation would be
|
|
||||||
* appreciated but is not required.
|
|
||||||
*
|
|
||||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
* misrepresented as being the original software.
|
|
||||||
*
|
|
||||||
* 3. This notice may not be removed or altered from any source distribution.
|
|
||||||
*
|
|
||||||
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Function Pointer Signatures */
|
|
||||||
typedef HRESULT(WINAPI* PFN_CREATE_DXGI_FACTORY1)(const GUID* riid, void** ppFactory);
|
|
||||||
typedef HRESULT(WINAPI* PFN_DXGI_GET_DEBUG_INTERFACE)(const GUID* riid, void** ppDebug);
|
|
||||||
|
|
||||||
/* IIDs (from https://magnumdb.com) */
|
|
||||||
static const IID D3D_IID_IDXGIFactory1 = { 0x770aae78,0xf26f,0x4dba,{0xa8,0x29,0x25,0x3c,0x83,0xd1,0xb3,0x87} };
|
|
||||||
static const IID D3D_IID_IDXGIFactory4 = { 0x1bc6ea02,0xef36,0x464f,{0xbf,0x0c,0x21,0xca,0x39,0xe5,0x16,0x8a} };
|
|
||||||
static const IID D3D_IID_IDXGIFactory5 = { 0x7632e1f5,0xee65,0x4dca,{0x87,0xfd,0x84,0xcd,0x75,0xf8,0x83,0x8d} };
|
|
||||||
static const IID D3D_IID_IDXGIFactory6 = { 0xc1b6694f,0xff09,0x44a9,{0xb0,0x3c,0x77,0x90,0x0a,0x0a,0x1d,0x17} };
|
|
||||||
static const IID D3D_IID_IDXGIAdapter1 = { 0x29038f61,0x3839,0x4626,{0x91,0xfd,0x08,0x68,0x79,0x01,0x1a,0x05} };
|
|
||||||
static const IID D3D_IID_ID3D11Texture2D = { 0x6f15aaf2,0xd208,0x4e89,{0x9a,0xb4,0x48,0x95,0x35,0xd3,0x4f,0x9c} };
|
|
||||||
static const IID D3D_IID_ID3D11Device1 = { 0xa04bfb29,0x08ef,0x43d6,{0xa4,0x9c,0xa9,0xbd,0xbd,0xcb,0xe6,0x86} };
|
|
||||||
static const IID D3D_IID_IDXGIDebug = { 0x119e7452,0xde9e,0x40fe,{0x88,0x06,0x88,0xf9,0x0c,0x12,0xb4,0x41} };
|
|
||||||
static const IID D3D_IID_IDXGIInfoQueue = { 0xd67441c7,0x672a,0x476f,{0x9e,0x82,0xcd,0x55,0xb4,0x49,0x49,0xce} };
|
|
||||||
|
|
||||||
static const GUID D3D_IID_DXGI_DEBUG_ALL = { 0xe48ae283,0xda80,0x490b,{0x87,0xe6,0x43,0xe9,0xa9,0xcf,0xda,0x08} };
|
|
|
@ -318,7 +318,7 @@ static Refresh_Sampler* TEMPLATE_CreateSampler(
|
||||||
|
|
||||||
static Refresh_ShaderModule* TEMPLATE_CreateShaderModule(
|
static Refresh_ShaderModule* TEMPLATE_CreateShaderModule(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_Driver_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
) {
|
) {
|
||||||
NOT_IMPLEMENTED
|
NOT_IMPLEMENTED
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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);
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>REFRESH_DRIVER_VULKAN;REFRESH_DRIVER_D3D11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>REFRESH_DRIVER_VULKAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<PreprocessorDefinitions>REFRESH_DRIVER_VULKAN;REFRESH_DRIVER_D3D11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>REFRESH_DRIVER_VULKAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -84,7 +84,6 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\Refresh.c" />
|
<ClCompile Include="..\src\Refresh.c" />
|
||||||
<ClCompile Include="..\src\Refresh_Driver_D3D11.c" />
|
|
||||||
<ClCompile Include="..\src\Refresh_Driver_Vulkan.c" />
|
<ClCompile Include="..\src\Refresh_Driver_Vulkan.c" />
|
||||||
<ClCompile Include="..\src\Refresh_Image.c" />
|
<ClCompile Include="..\src\Refresh_Image.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -92,7 +91,6 @@
|
||||||
<ClInclude Include="..\include\Refresh.h" />
|
<ClInclude Include="..\include\Refresh.h" />
|
||||||
<ClInclude Include="..\include\Refresh_Image.h" />
|
<ClInclude Include="..\include\Refresh_Image.h" />
|
||||||
<ClInclude Include="..\src\Refresh_Driver.h" />
|
<ClInclude Include="..\src\Refresh_Driver.h" />
|
||||||
<ClInclude Include="..\src\Refresh_Driver_D3D11_cdefines.h" />
|
|
||||||
<ClInclude Include="..\src\Refresh_Driver_Vulkan_vkfuncs.h" />
|
<ClInclude Include="..\src\Refresh_Driver_Vulkan_vkfuncs.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
<ClCompile Include="..\src\Refresh_Image.c">
|
<ClCompile Include="..\src\Refresh_Image.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\src\Refresh_Driver_D3D11.c">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\Refresh.h">
|
<ClInclude Include="..\include\Refresh.h">
|
||||||
|
@ -27,9 +24,6 @@
|
||||||
<ClInclude Include="..\include\Refresh_Image.h">
|
<ClInclude Include="..\include\Refresh_Image.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\src\Refresh_Driver_D3D11_cdefines.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="Header Files">
|
<Filter Include="Header Files">
|
||||||
|
|
Loading…
Reference in New Issue