Files
renderdoc/util/test/tests/Vulkan/VK_Resource_Lifetimes.py
T
baldurk 7149302680 Rename 'draw' or 'drawcall' to action
* There's not a good accepted terminology for this kind of event, and for
  historical reasons 'drawcall' has been the accepted term, even though
  that can be quite confusing when a dispatch or a copy is a 'drawcall'.
* This is particularly highlighted by the event browser filters where
  $draw() includes draws and dispatches, but $dispatch() only includes
  dispatches, it's hard to intuitively understand why $draw() matches all
  of these calls.
* As a result we've defined the term 'action' to cover these types of
  events in the same way that we defined 'event' in the first place to
  mean a single atomic API call.
2021-07-01 15:15:05 +01:00

60 lines
2.6 KiB
Python

import renderdoc as rd
import rdtest
class VK_Resource_Lifetimes(rdtest.TestCase):
demos_test_name = 'VK_Resource_Lifetimes'
demos_frame_cap = 200
def check_capture(self):
last_action: rd.ActionDescription = self.get_last_action()
self.controller.SetFrameEvent(last_action.eventId, True)
tex = last_action.copyDestination
# green background around first triangle, blue around second
self.check_pixel_value(tex, 10, 10, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(tex, 118, 10, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(tex, 118, 118, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(tex, 10, 118, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(tex, 138, 10, [0.0, 0.0, 1.0, 1.0])
self.check_pixel_value(tex, 246, 10, [0.0, 0.0, 1.0, 1.0])
self.check_pixel_value(tex, 246, 118, [0.0, 0.0, 1.0, 1.0])
self.check_pixel_value(tex, 138, 118, [0.0, 0.0, 1.0, 1.0])
# Sample across each triangle, we expect things to be identical
for xoffs in [0, 128]:
# Check black checkerboard squares
self.check_pixel_value(tex, xoffs+42, 92, [0.0, 0.0, 0.0, 1.0])
self.check_pixel_value(tex, xoffs+40, 85, [0.0, 0.0, 0.0, 1.0])
self.check_pixel_value(tex, xoffs+68, 66, [0.0, 0.0, 0.0, 1.0])
self.check_pixel_value(tex, xoffs+59, 47, [0.0, 0.0, 0.0, 1.0])
self.check_pixel_value(tex, xoffs+81, 92, [0.0, 0.0, 0.0, 1.0])
# Check the red and green eyes of the smiley
self.check_pixel_value(tex, xoffs+49, 83, [1.0, 0.0, 0.09, 1.0])
self.check_pixel_value(tex, xoffs+60, 83, [0.0, 1.0, 0.09, 1.0])
# Check the blue smile
self.check_pixel_value(tex, xoffs+64, 72, [0.09, 0.0, 1.0, 1.0])
# Check the orange face
self.check_pixel_value(tex, xoffs+46, 86, [1.0, 0.545, 0.36, 1.0])
# Check the empty space where we clamped and didn't repeat
self.check_pixel_value(tex, xoffs+82, 79, [0.72, 1.0, 1.0, 1.0])
self.check_pixel_value(tex, xoffs+84, 86, [0.72, 1.0, 1.0, 1.0])
self.check_pixel_value(tex, xoffs+88, 92, [0.72, 1.0, 1.0, 1.0])
# Check that the repeated smiley above is there
self.check_pixel_value(tex, xoffs+67, 53, [0.905, 0.635, 0.36, 1.0])
self.check_pixel_value(tex, xoffs+65, 50, [1.0, 0.0, 0.09, 1.0])
# Check for resource leaks
if len(self.controller.GetResources()) > 75:
raise rdtest.TestFailureException(
"Too many resources found: {}".format(len(self.controller.GetResources())))