62
64
#include "radeon_span.h"
64
#define need_GL_ARB_occlusion_query
65
#define need_GL_ARB_vertex_array_object
66
#define need_GL_ARB_vertex_program
67
#define need_GL_APPLE_vertex_array_object
68
#define need_GL_ATI_fragment_shader
69
#define need_GL_EXT_blend_minmax
70
#define need_GL_EXT_fog_coord
71
#define need_GL_EXT_secondary_color
72
#define need_GL_EXT_blend_equation_separate
73
#define need_GL_EXT_blend_func_separate
74
#define need_GL_EXT_gpu_program_parameters
75
#define need_GL_NV_vertex_program
76
#define need_GL_ARB_point_parameters
77
#define need_GL_EXT_framebuffer_object
78
#define need_GL_OES_EGL_image
80
#include "main/remap_helper.h"
83
67
#include "xmlpool.h" /* for symbolic values of enum-type options */
114
/* Extension strings exported by the R200 driver.
116
static const struct dri_extension card_extensions[] =
118
{ "GL_ARB_half_float_pixel", NULL },
119
{ "GL_ARB_multitexture", NULL },
120
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
121
{ "GL_ARB_texture_border_clamp", NULL },
122
{ "GL_ARB_texture_env_add", NULL },
123
{ "GL_ARB_texture_env_combine", NULL },
124
{ "GL_ARB_texture_env_dot3", NULL },
125
{ "GL_ARB_texture_env_crossbar", NULL },
126
{ "GL_ARB_texture_mirrored_repeat", NULL },
127
{ "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions},
128
{ "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
129
{ "GL_EXT_blend_subtract", NULL },
130
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
131
{ "GL_EXT_packed_depth_stencil", NULL},
132
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
133
{ "GL_EXT_stencil_wrap", NULL },
134
{ "GL_EXT_texture_edge_clamp", NULL },
135
{ "GL_EXT_texture_env_combine", NULL },
136
{ "GL_EXT_texture_env_dot3", NULL },
137
{ "GL_EXT_texture_filter_anisotropic", NULL },
138
{ "GL_EXT_texture_lod_bias", NULL },
139
{ "GL_EXT_texture_mirror_clamp", NULL },
140
{ "GL_EXT_texture_rectangle", NULL },
141
{ "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions },
142
{ "GL_ATI_texture_env_combine3", NULL },
143
{ "GL_ATI_texture_mirror_once", NULL },
144
{ "GL_MESA_pack_invert", NULL },
145
{ "GL_NV_blend_square", NULL },
146
#if FEATURE_OES_EGL_image
147
{ "GL_OES_EGL_image", GL_OES_EGL_image_functions },
152
static const struct dri_extension blend_extensions[] = {
153
{ "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
154
{ "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
158
static const struct dri_extension ARB_vp_extension[] = {
159
{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
160
{ "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions},
164
static const struct dri_extension NV_vp_extension[] = {
165
{ "GL_NV_vertex_program", GL_NV_vertex_program_functions }
168
static const struct dri_extension ATI_fs_extension[] = {
169
{ "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }
172
static const struct dri_extension point_extensions[] = {
173
{ "GL_ARB_point_sprite", NULL },
174
{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
178
static const struct dri_extension mm_extensions[] = {
179
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
183
98
extern const struct tnl_pipeline_stage _r200_render_stage;
184
99
extern const struct tnl_pipeline_stage _r200_tcl_stage;
284
197
GLboolean r200CreateContext( gl_api api,
285
198
const struct gl_config *glVisual,
286
199
__DRIcontext *driContextPriv,
200
unsigned major_version,
201
unsigned minor_version,
287
204
void *sharedContextPrivate)
289
206
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
290
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
207
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->driverPrivate);
291
208
struct dd_function_table functions;
292
209
r200ContextPtr rmesa;
293
210
struct gl_context *ctx;
214
/* API and flag filtering is handled in dri2CreateContextAttribs.
297
219
assert(glVisual);
298
220
assert(driContextPriv);
301
223
/* Allocate the R200 context */
302
224
rmesa = (r200ContextPtr) CALLOC( sizeof(*rmesa) );
226
*error = __DRI_CTX_ERROR_NO_MEMORY;
306
230
rmesa->radeon.radeonScreen = screen;
307
231
r200_init_vtbl(&rmesa->radeon);
440
364
_math_matrix_ctr( &rmesa->tmpmat );
441
365
_math_matrix_set_identity( &rmesa->tmpmat );
443
driInitExtensions( ctx, card_extensions, GL_TRUE );
445
if (rmesa->radeon.radeonScreen->kernel_mm)
446
driInitExtensions(ctx, mm_extensions, GL_FALSE);
367
ctx->Extensions.ARB_half_float_pixel = true;
368
ctx->Extensions.ARB_occlusion_query = true;
369
ctx->Extensions.ARB_texture_border_clamp = true;
370
ctx->Extensions.ARB_texture_env_combine = true;
371
ctx->Extensions.ARB_texture_env_dot3 = true;
372
ctx->Extensions.ARB_texture_env_crossbar = true;
373
ctx->Extensions.ARB_vertex_array_object = true;
374
ctx->Extensions.EXT_blend_color = true;
375
ctx->Extensions.EXT_blend_minmax = true;
376
ctx->Extensions.EXT_fog_coord = true;
377
ctx->Extensions.EXT_packed_depth_stencil = true;
378
ctx->Extensions.EXT_secondary_color = true;
379
ctx->Extensions.EXT_texture_env_dot3 = true;
380
ctx->Extensions.EXT_texture_filter_anisotropic = true;
381
ctx->Extensions.EXT_texture_mirror_clamp = true;
382
ctx->Extensions.APPLE_vertex_array_object = true;
383
ctx->Extensions.ATI_texture_env_combine3 = true;
384
ctx->Extensions.ATI_texture_mirror_once = true;
385
ctx->Extensions.MESA_pack_invert = true;
386
ctx->Extensions.NV_blend_square = true;
387
ctx->Extensions.NV_texture_rectangle = true;
388
#if FEATURE_OES_EGL_image
389
ctx->Extensions.OES_EGL_image = true;
392
ctx->Extensions.EXT_framebuffer_object = true;
393
ctx->Extensions.ARB_occlusion_query = true;
447
395
if (!(rmesa->radeon.radeonScreen->chip_flags & R200_CHIPSET_YCBCR_BROKEN)) {
448
396
/* yuv textures don't work with some chips - R200 / rv280 okay so far
449
397
others get the bit ordering right but don't actually do YUV-RGB conversion */
450
_mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
398
ctx->Extensions.MESA_ycbcr_texture = true;
452
400
if (rmesa->radeon.glCtx->Mesa_DXTn) {
453
_mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
454
_mesa_enable_extension( ctx, "GL_S3_s3tc" );
401
ctx->Extensions.EXT_texture_compression_s3tc = true;
402
ctx->Extensions.S3_s3tc = true;
456
404
else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
457
_mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
460
if (rmesa->radeon.radeonScreen->drmSupportsCubeMapsR200)
461
_mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" );
462
if (rmesa->radeon.radeonScreen->drmSupportsBlendColor) {
463
driInitExtensions( ctx, blend_extensions, GL_FALSE );
465
if(rmesa->radeon.radeonScreen->drmSupportsVertexProgram)
466
driInitExtensions( ctx, ARB_vp_extension, GL_FALSE );
467
if(driQueryOptionb(&rmesa->radeon.optionCache, "nv_vertex_program"))
468
driInitSingleExtension( ctx, NV_vp_extension );
470
if ((ctx->Const.MaxTextureUnits == 6) && rmesa->radeon.radeonScreen->drmSupportsFragShader)
471
driInitSingleExtension( ctx, ATI_fs_extension );
472
if (rmesa->radeon.radeonScreen->drmSupportsPointSprites)
473
driInitExtensions( ctx, point_extensions, GL_FALSE );
475
if (!rmesa->radeon.radeonScreen->kernel_mm)
476
_mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
405
ctx->Extensions.EXT_texture_compression_s3tc = true;
408
ctx->Extensions.ARB_texture_cube_map = true;
410
ctx->Extensions.EXT_blend_equation_separate = true;
411
ctx->Extensions.EXT_blend_func_separate = true;
413
ctx->Extensions.ARB_vertex_program = true;
414
ctx->Extensions.EXT_gpu_program_parameters = true;
416
ctx->Extensions.NV_vertex_program =
417
driQueryOptionb(&rmesa->radeon.optionCache, "nv_vertex_program");
419
ctx->Extensions.ATI_fragment_shader = (ctx->Const.MaxTextureUnits == 6);
421
ctx->Extensions.ARB_point_sprite = true;
422
ctx->Extensions.EXT_point_parameters = true;
478
425
r200InitDriverFuncs( ctx );
479
426
r200InitIoctlFuncs( ctx );