2 ##########################################################################
4 # Copyright 2009 VMware, Inc.
5 # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
8 # Permission is hereby granted, free of charge, to any person obtaining a
9 # copy of this software and associated documentation files (the
10 # "Software"), to deal in the Software without restriction, including
11 # without limitation the rights to use, copy, modify, merge, publish,
12 # distribute, sub license, and/or sell copies of the Software, and to
13 # permit persons to whom the Software is furnished to do so, subject to
14 # the following conditions:
16 # The above copyright notice and this permission notice (including the
17 # next paragraph) shall be included in all copies or substantial portions
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 # IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
24 # ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 ##########################################################################
46 class TextureTest(TestCase
):
68 last_level
= self
.last_level
75 texture
= dev
.texture_create(
81 last_level
= last_level
,
82 tex_usage
= tex_usage
,
87 surface
= texture
.get_surface(face
, level
, zslice
)
90 stride
= pf_get_stride(texture
->format
, w
)
91 size
= pf_get_nblocksy(texture
->format
) * stride
93 in_raw
= os
.urandom(size
)
95 surface
.put_tile_raw(0, 0, surface
.width
, surface
.height
, in_raw
, stride
)
97 out_raw
= surface
.get_tile_raw(0, 0, surface
.width
, surface
.height
)
114 PIPE_FORMAT_B8G8R8A8_UNORM
,
115 PIPE_FORMAT_B8G8R8X8_UNORM
,
116 PIPE_FORMAT_B8G8R8A8_SRGB
,
117 PIPE_FORMAT_B5G6R5_UNORM
,
118 PIPE_FORMAT_B5G5R5A1_UNORM
,
119 PIPE_FORMAT_B4G4R4A4_UNORM
,
120 PIPE_FORMAT_Z32_UNORM
,
121 PIPE_FORMAT_S8Z24_UNORM
,
122 PIPE_FORMAT_X8Z24_UNORM
,
123 PIPE_FORMAT_Z16_UNORM
,
124 PIPE_FORMAT_S8_UNORM
,
125 PIPE_FORMAT_A8_UNORM
,
126 PIPE_FORMAT_L8_UNORM
,
127 PIPE_FORMAT_DXT1_RGB
,
128 PIPE_FORMAT_DXT1_RGBA
,
129 PIPE_FORMAT_DXT3_RGBA
,
130 PIPE_FORMAT_DXT5_RGBA
,
133 sizes
= [64, 32, 16, 8, 4, 2, 1]
134 #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
147 for target
in targets
:
148 for format
in formats
:
150 if target
== PIPE_TEXTURE_3D
:
155 if target
!= PIPE_TEXTURE_CUBE
and face
:
158 for last_level
in range(levels
):
159 for level
in range(0, last_level
+ 1):
161 while zslice
< depth
>> level
:
169 last_level
= last_level
,
175 zslice
= (zslice
+ 1)*2 - 1
179 if __name__
== '__main__':