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
:
94 case PIPE_CAP_MAX_CONST_BUFFERS
:
95 return PIPE_MAX_CONSTANT_BUFFERS
;
96 case PIPE_CAP_MAX_CONST_BUFFER_SIZE
:
97 return 4096 * 4 * sizeof(float);
105 softpipe_get_paramf(struct pipe_screen
*screen
, int param
)
108 case PIPE_CAP_MAX_LINE_WIDTH
:
110 case PIPE_CAP_MAX_LINE_WIDTH_AA
:
111 return 255.0; /* arbitrary */
112 case PIPE_CAP_MAX_POINT_WIDTH
:
114 case PIPE_CAP_MAX_POINT_WIDTH_AA
:
115 return 255.0; /* arbitrary */
116 case PIPE_CAP_MAX_TEXTURE_ANISOTROPY
:
117 return 16.0; /* not actually signficant at this time */
118 case PIPE_CAP_MAX_TEXTURE_LOD_BIAS
:
119 return 16.0; /* arbitrary */
127 * Query format support for creating a texture, drawing surface, etc.
128 * \param format the format to test
129 * \param type one of PIPE_TEXTURE, PIPE_SURFACE
132 softpipe_is_format_supported( struct pipe_screen
*screen
,
133 enum pipe_format format
,
134 enum pipe_texture_target target
,
136 unsigned geom_flags
)
138 assert(target
== PIPE_TEXTURE_1D
||
139 target
== PIPE_TEXTURE_2D
||
140 target
== PIPE_TEXTURE_3D
||
141 target
== PIPE_TEXTURE_CUBE
);
144 case PIPE_FORMAT_L16_UNORM
:
145 case PIPE_FORMAT_YCBCR_REV
:
146 case PIPE_FORMAT_YCBCR
:
147 case PIPE_FORMAT_DXT1_RGB
:
148 case PIPE_FORMAT_DXT1_RGBA
:
149 case PIPE_FORMAT_DXT3_RGBA
:
150 case PIPE_FORMAT_DXT5_RGBA
:
151 case PIPE_FORMAT_Z32_FLOAT
:
152 case PIPE_FORMAT_R8G8_SNORM
:
153 case PIPE_FORMAT_B6UG5SR5S_NORM
:
154 case PIPE_FORMAT_X8UB8UG8SR8S_NORM
:
155 case PIPE_FORMAT_A8B8G8R8_SNORM
:
156 case PIPE_FORMAT_NONE
:
165 softpipe_destroy_screen( struct pipe_screen
*screen
)
167 struct pipe_winsys
*winsys
= screen
->winsys
;
170 winsys
->destroy(winsys
);
178 * Create a new pipe_screen object
179 * Note: we're not presently subclassing pipe_screen (no softpipe_screen).
182 softpipe_create_screen(struct pipe_winsys
*winsys
)
184 struct softpipe_screen
*screen
= CALLOC_STRUCT(softpipe_screen
);
189 screen
->base
.winsys
= winsys
;
191 screen
->base
.destroy
= softpipe_destroy_screen
;
193 screen
->base
.get_name
= softpipe_get_name
;
194 screen
->base
.get_vendor
= softpipe_get_vendor
;
195 screen
->base
.get_param
= softpipe_get_param
;
196 screen
->base
.get_paramf
= softpipe_get_paramf
;
197 screen
->base
.is_format_supported
= softpipe_is_format_supported
;
199 softpipe_init_screen_texture_funcs(&screen
->base
);
200 u_simple_screen_init(&screen
->base
);
202 return &screen
->base
;