33
34
#include "main/framebuffer.h"
34
35
#include "main/light.h"
35
36
#include "main/state.h"
37
#include "main/version.h"
36
38
#include "drivers/common/meta.h"
37
39
#include "drivers/common/driverfuncs.h"
38
40
#include "swrast/swrast.h"
41
43
#include "tnl/tnl.h"
42
44
#include "tnl/t_context.h"
44
#define need_GL_EXT_framebuffer_object
45
#define need_GL_EXT_fog_coord
46
#define need_GL_EXT_secondary_color
48
#include "main/remap_helper.h"
50
static const struct dri_extension nouveau_extensions[] = {
51
{ "GL_ARB_multitexture", NULL },
52
{ "GL_ARB_texture_env_add", NULL },
53
{ "GL_ARB_texture_mirrored_repeat", NULL },
54
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
55
{ "GL_EXT_framebuffer_blit", NULL },
56
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
57
{ "GL_EXT_packed_depth_stencil", NULL},
58
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
59
{ "GL_EXT_stencil_wrap", NULL },
60
{ "GL_EXT_texture_env_combine", NULL },
61
{ "GL_EXT_texture_filter_anisotropic", NULL },
62
{ "GL_EXT_texture_lod_bias", NULL },
63
{ "GL_NV_blend_square", NULL },
64
{ "GL_NV_texture_env_combine4", NULL },
69
47
nouveau_channel_flush_notify(struct nouveau_channel *chan)
79
57
nouveau_context_create(gl_api api,
80
58
const struct gl_config *visual, __DRIcontext *dri_ctx,
59
unsigned major_version,
60
unsigned minor_version,
83
65
__DRIscreen *dri_screen = dri_ctx->driScreenPriv;
84
struct nouveau_screen *screen = dri_screen->private;
66
struct nouveau_screen *screen = dri_screen->driverPrivate;
85
67
struct nouveau_context *nctx;
86
68
struct gl_context *ctx;
70
/* API and flag filtering is handled in dri2CreateContextAttribs.
88
75
ctx = screen->driver->context_create(screen, visual, share_ctx);
77
*error = __DRI_CTX_ERROR_NO_MEMORY;
92
81
nctx = to_nouveau_context(ctx);
93
82
nctx->dri_context = dri_ctx;
94
83
dri_ctx->driverPrivate = ctx;
85
_mesa_compute_version(ctx);
86
if (ctx->VersionMajor < major_version
87
|| (ctx->VersionMajor == major_version
88
&& ctx->VersionMinor < minor_version)) {
89
nouveau_context_destroy(dri_ctx);
90
*error = __DRI_CTX_ERROR_BAD_VERSION;
94
*error = __DRI_CTX_ERROR_SUCCESS;
140
139
nctx->hw.chan->user_private = nctx;
142
141
/* Enable any supported extensions. */
143
driInitExtensions(ctx, nouveau_extensions, GL_TRUE);
142
ctx->Extensions.EXT_blend_color = true;
143
ctx->Extensions.EXT_blend_minmax = true;
144
ctx->Extensions.EXT_fog_coord = true;
145
ctx->Extensions.EXT_framebuffer_blit = true;
146
ctx->Extensions.EXT_framebuffer_object = true;
147
ctx->Extensions.EXT_packed_depth_stencil = true;
148
ctx->Extensions.EXT_secondary_color = true;
149
ctx->Extensions.EXT_texture_filter_anisotropic = true;
150
ctx->Extensions.NV_blend_square = true;
151
ctx->Extensions.NV_texture_env_combine4 = true;
191
199
__DRIbuffer *buffers = NULL;
192
200
int i = 0, count, ret;
194
if (draw->lastStamp == *draw->pStamp)
202
if (draw->lastStamp == draw->dri2.stamp)
196
draw->lastStamp = *draw->pStamp;
204
draw->lastStamp = draw->dri2.stamp;
198
206
if (nfb->need_front)
199
207
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
271
279
struct gl_context *ctx = dri_ctx->driverPrivate;
272
280
struct gl_framebuffer *fb = draw->driverPrivate;
274
*stamp = *draw->pStamp;
282
*stamp = draw->dri2.stamp;
276
284
nouveau_update_renderbuffers(dri_ctx, draw);
277
285
_mesa_resize_framebuffer(ctx, fb, draw->w, draw->h);
351
359
dri2InvalidateDrawable(draw);
354
if (*draw->pStamp != *stamp)
362
if (draw->dri2.stamp != *stamp)
355
363
update_framebuffer(dri_ctx, draw, stamp);