change Clear definition to make more sense

submit_rewrite
cosmonaut 2021-01-22 14:16:02 -08:00
parent d9700707d0
commit fe03f1739a
4 changed files with 16 additions and 22 deletions

View File

@ -742,12 +742,11 @@ REFRESHAPI void Refresh_DestroyDevice(Refresh_Device *device);
* It is generally recommended to clear in BeginRenderPass
* rather than by calling this function unless necessary.
*
* clearRect: Area to clear.
* options: Bitflags to specify color/depth/stencil buffers for clearing.
* colors: An array of color values for the cleared color buffers.
* colorCount: The number of colors in the above array.
* depth: The new value of the cleared depth buffer.
* stencil: The new value of the cleared stencil buffer.
* clearRect: Area to clear.
* options: Bitflags to specify color/depth/stencil buffers for clearing.
* colors: An array of color values for the cleared color buffers.
* colorCount: The number of colors in the above array.
* depthStencil: Depth and stencil values for the cleared depth stencil buffer.
*/
REFRESHAPI void Refresh_Clear(
Refresh_Device *device,
@ -756,8 +755,7 @@ REFRESHAPI void Refresh_Clear(
Refresh_ClearOptions options,
Refresh_Color *colors,
uint32_t colorCount,
float depth,
int32_t stencil
Refresh_DepthStencilValue depthStencil
);
/* Draws data from vertex/index buffers with instancing enabled.

View File

@ -174,8 +174,7 @@ void Refresh_Clear(
Refresh_ClearOptions options,
Refresh_Color *colors,
uint32_t colorCount,
float depth,
int32_t stencil
Refresh_DepthStencilValue depthStencil
) {
NULL_RETURN(device);
device->Clear(
@ -185,8 +184,7 @@ void Refresh_Clear(
options,
colors,
colorCount,
depth,
stencil
depthStencil
);
}

View File

@ -174,8 +174,7 @@ struct Refresh_Device
Refresh_ClearOptions options,
Refresh_Color *colors,
uint32_t colorCount,
float depth,
int32_t stencil
Refresh_DepthStencilValue depthStencil
);
void (*DrawInstancedPrimitives)(

View File

@ -3694,8 +3694,7 @@ static void VULKAN_Clear(
Refresh_ClearOptions options,
Refresh_Color *colors,
uint32_t colorCount,
float depth,
int32_t stencil
Refresh_DepthStencilValue depthStencil
) {
VulkanRenderer* renderer = (VulkanRenderer*) driverData;
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
@ -3762,16 +3761,16 @@ static void VULKAN_Clear(
if (shouldClearDepth)
{
if (depth < 0.0f)
if (depthStencil.depth < 0.0f)
{
depth = 0.0f;
depthStencil.depth = 0.0f;
}
else if (depth > 1.0f)
else if (depthStencil.depth > 1.0f)
{
depth = 1.0f;
depthStencil.depth = 1.0f;
}
clearAttachments[attachmentCount].aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT;
clearAttachments[attachmentCount].clearValue.depthStencil.depth = depth;
clearAttachments[attachmentCount].clearValue.depthStencil.depth = depthStencil.depth;
}
else
{
@ -3781,7 +3780,7 @@ static void VULKAN_Clear(
if (shouldClearStencil)
{
clearAttachments[attachmentCount].aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
clearAttachments[attachmentCount].clearValue.depthStencil.stencil = stencil;
clearAttachments[attachmentCount].clearValue.depthStencil.stencil = depthStencil.stencil;
}
else
{