Compare commits
124 Commits
Author | SHA1 | Date |
---|---|---|
cosmonaut | 856a7004ae | |
cosmonaut | a80f3f40dd | |
cosmonaut | 397e84fe4a | |
cosmonaut | d3d5a5a525 | |
cosmonaut | 1dcf29eed4 | |
cosmonaut | bb57528242 | |
cosmonaut | efd26f474a | |
cosmonaut | 5db754719a | |
cosmonaut | 75927137d6 | |
cosmonaut | ded5dac60a | |
cosmonaut | 548c468cc9 | |
cosmonaut | 45e7dde067 | |
cosmonaut | 23aed89ad9 | |
cosmonaut | 953be4225c | |
cosmonaut | 65c30350a7 | |
cosmonaut | 838b5df27b | |
cosmonaut | 52d4c934f3 | |
cosmonaut | 6ebfabcecf | |
cosmonaut | 01e805c800 | |
cosmonaut | 6c2eef669e | |
cosmonaut | 3c74ddf8fa | |
cosmonaut | 5ed41a7de2 | |
cosmonaut | 5c84debb50 | |
cosmonaut | 128bd1f5f0 | |
cosmonaut | 52ac3e1980 | |
cosmonaut | e01cab47ec | |
cosmonaut | 16699e7ee3 | |
cosmonaut | f61938011b | |
cosmonaut | 172348e65f | |
Caleb Cornett | 8f2e70948d | |
Caleb Cornett | e7d258dd36 | |
Caleb Cornett | 27b166dfde | |
Caleb Cornett | 7274173b44 | |
Caleb Cornett | c497402f1d | |
Caleb Cornett | 56f292f987 | |
Caleb Cornett | 0a520f7a66 | |
Caleb Cornett | 4fe02e8571 | |
Caleb Cornett | 539ee66d41 | |
Caleb Cornett | 17f9322698 | |
Caleb Cornett | a5284ba0cd | |
Caleb Cornett | 644763f004 | |
Caleb Cornett | b3addd6e0b | |
Caleb Cornett | 95781e3378 | |
Caleb Cornett | 02aaf582d4 | |
Caleb Cornett | e3d112a971 | |
Caleb Cornett | 9f78f83322 | |
Caleb Cornett | 92f344d2f6 | |
Caleb Cornett | 0f2aacbae9 | |
Caleb Cornett | dcac27b5d8 | |
Caleb Cornett | c9b98c6e2b | |
Caleb Cornett | 557ce50737 | |
Caleb Cornett | 11cbfca702 | |
Caleb Cornett | f7fae4d314 | |
Caleb Cornett | 508d077c26 | |
Caleb Cornett | d76d223f68 | |
Caleb Cornett | 105ef1aebb | |
Caleb Cornett | 155d01ed92 | |
Caleb Cornett | 06f00c77a0 | |
Caleb Cornett | 297b8b2cd2 | |
Caleb Cornett | f598b65be5 | |
Caleb Cornett | 60a0ecab92 | |
Caleb Cornett | 4d11afa422 | |
Caleb Cornett | 5d069f006d | |
Caleb Cornett | e7be43e835 | |
Caleb Cornett | b712bda8a3 | |
Caleb Cornett | 5f3dd6ba8a | |
Caleb Cornett | db6ad7fb6a | |
Caleb Cornett | 0108b26d31 | |
Caleb Cornett | ca29f3b7da | |
Caleb Cornett | c9f23dd73b | |
Caleb Cornett | a3c8ab6a55 | |
Caleb Cornett | eb956a2f8b | |
Caleb Cornett | cdad57d1dd | |
Caleb Cornett | ce3b222529 | |
Caleb Cornett | 6a1c4ba80f | |
Caleb Cornett | a7bbc51653 | |
Caleb Cornett | ba842d855e | |
Caleb Cornett | b906ec9c69 | |
Caleb Cornett | 7f4ddde607 | |
Caleb Cornett | 15a73854b6 | |
Caleb Cornett | abfdb2c7d9 | |
Caleb Cornett | d7290c5e2b | |
Caleb Cornett | 740fb56aa1 | |
Caleb Cornett | afeb7ebd16 | |
Caleb Cornett | 01cd001b07 | |
Caleb Cornett | dda7db1d92 | |
Caleb Cornett | f008408965 | |
Caleb Cornett | b74666a6d7 | |
Caleb Cornett | acf64d51f0 | |
Caleb Cornett | acae35ebfa | |
Caleb Cornett | 0948537fe0 | |
Caleb Cornett | cbd8f4aee0 | |
Caleb Cornett | dd9ae93696 | |
Caleb Cornett | 08ba467551 | |
Caleb Cornett | dd1060373d | |
Caleb Cornett | b9d7cec252 | |
Caleb Cornett | 5385f02bbd | |
Caleb Cornett | d6378aba74 | |
cosmonaut | 9d1059ed0e | |
cosmonaut | 7b0ed4278d | |
cosmonaut | 02c0d85885 | |
cosmonaut | 695abd4139 | |
cosmonaut | 2361cec274 | |
cosmonaut | 899f961461 | |
cosmonaut | 9d36ddaac1 | |
cosmonaut | 4e1705d1bd | |
cosmonaut | 2f57a05c85 | |
cosmonaut | 2798067d54 | |
cosmonaut | d34310a7df | |
cosmonaut | 73d927791a | |
cosmonaut | 72ff9407c4 | |
cosmonaut | 52b99ea49a | |
cosmonaut | 94f181787b | |
cosmonaut | c44a095bca | |
cosmonaut | fdb29ade82 | |
cosmonaut | 61386a27ba | |
cosmonaut | ce4d294a31 | |
cosmonaut | c779718967 | |
cosmonaut | 218587bb6a | |
cosmonaut | 80914e9c38 | |
cosmonaut | 342a7f9ef6 | |
cosmonaut | 5b82609565 | |
cosmonaut | 10c0b5ae37 | |
cosmonaut | 6f31f17be1 |
|
@ -41,6 +41,12 @@ 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
|
||||||
|
@ -49,8 +55,10 @@ 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,6 +63,20 @@ 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,26 +194,37 @@ 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, 2);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (data.d3d11)
|
|
||||||
{
|
|
||||||
string inputPath = Path.Combine(tempDir, $"{shaderName}.hlsl");
|
|
||||||
WriteShaderBlob(writer, inputPath, 3);
|
WriteShaderBlob(writer, inputPath, 3);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +265,7 @@ partial class Program
|
||||||
{
|
{
|
||||||
Process spirvcross = Process.Start(
|
Process spirvcross = Process.Start(
|
||||||
"spirv-cross",
|
"spirv-cross",
|
||||||
$"\"{spirvPath}\" --hlsl --shader-model 50 --output \"{outputPath}\""
|
$"\"{spirvPath}\" --hlsl --flip-vert-y --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>net7.0</TargetFramework>
|
<TargetFramework>net8.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,6 +39,12 @@
|
||||||
#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
|
||||||
|
@ -48,6 +54,7 @@
|
||||||
static const Refresh_Driver *backends[] = {
|
static const Refresh_Driver *backends[] = {
|
||||||
NULL,
|
NULL,
|
||||||
VULKAN_DRIVER,
|
VULKAN_DRIVER,
|
||||||
|
D3D11_DRIVER,
|
||||||
PS5_DRIVER
|
PS5_DRIVER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,110 +203,7 @@ void Refresh_DestroyDevice(Refresh_Device *device)
|
||||||
device->DestroyDevice(device);
|
device->DestroyDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_DrawIndexedPrimitives(
|
/* State Creation */
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawIndexedPrimitives(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
baseVertex,
|
|
||||||
startIndex,
|
|
||||||
primitiveCount,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DrawInstancedPrimitives(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t baseVertex,
|
|
||||||
uint32_t startIndex,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
uint32_t instanceCount,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawInstancedPrimitives(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
baseVertex,
|
|
||||||
startIndex,
|
|
||||||
primitiveCount,
|
|
||||||
instanceCount,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DrawPrimitives(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t vertexStart,
|
|
||||||
uint32_t primitiveCount,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawPrimitives(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
vertexStart,
|
|
||||||
primitiveCount,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DrawPrimitivesIndirect(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint32_t offsetInBytes,
|
|
||||||
uint32_t drawCount,
|
|
||||||
uint32_t stride,
|
|
||||||
uint32_t vertexParamOffset,
|
|
||||||
uint32_t fragmentParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DrawPrimitivesIndirect(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
buffer,
|
|
||||||
offsetInBytes,
|
|
||||||
drawCount,
|
|
||||||
stride,
|
|
||||||
vertexParamOffset,
|
|
||||||
fragmentParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_DispatchCompute(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
uint32_t groupCountX,
|
|
||||||
uint32_t groupCountY,
|
|
||||||
uint32_t groupCountZ,
|
|
||||||
uint32_t computeParamOffset
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->DispatchCompute(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
groupCountX,
|
|
||||||
groupCountY,
|
|
||||||
groupCountZ,
|
|
||||||
computeParamOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Refresh_ComputePipeline* Refresh_CreateComputePipeline(
|
Refresh_ComputePipeline* Refresh_CreateComputePipeline(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
|
@ -338,7 +242,7 @@ Refresh_ShaderModule* Refresh_CreateShaderModule(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
) {
|
) {
|
||||||
Refresh_ShaderModuleCreateInfo driverSpecificCreateInfo = { 0, NULL };
|
Refresh_Driver_ShaderModuleCreateInfo driverSpecificCreateInfo = { 0, NULL, 0 };
|
||||||
uint8_t *bytes;
|
uint8_t *bytes;
|
||||||
uint32_t i, size;
|
uint32_t i, size;
|
||||||
|
|
||||||
|
@ -348,12 +252,24 @@ 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!");
|
Refresh_LogError("Cannot parse malformed Refresh shader blob: Incorrect magic number");
|
||||||
|
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 = 4;
|
i = 8;
|
||||||
while (i < shaderModuleCreateInfo->codeSize)
|
while (i < shaderModuleCreateInfo->codeSize)
|
||||||
{
|
{
|
||||||
size = *((uint32_t*) &bytes[i + 1]);
|
size = *((uint32_t*) &bytes[i + 1]);
|
||||||
|
@ -398,215 +314,31 @@ Refresh_Texture* Refresh_CreateTexture(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh_Buffer* Refresh_CreateBuffer(
|
Refresh_GpuBuffer* Refresh_CreateGpuBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_BufferUsageFlags usageFlags,
|
Refresh_BufferUsageFlags usageFlags,
|
||||||
uint32_t sizeInBytes
|
uint32_t sizeInBytes
|
||||||
) {
|
) {
|
||||||
NULL_RETURN_NULL(device);
|
NULL_RETURN_NULL(device);
|
||||||
return device->CreateBuffer(
|
return device->CreateGpuBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
usageFlags,
|
usageFlags,
|
||||||
sizeInBytes
|
sizeInBytes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_SetTextureData(
|
Refresh_TransferBuffer* Refresh_CreateTransferBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
uint32_t sizeInBytes
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN_NULL(device);
|
||||||
device->SetTextureData(
|
return device->CreateTransferBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer,
|
sizeInBytes
|
||||||
textureSlice,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_SetTextureDataYUV(
|
/* Disposal */
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer* commandBuffer,
|
|
||||||
Refresh_Texture *y,
|
|
||||||
Refresh_Texture *u,
|
|
||||||
Refresh_Texture *v,
|
|
||||||
uint32_t yWidth,
|
|
||||||
uint32_t yHeight,
|
|
||||||
uint32_t uvWidth,
|
|
||||||
uint32_t uvHeight,
|
|
||||||
void *yDataPtr,
|
|
||||||
void *uDataPtr,
|
|
||||||
void *vDataPtr,
|
|
||||||
uint32_t yDataLength,
|
|
||||||
uint32_t uvDataLength,
|
|
||||||
uint32_t yStride,
|
|
||||||
uint32_t uvStride
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->SetTextureDataYUV(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
y,
|
|
||||||
u,
|
|
||||||
v,
|
|
||||||
yWidth,
|
|
||||||
yHeight,
|
|
||||||
uvWidth,
|
|
||||||
uvHeight,
|
|
||||||
yDataPtr,
|
|
||||||
uDataPtr,
|
|
||||||
vDataPtr,
|
|
||||||
yDataLength,
|
|
||||||
uvDataLength,
|
|
||||||
yStride,
|
|
||||||
uvStride
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_CopyTextureToTexture(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *sourceTextureSlice,
|
|
||||||
Refresh_TextureSlice *destinationTextureSlice,
|
|
||||||
Refresh_Filter filter
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->CopyTextureToTexture(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
sourceTextureSlice,
|
|
||||||
destinationTextureSlice,
|
|
||||||
filter
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_CopyTextureToBuffer(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_TextureSlice *textureSlice,
|
|
||||||
Refresh_Buffer *buffer
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->CopyTextureToBuffer(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
textureSlice,
|
|
||||||
buffer
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_SetBufferData(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
uint32_t offsetInBytes,
|
|
||||||
void* data,
|
|
||||||
uint32_t dataLength
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->SetBufferData(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
buffer,
|
|
||||||
offsetInBytes,
|
|
||||||
data,
|
|
||||||
dataLength
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Refresh_PushVertexShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->PushVertexShaderUniforms(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Refresh_PushFragmentShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->PushFragmentShaderUniforms(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t Refresh_PushComputeShaderUniforms(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->PushComputeShaderUniforms(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_BindVertexSamplers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->BindVertexSamplers(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
pTextures,
|
|
||||||
pSamplers
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_BindFragmentSamplers(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_Texture **pTextures,
|
|
||||||
Refresh_Sampler **pSamplers
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->BindFragmentSamplers(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
pTextures,
|
|
||||||
pSamplers
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_GetBufferData(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_Buffer *buffer,
|
|
||||||
void *data,
|
|
||||||
uint32_t dataLengthInBytes
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->GetBufferData(
|
|
||||||
device->driverData,
|
|
||||||
buffer,
|
|
||||||
data,
|
|
||||||
dataLengthInBytes
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_QueueDestroyTexture(
|
void Refresh_QueueDestroyTexture(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
|
@ -630,14 +362,25 @@ void Refresh_QueueDestroySampler(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_QueueDestroyBuffer(
|
void Refresh_QueueDestroyGpuBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_Buffer *buffer
|
Refresh_GpuBuffer *gpuBuffer
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->QueueDestroyBuffer(
|
device->QueueDestroyGpuBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
buffer
|
gpuBuffer
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Refresh_QueueDestroyTransferBuffer(
|
||||||
|
Refresh_Device *device,
|
||||||
|
Refresh_TransferBuffer *transferBuffer
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->QueueDestroyTransferBuffer(
|
||||||
|
device->driverData,
|
||||||
|
transferBuffer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,6 +417,8 @@ void Refresh_QueueDestroyGraphicsPipeline(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Render Pass */
|
||||||
|
|
||||||
void Refresh_BeginRenderPass(
|
void Refresh_BeginRenderPass(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
@ -691,14 +436,16 @@ void Refresh_BeginRenderPass(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_EndRenderPass(
|
void Refresh_BindGraphicsPipeline(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->EndRenderPass(
|
device->BindGraphicsPipeline(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer
|
commandBuffer,
|
||||||
|
graphicsPipeline
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,26 +475,12 @@ void Refresh_SetScissor(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_BindGraphicsPipeline(
|
|
||||||
Refresh_Device *device,
|
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->BindGraphicsPipeline(
|
|
||||||
device->driverData,
|
|
||||||
commandBuffer,
|
|
||||||
graphicsPipeline
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_BindVertexBuffers(
|
void Refresh_BindVertexBuffers(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
uint32_t firstBinding,
|
uint32_t firstBinding,
|
||||||
uint32_t bindingCount,
|
uint32_t bindingCount,
|
||||||
Refresh_Buffer **pBuffers,
|
Refresh_BufferBinding *pBindings
|
||||||
uint64_t *pOffsets
|
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BindVertexBuffers(
|
device->BindVertexBuffers(
|
||||||
|
@ -755,28 +488,175 @@ void Refresh_BindVertexBuffers(
|
||||||
commandBuffer,
|
commandBuffer,
|
||||||
firstBinding,
|
firstBinding,
|
||||||
bindingCount,
|
bindingCount,
|
||||||
pBuffers,
|
pBindings
|
||||||
pOffsets
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_BindIndexBuffer(
|
void Refresh_BindIndexBuffer(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_BufferBinding *pBinding,
|
||||||
uint64_t offset,
|
|
||||||
Refresh_IndexElementSize indexElementSize
|
Refresh_IndexElementSize indexElementSize
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BindIndexBuffer(
|
device->BindIndexBuffer(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer,
|
commandBuffer,
|
||||||
buffer,
|
pBinding,
|
||||||
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,
|
||||||
|
@ -793,29 +673,219 @@ void Refresh_BindComputePipeline(
|
||||||
void Refresh_BindComputeBuffers(
|
void Refresh_BindComputeBuffers(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer **pBuffers
|
Refresh_ComputeBufferBinding *pBindings
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BindComputeBuffers(
|
device->BindComputeBuffers(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer,
|
commandBuffer,
|
||||||
pBuffers
|
pBindings
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Refresh_BindComputeTextures(
|
void Refresh_BindComputeTextures(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Texture **pTextures
|
Refresh_ComputeTextureBinding *pBindings
|
||||||
) {
|
) {
|
||||||
NULL_RETURN(device);
|
NULL_RETURN(device);
|
||||||
device->BindComputeTextures(
|
device->BindComputeTextures(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
commandBuffer,
|
commandBuffer,
|
||||||
pTextures
|
pBindings
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
@ -840,6 +910,30 @@ void Refresh_UnclaimWindow(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Refresh_SetSwapchainPresentMode(
|
||||||
|
Refresh_Device *device,
|
||||||
|
void *windowHandle,
|
||||||
|
Refresh_PresentMode presentMode
|
||||||
|
) {
|
||||||
|
NULL_RETURN(device);
|
||||||
|
device->SetSwapchainPresentMode(
|
||||||
|
device->driverData,
|
||||||
|
windowHandle,
|
||||||
|
presentMode
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh_TextureFormat Refresh_GetSwapchainFormat(
|
||||||
|
Refresh_Device *device,
|
||||||
|
void *windowHandle
|
||||||
|
) {
|
||||||
|
if (device == NULL) { return 0; }
|
||||||
|
return device->GetSwapchainFormat(
|
||||||
|
device->driverData,
|
||||||
|
windowHandle
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
|
Refresh_CommandBuffer* Refresh_AcquireCommandBuffer(
|
||||||
Refresh_Device *device
|
Refresh_Device *device
|
||||||
) {
|
) {
|
||||||
|
@ -866,30 +960,6 @@ Refresh_Texture* Refresh_AcquireSwapchainTexture(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh_TextureFormat Refresh_GetSwapchainFormat(
|
|
||||||
Refresh_Device *device,
|
|
||||||
void *windowHandle
|
|
||||||
) {
|
|
||||||
if (device == NULL) { return 0; }
|
|
||||||
return device->GetSwapchainFormat(
|
|
||||||
device->driverData,
|
|
||||||
windowHandle
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_SetSwapchainPresentMode(
|
|
||||||
Refresh_Device *device,
|
|
||||||
void *windowHandle,
|
|
||||||
Refresh_PresentMode presentMode
|
|
||||||
) {
|
|
||||||
NULL_RETURN(device);
|
|
||||||
device->SetSwapchainPresentMode(
|
|
||||||
device->driverData,
|
|
||||||
windowHandle,
|
|
||||||
presentMode
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh_Submit(
|
void Refresh_Submit(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer
|
||||||
|
@ -940,9 +1010,7 @@ int Refresh_QueryFence(
|
||||||
Refresh_Device *device,
|
Refresh_Device *device,
|
||||||
Refresh_Fence *fence
|
Refresh_Fence *fence
|
||||||
) {
|
) {
|
||||||
if (device == NULL) {
|
if (device == NULL) { return 0; }
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return device->QueryFence(
|
return device->QueryFence(
|
||||||
device->driverData,
|
device->driverData,
|
||||||
|
@ -961,4 +1029,38 @@ 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,6 +48,46 @@ 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
|
||||||
) {
|
) {
|
||||||
|
@ -87,7 +127,7 @@ static inline uint32_t Texture_GetFormatSize(
|
||||||
return 16;
|
return 16;
|
||||||
default:
|
default:
|
||||||
Refresh_LogError(
|
Refresh_LogError(
|
||||||
"Unrecognized SurfaceFormat!"
|
"Unrecognized TextureFormat!"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +211,22 @@ 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;
|
||||||
|
@ -181,58 +237,6 @@ 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)(
|
||||||
|
@ -252,7 +256,7 @@ struct Refresh_Device
|
||||||
|
|
||||||
Refresh_ShaderModule* (*CreateShaderModule)(
|
Refresh_ShaderModule* (*CreateShaderModule)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
Refresh_Driver_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
Refresh_Texture* (*CreateTexture)(
|
Refresh_Texture* (*CreateTexture)(
|
||||||
|
@ -260,107 +264,15 @@ struct Refresh_Device
|
||||||
Refresh_TextureCreateInfo *textureCreateInfo
|
Refresh_TextureCreateInfo *textureCreateInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
Refresh_Buffer* (*CreateBuffer)(
|
Refresh_GpuBuffer* (*CreateGpuBuffer)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_BufferUsageFlags usageFlags,
|
Refresh_BufferUsageFlags usageFlags,
|
||||||
uint32_t sizeInBytes
|
uint32_t sizeInBytes
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Setters */
|
Refresh_TransferBuffer* (*CreateTransferBuffer)(
|
||||||
|
|
||||||
void (*SetTextureData)(
|
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
uint32_t sizeInBytes
|
||||||
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 */
|
||||||
|
@ -375,9 +287,14 @@ struct Refresh_Device
|
||||||
Refresh_Sampler *sampler
|
Refresh_Sampler *sampler
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*QueueDestroyBuffer)(
|
void (*QueueDestroyGpuBuffer)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_Buffer *buffer
|
Refresh_GpuBuffer *gpuBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
void (*QueueDestroyTransferBuffer)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
Refresh_TransferBuffer *transferBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*QueueDestroyShaderModule)(
|
void (*QueueDestroyShaderModule)(
|
||||||
|
@ -395,7 +312,7 @@ struct Refresh_Device
|
||||||
Refresh_GraphicsPipeline *graphicsPipeline
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Graphics State */
|
/* Render Pass */
|
||||||
|
|
||||||
void (*BeginRenderPass)(
|
void (*BeginRenderPass)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
|
@ -405,9 +322,10 @@ struct Refresh_Device
|
||||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*EndRenderPass)(
|
void (*BindGraphicsPipeline)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
|
Refresh_GraphicsPipeline *graphicsPipeline
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*SetViewport)(
|
void (*SetViewport)(
|
||||||
|
@ -422,29 +340,92 @@ 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_Buffer **pBuffers,
|
Refresh_BufferBinding *pBindings
|
||||||
uint64_t *pOffsets
|
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*BindIndexBuffer)(
|
void (*BindIndexBuffer)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer *buffer,
|
Refresh_BufferBinding *pBinding,
|
||||||
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,
|
||||||
|
@ -454,15 +435,107 @@ struct Refresh_Device
|
||||||
void (*BindComputeBuffers)(
|
void (*BindComputeBuffers)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Buffer **pBuffers
|
Refresh_ComputeBufferBinding *pBindings
|
||||||
);
|
);
|
||||||
|
|
||||||
void (*BindComputeTextures)(
|
void (*BindComputeTextures)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer,
|
Refresh_CommandBuffer *commandBuffer,
|
||||||
Refresh_Texture **pTextures
|
Refresh_ComputeTextureBinding *pBindings
|
||||||
);
|
);
|
||||||
|
|
||||||
|
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,
|
||||||
|
@ -474,6 +547,17 @@ struct Refresh_Device
|
||||||
void *windowHandle
|
void *windowHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void (*SetSwapchainPresentMode)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
void *windowHandle,
|
||||||
|
Refresh_PresentMode presentMode
|
||||||
|
);
|
||||||
|
|
||||||
|
Refresh_TextureFormat (*GetSwapchainFormat)(
|
||||||
|
Refresh_Renderer *driverData,
|
||||||
|
void *windowHandle
|
||||||
|
);
|
||||||
|
|
||||||
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
||||||
Refresh_Renderer *driverData
|
Refresh_Renderer *driverData
|
||||||
);
|
);
|
||||||
|
@ -486,17 +570,6 @@ struct Refresh_Device
|
||||||
uint32_t *pHeight
|
uint32_t *pHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
Refresh_TextureFormat (*GetSwapchainFormat)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
void *windowHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*SetSwapchainPresentMode)(
|
|
||||||
Refresh_Renderer *driverData,
|
|
||||||
void *windowHandle,
|
|
||||||
Refresh_PresentMode presentMode
|
|
||||||
);
|
|
||||||
|
|
||||||
void (*Submit)(
|
void (*Submit)(
|
||||||
Refresh_Renderer *driverData,
|
Refresh_Renderer *driverData,
|
||||||
Refresh_CommandBuffer *commandBuffer
|
Refresh_CommandBuffer *commandBuffer
|
||||||
|
@ -528,6 +601,22 @@ 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;
|
||||||
};
|
};
|
||||||
|
@ -536,50 +625,59 @@ 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(CreateBuffer, name) \
|
ASSIGN_DRIVER_FUNC(CreateGpuBuffer, name) \
|
||||||
ASSIGN_DRIVER_FUNC(SetTextureData, name) \
|
ASSIGN_DRIVER_FUNC(CreateTransferBuffer, 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(QueueDestroyBuffer, name) \
|
ASSIGN_DRIVER_FUNC(QueueDestroyGpuBuffer, 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(EndRenderPass, name) \
|
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, 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) \
|
||||||
|
@ -597,6 +695,7 @@ 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
|
@ -0,0 +1,42 @@
|
||||||
|
/* 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_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
Refresh_Driver_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,6 +232,34 @@ 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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>REFRESH_DRIVER_VULKAN;REFRESH_DRIVER_D3D11;%(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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>REFRESH_DRIVER_VULKAN;REFRESH_DRIVER_D3D11;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -84,6 +84,7 @@
|
||||||
</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>
|
||||||
|
@ -91,6 +92,7 @@
|
||||||
<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,6 +10,9 @@
|
||||||
<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">
|
||||||
|
@ -24,6 +27,9 @@
|
||||||
<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