Files
renderdoc/util/test/tests/GL/GL_Multithread_Rendering.py
T
baldurk feafbde8bc Add GL hack to check for implicit thread switching
* This is a very big blunt hammer for fixing the problem of multithreaded
  submission from GL. Every GL call checks to see if the context changed (which
  would only happen from a thread switch to a different context) and if detected
  it inserts a manual MakeCurrent call equivalent.
* It's slow to capture (when this happens - checking is not particularly slow)
  and slow to replay, but it's functional which is an improvement.
2020-04-02 18:15:44 +01:00

33 lines
1.6 KiB
Python

import renderdoc as rd
import rdtest
class GL_Multithread_Rendering(rdtest.TestCase):
demos_test_name = 'GL_Multithread_Rendering'
def check_capture(self):
draw = self.get_last_draw()
self.controller.SetFrameEvent(draw.eventId, False)
pipe: rd.PipeState = self.controller.GetPipelineState()
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.25, 0.0, [0.0, 0.0, 0.0, 0.0])
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, 0.75, 0.0, [0.0, 0.0, 0.0, 0.0])
tex_details: rd.TextureDescription = self.get_texture(pipe.GetOutputTargets()[0].resourceId)
w = int(tex_details.width / 40)
h = int(tex_details.height / 40)
# Left side of the screen should be 20x40 red V shaped triangles on red background
for y in range(40):
for x in range(20):
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(x*w), int(tex_details.height - 1 - y*h), [0.3, 0.2, 0.2, 1.0])
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(x*w + w/2), int(tex_details.height - 1 - y*h - h/2), [1.0, 0.0, 0.25, 1.0])
# Right side of the screen should be delta shaped blue triangles
for y in range(40):
for x in range(20):
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(tex_details.width/2) + int(x*w), int(tex_details.height - 1 - y*h - (h-1)), [0.2, 0.3, 0.2, 1.0])
self.check_pixel_value(pipe.GetOutputTargets()[0].resourceId, int(tex_details.width/2) + int(x*w + w/2), int(tex_details.height - 1 - y*h - h/2), [0.0, 1.0, 0.75, 1.0])