Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1901 | serge | 1 | |
2 | * Mesa 3-D graphics library |
||
3 | * Version: 4.1 |
||
4 | * |
||
5 | * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. |
||
6 | * |
||
7 | * Permission is hereby granted, free of charge, to any person obtaining a |
||
8 | * copy of this software and associated documentation files (the "Software"), |
||
9 | * to deal in the Software without restriction, including without limitation |
||
10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||
11 | * and/or sell copies of the Software, and to permit persons to whom the |
||
12 | * Software is furnished to do so, subject to the following conditions: |
||
13 | * |
||
14 | * The above copyright notice and this permission notice shall be included |
||
15 | * in all copies or substantial portions of the Software. |
||
16 | * |
||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
||
18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||
20 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
||
21 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
||
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
||
23 | */ |
||
24 | |||
25 | |||
26 | |||
27 | #include "enums.h" |
||
28 | #include "context.h" |
||
29 | #include "hint.h" |
||
30 | #include "imports.h" |
||
31 | |||
32 | |||
33 | |||
34 | |||
35 | _mesa_Hint( GLenum target, GLenum mode ) |
||
36 | { |
||
37 | GET_CURRENT_CONTEXT(ctx); |
||
38 | ASSERT_OUTSIDE_BEGIN_END(ctx); |
||
39 | |||
40 | |||
41 | _mesa_debug(ctx, "glHint %s %d\n", |
||
42 | _mesa_lookup_enum_by_nr(target), mode); |
||
43 | |||
44 | |||
45 | _mesa_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); |
||
46 | return; |
||
47 | } |
||
48 | |||
49 | |||
50 | case GL_FOG_HINT: |
||
51 | if (ctx->Hint.Fog == mode) |
||
52 | return; |
||
53 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
54 | ctx->Hint.Fog = mode; |
||
55 | break; |
||
56 | case GL_LINE_SMOOTH_HINT: |
||
57 | if (ctx->Hint.LineSmooth == mode) |
||
58 | return; |
||
59 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
60 | ctx->Hint.LineSmooth = mode; |
||
61 | break; |
||
62 | case GL_PERSPECTIVE_CORRECTION_HINT: |
||
63 | if (ctx->Hint.PerspectiveCorrection == mode) |
||
64 | return; |
||
65 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
66 | ctx->Hint.PerspectiveCorrection = mode; |
||
67 | break; |
||
68 | case GL_POINT_SMOOTH_HINT: |
||
69 | if (ctx->Hint.PointSmooth == mode) |
||
70 | return; |
||
71 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
72 | ctx->Hint.PointSmooth = mode; |
||
73 | break; |
||
74 | case GL_POLYGON_SMOOTH_HINT: |
||
75 | if (ctx->Hint.PolygonSmooth == mode) |
||
76 | return; |
||
77 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
78 | ctx->Hint.PolygonSmooth = mode; |
||
79 | break; |
||
80 | |||
81 | |||
82 | case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: |
||
83 | if (ctx->Hint.ClipVolumeClipping == mode) |
||
84 | return; |
||
85 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
86 | ctx->Hint.ClipVolumeClipping = mode; |
||
87 | break; |
||
88 | |||
89 | |||
90 | case GL_TEXTURE_COMPRESSION_HINT_ARB: |
||
91 | if (ctx->Hint.TextureCompression == mode) |
||
92 | return; |
||
93 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
94 | ctx->Hint.TextureCompression = mode; |
||
95 | break; |
||
96 | |||
97 | |||
98 | case GL_GENERATE_MIPMAP_HINT_SGIS: |
||
99 | if (ctx->Hint.GenerateMipmap == mode) |
||
100 | return; |
||
101 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
102 | ctx->Hint.GenerateMipmap = mode; |
||
103 | break; |
||
104 | |||
105 | |||
106 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: |
||
107 | if (!ctx->Extensions.ARB_fragment_shader) { |
||
108 | _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); |
||
109 | return; |
||
110 | } |
||
111 | if (ctx->Hint.FragmentShaderDerivative == mode) |
||
112 | return; |
||
113 | FLUSH_VERTICES(ctx, _NEW_HINT); |
||
114 | ctx->Hint.FragmentShaderDerivative = mode; |
||
115 | break; |
||
116 | |||
117 | |||
118 | _mesa_error(ctx, GL_INVALID_ENUM, "glHint(target)"); |
||
119 | return; |
||
120 | } |
||
121 | |||
122 | |||
123 | (*ctx->Driver.Hint)( ctx, target, mode ); |
||
124 | } |
||
125 | } |
||
126 | |||
127 | |||
128 | |||
129 | /***** Initialization *****/ |
||
130 | /**********************************************************************/ |
||
131 | |||
132 | |||
133 | { |
||
134 | /* Hint group */ |
||
135 | ctx->Hint.PerspectiveCorrection = GL_DONT_CARE; |
||
136 | ctx->Hint.PointSmooth = GL_DONT_CARE; |
||
137 | ctx->Hint.LineSmooth = GL_DONT_CARE; |
||
138 | ctx->Hint.PolygonSmooth = GL_DONT_CARE; |
||
139 | ctx->Hint.Fog = GL_DONT_CARE; |
||
140 | ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; |
||
141 | ctx->Hint.TextureCompression = GL_DONT_CARE; |
||
142 | ctx->Hint.GenerateMipmap = GL_DONT_CARE; |
||
143 | ctx->Hint.FragmentShaderDerivative = GL_DONT_CARE; |
||
144 | } |
||
145 |