#include "nouveau_fbo.h"
#include "nv_object.xml.h"
+#include "main/api_exec.h"
#include "main/dd.h"
#include "main/framebuffer.h"
#include "main/fbobject.h"
#include "main/light.h"
#include "main/state.h"
#include "main/version.h"
+#include "main/vtxfmt.h"
#include "drivers/common/meta.h"
#include "drivers/common/driverfuncs.h"
#include "swrast/swrast.h"
struct nouveau_context *nctx;
struct gl_context *ctx;
+ switch (api) {
+ case API_OPENGL_COMPAT:
+ /* Do after-the-fact version checking (below).
+ */
+ break;
+ case API_OPENGLES:
+ /* NV10 and NV20 can support OpenGL ES 1.0 only. Older chips
+ * cannot do even that.
+ */
+ if ((screen->device->chipset & 0xf0) == 0x00) {
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ } else if (minor_version != 0) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES2:
+ case API_OPENGL_CORE:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
+ }
+
/* API and flag filtering is handled in dri2CreateContextAttribs.
*/
- (void) api;
(void) flags;
ctx = screen->driver->context_create(screen, visual, share_ctx);
dri_ctx->driverPrivate = ctx;
_mesa_compute_version(ctx);
- if (ctx->VersionMajor < major_version
- || (ctx->VersionMajor == major_version
- && ctx->VersionMinor < minor_version)) {
+ if (ctx->Version < major_version * 10 + minor_version) {
nouveau_context_destroy(dri_ctx);
*error = __DRI_CTX_ERROR_BAD_VERSION;
return GL_FALSE;
}
+ /* Exec table initialization requires the version to be computed */
+ _mesa_initialize_dispatch_tables(ctx);
+ _mesa_initialize_vbo_vtxfmt(ctx);
+
+ if (nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, 4096,
+ NULL, &nctx->fence)) {
+ nouveau_context_destroy(dri_ctx);
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
+ return GL_FALSE;
+ }
+
*error = __DRI_CTX_ERROR_SUCCESS;
return GL_TRUE;
}
nouveau_fbo_functions_init(&functions);
/* Initialize the mesa context. */
- _mesa_initialize_context(ctx, API_OPENGL, visual,
- share_ctx, &functions, NULL);
+ _mesa_initialize_context(ctx, API_OPENGL_COMPAT, visual,
+ share_ctx, &functions);
nouveau_state_init(ctx);
nouveau_scratch_init(ctx);
ctx->Extensions.EXT_blend_minmax = true;
ctx->Extensions.EXT_fog_coord = true;
ctx->Extensions.EXT_framebuffer_blit = true;
- ctx->Extensions.EXT_framebuffer_object = true;
ctx->Extensions.EXT_packed_depth_stencil = true;
- ctx->Extensions.EXT_secondary_color = true;
ctx->Extensions.EXT_texture_filter_anisotropic = true;
ctx->Extensions.NV_blend_square = true;
ctx->Extensions.NV_texture_env_combine4 = true;
struct nouveau_context *nctx = dri_ctx->driverPrivate;
struct gl_context *ctx = &nctx->base;
+ nouveau_bo_ref(NULL, &nctx->fence);
context_drv(ctx)->context_destroy(ctx);
}