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 "sp_texture.h"
36 #include "sp_winsys.h"
37 #include "sp_screen.h"
41 softpipe_get_vendor(struct pipe_screen
*screen
)
43 return "VMware, Inc.";
48 softpipe_get_name(struct pipe_screen
*screen
)
55 softpipe_get_param(struct pipe_screen
*screen
, int param
)
58 case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS
:
59 return PIPE_MAX_SAMPLERS
;
60 case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS
:
61 return PIPE_MAX_VERTEX_SAMPLERS
;
62 case PIPE_CAP_MAX_COMBINED_SAMPLERS
:
63 return PIPE_MAX_SAMPLERS
+ PIPE_MAX_VERTEX_SAMPLERS
;
64 case PIPE_CAP_NPOT_TEXTURES
:
66 case PIPE_CAP_TWO_SIDED_STENCIL
:
70 case PIPE_CAP_ANISOTROPIC_FILTER
:
72 case PIPE_CAP_POINT_SPRITE
:
74 case PIPE_CAP_MAX_RENDER_TARGETS
:
75 return PIPE_MAX_COLOR_BUFS
;
76 case PIPE_CAP_OCCLUSION_QUERY
:
78 case PIPE_CAP_TEXTURE_MIRROR_CLAMP
:
80 case PIPE_CAP_TEXTURE_MIRROR_REPEAT
:
82 case PIPE_CAP_TEXTURE_SHADOW_MAP
:
84 case PIPE_CAP_MAX_TEXTURE_2D_LEVELS
:
85 return 13; /* max 4Kx4K */
86 case PIPE_CAP_MAX_TEXTURE_3D_LEVELS
:
87 return 9; /* max 256x256x256 */
88 case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS
:
89 return 13; /* max 4Kx4K */
90 case PIPE_CAP_TGSI_CONT_SUPPORTED
:
92 case PIPE_CAP_BLEND_EQUATION_SEPARATE
:
101 softpipe_get_paramf(struct pipe_screen
*screen
, int param
)
104 case PIPE_CAP_MAX_LINE_WIDTH
:
106 case PIPE_CAP_MAX_LINE_WIDTH_AA
:
107 return 255.0; /* arbitrary */
108 case PIPE_CAP_MAX_POINT_WIDTH
:
110 case PIPE_CAP_MAX_POINT_WIDTH_AA
:
111 return 255.0; /* arbitrary */
112 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY
:
113 return 16.0; /* not actually signficant at this time */
114 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS
:
115 return 16.0; /* arbitrary */
123 * Query format support for creating a texture, drawing surface, etc.
124 * \param format the format to test
125 * \param type one of PIPE_TEXTURE, PIPE_SURFACE
128 softpipe_is_format_supported( struct pipe_screen
*screen
,
129 enum pipe_format format
,
130 enum pipe_texture_target target
,
132 unsigned geom_flags
)
134 assert(target
== PIPE_TEXTURE_1D
||
135 target
== PIPE_TEXTURE_2D
||
136 target
== PIPE_TEXTURE_3D
||
137 target
== PIPE_TEXTURE_CUBE
);
140 case PIPE_FORMAT_L16_UNORM
:
141 case PIPE_FORMAT_YCBCR_REV
:
142 case PIPE_FORMAT_YCBCR
:
143 case PIPE_FORMAT_DXT1_RGB
:
144 case PIPE_FORMAT_DXT1_RGBA
:
145 case PIPE_FORMAT_DXT3_RGBA
:
146 case PIPE_FORMAT_DXT5_RGBA
:
147 case PIPE_FORMAT_Z32_FLOAT
:
148 case PIPE_FORMAT_R8G8_SNORM
:
149 case PIPE_FORMAT_B6UG5SR5S_NORM
:
150 case PIPE_FORMAT_X8UB8UG8SR8S_NORM
:
151 case PIPE_FORMAT_A8B8G8R8_SNORM
:
152 case PIPE_FORMAT_NONE
:
161 softpipe_destroy_screen( struct pipe_screen
*screen
)
163 struct pipe_winsys
*winsys
= screen
->winsys
;
166 winsys
->destroy(winsys
);
174 * Create a new pipe_screen object
175 * Note: we're not presently subclassing pipe_screen (no softpipe_screen).
178 softpipe_create_screen(struct pipe_winsys
*winsys
)
180 struct softpipe_screen
*screen
= CALLOC_STRUCT(softpipe_screen
);
185 screen
->base
.winsys
= winsys
;
187 screen
->base
.destroy
= softpipe_destroy_screen
;
189 screen
->base
.get_name
= softpipe_get_name
;
190 screen
->base
.get_vendor
= softpipe_get_vendor
;
191 screen
->base
.get_param
= softpipe_get_param
;
192 screen
->base
.get_paramf
= softpipe_get_paramf
;
193 screen
->base
.is_format_supported
= softpipe_is_format_supported
;
195 softpipe_init_screen_texture_funcs(&screen
->base
);
196 u_simple_screen_init(&screen
->base
);
198 return &screen
->base
;