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/p_defines.h"
32 #include "pipe/p_screen.h"
34 #include "cell/common.h"
35 #include "cell_context.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_MAX_COMBINED_SAMPLERS
:
62 return CELL_MAX_SAMPLERS
;
63 case PIPE_CAP_NPOT_TEXTURES
:
65 case PIPE_CAP_TWO_SIDED_STENCIL
:
69 case PIPE_CAP_ANISOTROPIC_FILTER
:
71 case PIPE_CAP_POINT_SPRITE
:
73 case PIPE_CAP_MAX_RENDER_TARGETS
:
75 case PIPE_CAP_OCCLUSION_QUERY
:
77 case PIPE_CAP_TEXTURE_SHADOW_MAP
:
79 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS
:
80 return CELL_MAX_TEXTURE_LEVELS
;
81 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS
:
82 return 8; /* max 128x128x128 */
83 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS
:
84 return CELL_MAX_TEXTURE_LEVELS
;
85 case PIPE_CAP_TEXTURE_MIRROR_REPEAT
:
86 return 1; /* XXX not really true */
87 case PIPE_CAP_TEXTURE_MIRROR_CLAMP
:
88 return 0; /* XXX to do */
89 case PIPE_CAP_TGSI_CONT_SUPPORTED
:
91 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT
:
92 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER
:
94 case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT
:
95 case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER
:
104 cell_get_paramf(struct pipe_screen
*screen
, int param
)
107 case PIPE_CAP_MAX_LINE_WIDTH
:
109 case PIPE_CAP_MAX_LINE_WIDTH_AA
:
110 return 255.0; /* arbitrary */
112 case PIPE_CAP_MAX_POINT_WIDTH
:
114 case PIPE_CAP_MAX_POINT_WIDTH_AA
:
115 return 255.0; /* arbitrary */
117 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY
:
120 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS
:
121 return 16.0; /* arbitrary */
130 cell_is_format_supported( struct pipe_screen
*screen
,
131 enum pipe_format format
,
132 enum pipe_texture_target target
,
134 unsigned geom_flags
)
136 /* cell supports most formats, XXX for now anyway */
137 if (format
== PIPE_FORMAT_DXT5_RGBA
||
138 format
== PIPE_FORMAT_A8B8G8R8_SRGB
)
146 cell_destroy_screen( struct pipe_screen
*screen
)
148 struct pipe_winsys
*winsys
= screen
->winsys
;
151 winsys
->destroy(winsys
);
158 * Create a new pipe_screen object
159 * Note: we're not presently subclassing pipe_screen (no cell_screen) but
160 * that would be the place to put SPU thread/context info...
163 cell_create_screen(struct pipe_winsys
*winsys
)
165 struct pipe_screen
*screen
= CALLOC_STRUCT(pipe_screen
);
170 screen
->winsys
= winsys
;
172 screen
->destroy
= cell_destroy_screen
;
174 screen
->get_name
= cell_get_name
;
175 screen
->get_vendor
= cell_get_vendor
;
176 screen
->get_param
= cell_get_param
;
177 screen
->get_paramf
= cell_get_paramf
;
178 screen
->is_format_supported
= cell_is_format_supported
;
179 screen
->context_create
= cell_create_context
;
181 cell_init_screen_texture_funcs(screen
);
182 u_simple_screen_init(screen
);