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

@ -746,8 +746,7 @@ REFRESHAPI void Refresh_DestroyDevice(Refresh_Device *device);
* options: Bitflags to specify color/depth/stencil buffers for clearing. * options: Bitflags to specify color/depth/stencil buffers for clearing.
* colors: An array of color values for the cleared color buffers. * colors: An array of color values for the cleared color buffers.
* colorCount: The number of colors in the above array. * colorCount: The number of colors in the above array.
* depth: The new value of the cleared depth buffer. * depthStencil: Depth and stencil values for the cleared depth stencil buffer.
* stencil: The new value of the cleared stencil buffer.
*/ */
REFRESHAPI void Refresh_Clear( REFRESHAPI void Refresh_Clear(
Refresh_Device *device, Refresh_Device *device,
@ -756,8 +755,7 @@ REFRESHAPI void Refresh_Clear(
Refresh_ClearOptions options, Refresh_ClearOptions options,
Refresh_Color *colors, Refresh_Color *colors,
uint32_t colorCount, uint32_t colorCount,
float depth, Refresh_DepthStencilValue depthStencil
int32_t stencil
); );
/* Draws data from vertex/index buffers with instancing enabled. /* Draws data from vertex/index buffers with instancing enabled.

View File

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

View File

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

View File

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