Compare commits
144 Commits
intel_2009
...
mesa_7_5_1
Author | SHA1 | Date | |
---|---|---|---|
|
7d3af894d6 | ||
|
32156f3a11 | ||
|
1c32caf075 | ||
|
67c286d20e | ||
|
0b4e835b13 | ||
|
08575509e4 | ||
|
ccb081414b | ||
|
47df7900fd | ||
|
c3a0624ef0 | ||
|
e79054cc40 | ||
|
de343680a3 | ||
|
1d7a989b10 | ||
|
d9b7d7875b | ||
|
3f785080db | ||
|
fcf0804c05 | ||
|
9f36473a8e | ||
|
2241665dc6 | ||
|
6bf86681f5 | ||
|
f7654faf16 | ||
|
a48ee529a2 | ||
|
edb1178798 | ||
|
9399b9a0e2 | ||
|
0d7bed9f89 | ||
|
8f4d66c5f8 | ||
|
43a064e06d | ||
|
32f95f8c17 | ||
|
f8ae968d28 | ||
|
babb5ba9a9 | ||
|
d09d03aa42 | ||
|
488b3c4d1b | ||
|
f6d34c2058 | ||
|
04d170794a | ||
|
bf7e4b10cb | ||
|
96f7b42242 | ||
|
b5ecbbe636 | ||
|
b9b04872d5 | ||
|
f785b35b47 | ||
|
1aba1baa62 | ||
|
ce723d8d8b | ||
|
4c7c294fff | ||
|
5e6d21afa4 | ||
|
3097d7dbf8 | ||
|
fab17c1216 | ||
|
ee0984e299 | ||
|
e8957f4800 | ||
|
e3bc1fb6bc | ||
|
10430f47a4 | ||
|
cdf56eb68d | ||
|
1574b05189 | ||
|
a7ca80ff6a | ||
|
467b3d9a6f | ||
|
e691b0e533 | ||
|
3ffaa11f88 | ||
|
1e0f621b50 | ||
|
6d55fd705d | ||
|
ecb177eaea | ||
|
36df6a6e91 | ||
|
ad8a6937ae | ||
|
f418d18ea6 | ||
|
a531a5cf94 | ||
|
1ce3f5a806 | ||
|
d80b36f64f | ||
|
9676ed27fe | ||
|
98f00e8eb9 | ||
|
24fdf8aadb | ||
|
ffb1f9bded | ||
|
8c223e8eb6 | ||
|
5b3428d745 | ||
|
a59579c983 | ||
|
dcebe220f4 | ||
|
f792137593 | ||
|
2cd33afa00 | ||
|
727b2d747e | ||
|
4f36164024 | ||
|
05d393f59f | ||
|
854ea483d4 | ||
|
3a221a9018 | ||
|
61673aebb0 | ||
|
f5f8be8bb2 | ||
|
2bec909c69 | ||
|
f0df08abbe | ||
|
9d3929b60c | ||
|
9185a61c8a | ||
|
0ce73f84e9 | ||
|
fb7cf731f9 | ||
|
b59eb3b8b1 | ||
|
ed6125fe9b | ||
|
35e3449ad7 | ||
|
7d93f817c9 | ||
|
6842829539 | ||
|
2420b283b7 | ||
|
4d99e14535 | ||
|
45f4e8842e | ||
|
d090ba9e00 | ||
|
82f4dc21cc | ||
|
e32b601e7d | ||
|
ce0ad53281 | ||
|
bc60b88411 | ||
|
3dbaf68bdc | ||
|
722d136f7b | ||
|
a7427b0f7b | ||
|
0ad9eba333 | ||
|
7e2f26cbbf | ||
|
d2f56fe687 | ||
|
09ef339b69 | ||
|
25e371fb7b | ||
|
5276b049b4 | ||
|
c57d81ddc9 | ||
|
b4ba6a66b7 | ||
|
9c4b877519 | ||
|
b9e2e32daf | ||
|
a6b314150c | ||
|
1b445f9673 | ||
|
5ed4404005 | ||
|
cd10996d4f | ||
|
ee0b1bc7d3 | ||
|
a77b455af0 | ||
|
71b9e10291 | ||
|
7fd3674672 | ||
|
27587f46e5 | ||
|
8c6e81f97d | ||
|
2ba98efdf6 | ||
|
cf7e8fbc2e | ||
|
5807ccb41b | ||
|
d4e6df9ab6 | ||
|
0c4350790a | ||
|
4e1e18a772 | ||
|
3ab3209a1f | ||
|
6b7b13b5eb | ||
|
d970313b66 | ||
|
0474b5cb2a | ||
|
c68f659be3 | ||
|
fdeb778990 | ||
|
59de430de7 | ||
|
df5f7a6761 | ||
|
6c9d8a6f24 | ||
|
9aca6769df | ||
|
26e58a42b0 | ||
|
b0a17581e2 | ||
|
a36b9987cd | ||
|
6ec955efaf | ||
|
7325c1ebc8 | ||
|
4ed1de8b84 | ||
|
680f7d09b0 |
12
Makefile
12
Makefile
@@ -182,7 +182,7 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.5-rc4
|
||||
VERSION=7.5.1
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
@@ -388,7 +388,17 @@ GLW_FILES = \
|
||||
$(DIRECTORY)/src/glw/glw.pc.in \
|
||||
$(DIRECTORY)/src/glw/depend
|
||||
|
||||
GLEW_FILES = \
|
||||
$(DIRECTORY)/include/GL/glew.h \
|
||||
$(DIRECTORY)/include/GL/glxew.h \
|
||||
$(DIRECTORY)/include/GL/wglew.h \
|
||||
$(DIRECTORY)/src/glew/*.c \
|
||||
$(DIRECTORY)/src/glew/Makefile \
|
||||
$(DIRECTORY)/src/glew/SConscript \
|
||||
$(DIRECTORY)/src/glew/LICENSE.txt
|
||||
|
||||
DEMO_FILES = \
|
||||
$(GLEW_FILES) \
|
||||
$(DIRECTORY)/progs/beos/*.cpp \
|
||||
$(DIRECTORY)/progs/beos/Makefile \
|
||||
$(DIRECTORY)/progs/images/*.rgb \
|
||||
|
@@ -971,5 +971,6 @@ esac
|
||||
#
|
||||
if [ ${INSTALLDIR} != "." ] ; then
|
||||
echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
|
||||
test -d ${INSTALLDIR} || mkdir -p ${INSTALLDIR}
|
||||
mv ${FINAL_LIBS} ${INSTALLDIR}/
|
||||
fi
|
||||
|
@@ -10,7 +10,7 @@ CONFIG_NAME = default
|
||||
# Version info
|
||||
MESA_MAJOR=7
|
||||
MESA_MINOR=5
|
||||
MESA_TINY=0
|
||||
MESA_TINY=1
|
||||
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
|
||||
|
||||
# external projects. This should be useless now that we use libdrm.
|
||||
|
16
configure.ac
16
configure.ac
@@ -121,6 +121,7 @@ AC_ARG_ENABLE([32-bit],
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="$CFLAGS -m32"
|
||||
ARCH_FLAGS="$ARCH_FLAGS -m32"
|
||||
fi
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -m32"
|
||||
@@ -1145,6 +1146,21 @@ AC_ARG_WITH([xorg-driver-dir],
|
||||
[XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
|
||||
AC_SUBST([XORG_DRIVER_INSTALL_DIR])
|
||||
|
||||
AC_ARG_WITH([max-width],
|
||||
[AS_HELP_STRING([--with-max-width=N],
|
||||
[Maximum framebuffer width (4096)])],
|
||||
[DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
|
||||
AS_IF([test "${withval}" -gt "4096"],
|
||||
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
|
||||
)
|
||||
AC_ARG_WITH([max-height],
|
||||
[AS_HELP_STRING([--with-max-height=N],
|
||||
[Maximum framebuffer height (4096)])],
|
||||
[DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
|
||||
AS_IF([test "${withval}" -gt "4096"],
|
||||
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl Gallium Intel configuration
|
||||
dnl
|
||||
|
@@ -12,7 +12,7 @@
|
||||
The Mesa
|
||||
<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
|
||||
driver is part of the
|
||||
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
|
||||
<a href="http://wiki.freedesktop.org/wiki/Software/gallium" target="_parent">Gallium3D</a>
|
||||
architecture.
|
||||
Tungsten Graphics did the original implementation of the Cell driver.
|
||||
</p>
|
||||
|
@@ -39,7 +39,6 @@ a:visited {
|
||||
<ul>
|
||||
<li><a href="download.html" target="MainFrame">Downloading / Unpacking</a>
|
||||
<li><a href="install.html" target="MainFrame">Compiling / Installing</a>
|
||||
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
|
||||
<li><a href="precompiled.html" target="MainFrame">Precompiled Libraries</a>
|
||||
</ul>
|
||||
|
||||
@@ -68,6 +67,7 @@ a:visited {
|
||||
<li><a href="repository.html" target="MainFrame">Source Code Repository</a>
|
||||
<li><a href="memory.html" target="MainFrame">DRI Memory Management</a>
|
||||
<li><a href="shading.html" target="MainFrame">Shading Language</a>
|
||||
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
|
||||
<li><a href="utilities.html" target="MainFrame">Utilities</a>
|
||||
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
|
||||
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>
|
||||
|
@@ -9,14 +9,14 @@
|
||||
<H1>Downloading</H1>
|
||||
|
||||
<p>
|
||||
Primary download site:
|
||||
<a href="http://sourceforge.net/project/showfiles.php?group_id=3"
|
||||
target="_parent">SourceForge</a>
|
||||
Primary Mesa download site:
|
||||
<a href="ftp://ftp.freedesktop.org/pub/mesa/"
|
||||
target="_parent">freedesktop.org</a> (FTP)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When a new release is coming, release candidates (betas) can be found
|
||||
<a href="http://www.mesa3d.org/beta/">here</a>.
|
||||
When a new release is coming, release candidates (betas) may be found
|
||||
<a href="ftp://ftp.freedesktop.org/pub/mesa/beta/" target="_parent">here</a>.
|
||||
</p>
|
||||
|
||||
|
||||
|
@@ -316,6 +316,19 @@ Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates
|
||||
will fix the problem.
|
||||
</p>
|
||||
|
||||
<h2>3.6 How can I change the maximum framebuffer size in Mesa's
|
||||
<tt>swrast</tt> backend?</h2>
|
||||
<p>
|
||||
These can be overridden by using the <tt>--with-max-width</tt> and
|
||||
<tt>--with-max-height</tt> options. The two need not be equal.
|
||||
</p><p>
|
||||
Do note that Mesa uses these values to size some internal buffers,
|
||||
so increasing these sizes will cause Mesa to require additional
|
||||
memory. Furthermore, increasing these limits beyond <tt>4096</tt>
|
||||
may introduce rasterization artifacts; see the leading comments in
|
||||
<tt>src/mesa/swrast/s_tritemp.h</tt>.
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
@@ -11,6 +11,21 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>September 3, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.5.1.html">Mesa 7.5.1</a> is released.
|
||||
This is a bug-fix release which fixes bugs found in version 7.5.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>July 17, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.5.html">Mesa 7.5</a> is released.
|
||||
This is a new features release. People especially concerned about
|
||||
stability may want to wait for the follow-on 7.5.1 bug-fix release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>June 23, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
|
||||
@@ -99,7 +114,7 @@ Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
|
||||
<p>
|
||||
Gallium3D is the codename for the new Mesa device driver architecture
|
||||
which is currently under development.
|
||||
A <a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
|
||||
A <a href="http://wiki.freedesktop.org/wiki/Software/gallium"
|
||||
target="_parent"> summary</a> of the architecture can be found on the
|
||||
Tungsten Graphics website.
|
||||
</p>
|
||||
|
@@ -9,17 +9,11 @@
|
||||
<H1>Precompiled Libraries</H1>
|
||||
|
||||
<p>
|
||||
In general, precompiled libraries are not available.
|
||||
However, people occasionally prepare packages of precompiled libraries
|
||||
for some systems.
|
||||
In general, precompiled Mesa libraries are not available.
|
||||
</p>
|
||||
|
||||
<H2>Mesa-6.0 for Solaris</H2>
|
||||
|
||||
<p>
|
||||
Steve Christensen has submitted precompiled Mesa-6.0 libraries for
|
||||
Solaris at <a href="http://sunfreeware.com/" target="_parent">
|
||||
sunfreeware.com</a>.
|
||||
However, some Linux distros (such as Ubuntu) seem to closely track
|
||||
Mesa and often have the latest Mesa release available as an update.
|
||||
</p>
|
||||
|
||||
</BODY>
|
||||
|
64
docs/relnotes-7.5.1.html
Normal file
64
docs/relnotes-7.5.1.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.5.1 Release Notes, 3 September 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.5.1 is a bug-fix release fixing issues found since the 7.5 release.
|
||||
</p>
|
||||
<p>
|
||||
The main new feature of Mesa 7.5.x is the
|
||||
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
|
||||
target="_parent">Gallium3D</a> infrastructure.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.5.1 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
|
||||
max framebuffer, viewport size.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Added missing GLEW library to MesaDemos tarballs.
|
||||
<li>Fixed swapbuffers jerkiness in Doom3/etc in Intel drivers.
|
||||
<li>Fixed front buffer rendering bug in Intel drivers.
|
||||
<li>Fixed minor GLX memory leaks.
|
||||
<li>Fixed some texture env / fragment program state bugs.
|
||||
<li>Fixed some Gallium glBlitFramebuffer() bugs
|
||||
<li>Empty glBegin/glEnd() pair could cause divide by zero (bug 23489)
|
||||
<li>Fixed Gallium glBitmap() Z position bug
|
||||
<li>Setting arrays of sampler uniforms did not work
|
||||
<li>Selection/Feedback mode didn't handle polygon culling correctly (bug 16866)
|
||||
<li>Fixed 32/64-bit cross compilation issue in gen_matypes.c
|
||||
<li>Fixed glXCreateGLXPixmap() for direct rendering.
|
||||
<li>Fixed Gallium glCopyPixels(GL_STENCIL_INDEX) mispositioned image bug.
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -8,7 +8,7 @@
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.5 Release Notes / date TBD</H1>
|
||||
<H1>Mesa 7.5 Release Notes / 17 July 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.5 is a new development release.
|
||||
@@ -17,7 +17,7 @@ with the 7.4.x branch or wait for Mesa 7.5.1.
|
||||
</p>
|
||||
<p>
|
||||
The main new feature of Mesa 7.5 is the
|
||||
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
|
||||
<a href="http://wiki.freedesktop.org/wiki/Software/gallium"
|
||||
target="_parent">Gallium3D</a> infrastructure.
|
||||
</p>
|
||||
<p>
|
||||
@@ -40,7 +40,15 @@ If you're especially concerned with stability you should probably look for
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
553fd956e544727f30fbe249619b6286 MesaLib-7.5.tar.gz
|
||||
459f332551f6ebb86f384d21dd15e1f0 MesaLib-7.5.tar.bz2
|
||||
8c02c0e17a9025250d20424ae32f5163 MesaLib-7.5.zip
|
||||
a188da2886fa5496ea0c2cda602b2eeb MesaDemos-7.5.tar.gz
|
||||
398ee8801814a00e47f6c2314e3dfddc MesaDemos-7.5.tar.bz2
|
||||
15a0c8ae013c54335a26335e1a98d609 MesaDemos-7.5.zip
|
||||
81010147def5a644ba14f9bbb7a49a2a MesaGLUT-7.5.tar.gz
|
||||
baa7a1e850b6e39bae58868fd0684004 MesaGLUT-7.5.tar.bz2
|
||||
265228418e4423fa328f2f5b7970cf08 MesaGLUT-7.5.zip
|
||||
</pre>
|
||||
|
||||
|
||||
|
@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>
|
||||
|
@@ -498,7 +498,7 @@ SetupFunctionPointers(void)
|
||||
* Make FBO to render into given texture.
|
||||
*/
|
||||
static GLuint
|
||||
MakeFBO_RenderTexture(GLuint TexObj)
|
||||
MakeFBO_RenderTexture(GLuint texObj)
|
||||
{
|
||||
GLuint fb;
|
||||
GLint sizeFudge = 0;
|
||||
@@ -507,7 +507,7 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
|
||||
/* Render color to texture */
|
||||
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
TexTarget, TexObj, TextureLevel);
|
||||
TexTarget, texObj, TextureLevel);
|
||||
|
||||
if (Use_ARB_fbo) {
|
||||
/* use a smaller depth buffer to see what happens */
|
||||
@@ -541,7 +541,7 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
|
||||
/* queries */
|
||||
{
|
||||
GLint bits, w, h;
|
||||
GLint bits, w, h, name;
|
||||
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
@@ -559,8 +559,28 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
|
||||
printf("Stencil renderbuffer size = %d bits\n", bits);
|
||||
}
|
||||
|
||||
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
|
||||
&name);
|
||||
printf("Render to texture name: %d\n", texObj);
|
||||
printf("Color attachment[0] name: %d\n", name);
|
||||
assert(texObj == name);
|
||||
|
||||
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_STENCIL_ATTACHMENT,
|
||||
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
|
||||
&name);
|
||||
printf("Stencil attachment name: %d\n", name);
|
||||
|
||||
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_ATTACHMENT,
|
||||
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
|
||||
&name);
|
||||
printf("Depth attachment name: %d\n", name);
|
||||
|
||||
}
|
||||
/* bind the regular framebuffer */
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
|
@@ -32,6 +32,7 @@ DEMO_SOURCES = \
|
||||
pointcoord.c \
|
||||
points.c \
|
||||
samplers.c \
|
||||
samplers_array.c \
|
||||
shadow_sampler.c \
|
||||
skinning.c \
|
||||
texaaline.c \
|
||||
@@ -188,7 +189,8 @@ samplers.o: $(UTIL_HEADERS)
|
||||
samplers: samplers.o $(UTIL_OBJS)
|
||||
|
||||
|
||||
samplers_array.o: $(UTIL_HEADERS)
|
||||
samplers_array.o: samplers.c $(UTIL_HEADERS)
|
||||
$(APP_CC) $(CFLAGS) -DSAMPLERS_ARRAY $< -c -o $@
|
||||
|
||||
samplers_array: samplers_array.o $(UTIL_OBJS)
|
||||
|
||||
|
@@ -10,9 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -144,9 +142,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -219,19 +217,17 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
/* Setup the HeightArray[] uniform */
|
||||
for (i = 0; i < 20; i++)
|
||||
HeightArray[i] = i / 20.0;
|
||||
u = glGetUniformLocation_func(program, "HeightArray");
|
||||
glUniform1fv_func(u, 20, HeightArray);
|
||||
u = glGetUniformLocation(program, "HeightArray");
|
||||
glUniform1fv(u, 20, HeightArray);
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -79,11 +76,11 @@ Redisplay(void)
|
||||
BitmapText("-X");
|
||||
}
|
||||
else {
|
||||
glUseProgram_func(Program);
|
||||
glUseProgram(Program);
|
||||
|
||||
/* vertex positions (deltas) depend on texture size and window size */
|
||||
if (uScale != -1) {
|
||||
glUniform2f_func(uScale,
|
||||
glUniform2f(uScale,
|
||||
2.0 * TEX_WIDTH / WinWidth,
|
||||
2.0 * TEX_HEIGHT / WinHeight);
|
||||
}
|
||||
@@ -106,7 +103,7 @@ Redisplay(void)
|
||||
glTexCoord2f(0, 1); glVertex3fv(nx);
|
||||
glEnd();
|
||||
|
||||
glUseProgram_func(0);
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
@@ -161,9 +158,9 @@ Key(unsigned char key, int x, int y)
|
||||
printf("Using billboard texture\n");
|
||||
break;
|
||||
case 27:
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(Program);
|
||||
glDeleteShader(FragShader);
|
||||
glDeleteShader(VertShader);
|
||||
glDeleteProgram(Program);
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
}
|
||||
@@ -278,21 +275,19 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
Program = LinkShaders(VertShader, FragShader);
|
||||
|
||||
glUseProgram_func(Program);
|
||||
glUseProgram(Program);
|
||||
|
||||
uScale = glGetUniformLocation_func(Program, "scale");
|
||||
uTex = glGetUniformLocation_func(Program, "tex2d");
|
||||
uScale = glGetUniformLocation(Program, "scale");
|
||||
uTex = glGetUniformLocation(Program, "tex2d");
|
||||
if (uTex != -1) {
|
||||
glUniform1i_func(uTex, 0); /* tex unit 0 */
|
||||
glUniform1i(uTex, 0); /* tex unit 0 */
|
||||
}
|
||||
|
||||
glUseProgram_func(0);
|
||||
glUseProgram(0);
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -83,9 +80,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -145,13 +142,11 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
|
||||
@@ -161,9 +156,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -9,10 +9,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -60,7 +58,7 @@ static void
|
||||
Square(GLfloat size)
|
||||
{
|
||||
glNormal3f(0, 0, 1);
|
||||
glVertexAttrib3f_func(tangentAttrib, 1, 0, 0);
|
||||
glVertexAttrib3f(tangentAttrib, 1, 0, 0);
|
||||
glBegin(GL_POLYGON);
|
||||
glTexCoord2f(0, 0); glVertex2f(-size, -size);
|
||||
glTexCoord2f(1, 0); glVertex2f( size, -size);
|
||||
@@ -164,9 +162,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -230,17 +228,15 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
@@ -250,7 +246,7 @@ Init(void)
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
tangentAttrib = glGetAttribLocation_func(program, "Tangent");
|
||||
tangentAttrib = glGetAttribLocation(program, "Tangent");
|
||||
printf("Tangent Attrib: %d\n", tangentAttrib);
|
||||
|
||||
assert(tangentAttrib >= 0);
|
||||
|
@@ -14,10 +14,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -71,9 +68,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -178,13 +175,11 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
@@ -198,9 +193,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -13,10 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -86,9 +83,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -130,13 +127,11 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
@@ -144,9 +139,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -70,9 +67,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -142,8 +139,6 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
if (FragProgFile)
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
else
|
||||
@@ -156,7 +151,7 @@ Init(void)
|
||||
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
@@ -165,9 +160,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -133,11 +130,11 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(VertShader1);
|
||||
glDeleteShader_func(VertShader2);
|
||||
glDeleteShader_func(FragShader1);
|
||||
glDeleteShader_func(FragShader2);
|
||||
glDeleteProgram_func(Program);
|
||||
glDeleteShader(VertShader1);
|
||||
glDeleteShader(VertShader2);
|
||||
glDeleteShader(FragShader1);
|
||||
glDeleteShader(FragShader2);
|
||||
glDeleteProgram(Program);
|
||||
glutDestroyWindow(Win);
|
||||
}
|
||||
|
||||
@@ -176,11 +173,11 @@ static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
glGetProgramInfoLog(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
}
|
||||
@@ -192,8 +189,6 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1);
|
||||
@@ -201,26 +196,26 @@ Init(void)
|
||||
FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1);
|
||||
FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2);
|
||||
|
||||
Program = glCreateProgram_func();
|
||||
glAttachShader_func(Program, VertShader1);
|
||||
glAttachShader_func(Program, VertShader2);
|
||||
glAttachShader_func(Program, FragShader1);
|
||||
glAttachShader_func(Program, FragShader2);
|
||||
Program = glCreateProgram();
|
||||
glAttachShader(Program, VertShader1);
|
||||
glAttachShader(Program, VertShader2);
|
||||
glAttachShader(Program, FragShader1);
|
||||
glAttachShader(Program, FragShader2);
|
||||
|
||||
glLinkProgram_func(Program);
|
||||
glLinkProgram(Program);
|
||||
|
||||
CheckLink(Program);
|
||||
|
||||
glUseProgram_func(Program);
|
||||
glUseProgram(Program);
|
||||
|
||||
uDiffuse = glGetUniformLocation_func(Program, "diffuse");
|
||||
uSpecular = glGetUniformLocation_func(Program, "specular");
|
||||
uTexture = glGetUniformLocation_func(Program, "texture");
|
||||
uDiffuse = glGetUniformLocation(Program, "diffuse");
|
||||
uSpecular = glGetUniformLocation(Program, "specular");
|
||||
uTexture = glGetUniformLocation(Program, "texture");
|
||||
printf("DiffusePos %d SpecularPos %d TexturePos %d\n",
|
||||
uDiffuse, uSpecular, uTexture);
|
||||
|
||||
glUniform4fv_func(uDiffuse, 1, diffuse);
|
||||
glUniform4fv_func(uSpecular, 1, specular);
|
||||
glUniform4fv(uDiffuse, 1, diffuse);
|
||||
glUniform4fv(uSpecular, 1, specular);
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -229,11 +224,11 @@ Init(void)
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f);
|
||||
|
||||
assert(glIsProgram_func(Program));
|
||||
assert(glIsShader_func(VertShader1));
|
||||
assert(glIsShader_func(VertShader2));
|
||||
assert(glIsShader_func(FragShader1));
|
||||
assert(glIsShader_func(FragShader2));
|
||||
assert(glIsProgram(Program));
|
||||
assert(glIsShader(VertShader1));
|
||||
assert(glIsShader(VertShader2));
|
||||
assert(glIsShader(FragShader1));
|
||||
assert(glIsShader(FragShader2));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -57,9 +54,9 @@ Redisplay(void)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* set interactive uniform parameters */
|
||||
glUniform1fv_func(uZoom, 1, &zoom);
|
||||
glUniform1fv_func(uXcenter, 1, &xCenter);
|
||||
glUniform1fv_func(uYcenter, 1, &yCenter);
|
||||
glUniform1fv(uZoom, 1, &zoom);
|
||||
glUniform1fv(uXcenter, 1, &xCenter);
|
||||
glUniform1fv(uYcenter, 1, &yCenter);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
|
||||
@@ -95,9 +92,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -156,19 +153,17 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
|
||||
uZoom = glGetUniformLocation_func(program, "Zoom");
|
||||
uXcenter = glGetUniformLocation_func(program, "Xcenter");
|
||||
uYcenter = glGetUniformLocation_func(program, "Ycenter");
|
||||
uZoom = glGetUniformLocation(program, "Zoom");
|
||||
uXcenter = glGetUniformLocation(program, "Xcenter");
|
||||
uYcenter = glGetUniformLocation(program, "Ycenter");
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
@@ -176,9 +171,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -9,10 +9,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
static const char *VertShaderText =
|
||||
"void main() {\n"
|
||||
@@ -108,10 +105,10 @@ CleanUp(void)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteShader(vertShader);
|
||||
for( i = 0; i < 4; i++ ) {
|
||||
glDeleteShader_func(fragShader[ i ]);
|
||||
glDeleteProgram_func(program[ i ]);
|
||||
glDeleteShader(fragShader[ i ]);
|
||||
glDeleteProgram(program[ i ]);
|
||||
}
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
@@ -144,7 +141,7 @@ Key(unsigned char key, int x, int y)
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
glUseProgram_func(program[ key - '1' ]);
|
||||
glUseProgram(program[ key - '1' ]);
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
@@ -187,15 +184,15 @@ LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
glCompileShader(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
@@ -209,11 +206,11 @@ static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
glGetProgramInfoLog(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
@@ -234,22 +231,20 @@ Init(void)
|
||||
/*exit(1);*/
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
vertShader = glCreateShader(GL_VERTEX_SHADER);
|
||||
LoadAndCompileShader(vertShader, VertShaderText);
|
||||
|
||||
for( i = 0; i < 4; i++ ) {
|
||||
fragShader[ i ] = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
fragShader[ i ] = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
LoadAndCompileShader(fragShader[ i ], FragShaderText[ i ]);
|
||||
program[ i ] = glCreateProgram_func();
|
||||
glAttachShader_func(program[ i ], fragShader[ i ]);
|
||||
glAttachShader_func(program[ i ], vertShader);
|
||||
glLinkProgram_func(program[ i ]);
|
||||
program[ i ] = glCreateProgram();
|
||||
glAttachShader(program[ i ], fragShader[ i ]);
|
||||
glAttachShader(program[ i ], vertShader);
|
||||
glLinkProgram(program[ i ]);
|
||||
CheckLink(program[ i ]);
|
||||
}
|
||||
|
||||
glUseProgram_func(program[ 0 ]);
|
||||
glUseProgram(program[ 0 ]);
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <GL/glew.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
static const char *Demo = "multitex";
|
||||
@@ -81,22 +80,22 @@ static void
|
||||
DrawPolygonArray(void)
|
||||
{
|
||||
if (VertCoord_attr >= 0) {
|
||||
glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
glVertexAttribPointer(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
0, VertCoords);
|
||||
glEnableVertexAttribArray_func(VertCoord_attr);
|
||||
glEnableVertexAttribArray(VertCoord_attr);
|
||||
}
|
||||
else {
|
||||
glVertexPointer(2, GL_FLOAT, 0, VertCoords);
|
||||
glEnable(GL_VERTEX_ARRAY);
|
||||
}
|
||||
|
||||
glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
glVertexAttribPointer(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
0, Tex0Coords);
|
||||
glEnableVertexAttribArray_func(TexCoord0_attr);
|
||||
glEnableVertexAttribArray(TexCoord0_attr);
|
||||
|
||||
glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
glVertexAttribPointer(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
0, Tex1Coords);
|
||||
glEnableVertexAttribArray_func(TexCoord1_attr);
|
||||
glEnableVertexAttribArray(TexCoord1_attr);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
@@ -110,11 +109,11 @@ DrawPolygonVert(void)
|
||||
glBegin(GL_TRIANGLE_FAN);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
glVertexAttrib2fv_func(TexCoord0_attr, Tex0Coords[i]);
|
||||
glVertexAttrib2fv_func(TexCoord1_attr, Tex1Coords[i]);
|
||||
glVertexAttrib2fv(TexCoord0_attr, Tex0Coords[i]);
|
||||
glVertexAttrib2fv(TexCoord1_attr, Tex1Coords[i]);
|
||||
|
||||
if (VertCoord_attr >= 0)
|
||||
glVertexAttrib2fv_func(VertCoord_attr, VertCoords[i]);
|
||||
glVertexAttrib2fv(VertCoord_attr, VertCoords[i]);
|
||||
else
|
||||
glVertex2fv(VertCoords[i]);
|
||||
}
|
||||
@@ -268,27 +267,27 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
assert(vertShader);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
|
||||
if (VertCoord_attr > 0) {
|
||||
/* We want the VertCoord attrib to have position zero so that
|
||||
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
|
||||
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
|
||||
* to set that attribute last (which is a PITA to manage).
|
||||
*/
|
||||
glBindAttribLocation_func(program, 0, "VertCoord");
|
||||
glBindAttribLocation(program, 0, "VertCoord");
|
||||
/* re-link */
|
||||
glLinkProgram_func(program);
|
||||
glLinkProgram(program);
|
||||
/* VertCoord_attr should be zero now */
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
VertCoord_attr = glGetAttribLocation(program, "VertCoord");
|
||||
assert(VertCoord_attr == 0);
|
||||
}
|
||||
|
||||
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
|
||||
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
|
||||
TexCoord0_attr = glGetAttribLocation(program, "TexCoord0");
|
||||
TexCoord1_attr = glGetAttribLocation(program, "TexCoord1");
|
||||
|
||||
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
|
||||
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
|
||||
@@ -316,8 +315,6 @@ InitGL(void)
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
InitTextures();
|
||||
InitPrograms();
|
||||
|
||||
|
@@ -9,10 +9,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -68,7 +65,7 @@ Redisplay(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glUniform1fv_func(Uniforms[2].location, 1, &Slice);
|
||||
glUniform1fv(Uniforms[2].location, 1, &Slice);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
|
||||
@@ -104,9 +101,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -176,13 +173,11 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
|
||||
@@ -192,9 +187,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -11,10 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -65,9 +62,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -142,18 +139,16 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
tex0 = glGetUniformLocation_func(program, "tex0");
|
||||
tex0 = glGetUniformLocation(program, "tex0");
|
||||
printf("Uniforms: tex0: %d\n", tex0);
|
||||
|
||||
glUniform1i_func(tex0, 0); /* tex unit 0 */
|
||||
glUniform1i(tex0, 0); /* tex unit 0 */
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
@@ -161,9 +156,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
MakeTexture();
|
||||
|
||||
|
@@ -11,10 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -100,7 +97,7 @@ Redisplay(void)
|
||||
*/
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 1.2, 0);
|
||||
glUseProgram_func(0);
|
||||
glUseProgram(0);
|
||||
DrawPoints(GL_FALSE);
|
||||
glPopMatrix();
|
||||
|
||||
@@ -109,9 +106,9 @@ Redisplay(void)
|
||||
*/
|
||||
glPushMatrix();
|
||||
glTranslatef(0, -1.2, 0);
|
||||
glUseProgram_func(Program);
|
||||
glUseProgram(Program);
|
||||
if (uViewportInv != -1) {
|
||||
glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
|
||||
glUniform2f(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
|
||||
}
|
||||
DrawPoints(GL_TRUE);
|
||||
glPopMatrix();
|
||||
@@ -151,9 +148,9 @@ Key(unsigned char key, int x, int y)
|
||||
Smooth = !Smooth;
|
||||
break;
|
||||
case 27:
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(Program);
|
||||
glDeleteShader(FragShader);
|
||||
glDeleteShader(VertShader);
|
||||
glDeleteProgram(Program);
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
}
|
||||
@@ -226,17 +223,15 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
Program = LinkShaders(VertShader, FragShader);
|
||||
|
||||
glUseProgram_func(Program);
|
||||
glUseProgram(Program);
|
||||
|
||||
uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
|
||||
uViewportInv = glGetUniformLocation(Program, "viewportInv");
|
||||
|
||||
glUseProgram_func(0);
|
||||
glUseProgram(0);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
@@ -42,7 +42,6 @@
|
||||
#include <GL/glew.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -212,10 +211,18 @@ InitTextures(void)
|
||||
for (y = 0; y < stripeSize; y++) {
|
||||
for (x = 0; x < size; x++) {
|
||||
GLint k = 4 * ((ypos + y) * size + x);
|
||||
texImage[k + 0] = intensity;
|
||||
texImage[k + 1] = intensity;
|
||||
texImage[k + 2] = 0;
|
||||
texImage[k + 3] = 255;
|
||||
if (x < size / 2) {
|
||||
texImage[k + 0] = intensity;
|
||||
texImage[k + 1] = intensity;
|
||||
texImage[k + 2] = 0;
|
||||
texImage[k + 3] = 255;
|
||||
}
|
||||
else {
|
||||
texImage[k + 0] = 255 - intensity;
|
||||
texImage[k + 1] = 0;
|
||||
texImage[k + 2] = 0;
|
||||
texImage[k + 3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +298,7 @@ CreateProgram(void)
|
||||
assert(vertShader);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
free(fragShaderText);
|
||||
|
||||
@@ -316,10 +323,10 @@ InitProgram(void)
|
||||
#else
|
||||
sprintf(uname, "tex[%d]", s);
|
||||
#endif
|
||||
loc = glGetUniformLocation_func(Program, uname);
|
||||
loc = glGetUniformLocation(Program, uname);
|
||||
assert(loc >= 0);
|
||||
|
||||
glUniform1i_func(loc, s);
|
||||
glUniform1i(loc, s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,8 +341,6 @@ InitGL(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n", (const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &NumSamplers);
|
||||
if (NumSamplers > MAX_SAMPLERS)
|
||||
NumSamplers = MAX_SAMPLERS;
|
||||
|
@@ -11,10 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
|
||||
/** Use GL_RECTANGLE texture (with projective texcoords)? */
|
||||
@@ -67,7 +64,7 @@ Redisplay(void)
|
||||
glPushMatrix();
|
||||
|
||||
CheckError(__LINE__);
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
CheckError(__LINE__);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
@@ -87,7 +84,7 @@ Redisplay(void)
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glUseProgram_func(0);
|
||||
glUseProgram(0);
|
||||
glWindowPos2iARB(80, 20);
|
||||
PrintString("white black white black");
|
||||
|
||||
@@ -111,9 +108,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -179,13 +176,13 @@ static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
glCompileShader_func(shader);
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
|
||||
glCompileShader(shader);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
@@ -223,11 +220,11 @@ static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
glGetProgramiv(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
glGetProgramInfoLog(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
}
|
||||
@@ -267,35 +264,33 @@ Init(void)
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
if (FragProgFile)
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
else
|
||||
LoadAndCompileShader(fragShader, fragShaderText);
|
||||
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
vertShader = glCreateShader(GL_VERTEX_SHADER);
|
||||
if (VertProgFile)
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
else
|
||||
LoadAndCompileShader(vertShader, vertShaderText);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
program = glCreateProgram();
|
||||
glAttachShader(program, fragShader);
|
||||
glAttachShader(program, vertShader);
|
||||
glLinkProgram(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
uTexture2D = glGetUniformLocation_func(program, "shadowTex2D");
|
||||
uTextureRect = glGetUniformLocation_func(program, "shadowTexRect");
|
||||
uTexture2D = glGetUniformLocation(program, "shadowTex2D");
|
||||
uTextureRect = glGetUniformLocation(program, "shadowTexRect");
|
||||
printf("uTexture2D %d uTextureRect %d\n", uTexture2D, uTextureRect);
|
||||
if (uTexture2D >= 0) {
|
||||
glUniform1i_func(uTexture2D, 0); /* use texture unit 0 */
|
||||
glUniform1i(uTexture2D, 0); /* use texture unit 0 */
|
||||
}
|
||||
if (uTextureRect >= 0) {
|
||||
glUniform1i_func(uTextureRect, 1); /* use texture unit 0 */
|
||||
glUniform1i(uTextureRect, 1); /* use texture unit 0 */
|
||||
}
|
||||
CheckError(__LINE__);
|
||||
|
||||
|
@@ -13,10 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -65,11 +62,11 @@ Cylinder(GLfloat length, GLfloat radius, GLint slices, GLint stacks)
|
||||
float a = (float) i / (slices - 1) * M_PI * 2.0;
|
||||
float x = radius * cos(a);
|
||||
float y = radius * sin(a);
|
||||
glVertexAttrib1f_func(WeightAttr, w0);
|
||||
glVertexAttrib1f(WeightAttr, w0);
|
||||
glNormal3f(x, y, 0.0);
|
||||
glVertex3f(x, y, z0);
|
||||
|
||||
glVertexAttrib1f_func(WeightAttr, w0 + dw);
|
||||
glVertexAttrib1f(WeightAttr, w0 + dw);
|
||||
glNormal3f(x, y, 0.0);
|
||||
glVertex3f(x, y, z0 + dz);
|
||||
}
|
||||
@@ -107,8 +104,8 @@ Redisplay(void)
|
||||
{
|
||||
UpdateMatrices();
|
||||
|
||||
glUniformMatrix4fv_func(uMat0, 1, GL_FALSE, Matrices[0]);
|
||||
glUniformMatrix4fv_func(uMat1, 1, GL_FALSE, Matrices[1]);
|
||||
glUniformMatrix4fv(uMat0, 1, GL_FALSE, Matrices[0]);
|
||||
glUniformMatrix4fv(uMat1, 1, GL_FALSE, Matrices[1]);
|
||||
|
||||
if (WireFrame)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
@@ -149,9 +146,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -222,18 +219,16 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
uMat0 = glGetUniformLocation_func(program, "mat0");
|
||||
uMat1 = glGetUniformLocation_func(program, "mat1");
|
||||
uMat0 = glGetUniformLocation(program, "mat0");
|
||||
uMat1 = glGetUniformLocation(program, "mat1");
|
||||
|
||||
WeightAttr = glGetAttribLocation_func(program, "weight");
|
||||
WeightAttr = glGetAttribLocation(program, "weight");
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
@@ -12,10 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
|
||||
static GLint WinWidth = 300, WinHeight = 300;
|
||||
@@ -329,8 +326,6 @@ Init(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include <GL/glew.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
static const char *Demo = "texdemo1";
|
||||
@@ -98,7 +97,7 @@ draw(void)
|
||||
/* sphere w/ reflection map */
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 1, 0);
|
||||
glUseProgram_func(Program1);
|
||||
glUseProgram(Program1);
|
||||
|
||||
/* setup texture matrix */
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
@@ -117,7 +116,7 @@ draw(void)
|
||||
glPopMatrix();
|
||||
|
||||
/* ground */
|
||||
glUseProgram_func(Program2);
|
||||
glUseProgram(Program2);
|
||||
glTranslatef(0, -1.0, 0);
|
||||
DrawGround(5);
|
||||
|
||||
@@ -381,7 +380,7 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
|
||||
@@ -408,8 +407,6 @@ Init(GLboolean useImageFiles)
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
InitTextures(useImageFiles);
|
||||
InitPrograms();
|
||||
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -100,9 +97,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -170,13 +167,11 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
|
||||
|
@@ -16,10 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -86,9 +83,9 @@ Redisplay(void)
|
||||
RotateVerts(Zrot, 3, TriVerts, v);
|
||||
ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax);
|
||||
|
||||
glUniform2fv_func(uv0, 1, v[0]);
|
||||
glUniform2fv_func(uv1, 1, v[1]);
|
||||
glUniform2fv_func(uv2, 1, v[2]);
|
||||
glUniform2fv(uv0, 1, v[0]);
|
||||
glUniform2fv(uv1, 1, v[1]);
|
||||
glUniform2fv(uv2, 1, v[2]);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -133,9 +130,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -197,17 +194,15 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
uv0 = glGetUniformLocation_func(program, "v0");
|
||||
uv1 = glGetUniformLocation_func(program, "v1");
|
||||
uv2 = glGetUniformLocation_func(program, "v2");
|
||||
uv0 = glGetUniformLocation(program, "v0");
|
||||
uv1 = glGetUniformLocation(program, "v1");
|
||||
uv2 = glGetUniformLocation(program, "v2");
|
||||
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
@@ -217,9 +212,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -13,10 +13,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -60,11 +57,11 @@ Redisplay(void)
|
||||
glFrontFace(FrontWinding);
|
||||
|
||||
if (DetermineFacingInFragProg) {
|
||||
glUniform1i_func(u_fragface, 1);
|
||||
glUniform1i(u_fragface, 1);
|
||||
glDisable(GL_VERTEX_PROGRAM_TWO_SIDE);
|
||||
}
|
||||
else {
|
||||
glUniform1i_func(u_fragface, 0);
|
||||
glUniform1i(u_fragface, 0);
|
||||
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
|
||||
}
|
||||
|
||||
@@ -76,7 +73,7 @@ Redisplay(void)
|
||||
/* Draw a tristrip ring */
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glColor4fv(Red);
|
||||
glSecondaryColor3fv_func(Green);
|
||||
glSecondaryColor3fv(Green);
|
||||
for (i = 0; i <= sections; i++) {
|
||||
float a = (float) i / (sections) * M_PI * 2.0;
|
||||
float x = radius * cos(a);
|
||||
@@ -126,9 +123,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -230,15 +227,13 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
u_fragface = glGetUniformLocation_func(program, "fragface");
|
||||
u_fragface = glGetUniformLocation(program, "fragface");
|
||||
printf("Uniforms: %d\n", u_fragface);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
@@ -247,9 +242,9 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
assert(glIsProgram(program));
|
||||
assert(glIsShader(fragShader));
|
||||
assert(glIsShader(vertShader));
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
|
@@ -12,10 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -59,14 +56,14 @@ Redisplay(void)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* render with vertex shader only */
|
||||
glUseProgram_func(VertProgram);
|
||||
glUseProgram(VertProgram);
|
||||
glPushMatrix();
|
||||
glTranslatef(-1.5, 0, 0);
|
||||
DrawQuadTex();
|
||||
glPopMatrix();
|
||||
|
||||
/* render with fragment shader only */
|
||||
glUseProgram_func(FragProgram);
|
||||
glUseProgram(FragProgram);
|
||||
glPushMatrix();
|
||||
glTranslatef(+1.5, 0, 0);
|
||||
DrawQuadColor();
|
||||
@@ -91,10 +88,10 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(VertProgram);
|
||||
glDeleteProgram_func(FragProgram);
|
||||
glDeleteShader(FragShader);
|
||||
glDeleteShader(VertShader);
|
||||
glDeleteProgram(VertProgram);
|
||||
glDeleteProgram(FragProgram);
|
||||
glutDestroyWindow(Win);
|
||||
}
|
||||
|
||||
@@ -130,8 +127,6 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
if (FragProgFile)
|
||||
FragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
else
|
||||
@@ -150,10 +145,10 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(VertProgram));
|
||||
assert(glIsProgram_func(FragProgram));
|
||||
assert(glIsShader_func(FragShader));
|
||||
assert(glIsShader_func(VertShader));
|
||||
assert(glIsProgram(VertProgram));
|
||||
assert(glIsProgram(FragProgram));
|
||||
assert(glIsShader(FragShader));
|
||||
assert(glIsShader(VertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
@@ -10,10 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -134,9 +131,9 @@ Reshape(int width, int height)
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glDeleteShader(fragShader);
|
||||
glDeleteShader(vertShader);
|
||||
glDeleteProgram(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
@@ -240,13 +237,11 @@ Init(void)
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
glUseProgram(program);
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
4
progs/tests/.gitignore
vendored
4
progs/tests/.gitignore
vendored
@@ -5,6 +5,7 @@ arbfpspec
|
||||
arbfptest1
|
||||
arbfptexture
|
||||
arbfptrig
|
||||
arbgpuprog
|
||||
arbnpot
|
||||
arbnpot-mipmap
|
||||
arbvptest1
|
||||
@@ -38,6 +39,7 @@ fptest1
|
||||
fptexture
|
||||
getprocaddress
|
||||
getproclist.h
|
||||
getteximage
|
||||
glutfx
|
||||
interleave
|
||||
invert
|
||||
@@ -49,11 +51,13 @@ mapvbo
|
||||
minmag
|
||||
mipgen
|
||||
mipmap_comp
|
||||
mipmap_comp_tests
|
||||
mipmap_limits
|
||||
mipmap_view
|
||||
multipal
|
||||
no_s3tc
|
||||
packedpixels
|
||||
persp_hint
|
||||
pbo
|
||||
prim
|
||||
prog_parameter
|
||||
|
@@ -59,6 +59,7 @@ SOURCES = \
|
||||
minmag.c \
|
||||
mipgen.c \
|
||||
mipmap_comp.c \
|
||||
mipmap_comp_tests.c \
|
||||
mipmap_limits.c \
|
||||
mipmap_view.c \
|
||||
multipal.c \
|
||||
|
@@ -82,6 +82,7 @@ progs = [
|
||||
'minmag',
|
||||
'mipgen',
|
||||
'mipmap_comp',
|
||||
'mipmap_comp_tests',
|
||||
'mipmap_limits',
|
||||
'mipmap_view',
|
||||
'multipal',
|
||||
|
@@ -127,7 +127,7 @@ Init( void )
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||
printf("GL_EXT_framebuffer_object not found!\n");
|
||||
/*exit(0);*/
|
||||
exit(0);
|
||||
}
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
|
318
progs/tests/mipmap_comp_tests.c
Normal file
318
progs/tests/mipmap_comp_tests.c
Normal file
@@ -0,0 +1,318 @@
|
||||
/* Copyright (c) Mark J. Kilgard, 1994. */
|
||||
/*
|
||||
* (c) Copyright 1993, Silicon Graphics, Inc.
|
||||
* ALL RIGHTS RESERVED
|
||||
* Permission to use, copy, modify, and distribute this software for
|
||||
* any purpose and without fee is hereby granted, provided that the above
|
||||
* copyright notice appear in all copies and that both the copyright notice
|
||||
* and this permission notice appear in supporting documentation, and that
|
||||
* the name of Silicon Graphics, Inc. not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission.
|
||||
*
|
||||
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
||||
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
||||
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
||||
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
||||
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
* Use, duplication, or disclosure by the Government is subject to
|
||||
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
||||
* clause at DFARS 252.227-7013 and/or in similar or successor
|
||||
* clauses in the FAR or the DOD or NASA FAR Supplement.
|
||||
* Unpublished-- rights reserved under the copyright laws of the
|
||||
* United States. Contractor/manufacturer is Silicon Graphics,
|
||||
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
||||
*
|
||||
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
/* mipmap_comp
|
||||
* Test compressed texture mipmaps
|
||||
*
|
||||
* Based on mipmap_limits
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define SIZE 16 /* not larger then 16 */
|
||||
|
||||
static GLint BaseLevel = 0, MaxLevel ;
|
||||
static GLfloat MinLod, MaxLod;
|
||||
static GLfloat LodBias;
|
||||
static GLboolean NearestFilter;
|
||||
static GLuint texImage;
|
||||
static GLuint View;
|
||||
|
||||
struct view {
|
||||
GLfloat minLod;
|
||||
GLfloat maxLod;
|
||||
const char *string;
|
||||
};
|
||||
|
||||
static struct view views[] =
|
||||
{
|
||||
{ 0, 0, "Green" },
|
||||
{ 0, 1, "Green, Red" },
|
||||
{ 0, 2, "Green, Red, Blue" },
|
||||
{ 0, 3, "Green, Red, Blue, Black" },
|
||||
{ 0, 4, "Green, Red, Blue, Black, White" },
|
||||
{ 1, 4, "Red, Blue, Black, White" },
|
||||
{ 2, 4, "Blue, Black, White" },
|
||||
{ 3, 4, "Black, White" },
|
||||
{ 4, 4, "White" },
|
||||
{ 3, 3, "Black" },
|
||||
{ 2, 2, "Blue" },
|
||||
{ 1, 1, "Red" },
|
||||
{ 1, 3, "Red, Blue, Black" },
|
||||
{ 1, 2, "Red, Blue" },
|
||||
{ 2, 3, "Blue, Black" },
|
||||
{ 0, 0, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
initValues(void)
|
||||
{
|
||||
View = 12;
|
||||
BaseLevel = 0;
|
||||
MaxLevel = 9;
|
||||
MinLod = views[View].minLod;
|
||||
MaxLod = views[View].maxLod;
|
||||
LodBias = 5.0;
|
||||
NearestFilter = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
changeView(void)
|
||||
{
|
||||
if (views[++View].string == NULL)
|
||||
View = 0;
|
||||
|
||||
MinLod = views[View].minLod;
|
||||
MaxLod = views[View].maxLod;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
makeImage(int level, int width, int height)
|
||||
{
|
||||
GLubyte img[SIZE*SIZE*3];
|
||||
GLubyte color[5][3] = {
|
||||
{ 0, 255, 0 },
|
||||
{ 255, 0, 0 },
|
||||
{ 0, 0, 255 },
|
||||
{ 0, 0, 0 },
|
||||
{ 255, 255, 255 },
|
||||
};
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j++) {
|
||||
int k = (i * width + j) * 3;
|
||||
img[k + 0] = color[level][0];
|
||||
img[k + 1] = color[level][1];
|
||||
img[k + 2] = color[level][2];
|
||||
}
|
||||
}
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, level,
|
||||
GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
||||
width, height, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, img);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
makeImages(void)
|
||||
{
|
||||
int i, sz;
|
||||
|
||||
for (i = 0, sz = SIZE; sz >= 1; i++, sz /= 2) {
|
||||
makeImage(i, sz, sz);
|
||||
printf("Level %d size: %d x %d\n", i, sz, sz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
myInit(void)
|
||||
{
|
||||
|
||||
initValues();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glTranslatef(0.0, 0.0, -3.6);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glGenTextures(1, &texImage);
|
||||
glBindTexture(GL_TEXTURE_2D, texImage);
|
||||
makeImages();
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
display(void)
|
||||
{
|
||||
GLfloat tcm = 1.0;
|
||||
glBindTexture(GL_TEXTURE_2D, texImage);
|
||||
|
||||
printf("BASE_LEVEL=%d MAX_LEVEL=%d MIN_LOD=%.2g MAX_LOD=%.2g Bias=%.2g Filter=%s\n",
|
||||
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
|
||||
NearestFilter ? "NEAREST" : "LINEAR");
|
||||
printf("You should see: %s\n", views[View].string );
|
||||
fflush(stdout);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, MinLod);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, MaxLod);
|
||||
|
||||
if (NearestFilter) {
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_NEAREST_MIPMAP_NEAREST);
|
||||
}
|
||||
else {
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_LINEAR_MIPMAP_LINEAR);
|
||||
}
|
||||
|
||||
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, LodBias);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0);
|
||||
glTexCoord2f(0.0, tcm); glVertex3f(-2.0, 1.0, 0.0);
|
||||
glTexCoord2f(tcm * 3000.0, tcm); glVertex3f(3000.0, 1.0, -6000.0);
|
||||
glTexCoord2f(tcm * 3000.0, 0.0); glVertex3f(3000.0, -1.0, -6000.0);
|
||||
glEnd();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
myReshape(int w, int h)
|
||||
{
|
||||
glViewport(0, 0, w, h);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
key(unsigned char k, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (k) {
|
||||
#if 0
|
||||
case 'b':
|
||||
BaseLevel--;
|
||||
if (BaseLevel < 0)
|
||||
BaseLevel = 0;
|
||||
break;
|
||||
case 'B':
|
||||
BaseLevel++;
|
||||
if (BaseLevel > 10)
|
||||
BaseLevel = 10;
|
||||
break;
|
||||
case 'm':
|
||||
MaxLevel--;
|
||||
if (MaxLevel < 0)
|
||||
MaxLevel = 0;
|
||||
break;
|
||||
case 'M':
|
||||
MaxLevel++;
|
||||
if (MaxLevel > 10)
|
||||
MaxLevel = 10;
|
||||
break;
|
||||
case 'l':
|
||||
LodBias -= 0.25;
|
||||
break;
|
||||
case 'L':
|
||||
LodBias += 0.25;
|
||||
break;
|
||||
case 'n':
|
||||
MinLod -= 0.25;
|
||||
break;
|
||||
case 'N':
|
||||
MinLod += 0.25;
|
||||
break;
|
||||
case 'x':
|
||||
MaxLod -= 0.25;
|
||||
break;
|
||||
case 'X':
|
||||
MaxLod += 0.25;
|
||||
break;
|
||||
case 'f':
|
||||
NearestFilter = !NearestFilter;
|
||||
break;
|
||||
#endif
|
||||
case ' ':
|
||||
initValues();
|
||||
break;
|
||||
case 27: /* Escape */
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
changeView();
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("usage:\n");
|
||||
printf(" Any Change view\n");
|
||||
printf(" SPACE reset values\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
|
||||
glutInitWindowSize (600, 600);
|
||||
glutCreateWindow (argv[0]);
|
||||
glewInit();
|
||||
myInit();
|
||||
glutReshapeFunc (myReshape);
|
||||
glutDisplayFunc(display);
|
||||
glutKeyboardFunc(key);
|
||||
usage();
|
||||
glutMainLoop();
|
||||
return 0; /* ANSI C requires main to return int. */
|
||||
}
|
@@ -258,8 +258,26 @@ static void Init( void )
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE);
|
||||
#ifdef TEST_PBO_DLIST
|
||||
/* test fetching teximage from PBO in display list */
|
||||
{
|
||||
GLuint b = 42, l = 10;
|
||||
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, b);
|
||||
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER, sizeof(BorderImage),
|
||||
BorderImage, GL_STREAM_DRAW);
|
||||
|
||||
glNewList(l, GL_COMPILE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, (void *) 0/* BorderImage*/);
|
||||
glEndList();
|
||||
glCallList(l);
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
}
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < SIZE; i++) {
|
||||
for (j = 0; j < SIZE; j++) {
|
||||
|
15
progs/trivial/.gitignore
vendored
15
progs/trivial/.gitignore
vendored
@@ -5,10 +5,17 @@ clear-random
|
||||
clear-repeat
|
||||
clear-scissor
|
||||
clear-undefined
|
||||
createwin
|
||||
dlist-begin-call-end
|
||||
dlist-dangling
|
||||
dlist-degenerate
|
||||
dlist-edgeflag
|
||||
dlist-edgeflag-dangling
|
||||
dlist-flat-tri
|
||||
dlist-mat-tri
|
||||
dlist-recursive-call
|
||||
dlist-tri-flat-tri
|
||||
dlist-tri-mat-tri
|
||||
draw2arrays
|
||||
drawarrays
|
||||
drawelements
|
||||
@@ -30,6 +37,7 @@ lineloop
|
||||
lineloop-clip
|
||||
lineloop-elts
|
||||
linestrip
|
||||
linestrip-clip
|
||||
linestrip-flat-stipple
|
||||
linestrip-stipple
|
||||
linestrip-stipple-wide
|
||||
@@ -70,8 +78,10 @@ quadstrip-cont
|
||||
quadstrip-flat
|
||||
readtex.c
|
||||
readtex.h
|
||||
readpixels
|
||||
tri
|
||||
tri-alpha
|
||||
tri-alpha-tex
|
||||
tri-array-interleaved
|
||||
tri-blend
|
||||
tri-blend-color
|
||||
@@ -79,6 +89,7 @@ tri-blend-max
|
||||
tri-blend-min
|
||||
tri-blend-revsub
|
||||
tri-blend-sub
|
||||
tri-clear
|
||||
tri-clip
|
||||
tri-cull
|
||||
tri-cull-both
|
||||
@@ -93,6 +104,7 @@ tri-fog
|
||||
tri-fp
|
||||
tri-fp-const-imm
|
||||
tri-lit
|
||||
tri-lit-material
|
||||
tri-logicop-none
|
||||
tri-logicop-xor
|
||||
tri-mask-tri
|
||||
@@ -101,6 +113,7 @@ tri-orig
|
||||
tri-query
|
||||
tri-repeat
|
||||
tri-scissor-tri
|
||||
tri-square
|
||||
tri-stencil
|
||||
tri-stipple
|
||||
tri-tex
|
||||
@@ -110,6 +123,7 @@ tri-unfilled
|
||||
tri-unfilled-clip
|
||||
tri-unfilled-edgeflag
|
||||
tri-unfilled-fog
|
||||
tri-unfilled-point
|
||||
tri-unfilled-smooth
|
||||
tri-unfilled-tri
|
||||
tri-unfilled-tri-lit
|
||||
@@ -118,6 +132,7 @@ tri-unfilled-userclip-stip
|
||||
tri-userclip
|
||||
tri-viewport
|
||||
tri-z
|
||||
tri-z-9
|
||||
tri-z-eq
|
||||
trifan
|
||||
trifan-flat
|
||||
|
@@ -18,6 +18,7 @@ SOURCES = \
|
||||
clear-repeat.c \
|
||||
clear-random.c \
|
||||
clear.c \
|
||||
createwin.c \
|
||||
dlist-dangling.c \
|
||||
dlist-flat-tri.c \
|
||||
dlist-mat-tri.c \
|
||||
@@ -48,6 +49,7 @@ SOURCES = \
|
||||
lineloop-clip.c \
|
||||
lineloop-elts.c \
|
||||
lineloop.c \
|
||||
linestrip-clip.c \
|
||||
linestrip-flat-stipple.c \
|
||||
linestrip-stipple-wide.c \
|
||||
linestrip-stipple.c \
|
||||
@@ -87,7 +89,9 @@ SOURCES = \
|
||||
quadstrip-cont.c \
|
||||
quadstrip-flat.c \
|
||||
quadstrip.c \
|
||||
readpixels.c \
|
||||
tri-alpha.c \
|
||||
tri-alpha-tex.c \
|
||||
tri-array-interleaved.c \
|
||||
tri-blend-color.c \
|
||||
tri-blend-max.c \
|
||||
@@ -95,6 +99,7 @@ SOURCES = \
|
||||
tri-blend-revsub.c \
|
||||
tri-blend-sub.c \
|
||||
tri-blend.c \
|
||||
tri-clear.c \
|
||||
tri-clip.c \
|
||||
tri-cull-both.c \
|
||||
tri-cull.c \
|
||||
@@ -117,6 +122,7 @@ SOURCES = \
|
||||
tri-query.c \
|
||||
tri-repeat.c \
|
||||
tri-scissor-tri.c \
|
||||
tri-square.c \
|
||||
tri-stencil.c \
|
||||
tri-stipple.c \
|
||||
tri-multitex-vbo.c \
|
||||
@@ -126,6 +132,7 @@ SOURCES = \
|
||||
tri-unfilled-fog.c \
|
||||
tri-unfilled-edgeflag.c \
|
||||
tri-unfilled-clip.c \
|
||||
tri-unfilled-point.c \
|
||||
tri-unfilled-smooth.c \
|
||||
tri-unfilled-tri.c \
|
||||
tri-unfilled-tri-lit.c \
|
||||
@@ -134,6 +141,7 @@ SOURCES = \
|
||||
tri-unfilled.c \
|
||||
tri-userclip.c \
|
||||
tri-viewport.c \
|
||||
tri-z-9.c \
|
||||
tri-z-eq.c \
|
||||
tri-z.c \
|
||||
tri.c \
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
@@ -20,7 +19,6 @@ Init(void)
|
||||
{
|
||||
static GLboolean firstCall = GL_TRUE;
|
||||
if (firstCall) {
|
||||
GetExtensionFuncs();
|
||||
firstCall = GL_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -51,14 +49,14 @@ CompileShaderText(GLenum shaderType, const char *text)
|
||||
|
||||
Init();
|
||||
|
||||
shader = glCreateShader_func(shaderType);
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
glCompileShader_func(shader);
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
shader = glCreateShader(shaderType);
|
||||
glShaderSource(shader, 1, (const GLchar **) &text, NULL);
|
||||
glCompileShader(shader);
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "Error: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
@@ -110,24 +108,24 @@ CompileShaderFile(GLenum shaderType, const char *filename)
|
||||
GLuint
|
||||
LinkShaders(GLuint vertShader, GLuint fragShader)
|
||||
{
|
||||
GLuint program = glCreateProgram_func();
|
||||
GLuint program = glCreateProgram();
|
||||
|
||||
assert(vertShader || fragShader);
|
||||
|
||||
if (fragShader)
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader(program, fragShader);
|
||||
if (vertShader)
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
glAttachShader(program, vertShader);
|
||||
glLinkProgram(program);
|
||||
|
||||
/* check link */
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(program, GL_LINK_STATUS, &stat);
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(program, 1000, &len, log);
|
||||
glGetProgramInfoLog(program, 1000, &len, log);
|
||||
fprintf(stderr, "Shader link error:\n%s\n", log);
|
||||
return 0;
|
||||
}
|
||||
@@ -144,7 +142,7 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
|
||||
|
||||
for (i = 0; uniforms[i].name; i++) {
|
||||
uniforms[i].location
|
||||
= glGetUniformLocation_func(program, uniforms[i].name);
|
||||
= glGetUniformLocation(program, uniforms[i].name);
|
||||
|
||||
printf("Uniform %s location: %d\n", uniforms[i].name,
|
||||
uniforms[i].location);
|
||||
@@ -152,19 +150,19 @@ InitUniforms(GLuint program, struct uniform_info uniforms[])
|
||||
switch (uniforms[i].size) {
|
||||
case 1:
|
||||
if (uniforms[i].type == GL_INT)
|
||||
glUniform1i_func(uniforms[i].location,
|
||||
glUniform1i(uniforms[i].location,
|
||||
(GLint) uniforms[i].value[0]);
|
||||
else
|
||||
glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
glUniform1fv(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
glUniform2fv(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
glUniform3fv(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
glUniform4fv(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
|
@@ -378,6 +378,9 @@ make_window( Display *dpy, const char *name,
|
||||
scrnum = DefaultScreen( dpy );
|
||||
root = RootWindow( dpy, scrnum );
|
||||
|
||||
if (visinfo)
|
||||
XFree(visinfo);
|
||||
|
||||
visinfo = glXChooseVisual( dpy, scrnum, attribs );
|
||||
if (!visinfo) {
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
|
@@ -587,6 +587,9 @@ event_loop(Display *dpy, Window win)
|
||||
angle += 2.0;
|
||||
|
||||
draw();
|
||||
|
||||
glXSwapBuffers(dpy, win);
|
||||
|
||||
if ( get_frame_usage != NULL ) {
|
||||
GLfloat temp;
|
||||
|
||||
@@ -594,8 +597,6 @@ event_loop(Display *dpy, Window win)
|
||||
frame_usage += temp;
|
||||
}
|
||||
|
||||
glXSwapBuffers(dpy, win);
|
||||
|
||||
/* calc framerate */
|
||||
{
|
||||
static int t0 = -1;
|
||||
|
27
scons/fixes.py
Normal file
27
scons/fixes.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import sys
|
||||
|
||||
# Monkey patch os.spawnve on windows to become thread safe
|
||||
if sys.platform == 'win32':
|
||||
import os
|
||||
import threading
|
||||
from os import spawnve as old_spawnve
|
||||
|
||||
spawn_lock = threading.Lock()
|
||||
|
||||
def new_spawnve(mode, file, args, env):
|
||||
spawn_lock.acquire()
|
||||
try:
|
||||
if mode == os.P_WAIT:
|
||||
ret = old_spawnve(os.P_NOWAIT, file, args, env)
|
||||
else:
|
||||
ret = old_spawnve(mode, file, args, env)
|
||||
finally:
|
||||
spawn_lock.release()
|
||||
if mode == os.P_WAIT:
|
||||
pid, status = os.waitpid(ret, 0)
|
||||
ret = status >> 8
|
||||
return ret
|
||||
|
||||
os.spawnve = new_spawnve
|
||||
|
||||
|
@@ -38,6 +38,8 @@ import SCons.Action
|
||||
import SCons.Builder
|
||||
import SCons.Scanner
|
||||
|
||||
import fixes
|
||||
|
||||
|
||||
def quietCommandLines(env):
|
||||
# Quiet command lines
|
||||
|
@@ -4,7 +4,7 @@ TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main
|
||||
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main $(X11_INCLUDES)
|
||||
|
||||
|
||||
SOURCES = demo.c
|
||||
|
@@ -4,7 +4,7 @@ TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi
|
||||
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi $(X11_INCLUDES)
|
||||
|
||||
HEADERS = \
|
||||
eglconfig.h \
|
||||
|
@@ -158,6 +158,60 @@ static void do_triangle( struct draw_context *draw,
|
||||
|
||||
|
||||
|
||||
#define QUAD(i0,i1,i2,i3) \
|
||||
do_triangle( draw, \
|
||||
( DRAW_PIPE_RESET_STIPPLE | \
|
||||
DRAW_PIPE_EDGE_FLAG_0 | \
|
||||
DRAW_PIPE_EDGE_FLAG_2 ), \
|
||||
verts + stride * elts[i0], \
|
||||
verts + stride * elts[i1], \
|
||||
verts + stride * elts[i3]); \
|
||||
do_triangle( draw, \
|
||||
( DRAW_PIPE_EDGE_FLAG_0 | \
|
||||
DRAW_PIPE_EDGE_FLAG_1 ), \
|
||||
verts + stride * elts[i1], \
|
||||
verts + stride * elts[i2], \
|
||||
verts + stride * elts[i3])
|
||||
|
||||
#define TRIANGLE(flags,i0,i1,i2) \
|
||||
do_triangle( draw, \
|
||||
elts[i0], /* flags */ \
|
||||
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
|
||||
verts + stride * elts[i1], \
|
||||
verts + stride * elts[i2])
|
||||
|
||||
#define LINE(flags,i0,i1) \
|
||||
do_line( draw, \
|
||||
elts[i0], \
|
||||
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
|
||||
verts + stride * elts[i1])
|
||||
|
||||
#define POINT(i0) \
|
||||
do_point( draw, \
|
||||
verts + stride * elts[i0] )
|
||||
|
||||
#define FUNC pipe_run
|
||||
#define ARGS \
|
||||
struct draw_context *draw, \
|
||||
unsigned prim, \
|
||||
struct vertex_header *vertices, \
|
||||
unsigned stride, \
|
||||
const ushort *elts
|
||||
|
||||
#define LOCAL_VARS \
|
||||
char *verts = (char *)vertices; \
|
||||
boolean flatfirst = (draw->rasterizer->flatshade && \
|
||||
draw->rasterizer->flatshade_first); \
|
||||
unsigned i; \
|
||||
ushort flags
|
||||
|
||||
#define FLUSH
|
||||
|
||||
#include "draw_pt_decompose.h"
|
||||
#undef ARGS
|
||||
#undef LOCAL_VARS
|
||||
|
||||
|
||||
|
||||
/* Code to run the pipeline on a fairly arbitary collection of vertices.
|
||||
*
|
||||
@@ -178,34 +232,12 @@ void draw_pipeline_run( struct draw_context *draw,
|
||||
unsigned count )
|
||||
{
|
||||
char *verts = (char *)vertices;
|
||||
unsigned i;
|
||||
|
||||
draw->pipeline.verts = verts;
|
||||
draw->pipeline.vertex_stride = stride;
|
||||
draw->pipeline.vertex_count = vertex_count;
|
||||
|
||||
switch (prim) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
for (i = 0; i < count; i++)
|
||||
do_point( draw,
|
||||
verts + stride * elts[i] );
|
||||
break;
|
||||
case PIPE_PRIM_LINES:
|
||||
for (i = 0; i+1 < count; i += 2)
|
||||
do_line( draw,
|
||||
elts[i+0], /* flags */
|
||||
verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK),
|
||||
verts + stride * elts[i+1]);
|
||||
break;
|
||||
case PIPE_PRIM_TRIANGLES:
|
||||
for (i = 0; i+2 < count; i += 3)
|
||||
do_triangle( draw,
|
||||
elts[i+0], /* flags */
|
||||
verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK),
|
||||
verts + stride * elts[i+1],
|
||||
verts + stride * elts[i+2]);
|
||||
break;
|
||||
}
|
||||
pipe_run(draw, prim, vertices, stride, elts, count);
|
||||
|
||||
draw->pipeline.verts = NULL;
|
||||
draw->pipeline.vertex_count = 0;
|
||||
|
@@ -477,6 +477,8 @@ tgsi_default_full_instruction( void )
|
||||
full_instruction.FullSrcRegisters[i] = tgsi_default_full_src_register();
|
||||
}
|
||||
|
||||
full_instruction.Flags = 0x0;
|
||||
|
||||
return full_instruction;
|
||||
}
|
||||
|
||||
|
@@ -62,6 +62,9 @@
|
||||
|
||||
#define FAST_MATH 1
|
||||
|
||||
/** for tgsi_full_instruction::Flags */
|
||||
#define SOA_DEPENDENCY_FLAG 0x1
|
||||
|
||||
#define TILE_TOP_LEFT 0
|
||||
#define TILE_TOP_RIGHT 1
|
||||
#define TILE_BOTTOM_LEFT 2
|
||||
@@ -182,7 +185,7 @@ print_temp(const struct tgsi_exec_machine *mach, uint index)
|
||||
* MOV t3, t2;
|
||||
* The second instruction will have the wrong value for t0 if executed as-is.
|
||||
*/
|
||||
static boolean
|
||||
boolean
|
||||
tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
|
||||
{
|
||||
uint i, chan;
|
||||
@@ -328,20 +331,25 @@ tgsi_exec_machine_bind_shader(
|
||||
* sizeof(struct tgsi_full_instruction));
|
||||
maxInstructions += 10;
|
||||
}
|
||||
|
||||
if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
|
||||
uint opcode = parse.FullToken.FullInstruction.Instruction.Opcode;
|
||||
parse.FullToken.FullInstruction.Flags = SOA_DEPENDENCY_FLAG;
|
||||
/* XXX we only handle SOA dependencies properly for MOV/SWZ
|
||||
* at this time!
|
||||
*/
|
||||
if (opcode != TGSI_OPCODE_MOV && opcode != TGSI_OPCODE_SWZ) {
|
||||
debug_printf("Warning: SOA dependency in instruction"
|
||||
" is not handled:\n");
|
||||
tgsi_dump_instruction(&parse.FullToken.FullInstruction,
|
||||
numInstructions);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(instructions + numInstructions,
|
||||
&parse.FullToken.FullInstruction,
|
||||
sizeof(instructions[0]));
|
||||
|
||||
#if 0
|
||||
if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) {
|
||||
debug_printf("SOA dependency in instruction:\n");
|
||||
tgsi_dump_instruction(&parse.FullToken.FullInstruction,
|
||||
numInstructions);
|
||||
}
|
||||
#else
|
||||
(void) tgsi_check_soa_dependencies;
|
||||
#endif
|
||||
|
||||
numInstructions++;
|
||||
break;
|
||||
|
||||
@@ -2018,9 +2026,23 @@ exec_instruction(
|
||||
|
||||
case TGSI_OPCODE_MOV:
|
||||
case TGSI_OPCODE_SWZ:
|
||||
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
|
||||
FETCH( &r[0], 0, chan_index );
|
||||
STORE( &r[0], 0, chan_index );
|
||||
if (inst->Flags & SOA_DEPENDENCY_FLAG) {
|
||||
/* Do all fetches into temp regs, then do all stores to avoid
|
||||
* intermediate/accidental clobbering. This could be done all the
|
||||
* time for MOV but for other instructions we'll need more temps...
|
||||
*/
|
||||
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
|
||||
FETCH( &r[chan_index], 0, chan_index );
|
||||
}
|
||||
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
|
||||
STORE( &r[chan_index], 0, chan_index );
|
||||
}
|
||||
}
|
||||
else {
|
||||
FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
|
||||
FETCH( &r[0], 0, chan_index );
|
||||
STORE( &r[0], 0, chan_index );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -272,6 +272,10 @@ void
|
||||
tgsi_exec_machine_free_data(struct tgsi_exec_machine *mach);
|
||||
|
||||
|
||||
boolean
|
||||
tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst);
|
||||
|
||||
|
||||
static INLINE void
|
||||
tgsi_set_kill_mask(struct tgsi_exec_machine *mach, unsigned mask)
|
||||
{
|
||||
|
@@ -91,6 +91,7 @@ struct tgsi_full_instruction
|
||||
struct tgsi_instruction_ext_texture InstructionExtTexture;
|
||||
struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS];
|
||||
struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS];
|
||||
uint Flags; /**< user-defined usage */
|
||||
};
|
||||
|
||||
union tgsi_full_token
|
||||
|
@@ -1107,6 +1107,15 @@ static int
|
||||
emit_instruction(struct gen_context *gen,
|
||||
struct tgsi_full_instruction *inst)
|
||||
{
|
||||
|
||||
/* we don't handle saturation/clamping yet */
|
||||
if (inst->Instruction.Saturate != TGSI_SAT_NONE)
|
||||
return 0;
|
||||
|
||||
/* need to use extra temps to fix SOA dependencies : */
|
||||
if (tgsi_check_soa_dependencies(inst))
|
||||
return FALSE;
|
||||
|
||||
switch (inst->Instruction.Opcode) {
|
||||
case TGSI_OPCODE_MOV:
|
||||
case TGSI_OPCODE_SWZ:
|
||||
|
@@ -1502,6 +1502,14 @@ emit_instruction(
|
||||
if (indirect_temp_reference(inst))
|
||||
return FALSE;
|
||||
|
||||
/* we don't handle saturation/clamping yet */
|
||||
if (inst->Instruction.Saturate != TGSI_SAT_NONE)
|
||||
return FALSE;
|
||||
|
||||
/* need to use extra temps to fix SOA dependencies : */
|
||||
if (tgsi_check_soa_dependencies(inst))
|
||||
return FALSE;
|
||||
|
||||
switch (inst->Instruction.Opcode) {
|
||||
case TGSI_OPCODE_ARL:
|
||||
FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) {
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include "util/u_math.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_simple_shaders.h"
|
||||
#include "util/u_surface.h"
|
||||
|
||||
#include "cso_cache/cso_context.h"
|
||||
|
||||
@@ -61,7 +62,7 @@ struct blit_state
|
||||
struct pipe_viewport_state viewport;
|
||||
|
||||
void *vs;
|
||||
void *fs;
|
||||
void *fs[TGSI_WRITEMASK_XYZW + 1];
|
||||
|
||||
struct pipe_buffer *vbuf; /**< quad vertices */
|
||||
unsigned vbuf_slot;
|
||||
@@ -124,7 +125,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
|
||||
}
|
||||
|
||||
/* fragment shader */
|
||||
ctx->fs = util_make_fragment_tex_shader(pipe);
|
||||
ctx->fs[TGSI_WRITEMASK_XYZW] = util_make_fragment_tex_shader(pipe);
|
||||
ctx->vbuf = NULL;
|
||||
|
||||
/* init vertex data that doesn't change */
|
||||
@@ -145,9 +146,13 @@ void
|
||||
util_destroy_blit(struct blit_state *ctx)
|
||||
{
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
unsigned i;
|
||||
|
||||
pipe->delete_vs_state(pipe, ctx->vs);
|
||||
pipe->delete_fs_state(pipe, ctx->fs);
|
||||
|
||||
for (i = 0; i < Elements(ctx->fs); i++)
|
||||
if (ctx->fs[i])
|
||||
pipe->delete_fs_state(pipe, ctx->fs[i]);
|
||||
|
||||
pipe_buffer_reference(&ctx->vbuf, NULL);
|
||||
|
||||
@@ -155,7 +160,11 @@ util_destroy_blit(struct blit_state *ctx)
|
||||
}
|
||||
|
||||
|
||||
static unsigned get_next_slot( struct blit_state *ctx )
|
||||
/**
|
||||
* Get offset of next free slot in vertex buffer for quad vertices.
|
||||
*/
|
||||
static unsigned
|
||||
get_next_slot( struct blit_state *ctx )
|
||||
{
|
||||
const unsigned max_slots = 4096 / sizeof ctx->vertices;
|
||||
|
||||
@@ -173,7 +182,6 @@ static unsigned get_next_slot( struct blit_state *ctx )
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Setup vertex data for the textured quad we'll draw.
|
||||
* Note: y=0=top
|
||||
@@ -260,20 +268,50 @@ setup_vertex_data_tex(struct blit_state *ctx,
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \return TRUE if two regions overlap, FALSE otherwise
|
||||
*/
|
||||
static boolean
|
||||
regions_overlap(int srcX0, int srcY0,
|
||||
int srcX1, int srcY1,
|
||||
int dstX0, int dstY0,
|
||||
int dstX1, int dstY1)
|
||||
{
|
||||
if (MAX2(srcX0, srcX1) < MIN2(dstX0, dstX1))
|
||||
return FALSE; /* src completely left of dst */
|
||||
|
||||
if (MAX2(dstX0, dstX1) < MIN2(srcX0, srcX1))
|
||||
return FALSE; /* dst completely left of src */
|
||||
|
||||
if (MAX2(srcY0, srcY1) < MIN2(dstY0, dstY1))
|
||||
return FALSE; /* src completely above dst */
|
||||
|
||||
if (MAX2(dstY0, dstY1) < MIN2(srcY0, srcY1))
|
||||
return FALSE; /* dst completely above src */
|
||||
|
||||
return TRUE; /* some overlap */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy pixel block from src surface to dst surface.
|
||||
* Overlapping regions are acceptable.
|
||||
* Flipping and stretching are supported.
|
||||
* XXX what about clipping???
|
||||
* XXX need some control over blitting Z and/or stencil.
|
||||
*/
|
||||
void
|
||||
util_blit_pixels(struct blit_state *ctx,
|
||||
struct pipe_surface *src,
|
||||
int srcX0, int srcY0,
|
||||
int srcX1, int srcY1,
|
||||
struct pipe_surface *dst,
|
||||
int dstX0, int dstY0,
|
||||
int dstX1, int dstY1,
|
||||
float z, uint filter)
|
||||
util_blit_pixels_writemask(struct blit_state *ctx,
|
||||
struct pipe_surface *src,
|
||||
int srcX0, int srcY0,
|
||||
int srcX1, int srcY1,
|
||||
struct pipe_surface *dst,
|
||||
int dstX0, int dstY0,
|
||||
int dstX1, int dstY1,
|
||||
float z, uint filter,
|
||||
uint writemask)
|
||||
{
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
struct pipe_screen *screen = pipe->screen;
|
||||
@@ -285,10 +323,41 @@ util_blit_pixels(struct blit_state *ctx,
|
||||
const int srcLeft = MIN2(srcX0, srcX1);
|
||||
const int srcTop = MIN2(srcY0, srcY1);
|
||||
unsigned offset;
|
||||
boolean overlap;
|
||||
|
||||
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
|
||||
filter == PIPE_TEX_MIPFILTER_LINEAR);
|
||||
|
||||
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_SAMPLER, 0));
|
||||
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
|
||||
|
||||
/* do the regions overlap? */
|
||||
overlap = util_same_surface(src, dst) &&
|
||||
regions_overlap(srcX0, srcY0, srcX1, srcY1,
|
||||
dstX0, dstY0, dstX1, dstY1);
|
||||
|
||||
/*
|
||||
* Check for simple case: no format conversion, no flipping, no stretching,
|
||||
* no overlapping.
|
||||
* Filter mode should not matter since there's no stretching.
|
||||
*/
|
||||
if (dst->format == src->format &&
|
||||
srcX0 < srcX1 &&
|
||||
dstX0 < dstX1 &&
|
||||
srcY0 < srcY1 &&
|
||||
dstY0 < dstY1 &&
|
||||
(dstX1 - dstX0) == (srcX1 - srcX0) &&
|
||||
(dstY1 - dstY0) == (srcY1 - srcY0) &&
|
||||
!overlap) {
|
||||
pipe->surface_copy(pipe,
|
||||
dst, dstX0, dstY0, /* dest */
|
||||
src, srcX0, srcY0, /* src */
|
||||
srcW, srcH); /* size */
|
||||
return;
|
||||
}
|
||||
|
||||
if (srcLeft != srcX0) {
|
||||
/* left-right flip */
|
||||
int tmp = dstX0;
|
||||
@@ -303,20 +372,6 @@ util_blit_pixels(struct blit_state *ctx,
|
||||
dstY1 = tmp;
|
||||
}
|
||||
|
||||
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_SAMPLER, 0));
|
||||
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_SAMPLER, 0));
|
||||
|
||||
if(dst->format == src->format && (dstX1 - dstX0) == srcW && (dstY1 - dstY0) == srcH) {
|
||||
/* FIXME: this will most surely fail for overlapping rectangles */
|
||||
pipe->surface_copy(pipe,
|
||||
dst, dstX0, dstY0, /* dest */
|
||||
src, srcX0, srcY0, /* src */
|
||||
srcW, srcH); /* size */
|
||||
return;
|
||||
}
|
||||
|
||||
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
|
||||
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
|
||||
|
||||
@@ -376,8 +431,11 @@ util_blit_pixels(struct blit_state *ctx,
|
||||
/* texture */
|
||||
cso_set_sampler_textures(ctx->cso, 1, &tex);
|
||||
|
||||
if (ctx->fs[writemask] == NULL)
|
||||
ctx->fs[writemask] = util_make_fragment_tex_shader_writemask(pipe, writemask);
|
||||
|
||||
/* shaders */
|
||||
cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
|
||||
cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]);
|
||||
cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
|
||||
|
||||
/* drawing dest */
|
||||
@@ -412,6 +470,27 @@ util_blit_pixels(struct blit_state *ctx,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
util_blit_pixels(struct blit_state *ctx,
|
||||
struct pipe_surface *src,
|
||||
int srcX0, int srcY0,
|
||||
int srcX1, int srcY1,
|
||||
struct pipe_surface *dst,
|
||||
int dstX0, int dstY0,
|
||||
int dstX1, int dstY1,
|
||||
float z, uint filter )
|
||||
{
|
||||
util_blit_pixels_writemask( ctx, src,
|
||||
srcX0, srcY0,
|
||||
srcX1, srcY1,
|
||||
dst,
|
||||
dstX0, dstY0,
|
||||
dstX1, dstY1,
|
||||
z, filter,
|
||||
TGSI_WRITEMASK_XYZW );
|
||||
}
|
||||
|
||||
|
||||
/* Release vertex buffer at end of frame to avoid synchronous
|
||||
* rendering.
|
||||
*/
|
||||
@@ -485,7 +564,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
|
||||
cso_set_sampler_textures(ctx->cso, 1, &tex);
|
||||
|
||||
/* shaders */
|
||||
cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
|
||||
cso_set_fragment_shader_handle(ctx->cso, ctx->fs[TGSI_WRITEMASK_XYZW]);
|
||||
cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
|
||||
|
||||
/* drawing dest */
|
||||
|
@@ -60,6 +60,17 @@ util_blit_pixels(struct blit_state *ctx,
|
||||
int dstX1, int dstY1,
|
||||
float z, uint filter);
|
||||
|
||||
void
|
||||
util_blit_pixels_writemask(struct blit_state *ctx,
|
||||
struct pipe_surface *src,
|
||||
int srcX0, int srcY0,
|
||||
int srcX1, int srcY1,
|
||||
struct pipe_surface *dst,
|
||||
int dstX0, int dstY0,
|
||||
int dstX1, int dstY1,
|
||||
float z, uint filter,
|
||||
uint writemask);
|
||||
|
||||
extern void
|
||||
util_blit_pixels_tex(struct blit_state *ctx,
|
||||
struct pipe_texture *tex,
|
||||
|
@@ -143,11 +143,9 @@ void _debug_vprintf(const char *format, va_list ap)
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT)
|
||||
/* TODO */
|
||||
#else /* !PIPE_SUBSYSTEM_WINDOWS */
|
||||
#ifdef DEBUG
|
||||
fflush(stdout);
|
||||
vfprintf(stderr, format, ap);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@@ -921,11 +921,19 @@ static void
|
||||
format_to_type_comps(enum pipe_format pformat,
|
||||
enum dtype *datatype, uint *comps)
|
||||
{
|
||||
/* XXX I think this could be implemented in terms of the pf_*() functions */
|
||||
switch (pformat) {
|
||||
case PIPE_FORMAT_A8R8G8B8_UNORM:
|
||||
case PIPE_FORMAT_X8R8G8B8_UNORM:
|
||||
case PIPE_FORMAT_B8G8R8A8_UNORM:
|
||||
case PIPE_FORMAT_B8G8R8X8_UNORM:
|
||||
case PIPE_FORMAT_R8G8B8A8_SRGB:
|
||||
case PIPE_FORMAT_R8G8B8X8_SRGB:
|
||||
case PIPE_FORMAT_A8R8G8B8_SRGB:
|
||||
case PIPE_FORMAT_X8R8G8B8_SRGB:
|
||||
case PIPE_FORMAT_B8G8R8A8_SRGB:
|
||||
case PIPE_FORMAT_B8G8R8X8_SRGB:
|
||||
case PIPE_FORMAT_R8G8B8_SRGB:
|
||||
*datatype = DTYPE_UBYTE;
|
||||
*comps = 4;
|
||||
return;
|
||||
@@ -942,12 +950,14 @@ format_to_type_comps(enum pipe_format pformat,
|
||||
*comps = 3;
|
||||
return;
|
||||
case PIPE_FORMAT_L8_UNORM:
|
||||
case PIPE_FORMAT_L8_SRGB:
|
||||
case PIPE_FORMAT_A8_UNORM:
|
||||
case PIPE_FORMAT_I8_UNORM:
|
||||
*datatype = DTYPE_UBYTE;
|
||||
*comps = 1;
|
||||
return;
|
||||
case PIPE_FORMAT_A8L8_UNORM:
|
||||
case PIPE_FORMAT_A8L8_SRGB:
|
||||
*datatype = DTYPE_UBYTE;
|
||||
*comps = 2;
|
||||
return;
|
||||
|
@@ -152,11 +152,14 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
|
||||
|
||||
/**
|
||||
* Make simple fragment texture shader:
|
||||
* TEX OUT[0], IN[0], SAMP[0], 2D;
|
||||
* IMM {0,0,0,1} // (if writemask != 0xf)
|
||||
* MOV OUT[0], IMM[0] // (if writemask != 0xf)
|
||||
* TEX OUT[0].writemask, IN[0], SAMP[0], 2D;
|
||||
* END;
|
||||
*/
|
||||
void *
|
||||
util_make_fragment_tex_shader(struct pipe_context *pipe)
|
||||
util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
|
||||
unsigned writemask )
|
||||
{
|
||||
struct pipe_shader_state shader;
|
||||
struct tgsi_token tokens[100];
|
||||
@@ -217,12 +220,43 @@ util_make_fragment_tex_shader(struct pipe_context *pipe)
|
||||
header,
|
||||
Elements(tokens) - ti);
|
||||
|
||||
|
||||
if (writemask != TGSI_WRITEMASK_XYZW) {
|
||||
struct tgsi_full_immediate imm;
|
||||
static const float value[4] = { 0, 0, 0, 1 };
|
||||
|
||||
imm = tgsi_default_full_immediate();
|
||||
imm.Immediate.NrTokens += 4;
|
||||
imm.Immediate.DataType = TGSI_IMM_FLOAT32;
|
||||
imm.u.Pointer = value;
|
||||
|
||||
ti += tgsi_build_full_immediate(&imm,
|
||||
&tokens[ti],
|
||||
header,
|
||||
Elements(tokens) - ti );
|
||||
|
||||
/* MOV instruction */
|
||||
inst = tgsi_default_full_instruction();
|
||||
inst.Instruction.Opcode = TGSI_OPCODE_MOV;
|
||||
inst.Instruction.NumDstRegs = 1;
|
||||
inst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
|
||||
inst.FullDstRegisters[0].DstRegister.Index = 0;
|
||||
inst.Instruction.NumSrcRegs = 1;
|
||||
inst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_IMMEDIATE;
|
||||
inst.FullSrcRegisters[0].SrcRegister.Index = 0;
|
||||
ti += tgsi_build_full_instruction(&inst,
|
||||
&tokens[ti],
|
||||
header,
|
||||
Elements(tokens) - ti );
|
||||
}
|
||||
|
||||
/* TEX instruction */
|
||||
inst = tgsi_default_full_instruction();
|
||||
inst.Instruction.Opcode = TGSI_OPCODE_TEX;
|
||||
inst.Instruction.NumDstRegs = 1;
|
||||
inst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT;
|
||||
inst.FullDstRegisters[0].DstRegister.Index = 0;
|
||||
inst.FullDstRegisters[0].DstRegister.WriteMask = writemask;
|
||||
inst.Instruction.NumSrcRegs = 2;
|
||||
inst.InstructionExtTexture.Texture = TGSI_TEXTURE_2D;
|
||||
inst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT;
|
||||
@@ -253,6 +287,13 @@ util_make_fragment_tex_shader(struct pipe_context *pipe)
|
||||
return pipe->create_fs_state(pipe, &shader);
|
||||
}
|
||||
|
||||
void *
|
||||
util_make_fragment_tex_shader(struct pipe_context *pipe )
|
||||
{
|
||||
return util_make_fragment_tex_shader_writemask( pipe,
|
||||
TGSI_WRITEMASK_XYZW );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -49,6 +49,10 @@ util_make_vertex_passthrough_shader(struct pipe_context *pipe,
|
||||
const uint *semantic_indexes);
|
||||
|
||||
|
||||
extern void *
|
||||
util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
|
||||
unsigned writemask );
|
||||
|
||||
extern void *
|
||||
util_make_fragment_tex_shader(struct pipe_context *pipe);
|
||||
|
||||
|
@@ -37,6 +37,23 @@ struct pipe_texture;
|
||||
struct pipe_surface;
|
||||
|
||||
|
||||
/**
|
||||
* Are s1 and s2 the same surface?
|
||||
* Surfaces are basically views into textures so check if the two surfaces
|
||||
* name the same part of the same texture.
|
||||
*/
|
||||
static INLINE boolean
|
||||
util_same_surface(const struct pipe_surface *s1, const struct pipe_surface *s2)
|
||||
{
|
||||
return (s1->texture == s2->texture &&
|
||||
s1->face == s2->face &&
|
||||
s1->level == s2->level &&
|
||||
s1->zslice == s2->zslice);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
extern boolean
|
||||
util_create_rgba_surface(struct pipe_screen *screen,
|
||||
uint width, uint height,
|
||||
|
@@ -153,7 +153,7 @@ a8r8g8b8_put_tile_rgba(unsigned *dst,
|
||||
}
|
||||
|
||||
|
||||
/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/
|
||||
/*** PIPE_FORMAT_X8R8G8B8_UNORM ***/
|
||||
|
||||
static void
|
||||
x8r8g8b8_get_tile_rgba(const unsigned *src,
|
||||
@@ -596,6 +596,184 @@ r16g16b16a16_put_tile_rgba(short *dst,
|
||||
}
|
||||
|
||||
|
||||
/*** PIPE_FORMAT_R8G8B8A8_SRGB ***/
|
||||
|
||||
/**
|
||||
* Convert an 8-bit sRGB value from non-linear space to a
|
||||
* linear RGB value in [0, 1].
|
||||
* Implemented with a 256-entry lookup table.
|
||||
*/
|
||||
static INLINE float
|
||||
srgb_to_linear(ubyte cs8)
|
||||
{
|
||||
static float table[256];
|
||||
static boolean tableReady = FALSE;
|
||||
if (!tableReady) {
|
||||
/* compute lookup table now */
|
||||
uint i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
const float cs = ubyte_to_float(i);
|
||||
if (cs <= 0.04045) {
|
||||
table[i] = cs / 12.92f;
|
||||
}
|
||||
else {
|
||||
table[i] = (float) powf((cs + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
}
|
||||
tableReady = TRUE;
|
||||
}
|
||||
return table[cs8];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert linear float in [0,1] to an srgb ubyte value in [0,255].
|
||||
* XXX this hasn't been tested (render to srgb surface).
|
||||
* XXX this needs optimization.
|
||||
*/
|
||||
static INLINE ubyte
|
||||
linear_to_srgb(float cl)
|
||||
{
|
||||
if (cl >= 1.0F)
|
||||
return 255;
|
||||
else if (cl >= 0.0031308F)
|
||||
return float_to_ubyte(1.055F * powf(cl, 0.41666F) - 0.055F);
|
||||
else if (cl > 0.0F)
|
||||
return float_to_ubyte(12.92F * cl);
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
a8r8g8b8_srgb_get_tile_rgba(const unsigned *src,
|
||||
unsigned w, unsigned h,
|
||||
float *p,
|
||||
unsigned dst_stride)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
float *pRow = p;
|
||||
for (j = 0; j < w; j++, pRow += 4) {
|
||||
const unsigned pixel = *src++;
|
||||
pRow[0] = srgb_to_linear((pixel >> 16) & 0xff);
|
||||
pRow[1] = srgb_to_linear((pixel >> 8) & 0xff);
|
||||
pRow[2] = srgb_to_linear((pixel >> 0) & 0xff);
|
||||
pRow[3] = ubyte_to_float((pixel >> 24) & 0xff);
|
||||
}
|
||||
p += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
a8r8g8b8_srgb_put_tile_rgba(unsigned *dst,
|
||||
unsigned w, unsigned h,
|
||||
const float *p,
|
||||
unsigned src_stride)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
const float *pRow = p;
|
||||
for (j = 0; j < w; j++, pRow += 4) {
|
||||
unsigned r, g, b, a;
|
||||
r = linear_to_srgb(pRow[0]);
|
||||
g = linear_to_srgb(pRow[1]);
|
||||
b = linear_to_srgb(pRow[2]);
|
||||
a = float_to_ubyte(pRow[3]);
|
||||
*dst++ = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
p += src_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** PIPE_FORMAT_A8L8_SRGB ***/
|
||||
|
||||
static void
|
||||
a8l8_srgb_get_tile_rgba(const ushort *src,
|
||||
unsigned w, unsigned h,
|
||||
float *p,
|
||||
unsigned dst_stride)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
float *pRow = p;
|
||||
for (j = 0; j < w; j++, pRow += 4) {
|
||||
ushort p = *src++;
|
||||
pRow[0] =
|
||||
pRow[1] =
|
||||
pRow[2] = srgb_to_linear(p & 0xff);
|
||||
pRow[3] = ubyte_to_float(p >> 8);
|
||||
}
|
||||
p += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
a8l8_srgb_put_tile_rgba(ushort *dst,
|
||||
unsigned w, unsigned h,
|
||||
const float *p,
|
||||
unsigned src_stride)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
const float *pRow = p;
|
||||
for (j = 0; j < w; j++, pRow += 4) {
|
||||
unsigned r, a;
|
||||
r = linear_to_srgb(pRow[0]);
|
||||
a = float_to_ubyte(pRow[3]);
|
||||
*dst++ = (a << 8) | r;
|
||||
}
|
||||
p += src_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** PIPE_FORMAT_L8_SRGB ***/
|
||||
|
||||
static void
|
||||
l8_srgb_get_tile_rgba(const ubyte *src,
|
||||
unsigned w, unsigned h,
|
||||
float *p,
|
||||
unsigned dst_stride)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
float *pRow = p;
|
||||
for (j = 0; j < w; j++, src++, pRow += 4) {
|
||||
pRow[0] =
|
||||
pRow[1] =
|
||||
pRow[2] = srgb_to_linear(*src);
|
||||
pRow[3] = 1.0;
|
||||
}
|
||||
p += dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
l8_srgb_put_tile_rgba(ubyte *dst,
|
||||
unsigned w, unsigned h,
|
||||
const float *p,
|
||||
unsigned src_stride)
|
||||
{
|
||||
unsigned i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
const float *pRow = p;
|
||||
for (j = 0; j < w; j++, pRow += 4) {
|
||||
unsigned r;
|
||||
r = linear_to_srgb(pRow[0]);
|
||||
*dst++ = (ubyte) r;
|
||||
}
|
||||
p += src_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** PIPE_FORMAT_I8_UNORM ***/
|
||||
|
||||
@@ -946,6 +1124,15 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
|
||||
case PIPE_FORMAT_R16G16B16A16_SNORM:
|
||||
r16g16b16a16_get_tile_rgba((short *) src, w, h, dst, dst_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_A8R8G8B8_SRGB:
|
||||
a8r8g8b8_srgb_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_A8L8_SRGB:
|
||||
a8l8_srgb_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_L8_SRGB:
|
||||
l8_srgb_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_Z16_UNORM:
|
||||
z16_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
|
||||
break;
|
||||
@@ -1059,6 +1246,15 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
|
||||
case PIPE_FORMAT_R16G16B16A16_SNORM:
|
||||
r16g16b16a16_put_tile_rgba((short *) packed, w, h, p, src_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_A8R8G8B8_SRGB:
|
||||
a8r8g8b8_srgb_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_A8L8_SRGB:
|
||||
a8l8_srgb_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_L8_SRGB:
|
||||
l8_srgb_put_tile_rgba((ubyte *) packed, w, h, p, src_stride);
|
||||
break;
|
||||
case PIPE_FORMAT_Z16_UNORM:
|
||||
/*z16_put_tile_rgba((ushort *) packed, w, h, p, src_stride);*/
|
||||
break;
|
||||
|
@@ -123,21 +123,25 @@ static enum pipe_error
|
||||
u_upload_alloc_buffer( struct u_upload_mgr *upload,
|
||||
unsigned min_size )
|
||||
{
|
||||
unsigned size;
|
||||
|
||||
/* Release old buffer, if present:
|
||||
*/
|
||||
u_upload_flush( upload );
|
||||
|
||||
/* Allocate a new one:
|
||||
*/
|
||||
upload->size = align(MAX2(upload->default_size, min_size), 4096);
|
||||
size = align(MAX2(upload->default_size, min_size), 4096);
|
||||
|
||||
upload->buffer = pipe_buffer_create( upload->screen,
|
||||
upload->alignment,
|
||||
upload->usage | PIPE_BUFFER_USAGE_CPU_WRITE,
|
||||
upload->size );
|
||||
size );
|
||||
if (upload->buffer == NULL)
|
||||
goto fail;
|
||||
|
||||
upload->size = size;
|
||||
|
||||
upload->offset = 0;
|
||||
return 0;
|
||||
|
||||
|
@@ -72,6 +72,24 @@ do { \
|
||||
R[3] = A[3] - B[3]; \
|
||||
} while (0)
|
||||
|
||||
/** Add and limit result to ceiling of 1.0 */
|
||||
#define VEC4_ADD_SAT(R, A, B) \
|
||||
do { \
|
||||
R[0] = A[0] + B[0]; if (R[0] > 1.0f) R[0] = 1.0f; \
|
||||
R[1] = A[1] + B[1]; if (R[1] > 1.0f) R[1] = 1.0f; \
|
||||
R[2] = A[2] + B[2]; if (R[2] > 1.0f) R[2] = 1.0f; \
|
||||
R[3] = A[3] + B[3]; if (R[3] > 1.0f) R[3] = 1.0f; \
|
||||
} while (0)
|
||||
|
||||
/** Subtract and limit result to floor of 0.0 */
|
||||
#define VEC4_SUB_SAT(R, A, B) \
|
||||
do { \
|
||||
R[0] = A[0] - B[0]; if (R[0] < 0.0f) R[0] = 0.0f; \
|
||||
R[1] = A[1] - B[1]; if (R[1] < 0.0f) R[1] = 0.0f; \
|
||||
R[2] = A[2] - B[2]; if (R[2] < 0.0f) R[2] = 0.0f; \
|
||||
R[3] = A[3] - B[3]; if (R[3] < 0.0f) R[3] = 0.0f; \
|
||||
} while (0)
|
||||
|
||||
#define VEC4_MUL(R, A, B) \
|
||||
do { \
|
||||
R[0] = A[0] * B[0]; \
|
||||
@@ -676,19 +694,19 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
|
||||
*/
|
||||
switch (softpipe->blend->rgb_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
VEC4_ADD(quadColor[0], source[0], dest[0]); /* R */
|
||||
VEC4_ADD(quadColor[1], source[1], dest[1]); /* G */
|
||||
VEC4_ADD(quadColor[2], source[2], dest[2]); /* B */
|
||||
VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */
|
||||
VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */
|
||||
VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */
|
||||
break;
|
||||
case PIPE_BLEND_SUBTRACT:
|
||||
VEC4_SUB(quadColor[0], source[0], dest[0]); /* R */
|
||||
VEC4_SUB(quadColor[1], source[1], dest[1]); /* G */
|
||||
VEC4_SUB(quadColor[2], source[2], dest[2]); /* B */
|
||||
VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */
|
||||
VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */
|
||||
VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */
|
||||
break;
|
||||
case PIPE_BLEND_REVERSE_SUBTRACT:
|
||||
VEC4_SUB(quadColor[0], dest[0], source[0]); /* R */
|
||||
VEC4_SUB(quadColor[1], dest[1], source[1]); /* G */
|
||||
VEC4_SUB(quadColor[2], dest[2], source[2]); /* B */
|
||||
VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */
|
||||
VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */
|
||||
VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */
|
||||
break;
|
||||
case PIPE_BLEND_MIN:
|
||||
VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */
|
||||
@@ -709,13 +727,13 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
|
||||
*/
|
||||
switch (softpipe->blend->alpha_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
VEC4_ADD(quadColor[3], source[3], dest[3]); /* A */
|
||||
VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
|
||||
break;
|
||||
case PIPE_BLEND_SUBTRACT:
|
||||
VEC4_SUB(quadColor[3], source[3], dest[3]); /* A */
|
||||
VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */
|
||||
break;
|
||||
case PIPE_BLEND_REVERSE_SUBTRACT:
|
||||
VEC4_SUB(quadColor[3], dest[3], source[3]); /* A */
|
||||
VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */
|
||||
break;
|
||||
case PIPE_BLEND_MIN:
|
||||
VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "sp_texture.h"
|
||||
#include "sp_tile_cache.h"
|
||||
#include "sp_screen.h"
|
||||
#include "sp_winsys.h"
|
||||
|
||||
|
||||
/* Simple, maximally packed layout.
|
||||
|
@@ -351,7 +351,7 @@ void trace_dump_call_begin_locked(const char *klass, const char *method)
|
||||
trace_dump_indent(1);
|
||||
trace_dump_writes("<call no=\'");
|
||||
trace_dump_writef("%lu", call_no);
|
||||
trace_dump_writes("\' class =\'");
|
||||
trace_dump_writes("\' class=\'");
|
||||
trace_dump_escape(klass);
|
||||
trace_dump_writes("\' method=\'");
|
||||
trace_dump_escape(method);
|
||||
|
@@ -63,6 +63,13 @@ pipe_buffer_map(struct pipe_screen *screen,
|
||||
if(screen->buffer_map_range) {
|
||||
unsigned offset = 0;
|
||||
unsigned length = buf->size;
|
||||
|
||||
/* XXX: Actually we should be using/detecting DISCARD
|
||||
* instead of assuming that WRITE implies discard */
|
||||
if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) &&
|
||||
!(usage & PIPE_BUFFER_USAGE_DISCARD))
|
||||
usage |= PIPE_BUFFER_USAGE_CPU_READ;
|
||||
|
||||
return screen->buffer_map_range(screen, buf, offset, length, usage);
|
||||
}
|
||||
else
|
||||
|
@@ -743,7 +743,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
|
||||
{
|
||||
static GLboolean firstTime = GL_TRUE;
|
||||
struct pipe_screen *screen;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_context *pipe = NULL;
|
||||
XMesaContext c;
|
||||
GLcontext *mesaCtx;
|
||||
uint pf;
|
||||
|
@@ -15,6 +15,19 @@ if 'python' in env['statetrackers']:
|
||||
|
||||
env.Append(CPPPATH = '.')
|
||||
|
||||
if env['platform'] == 'windows':
|
||||
env.Append(LIBS = [
|
||||
'opengl32',
|
||||
'gdi32',
|
||||
'user32',
|
||||
'kernel32',
|
||||
])
|
||||
else:
|
||||
env.Append(LIBS = [
|
||||
'GL',
|
||||
'X11',
|
||||
])
|
||||
|
||||
pyst = env.ConvenienceLibrary(
|
||||
target = 'pyst',
|
||||
source = [
|
||||
|
@@ -456,6 +456,7 @@ class Context(Object):
|
||||
x, y, z, w = unpack_from(format, data, offset)
|
||||
sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
|
||||
index += 1
|
||||
sys.stdout.flush()
|
||||
|
||||
def set_constant_buffer(self, shader, index, buffer):
|
||||
if buffer is not None:
|
||||
@@ -537,6 +538,7 @@ class Context(Object):
|
||||
sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
|
||||
assert len(values) == velem.nr_components
|
||||
sys.stdout.write('\t},\n')
|
||||
sys.stdout.flush()
|
||||
|
||||
def dump_indices(self, ibuf, isize, start, count):
|
||||
if not self.interpreter.verbosity(2):
|
||||
@@ -564,6 +566,7 @@ class Context(Object):
|
||||
minindex = min(minindex, index)
|
||||
maxindex = max(maxindex, index)
|
||||
sys.stdout.write('\t},\n')
|
||||
sys.stdout.flush()
|
||||
|
||||
return minindex, maxindex
|
||||
|
||||
@@ -591,6 +594,20 @@ class Context(Object):
|
||||
self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
|
||||
self._set_dirty()
|
||||
|
||||
def surface_copy(self, dest, destx, desty, src, srcx, srcy, width, height):
|
||||
if dest is not None and src is not None:
|
||||
if self.interpreter.options.all:
|
||||
self.interpreter.present(src, 'surface_copy_src', srcx, srcy, width, height)
|
||||
self.real.surface_copy(dest, destx, desty, src, srcx, srcy, width, height)
|
||||
if dest in self.cbufs:
|
||||
self._set_dirty()
|
||||
flags = gallium.PIPE_FLUSH_FRAME
|
||||
else:
|
||||
flags = 0
|
||||
self.flush(flags)
|
||||
if self.interpreter.options.all:
|
||||
self.interpreter.present(dest, 'surface_copy_dest', destx, desty, width, height)
|
||||
|
||||
def is_texture_referenced(self, texture, face, level):
|
||||
#return self.real.is_texture_referenced(format, texture, face, level)
|
||||
pass
|
||||
@@ -660,7 +677,7 @@ class Interpreter(parser.TraceDumper):
|
||||
self.interpret_call(call)
|
||||
|
||||
def handle_call(self, call):
|
||||
if self.options.stop and call.no >= self.options.stop:
|
||||
if self.options.stop and call.no > self.options.stop:
|
||||
sys.exit(0)
|
||||
|
||||
if (call.klass, call.method) in self.ignore_calls:
|
||||
@@ -670,6 +687,7 @@ class Interpreter(parser.TraceDumper):
|
||||
|
||||
if self.verbosity(1):
|
||||
parser.TraceDumper.handle_call(self, call)
|
||||
sys.stdout.flush()
|
||||
|
||||
args = [(str(name), self.interpret_arg(arg)) for name, arg in call.args]
|
||||
|
||||
|
@@ -371,7 +371,7 @@ class Main:
|
||||
stream = GzipFile(arg, 'rt')
|
||||
elif arg.endswith('.bz2'):
|
||||
from bz2 import BZ2File
|
||||
stream = BZ2File(arg, 'rt')
|
||||
stream = BZ2File(arg, 'rU')
|
||||
else:
|
||||
stream = open(arg, 'rt')
|
||||
self.process_arg(stream, options)
|
||||
|
@@ -139,7 +139,7 @@ def test(dev):
|
||||
tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
|
||||
).get_surface()
|
||||
zbuf = dev.texture_create(
|
||||
PIPE_FORMAT_Z32_UNORM,
|
||||
PIPE_FORMAT_Z16_UNORM,
|
||||
width, height,
|
||||
tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL,
|
||||
).get_surface()
|
||||
|
@@ -44,8 +44,14 @@
|
||||
static void
|
||||
st_device_really_destroy(struct st_device *st_dev)
|
||||
{
|
||||
if(st_dev->screen)
|
||||
if(st_dev->screen) {
|
||||
/* FIXME: Don't really destroy until we keep track of every single
|
||||
* reference or we end up causing a segmentation fault every time
|
||||
* python exits. */
|
||||
#if 0
|
||||
st_dev->screen->destroy(st_dev->screen);
|
||||
#endif
|
||||
}
|
||||
|
||||
FREE(st_dev);
|
||||
}
|
||||
|
@@ -28,31 +28,206 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Stub for hardware pipe driver support.
|
||||
* Get a hardware accelerated Gallium screen/context from the OpenGL driver.
|
||||
*/
|
||||
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
#ifdef PIPE_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#else
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#include "st_winsys.h"
|
||||
|
||||
|
||||
typedef struct pipe_screen * (GLAPIENTRY *PFNGETGALLIUMSCREENMESAPROC) (void);
|
||||
typedef struct pipe_context * (GLAPIENTRY* PFNCREATEGALLIUMCONTEXTMESAPROC) (void);
|
||||
|
||||
static PFNGETGALLIUMSCREENMESAPROC pfnGetGalliumScreenMESA = NULL;
|
||||
static PFNCREATEGALLIUMCONTEXTMESAPROC pfnCreateGalliumContextMESA = NULL;
|
||||
|
||||
|
||||
/* XXX: Force init_gallium symbol to be linked */
|
||||
extern void init_gallium(void);
|
||||
void (*force_init_gallium_linkage)(void) = &init_gallium;
|
||||
|
||||
|
||||
#ifdef PIPE_OS_WINDOWS
|
||||
|
||||
static INLINE boolean
|
||||
st_hardpipe_load(void)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
HWND hwnd;
|
||||
HGLRC hglrc;
|
||||
HDC hdc;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
int iPixelFormat;
|
||||
|
||||
if(pfnGetGalliumScreenMESA && pfnCreateGalliumContextMESA)
|
||||
return TRUE;
|
||||
|
||||
memset(&wc, 0, sizeof wc);
|
||||
wc.lpfnWndProc = DefWindowProc;
|
||||
wc.lpszClassName = "gallium";
|
||||
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
|
||||
RegisterClass(&wc);
|
||||
|
||||
hwnd = CreateWindow(wc.lpszClassName, "gallium", 0, 0, 0, 0, 0, NULL, 0, wc.hInstance, NULL);
|
||||
if (!hwnd)
|
||||
return FALSE;
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
if (!hdc)
|
||||
return FALSE;
|
||||
|
||||
pfd.cColorBits = 3;
|
||||
pfd.cRedBits = 1;
|
||||
pfd.cGreenBits = 1;
|
||||
pfd.cBlueBits = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
|
||||
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
|
||||
if (!iPixelFormat) {
|
||||
pfd.dwFlags |= PFD_DOUBLEBUFFER;
|
||||
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
|
||||
}
|
||||
if (!iPixelFormat)
|
||||
return FALSE;
|
||||
|
||||
SetPixelFormat(hdc, iPixelFormat, &pfd);
|
||||
hglrc = wglCreateContext(hdc);
|
||||
if (!hglrc)
|
||||
return FALSE;
|
||||
|
||||
if (!wglMakeCurrent(hdc, hglrc))
|
||||
return FALSE;
|
||||
|
||||
pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)wglGetProcAddress("wglGetGalliumScreenMESA");
|
||||
if(!pfnGetGalliumScreenMESA)
|
||||
return FALSE;
|
||||
|
||||
pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)wglGetProcAddress("wglCreateGalliumContextMESA");
|
||||
if(!pfnCreateGalliumContextMESA)
|
||||
return FALSE;
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static INLINE boolean
|
||||
st_hardpipe_load(void)
|
||||
{
|
||||
Display *dpy;
|
||||
int scrnum;
|
||||
Window root;
|
||||
int attribSingle[] = {
|
||||
GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
None };
|
||||
int attribDouble[] = {
|
||||
GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
GLX_DOUBLEBUFFER,
|
||||
None };
|
||||
XVisualInfo *visinfo;
|
||||
GLXContext ctx = NULL;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
int width = 100, height = 100;
|
||||
Window win;
|
||||
|
||||
dpy = XOpenDisplay(NULL);
|
||||
if (!dpy)
|
||||
return FALSE;
|
||||
|
||||
scrnum = 0;
|
||||
|
||||
root = RootWindow(dpy, scrnum);
|
||||
|
||||
visinfo = glXChooseVisual(dpy, scrnum, attribSingle);
|
||||
if (!visinfo)
|
||||
visinfo = glXChooseVisual(dpy, scrnum, attribDouble);
|
||||
if (!visinfo)
|
||||
return FALSE;
|
||||
|
||||
ctx = glXCreateContext( dpy, visinfo, NULL, True );
|
||||
|
||||
if (!ctx)
|
||||
return FALSE;
|
||||
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask;
|
||||
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow(dpy, root, 0, 0, width, height,
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &attr);
|
||||
|
||||
if (!glXMakeCurrent(dpy, win, ctx))
|
||||
return FALSE;
|
||||
|
||||
pfnGetGalliumScreenMESA = (PFNGETGALLIUMSCREENMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXGetGalliumScreenMESA");
|
||||
if(!pfnGetGalliumScreenMESA)
|
||||
return FALSE;
|
||||
|
||||
pfnCreateGalliumContextMESA = (PFNCREATEGALLIUMCONTEXTMESAPROC)glXGetProcAddressARB((const GLubyte *)"glXCreateGalliumContextMESA");
|
||||
if(!pfnCreateGalliumContextMESA)
|
||||
return FALSE;
|
||||
|
||||
glXDestroyContext(dpy, ctx);
|
||||
XFree(visinfo);
|
||||
XDestroyWindow(dpy, win);
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static struct pipe_screen *
|
||||
st_hardpipe_screen_create(void)
|
||||
{
|
||||
return st_softpipe_winsys.screen_create();
|
||||
if(st_hardpipe_load())
|
||||
return pfnGetGalliumScreenMESA();
|
||||
else
|
||||
return st_softpipe_winsys.screen_create();
|
||||
}
|
||||
|
||||
|
||||
static struct pipe_context *
|
||||
st_hardpipe_context_create(struct pipe_screen *screen)
|
||||
{
|
||||
return st_softpipe_winsys.context_create(screen);
|
||||
if(st_hardpipe_load()) {
|
||||
if(screen == pfnGetGalliumScreenMESA())
|
||||
return pfnCreateGalliumContextMESA();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return st_softpipe_winsys.context_create(screen);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -29,6 +29,7 @@ if env['platform'] in ['windows']:
|
||||
'shared/stw_extensionsstring.c',
|
||||
'shared/stw_extswapinterval.c',
|
||||
'shared/stw_getprocaddress.c',
|
||||
'shared/stw_extgallium.c',
|
||||
'shared/stw_arbpixelformat.c',
|
||||
'shared/stw_tls.c',
|
||||
]
|
||||
|
79
src/gallium/state_trackers/wgl/shared/stw_extgallium.c
Normal file
79
src/gallium/state_trackers/wgl/shared/stw_extgallium.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "stw_public.h"
|
||||
#include "stw_device.h"
|
||||
#include "stw_winsys.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "trace/tr_screen.h"
|
||||
#include "trace/tr_context.h"
|
||||
#endif
|
||||
|
||||
|
||||
struct pipe_screen * APIENTRY
|
||||
wglGetGalliumScreenMESA(void)
|
||||
{
|
||||
return stw_dev ? stw_dev->screen : NULL;
|
||||
}
|
||||
|
||||
|
||||
/* XXX: Unify with stw_create_layer_context */
|
||||
struct pipe_context * APIENTRY
|
||||
wglCreateGalliumContextMESA(void)
|
||||
{
|
||||
struct pipe_screen *screen = NULL;
|
||||
struct pipe_context *pipe = NULL;
|
||||
|
||||
if(!stw_dev)
|
||||
return NULL;
|
||||
|
||||
screen = stw_dev->screen;
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Unwrap screen */
|
||||
if(stw_dev->trace_running)
|
||||
screen = trace_screen(screen)->screen;
|
||||
#endif
|
||||
|
||||
pipe = stw_dev->stw_winsys->create_context( screen );
|
||||
if (pipe == NULL)
|
||||
goto no_pipe;
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Wrap context */
|
||||
if(stw_dev->trace_running)
|
||||
pipe = trace_context_create(stw_dev->screen, pipe);
|
||||
#endif
|
||||
|
||||
return pipe;
|
||||
|
||||
no_pipe:
|
||||
return NULL;
|
||||
}
|
47
src/gallium/state_trackers/wgl/shared/stw_extgallium.h
Normal file
47
src/gallium/state_trackers/wgl/shared/stw_extgallium.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef STW_EXTGALLIUM_H_
|
||||
#define STW_EXTGALLIUM_H_
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
struct pipe_screen;
|
||||
struct pipe_context;
|
||||
|
||||
|
||||
struct pipe_screen * APIENTRY
|
||||
wglGetGalliumScreenMESA(void);
|
||||
|
||||
|
||||
struct pipe_context * APIENTRY
|
||||
wglCreateGalliumContextMESA(void);
|
||||
|
||||
|
||||
#endif /* STW_EXTGALLIUM_H_ */
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "glapi/glapi.h"
|
||||
#include "stw_public.h"
|
||||
#include "stw_extgallium.h"
|
||||
|
||||
struct stw_extension_entry
|
||||
{
|
||||
@@ -60,6 +61,10 @@ static const struct stw_extension_entry stw_extension_entries[] = {
|
||||
STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ),
|
||||
STW_EXTENSION_ENTRY( wglSwapIntervalEXT ),
|
||||
|
||||
/* WGL_EXT_gallium ? */
|
||||
STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ),
|
||||
STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ),
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -75,7 +80,7 @@ stw_get_proc_address(
|
||||
return entry->proc;
|
||||
|
||||
if (lpszProc[0] == 'g' && lpszProc[1] == 'l')
|
||||
return (PROC) _glapi_get_proc_address( lpszProc );
|
||||
return (PROC) _glapi_get_proc_address( lpszProc );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -364,7 +364,7 @@ void xlib_brw_buffer_subdata_typed( struct pipe_winsys *pws,
|
||||
unsigned data_type )
|
||||
{
|
||||
unsigned aub_type = DW_GENERAL_STATE;
|
||||
unsigned aub_sub_type;
|
||||
unsigned aub_sub_type = 0;
|
||||
|
||||
switch (data_type) {
|
||||
case BRW_CC_VP:
|
||||
|
@@ -303,6 +303,7 @@ xm_flush_frontbuffer(struct pipe_winsys *pws,
|
||||
*/
|
||||
XMesaContext xmctx = (XMesaContext) context_private;
|
||||
xlib_softpipe_display_surface(xmctx->xm_buffer, surf);
|
||||
xmesa_check_and_update_buffer_size(xmctx, xmctx->xm_buffer);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -481,6 +481,8 @@ static __GLXDRIscreen *dri2CreateScreen(__GLXscreenConfigs *psc, int screen,
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
|
||||
psc->driver_configs = driver_configs;
|
||||
|
||||
psp->destroyScreen = dri2DestroyScreen;
|
||||
psp->createContext = dri2CreateContext;
|
||||
psp->createDrawable = dri2CreateDrawable;
|
||||
|
@@ -418,6 +418,8 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc,
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
|
||||
psc->driver_configs = driver_configs;
|
||||
|
||||
/* Visuals with depth != screen depth are subject to automatic compositing
|
||||
* in the X server, so DRI1 can't render to them properly. Mark them as
|
||||
* non-conformant to prevent apps from picking them up accidentally.
|
||||
|
@@ -401,7 +401,7 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
|
||||
psc->configs = driConvertConfigs(psc->core, psc->configs, driver_configs);
|
||||
psc->visuals = driConvertConfigs(psc->core, psc->visuals, driver_configs);
|
||||
|
||||
free(driver_configs);
|
||||
psc->driver_configs = driver_configs;
|
||||
|
||||
psp->destroyScreen = driDestroyScreen;
|
||||
psp->createContext = driCreateContext;
|
||||
|
@@ -501,6 +501,8 @@ struct __GLXscreenConfigsRec {
|
||||
|
||||
__GLXDRIscreen *driScreen;
|
||||
|
||||
const __DRIconfig** driver_configs;
|
||||
|
||||
#ifdef __DRI_COPY_SUB_BUFFER
|
||||
const __DRIcopySubBufferExtension *driCopySubBuffer;
|
||||
#endif
|
||||
|
@@ -845,6 +845,34 @@ PUBLIC GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,
|
||||
req->glxpixmap = xid = XAllocID(dpy);
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
do {
|
||||
/* FIXME: Maybe delay __DRIdrawable creation until the drawable
|
||||
* is actually bound to a context... */
|
||||
|
||||
__GLXdisplayPrivate *const priv = __glXInitialize(dpy);
|
||||
__GLXDRIdrawable *pdraw;
|
||||
__GLXscreenConfigs *psc;
|
||||
__GLcontextModes *modes;
|
||||
|
||||
psc = &priv->screenConfigs[vis->screen];
|
||||
if (psc->driScreen == NULL)
|
||||
break;
|
||||
modes = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
|
||||
pdraw = psc->driScreen->createDrawable(psc, pixmap, req->glxpixmap, modes);
|
||||
if (pdraw == NULL) {
|
||||
fprintf(stderr, "failed to create pixmap\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (__glxHashInsert(psc->drawHash, req->glxpixmap, pdraw)) {
|
||||
(*pdraw->destroyDrawable) (pdraw);
|
||||
return None; /* FIXME: Check what we're supposed to do here... */
|
||||
}
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
return xid;
|
||||
}
|
||||
|
||||
|
@@ -149,6 +149,12 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
|
||||
Xfree((char *) psc->serverGLXexts);
|
||||
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (psc->driver_configs) {
|
||||
for(unsigned int i = 0; psc->driver_configs[i]; i++)
|
||||
free((__DRIconfig*)psc->driver_configs[i]);
|
||||
free(psc->driver_configs);
|
||||
psc->driver_configs = NULL;
|
||||
}
|
||||
if (psc->driScreen) {
|
||||
psc->driScreen->destroyScreen(psc);
|
||||
__glxHashDestroy(psc->drawHash);
|
||||
|
@@ -763,7 +763,7 @@ dri2CreateNewScreen(int scrn, int fd,
|
||||
if (driDriverAPI.InitScreen2 == NULL)
|
||||
return NULL;
|
||||
|
||||
psp = _mesa_malloc(sizeof(*psp));
|
||||
psp = _mesa_calloc(sizeof(*psp));
|
||||
if (!psp)
|
||||
return NULL;
|
||||
|
||||
|
@@ -152,7 +152,8 @@ static void upload_clip_prog(struct brw_context *brw)
|
||||
|
||||
/* _NEW_POLYGON */
|
||||
if (key.primitive == GL_TRIANGLES) {
|
||||
if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
|
||||
if (ctx->Polygon.CullFlag &&
|
||||
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
|
||||
key.clip_mode = BRW_CLIPMODE_REJECT_ALL;
|
||||
else {
|
||||
GLuint fill_front = CLIP_CULL;
|
||||
|
@@ -197,6 +197,11 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
|
||||
GLuint used = batch->ptr - batch->map;
|
||||
GLboolean was_locked = intel->locked;
|
||||
|
||||
if (intel->first_post_swapbuffers_batch == NULL) {
|
||||
intel->first_post_swapbuffers_batch = intel->batch->buf;
|
||||
drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
|
||||
}
|
||||
|
||||
if (used == 0) {
|
||||
batch->cliprect_mode = IGNORE_CLIPRECTS;
|
||||
return;
|
||||
|
@@ -505,7 +505,7 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
|
||||
* each of N places that do rendering. This has worse performances,
|
||||
* but it is much easier to get correct.
|
||||
*/
|
||||
if (intel->is_front_buffer_rendering) {
|
||||
if (!intel->is_front_buffer_rendering) {
|
||||
intel->front_buffer_dirty = GL_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -521,7 +521,27 @@ intelFlush(GLcontext * ctx)
|
||||
static void
|
||||
intel_glFlush(GLcontext *ctx)
|
||||
{
|
||||
struct intel_context *intel = intel_context(ctx);
|
||||
|
||||
intel_flush(ctx, GL_TRUE);
|
||||
|
||||
/* We're using glFlush as an indicator that a frame is done, which is
|
||||
* what DRI2 does before calling SwapBuffers (and means we should catch
|
||||
* people doing front-buffer rendering, as well)..
|
||||
*
|
||||
* Wait for the swapbuffers before the one we just emitted, so we don't
|
||||
* get too many swaps outstanding for apps that are GPU-heavy but not
|
||||
* CPU-heavy.
|
||||
*
|
||||
* Unfortunately, we don't have a handle to the batch containing the swap,
|
||||
* and getting our hands on that doesn't seem worth it, so we just us the
|
||||
* first batch we emitted after the last swap.
|
||||
*/
|
||||
if (intel->first_post_swapbuffers_batch != NULL) {
|
||||
drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch);
|
||||
drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
|
||||
intel->first_post_swapbuffers_batch = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -787,6 +807,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
|
||||
intel->prim.vb = NULL;
|
||||
dri_bo_unreference(intel->prim.vb_bo);
|
||||
intel->prim.vb_bo = NULL;
|
||||
dri_bo_unreference(intel->first_post_swapbuffers_batch);
|
||||
intel->first_post_swapbuffers_batch = NULL;
|
||||
|
||||
if (release_texture_heaps) {
|
||||
/* This share group is about to go away, free our private
|
||||
@@ -804,6 +826,9 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
|
||||
|
||||
/* free the Mesa context */
|
||||
_mesa_free_context_data(&intel->ctx);
|
||||
|
||||
FREE(intel);
|
||||
driContextPriv->driverPrivate = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -191,6 +191,7 @@ struct intel_context
|
||||
GLboolean ttm;
|
||||
|
||||
struct intel_batchbuffer *batch;
|
||||
drm_intel_bo *first_post_swapbuffers_batch;
|
||||
GLboolean no_batch_wrap;
|
||||
unsigned batch_id;
|
||||
|
||||
|
@@ -409,6 +409,12 @@ intel_texture_bitmap(GLcontext * ctx,
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (ctx->Fog.Enabled) {
|
||||
if (INTEL_DEBUG & DEBUG_FALLBACKS)
|
||||
fprintf(stderr, "glBitmap() fallback: fog\n");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/* Check that we can load in a texture this big. */
|
||||
if (width > (1 << (ctx->Const.MaxTextureLevels - 1)) ||
|
||||
height > (1 << (ctx->Const.MaxTextureLevels - 1))) {
|
||||
|
@@ -305,7 +305,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv)
|
||||
|
||||
dri_bufmgr_destroy(intelScreen->bufmgr);
|
||||
intelUnmapScreenRegions(intelScreen);
|
||||
driDestroyOptionCache(&intelScreen->optionCache);
|
||||
driDestroyOptionInfo(&intelScreen->optionCache);
|
||||
|
||||
FREE(intelScreen);
|
||||
sPriv->private = NULL;
|
||||
@@ -617,10 +617,10 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
|
||||
/* Otherwise, use the classic buffer manager. */
|
||||
if (intelScreen->bufmgr == NULL) {
|
||||
if (gem_disable) {
|
||||
fprintf(stderr, "GEM disabled. Using classic.\n");
|
||||
_mesa_warning(NULL, "GEM disabled. Using classic.");
|
||||
} else {
|
||||
fprintf(stderr, "Failed to initialize GEM. "
|
||||
"Falling back to classic.\n");
|
||||
_mesa_warning(NULL,
|
||||
"Failed to initialize GEM. Falling back to classic.");
|
||||
}
|
||||
|
||||
if (intelScreen->tex.size == 0) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user