Compare commits

...

2 Commits

Author SHA1 Message Date
Caleb Cornett 2706b6fe43 fixed a few msaa validation errors 2022-11-02 18:49:01 -04:00
TheSpydog c4b9798fc1 enable samplerAnisotropy device feature (#24)
Co-authored-by: TheSpydog <thespydog@noreply.example.org>
Co-committed-by: TheSpydog <thespydog@noreply.example.org>
2022-11-02 21:23:48 +00:00
1 changed files with 22 additions and 3 deletions

View File

@ -5446,7 +5446,7 @@ static VulkanRenderTarget* VULKAN_INTERNAL_CreateRenderTarget(
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
); );
renderTarget->multisampleCount = multisampleCount; renderTarget->multisampleCount = RefreshToVK_SampleCount[multisampleCount];
} }
/* create framebuffer compatible views for RenderTarget */ /* create framebuffer compatible views for RenderTarget */
@ -5810,7 +5810,9 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[ attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
attachmentDescription.format attachmentDescription.format
]; ];
attachmentDescriptions[attachmentDescriptionCount].samples = VK_SAMPLE_COUNT_1_BIT; attachmentDescriptions[attachmentDescriptionCount].samples = RefreshToVK_SampleCount[
attachmentDescription.sampleCount
];
attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
attachmentDescriptions[attachmentDescriptionCount].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
@ -8307,6 +8309,7 @@ static void VULKAN_BeginRenderPass(
VulkanTexture *texture; VulkanTexture *texture;
VkClearValue *clearValues; VkClearValue *clearValues;
uint32_t clearCount = colorAttachmentCount; uint32_t clearCount = colorAttachmentCount;
uint32_t multisampleAttachmentCount = 0;
uint32_t i; uint32_t i;
VkImageAspectFlags depthAspectFlags; VkImageAspectFlags depthAspectFlags;
Refresh_Viewport defaultViewport; Refresh_Viewport defaultViewport;
@ -8393,6 +8396,12 @@ static void VULKAN_BeginRenderPass(
&texture->resourceAccessType &texture->resourceAccessType
); );
if (colorAttachmentInfos[i].sampleCount > 1)
{
clearCount += 1;
multisampleAttachmentCount += 1;
}
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, texture); VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, texture);
} }
@ -8430,12 +8439,21 @@ static void VULKAN_BeginRenderPass(
clearValues = SDL_stack_alloc(VkClearValue, clearCount); clearValues = SDL_stack_alloc(VkClearValue, clearCount);
for (i = 0; i < colorAttachmentCount; i += 1) for (i = 0; i < colorAttachmentCount + multisampleAttachmentCount; i += 1)
{ {
clearValues[i].color.float32[0] = colorAttachmentInfos[i].clearColor.x; clearValues[i].color.float32[0] = colorAttachmentInfos[i].clearColor.x;
clearValues[i].color.float32[1] = colorAttachmentInfos[i].clearColor.y; clearValues[i].color.float32[1] = colorAttachmentInfos[i].clearColor.y;
clearValues[i].color.float32[2] = colorAttachmentInfos[i].clearColor.z; clearValues[i].color.float32[2] = colorAttachmentInfos[i].clearColor.z;
clearValues[i].color.float32[3] = colorAttachmentInfos[i].clearColor.w; clearValues[i].color.float32[3] = colorAttachmentInfos[i].clearColor.w;
if (colorAttachmentInfos[i].sampleCount > 0)
{
i += 1;
clearValues[i].color.float32[0] = colorAttachmentInfos[i].clearColor.x;
clearValues[i].color.float32[1] = colorAttachmentInfos[i].clearColor.y;
clearValues[i].color.float32[2] = colorAttachmentInfos[i].clearColor.z;
clearValues[i].color.float32[3] = colorAttachmentInfos[i].clearColor.w;
}
} }
if (depthStencilAttachmentInfo != NULL) if (depthStencilAttachmentInfo != NULL)
@ -10549,6 +10567,7 @@ static uint8_t VULKAN_INTERNAL_CreateLogicalDevice(
deviceFeatures.occlusionQueryPrecise = VK_TRUE; deviceFeatures.occlusionQueryPrecise = VK_TRUE;
deviceFeatures.fillModeNonSolid = VK_TRUE; deviceFeatures.fillModeNonSolid = VK_TRUE;
deviceFeatures.depthClamp = VK_TRUE; deviceFeatures.depthClamp = VK_TRUE;
deviceFeatures.samplerAnisotropy = VK_TRUE;
/* creating the logical device */ /* creating the logical device */