1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "util/u_memory.h"
30 #include "pipe/internal/p_winsys_screen.h"
31 #include "pipe/p_defines.h"
32 #include "pipe/p_screen.h"
34 #include "cell/common.h"
35 #include "cell_screen.h"
36 #include "cell_texture.h"
37 #include "cell_winsys.h"
41 cell_get_vendor(struct pipe_screen
*screen
)
43 return "Tungsten Graphics, Inc.";
48 cell_get_name(struct pipe_screen
*screen
)
55 cell_get_param(struct pipe_screen
*screen
, int param
)
58 case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS
:
59 return CELL_MAX_SAMPLERS
;
60 case PIPE_CAP_NPOT_TEXTURES
:
62 case PIPE_CAP_TWO_SIDED_STENCIL
:
68 case PIPE_CAP_ANISOTROPIC_FILTER
:
70 case PIPE_CAP_POINT_SPRITE
:
72 case PIPE_CAP_MAX_RENDER_TARGETS
:
74 case PIPE_CAP_OCCLUSION_QUERY
:
76 case PIPE_CAP_TEXTURE_SHADOW_MAP
:
78 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS
:
79 return CELL_MAX_TEXTURE_LEVELS
;
80 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS
:
81 return 8; /* max 128x128x128 */
82 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS
:
83 return CELL_MAX_TEXTURE_LEVELS
;
84 case PIPE_CAP_TEXTURE_MIRROR_REPEAT
:
85 return 1; /* XXX not really true */
86 case PIPE_CAP_TEXTURE_MIRROR_CLAMP
:
87 return 0; /* XXX to do */
95 cell_get_paramf(struct pipe_screen
*screen
, int param
)
98 case PIPE_CAP_MAX_LINE_WIDTH
:
100 case PIPE_CAP_MAX_LINE_WIDTH_AA
:
101 return 255.0; /* arbitrary */
103 case PIPE_CAP_MAX_POINT_WIDTH
:
105 case PIPE_CAP_MAX_POINT_WIDTH_AA
:
106 return 255.0; /* arbitrary */
108 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY
:
111 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS
:
112 return 16.0; /* arbitrary */
121 cell_is_format_supported( struct pipe_screen
*screen
,
122 enum pipe_format format
,
123 enum pipe_texture_target target
,
125 unsigned geom_flags
)
127 /* cell supports most formats, XXX for now anyway */
128 if (format
== PIPE_FORMAT_DXT5_RGBA
||
129 format
== PIPE_FORMAT_R8G8B8A8_SRGB
)
137 cell_destroy_screen( struct pipe_screen
*screen
)
139 struct pipe_winsys
*winsys
= screen
->winsys
;
142 winsys
->destroy(winsys
);
149 * Create a new pipe_screen object
150 * Note: we're not presently subclassing pipe_screen (no cell_screen) but
151 * that would be the place to put SPU thread/context info...
154 cell_create_screen(struct pipe_winsys
*winsys
)
156 struct pipe_screen
*screen
= CALLOC_STRUCT(pipe_screen
);
161 screen
->winsys
= winsys
;
163 screen
->destroy
= cell_destroy_screen
;
165 screen
->get_name
= cell_get_name
;
166 screen
->get_vendor
= cell_get_vendor
;
167 screen
->get_param
= cell_get_param
;
168 screen
->get_paramf
= cell_get_paramf
;
169 screen
->is_format_supported
= cell_is_format_supported
;
171 cell_init_screen_texture_funcs(screen
);