Vulkan: Fixes validation errors with "null" textures

These arise in non-buffered rendering when we don't have a framebuffer
to texture from.
This commit is contained in:
Henrik Rydgård committed 2022-10-28 18:40:55 +02:00
1 parent ac818d9639
commit c6fe91224a
3 files changed
+10 -3

No files matched your search

+7 -1
View File
@@ -1343,7 +1343,11 @@ void VKContext::BindTextures(int start, int count, Texture **textures, TextureBi
boundImageView_[i] = boundTextures_[i]->GetImageView();
}
} else {
boundImageView_[i] = GetNullTexture()->GetImageView();
if (flags & TextureBindFlags::VULKAN_BIND_ARRAY) {
boundImageView_[i] = GetNullTexture()->GetImageArrayView();
} else {
boundImageView_[i] = GetNullTexture()->GetImageView();
}
}
}
}
@@ -1693,6 +1697,8 @@ uint64_t VKContext::GetNativeObject(NativeObject obj, void *srcObject) {
return (uint64_t)(uintptr_t)&renderManager_;
case NativeObject::NULL_IMAGEVIEW:
return (uint64_t)GetNullTexture()->GetImageView();
case NativeObject::NULL_IMAGEVIEW_ARRAY:
return (uint64_t)GetNullTexture()->GetImageArrayView();
case NativeObject::TEXTURE_VIEW:
return (uint64_t)(((VKTexture *)srcObject)->GetImageView());
case NativeObject::BOUND_FRAMEBUFFER_COLOR_IMAGEVIEW_ALL_LAYERS:
+1
View File
@@ -249,6 +249,7 @@ enum class NativeObject {
RENDER_MANAGER,
TEXTURE_VIEW,
NULL_IMAGEVIEW,
NULL_IMAGEVIEW_ARRAY,
FRAME_DATA_DESC_SET_LAYOUT,
THIN3D_PIPELINE_LAYOUT,
};
+2 -2
View File
@@ -770,7 +770,7 @@ void DrawEngineVulkan::DoFlush() {
textureCache_->ApplyTexture();
textureCache_->GetVulkanHandles(imageView, sampler);
if (imageView == VK_NULL_HANDLE)
imageView = (VkImageView)draw_->GetNativeObject(Draw::NativeObject::NULL_IMAGEVIEW);
imageView = (VkImageView)draw_->GetNativeObject(gstate_c.arrayTexture ? Draw::NativeObject::NULL_IMAGEVIEW_ARRAY : Draw::NativeObject::NULL_IMAGEVIEW);
if (sampler == VK_NULL_HANDLE)
sampler = nullSampler_;
}
@@ -906,7 +906,7 @@ void DrawEngineVulkan::DoFlush() {
textureCache_->ApplyTexture();
textureCache_->GetVulkanHandles(imageView, sampler);
if (imageView == VK_NULL_HANDLE)
imageView = (VkImageView)draw_->GetNativeObject(Draw::NativeObject::NULL_IMAGEVIEW);
imageView = (VkImageView)draw_->GetNativeObject(gstate_c.arrayTexture ? Draw::NativeObject::NULL_IMAGEVIEW_ARRAY : Draw::NativeObject::NULL_IMAGEVIEW);
if (sampler == VK_NULL_HANDLE)
sampler = nullSampler_;
}