Vulkan: enable frag shader placeholder.

The Vulkan spec mandates the use of a fragment shader unless
rasterizer discard is enabled. For now, enable the placeholder
fragment shader in all cases, with a bug logged to optimize it
for the rasterizer discard case.

Bug: dawn:1696 dawn:1698
Change-Id: I9e85e6308a9952fc505382488c618897bd9abc7b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/123503
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White 2023-03-10 19:20:15 +00:00 committed by Dawn LUCI CQ
parent 4eea1e042d
commit 76cd4332cc
3 changed files with 8 additions and 5 deletions

View File

@ -226,7 +226,8 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{
{Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, {Toggle::UsePlaceholderFragmentInVertexOnlyPipeline,
{"use_placeholder_fragment_in_vertex_only_pipeline", {"use_placeholder_fragment_in_vertex_only_pipeline",
"Use a placeholder empty fragment shader in vertex only render pipeline. This toggle must be " "Use a placeholder empty fragment shader in vertex only render pipeline. This toggle must be "
"enabled for OpenGL ES backend, and serves as a workaround by default enabled on some Metal " "enabled for OpenGL ES backend, the Vulkan Backend, and serves as a workaround by default "
"enabled on some Metal "
"devices with Intel GPU to ensure the depth result is correct.", "devices with Intel GPU to ensure the depth result is correct.",
"https://crbug.com/dawn/136", ToggleStage::Device}}, "https://crbug.com/dawn/136", ToggleStage::Device}},
{Toggle::FxcOptimizations, {Toggle::FxcOptimizations,

View File

@ -447,6 +447,12 @@ void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
// By default try to initialize workgroup memory with OpConstantNull according to the Vulkan // By default try to initialize workgroup memory with OpConstantNull according to the Vulkan
// extension VK_KHR_zero_initialize_workgroup_memory. // extension VK_KHR_zero_initialize_workgroup_memory.
deviceToggles->Default(Toggle::VulkanUseZeroInitializeWorkgroupMemoryExtension, true); deviceToggles->Default(Toggle::VulkanUseZeroInitializeWorkgroupMemoryExtension, true);
// Inject fragment shaders in all vertex-only pipelines.
// TODO(crbug.com/dawn/1698): relax this requirement where the Vulkan spec allows.
// In particular, enable rasterizer discard if the depth-stencil stage is a no-op, and skip
// insertion of the placeholder fragment shader.
deviceToggles->Default(Toggle::UsePlaceholderFragmentInVertexOnlyPipeline, true);
} }
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor, ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,

View File

@ -864,10 +864,6 @@ TEST_P(TimestampQueryTests, TimestampWritesOnRenderPassWithNoPipline) {
TEST_P(TimestampQueryTests, TimestampWritesOnRenderPassWithOnlyVertexStage) { TEST_P(TimestampQueryTests, TimestampWritesOnRenderPassWithOnlyVertexStage) {
DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("use_placeholder_fragment_in_vertex_only_pipeline")); DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("use_placeholder_fragment_in_vertex_only_pipeline"));
// TODO(dawn:1696): VVL claims that this configuration is invalid without a fragment shader.
// Investigate and remove this suppression.
DAWN_SUPPRESS_TEST_IF(IsVulkan());
wgpu::QuerySet querySet = CreateQuerySetForTimestamp(2); wgpu::QuerySet querySet = CreateQuerySetForTimestamp(2);
TestTimestampWritesOnRenderPass({{querySet, 0, wgpu::RenderPassTimestampLocation::Beginning}, TestTimestampWritesOnRenderPass({{querySet, 0, wgpu::RenderPassTimestampLocation::Beginning},
{querySet, 1, wgpu::RenderPassTimestampLocation::End}}, {querySet, 1, wgpu::RenderPassTimestampLocation::End}},