Vulkan scissor fix (validation errors).

This commit is contained in:
Henrik Rydgård 2021-09-10 01:13:28 +02:00
parent 85ac0f8856
commit 5876388c65
2 changed files with 14 additions and 5 deletions

View file

@ -185,13 +185,22 @@ public:
// Clamp to curWidth_/curHeight_. Apparently an issue.
if ((int)(rc.offset.x + rc.extent.width) > curWidth_) {
rc.extent.width = curWidth_ - rc.offset.x;
int newWidth = curWidth_ - rc.offset.x;
rc.extent.width = std::max(1, newWidth);
if (rc.offset.x >= curWidth_) {
// Fallback.
rc.offset.x = curWidth_ - rc.extent.width;
}
}
if ((int)(rc.offset.y + rc.extent.height) > curHeight_) {
rc.extent.height = curHeight_ - rc.offset.y;
int newHeight = curHeight_ - rc.offset.y;
rc.extent.height = std::max(1, newHeight);
if (rc.offset.y >= curHeight_) {
// Fallback.
rc.offset.y = curHeight_ - rc.extent.height;
}
}
_dbg_assert_((int)(rc.offset.x + rc.extent.width) <= curWidth_);
_dbg_assert_((int)(rc.offset.y + rc.extent.height) <= curHeight_);
curRenderArea_.Apply(rc);
VkRenderData data{ VKRRenderCommand::SCISSOR };

View file

@ -83,7 +83,7 @@ void LoadPostShaderInfo(const std::vector<Path> &directories) {
std::vector<File::FileInfo> fileInfo;
VFSGetFileListing(directories[d].c_str(), &fileInfo, "ini:");
if (fileInfo.size() == 0) {
if (fileInfo.empty()) {
File::GetFilesInDir(directories[d], &fileInfo, "ini:");
}