2 * Copyright (C) 2009 Francisco Jerez.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include "nouveau_driver.h"
28 #include "nouveau_context.h"
29 #include "nouveau_fbo.h"
30 #include "nouveau_util.h"
31 #include "nouveau_class.h"
32 #include "nv10_driver.h"
35 nv10_clear(GLcontext
*ctx
, GLbitfield buffers
)
37 struct nouveau_channel
*chan
= context_chan(ctx
);
38 struct nouveau_grobj
*celsius
= context_eng3d(ctx
);
39 struct nouveau_framebuffer
*nfb
= to_nouveau_framebuffer(
42 nouveau_validate_framebuffer(ctx
);
44 /* Clear the LMA depth buffer, if present. */
45 if ((buffers
& BUFFER_BIT_DEPTH
) && ctx
->Depth
.Mask
&&
47 struct nouveau_surface
*s
= &to_nouveau_renderbuffer(
48 nfb
->base
._DepthBuffer
->Wrapped
)->surface
;
50 BEGIN_RING(chan
, celsius
, NV17TCL_LMA_DEPTH_FILL_VALUE
, 1);
51 OUT_RING(chan
, pack_zs_f(s
->format
, ctx
->Depth
.Clear
, 0));
52 BEGIN_RING(chan
, celsius
, NV17TCL_LMA_DEPTH_BUFFER_CLEAR
, 1);
56 nouveau_clear(ctx
, buffers
);
60 nv10_context_create(struct nouveau_screen
*screen
, const GLvisual
*visual
,
63 struct nouveau_context
*nctx
;
66 nctx
= CALLOC_STRUCT(nouveau_context
);
71 nouveau_context_init(ctx
, screen
, visual
, share_ctx
);
73 ctx
->Const
.MaxTextureLevels
= 12;
74 ctx
->Const
.MaxTextureCoordUnits
= NV10_TEXTURE_UNITS
;
75 ctx
->Const
.MaxTextureImageUnits
= NV10_TEXTURE_UNITS
;
76 ctx
->Const
.MaxTextureUnits
= NV10_TEXTURE_UNITS
;
77 ctx
->Const
.MaxTextureMaxAnisotropy
= 2;
78 ctx
->Const
.MaxTextureLodBias
= 15;
79 ctx
->Driver
.Clear
= nv10_clear
;
81 nv10_render_init(ctx
);
87 nv10_context_destroy(GLcontext
*ctx
)
89 nv10_render_destroy(ctx
);