Vulkan: Compile compute shaders only if enabled.
This commit is contained in:
parent
41a6831333
commit
be5d93d5f1
2 changed files with 14 additions and 9 deletions
|
@ -224,7 +224,6 @@ void VulkanTexture::Touch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageView VulkanTexture::CreateViewForMip(int mip) {
|
VkImageView VulkanTexture::CreateViewForMip(int mip) {
|
||||||
// Create the view while we're at it.
|
|
||||||
VkImageViewCreateInfo view_info = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
VkImageViewCreateInfo view_info = { VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO };
|
||||||
view_info.image = image_;
|
view_info.image = image_;
|
||||||
view_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
view_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||||
|
|
|
@ -625,7 +625,9 @@ void TextureCacheVulkan::DeviceLost() {
|
||||||
if (samplerNearest_)
|
if (samplerNearest_)
|
||||||
vulkan_->Delete().QueueDeleteSampler(samplerNearest_);
|
vulkan_->Delete().QueueDeleteSampler(samplerNearest_);
|
||||||
|
|
||||||
|
if (uploadCS_ != VK_NULL_HANDLE)
|
||||||
vulkan_->Delete().QueueDeleteShaderModule(uploadCS_);
|
vulkan_->Delete().QueueDeleteShaderModule(uploadCS_);
|
||||||
|
if (copyCS_ != VK_NULL_HANDLE)
|
||||||
vulkan_->Delete().QueueDeleteShaderModule(copyCS_);
|
vulkan_->Delete().QueueDeleteShaderModule(copyCS_);
|
||||||
|
|
||||||
computeShaderManager_.DeviceLost();
|
computeShaderManager_.DeviceLost();
|
||||||
|
@ -655,10 +657,12 @@ void TextureCacheVulkan::DeviceRestore(VulkanContext *vulkan, Draw::DrawContext
|
||||||
std::string fullUploadShader = StringFromFormat(uploadShader, shader4xbrz);
|
std::string fullUploadShader = StringFromFormat(uploadShader, shader4xbrz);
|
||||||
std::string fullCopyShader = StringFromFormat(copyShader, shader4xbrz);
|
std::string fullCopyShader = StringFromFormat(copyShader, shader4xbrz);
|
||||||
|
|
||||||
|
if (g_Config.bTexHardwareScaling) {
|
||||||
uploadCS_ = CompileShaderModule(vulkan_, VK_SHADER_STAGE_COMPUTE_BIT, fullUploadShader.c_str(), &error);
|
uploadCS_ = CompileShaderModule(vulkan_, VK_SHADER_STAGE_COMPUTE_BIT, fullUploadShader.c_str(), &error);
|
||||||
_dbg_assert_msg_(G3D, uploadCS_ != VK_NULL_HANDLE, "failed to compile upload shader");
|
_dbg_assert_msg_(G3D, uploadCS_ != VK_NULL_HANDLE, "failed to compile upload shader");
|
||||||
copyCS_ = CompileShaderModule(vulkan_, VK_SHADER_STAGE_COMPUTE_BIT, fullCopyShader.c_str(), &error);
|
copyCS_ = CompileShaderModule(vulkan_, VK_SHADER_STAGE_COMPUTE_BIT, fullCopyShader.c_str(), &error);
|
||||||
_dbg_assert_msg_(G3D, copyCS_!= VK_NULL_HANDLE, "failed to compile copy shader");
|
_dbg_assert_msg_(G3D, copyCS_!= VK_NULL_HANDLE, "failed to compile copy shader");
|
||||||
|
}
|
||||||
|
|
||||||
computeShaderManager_.DeviceRestore(vulkan);
|
computeShaderManager_.DeviceRestore(vulkan);
|
||||||
}
|
}
|
||||||
|
@ -1094,8 +1098,10 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||||
// Compute experiment
|
// Compute experiment
|
||||||
if (actualFmt == VULKAN_8888_FORMAT && scaleFactor > 1 && g_Config.bTexHardwareScaling) {
|
if (actualFmt == VULKAN_8888_FORMAT && scaleFactor > 1 && g_Config.bTexHardwareScaling) {
|
||||||
// Enable the experiment you want.
|
// Enable the experiment you want.
|
||||||
// computeCopy = true;
|
if (uploadCS_ != VK_NULL_HANDLE)
|
||||||
computeUpload = true;
|
computeUpload = true;
|
||||||
|
else if (copyCS_ != VK_NULL_HANDLE)
|
||||||
|
computeCopy = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (computeUpload) {
|
if (computeUpload) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue