diff options
Diffstat (limited to 'meta/recipes-graphics')
-rw-r--r-- | meta/recipes-graphics/mesa/mesa-demos/0001-mesa-demos-Add-missing-data-files.patch | 623 | ||||
-rw-r--r-- | meta/recipes-graphics/mesa/mesa-demos_8.1.0.bb | 3 |
2 files changed, 625 insertions, 1 deletions
diff --git a/meta/recipes-graphics/mesa/mesa-demos/0001-mesa-demos-Add-missing-data-files.patch b/meta/recipes-graphics/mesa/mesa-demos/0001-mesa-demos-Add-missing-data-files.patch new file mode 100644 index 0000000000..c7851035a8 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-demos/0001-mesa-demos-Add-missing-data-files.patch | |||
@@ -0,0 +1,623 @@ | |||
1 | From 87f9a62329d7c5f4d351fbb63a41f2a1935fb2f1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Drew Moseley <drew_moseley@mentor.com> | ||
3 | Date: Mon, 12 May 2014 15:22:32 -0400 | ||
4 | Subject: [PATCH] mesa-demos: Add missing data files. | ||
5 | |||
6 | Add some data files that are present in the git repository: | ||
7 | http://cgit.freedesktop.org/mesa/demos/tree/?id=mesa-demos-8.1.0 | ||
8 | but not in the release tarball | ||
9 | ftp://ftp.freedesktop.org/pub/mesa/demos/8.1.0/mesa-demos-8.1.0.tar.bz2 | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | Signed-off-by: Drew Moseley <drew_moseley@mentor.com> | ||
13 | --- | ||
14 | src/fpglsl/depth-read.glsl | 4 + | ||
15 | src/fpglsl/infinite-loop.glsl | 7 + | ||
16 | src/glsl/CH11-bumpmaptex.frag | 47 +++++++ | ||
17 | src/glsl/blinking-teapot.frag | 31 +++++ | ||
18 | src/glsl/blinking-teapot.vert | 16 +++ | ||
19 | src/glsl/convolution.frag | 21 +++ | ||
20 | src/glsl/simplex-noise.glsl | 279 +++++++++++++++++++++++++++++++++++++++ | ||
21 | src/glsl/skinning.vert | 24 ++++ | ||
22 | src/perf/glslstateschange1.frag | 19 +++ | ||
23 | src/perf/glslstateschange1.vert | 14 ++ | ||
24 | src/perf/glslstateschange2.frag | 17 +++ | ||
25 | src/perf/glslstateschange2.vert | 14 ++ | ||
26 | src/vpglsl/infinite-loop.glsl | 8 ++ | ||
27 | 13 files changed, 501 insertions(+) | ||
28 | create mode 100644 src/fpglsl/depth-read.glsl | ||
29 | create mode 100644 src/fpglsl/infinite-loop.glsl | ||
30 | create mode 100644 src/glsl/CH11-bumpmaptex.frag | ||
31 | create mode 100644 src/glsl/blinking-teapot.frag | ||
32 | create mode 100644 src/glsl/blinking-teapot.vert | ||
33 | create mode 100644 src/glsl/convolution.frag | ||
34 | create mode 100644 src/glsl/simplex-noise.glsl | ||
35 | create mode 100644 src/glsl/skinning.vert | ||
36 | create mode 100644 src/perf/glslstateschange1.frag | ||
37 | create mode 100644 src/perf/glslstateschange1.vert | ||
38 | create mode 100644 src/perf/glslstateschange2.frag | ||
39 | create mode 100644 src/perf/glslstateschange2.vert | ||
40 | create mode 100644 src/vpglsl/infinite-loop.glsl | ||
41 | |||
42 | diff --git a/src/fpglsl/depth-read.glsl b/src/fpglsl/depth-read.glsl | ||
43 | new file mode 100644 | ||
44 | index 0000000..86d298e | ||
45 | --- /dev/null | ||
46 | +++ b/src/fpglsl/depth-read.glsl | ||
47 | @@ -0,0 +1,4 @@ | ||
48 | +void main() | ||
49 | +{ | ||
50 | + gl_FragColor = gl_FragCoord.zzzz; | ||
51 | +} | ||
52 | diff --git a/src/fpglsl/infinite-loop.glsl b/src/fpglsl/infinite-loop.glsl | ||
53 | new file mode 100644 | ||
54 | index 0000000..c6dc6ee | ||
55 | --- /dev/null | ||
56 | +++ b/src/fpglsl/infinite-loop.glsl | ||
57 | @@ -0,0 +1,7 @@ | ||
58 | +void main() { | ||
59 | + vec4 sum = vec4(0); | ||
60 | + for (int i = 1; i != 2; i += 2) { | ||
61 | + sum += vec4(0.1, 0.1, 0.1, 0.1); | ||
62 | + } | ||
63 | + gl_FragColor = sum; | ||
64 | +} | ||
65 | diff --git a/src/glsl/CH11-bumpmaptex.frag b/src/glsl/CH11-bumpmaptex.frag | ||
66 | new file mode 100644 | ||
67 | index 0000000..b5dabb4 | ||
68 | --- /dev/null | ||
69 | +++ b/src/glsl/CH11-bumpmaptex.frag | ||
70 | @@ -0,0 +1,47 @@ | ||
71 | +// | ||
72 | +// Fragment shader for procedural bumps | ||
73 | +// | ||
74 | +// Authors: John Kessenich, Randi Rost | ||
75 | +// | ||
76 | +// Copyright (c) 2002-2006 3Dlabs Inc. Ltd. | ||
77 | +// | ||
78 | +// See 3Dlabs-License.txt for license information | ||
79 | +// | ||
80 | +// Texture mapping/modulation added by Brian Paul | ||
81 | +// | ||
82 | + | ||
83 | +varying vec3 LightDir; | ||
84 | +varying vec3 EyeDir; | ||
85 | + | ||
86 | +uniform float BumpDensity; // = 16.0 | ||
87 | +uniform float BumpSize; // = 0.15 | ||
88 | +uniform float SpecularFactor; // = 0.5 | ||
89 | + | ||
90 | +uniform sampler2D Tex; | ||
91 | + | ||
92 | +void main() | ||
93 | +{ | ||
94 | + vec3 ambient = vec3(0.25); | ||
95 | + vec3 litColor; | ||
96 | + vec2 c = BumpDensity * gl_TexCoord[0].st; | ||
97 | + vec2 p = fract(c) - vec2(0.5); | ||
98 | + | ||
99 | + float d, f; | ||
100 | + d = p.x * p.x + p.y * p.y; | ||
101 | + f = inversesqrt(d + 1.0); | ||
102 | + | ||
103 | + if (d >= BumpSize) | ||
104 | + { p = vec2(0.0); f = 1.0; } | ||
105 | + | ||
106 | + vec3 SurfaceColor = texture2D(Tex, gl_TexCoord[0].st).xyz; | ||
107 | + | ||
108 | + vec3 normDelta = vec3(p.x, p.y, 1.0) * f; | ||
109 | + litColor = SurfaceColor * (ambient + max(dot(normDelta, LightDir), 0.0)); | ||
110 | + vec3 reflectDir = reflect(LightDir, normDelta); | ||
111 | + | ||
112 | + float spec = max(dot(EyeDir, reflectDir), 0.0); | ||
113 | + spec *= SpecularFactor; | ||
114 | + litColor = min(litColor + spec, vec3(1.0)); | ||
115 | + | ||
116 | + gl_FragColor = vec4(litColor, 1.0); | ||
117 | +} | ||
118 | diff --git a/src/glsl/blinking-teapot.frag b/src/glsl/blinking-teapot.frag | ||
119 | new file mode 100644 | ||
120 | index 0000000..0db060b | ||
121 | --- /dev/null | ||
122 | +++ b/src/glsl/blinking-teapot.frag | ||
123 | @@ -0,0 +1,31 @@ | ||
124 | +#extension GL_ARB_uniform_buffer_object : enable | ||
125 | + | ||
126 | +layout(std140) uniform colors0 | ||
127 | +{ | ||
128 | + float DiffuseCool; | ||
129 | + float DiffuseWarm; | ||
130 | + vec3 SurfaceColor; | ||
131 | + vec3 WarmColor; | ||
132 | + vec3 CoolColor; | ||
133 | + vec4 some[8]; | ||
134 | +}; | ||
135 | + | ||
136 | +varying float NdotL; | ||
137 | +varying vec3 ReflectVec; | ||
138 | +varying vec3 ViewVec; | ||
139 | + | ||
140 | +void main (void) | ||
141 | +{ | ||
142 | + | ||
143 | + vec3 kcool = min(CoolColor + DiffuseCool * SurfaceColor, 1.0); | ||
144 | + vec3 kwarm = min(WarmColor + DiffuseWarm * SurfaceColor, 1.0); | ||
145 | + vec3 kfinal = mix(kcool, kwarm, NdotL); | ||
146 | + | ||
147 | + vec3 nreflect = normalize(ReflectVec); | ||
148 | + vec3 nview = normalize(ViewVec); | ||
149 | + | ||
150 | + float spec = max(dot(nreflect, nview), 0.0); | ||
151 | + spec = pow(spec, 32.0); | ||
152 | + | ||
153 | + gl_FragColor = vec4 (min(kfinal + spec, 1.0), 1.0); | ||
154 | +} | ||
155 | diff --git a/src/glsl/blinking-teapot.vert b/src/glsl/blinking-teapot.vert | ||
156 | new file mode 100644 | ||
157 | index 0000000..397d733 | ||
158 | --- /dev/null | ||
159 | +++ b/src/glsl/blinking-teapot.vert | ||
160 | @@ -0,0 +1,16 @@ | ||
161 | +vec3 LightPosition = vec3(0.0, 10.0, 4.0); | ||
162 | + | ||
163 | +varying float NdotL; | ||
164 | +varying vec3 ReflectVec; | ||
165 | +varying vec3 ViewVec; | ||
166 | + | ||
167 | +void main(void) | ||
168 | +{ | ||
169 | + vec3 ecPos = vec3 (gl_ModelViewMatrix * gl_Vertex); | ||
170 | + vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal); | ||
171 | + vec3 lightVec = normalize(LightPosition - ecPos); | ||
172 | + ReflectVec = normalize(reflect(-lightVec, tnorm)); | ||
173 | + ViewVec = normalize(-ecPos); | ||
174 | + NdotL = (dot(lightVec, tnorm) + 1.0) * 0.5; | ||
175 | + gl_Position = ftransform(); | ||
176 | +} | ||
177 | diff --git a/src/glsl/convolution.frag b/src/glsl/convolution.frag | ||
178 | new file mode 100644 | ||
179 | index 0000000..e49b8ac | ||
180 | --- /dev/null | ||
181 | +++ b/src/glsl/convolution.frag | ||
182 | @@ -0,0 +1,21 @@ | ||
183 | + | ||
184 | +const int KernelSize = 9; | ||
185 | + | ||
186 | +//texture offsets | ||
187 | +uniform vec2 Offset[KernelSize]; | ||
188 | +//convolution kernel | ||
189 | +uniform vec4 KernelValue[KernelSize]; | ||
190 | +uniform sampler2D srcTex; | ||
191 | +uniform vec4 ScaleFactor; | ||
192 | +uniform vec4 BaseColor; | ||
193 | + | ||
194 | +void main(void) | ||
195 | +{ | ||
196 | + int i; | ||
197 | + vec4 sum = vec4(0.0); | ||
198 | + for (i = 0; i < KernelSize; ++i) { | ||
199 | + vec4 tmp = texture2D(srcTex, gl_TexCoord[0].st + Offset[i]); | ||
200 | + sum += tmp * KernelValue[i]; | ||
201 | + } | ||
202 | + gl_FragColor = sum * ScaleFactor + BaseColor; | ||
203 | +} | ||
204 | diff --git a/src/glsl/simplex-noise.glsl b/src/glsl/simplex-noise.glsl | ||
205 | new file mode 100644 | ||
206 | index 0000000..b6833cb | ||
207 | --- /dev/null | ||
208 | +++ b/src/glsl/simplex-noise.glsl | ||
209 | @@ -0,0 +1,279 @@ | ||
210 | +// | ||
211 | +// Description : Array and textureless GLSL 2D/3D/4D simplex | ||
212 | +// noise functions. | ||
213 | +// Author : Ian McEwan, Ashima Arts. | ||
214 | +// Maintainer : ijm | ||
215 | +// Lastmod : 20110223 | ||
216 | +// License : Copyright (C) 2011 Ashima Arts. All rights reserved. | ||
217 | +// Distributed under the Artistic License 2.0; See LICENCE file. | ||
218 | +// | ||
219 | + | ||
220 | +#define NORMALIZE_GRADIENTS | ||
221 | +#undef USE_CIRCLE | ||
222 | +#define COLLAPSE_SORTNET | ||
223 | + | ||
224 | +float permute(float x0,vec3 p) { | ||
225 | + float x1 = mod(x0 * p.y, p.x); | ||
226 | + return floor( mod( (x1 + p.z) *x0, p.x )); | ||
227 | + } | ||
228 | +vec2 permute(vec2 x0,vec3 p) { | ||
229 | + vec2 x1 = mod(x0 * p.y, p.x); | ||
230 | + return floor( mod( (x1 + p.z) *x0, p.x )); | ||
231 | + } | ||
232 | +vec3 permute(vec3 x0,vec3 p) { | ||
233 | + vec3 x1 = mod(x0 * p.y, p.x); | ||
234 | + return floor( mod( (x1 + p.z) *x0, p.x )); | ||
235 | + } | ||
236 | +vec4 permute(vec4 x0,vec3 p) { | ||
237 | + vec4 x1 = mod(x0 * p.y, p.x); | ||
238 | + return floor( mod( (x1 + p.z) *x0, p.x )); | ||
239 | + } | ||
240 | + | ||
241 | +uniform vec4 pParam; | ||
242 | +// Example | ||
243 | +// const vec4 pParam = vec4( 17.* 17., 34., 1., 7.); | ||
244 | + | ||
245 | +float taylorInvSqrt(float r) | ||
246 | + { | ||
247 | + return ( 0.83666002653408 + 0.7*0.85373472095314 - 0.85373472095314 * r ); | ||
248 | + } | ||
249 | + | ||
250 | +float simplexNoise2(vec2 v) | ||
251 | + { | ||
252 | + const vec2 C = vec2(0.211324865405187134, // (3.0-sqrt(3.0))/6.; | ||
253 | + 0.366025403784438597); // 0.5*(sqrt(3.0)-1.); | ||
254 | + const vec3 D = vec3( 0., 0.5, 2.0) * 3.14159265358979312; | ||
255 | +// First corner | ||
256 | + vec2 i = floor(v + dot(v, C.yy) ); | ||
257 | + vec2 x0 = v - i + dot(i, C.xx); | ||
258 | + | ||
259 | +// Other corners | ||
260 | + vec2 i1 = (x0.x > x0.y) ? vec2(1.,0.) : vec2(0.,1.) ; | ||
261 | + | ||
262 | + // x0 = x0 - 0. + 0. * C | ||
263 | + vec2 x1 = x0 - i1 + 1. * C.xx ; | ||
264 | + vec2 x2 = x0 - 1. + 2. * C.xx ; | ||
265 | + | ||
266 | +// Permutations | ||
267 | + i = mod(i, pParam.x); | ||
268 | + vec3 p = permute( permute( | ||
269 | + i.y + vec3(0., i1.y, 1. ), pParam.xyz) | ||
270 | + + i.x + vec3(0., i1.x, 1. ), pParam.xyz); | ||
271 | + | ||
272 | +#ifndef USE_CIRCLE | ||
273 | +// ( N points uniformly over a line, mapped onto a diamond.) | ||
274 | + vec3 x = fract(p / pParam.w) ; | ||
275 | + vec3 h = 0.5 - abs(x) ; | ||
276 | + | ||
277 | + vec3 sx = vec3(lessThan(x,D.xxx)) *2. -1.; | ||
278 | + vec3 sh = vec3(lessThan(h,D.xxx)); | ||
279 | + | ||
280 | + vec3 a0 = x + sx*sh; | ||
281 | + vec2 p0 = vec2(a0.x,h.x); | ||
282 | + vec2 p1 = vec2(a0.y,h.y); | ||
283 | + vec2 p2 = vec2(a0.z,h.z); | ||
284 | + | ||
285 | +#ifdef NORMALISE_GRADIENTS | ||
286 | + p0 *= taylorInvSqrt(dot(p0,p0)); | ||
287 | + p1 *= taylorInvSqrt(dot(p1,p1)); | ||
288 | + p2 *= taylorInvSqrt(dot(p2,p2)); | ||
289 | +#endif | ||
290 | + | ||
291 | + vec3 g = 2.0 * vec3( dot(p0, x0), dot(p1, x1), dot(p2, x2) ); | ||
292 | +#else | ||
293 | +// N points around a unit circle. | ||
294 | + vec3 phi = D.z * mod(p,pParam.w) /pParam.w ; | ||
295 | + vec4 a0 = sin(phi.xxyy+D.xyxy); | ||
296 | + vec2 a1 = sin(phi.zz +D.xy); | ||
297 | + vec3 g = vec3( dot(a0.xy, x0), dot(a0.zw, x1), dot(a1.xy, x2) ); | ||
298 | +#endif | ||
299 | +// mix | ||
300 | + vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.); | ||
301 | + m = m*m ; | ||
302 | + return 1.66666* 70.*dot(m*m, g); | ||
303 | + } | ||
304 | + | ||
305 | +float simplexNoise3(vec3 v) | ||
306 | + { | ||
307 | + const vec2 C = vec2(1./6. , 1./3. ) ; | ||
308 | + const vec4 D = vec4(0., 0.5, 1.0, 2.0); | ||
309 | + | ||
310 | +// First corner | ||
311 | + vec3 i = floor(v + dot(v, C.yyy) ); | ||
312 | + vec3 x0 = v - i + dot(i, C.xxx) ; | ||
313 | + | ||
314 | +// Other corners | ||
315 | +#ifdef COLLAPSE_SORTNET | ||
316 | + vec3 g = vec3( greaterThan( x0.xyz, x0.yzx) ); | ||
317 | + vec3 l = vec3( lessThanEqual( x0.xyz, x0.yzx) ); | ||
318 | + | ||
319 | + vec3 i1 = g.xyz * l.zxy; | ||
320 | + vec3 i2 = max( g.xyz, l.zxy); | ||
321 | +#else | ||
322 | +// Keeping this clean - let the compiler optimize. | ||
323 | + vec3 q1; | ||
324 | + q1.x = max(x0.x, x0.y); | ||
325 | + q1.y = min(x0.x, x0.y); | ||
326 | + q1.z = x0.z; | ||
327 | + | ||
328 | + vec3 q2; | ||
329 | + q2.x = max(q1.x,q1.z); | ||
330 | + q2.z = min(q1.x,q1.z); | ||
331 | + q2.y = q1.y; | ||
332 | + | ||
333 | + vec3 q3; | ||
334 | + q3.y = max(q2.y, q2.z); | ||
335 | + q3.z = min(q2.y, q2.z); | ||
336 | + q3.x = q2.x; | ||
337 | + | ||
338 | + vec3 i1 = vec3(equal(q3.xxx, x0)); | ||
339 | + vec3 i2 = i1 + vec3(equal(q3.yyy, x0)); | ||
340 | +#endif | ||
341 | + | ||
342 | + // x0 = x0 - 0. + 0. * C | ||
343 | + vec3 x1 = x0 - i1 + 1. * C.xxx; | ||
344 | + vec3 x2 = x0 - i2 + 2. * C.xxx; | ||
345 | + vec3 x3 = x0 - 1. + 3. * C.xxx; | ||
346 | + | ||
347 | +// Permutations | ||
348 | + i = mod(i, pParam.x ); | ||
349 | + vec4 p = permute( permute( permute( | ||
350 | + i.z + vec4(0., i1.z, i2.z, 1. ), pParam.xyz) | ||
351 | + + i.y + vec4(0., i1.y, i2.y, 1. ), pParam.xyz) | ||
352 | + + i.x + vec4(0., i1.x, i2.x, 1. ), pParam.xyz); | ||
353 | + | ||
354 | +// Gradients | ||
355 | +// ( N*N points uniformly over a square, mapped onto a octohedron.) | ||
356 | + float n_ = 1.0/pParam.w ; | ||
357 | + vec3 ns = n_ * D.wyz - D.xzx ; | ||
358 | + | ||
359 | + vec4 j = p - pParam.w*pParam.w*floor(p * ns.z *ns.z); // mod(p,N*N) | ||
360 | + | ||
361 | + vec4 x_ = floor(j * ns.z) ; | ||
362 | + vec4 y_ = floor(j - pParam.w * x_ ) ; // mod(j,N) | ||
363 | + | ||
364 | + vec4 x = x_ *ns.x + ns.yyyy; | ||
365 | + vec4 y = y_ *ns.x + ns.yyyy; | ||
366 | + vec4 h = 1. - abs(x) - abs(y); | ||
367 | + | ||
368 | + vec4 b0 = vec4( x.xy, y.xy ); | ||
369 | + vec4 b1 = vec4( x.zw, y.zw ); | ||
370 | + | ||
371 | + vec4 s0 = vec4(lessThan(b0,D.xxxx)) *2. -1.; | ||
372 | + vec4 s1 = vec4(lessThan(b1,D.xxxx)) *2. -1.; | ||
373 | + vec4 sh = vec4(lessThan(h, D.xxxx)); | ||
374 | + | ||
375 | + vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; | ||
376 | + vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; | ||
377 | + | ||
378 | + vec3 p0 = vec3(a0.xy,h.x); | ||
379 | + vec3 p1 = vec3(a0.zw,h.y); | ||
380 | + vec3 p2 = vec3(a1.xy,h.z); | ||
381 | + vec3 p3 = vec3(a1.zw,h.w); | ||
382 | + | ||
383 | +#ifdef NORMALISE_GRADIENTS | ||
384 | + p0 *= taylorInvSqrt(dot(p0,p0)); | ||
385 | + p1 *= taylorInvSqrt(dot(p1,p1)); | ||
386 | + p2 *= taylorInvSqrt(dot(p2,p2)); | ||
387 | + p3 *= taylorInvSqrt(dot(p3,p3)); | ||
388 | +#endif | ||
389 | + | ||
390 | +// Mix | ||
391 | + vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.); | ||
392 | + m = m * m; | ||
393 | +//used to be 64. | ||
394 | + return 48.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), | ||
395 | + dot(p2,x2), dot(p3,x3) ) ); | ||
396 | + } | ||
397 | + | ||
398 | +vec4 grad4(float j, vec4 ip) | ||
399 | + { | ||
400 | + const vec4 ones = vec4(1.,1.,1.,-1.); | ||
401 | + vec4 p,s; | ||
402 | + | ||
403 | + p.xyz = floor( fract (vec3(j) * ip.xyz) *pParam.w) * ip.z -1.0; | ||
404 | + p.w = 1.5 - dot(abs(p.xyz), ones.xyz); | ||
405 | + s = vec4(lessThan(p,vec4(0.))); | ||
406 | + p.xyz = p.xyz + (s.xyz*2.-1.) * s.www; | ||
407 | + | ||
408 | + return p; | ||
409 | + } | ||
410 | + | ||
411 | +float simplexNoise4(vec4 v) | ||
412 | + { | ||
413 | + const vec2 C = vec2( 0.138196601125010504, // (5 - sqrt(5))/20 G4 | ||
414 | + 0.309016994374947451); // (sqrt(5) - 1)/4 F4 | ||
415 | +// First corner | ||
416 | + vec4 i = floor(v + dot(v, C.yyyy) ); | ||
417 | + vec4 x0 = v - i + dot(i, C.xxxx); | ||
418 | + | ||
419 | +// Other corners | ||
420 | + | ||
421 | +// Force existance of strict total ordering in sort. | ||
422 | + vec4 q0 = floor(x0 * 1024.0) + vec4( 0., 1./4., 2./4. , 3./4.); | ||
423 | + vec4 q1; | ||
424 | + q1.xy = max(q0.xy,q0.zw); // x:z y:w | ||
425 | + q1.zw = min(q0.xy,q0.zw); | ||
426 | + | ||
427 | + vec4 q2; | ||
428 | + q2.xz = max(q1.xz,q1.yw); // x:y z:w | ||
429 | + q2.yw = min(q1.xz,q1.yw); | ||
430 | + | ||
431 | + vec4 q3; | ||
432 | + q3.y = max(q2.y,q2.z); // y:z | ||
433 | + q3.z = min(q2.y,q2.z); | ||
434 | + q3.xw = q2.xw; | ||
435 | + | ||
436 | + vec4 i1 = vec4(lessThanEqual(q3.xxxx, q0)); | ||
437 | + vec4 i2 = vec4(lessThanEqual(q3.yyyy, q0)); | ||
438 | + vec4 i3 = vec4(lessThanEqual(q3.zzzz, q0)); | ||
439 | + | ||
440 | + // x0 = x0 - 0. + 0. * C | ||
441 | + vec4 x1 = x0 - i1 + 1. * C.xxxx; | ||
442 | + vec4 x2 = x0 - i2 + 2. * C.xxxx; | ||
443 | + vec4 x3 = x0 - i3 + 3. * C.xxxx; | ||
444 | + vec4 x4 = x0 - 1. + 4. * C.xxxx; | ||
445 | + | ||
446 | +// Permutations | ||
447 | + i = mod(i, pParam.x ); | ||
448 | + float j0 = permute( permute( permute( permute ( | ||
449 | + i.w, pParam.xyz) + i.z, pParam.xyz) | ||
450 | + + i.y, pParam.xyz) + i.x, pParam.xyz); | ||
451 | + vec4 j1 = permute( permute( permute( permute ( | ||
452 | + i.w + vec4(i1.w, i2.w, i3.w, 1. ), pParam.xyz) | ||
453 | + + i.z + vec4(i1.z, i2.z, i3.z, 1. ), pParam.xyz) | ||
454 | + + i.y + vec4(i1.y, i2.y, i3.y, 1. ), pParam.xyz) | ||
455 | + + i.x + vec4(i1.x, i2.x, i3.x, 1. ), pParam.xyz); | ||
456 | +// Gradients | ||
457 | +// ( N*N*N points uniformly over a cube, mapped onto a 4-octohedron.) | ||
458 | + vec4 ip = pParam ; | ||
459 | + ip.xy *= pParam.w ; | ||
460 | + ip.x *= pParam.w ; | ||
461 | + ip = vec4(1.,1.,1.,2.) / ip ; | ||
462 | + | ||
463 | + vec4 p0 = grad4(j0, ip); | ||
464 | + vec4 p1 = grad4(j1.x, ip); | ||
465 | + vec4 p2 = grad4(j1.y, ip); | ||
466 | + vec4 p3 = grad4(j1.z, ip); | ||
467 | + vec4 p4 = grad4(j1.w, ip); | ||
468 | + | ||
469 | +#ifdef NORMALISE_GRADIENTS | ||
470 | + p0 *= taylorInvSqrt(dot(p0,p0)); | ||
471 | + p1 *= taylorInvSqrt(dot(p1,p1)); | ||
472 | + p2 *= taylorInvSqrt(dot(p2,p2)); | ||
473 | + p3 *= taylorInvSqrt(dot(p3,p3)); | ||
474 | + p4 *= taylorInvSqrt(dot(p4,p4)); | ||
475 | +#endif | ||
476 | + | ||
477 | +// Mix | ||
478 | + vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.); | ||
479 | + vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.); | ||
480 | + m0 = m0 * m0; | ||
481 | + m1 = m1 * m1; | ||
482 | + return 32. * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 ))) | ||
483 | + + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ; | ||
484 | + | ||
485 | + } | ||
486 | + | ||
487 | + | ||
488 | + | ||
489 | diff --git a/src/glsl/skinning.vert b/src/glsl/skinning.vert | ||
490 | new file mode 100644 | ||
491 | index 0000000..28970ee | ||
492 | --- /dev/null | ||
493 | +++ b/src/glsl/skinning.vert | ||
494 | @@ -0,0 +1,24 @@ | ||
495 | +// Vertex weighting/blendin shader | ||
496 | +// Brian Paul | ||
497 | +// 4 Nov 2008 | ||
498 | + | ||
499 | +uniform mat4 mat0, mat1; | ||
500 | +attribute float weight; | ||
501 | + | ||
502 | +void main() | ||
503 | +{ | ||
504 | + // simple diffuse shading | ||
505 | + // Note that we should really transform the normal vector along with | ||
506 | + // the postion below... someday. | ||
507 | + vec3 lightVec = vec3(0, 0, 1); | ||
508 | + vec3 norm = gl_NormalMatrix * gl_Normal; | ||
509 | + float dot = 0.2 + max(0.0, dot(norm, lightVec)); | ||
510 | + gl_FrontColor = vec4(dot); | ||
511 | + | ||
512 | + // compute sum of weighted transformations | ||
513 | + vec4 pos0 = mat0 * gl_Vertex; | ||
514 | + vec4 pos1 = mat1 * gl_Vertex; | ||
515 | + vec4 pos = mix(pos0, pos1, weight); | ||
516 | + | ||
517 | + gl_Position = gl_ModelViewProjectionMatrix * pos; | ||
518 | +} | ||
519 | diff --git a/src/perf/glslstateschange1.frag b/src/perf/glslstateschange1.frag | ||
520 | new file mode 100644 | ||
521 | index 0000000..0839436 | ||
522 | --- /dev/null | ||
523 | +++ b/src/perf/glslstateschange1.frag | ||
524 | @@ -0,0 +1,19 @@ | ||
525 | +// Multi-texture fragment shader | ||
526 | +// Brian Paul | ||
527 | + | ||
528 | +// Composite second texture over first. | ||
529 | +// We're assuming the 2nd texture has a meaningful alpha channel. | ||
530 | + | ||
531 | +uniform sampler2D tex1; | ||
532 | +uniform sampler2D tex2; | ||
533 | +uniform vec4 UniV1; | ||
534 | +uniform vec4 UniV2; | ||
535 | + | ||
536 | +void main() | ||
537 | +{ | ||
538 | + vec4 t3; | ||
539 | + vec4 t1 = texture2D(tex1, gl_TexCoord[0].xy); | ||
540 | + vec4 t2 = texture2D(tex2, gl_TexCoord[1].xy); | ||
541 | + t3 = mix(t1, t2, t2.w); | ||
542 | + gl_FragColor = t3 + UniV1 + UniV2; | ||
543 | +} | ||
544 | diff --git a/src/perf/glslstateschange1.vert b/src/perf/glslstateschange1.vert | ||
545 | new file mode 100644 | ||
546 | index 0000000..cef50db | ||
547 | --- /dev/null | ||
548 | +++ b/src/perf/glslstateschange1.vert | ||
549 | @@ -0,0 +1,14 @@ | ||
550 | +// Multi-texture vertex shader | ||
551 | +// Brian Paul | ||
552 | + | ||
553 | + | ||
554 | +attribute vec4 TexCoord0, TexCoord1; | ||
555 | +attribute vec4 VertCoord; | ||
556 | + | ||
557 | +void main() | ||
558 | +{ | ||
559 | + gl_TexCoord[0] = TexCoord0; | ||
560 | + gl_TexCoord[1] = TexCoord1; | ||
561 | + // note: may use gl_Vertex or VertCoord here for testing: | ||
562 | + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
563 | +} | ||
564 | diff --git a/src/perf/glslstateschange2.frag b/src/perf/glslstateschange2.frag | ||
565 | new file mode 100644 | ||
566 | index 0000000..0df0319 | ||
567 | --- /dev/null | ||
568 | +++ b/src/perf/glslstateschange2.frag | ||
569 | @@ -0,0 +1,17 @@ | ||
570 | +// Multi-texture fragment shader | ||
571 | +// Brian Paul | ||
572 | + | ||
573 | +// Composite second texture over first. | ||
574 | +// We're assuming the 2nd texture has a meaningful alpha channel. | ||
575 | + | ||
576 | +uniform sampler2D tex1; | ||
577 | +uniform sampler2D tex2; | ||
578 | +uniform vec4 UniV1; | ||
579 | +uniform vec4 UniV2; | ||
580 | + | ||
581 | +void main() | ||
582 | +{ | ||
583 | + vec4 t1 = texture2D(tex1, gl_TexCoord[0].xy); | ||
584 | + vec4 t2 = texture2D(tex2, gl_TexCoord[1].xy); | ||
585 | + gl_FragColor = t1 + t2 + UniV1 + UniV2; | ||
586 | +} | ||
587 | diff --git a/src/perf/glslstateschange2.vert b/src/perf/glslstateschange2.vert | ||
588 | new file mode 100644 | ||
589 | index 0000000..cef50db | ||
590 | --- /dev/null | ||
591 | +++ b/src/perf/glslstateschange2.vert | ||
592 | @@ -0,0 +1,14 @@ | ||
593 | +// Multi-texture vertex shader | ||
594 | +// Brian Paul | ||
595 | + | ||
596 | + | ||
597 | +attribute vec4 TexCoord0, TexCoord1; | ||
598 | +attribute vec4 VertCoord; | ||
599 | + | ||
600 | +void main() | ||
601 | +{ | ||
602 | + gl_TexCoord[0] = TexCoord0; | ||
603 | + gl_TexCoord[1] = TexCoord1; | ||
604 | + // note: may use gl_Vertex or VertCoord here for testing: | ||
605 | + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
606 | +} | ||
607 | diff --git a/src/vpglsl/infinite-loop.glsl b/src/vpglsl/infinite-loop.glsl | ||
608 | new file mode 100644 | ||
609 | index 0000000..bc7ae4b | ||
610 | --- /dev/null | ||
611 | +++ b/src/vpglsl/infinite-loop.glsl | ||
612 | @@ -0,0 +1,8 @@ | ||
613 | +void main() { | ||
614 | + gl_Position = gl_Vertex; | ||
615 | + vec4 sum = vec4(0); | ||
616 | + for (int i = 1; i != 2; i += 2) { | ||
617 | + sum += vec4(0.1, 0.1, 0.1, 0.1); | ||
618 | + } | ||
619 | + gl_FrontColor = sum; | ||
620 | +} | ||
621 | -- | ||
622 | 1.7.9.5 | ||
623 | |||
diff --git a/meta/recipes-graphics/mesa/mesa-demos_8.1.0.bb b/meta/recipes-graphics/mesa/mesa-demos_8.1.0.bb index 972ead3478..469b8caf08 100644 --- a/meta/recipes-graphics/mesa/mesa-demos_8.1.0.bb +++ b/meta/recipes-graphics/mesa/mesa-demos_8.1.0.bb | |||
@@ -14,7 +14,8 @@ DEPENDS = "virtual/libgl glew" | |||
14 | SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/demos/${PV}/${BPN}-${PV}.tar.bz2 \ | 14 | SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/demos/${PV}/${BPN}-${PV}.tar.bz2 \ |
15 | file://glut.patch \ | 15 | file://glut.patch \ |
16 | file://egl-mesa-screen-surface-build-fix.patch \ | 16 | file://egl-mesa-screen-surface-build-fix.patch \ |
17 | file://egl-mesa-screen-surface-query.patch" | 17 | file://egl-mesa-screen-surface-query.patch \ |
18 | file://0001-mesa-demos-Add-missing-data-files.patch" | ||
18 | 19 | ||
19 | SRC_URI[md5sum] = "9df33ba69a26bbfbc7c8148602e59542" | 20 | SRC_URI[md5sum] = "9df33ba69a26bbfbc7c8148602e59542" |
20 | SRC_URI[sha256sum] = "9703fa0646b32a1e68d2abf5628f936f77bf97c69ffcaac90de380820a87a828" | 21 | SRC_URI[sha256sum] = "9703fa0646b32a1e68d2abf5628f936f77bf97c69ffcaac90de380820a87a828" |