Go to the source code of this file.
Functions | |
void | st_init_limits (struct st_context *st) |
Query driver to get implementation limits. | |
void | st_init_extensions (struct st_context *st) |
XXX this needs careful review. |
void st_init_extensions | ( | struct st_context * | st | ) |
XXX this needs careful review.
Definition at line 121 of file st_extensions.c.
References st_context::ctx, pipe_screen::get_param, pipe_screen::is_format_supported, st_context::pipe, PIPE_CAP_ANISOTROPIC_FILTER, PIPE_CAP_GLSL, PIPE_CAP_MAX_RENDER_TARGETS, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS, PIPE_CAP_NPOT_TEXTURES, PIPE_CAP_OCCLUSION_QUERY, PIPE_CAP_POINT_SPRITE, PIPE_CAP_TEXTURE_MIRROR_CLAMP, PIPE_CAP_TEXTURE_MIRROR_REPEAT, PIPE_CAP_TEXTURE_SHADOW_MAP, PIPE_CAP_TWO_SIDED_STENCIL, PIPE_FORMAT_DXT5_RGBA, PIPE_FORMAT_R8G8B8A8_SRGB, PIPE_FORMAT_S8Z24_UNORM, PIPE_FORMAT_YCBCR, PIPE_FORMAT_YCBCR_REV, PIPE_FORMAT_Z24S8_UNORM, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_DEPTH_STENCIL, PIPE_TEXTURE_USAGE_SAMPLER, and pipe_context::screen.
00122 { 00123 struct pipe_screen *screen = st->pipe->screen; 00124 GLcontext *ctx = st->ctx; 00125 00126 /* 00127 * Extensions that are supported by all Gallium drivers: 00128 */ 00129 ctx->Extensions.ARB_multisample = GL_TRUE; /* API support */ 00130 ctx->Extensions.ARB_fragment_program = GL_TRUE; 00131 ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */ 00132 ctx->Extensions.ARB_texture_compression = GL_TRUE; /* API support only */ 00133 ctx->Extensions.ARB_texture_cube_map = GL_TRUE; 00134 ctx->Extensions.ARB_texture_env_combine = GL_TRUE; 00135 ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; 00136 ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; 00137 ctx->Extensions.ARB_vertex_program = GL_TRUE; 00138 ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; 00139 00140 ctx->Extensions.EXT_blend_color = GL_TRUE; 00141 ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; 00142 ctx->Extensions.EXT_blend_func_separate = GL_TRUE; 00143 ctx->Extensions.EXT_blend_logic_op = GL_TRUE; 00144 ctx->Extensions.EXT_blend_minmax = GL_TRUE; 00145 ctx->Extensions.EXT_blend_subtract = GL_TRUE; 00146 ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; 00147 ctx->Extensions.EXT_framebuffer_object = GL_TRUE; 00148 ctx->Extensions.EXT_fog_coord = GL_TRUE; 00149 ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE; 00150 ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; 00151 ctx->Extensions.EXT_point_parameters = GL_TRUE; 00152 ctx->Extensions.EXT_secondary_color = GL_TRUE; 00153 ctx->Extensions.EXT_stencil_wrap = GL_TRUE; 00154 ctx->Extensions.EXT_texture_env_add = GL_TRUE; 00155 ctx->Extensions.EXT_texture_env_combine = GL_TRUE; 00156 ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; 00157 ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; 00158 00159 ctx->Extensions.NV_blend_square = GL_TRUE; 00160 ctx->Extensions.NV_texgen_reflection = GL_TRUE; 00161 00162 ctx->Extensions.SGI_color_matrix = GL_TRUE; 00163 ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; /* XXX temp */ 00164 00165 /* 00166 * Extensions that depend on the driver/hardware: 00167 */ 00168 if (screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS) > 0) { 00169 ctx->Extensions.ARB_draw_buffers = GL_TRUE; 00170 } 00171 00172 if (screen->get_param(screen, PIPE_CAP_GLSL)) { 00173 ctx->Extensions.ARB_fragment_shader = GL_TRUE; 00174 ctx->Extensions.ARB_vertex_shader = GL_TRUE; 00175 ctx->Extensions.ARB_shader_objects = GL_TRUE; 00176 ctx->Extensions.ARB_shading_language_100 = GL_TRUE; 00177 ctx->Extensions.ARB_shading_language_120 = GL_TRUE; 00178 } 00179 00180 if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_REPEAT) > 0) { 00181 ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; 00182 } 00183 00184 if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_CLAMP) > 0) { 00185 ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE; 00186 } 00187 00188 if (screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) { 00189 ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; 00190 ctx->Extensions.NV_texture_rectangle = GL_TRUE; 00191 } 00192 00193 if (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS) > 1) { 00194 ctx->Extensions.ARB_multitexture = GL_TRUE; 00195 } 00196 00197 if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) { 00198 ctx->Extensions.ATI_separate_stencil = GL_TRUE; 00199 } 00200 00201 if (screen->get_param(screen, PIPE_CAP_ANISOTROPIC_FILTER)) { 00202 ctx->Extensions.EXT_texture_filter_anisotropic = GL_TRUE; 00203 } 00204 00205 if (screen->get_param(screen, PIPE_CAP_POINT_SPRITE)) { 00206 ctx->Extensions.ARB_point_sprite = GL_TRUE; 00207 ctx->Extensions.NV_point_sprite = GL_TRUE; 00208 } 00209 00210 if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) { 00211 ctx->Extensions.ARB_occlusion_query = GL_TRUE; 00212 } 00213 00214 if (screen->get_param(screen, PIPE_CAP_TEXTURE_SHADOW_MAP)) { 00215 ctx->Extensions.ARB_depth_texture = GL_TRUE; 00216 ctx->Extensions.ARB_shadow = GL_TRUE; 00217 ctx->Extensions.EXT_shadow_funcs = GL_TRUE; 00218 /*ctx->Extensions.ARB_shadow_ambient = GL_TRUE;*/ 00219 } 00220 00221 /* GL_EXT_packed_depth_stencil requires both the ability to render to 00222 * a depth/stencil buffer and texture from depth/stencil source. 00223 */ 00224 if (screen->is_format_supported(screen, PIPE_FORMAT_Z24S8_UNORM, 00225 PIPE_TEXTURE_2D, 00226 PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0) && 00227 screen->is_format_supported(screen, PIPE_FORMAT_Z24S8_UNORM, 00228 PIPE_TEXTURE_2D, 00229 PIPE_TEXTURE_USAGE_SAMPLER, 0)) { 00230 ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; 00231 } 00232 else if (screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM, 00233 PIPE_TEXTURE_2D, 00234 PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0) && 00235 screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM, 00236 PIPE_TEXTURE_2D, 00237 PIPE_TEXTURE_USAGE_SAMPLER, 0)) { 00238 ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE; 00239 } 00240 00241 if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SRGB, 00242 PIPE_TEXTURE_2D, 00243 PIPE_TEXTURE_USAGE_SAMPLER, 0)) { 00244 ctx->Extensions.EXT_texture_sRGB = GL_TRUE; 00245 } 00246 00247 #if 01 00248 if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA, 00249 PIPE_TEXTURE_2D, 00250 PIPE_TEXTURE_USAGE_SAMPLER, 0)) { 00251 ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE; 00252 } 00253 #endif 00254 if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR, 00255 PIPE_TEXTURE_2D, 00256 PIPE_TEXTURE_USAGE_SAMPLER, 0) || 00257 screen->is_format_supported(screen, PIPE_FORMAT_YCBCR_REV, 00258 PIPE_TEXTURE_2D, 00259 PIPE_TEXTURE_USAGE_SAMPLER, 0)) { 00260 ctx->Extensions.MESA_ycbcr_texture = GL_TRUE; 00261 } 00262 00263 }
void st_init_limits | ( | struct st_context * | st | ) |
Query driver to get implementation limits.
Note that we have to limit/clamp against Mesa's internal limits too.
Definition at line 66 of file st_extensions.c.
References _clamp(), _maxf(), _min(), CLAMP, st_context::ctx, pipe_screen::get_param, pipe_screen::get_paramf, st_context::pipe, PIPE_CAP_MAX_LINE_WIDTH, PIPE_CAP_MAX_LINE_WIDTH_AA, PIPE_CAP_MAX_POINT_WIDTH, PIPE_CAP_MAX_POINT_WIDTH_AA, PIPE_CAP_MAX_RENDER_TARGETS, PIPE_CAP_MAX_TEXTURE_2D_LEVELS, PIPE_CAP_MAX_TEXTURE_3D_LEVELS, PIPE_CAP_MAX_TEXTURE_ANISOTROPY, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS, PIPE_CAP_MAX_TEXTURE_LOD_BIAS, and pipe_context::screen.
00067 { 00068 struct pipe_screen *screen = st->pipe->screen; 00069 struct gl_constants *c = &st->ctx->Const; 00070 00071 c->MaxTextureLevels 00072 = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS), 00073 MAX_TEXTURE_LEVELS); 00074 00075 c->Max3DTextureLevels 00076 = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS), 00077 MAX_3D_TEXTURE_LEVELS); 00078 00079 c->MaxCubeTextureLevels 00080 = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS), 00081 MAX_CUBE_TEXTURE_LEVELS); 00082 00083 c->MaxTextureRectSize 00084 = _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE); 00085 00086 c->MaxTextureUnits 00087 = c->MaxTextureImageUnits 00088 = c->MaxTextureCoordUnits 00089 = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS), 00090 MAX_TEXTURE_IMAGE_UNITS); 00091 00092 c->MaxDrawBuffers 00093 = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 00094 1, MAX_DRAW_BUFFERS); 00095 00096 c->MaxLineWidth 00097 = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH)); 00098 c->MaxLineWidthAA 00099 = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_LINE_WIDTH_AA)); 00100 00101 c->MaxPointSize 00102 = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH)); 00103 c->MaxPointSizeAA 00104 = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA)); 00105 00106 c->MaxTextureMaxAnisotropy 00107 = _maxf(2.0f, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY)); 00108 00109 c->MaxTextureLodBias 00110 = screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS); 00111 00112 c->MaxDrawBuffers 00113 = CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 00114 1, MAX_DRAW_BUFFERS); 00115 }