[Vulkan] Handle unsupported fillModeNonSolid + fix portability subset feature checks

This commit is contained in:
Triang3l 2022-06-25 20:46:52 +03:00
parent d30d59883a
commit d8b2944caa
1 changed files with 46 additions and 34 deletions

View File

@ -525,37 +525,41 @@ bool VulkanPipelineCache::GetCurrentStateDescription(
bool cull_back = pa_su_sc_mode_cntl.cull_back; bool cull_back = pa_su_sc_mode_cntl.cull_back;
description_out.cull_front = cull_front; description_out.cull_front = cull_front;
description_out.cull_back = cull_back; description_out.cull_back = cull_back;
xenos::PolygonType polygon_type = xenos::PolygonType::kTriangles; if (device_features.fillModeNonSolid) {
if (!cull_front) { xenos::PolygonType polygon_type = xenos::PolygonType::kTriangles;
polygon_type = if (!cull_front) {
std::min(polygon_type, pa_su_sc_mode_cntl.polymode_front_ptype); polygon_type =
} std::min(polygon_type, pa_su_sc_mode_cntl.polymode_front_ptype);
if (!cull_back) { }
polygon_type = if (!cull_back) {
std::min(polygon_type, pa_su_sc_mode_cntl.polymode_back_ptype); polygon_type =
} std::min(polygon_type, pa_su_sc_mode_cntl.polymode_back_ptype);
if (pa_su_sc_mode_cntl.poly_mode != xenos::PolygonModeEnable::kDualMode) { }
polygon_type = xenos::PolygonType::kTriangles; if (pa_su_sc_mode_cntl.poly_mode != xenos::PolygonModeEnable::kDualMode) {
} polygon_type = xenos::PolygonType::kTriangles;
switch (polygon_type) { }
case xenos::PolygonType::kPoints: switch (polygon_type) {
// When points are not supported, use lines instead, preserving case xenos::PolygonType::kPoints:
// debug-like purpose. // When points are not supported, use lines instead, preserving
description_out.polygon_mode = // debug-like purpose.
(!device_portability_subset_features || description_out.polygon_mode =
device_portability_subset_features->pointPolygons) (!device_portability_subset_features ||
? PipelinePolygonMode::kPoint device_portability_subset_features->pointPolygons)
: PipelinePolygonMode::kLine; ? PipelinePolygonMode::kPoint
break; : PipelinePolygonMode::kLine;
case xenos::PolygonType::kLines: break;
description_out.polygon_mode = PipelinePolygonMode::kLine; case xenos::PolygonType::kLines:
break; description_out.polygon_mode = PipelinePolygonMode::kLine;
case xenos::PolygonType::kTriangles: break;
description_out.polygon_mode = PipelinePolygonMode::kFill; case xenos::PolygonType::kTriangles:
break; description_out.polygon_mode = PipelinePolygonMode::kFill;
default: break;
assert_unhandled_case(polygon_type); default:
return false; assert_unhandled_case(polygon_type);
return false;
}
} else {
description_out.polygon_mode = PipelinePolygonMode::kFill;
} }
description_out.front_face_clockwise = pa_su_sc_mode_cntl.face != 0; description_out.front_face_clockwise = pa_su_sc_mode_cntl.face != 0;
} else { } else {
@ -701,7 +705,6 @@ bool VulkanPipelineCache::ArePipelineRequirementsMet(
const ui::vulkan::VulkanProvider& provider = const ui::vulkan::VulkanProvider& provider =
command_processor_.GetVulkanProvider(); command_processor_.GetVulkanProvider();
const VkPhysicalDeviceFeatures& device_features = provider.device_features();
const VkPhysicalDevicePortabilitySubsetFeaturesKHR* const VkPhysicalDevicePortabilitySubsetFeaturesKHR*
device_portability_subset_features = device_portability_subset_features =
@ -709,13 +712,15 @@ bool VulkanPipelineCache::ArePipelineRequirementsMet(
if (device_portability_subset_features) { if (device_portability_subset_features) {
if (description.primitive_topology == if (description.primitive_topology ==
PipelinePrimitiveTopology::kTriangleFan && PipelinePrimitiveTopology::kTriangleFan &&
device_portability_subset_features->triangleFans) { !device_portability_subset_features->triangleFans) {
return false; return false;
} }
if (description.polygon_mode == PipelinePolygonMode::kPoint && if (description.polygon_mode == PipelinePolygonMode::kPoint &&
device_portability_subset_features->pointPolygons) { !device_portability_subset_features->pointPolygons) {
return false; return false;
} }
if (!device_portability_subset_features->constantAlphaColorBlendFactors) { if (!device_portability_subset_features->constantAlphaColorBlendFactors) {
uint32_t color_rts_remaining = uint32_t color_rts_remaining =
description.render_pass_key.depth_and_color_used >> 1; description.render_pass_key.depth_and_color_used >> 1;
@ -738,11 +743,18 @@ bool VulkanPipelineCache::ArePipelineRequirementsMet(
} }
} }
const VkPhysicalDeviceFeatures& device_features = provider.device_features();
if (!device_features.geometryShader && if (!device_features.geometryShader &&
description.geometry_shader != PipelineGeometryShader::kNone) { description.geometry_shader != PipelineGeometryShader::kNone) {
return false; return false;
} }
if (!device_features.fillModeNonSolid &&
description.polygon_mode != PipelinePolygonMode::kFill) {
return false;
}
if (!device_features.independentBlend) { if (!device_features.independentBlend) {
uint32_t color_rts_remaining = uint32_t color_rts_remaining =
description.render_pass_key.depth_and_color_used >> 1; description.render_pass_key.depth_and_color_used >> 1;