mesa: Add "shader/" path to #include statements in shader parser/lexer sources
[mesa.git] / src / mesa / drivers / dri / ffb / ffb_dd.c
1 /*
2 *
3 * GLX Hardware Device Driver for Sun Creator/Creator3D
4 * Copyright (C) 2000, 2001 David S. Miller
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 *
25 * David S. Miller <davem@redhat.com>
26 */
27
28 #include "main/mtypes.h"
29 #include "main/mm.h"
30 #include "main/extensions.h"
31 #include "ffb_dd.h"
32 #include "ffb_span.h"
33 #include "ffb_depth.h"
34 #include "ffb_context.h"
35 #include "ffb_vb.h"
36 #include "ffb_tris.h"
37 #include "ffb_clear.h"
38 #include "ffb_lock.h"
39
40 #define FFB_DATE "20021125"
41
42 PUBLIC const char __driConfigOptions[] = { 0 };
43 const GLuint __driNConfigOptions = 0;
44
45 /* Mesa's Driver Functions */
46
47 static const GLubyte *ffbDDGetString(GLcontext *ctx, GLenum name)
48 {
49 ffbContextPtr fmesa = FFB_CONTEXT(ctx);
50 static char buffer[128];
51
52 switch (name) {
53 case GL_VENDOR:
54 return (GLubyte *) "David S. Miller";
55
56 case GL_RENDERER:
57 sprintf(buffer, "Mesa DRI FFB " FFB_DATE);
58
59 if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2)
60 strncat(buffer, " FFB2", 5);
61 if (fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS)
62 strncat(buffer, " FFB2PLUS", 9);
63 if (fmesa->ffb_sarea->flags & FFB_DRI_PAC1)
64 strncat(buffer, " PAC1", 5);
65 if (fmesa->ffb_sarea->flags & FFB_DRI_PAC2)
66 strncat(buffer, " PAC2", 5);
67
68 #ifdef USE_SPARC_ASM
69 strncat(buffer, " Sparc", 6);
70 #endif
71
72 return (GLubyte *) buffer;
73
74 default:
75 return NULL;
76 };
77 }
78
79
80 static void ffbBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
81 {
82 GET_CURRENT_CONTEXT(ctx);
83 ffbContextPtr fmesa = FFB_CONTEXT(ctx);
84
85 LOCK_HARDWARE(fmesa);
86 *width = fmesa->driDrawable->w;
87 *height = fmesa->driDrawable->h;
88 UNLOCK_HARDWARE(fmesa);
89 }
90
91 void ffbDDExtensionsInit(GLcontext *ctx)
92 {
93 /* Nothing for now until we start to add
94 * real acceleration. -DaveM
95 */
96
97 /* XXX Need to turn off GL_EXT_blend_func_separate for one.
98 * XXX Also BlendEquation should be turned off too, what
99 * XXX EXT is that assosciated with?
100 */
101 }
102
103 static void ffbDDFinish(GLcontext *ctx)
104 {
105 ffbContextPtr fmesa = FFB_CONTEXT(ctx);
106
107 LOCK_HARDWARE(fmesa);
108 FFBWait(fmesa, fmesa->regs);
109 UNLOCK_HARDWARE(fmesa);
110 }
111
112 void ffbDDInitDriverFuncs(GLcontext *ctx)
113 {
114 ctx->Driver.GetBufferSize = ffbBufferSize;
115 ctx->Driver.GetString = ffbDDGetString;
116 ctx->Driver.Clear = ffbDDClear;
117
118 ctx->Driver.Finish = ffbDDFinish;
119 }