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 "util/u_simple_screen.h"
31 #include "pipe/internal/p_winsys_screen.h"
32 #include "pipe/p_defines.h"
33 #include "pipe/p_screen.h"
35 #include "cell/common.h"
36 #include "cell_screen.h"
37 #include "cell_texture.h"
38 #include "cell_winsys.h"
42 cell_get_vendor(struct pipe_screen
*screen
)
44 return "VMware, Inc.";
49 cell_get_name(struct pipe_screen
*screen
)
56 cell_get_param(struct pipe_screen
*screen
, int param
)
59 case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS
:
60 return CELL_MAX_SAMPLERS
;
61 case PIPE_CAP_NPOT_TEXTURES
:
63 case PIPE_CAP_TWO_SIDED_STENCIL
:
67 case PIPE_CAP_ANISOTROPIC_FILTER
:
69 case PIPE_CAP_POINT_SPRITE
:
71 case PIPE_CAP_MAX_RENDER_TARGETS
:
73 case PIPE_CAP_OCCLUSION_QUERY
:
75 case PIPE_CAP_TEXTURE_SHADOW_MAP
:
77 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS
:
78 return CELL_MAX_TEXTURE_LEVELS
;
79 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS
:
80 return 8; /* max 128x128x128 */
81 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS
:
82 return CELL_MAX_TEXTURE_LEVELS
;
83 case PIPE_CAP_TEXTURE_MIRROR_REPEAT
:
84 return 1; /* XXX not really true */
85 case PIPE_CAP_TEXTURE_MIRROR_CLAMP
:
86 return 0; /* XXX to do */
87 case PIPE_CAP_TGSI_CONT_SUPPORTED
:
96 cell_get_paramf(struct pipe_screen
*screen
, int param
)
99 case PIPE_CAP_MAX_LINE_WIDTH
:
101 case PIPE_CAP_MAX_LINE_WIDTH_AA
:
102 return 255.0; /* arbitrary */
104 case PIPE_CAP_MAX_POINT_WIDTH
:
106 case PIPE_CAP_MAX_POINT_WIDTH_AA
:
107 return 255.0; /* arbitrary */
109 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY
:
112 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS
:
113 return 16.0; /* arbitrary */
122 cell_is_format_supported( struct pipe_screen
*screen
,
123 enum pipe_format format
,
124 enum pipe_texture_target target
,
126 unsigned geom_flags
)
128 /* cell supports most formats, XXX for now anyway */
129 if (format
== PIPE_FORMAT_DXT5_RGBA
||
130 format
== PIPE_FORMAT_R8G8B8A8_SRGB
)
138 cell_destroy_screen( struct pipe_screen
*screen
)
140 struct pipe_winsys
*winsys
= screen
->winsys
;
143 winsys
->destroy(winsys
);
150 * Create a new pipe_screen object
151 * Note: we're not presently subclassing pipe_screen (no cell_screen) but
152 * that would be the place to put SPU thread/context info...
155 cell_create_screen(struct pipe_winsys
*winsys
)
157 struct pipe_screen
*screen
= CALLOC_STRUCT(pipe_screen
);
162 screen
->winsys
= winsys
;
164 screen
->destroy
= cell_destroy_screen
;
166 screen
->get_name
= cell_get_name
;
167 screen
->get_vendor
= cell_get_vendor
;
168 screen
->get_param
= cell_get_param
;
169 screen
->get_paramf
= cell_get_paramf
;
170 screen
->is_format_supported
= cell_is_format_supported
;
172 cell_init_screen_texture_funcs(screen
);
173 u_simple_screen_init(screen
);