Skip to content

Commit

Permalink
Fixes for issues found by Vulkan validation layers, including a commo…
Browse files Browse the repository at this point in the history
…n non-harmful perf warning (doesn't fix all cases, but does fix the most common one).
  • Loading branch information
hrydgard committed Jan 25, 2019
1 parent add5e3c commit c38c546
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Common/Vulkan/VulkanContext.cpp
Expand Up @@ -585,7 +585,9 @@ VkResult VulkanContext::CreateDevice() {
}
assert(found);

deviceExtensionsLookup_.DEDICATED_ALLOCATION = EnableDeviceExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
if (EnableDeviceExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME)) {
deviceExtensionsLookup_.DEDICATED_ALLOCATION = EnableDeviceExtension(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
}

VkDeviceCreateInfo device_info{ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
device_info.queueCreateInfoCount = 1;
Expand Down
2 changes: 0 additions & 2 deletions Common/Vulkan/VulkanDebug.cpp
Expand Up @@ -79,8 +79,6 @@ VkBool32 VKAPI_CALL Vulkan_Dbg(VkDebugReportFlagsEXT msgFlags, VkDebugReportObje
return false;
if (msgCode == 5)
return false; // Not exactly a false positive, see https://github.com/KhronosGroup/glslang/issues/1418
if (msgCode == 0 && strstr(pMsg, "vertexPipelineStoresAndAtomics")) // https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/73
return false;
#ifdef _WIN32
std::string msg = message.str();
OutputDebugStringA(msg.c_str());
Expand Down
9 changes: 6 additions & 3 deletions GPU/Vulkan/PipelineManagerVulkan.cpp
Expand Up @@ -112,12 +112,14 @@ static int SetupVertexAttribs(VkVertexInputAttributeDescription attrs[], const D
return count;
}

static int SetupVertexAttribsPretransformed(VkVertexInputAttributeDescription attrs[]) {
static int SetupVertexAttribsPretransformed(VkVertexInputAttributeDescription attrs[], bool needsColor1) {
int count = 0;
VertexAttribSetup(&attrs[count++], DEC_FLOAT_4, 0, PspAttributeLocation::POSITION);
VertexAttribSetup(&attrs[count++], DEC_FLOAT_3, 16, PspAttributeLocation::TEXCOORD);
VertexAttribSetup(&attrs[count++], DEC_U8_4, 28, PspAttributeLocation::COLOR0);
VertexAttribSetup(&attrs[count++], DEC_U8_4, 32, PspAttributeLocation::COLOR1);
if (needsColor1) {
VertexAttribSetup(&attrs[count++], DEC_U8_4, 32, PspAttributeLocation::COLOR1);
}
return count;
}

Expand Down Expand Up @@ -243,7 +245,8 @@ static VulkanPipeline *CreateVulkanPipeline(VkDevice device, VkPipelineCache pip
attributeCount = SetupVertexAttribs(attrs, *decFmt);
vertexStride = decFmt->stride;
} else {
attributeCount = SetupVertexAttribsPretransformed(attrs);
bool needsColor1 = vs->GetID().Bit(FS_BIT_LMODE);
attributeCount = SetupVertexAttribsPretransformed(attrs, needsColor1);
vertexStride = 36;
}

Expand Down

0 comments on commit c38c546

Please sign in to comment.