TextureSlice and TextureRegion API
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
721854921d
commit
eeccea8ce8
|
@ -386,13 +386,18 @@ typedef struct Refresh_TextureSlice
|
|||
Refresh_Texture *texture;
|
||||
uint32_t mipLevel;
|
||||
uint32_t layer;
|
||||
} Refresh_TextureSlice;
|
||||
|
||||
typedef struct Refresh_TextureRegion
|
||||
{
|
||||
Refresh_TextureSlice textureSlice;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t z;
|
||||
uint32_t w;
|
||||
uint32_t h;
|
||||
uint32_t d;
|
||||
} Refresh_TextureSlice;
|
||||
} Refresh_TextureRegion;
|
||||
|
||||
typedef struct Refresh_BufferImageCopy
|
||||
{
|
||||
|
@ -580,9 +585,7 @@ typedef struct Refresh_GraphicsPipelineCreateInfo
|
|||
|
||||
typedef struct Refresh_ColorAttachmentInfo
|
||||
{
|
||||
Refresh_Texture *texture;
|
||||
uint32_t layer;
|
||||
uint32_t level;
|
||||
Refresh_TextureSlice textureSlice;
|
||||
Refresh_Vec4 clearColor; /* Can be ignored by RenderPass */
|
||||
Refresh_LoadOp loadOp;
|
||||
Refresh_StoreOp storeOp;
|
||||
|
@ -591,9 +594,7 @@ typedef struct Refresh_ColorAttachmentInfo
|
|||
|
||||
typedef struct Refresh_DepthStencilAttachmentInfo
|
||||
{
|
||||
Refresh_Texture *texture;
|
||||
uint32_t layer;
|
||||
uint32_t level;
|
||||
Refresh_TextureSlice textureSlice;
|
||||
Refresh_DepthStencilValue depthStencilClearValue; /* Can be ignored by RenderPass */
|
||||
Refresh_LoadOp loadOp;
|
||||
Refresh_StoreOp storeOp;
|
||||
|
@ -1111,7 +1112,7 @@ REFRESHAPI void Refresh_UploadToTexture(
|
|||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
@ -1136,7 +1137,7 @@ REFRESHAPI void Refresh_UploadToBuffer(
|
|||
REFRESHAPI void Refresh_DownloadFromTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_TransferOptions option
|
||||
|
@ -1175,8 +1176,8 @@ REFRESHAPI void Refresh_DownloadFromBuffer(
|
|||
REFRESHAPI void Refresh_CopyTextureToTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *source,
|
||||
Refresh_TextureSlice *destination,
|
||||
Refresh_TextureRegion *source,
|
||||
Refresh_TextureRegion *destination,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
|
@ -1184,7 +1185,7 @@ REFRESHAPI void Refresh_CopyTextureToTexture(
|
|||
REFRESHAPI void Refresh_CopyTextureToBuffer(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
|
@ -1195,7 +1196,7 @@ REFRESHAPI void Refresh_CopyBufferToTexture(
|
|||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
|
|
@ -779,7 +779,7 @@ void Refresh_UploadToTexture(
|
|||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
|
@ -788,7 +788,7 @@ void Refresh_UploadToTexture(
|
|||
device->driverData,
|
||||
commandBuffer,
|
||||
transferBuffer,
|
||||
textureSlice,
|
||||
textureRegion,
|
||||
copyParams,
|
||||
option
|
||||
);
|
||||
|
@ -816,7 +816,7 @@ void Refresh_UploadToBuffer(
|
|||
void Refresh_DownloadFromTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_TransferOptions option
|
||||
|
@ -825,7 +825,7 @@ void Refresh_DownloadFromTexture(
|
|||
device->DownloadFromTexture(
|
||||
device->driverData,
|
||||
commandBuffer,
|
||||
textureSlice,
|
||||
textureRegion,
|
||||
transferBuffer,
|
||||
copyParams,
|
||||
option
|
||||
|
@ -854,16 +854,16 @@ void Refresh_DownloadFromBuffer(
|
|||
void Refresh_CopyTextureToTexture(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *sourceTextureSlice,
|
||||
Refresh_TextureSlice *destinationTextureSlice,
|
||||
Refresh_TextureRegion *source,
|
||||
Refresh_TextureRegion *destination,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
NULL_RETURN(device);
|
||||
device->CopyTextureToTexture(
|
||||
device->driverData,
|
||||
commandBuffer,
|
||||
sourceTextureSlice,
|
||||
destinationTextureSlice,
|
||||
source,
|
||||
destination,
|
||||
option
|
||||
);
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ void Refresh_CopyTextureToTexture(
|
|||
void Refresh_CopyTextureToBuffer(
|
||||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParameters,
|
||||
Refresh_CopyOptions option
|
||||
|
@ -880,7 +880,7 @@ void Refresh_CopyTextureToBuffer(
|
|||
device->CopyTextureToBuffer(
|
||||
device->driverData,
|
||||
commandBuffer,
|
||||
textureSlice,
|
||||
textureRegion,
|
||||
gpuBuffer,
|
||||
copyParameters,
|
||||
option
|
||||
|
@ -891,7 +891,7 @@ void Refresh_CopyBufferToTexture(
|
|||
Refresh_Device *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
|
@ -900,7 +900,7 @@ void Refresh_CopyBufferToTexture(
|
|||
device->driverData,
|
||||
commandBuffer,
|
||||
gpuBuffer,
|
||||
textureSlice,
|
||||
textureRegion,
|
||||
copyParams,
|
||||
option
|
||||
);
|
||||
|
|
|
@ -440,7 +440,7 @@ struct Refresh_Device
|
|||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
@ -457,7 +457,7 @@ struct Refresh_Device
|
|||
void (*DownloadFromTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureSlice,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_TransferOptions option
|
||||
|
@ -475,15 +475,15 @@ struct Refresh_Device
|
|||
void (*CopyTextureToTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *source,
|
||||
Refresh_TextureSlice *destination,
|
||||
Refresh_TextureRegion *source,
|
||||
Refresh_TextureRegion *destination,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
||||
void (*CopyTextureToBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureSlice,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
|
@ -493,7 +493,7 @@ struct Refresh_Device
|
|||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
);
|
||||
|
|
|
@ -5577,6 +5577,10 @@ static VulkanTexture* VULKAN_INTERNAL_CreateTexture(
|
|||
{
|
||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D;
|
||||
}
|
||||
else if (layerCount > 1)
|
||||
{
|
||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
|
@ -5789,7 +5793,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].textureSlice.texture)->activeTextureHandle->vulkanTexture;
|
||||
|
||||
if (texture->sampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||
{
|
||||
|
@ -5892,7 +5896,7 @@ static VkRenderPass VULKAN_INTERNAL_CreateRenderPass(
|
|||
}
|
||||
else
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture;
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->textureSlice.texture)->activeTextureHandle->vulkanTexture;
|
||||
|
||||
attachmentDescriptions[attachmentDescriptionCount].flags = 0;
|
||||
attachmentDescriptions[attachmentDescriptionCount].format = texture->format;
|
||||
|
@ -7490,7 +7494,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
hash.colorTargetDescriptions[i].format = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture->format;
|
||||
hash.colorTargetDescriptions[i].format = ((VulkanTextureContainer*) colorAttachmentInfos[i].textureSlice.texture)->activeTextureHandle->vulkanTexture->format;
|
||||
hash.colorTargetDescriptions[i].clearColor = colorAttachmentInfos[i].clearColor;
|
||||
hash.colorTargetDescriptions[i].loadOp = colorAttachmentInfos[i].loadOp;
|
||||
hash.colorTargetDescriptions[i].storeOp = colorAttachmentInfos[i].storeOp;
|
||||
|
@ -7499,7 +7503,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|||
hash.colorAttachmentSampleCount = VK_SAMPLE_COUNT_1_BIT;
|
||||
if (colorAttachmentCount > 0)
|
||||
{
|
||||
hash.colorAttachmentSampleCount = ((VulkanTextureContainer*) colorAttachmentInfos[0].texture)->activeTextureHandle->vulkanTexture->sampleCount;
|
||||
hash.colorAttachmentSampleCount = ((VulkanTextureContainer*) colorAttachmentInfos[0].textureSlice.texture)->activeTextureHandle->vulkanTexture->sampleCount;
|
||||
}
|
||||
|
||||
hash.colorAttachmentCount = colorAttachmentCount;
|
||||
|
@ -7514,7 +7518,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
|||
}
|
||||
else
|
||||
{
|
||||
hash.depthStencilTargetDescription.format = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture->format;
|
||||
hash.depthStencilTargetDescription.format = ((VulkanTextureContainer*) depthStencilAttachmentInfo->textureSlice.texture)->activeTextureHandle->vulkanTexture->format;
|
||||
hash.depthStencilTargetDescription.loadOp = depthStencilAttachmentInfo->loadOp;
|
||||
hash.depthStencilTargetDescription.storeOp = depthStencilAttachmentInfo->storeOp;
|
||||
hash.depthStencilTargetDescription.stencilLoadOp = depthStencilAttachmentInfo->stencilLoadOp;
|
||||
|
@ -7567,7 +7571,6 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
VkResult result;
|
||||
VkImageView imageViewAttachments[2 * MAX_COLOR_TARGET_BINDINGS + 1];
|
||||
FramebufferHash hash;
|
||||
VulkanTexture *texture;
|
||||
VulkanTextureSlice *textureSlice;
|
||||
uint32_t attachmentCount = 0;
|
||||
uint32_t i;
|
||||
|
@ -7582,12 +7585,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
colorAttachmentInfos[i].layer,
|
||||
colorAttachmentInfos[i].level
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&colorAttachmentInfos[i].textureSlice);
|
||||
|
||||
hash.colorAttachmentViews[i] = textureSlice->view;
|
||||
|
||||
|
@ -7603,12 +7601,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
}
|
||||
else
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
depthStencilAttachmentInfo->layer,
|
||||
depthStencilAttachmentInfo->level
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&depthStencilAttachmentInfo->textureSlice);
|
||||
hash.depthStencilAttachmentView = textureSlice->view;
|
||||
}
|
||||
|
||||
|
@ -7637,12 +7630,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
colorAttachmentInfos[i].layer,
|
||||
colorAttachmentInfos[i].level
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&colorAttachmentInfos[i].textureSlice);
|
||||
|
||||
imageViewAttachments[attachmentCount] =
|
||||
textureSlice->view;
|
||||
|
@ -7660,12 +7648,7 @@ static VulkanFramebuffer* VULKAN_INTERNAL_FetchFramebuffer(
|
|||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
depthStencilAttachmentInfo->layer,
|
||||
depthStencilAttachmentInfo->level
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&depthStencilAttachmentInfo->textureSlice);
|
||||
|
||||
imageViewAttachments[attachmentCount] =
|
||||
textureSlice->view;
|
||||
|
@ -7792,8 +7775,6 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
VulkanTextureContainer *textureContainer;
|
||||
VulkanTextureSlice *textureSlice;
|
||||
VulkanTexture *texture;
|
||||
VulkanTexture *msaaTexture = NULL;
|
||||
uint32_t w, h;
|
||||
VkClearValue *clearValues;
|
||||
uint32_t clearCount = colorAttachmentCount;
|
||||
|
@ -7808,12 +7789,8 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
textureContainer = (VulkanTextureContainer*) colorAttachmentInfos[i].texture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
textureContainer->activeTextureHandle->vulkanTexture,
|
||||
colorAttachmentInfos[i].layer,
|
||||
colorAttachmentInfos[i].level
|
||||
);
|
||||
textureContainer = (VulkanTextureContainer*) colorAttachmentInfos[i].textureSlice.texture;
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&colorAttachmentInfos[i].textureSlice);
|
||||
|
||||
if (
|
||||
colorAttachmentInfos[i].safeDiscard &&
|
||||
|
@ -7825,17 +7802,12 @@ static void VULKAN_BeginRenderPass(
|
|||
renderer,
|
||||
textureContainer
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&colorAttachmentInfos[i].textureSlice);
|
||||
}
|
||||
|
||||
texture = textureContainer->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
colorAttachmentInfos[i].layer,
|
||||
colorAttachmentInfos[i].level
|
||||
);
|
||||
|
||||
w = texture->dimensions.width >> colorAttachmentInfos[i].level;
|
||||
h = texture->dimensions.height >> colorAttachmentInfos[i].level;
|
||||
w = textureSlice->parent->dimensions.width >> colorAttachmentInfos[i].textureSlice.mipLevel;
|
||||
h = textureSlice->parent->dimensions.height >> colorAttachmentInfos[i].textureSlice.mipLevel;
|
||||
|
||||
/* The framebuffer cannot be larger than the smallest attachment. */
|
||||
|
||||
|
@ -7858,12 +7830,8 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
textureContainer = (VulkanTextureContainer*) depthStencilAttachmentInfo->texture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
textureContainer->activeTextureHandle->vulkanTexture,
|
||||
depthStencilAttachmentInfo->layer,
|
||||
depthStencilAttachmentInfo->level
|
||||
);
|
||||
textureContainer = (VulkanTextureContainer*) depthStencilAttachmentInfo->textureSlice.texture;
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&depthStencilAttachmentInfo->textureSlice);
|
||||
|
||||
if (
|
||||
depthStencilAttachmentInfo->safeDiscard &&
|
||||
|
@ -7876,17 +7844,11 @@ static void VULKAN_BeginRenderPass(
|
|||
renderer,
|
||||
textureContainer
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&depthStencilAttachmentInfo->textureSlice);
|
||||
}
|
||||
|
||||
texture = textureContainer->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
depthStencilAttachmentInfo->layer,
|
||||
depthStencilAttachmentInfo->level
|
||||
);
|
||||
|
||||
w = texture->dimensions.width >> depthStencilAttachmentInfo->level;
|
||||
h = texture->dimensions.height >> depthStencilAttachmentInfo->level;
|
||||
w = textureSlice->parent->dimensions.width >> depthStencilAttachmentInfo->textureSlice.mipLevel;
|
||||
h = textureSlice->parent->dimensions.height >> depthStencilAttachmentInfo->textureSlice.mipLevel;
|
||||
|
||||
/* The framebuffer cannot be larger than the smallest attachment. */
|
||||
|
||||
|
@ -7933,12 +7895,7 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
for (i = 0; i < colorAttachmentCount; i += 1)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
colorAttachmentInfos[i].layer,
|
||||
colorAttachmentInfos[i].level
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&colorAttachmentInfos[i].textureSlice);
|
||||
|
||||
vulkanCommandBuffer->renderPassColorTargetTextureSlices[i] = textureSlice;
|
||||
|
||||
|
@ -7950,20 +7907,14 @@ static void VULKAN_BeginRenderPass(
|
|||
textureSlice
|
||||
);
|
||||
|
||||
if (texture->sampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||
if (textureSlice->msaaTex != NULL)
|
||||
{
|
||||
msaaTexture = VULKAN_INTERNAL_FetchMSAATexture(
|
||||
texture,
|
||||
colorAttachmentInfos[i].layer,
|
||||
colorAttachmentInfos[i].level
|
||||
);
|
||||
|
||||
/* Transition the multisample attachment */
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
renderer,
|
||||
vulkanCommandBuffer->commandBuffer,
|
||||
RESOURCE_ACCESS_COLOR_ATTACHMENT_WRITE,
|
||||
&msaaTexture->slices[0]
|
||||
&textureSlice->msaaTex->slices[0]
|
||||
);
|
||||
|
||||
clearCount += 1;
|
||||
|
@ -7979,18 +7930,13 @@ static void VULKAN_BeginRenderPass(
|
|||
|
||||
if (depthStencilAttachmentInfo != NULL)
|
||||
{
|
||||
texture = ((VulkanTextureContainer*) depthStencilAttachmentInfo->texture)->activeTextureHandle->vulkanTexture;
|
||||
textureSlice = VULKAN_INTERNAL_FetchTextureSlice(
|
||||
texture,
|
||||
depthStencilAttachmentInfo->layer,
|
||||
depthStencilAttachmentInfo->level
|
||||
);
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&depthStencilAttachmentInfo->textureSlice);
|
||||
|
||||
vulkanCommandBuffer->renderPassDepthTextureSlice = textureSlice;
|
||||
|
||||
depthAspectFlags = VK_IMAGE_ASPECT_DEPTH_BIT;
|
||||
|
||||
if (IsStencilFormat(texture->format))
|
||||
if (IsStencilFormat(textureSlice->parent->format))
|
||||
{
|
||||
depthAspectFlags |= VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
}
|
||||
|
@ -8020,8 +7966,9 @@ static void VULKAN_BeginRenderPass(
|
|||
clearValues[i].color.float32[2] = colorAttachmentInfos[i].clearColor.z;
|
||||
clearValues[i].color.float32[3] = colorAttachmentInfos[i].clearColor.w;
|
||||
|
||||
texture = ((VulkanTextureContainer*) colorAttachmentInfos[i].texture)->activeTextureHandle->vulkanTexture;
|
||||
if (texture->sampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||
textureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&colorAttachmentInfos[i].textureSlice);
|
||||
|
||||
if (textureSlice->parent->sampleCount > VK_SAMPLE_COUNT_1_BIT)
|
||||
{
|
||||
clearValues[i+1].color.float32[0] = colorAttachmentInfos[i].clearColor.x;
|
||||
clearValues[i+1].color.float32[1] = colorAttachmentInfos[i].clearColor.y;
|
||||
|
@ -8580,18 +8527,18 @@ static void VULKAN_UploadToTexture(
|
|||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
VulkanTextureContainer *vulkanTextureContainer = (VulkanTextureContainer*) textureSlice->texture;
|
||||
VulkanTextureContainer *vulkanTextureContainer = (VulkanTextureContainer*) textureRegion->textureSlice.texture;
|
||||
VulkanTextureSlice *vulkanTextureSlice;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(textureSlice);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
|
||||
if (
|
||||
option == REFRESH_COPYOPTIONS_SAFEDISCARD &&
|
||||
|
@ -8603,7 +8550,7 @@ static void VULKAN_UploadToTexture(
|
|||
vulkanTextureContainer
|
||||
);
|
||||
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(textureSlice);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -8620,16 +8567,16 @@ static void VULKAN_UploadToTexture(
|
|||
vulkanTextureSlice
|
||||
);
|
||||
|
||||
imageCopy.imageExtent.width = textureSlice->w;
|
||||
imageCopy.imageExtent.height = textureSlice->h;
|
||||
imageCopy.imageExtent.depth = textureSlice->d;
|
||||
imageCopy.imageOffset.x = textureSlice->x;
|
||||
imageCopy.imageOffset.y = textureSlice->y;
|
||||
imageCopy.imageOffset.z = textureSlice->z;
|
||||
imageCopy.imageExtent.width = textureRegion->w;
|
||||
imageCopy.imageExtent.height = textureRegion->h;
|
||||
imageCopy.imageExtent.depth = textureRegion->d;
|
||||
imageCopy.imageOffset.x = textureRegion->x;
|
||||
imageCopy.imageOffset.y = textureRegion->y;
|
||||
imageCopy.imageOffset.z = textureRegion->z;
|
||||
imageCopy.imageSubresource.aspectMask = vulkanTextureSlice->parent->aspectFlags;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureSlice->layer;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureRegion->textureSlice.layer;
|
||||
imageCopy.imageSubresource.layerCount = 1;
|
||||
imageCopy.imageSubresource.mipLevel = textureSlice->mipLevel;
|
||||
imageCopy.imageSubresource.mipLevel = textureRegion->textureSlice.mipLevel;
|
||||
imageCopy.bufferOffset = copyParams->bufferOffset;
|
||||
imageCopy.bufferRowLength = copyParams->bufferStride;
|
||||
imageCopy.bufferImageHeight = copyParams->bufferImageHeight;
|
||||
|
@ -8706,7 +8653,7 @@ static void VULKAN_UploadToBuffer(
|
|||
static void VULKAN_DownloadFromTexture(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_TransferOptions option
|
||||
|
@ -8717,7 +8664,7 @@ static void VULKAN_DownloadFromTexture(
|
|||
VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer*) transferBuffer;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(textureSlice);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
|
||||
if (
|
||||
option == REFRESH_TRANSFEROPTIONS_SAFEDISCARD &&
|
||||
|
@ -8727,6 +8674,7 @@ static void VULKAN_DownloadFromTexture(
|
|||
renderer,
|
||||
transferBufferContainer
|
||||
);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -8743,16 +8691,16 @@ static void VULKAN_DownloadFromTexture(
|
|||
vulkanTextureSlice
|
||||
);
|
||||
|
||||
imageCopy.imageExtent.width = textureSlice->w;
|
||||
imageCopy.imageExtent.height = textureSlice->h;
|
||||
imageCopy.imageExtent.depth = textureSlice->d;
|
||||
imageCopy.imageOffset.x = textureSlice->x;
|
||||
imageCopy.imageOffset.y = textureSlice->y;
|
||||
imageCopy.imageOffset.z = textureSlice->z;
|
||||
imageCopy.imageExtent.width = textureRegion->w;
|
||||
imageCopy.imageExtent.height = textureRegion->h;
|
||||
imageCopy.imageExtent.depth = textureRegion->d;
|
||||
imageCopy.imageOffset.x = textureRegion->x;
|
||||
imageCopy.imageOffset.y = textureRegion->y;
|
||||
imageCopy.imageOffset.z = textureRegion->z;
|
||||
imageCopy.imageSubresource.aspectMask = vulkanTextureSlice->parent->aspectFlags;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureSlice->layer;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureRegion->textureSlice.layer;
|
||||
imageCopy.imageSubresource.layerCount = 1;
|
||||
imageCopy.imageSubresource.mipLevel = textureSlice->mipLevel;
|
||||
imageCopy.imageSubresource.mipLevel = textureRegion->textureSlice.mipLevel;
|
||||
imageCopy.bufferOffset = copyParams->bufferOffset;
|
||||
imageCopy.bufferRowLength = copyParams->bufferStride;
|
||||
imageCopy.bufferImageHeight = copyParams->bufferImageHeight;
|
||||
|
@ -8829,20 +8777,19 @@ static void VULKAN_DownloadFromBuffer(
|
|||
static void VULKAN_CopyTextureToTexture(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *source,
|
||||
Refresh_TextureSlice *destination,
|
||||
Refresh_TextureRegion *source,
|
||||
Refresh_TextureRegion *destination,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTextureContainer *srcContainer = (VulkanTextureContainer*) source->texture;
|
||||
VulkanTextureContainer *dstContainer = (VulkanTextureContainer*) destination->texture;
|
||||
VulkanTextureContainer *dstContainer = (VulkanTextureContainer*) destination->textureSlice.texture;
|
||||
VulkanTextureSlice *srcSlice;
|
||||
VulkanTextureSlice *dstSlice;
|
||||
VkImageCopy imageCopy;
|
||||
|
||||
srcSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(source);
|
||||
dstSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(destination);
|
||||
srcSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&source->textureSlice);
|
||||
dstSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&destination->textureSlice);
|
||||
|
||||
if (
|
||||
option == REFRESH_COPYOPTIONS_SAFEDISCARD &&
|
||||
|
@ -8853,7 +8800,7 @@ static void VULKAN_CopyTextureToTexture(
|
|||
renderer,
|
||||
dstContainer
|
||||
);
|
||||
dstSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(destination);
|
||||
dstSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&destination->textureSlice);
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||
|
@ -8874,16 +8821,16 @@ static void VULKAN_CopyTextureToTexture(
|
|||
imageCopy.srcOffset.y = source->y;
|
||||
imageCopy.srcOffset.z = source->z;
|
||||
imageCopy.srcSubresource.aspectMask = srcSlice->parent->aspectFlags;
|
||||
imageCopy.srcSubresource.baseArrayLayer = source->layer;
|
||||
imageCopy.srcSubresource.baseArrayLayer = source->textureSlice.layer;
|
||||
imageCopy.srcSubresource.layerCount = 1;
|
||||
imageCopy.srcSubresource.mipLevel = source->mipLevel;
|
||||
imageCopy.srcSubresource.mipLevel = source->textureSlice.mipLevel;
|
||||
imageCopy.dstOffset.x = destination->x;
|
||||
imageCopy.dstOffset.y = destination->y;
|
||||
imageCopy.dstOffset.z = destination->z;
|
||||
imageCopy.dstSubresource.aspectMask = dstSlice->parent->aspectFlags;
|
||||
imageCopy.dstSubresource.baseArrayLayer = destination->layer;
|
||||
imageCopy.dstSubresource.baseArrayLayer = destination->textureSlice.layer;
|
||||
imageCopy.dstSubresource.layerCount = 1;
|
||||
imageCopy.dstSubresource.mipLevel = destination->mipLevel;
|
||||
imageCopy.dstSubresource.mipLevel = destination->textureSlice.mipLevel;
|
||||
imageCopy.extent.width = source->w;
|
||||
imageCopy.extent.height = source->h;
|
||||
imageCopy.extent.depth = source->d;
|
||||
|
@ -8907,19 +8854,18 @@ static void VULKAN_CopyTextureToTexture(
|
|||
static void VULKAN_CopyTextureToBuffer(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanTextureContainer *textureContainer = (VulkanTextureContainer*) textureSlice->texture;
|
||||
VulkanTextureSlice *vulkanTextureSlice;
|
||||
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer*) gpuBuffer;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(textureSlice);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
|
||||
if (
|
||||
option == REFRESH_COPYOPTIONS_SAFEDISCARD &&
|
||||
|
@ -8945,16 +8891,16 @@ static void VULKAN_CopyTextureToBuffer(
|
|||
bufferContainer->activeBufferHandle->vulkanBuffer
|
||||
);
|
||||
|
||||
imageCopy.imageExtent.width = textureSlice->w;
|
||||
imageCopy.imageExtent.height = textureSlice->h;
|
||||
imageCopy.imageExtent.depth = textureSlice->d;
|
||||
imageCopy.imageOffset.x = textureSlice->x;
|
||||
imageCopy.imageOffset.y = textureSlice->y;
|
||||
imageCopy.imageOffset.z = textureSlice->z;
|
||||
imageCopy.imageExtent.width = textureRegion->w;
|
||||
imageCopy.imageExtent.height = textureRegion->h;
|
||||
imageCopy.imageExtent.depth = textureRegion->d;
|
||||
imageCopy.imageOffset.x = textureRegion->x;
|
||||
imageCopy.imageOffset.y = textureRegion->y;
|
||||
imageCopy.imageOffset.z = textureRegion->z;
|
||||
imageCopy.imageSubresource.aspectMask = vulkanTextureSlice->parent->aspectFlags;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureSlice->layer;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureRegion->textureSlice.layer;
|
||||
imageCopy.imageSubresource.layerCount = 1;
|
||||
imageCopy.imageSubresource.mipLevel = textureSlice->mipLevel;
|
||||
imageCopy.imageSubresource.mipLevel = textureRegion->textureSlice.mipLevel;
|
||||
imageCopy.bufferOffset = copyParams->bufferOffset;
|
||||
imageCopy.bufferRowLength = copyParams->bufferStride;
|
||||
imageCopy.bufferImageHeight = copyParams->bufferImageHeight;
|
||||
|
@ -8978,18 +8924,18 @@ static void VULKAN_CopyBufferToTexture(
|
|||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GpuBuffer *gpuBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_TextureRegion *textureRegion,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
Refresh_CopyOptions option
|
||||
) {
|
||||
VulkanRenderer *renderer = (VulkanRenderer*) driverData;
|
||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) commandBuffer;
|
||||
VulkanBufferContainer *bufferContainer = (VulkanBufferContainer*) gpuBuffer;
|
||||
VulkanTextureContainer *textureContainer = (VulkanTextureContainer*) textureSlice->texture;
|
||||
VulkanTextureContainer *textureContainer = (VulkanTextureContainer*) textureRegion->textureSlice.texture;
|
||||
VulkanTextureSlice *vulkanTextureSlice;
|
||||
VkBufferImageCopy imageCopy;
|
||||
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(textureSlice);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
|
||||
if (
|
||||
option == REFRESH_COPYOPTIONS_SAFEDISCARD &&
|
||||
|
@ -9000,7 +8946,7 @@ static void VULKAN_CopyBufferToTexture(
|
|||
renderer,
|
||||
textureContainer
|
||||
);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(textureSlice);
|
||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||
|
@ -9017,16 +8963,16 @@ static void VULKAN_CopyBufferToTexture(
|
|||
vulkanTextureSlice
|
||||
);
|
||||
|
||||
imageCopy.imageExtent.width = textureSlice->w;
|
||||
imageCopy.imageExtent.height = textureSlice->h;
|
||||
imageCopy.imageExtent.depth = textureSlice->d;
|
||||
imageCopy.imageOffset.x = textureSlice->x;
|
||||
imageCopy.imageOffset.y = textureSlice->y;
|
||||
imageCopy.imageOffset.z = textureSlice->z;
|
||||
imageCopy.imageExtent.width = textureRegion->w;
|
||||
imageCopy.imageExtent.height = textureRegion->h;
|
||||
imageCopy.imageExtent.depth = textureRegion->d;
|
||||
imageCopy.imageOffset.x = textureRegion->x;
|
||||
imageCopy.imageOffset.y = textureRegion->y;
|
||||
imageCopy.imageOffset.z = textureRegion->z;
|
||||
imageCopy.imageSubresource.aspectMask = vulkanTextureSlice->parent->aspectFlags;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureSlice->layer;
|
||||
imageCopy.imageSubresource.baseArrayLayer = textureRegion->textureSlice.layer;
|
||||
imageCopy.imageSubresource.layerCount = 1;
|
||||
imageCopy.imageSubresource.mipLevel = textureSlice->mipLevel;
|
||||
imageCopy.imageSubresource.mipLevel = textureRegion->textureSlice.mipLevel;
|
||||
imageCopy.bufferOffset = copyParams->bufferOffset;
|
||||
imageCopy.bufferRowLength = copyParams->bufferStride;
|
||||
imageCopy.bufferImageHeight = copyParams->bufferImageHeight;
|
||||
|
|
Loading…
Reference in New Issue