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