Refactor public interface around handling of textures

* Subresource handling is more consistent - we pass around a struct now that
  contains the array slice, mip level, and sample. We remove the concept of
  'MSAA textures count samples as extra slices within the real slices' and
  internalise that completely. This also means we have a consistent set
  everywhere that we need to refer to a subresource.
* Functions that used to be in the ReplayOutput and use a couple of implicit
  parameters from the texture viewer configuration are now in the
  ReplayController and take them explicitly. This includes GetMinMax,
  GetHistogram, and PickPixel.
* Since these functions aren't ReplayOutput relative, if you want to decode the
  custom shader texture or the overlay texture you need to pass that ID
  directly.
This commit is contained in:
baldurk
2019-10-30 17:14:12 +00:00
parent 01344c7e83
commit db563bb0bf
46 changed files with 1449 additions and 1457 deletions
+1 -13
View File
@@ -148,7 +148,6 @@ class TestCase:
self.capture_filename = ""
self.controller: rd.ReplayController = None
self._variables = []
self.pickout: rd.ReplayOutput = None
def get_ref_path(self, name: str, extra: bool = False):
if extra:
@@ -308,16 +307,7 @@ class TestCase:
if type(y) is float:
y = int(tex_details.height * y)
if self.pickout is None:
self.pickout: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100),
rd.ReplayOutputType.Texture)
self.check(self.pickout is not None)
texdisplay = rd.TextureDisplay()
texdisplay.resourceId = tex
self.pickout.SetTextureDisplay(texdisplay)
picked: rd.PixelValue = self.pickout.PickPixel(tex, False, x, y, 0, 0, 0)
picked: rd.PixelValue = self.controller.PickPixel(tex, x, y, rd.Subresource(0, 0, 0), rd.CompType.Typeless)
if not util.value_compare(picked.floatValue, value, eps):
raise TestFailureException(
@@ -339,11 +329,9 @@ class TestCase:
self.check_capture()
self.controller.Shutdown()
self.pickout = None
def invoketest(self, debugMode):
self.run()
self.pickout = None
self.debugMode = debugMode
def get_first_draw(self):
+1 -1
View File
@@ -14,7 +14,7 @@ class GL_Parameter_Zoo(rdtest.TestCase):
self.controller.SetFrameEvent(self.get_last_draw().eventId, True)
data = self.controller.GetTextureData(id, 0, 0)
data = self.controller.GetTextureData(id, rd.Subresource(0, 0, 0))
first_pixel = struct.unpack_from("BBBB", data, 0)
val = [255, 0, 255, 255]
+2 -2
View File
@@ -41,7 +41,7 @@ class GL_Per_Type_Tex_Units(rdtest.TestCase):
raise rdtest.TestFailureException(
"First texture should be 8x8, not {}x{}".format(tex_details.width, tex_details.height))
data = self.controller.GetTextureData(id, 0, 0)
data = self.controller.GetTextureData(id, rd.Subresource(0, 0, 0))
first_pixel = struct.unpack_from("BBBB", data, 0)
if not rdtest.value_compare(first_pixel, (255, 0, 0, 255)):
@@ -71,7 +71,7 @@ class GL_Per_Type_Tex_Units(rdtest.TestCase):
"First texture should be 4x4x4, not {}x{}x{}".format(tex_details.width, tex_details.height,
tex_details.depth))
data = self.controller.GetTextureData(id, 0, 0)
data = self.controller.GetTextureData(id, rd.Subresource(0, 0, 0))
first_pixel = struct.unpack_from("BBBB", data, 0)
if not rdtest.value_compare(first_pixel, (0, 255, 0, 255)):
+1 -1
View File
@@ -135,7 +135,7 @@ class Iter_Test(rdtest.TestCase):
rdtest.log.print("Fetching history for %d,%d on target %s" % (x, y, str(target)))
history = self.controller.PixelHistory(target, x, y, 0, 0, 0, rd.CompType.Typeless)
history = self.controller.PixelHistory(target, x, y, rd.Subresource(0, 0, 0), rd.CompType.Typeless)
rdtest.log.success("Pixel %d,%d has %d history events" % (x, y, len(history)))
+3 -10
View File
@@ -21,7 +21,7 @@ class VK_Line_Raster(rdtest.TestCase):
x = self.view[0] * col + p[0]
y = self.view[1] * row + p[1]
picked: rd.PixelValue = self.out.PickPixel(self.tex.resourceId, False, x, y, 0, 0, 0)
picked: rd.PixelValue = self.controller.PickPixel(self.tex, x, y, rd.Subresource(0, 0, 0), rd.CompType.Typeless)
ret.append(rdtest.value_compare(picked.floatValue, [0.0, 1.0, 1.0, 1.0]))
return ret
@@ -34,16 +34,11 @@ class VK_Line_Raster(rdtest.TestCase):
self.controller.SetFrameEvent(draw.eventId, False)
# Make an output so we can pick pixels
self.out: rd.ReplayOutput = self.controller.CreateOutput(rd.CreateHeadlessWindowingData(100, 100), rd.ReplayOutputType.Texture)
pipe: rd.PipeState = self.controller.GetPipelineState()
self.tex = rd.TextureDisplay()
self.tex.resourceId = pipe.GetOutputTargets()[0].resourceId
self.out.SetTextureDisplay(self.tex)
self.tex = pipe.GetOutputTargets()[0].resourceId
texdetails = self.get_texture(self.tex.resourceId)
texdetails = self.get_texture(self.tex)
# Top left we expect a regular line segment.
s = self.sample(0, 0)
@@ -85,5 +80,3 @@ class VK_Line_Raster(rdtest.TestCase):
rdtest.log.success("{} line not supported".format(n))
rdtest.log.success("All lines look as expected")
self.out.Shutdown()