Add test of creating an empty capture

This commit is contained in:
baldurk
2020-02-21 17:55:53 +00:00
parent 70913fdda5
commit aacf148201
11 changed files with 338 additions and 0 deletions
+2
View File
@@ -11,6 +11,7 @@ set(VULKAN_SRC
vk/vk_descriptor_index.cpp
vk/vk_discard_rects.cpp
vk/vk_draw_zoo.cpp
vk/vk_empty_capture.cpp
vk/vk_ext_buffer_address.cpp
vk/vk_image_layouts.cpp
vk/vk_imageless_framebuffer.cpp
@@ -48,6 +49,7 @@ set(OPENGL_SRC
gl/gl_callstacks.cpp
gl/gl_cbuffer_zoo.cpp
gl/gl_depthstencil_fbo.cpp
gl/gl_empty_capture.cpp
gl/gl_entry_points.cpp
gl/gl_large_bcn_arrays.cpp
gl/gl_marker_test.cpp
@@ -0,0 +1,58 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2020 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "d3d11_test.h"
RD_TEST(D3D11_Empty_Capture, D3D11GraphicsTest)
{
static constexpr const char *Description =
"Draws nothing but will trigger a completely empty capture at frame 10.";
int main()
{
// initialise, create window, create device, etc
if(!Init())
return 3;
while(Running())
{
ClearRenderTargetView(bbRTV, {0.2f, 0.2f, 0.2f, 1.0f});
Present();
if(curFrame == 10 && rdoc)
{
rdoc->StartFrameCapture(NULL, NULL);
rdoc->EndFrameCapture(NULL, NULL);
}
if(curFrame > 50)
break;
}
return 0;
}
};
REGISTER_TEST();
@@ -0,0 +1,73 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2020 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "d3d12_test.h"
RD_TEST(D3D12_Empty_Capture, D3D12GraphicsTest)
{
static constexpr const char *Description =
"Draws nothing but will trigger a completely empty capture at frame 10.";
int main()
{
// initialise, create window, create device, etc
if(!Init())
return 3;
while(Running())
{
ID3D12GraphicsCommandListPtr cmd = GetCommandBuffer();
Reset(cmd);
ID3D12ResourcePtr bb = StartUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET);
D3D12_CPU_DESCRIPTOR_HANDLE rtv =
MakeRTV(bb).Format(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB).CreateCPU(0);
ClearRenderTargetView(cmd, rtv, {0.2f, 0.2f, 0.2f, 1.0f});
FinishUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET);
cmd->Close();
Submit({cmd});
Present();
if(rdoc)
{
rdoc->StartFrameCapture(NULL, NULL);
rdoc->EndFrameCapture(NULL, NULL);
}
if(curFrame > 50)
break;
}
return 0;
}
};
REGISTER_TEST();
+4
View File
@@ -128,6 +128,7 @@
<ClCompile Include="d3d11\d3d11_discard_view.cpp" />
<ClCompile Include="d3d11\d3d11_divergent_shader.cpp" />
<ClCompile Include="d3d11\d3d11_draw_zoo.cpp" />
<ClCompile Include="d3d11\d3d11_empty_capture.cpp" />
<ClCompile Include="d3d11\d3d11_empty_compute_dispatch.cpp" />
<ClCompile Include="d3d11\d3d11_empty_drawcall.cpp" />
<ClCompile Include="d3d11\d3d11_empty_viewports.cpp" />
@@ -162,6 +163,7 @@
<ClCompile Include="d3d11\d3d11_vertex_attr_zoo.cpp" />
<ClCompile Include="d3d11\d3d11_video_textures.cpp" />
<ClCompile Include="d3d12\d3d12_cbuffer_zoo.cpp" />
<ClCompile Include="d3d12\d3d12_empty_capture.cpp" />
<ClCompile Include="d3d12\d3d12_execute_indirect.cpp" />
<ClCompile Include="d3d12\d3d12_helpers.cpp" />
<ClCompile Include="d3d12\d3d12_mesh_zoo.cpp" />
@@ -197,6 +199,7 @@
<ClCompile Include="gl\gl_cbuffer_zoo.cpp" />
<ClCompile Include="gl\gl_depthstencil_fbo.cpp" />
<ClCompile Include="gl\gl_dx_interop.cpp" />
<ClCompile Include="gl\gl_empty_capture.cpp" />
<ClCompile Include="gl\gl_entry_points.cpp" />
<ClCompile Include="gl\gl_large_bcn_arrays.cpp" />
<ClCompile Include="gl\gl_map_overrun.cpp" />
@@ -236,6 +239,7 @@
<ClCompile Include="main.cpp" />
<ClCompile Include="test_common.cpp" />
<ClCompile Include="texture_zoo.cpp" />
<ClCompile Include="vk\vk_empty_capture.cpp" />
<ClCompile Include="vk\vk_khr_buffer_address.cpp" />
<ClCompile Include="vk\vk_mesh_zoo.cpp" />
<ClCompile Include="vk\vk_parameter_zoo.cpp" />
+12
View File
@@ -436,6 +436,18 @@
<ClCompile Include="gl\gl_marker_test.cpp">
<Filter>OpenGL\demos</Filter>
</ClCompile>
<ClCompile Include="vk\vk_empty_capture.cpp">
<Filter>Vulkan\demos</Filter>
</ClCompile>
<ClCompile Include="gl\gl_empty_capture.cpp">
<Filter>OpenGL\demos</Filter>
</ClCompile>
<ClCompile Include="d3d12\d3d12_empty_capture.cpp">
<Filter>D3D12\demos</Filter>
</ClCompile>
<ClCompile Include="d3d11\d3d11_empty_capture.cpp">
<Filter>D3D11\demos</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="D3D11">
+59
View File
@@ -0,0 +1,59 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2020 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "gl_test.h"
RD_TEST(GL_Empty_Capture, OpenGLGraphicsTest)
{
static constexpr const char *Description =
"Draws nothing but will trigger a completely empty capture at frame 10.";
int main()
{
// initialise, create window, create context, etc
if(!Init())
return 3;
while(Running())
{
float col[] = {0.2f, 0.2f, 0.2f, 1.0f};
glClearBufferfv(GL_COLOR, 0, col);
Present();
if(rdoc)
{
rdoc->StartFrameCapture(NULL, NULL);
rdoc->EndFrameCapture(NULL, NULL);
}
if(curFrame > 50)
break;
}
return 0;
}
};
REGISTER_TEST();
+73
View File
@@ -0,0 +1,73 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2020 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#include "vk_test.h"
RD_TEST(VK_Empty_Capture, VulkanGraphicsTest)
{
static constexpr const char *Description =
"Draws nothing but will trigger a completely empty capture at frame 10.";
int main()
{
// initialise, create window, create context, etc
if(!Init())
return 3;
while(Running())
{
VkCommandBuffer cmd = GetCommandBuffer();
vkBeginCommandBuffer(cmd, vkh::CommandBufferBeginInfo());
VkImage swapimg =
StartUsingBackbuffer(cmd, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_GENERAL);
vkCmdClearColorImage(cmd, swapimg, VK_IMAGE_LAYOUT_GENERAL,
vkh::ClearColorValue(0.2f, 0.2f, 0.2f, 1.0f), 1,
vkh::ImageSubresourceRange());
FinishUsingBackbuffer(cmd, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_GENERAL);
vkEndCommandBuffer(cmd);
Submit(0, 1, {cmd});
Present();
if(rdoc)
{
rdoc->StartFrameCapture(NULL, NULL);
rdoc->EndFrameCapture(NULL, NULL);
}
if(curFrame > 50)
break;
}
return 0;
}
};
REGISTER_TEST();
@@ -0,0 +1,14 @@
import renderdoc as rd
import rdtest
class D3D11_Empty_Capture(rdtest.TestCase):
demos_test_name = 'D3D11_Empty_Capture'
demos_frame_cap = 100
def check_capture(self):
draws = self.controller.GetDrawcalls()
self.check(len(draws) == 1)
self.check('End' in draws[0].name)
self.check(draws[0].eventId == 1)
@@ -0,0 +1,14 @@
import renderdoc as rd
import rdtest
class D3D12_Empty_Capture(rdtest.TestCase):
demos_test_name = 'D3D12_Empty_Capture'
demos_frame_cap = 100
def check_capture(self):
draws = self.controller.GetDrawcalls()
self.check(len(draws) == 1)
self.check('End' in draws[0].name)
self.check(draws[0].eventId == 1)
+15
View File
@@ -0,0 +1,15 @@
import renderdoc as rd
import rdtest
class GL_Empty_Capture(rdtest.TestCase):
demos_test_name = 'GL_Empty_Capture'
demos_frame_cap = 100
def check_capture(self):
draws = self.controller.GetDrawcalls()
self.check(len(draws) == 1)
self.check('End' in draws[0].name)
# EID 1 is the implicit context activation
self.check(draws[0].eventId == 2)
@@ -0,0 +1,14 @@
import renderdoc as rd
import rdtest
class VK_Empty_Capture(rdtest.TestCase):
demos_test_name = 'VK_Empty_Capture'
demos_frame_cap = 100
def check_capture(self):
draws = self.controller.GetDrawcalls()
self.check(len(draws) == 1)
self.check('End' in draws[0].name)
self.check(draws[0].eventId == 1)