Skip to content

Commit

Permalink
tests: Test not setting dynamic discard rectangles
Browse files Browse the repository at this point in the history
  • Loading branch information
ziga-lunarg authored and spencer-lunarg committed Jan 7, 2025
1 parent 5d04cc3 commit b842783
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions tests/unit/dynamic_state_positive.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright (c) 2015-2024 The Khronos Group Inc.
* Copyright (c) 2015-2024 Valve Corporation
* Copyright (c) 2015-2024 LunarG, Inc.
* Copyright (c) 2015-2024 Google, Inc.
* Copyright (c) 2015-2025 The Khronos Group Inc.
* Copyright (c) 2015-2025 Valve Corporation
* Copyright (c) 2015-2025 LunarG, Inc.
* Copyright (c) 2015-2025 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1397,3 +1397,24 @@ TEST_F(PositiveDynamicState, DiscardRectanglesModeNotSetWithCommand) {
m_command_buffer.EndRenderPass();
m_command_buffer.End();
}

TEST_F(PositiveDynamicState, DiscardRectanglesDisabled) {
TEST_DESCRIPTION("Draw without discard rectangles if discard rectangle enable is false");

AddRequiredExtensions(VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME);
RETURN_IF_SKIP(Init());
InitRenderTarget();

CreatePipelineHelper pipe(*this);
pipe.AddDynamicState(VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT);
pipe.AddDynamicState(VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT);
pipe.CreateGraphicsPipeline();

m_command_buffer.Begin();
m_command_buffer.BeginRenderPass(m_renderPassBeginInfo);
vk::CmdBindPipeline(m_command_buffer.handle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.Handle());
vk::CmdSetDiscardRectangleEnableEXT(m_command_buffer.handle(), VK_FALSE);
vk::CmdDraw(m_command_buffer.handle(), 3, 1, 0, 0);
m_command_buffer.EndRenderPass();
m_command_buffer.End();
}

0 comments on commit b842783

Please sign in to comment.