Files
renderdoc/util/test/tests/GL/GL_Depth_Bounds.py
T
baldurk 748e089b15 Fix remaining static analysis identified issues in python test code
* This includes:
  - Incorrect comparisons
  - Missing type annotations where it can't be inferred
  - Variable shadowing and bad use
  - Unused imports
  - asserts for non-None on types
* Passes clean on strict pyright checking except for
  `reportMissingParameterType`, `reportUnusedVariable`, and
  `reportOptionalMemberAccess` which are all too spammy and low value to be
  worth addressing.
2026-09-11 15:04:05 +01:00

31 lines
1.2 KiB
Python

import rdtest
class GL_Depth_Bounds(rdtest.TestCase):
demos_test_name = 'GL_Depth_Bounds'
def check_capture(self):
eid = self.find_action("Test").nextAction.eventId
self.controller.SetFrameEvent(eid, False)
glpipe = self.controller.GetGLPipelineState()
assert glpipe.depthState.depthBounds
if (not rdtest.value_compare(glpipe.depthState.nearBound, 0.2) or
not rdtest.value_compare(glpipe.depthState.farBound, 0.8)):
raise rdtest.TestFailureException(f"Bounds {glpipe.depthState.nearBound} - {glpipe.depthState.farBound} aren't as expected")
pipe = self.controller.GetPipelineState()
tex = pipe.GetOutputTargets()[0].resource
self.check_pixel_value(tex, 200, 200, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(tex, 200, 100, [0.0, 1.0, 0.0, 1.0])
self.check_pixel_value(tex, 125, 100, [1.0, 0.0, 1.0, 1.0])
self.check_pixel_value(tex, 125, 200, [1.0, 0.0, 1.0, 1.0])
self.check_pixel_value(tex, 275, 100, [1.0, 0.0, 1.0, 1.0])
self.check_pixel_value(tex, 275, 200, [1.0, 0.0, 1.0, 1.0])
rdtest.log.success("Triangle is clipped as expected")