|
|
@ -971,7 +971,6 @@ typedef struct RenderPassHash
|
|
|
|
RenderPassColorTargetDescription colorTargetDescriptions[MAX_COLOR_TARGET_BINDINGS];
|
|
|
|
RenderPassColorTargetDescription colorTargetDescriptions[MAX_COLOR_TARGET_BINDINGS];
|
|
|
|
uint32_t colorAttachmentCount;
|
|
|
|
uint32_t colorAttachmentCount;
|
|
|
|
RenderPassDepthStencilTargetDescription depthStencilTargetDescription;
|
|
|
|
RenderPassDepthStencilTargetDescription depthStencilTargetDescription;
|
|
|
|
Refresh_SampleCount colorAttachmentSampleCount;
|
|
|
|
|
|
|
|
} RenderPassHash;
|
|
|
|
} RenderPassHash;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct RenderPassHashMap
|
|
|
|
typedef struct RenderPassHashMap
|
|
|
@ -998,11 +997,6 @@ static inline uint8_t RenderPassHash_Compare(
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (a->colorAttachmentSampleCount != b->colorAttachmentSampleCount)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < a->colorAttachmentCount; i += 1)
|
|
|
|
for (i = 0; i < a->colorAttachmentCount; i += 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (a->colorTargetDescriptions[i].format != b->colorTargetDescriptions[i].format)
|
|
|
|
if (a->colorTargetDescriptions[i].format != b->colorTargetDescriptions[i].format)
|
|
|
@ -2029,29 +2023,6 @@ static inline VkDeviceSize VULKAN_INTERNAL_BytesPerImage(
|
|
|
|
return blocksPerRow * blocksPerColumn * VULKAN_INTERNAL_BytesPerPixel(format);
|
|
|
|
return blocksPerRow * blocksPerColumn * VULKAN_INTERNAL_BytesPerPixel(format);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline Refresh_SampleCount VULKAN_INTERNAL_GetMaxMultiSampleCount(
|
|
|
|
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
|
|
|
|
Refresh_SampleCount multiSampleCount
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
VkSampleCountFlags flags = renderer->physicalDeviceProperties.properties.limits.framebufferColorSampleCounts;
|
|
|
|
|
|
|
|
Refresh_SampleCount maxSupported = REFRESH_SAMPLECOUNT_1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (flags & VK_SAMPLE_COUNT_8_BIT)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
maxSupported = REFRESH_SAMPLECOUNT_8;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (flags & VK_SAMPLE_COUNT_4_BIT)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
maxSupported = REFRESH_SAMPLECOUNT_4;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (flags & VK_SAMPLE_COUNT_2_BIT)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
maxSupported = REFRESH_SAMPLECOUNT_2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return SDL_min(multiSampleCount, maxSupported);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Memory Management */
|
|
|
|
/* Memory Management */
|
|
|
|
|
|
|
|
|
|
|
|
static inline VkDeviceSize VULKAN_INTERNAL_NextHighestAlignment(
|
|
|
|
static inline VkDeviceSize VULKAN_INTERNAL_NextHighestAlignment(
|
|
|
@ -5460,12 +5431,6 @@ static VulkanRenderTarget* VULKAN_INTERNAL_CreateRenderTarget(
|
|
|
|
/* create resolve target for multisample */
|
|
|
|
/* create resolve target for multisample */
|
|
|
|
if (multisampleCount > REFRESH_SAMPLECOUNT_1)
|
|
|
|
if (multisampleCount > REFRESH_SAMPLECOUNT_1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Find a compatible sample count to use */
|
|
|
|
|
|
|
|
multisampleCount = VULKAN_INTERNAL_GetMaxMultiSampleCount(
|
|
|
|
|
|
|
|
renderer,
|
|
|
|
|
|
|
|
multisampleCount
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderTarget->multisampleTexture =
|
|
|
|
renderTarget->multisampleTexture =
|
|
|
|
VULKAN_INTERNAL_CreateTexture(
|
|
|
|
VULKAN_INTERNAL_CreateTexture(
|
|
|
|
renderer,
|
|
|
|
renderer,
|
|
|
@ -5481,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 = RefreshToVK_SampleCount[multisampleCount];
|
|
|
|
renderTarget->multisampleCount = multisampleCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* create framebuffer compatible views for RenderTarget */
|
|
|
|
/* create framebuffer compatible views for RenderTarget */
|
|
|
@ -5575,7 +5540,6 @@ static VulkanRenderTarget* VULKAN_INTERNAL_FetchRenderTarget(
|
|
|
|
|
|
|
|
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
VulkanCommandBuffer *commandBuffer,
|
|
|
|
|
|
|
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
|
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
|
|
uint32_t colorAttachmentCount,
|
|
|
|
uint32_t colorAttachmentCount,
|
|
|
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
|
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
|
@ -5615,22 +5579,6 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
multisampling = 1;
|
|
|
|
multisampling = 1;
|
|
|
|
|
|
|
|
|
|
|
|
/* Transition the multisample attachment */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
|
|
|
|
|
|
|
renderer,
|
|
|
|
|
|
|
|
commandBuffer->commandBuffer,
|
|
|
|
|
|
|
|
RESOURCE_ACCESS_COLOR_ATTACHMENT_WRITE,
|
|
|
|
|
|
|
|
VK_IMAGE_ASPECT_COLOR_BIT,
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
renderTarget->multisampleTexture->layerCount,
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
renderTarget->multisampleTexture->levelCount,
|
|
|
|
|
|
|
|
0,
|
|
|
|
|
|
|
|
renderTarget->multisampleTexture->image,
|
|
|
|
|
|
|
|
&renderTarget->multisampleTexture->resourceAccessType
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Resolve attachment and multisample attachment */
|
|
|
|
/* Resolve attachment and multisample attachment */
|
|
|
|
|
|
|
|
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
|
|
@ -5640,8 +5588,9 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
|
|
|
colorAttachmentInfos[i].loadOp
|
|
|
|
colorAttachmentInfos[i].loadOp
|
|
|
|
];
|
|
|
|
];
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].storeOp =
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
|
|
|
VK_ATTACHMENT_STORE_OP_STORE; /* Always store the resolve texture */
|
|
|
|
colorAttachmentInfos[i].storeOp
|
|
|
|
|
|
|
|
];
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
|
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
|
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
|
|
@ -5694,8 +5643,9 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].loadOp = RefreshToVK_LoadOp[
|
|
|
|
colorAttachmentInfos[i].loadOp
|
|
|
|
colorAttachmentInfos[i].loadOp
|
|
|
|
];
|
|
|
|
];
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].storeOp =
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].storeOp = RefreshToVK_StoreOp[
|
|
|
|
VK_ATTACHMENT_STORE_OP_STORE; /* Always store non-MSAA textures */
|
|
|
|
colorAttachmentInfos[i].storeOp
|
|
|
|
|
|
|
|
];
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilLoadOp =
|
|
|
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
|
|
VK_ATTACHMENT_LOAD_OP_DONT_CARE;
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].stencilStoreOp =
|
|
|
@ -5810,8 +5760,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
|
|
|
|
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
Refresh_GraphicsPipelineAttachmentInfo attachmentInfo,
|
|
|
|
Refresh_GraphicsPipelineAttachmentInfo attachmentInfo
|
|
|
|
Refresh_SampleCount sampleCount
|
|
|
|
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
|
|
|
VkAttachmentDescription attachmentDescriptions[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
|
|
|
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
|
|
|
VkAttachmentReference colorAttachmentReferences[MAX_COLOR_TARGET_BINDINGS];
|
|
|
@ -5833,7 +5782,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
attachmentDescription = attachmentInfo.colorAttachmentDescriptions[i];
|
|
|
|
attachmentDescription = attachmentInfo.colorAttachmentDescriptions[i];
|
|
|
|
|
|
|
|
|
|
|
|
if (sampleCount > REFRESH_SAMPLECOUNT_1)
|
|
|
|
if (attachmentDescription.sampleCount > REFRESH_SAMPLECOUNT_1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
multisampling = 1;
|
|
|
|
multisampling = 1;
|
|
|
|
|
|
|
|
|
|
|
@ -5861,9 +5810,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].format = RefreshToVK_SurfaceFormat[
|
|
|
|
attachmentDescription.format
|
|
|
|
attachmentDescription.format
|
|
|
|
];
|
|
|
|
];
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples = RefreshToVK_SampleCount[
|
|
|
|
attachmentDescriptions[attachmentDescriptionCount].samples = VK_SAMPLE_COUNT_1_BIT;
|
|
|
|
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;
|
|
|
@ -5993,7 +5940,6 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
VkResult vulkanResult;
|
|
|
|
VkResult vulkanResult;
|
|
|
|
uint32_t i;
|
|
|
|
uint32_t i;
|
|
|
|
Refresh_SampleCount actualSampleCount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VulkanGraphicsPipeline *graphicsPipeline = (VulkanGraphicsPipeline*) SDL_malloc(sizeof(VulkanGraphicsPipeline));
|
|
|
|
VulkanGraphicsPipeline *graphicsPipeline = (VulkanGraphicsPipeline*) SDL_malloc(sizeof(VulkanGraphicsPipeline));
|
|
|
|
VkGraphicsPipelineCreateInfo vkPipelineCreateInfo;
|
|
|
|
VkGraphicsPipelineCreateInfo vkPipelineCreateInfo;
|
|
|
@ -6031,19 +5977,11 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
|
|
|
|
|
|
|
|
|
|
|
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
|
|
|
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
|
|
|
|
|
|
|
|
|
|
|
/* Find a compatible sample count to use */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actualSampleCount = VULKAN_INTERNAL_GetMaxMultiSampleCount(
|
|
|
|
|
|
|
|
renderer,
|
|
|
|
|
|
|
|
pipelineCreateInfo->multisampleState.multisampleCount
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a "compatible" render pass */
|
|
|
|
/* Create a "compatible" render pass */
|
|
|
|
|
|
|
|
|
|
|
|
VkRenderPass transientRenderPass = VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
VkRenderPass transientRenderPass = VULKAN_INTERNAL_CreateTransientRenderPass(
|
|
|
|
renderer,
|
|
|
|
renderer,
|
|
|
|
pipelineCreateInfo->attachmentInfo,
|
|
|
|
pipelineCreateInfo->attachmentInfo
|
|
|
|
actualSampleCount
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* Dynamic state */
|
|
|
|
/* Dynamic state */
|
|
|
@ -6174,7 +6112,9 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
|
|
|
|
multisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
|
|
|
multisampleStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
|
|
|
multisampleStateCreateInfo.pNext = NULL;
|
|
|
|
multisampleStateCreateInfo.pNext = NULL;
|
|
|
|
multisampleStateCreateInfo.flags = 0;
|
|
|
|
multisampleStateCreateInfo.flags = 0;
|
|
|
|
multisampleStateCreateInfo.rasterizationSamples = RefreshToVK_SampleCount[actualSampleCount];
|
|
|
|
multisampleStateCreateInfo.rasterizationSamples = RefreshToVK_SampleCount[
|
|
|
|
|
|
|
|
pipelineCreateInfo->multisampleState.multisampleCount
|
|
|
|
|
|
|
|
];
|
|
|
|
multisampleStateCreateInfo.sampleShadingEnable = VK_FALSE;
|
|
|
|
multisampleStateCreateInfo.sampleShadingEnable = VK_FALSE;
|
|
|
|
multisampleStateCreateInfo.minSampleShading = 1.0f;
|
|
|
|
multisampleStateCreateInfo.minSampleShading = 1.0f;
|
|
|
|
multisampleStateCreateInfo.pSampleMask =
|
|
|
|
multisampleStateCreateInfo.pSampleMask =
|
|
|
@ -8040,7 +7980,6 @@ static void VULKAN_QueueDestroyGraphicsPipeline(
|
|
|
|
|
|
|
|
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
|
static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
VulkanRenderer *renderer,
|
|
|
|
VulkanCommandBuffer *commandBuffer,
|
|
|
|
|
|
|
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
|
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
|
|
uint32_t colorAttachmentCount,
|
|
|
|
uint32_t colorAttachmentCount,
|
|
|
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
|
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
|
@ -8059,11 +7998,6 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
|
hash.colorTargetDescriptions[i].storeOp = colorAttachmentInfos[i].storeOp;
|
|
|
|
hash.colorTargetDescriptions[i].storeOp = colorAttachmentInfos[i].storeOp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (colorAttachmentCount > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hash.colorAttachmentSampleCount = colorAttachmentInfos[0].sampleCount;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hash.colorAttachmentCount = colorAttachmentCount;
|
|
|
|
hash.colorAttachmentCount = colorAttachmentCount;
|
|
|
|
|
|
|
|
|
|
|
|
if (depthStencilAttachmentInfo == NULL)
|
|
|
|
if (depthStencilAttachmentInfo == NULL)
|
|
|
@ -8096,7 +8030,6 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|
|
|
|
|
|
|
|
|
|
|
renderPass = VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
renderPass = VULKAN_INTERNAL_CreateRenderPass(
|
|
|
|
renderer,
|
|
|
|
renderer,
|
|
|
|
commandBuffer,
|
|
|
|
|
|
|
|
colorAttachmentInfos,
|
|
|
|
colorAttachmentInfos,
|
|
|
|
colorAttachmentCount,
|
|
|
|
colorAttachmentCount,
|
|
|
|
depthStencilAttachmentInfo
|
|
|
|
depthStencilAttachmentInfo
|
|
|
@ -8361,6 +8294,7 @@ static void VULKAN_SetScissor(
|
|
|
|
static void VULKAN_BeginRenderPass(
|
|
|
|
static void VULKAN_BeginRenderPass(
|
|
|
|
Refresh_Renderer *driverData,
|
|
|
|
Refresh_Renderer *driverData,
|
|
|
|
Refresh_CommandBuffer *commandBuffer,
|
|
|
|
Refresh_CommandBuffer *commandBuffer,
|
|
|
|
|
|
|
|
Refresh_Rect *renderArea,
|
|
|
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
|
|
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
|
|
|
uint32_t colorAttachmentCount,
|
|
|
|
uint32_t colorAttachmentCount,
|
|
|
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
|
|
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
|
|
@ -8373,7 +8307,6 @@ 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;
|
|
|
@ -8423,7 +8356,6 @@ static void VULKAN_BeginRenderPass(
|
|
|
|
|
|
|
|
|
|
|
|
renderPass = VULKAN_INTERNAL_FetchRenderPass(
|
|
|
|
renderPass = VULKAN_INTERNAL_FetchRenderPass(
|
|
|
|
renderer,
|
|
|
|
renderer,
|
|
|
|
vulkanCommandBuffer,
|
|
|
|
|
|
|
|
colorAttachmentInfos,
|
|
|
|
colorAttachmentInfos,
|
|
|
|
colorAttachmentCount,
|
|
|
|
colorAttachmentCount,
|
|
|
|
depthStencilAttachmentInfo
|
|
|
|
depthStencilAttachmentInfo
|
|
|
@ -8461,12 +8393,6 @@ static void VULKAN_BeginRenderPass(
|
|
|
|
&texture->resourceAccessType
|
|
|
|
&texture->resourceAccessType
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (colorAttachmentInfos[i].sampleCount > REFRESH_SAMPLECOUNT_1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
clearCount += 1;
|
|
|
|
|
|
|
|
multisampleAttachmentCount += 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, texture);
|
|
|
|
VULKAN_INTERNAL_TrackTexture(renderer, vulkanCommandBuffer, texture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -8504,21 +8430,12 @@ static void VULKAN_BeginRenderPass(
|
|
|
|
|
|
|
|
|
|
|
|
clearValues = SDL_stack_alloc(VkClearValue, clearCount);
|
|
|
|
clearValues = SDL_stack_alloc(VkClearValue, clearCount);
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < colorAttachmentCount + multisampleAttachmentCount; i += 1)
|
|
|
|
for (i = 0; i < colorAttachmentCount; 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 > REFRESH_SAMPLECOUNT_1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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)
|
|
|
@ -8536,10 +8453,21 @@ static void VULKAN_BeginRenderPass(
|
|
|
|
renderPassBeginInfo.framebuffer = framebuffer->framebuffer;
|
|
|
|
renderPassBeginInfo.framebuffer = framebuffer->framebuffer;
|
|
|
|
renderPassBeginInfo.pClearValues = clearValues;
|
|
|
|
renderPassBeginInfo.pClearValues = clearValues;
|
|
|
|
renderPassBeginInfo.clearValueCount = clearCount;
|
|
|
|
renderPassBeginInfo.clearValueCount = clearCount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (renderArea != NULL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
renderPassBeginInfo.renderArea.extent.width = renderArea->w;
|
|
|
|
|
|
|
|
renderPassBeginInfo.renderArea.extent.height = renderArea->h;
|
|
|
|
|
|
|
|
renderPassBeginInfo.renderArea.offset.x = renderArea->x;
|
|
|
|
|
|
|
|
renderPassBeginInfo.renderArea.offset.y = renderArea->y;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
renderPassBeginInfo.renderArea.extent.width = framebufferWidth;
|
|
|
|
renderPassBeginInfo.renderArea.extent.width = framebufferWidth;
|
|
|
|
renderPassBeginInfo.renderArea.extent.height = framebufferHeight;
|
|
|
|
renderPassBeginInfo.renderArea.extent.height = framebufferHeight;
|
|
|
|
renderPassBeginInfo.renderArea.offset.x = 0;
|
|
|
|
renderPassBeginInfo.renderArea.offset.x = 0;
|
|
|
|
renderPassBeginInfo.renderArea.offset.y = 0;
|
|
|
|
renderPassBeginInfo.renderArea.offset.y = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderer->vkCmdBeginRenderPass(
|
|
|
|
renderer->vkCmdBeginRenderPass(
|
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
|
vulkanCommandBuffer->commandBuffer,
|
|
|
|