#include <stdbool.h>
#include "main/glheader.h"
#include "main/api_arrayelt.h"
+#include "main/api_exec.h"
#include "main/context.h"
#include "main/simple_list.h"
#include "main/imports.h"
#include "main/extensions.h"
-#include "main/mfeatures.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "radeon_tcl.h"
#include "radeon_queryobj.h"
#include "radeon_blit.h"
+#include "radeon_fog.h"
#include "utils.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
r100CreateContext( gl_api api,
const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
+ unsigned major_version,
+ unsigned minor_version,
+ uint32_t flags,
+ unsigned *error,
void *sharedContextPrivate)
{
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
- radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
+ radeonScreenPtr screen = (radeonScreenPtr)(sPriv->driverPrivate);
struct dd_function_table functions;
r100ContextPtr rmesa;
struct gl_context *ctx;
int i;
int tcl_mode, fthrottle_mode;
+ switch (api) {
+ case API_OPENGL_COMPAT:
+ if (major_version > 1 || minor_version > 3) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES:
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ }
+
+ /* Flag filtering is handled in dri2CreateContextAttribs.
+ */
+ (void) flags;
+
assert(glVisual);
assert(driContextPriv);
assert(screen);
/* Allocate the Radeon context */
- rmesa = (r100ContextPtr) CALLOC( sizeof(*rmesa) );
- if ( !rmesa )
+ rmesa = calloc(1, sizeof(*rmesa));
+ if ( !rmesa ) {
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
return GL_FALSE;
+ }
rmesa->radeon.radeonScreen = screen;
r100_init_vtbl(&rmesa->radeon);
if (!radeonInitContext(&rmesa->radeon, &functions,
glVisual, driContextPriv,
sharedContextPrivate)) {
- FREE(rmesa);
+ free(rmesa);
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
return GL_FALSE;
}
rmesa->radeon.swtcl.RenderIndex = ~0;
rmesa->radeon.hw.all_dirty = GL_TRUE;
+ ctx = &rmesa->radeon.glCtx;
+ /* Initialize the software rasterizer and helper modules.
+ */
+ _swrast_CreateContext( ctx );
+ _vbo_CreateContext( ctx );
+ _tnl_CreateContext( ctx );
+ _swsetup_CreateContext( ctx );
+ _ae_create_context( ctx );
+
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have all of them in
* texturable memory at once. Depending on the allow_large_textures driconf
* setting allow larger textures.
*/
- ctx = rmesa->radeon.glCtx;
ctx->Const.MaxTextureUnits = driQueryOptioni (&rmesa->radeon.optionCache,
"texture_units");
- ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
+ ctx->Const.FragmentProgram.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxTextureUnits;
+ ctx->Const.StripTextureBorder = GL_TRUE;
+
i = driQueryOptioni( &rmesa->radeon.optionCache, "allow_large_textures");
/* FIXME: When no memory manager is available we should set this
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
- /* Initialize the software rasterizer and helper modules.
- */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _ae_create_context( ctx );
-
/* Install the customized pipeline:
*/
_tnl_destroy_pipeline( ctx );
ctx->Extensions.ATI_texture_mirror_once = true;
ctx->Extensions.MESA_ycbcr_texture = true;
ctx->Extensions.NV_blend_square = true;
-#if FEATURE_OES_EGL_image
ctx->Extensions.OES_EGL_image = true;
-#endif
-
ctx->Extensions.EXT_framebuffer_object = true;
+ ctx->Extensions.ARB_texture_cube_map = true;
- ctx->Extensions.ARB_texture_cube_map =
- rmesa->radeon.radeonScreen->drmSupportsCubeMapsR100;
-
- if (rmesa->radeon.glCtx->Mesa_DXTn) {
+ if (rmesa->radeon.glCtx.Mesa_DXTn) {
ctx->Extensions.EXT_texture_compression_s3tc = true;
- ctx->Extensions.S3_s3tc = true;
+ ctx->Extensions.ANGLE_texture_compression_dxt = true;
}
else if (driQueryOptionb (&rmesa->radeon.optionCache, "force_s3tc_enable")) {
ctx->Extensions.EXT_texture_compression_s3tc = true;
+ ctx->Extensions.ANGLE_texture_compression_dxt = true;
}
ctx->Extensions.NV_texture_rectangle = true;
rmesa->radeon.radeonScreen->chip_flags &= ~RADEON_CHIPSET_TCL;
fprintf(stderr, "Disabling HW TCL support\n");
}
- TCL_FALLBACK(rmesa->radeon.glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
+ TCL_FALLBACK(&rmesa->radeon.glCtx, RADEON_TCL_FALLBACK_TCL_DISABLE, 1);
}
if (rmesa->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL) {
/* _tnl_need_dlist_norm_lengths( ctx, GL_FALSE ); */
}
+
+ _mesa_compute_version(ctx);
+
+ /* Exec table initialization requires the version to be computed */
+ _mesa_initialize_dispatch_tables(ctx);
+ _mesa_initialize_vbo_vtxfmt(ctx);
+
+ *error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
}