"pipe_vertex_element": gallium.VertexElement,
"pipe_viewport_state": gallium.Viewport,
#"pipe_texture": gallium.Texture,
+ 'pipe_subresource': gallium.pipe_subresource,
+ 'pipe_box': gallium.pipe_box,
}
self.interpreter = interpreter
self.real = real
- def pipe_winsys_create(self):
- return Winsys(self.interpreter, gallium.Device())
-
- def pipe_screen_create(self, winsys=None):
- if winsys is None:
- real = gallium.Device()
- else:
- real = winsys.real
+ def pipe_screen_create(self):
+ real = gallium.Device()
return Screen(self.interpreter, real)
def pipe_context_create(self, screen):
return Context(self.interpreter, context)
-class Winsys(Object):
-
- def __init__(self, interpreter, real):
- self.interpreter = interpreter
- self.real = real
-
- def get_name(self):
- pass
-
- def user_buffer_create(self, data, size):
- # We don't really care to distinguish between user and regular buffers
- buffer = self.real.buffer_create(size,
- 4,
- gallium.PIPE_BUFFER_USAGE_CPU_READ |
- gallium.PIPE_BUFFER_USAGE_CPU_WRITE )
- assert size == len(data)
- buffer.write(data)
- return buffer
-
- def buffer_create(self, alignment, usage, size):
- return self.real.buffer_create(size, alignment, usage)
-
- def buffer_destroy(self, buffer):
- pass
-
- def buffer_write(self, buffer, data, size):
- assert size == len(data)
- buffer.write(data)
-
- def fence_finish(self, fence, flags):
- pass
-
- def fence_reference(self, dst, src):
- pass
-
- def flush_frontbuffer(self, surface):
- pass
-
- def surface_alloc(self):
- return None
-
- def surface_release(self, surface):
- pass
-
-
class Transfer:
- def __init__(self, surface, x, y, w, h):
- self.surface = surface
- self.x = x
- self.y = y
- self.w = w
- self.h = h
+ def __init__(self, resource, usage, subresource, box):
+ self.resource = resource
+ self.usage = usage
+ self.subresource = subresource
+ self.box = box
class Screen(Object):
context = self.real.context_create()
return Context(self.interpreter, context)
- def is_format_supported(self, format, target, tex_usage, geom_flags):
- return self.real.is_format_supported(format, target, tex_usage, geom_flags)
+ def is_format_supported(self, format, target, bind, geom_flags):
+ return self.real.is_format_supported(format, target, bind, geom_flags)
- def texture_create(self, templat):
- return self.real.texture_create(
+ def resource_create(self, templat):
+ return self.real.resource_create(
format = templat.format,
width = templat.width,
height = templat.height,
depth = templat.depth,
last_level = templat.last_level,
target = templat.target,
- tex_usage = templat.tex_usage,
+ bind = templat.bind,
)
def texture_destroy(self, texture):
def tex_surface_release(self, surface):
pass
- def surface_write(self, surface, data, stride, size):
- if surface is None:
- return
-# assert surface.nblocksy * stride == size
- surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
-
- def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
- if texture is None:
- return None
- transfer = Transfer(texture.get_surface(face, level, zslice), x, y, w, h)
- if transfer and usage & gallium.PIPE_TRANSFER_READ:
- if self.interpreter.options.all:
- self.interpreter.present(transfer.surface, 'transf_read', x, y, w, h)
- return transfer
-
- def tex_transfer_destroy(self, transfer):
- self.interpreter.unregister_object(transfer)
-
- def transfer_write(self, transfer, stride, data, size):
- if transfer is None:
- return
- transfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, stride)
- if self.interpreter.options.all:
- self.interpreter.present(transfer.surface, 'transf_write', transfer.x, transfer.y, transfer.w, transfer.h)
-
- def user_buffer_create(self, data, size):
+ def user_buffer_create(self, data, size, bind):
# We don't really care to distinguish between user and regular buffers
- buffer = self.real.buffer_create(size,
- 4,
- gallium.PIPE_BUFFER_USAGE_CPU_READ |
- gallium.PIPE_BUFFER_USAGE_CPU_WRITE )
+ buffer = self.real.buffer_create(size, bind)
assert size == len(data)
buffer.write(data)
return buffer
def buffer_destroy(self, buffer):
pass
- def buffer_write(self, buffer, data, size, offset=0):
- assert size == len(data)
- buffer.write(data)
-
def fence_finish(self, fence, flags):
pass
def set_viewport_state(self, state):
self.real.set_viewport(state)
- def set_fragment_sampler_textures(self, num_textures, textures):
- for i in range(num_textures):
- self.real.set_fragment_sampler_texture(i, textures[i])
+ def create_sampler_view(self, texture, templ):
+ return self.real.create_sampler_view(texture,
+ format = templ.format,
+ first_level = templ.first_level,
+ last_level = templ.last_level,
+ swizzle_r = templ.swizzle_r,
+ swizzle_g = templ.swizzle_r,
+ swizzle_b = templ.swizzle_g,
+ swizzle_a = templ.swizzle_a)
- def set_vertex_sampler_textures(self, num_textures, textures):
- for i in range(num_textures):
- self.real.set_vertex_sampler_texture(i, textures[i])
+ def set_fragment_sampler_views(self, num, views):
+ for i in range(num):
+ self.real.set_fragment_sampler_view(i, views[i])
+
+ def set_vertex_sampler_views(self, num, views):
+ for i in range(num):
+ self.real.set_vertex_sampler_view(i, views[i])
def set_vertex_buffers(self, num_buffers, buffers):
self.vbufs = buffers[0:num_buffers]
buffer_offset = vbuf.buffer_offset,
buffer = vbuf.buffer,
)
+
+ def create_vertex_elements_state(self, num_elements, elements):
+ return elements[0:num_elements]
- def set_vertex_elements(self, num_elements, elements):
- self.velems = elements[0:num_elements]
+ def bind_vertex_elements_state(self, state):
+ elements = state
+ num_elements = len(elements)
+ self.velems = elements
for i in range(num_elements):
self.real.set_vertex_element(i, elements[i])
self.real.set_vertex_elements(num_elements)
+ def delete_vertex_elements_state(self, state):
+ pass
+
def dump_vertices(self, start, count):
if not self.interpreter.verbosity(2):
return
#return self.real.is_buffer_referenced(format, buf)
pass
+ def buffer_write(self, buffer, data, size, offset=0):
+ assert size == len(data)
+ self.buffer_write(buffer, data)
+
+ def surface_write(self, surface, data, stride, size):
+ if surface is None:
+ return
+# assert surface.nblocksy * stride == size
+ surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
+
+ def get_transfer(self, texture, sr, usage, box):
+ if texture is None:
+ return None
+ transfer = Transfer(texture, sr, usage, box)
+ if transfer and usage & gallium.PIPE_TRANSFER_READ:
+ if self.interpreter.options.all:
+ surface = texture.get_surface(sr.face, sr.level, box.z)
+ self.interpreter.present(transfer.surface, 'transf_read', box.x, box.y, box.w, box.h)
+ return transfer
+
+ def tex_transfer_destroy(self, transfer):
+ self.interpreter.unregister_object(transfer)
+
+ def transfer_write(self, transfer, data, size):
+ if transfer is None:
+ return
+ self.real.transfer_inline_write(resource, sr, usage, box, data, stride, slice_stride)
+ self.transfertransfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, transfer.stride)
+ if self.interpreter.options.all:
+ box = transfer.box
+ surface = transfer.resource.get_surface(sr.face, sr.level, box.z)
+ self.interpreter.present(transfer.surface, 'transf_write', box.x, box.y, box.w, box.h)
+
+ def transfer_inline_write(self, resource, sr, usage, box, stride, slice_stride, data):
+ self.real.transfer_inline_write(resource, sr, usage, box, data, stride, slice_stride)
+
def _set_dirty(self):
if self.interpreter.options.step:
self._present()
minz = 0.0
maxz = 1.0
- tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
+ bind = PIPE_BIND_SAMPLER_VIEW
geom_flags = 0
if width != height:
geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
if not is_pot(width) or not is_pot(height) or not is_pot(depth):
geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
- if not dev.is_format_supported(format, target, tex_usage, geom_flags):
+ if not dev.is_format_supported(format, target, bind, geom_flags):
raise TestSkip
# disabled blending/masking
ctx.set_fragment_sampler(0, sampler)
# texture
- texture = dev.texture_create(
+ texture = dev.resource_create(
target = target,
format = format,
width = width,
height = height,
depth = depth,
last_level = last_level,
- tex_usage = tex_usage,
+ bind = bind,
)
expected_rgba = FloatArray(height*width*4)
ctx.set_clip(clip)
# framebuffer
- cbuf_tex = dev.texture_create(
+ cbuf_tex = dev.resource_create(
PIPE_FORMAT_B8G8R8A8_UNORM,
width,
height,
- tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+ bind = PIPE_BIND_RENDER_TARGET,
)
cbuf = cbuf_tex.get_surface()
minz = 0.0
maxz = 1.0
- tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
+ bind = PIPE_BIND_SAMPLER_VIEW
geom_flags = 0
if width != height:
geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
if not is_pot(width) or not is_pot(height) or not is_pot(depth):
geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
- if not dev.is_format_supported(format, target, tex_usage, geom_flags):
+ if not dev.is_format_supported(format, target, bind, geom_flags):
raise TestSkip
# disabled blending/masking
ctx.set_fragment_sampler(0, sampler)
# texture
- texture = dev.texture_create(
+ texture = dev.resource_create(
target = target,
format = format,
width = width,
height = height,
depth = depth,
last_level = last_level,
- tex_usage = tex_usage,
+ bind = bind,
)
expected_rgba = FloatArray(height*width*4)
ctx.set_clip(clip)
# framebuffer
- cbuf_tex = dev.texture_create(
+ cbuf_tex = dev.resource_create(
PIPE_FORMAT_B8G8R8A8_UNORM,
width,
height,
- tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+ bind = PIPE_BIND_RENDER_TARGET,
)
- zsbuf_tex = dev.texture_create(
+ zsbuf_tex = dev.resource_create(
PIPE_FORMAT_X8Z24_UNORM,
width,
height,
- tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+ bind = PIPE_BIND_RENDER_TARGET,
)
cbuf = cbuf_tex.get_surface()