Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Fix trying to compare uninitialized parts of packed descriptors #18678

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Vulkan: Fix trying to compare uninitialized parts of packed descriptors
Found by Valgrind.

Other minor cleanup, too.
  • Loading branch information
hrydgard committed Jan 10, 2024
commit d0817c4c0ae67a5e0c7243eb80eec46107863f55
4 changes: 3 additions & 1 deletion Common/GPU/Vulkan/VulkanLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,14 @@ static VulkanLibraryHandle VulkanLoadLibrary(const char *logname) {
(std::string(tempDir.c_str()) + "/").c_str(),g_nativeLibDir.c_str(),
(std::string(driverPath.c_str()) + "/").c_str(),driverLibName.c_str(),
(std::string(fileRedirectDir.c_str()) + "/").c_str(),nullptr);
if (!lib) {
ERROR_LOG(G3D, "Failed to load custom driver");
}
}
}
#endif

if (!lib) {
ERROR_LOG(G3D, "Failed to load custom driver");
for (int i = 0; i < ARRAY_SIZE(so_names); i++) {
lib = dlopen(so_names[i], RTLD_NOW | RTLD_LOCAL);
if (lib) {
Expand Down
6 changes: 5 additions & 1 deletion Common/GPU/Vulkan/VulkanRenderManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,13 @@ struct PackedDescriptor {
} image;
struct {
VkBuffer buffer;
uint32_t offset;
uint32_t range;
uint32_t offset;
} buffer;
struct {
VkBuffer buffer;
uint64_t range; // write range and a zero offset in one operation with this.
} buffer_zero_offset;
};
};

Expand Down
2 changes: 1 addition & 1 deletion Common/Render/ManagedTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class TextureLoadTask : public Task {
size_t fileSize;
uint8_t *buffer = g_VFS.ReadFile(filename_.c_str(), &fileSize);
if (!buffer) {
filename_.clear();
ERROR_LOG(IO, "Failed to read file '%s'", filename_.c_str());
filename_.clear();
*state_ = ManagedTexture::LoadState::FAILED;
return;
}
Expand Down
12 changes: 6 additions & 6 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ void DrawEngineVulkan::DoFlush() {
descriptors[1].image.sampler = samplerSecondaryNearest_;
descriptors[2].image.view = boundDepal_;
descriptors[2].image.sampler = (boundDepal_ && boundDepalSmoothed_) ? samplerSecondaryLinear_ : samplerSecondaryNearest_;
descriptors[3].buffer.buffer = baseBuf;
descriptors[3].buffer.range = sizeof(UB_VS_FS_Base);
descriptors[4].buffer.buffer = lightBuf;
descriptors[4].buffer.range = sizeof(UB_VS_Lights);
descriptors[5].buffer.buffer = boneBuf;
descriptors[5].buffer.range = sizeof(UB_VS_Bones);
descriptors[3].buffer_zero_offset.buffer = baseBuf;
descriptors[3].buffer_zero_offset.range = sizeof(UB_VS_FS_Base);
descriptors[4].buffer_zero_offset.buffer = lightBuf;
descriptors[4].buffer_zero_offset.range = sizeof(UB_VS_Lights);
descriptors[5].buffer_zero_offset.buffer = boneBuf;
descriptors[5].buffer_zero_offset.range = sizeof(UB_VS_Bones);
if (tess) {
const VkDescriptorBufferInfo *bufInfo = tessDataTransferVulkan->GetBufferInfo();
for (int j = 0; j < 3; j++) {
Expand Down