Merge pull request #12083 from liamwhite/viewport

renderer_vulkan: ignore viewport stores on non-supporting drivers
This commit is contained in:
liamwhite 2023-11-19 14:09:25 -05:00 committed by GitHub
commit 12fba361bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 1 deletions

View File

@ -407,7 +407,7 @@ void SetupCapabilities(const Profile& profile, const Info& info, EmitContext& ct
} }
ctx.AddCapability(spv::Capability::DemoteToHelperInvocation); ctx.AddCapability(spv::Capability::DemoteToHelperInvocation);
} }
if (info.stores[IR::Attribute::ViewportIndex]) { if (info.stores[IR::Attribute::ViewportIndex] && profile.support_multi_viewport) {
ctx.AddCapability(spv::Capability::MultiViewport); ctx.AddCapability(spv::Capability::MultiViewport);
} }
if (info.stores[IR::Attribute::ViewportMask] && profile.support_viewport_mask) { if (info.stores[IR::Attribute::ViewportMask] && profile.support_viewport_mask) {

View File

@ -84,6 +84,10 @@ std::optional<OutAttr> OutputAttrPointer(EmitContext& ctx, IR::Attribute attr) {
} }
return std::nullopt; return std::nullopt;
case IR::Attribute::ViewportIndex: case IR::Attribute::ViewportIndex:
if (!ctx.profile.support_multi_viewport) {
LOG_WARNING(Shader, "Ignoring viewport index store on non-supporting driver");
return std::nullopt;
}
if (ctx.profile.support_viewport_index_layer_non_geometry || if (ctx.profile.support_viewport_index_layer_non_geometry ||
ctx.stage == Shader::Stage::Geometry) { ctx.stage == Shader::Stage::Geometry) {
return OutAttr{ctx.viewport_index, ctx.U32[1]}; return OutAttr{ctx.viewport_index, ctx.U32[1]};

View File

@ -43,6 +43,7 @@ struct Profile {
bool support_gl_sparse_textures{}; bool support_gl_sparse_textures{};
bool support_gl_derivative_control{}; bool support_gl_derivative_control{};
bool support_scaled_attributes{}; bool support_scaled_attributes{};
bool support_multi_viewport{};
bool warp_size_potentially_larger_than_guest{}; bool warp_size_potentially_larger_than_guest{};

View File

@ -351,6 +351,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device
.support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(), .support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(),
.support_native_ndc = device.IsExtDepthClipControlSupported(), .support_native_ndc = device.IsExtDepthClipControlSupported(),
.support_scaled_attributes = !device.MustEmulateScaledFormats(), .support_scaled_attributes = !device.MustEmulateScaledFormats(),
.support_multi_viewport = device.SupportsMultiViewport(),
.warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(), .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(),

View File

@ -669,6 +669,10 @@ public:
return supports_conditional_barriers; return supports_conditional_barriers;
} }
bool SupportsMultiViewport() const {
return features2.features.multiViewport;
}
[[nodiscard]] static constexpr bool CheckBrokenCompute(VkDriverId driver_id, [[nodiscard]] static constexpr bool CheckBrokenCompute(VkDriverId driver_id,
u32 driver_version) { u32 driver_version) {
if (driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) { if (driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS) {