summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rw-r--r--debian/changelog7
-rw-r--r--docs/relnotes-6.5.2.html4
-rw-r--r--src/glut/fbdev/callback.c2
-rw-r--r--src/glut/fbdev/colormap.c3
-rw-r--r--src/glut/fbdev/cursor.c2
-rw-r--r--src/glut/fbdev/ext.c2
-rw-r--r--src/glut/fbdev/fbdev.c4
-rw-r--r--src/glut/fbdev/gamemode.c1
-rw-r--r--src/glut/fbdev/input.c6
-rw-r--r--src/glut/fbdev/internal.h7
-rw-r--r--src/glut/fbdev/menu.c2
-rw-r--r--src/glut/fbdev/state.c1
-rw-r--r--src/glx/x11/XF86dri.c4
-rw-r--r--src/mesa/array_cache/sources7
-rw-r--r--src/mesa/drivers/common/sources2
-rw-r--r--src/mesa/drivers/dri/i915tex/i830_context.h5
-rw-r--r--src/mesa/drivers/dri/i915tex/i830_metaops.c32
-rw-r--r--src/mesa/drivers/dri/i915tex/i830_vtbl.c83
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c35
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.h3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel.c5
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_copy.c11
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_draw.c14
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_read.c8
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_regions.c11
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_copy.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_image.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_attrib.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_save_api.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_save_draw.c26
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_tnl.c9
-rw-r--r--src/mesa/drivers/dri/i965/intel_blit.c38
-rw-r--r--src/mesa/drivers/dri/i965/intel_blit.h3
-rw-r--r--src/mesa/drivers/dri/i965/intel_pixel_copy.c8
-rw-r--r--src/mesa/drivers/dri/i965/intel_regions.c3
-rw-r--r--src/mesa/drivers/dri/r200/r200_fragshader.c37
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.c4
-rw-r--r--src/mesa/drivers/x11/sources8
-rw-r--r--src/mesa/glapi/sources12
-rw-r--r--src/mesa/main/api_arrayelt.c29
-rw-r--r--src/mesa/main/api_loopback.c2
-rw-r--r--src/mesa/main/sources138
-rw-r--r--src/mesa/math/sources25
-rw-r--r--src/mesa/shader/grammar/sources8
-rw-r--r--src/mesa/shader/slang/slang_assemble_constructor.c623
-rw-r--r--src/mesa/shader/slang/slang_assemble_constructor.h44
-rw-r--r--src/mesa/shader/slang/slang_assemble_typeinfo.c2
-rw-r--r--src/mesa/shader/slang/slang_assemble_typeinfo.h4
-rw-r--r--src/mesa/shader/slang/slang_compile_function.h18
-rw-r--r--src/mesa/shader/slang/slang_compile_operation.h152
-rw-r--r--src/mesa/shader/slang/slang_compile_variable.c550
-rw-r--r--src/mesa/shader/slang/slang_compile_variable.h40
-rw-r--r--src/mesa/shader/slang/sources44
-rw-r--r--src/mesa/shader/sources28
-rw-r--r--src/mesa/swrast/sources65
-rw-r--r--src/mesa/swrast_setup/sources10
-rw-r--r--src/mesa/tnl/sources46
-rw-r--r--src/mesa/tnl/t_context.c5
-rw-r--r--src/mesa/tnl/t_save_playback.c1
-rw-r--r--src/mesa/tnl/t_vtx_api.c3
-rw-r--r--src/mesa/tnl/t_vtx_exec.c5
65 files changed, 1442 insertions, 844 deletions
diff --git a/Makefile b/Makefile
index b280298daf5..b95cedda8d8 100644
--- a/Makefile
+++ b/Makefile
@@ -205,25 +205,35 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/depend \
$(DIRECTORY)/src/mesa/main/*.[chS] \
$(DIRECTORY)/src/mesa/main/descrip.mms \
+ $(DIRECTORY)/src/mesa/main/sources \
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
$(DIRECTORY)/src/mesa/glapi/descrip.mms \
+ $(DIRECTORY)/src/mesa/glapi/sources \
$(DIRECTORY)/src/mesa/array_cache/*.[ch] \
$(DIRECTORY)/src/mesa/array_cache/descrip.mms \
+ $(DIRECTORY)/src/mesa/array_cache/sources \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/descrip.mms \
+ $(DIRECTORY)/src/mesa/math/sources \
$(DIRECTORY)/src/mesa/shader/*.[ch] \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
+ $(DIRECTORY)/src/mesa/shader/sources \
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
$(DIRECTORY)/src/mesa/shader/grammar/descrip.mms \
+ $(DIRECTORY)/src/mesa/shader/grammar/sources \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
+ $(DIRECTORY)/src/mesa/shader/slang/sources \
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
+ $(DIRECTORY)/src/mesa/swrast/sources \
$(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \
$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms \
+ $(DIRECTORY)/src/mesa/swrast_setup/sources \
$(DIRECTORY)/src/mesa/tnl/*.[chS] \
$(DIRECTORY)/src/mesa/tnl/descrip.mms \
+ $(DIRECTORY)/src/mesa/tnl/sources \
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
@@ -231,6 +241,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/common/descrip.mms \
+ $(DIRECTORY)/src/mesa/drivers/common/sources \
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
@@ -251,6 +262,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
+ $(DIRECTORY)/src/mesa/drivers/x11/sources \
$(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
$(DIRECTORY)/src/mesa/ppc/*.[ch] \
$(DIRECTORY)/src/mesa/sparc/*.[chS] \
diff --git a/debian/changelog b/debian/changelog
index 13aab843476..342741b5a05 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mesa (6.5.2~rc3-0.1) experimental; urgency=low
+
+ * Non-maintainer upload.
+ * Update to latest upstream release candidate.
+
+ -- Thierry Reding <thierry@gilfi.de> Fri, 1 Dec 2006 01:06:28 +0100
+
mesa (6.5.2~rc2-0.1) experimental; urgency=low
* Non-maintainer upload.
diff --git a/docs/relnotes-6.5.2.html b/docs/relnotes-6.5.2.html
index ba99420d7d1..a8eb970cd24 100644
--- a/docs/relnotes-6.5.2.html
+++ b/docs/relnotes-6.5.2.html
@@ -49,7 +49,10 @@ copy texturing).
<li>radeon</li>
<li>savage</li>
<li>mga</li>
+ <li>tdfx</li>
</ul>
+<li>Added support for ARB_occlusion_query to the tdfx driver (Ian
+Romanick).</li>
</ul>
<h2>Bug fixes</h2>
@@ -69,6 +72,7 @@ copy texturing).
<li>Fixed glDrawPixels(GL_COLOR_INDEX, GL_BITMAP) segfault (bug 9044)
<li>Fixed some gluBuild2DMipmaps() bugs (Greg McGarragh)
<li>Fixed broken "mgl" name mangling
+<li>Indirect rending was broken for glMap* functions (bug 8899)
</ul>
diff --git a/src/glut/fbdev/callback.c b/src/glut/fbdev/callback.c
index 37373672d36..946c8d8c133 100644
--- a/src/glut/fbdev/callback.c
+++ b/src/glut/fbdev/callback.c
@@ -24,6 +24,8 @@
* Written by Sean D'Epagnier (c) 2006
*/
+#include <stdlib.h>
+
#include <GL/glut.h>
#include "internal.h"
diff --git a/src/glut/fbdev/colormap.c b/src/glut/fbdev/colormap.c
index 89556ef4a5c..3a81f93657d 100644
--- a/src/glut/fbdev/colormap.c
+++ b/src/glut/fbdev/colormap.c
@@ -24,6 +24,7 @@
* Written by Sean D'Epagnier (c) 2006
*/
+#include <stdio.h>
#include <stdlib.h>
#include <linux/fb.h>
@@ -37,7 +38,7 @@
#define TORMAP(x)(unsigned short)((x<0?0:x>1?1:x)*(GLfloat)(REVERSECMAPSIZE-1))
#define FROMCMAP(x) (GLfloat)x / (GLfloat)((1<<16) - 1)
-static struct fb_cmap ColorMap;
+static struct fb_cmap ColorMap, OriginalColorMap;
unsigned short RedColorMap[256], GreenColorMap[256], BlueColorMap[256];
diff --git a/src/glut/fbdev/cursor.c b/src/glut/fbdev/cursor.c
index 88386956a44..6cd087e93c8 100644
--- a/src/glut/fbdev/cursor.c
+++ b/src/glut/fbdev/cursor.c
@@ -28,8 +28,10 @@
to render the cursor, this is faster, it would be good to use a hardware
cursor if it exists instead */
+#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
+#include <string.h>
#include <linux/fb.h>
diff --git a/src/glut/fbdev/ext.c b/src/glut/fbdev/ext.c
index 4a3c185a16d..65953e705b9 100644
--- a/src/glut/fbdev/ext.c
+++ b/src/glut/fbdev/ext.c
@@ -24,6 +24,8 @@
* Written by Sean D'Epagnier (c) 2006
*/
+#include <stdio.h>
+
#include <GL/gl.h>
#include <GL/glut.h>
diff --git a/src/glut/fbdev/fbdev.c b/src/glut/fbdev/fbdev.c
index ce6419816dd..7b46d545920 100644
--- a/src/glut/fbdev/fbdev.c
+++ b/src/glut/fbdev/fbdev.c
@@ -571,7 +571,8 @@ void SetVideoMode(void)
}
/* initialize colormap */
- LoadColorMap();
+ if(FixedInfo.visual != FB_VISUAL_TRUECOLOR)
+ LoadColorMap();
}
void CreateBuffer()
@@ -786,6 +787,7 @@ void glutDestroyWindow(int win)
glFBDevDestroyContext(Context);
glFBDevDestroyBuffer(Buffer);
glFBDevDestroyVisual(Visual);
+
Visual = NULL;
}
diff --git a/src/glut/fbdev/gamemode.c b/src/glut/fbdev/gamemode.c
index 9f32d9d7e82..30be36af7af 100644
--- a/src/glut/fbdev/gamemode.c
+++ b/src/glut/fbdev/gamemode.c
@@ -24,6 +24,7 @@
* Written by Sean D'Epagnier (c) 2006
*/
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/glut/fbdev/input.c b/src/glut/fbdev/input.c
index 2528a74a105..d09de22ed7e 100644
--- a/src/glut/fbdev/input.c
+++ b/src/glut/fbdev/input.c
@@ -53,7 +53,7 @@
int GpmMouse;
#endif
-int CurrentVT;
+int CurrentVT = 0;
int ConsoleFD = -1;
int KeyboardModifiers;
@@ -529,14 +529,14 @@ static void VTSwitchHandler(int sig)
/* this is a hack to turn the cursor off */
ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo);
- RestoreColorMap();
+ if(FixedInfo.visual != FB_VISUAL_TRUECOLOR)
+ RestoreColorMap();
Active = 1;
Visible = 1;
VisibleSwitch = 1;
Redisplay = 1;
-
break;
}
}
diff --git a/src/glut/fbdev/internal.h b/src/glut/fbdev/internal.h
index 082cd4f6f3a..8801cc9f6c3 100644
--- a/src/glut/fbdev/internal.h
+++ b/src/glut/fbdev/internal.h
@@ -72,14 +72,13 @@ extern GLFBDevVisualPtr Visual;
#define REVERSECMAPSIZE (1<<REVERSECMAPSIZELOG)
extern unsigned short RedColorMap[256],
- GreenColorMap[256],
- BlueColorMap[256];
+ GreenColorMap[256],
+ BlueColorMap[256];
extern unsigned char ReverseColorMap[REVERSECMAPSIZE]
[REVERSECMAPSIZE]
[REVERSECMAPSIZE];
-void LoadOldColorMap(void);
+
void LoadColorMap(void);
-void UnloadColorMap(void);
void RestoreColorMap(void);
/* --- mouse --- */
diff --git a/src/glut/fbdev/menu.c b/src/glut/fbdev/menu.c
index f5a5ef75434..18cd58d6a2d 100644
--- a/src/glut/fbdev/menu.c
+++ b/src/glut/fbdev/menu.c
@@ -25,6 +25,8 @@
*/
#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
#include <linux/fb.h>
diff --git a/src/glut/fbdev/state.c b/src/glut/fbdev/state.c
index bca675c52c4..212a04aa028 100644
--- a/src/glut/fbdev/state.c
+++ b/src/glut/fbdev/state.c
@@ -24,6 +24,7 @@
* Written by Sean D'Epagnier (c) 2006
*/
+#include <string.h>
#include <sys/time.h>
#include <linux/fb.h>
diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c
index 0ce588276be..8909a047721 100644
--- a/src/glx/x11/XF86dri.c
+++ b/src/glx/x11/XF86dri.c
@@ -203,7 +203,7 @@ PUBLIC Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString)
*hSAREA = rep.hSAREALow;
if (sizeof(drm_handle_t) == 8) {
- const int shift = 32; /* var to prevent warning on next line */
+ int shift = 32; /* var to prevent warning on next line */
*hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift;
}
@@ -566,7 +566,7 @@ PUBLIC Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer,
*hFrameBuffer = rep.hFrameBufferLow;
if (sizeof(drm_handle_t) == 8) {
- const int shift = 32; /* var to prevent warning on next line */
+ int shift = 32; /* var to prevent warning on next line */
*hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift;
}
diff --git a/src/mesa/array_cache/sources b/src/mesa/array_cache/sources
new file mode 100644
index 00000000000..fb3328d10e6
--- /dev/null
+++ b/src/mesa/array_cache/sources
@@ -0,0 +1,7 @@
+MESA_ARRAY_CACHE_SOURCES = \
+ac_context.c \
+ac_import.c
+
+MESA_ARRAY_CACHE_HEADERS = \
+ac_context.h \
+acache.h
diff --git a/src/mesa/drivers/common/sources b/src/mesa/drivers/common/sources
new file mode 100644
index 00000000000..90e29d78d3f
--- /dev/null
+++ b/src/mesa/drivers/common/sources
@@ -0,0 +1,2 @@
+MESA_DRIVER_COMMON_SOURCES = \
+driverfuncs.c
diff --git a/src/mesa/drivers/dri/i915tex/i830_context.h b/src/mesa/drivers/dri/i915tex/i830_context.h
index e5377b300aa..3d754103c0a 100644
--- a/src/mesa/drivers/dri/i915tex/i830_context.h
+++ b/src/mesa/drivers/dri/i915tex/i830_context.h
@@ -156,6 +156,11 @@ do { \
*/
extern void i830InitVtbl(struct i830_context *i830);
+extern void
+i830_state_draw_region(struct intel_context *intel,
+ struct i830_hw_state *state,
+ struct intel_region *color_region,
+ struct intel_region *depth_region);
/* i830_context.c
*/
extern GLboolean
diff --git a/src/mesa/drivers/dri/i915tex/i830_metaops.c b/src/mesa/drivers/dri/i915tex/i830_metaops.c
index c90f5022229..f76646d89db 100644
--- a/src/mesa/drivers/dri/i915tex/i830_metaops.c
+++ b/src/mesa/drivers/dri/i915tex/i830_metaops.c
@@ -400,40 +400,12 @@ meta_import_pixel_state(struct intel_context *intel)
*/
static void
meta_draw_region(struct intel_context *intel,
- struct intel_region *draw_region,
+ struct intel_region *color_region,
struct intel_region *depth_region)
{
struct i830_context *i830 = i830_context(&intel->ctx);
- GLuint format;
- GLuint depth_format = DEPTH_FRMT_16_FIXED;
- intel_region_release(&i830->meta.draw_region);
- intel_region_reference(&i830->meta.draw_region, draw_region);
-
- intel_region_release(&i830->meta.depth_region);
- intel_region_reference(&i830->meta.depth_region, depth_region);
-
- /* XXX FBO: grab code from i915 meta_draw_region */
-
- /* XXX: 555 support?
- */
- if (draw_region->cpp == 2)
- format = DV_PF_565;
- else
- format = DV_PF_8888;
-
- if (depth_region) {
- if (depth_region->cpp == 2)
- depth_format = DEPTH_FRMT_16_FIXED;
- else
- depth_format = DEPTH_FRMT_24_FIXED_8_OTHER;
- }
-
- i830->meta.Buffer[I830_DESTREG_DV1] = (DSTORG_HORT_BIAS(0x8) | /* .5 */
- DSTORG_VERT_BIAS(0x8) | /* .5 */
- format | DEPTH_IS_Z | depth_format);
-
- i830->meta.emitted &= ~I830_UPLOAD_BUFFERS;
+ i830_state_draw_region(intel, &i830->meta, color_region, depth_region);
}
diff --git a/src/mesa/drivers/dri/i915tex/i830_vtbl.c b/src/mesa/drivers/dri/i915tex/i830_vtbl.c
index 45502da290a..18fc6d4b91f 100644
--- a/src/mesa/drivers/dri/i915tex/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915tex/i830_vtbl.c
@@ -518,28 +518,79 @@ i830_destroy_context(struct intel_context *intel)
_tnl_free_vertices(&intel->ctx);
}
-static void
-i830_set_draw_region(struct intel_context *intel,
- struct intel_region *draw_region,
- struct intel_region *depth_region)
+
+void
+i830_state_draw_region(struct intel_context *intel,
+ struct i830_hw_state *state,
+ struct intel_region *color_region,
+ struct intel_region *depth_region)
{
struct i830_context *i830 = i830_context(&intel->ctx);
+ GLuint value;
- intel_region_release(&i830->state.draw_region);
- intel_region_release(&i830->state.depth_region);
- intel_region_reference(&i830->state.draw_region, draw_region);
- intel_region_reference(&i830->state.depth_region, depth_region);
+ ASSERT(state == &i830->state || state == &i830->meta);
- /* XXX FBO: Need code from i915_set_draw_region() */
+ if (state->draw_region != color_region) {
+ intel_region_release(&state->draw_region);
+ intel_region_reference(&state->draw_region, color_region);
+ }
+ if (state->depth_region != depth_region) {
+ intel_region_release(&state->depth_region);
+ intel_region_reference(&state->depth_region, depth_region);
+ }
+
+ /*
+ * Set stride/cpp values
+ */
+ if (color_region) {
+ state->Buffer[I830_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
+ state->Buffer[I830_DESTREG_CBUFADDR1] =
+ (BUF_3D_ID_COLOR_BACK |
+ BUF_3D_PITCH(color_region->pitch * color_region->cpp) |
+ BUF_3D_USE_FENCE);
+ }
+
+ if (depth_region) {
+ state->Buffer[I830_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD;
+ state->Buffer[I830_DESTREG_DBUFADDR1] =
+ (BUF_3D_ID_DEPTH |
+ BUF_3D_PITCH(depth_region->pitch * depth_region->cpp) |
+ BUF_3D_USE_FENCE);
+ }
+
+ /*
+ * Compute/set I830_DESTREG_DV1 value
+ */
+ value = (DSTORG_HORT_BIAS(0x8) | /* .5 */
+ DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */
+
+ if (color_region && color_region->cpp == 4) {
+ value |= DV_PF_8888;
+ }
+ else {
+ value |= DV_PF_565;
+ }
+ if (depth_region && depth_region->cpp == 4) {
+ value |= DEPTH_FRMT_24_FIXED_8_OTHER;
+ }
+ else {
+ value |= DEPTH_FRMT_16_FIXED;
+ }
+ state->Buffer[I830_DESTREG_DV1] = value;
I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
- I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS);
- i830->state.Buffer[I830_DESTREG_CBUFADDR1] =
- (BUF_3D_ID_COLOR_BACK | BUF_3D_PITCH(draw_region->pitch) |
- BUF_3D_USE_FENCE);
- i830->state.Buffer[I830_DESTREG_DBUFADDR1] =
- (BUF_3D_ID_DEPTH | BUF_3D_PITCH(depth_region->pitch) |
- BUF_3D_USE_FENCE);
+
+
+}
+
+
+static void
+i830_set_draw_region(struct intel_context *intel,
+ struct intel_region *color_region,
+ struct intel_region *depth_region)
+{
+ struct i830_context *i830 = i830_context(&intel->ctx);
+ i830_state_draw_region(intel, &i830->state, color_region, depth_region);
}
#if 0
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index b6b65439087..550669ab0c8 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -277,6 +277,30 @@ intelEmitFillBlit(struct intel_context *intel,
}
+static GLuint translate_raster_op(GLenum logicop)
+{
+ switch(logicop) {
+ case GL_CLEAR: return 0x00;
+ case GL_AND: return 0x88;
+ case GL_AND_REVERSE: return 0x44;
+ case GL_COPY: return 0xCC;
+ case GL_AND_INVERTED: return 0x22;
+ case GL_NOOP: return 0xAA;
+ case GL_XOR: return 0x66;
+ case GL_OR: return 0xEE;
+ case GL_NOR: return 0x11;
+ case GL_EQUIV: return 0x99;
+ case GL_INVERT: return 0x55;
+ case GL_OR_REVERSE: return 0xDD;
+ case GL_COPY_INVERTED: return 0x33;
+ case GL_OR_INVERTED: return 0xBB;
+ case GL_NAND: return 0x77;
+ case GL_SET: return 0xFF;
+ default: return 0;
+ }
+}
+
+
/* Copy BitBlt
*/
void
@@ -289,7 +313,9 @@ intelEmitCopyBlit(struct intel_context *intel,
struct _DriBufferObject *dst_buffer,
GLuint dst_offset,
GLshort src_x, GLshort src_y,
- GLshort dst_x, GLshort dst_y, GLshort w, GLshort h)
+ GLshort dst_x, GLshort dst_y,
+ GLshort w, GLshort h,
+ GLenum logic_op)
{
GLuint CMD, BR13;
int dst_y2 = dst_y + h;
@@ -309,13 +335,14 @@ intelEmitCopyBlit(struct intel_context *intel,
case 1:
case 2:
case 3:
- BR13 = (((GLint) dst_pitch) & 0xffff) | (0xCC << 16) | (1 << 24);
+ BR13 = (((GLint) dst_pitch) & 0xffff) |
+ (translate_raster_op(logic_op) << 16) | (1 << 24);
CMD = XY_SRC_COPY_BLT_CMD;
break;
case 4:
BR13 =
- (((GLint) dst_pitch) & 0xffff) | (0xCC << 16) | (1 << 24) | (1 <<
- 25);
+ (((GLint) dst_pitch) & 0xffff) |
+ (translate_raster_op(logic_op) << 16) | (1 << 24) | (1 << 25);
CMD =
(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.h b/src/mesa/drivers/dri/i915tex/intel_blit.h
index ee85c626334..e7bc280f58a 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.h
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.h
@@ -47,7 +47,8 @@ extern void intelEmitCopyBlit(struct intel_context *intel,
GLuint dst_offset,
GLshort srcx, GLshort srcy,
GLshort dstx, GLshort dsty,
- GLshort w, GLshort h);
+ GLshort w, GLshort h,
+ GLenum logicop );
extern void intelEmitFillBlit(struct intel_context *intel,
GLuint cpp,
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel.c b/src/mesa/drivers/dri/i915tex/intel_pixel.c
index 4fe128deea1..9018e3daef4 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel.c
@@ -56,8 +56,9 @@ intel_check_blit_fragment_ops(GLcontext * ctx)
!ctx->Color.ColorMask[1] ||
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits || ctx->FragmentProgram._Enabled);
+ ctx->Texture._EnabledUnits ||
+ ctx->FragmentProgram._Enabled ||
+ ctx->Color.BlendEnabled);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
index 5eb021f008b..9d478283e47 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
@@ -95,9 +95,9 @@ intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
!ctx->Color.ColorMask[1] ||
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] ||
- ctx->Color.ColorLogicOpEnabled ||
ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled);
+ ctx->FragmentProgram._Enabled ||
+ ctx->Color.BlendEnabled);
}
/* Doesn't work for overlapping regions. Could do a double copy or
@@ -344,9 +344,12 @@ do_blit_copypixels(GLcontext * ctx,
intelEmitCopyBlit(intel, dst->cpp,
src->pitch, src->buffer, 0,
dst->pitch, dst->buffer, 0,
- rect.x1 + delta_x, rect.y1 + delta_y, /* srcx, srcy */
+ rect.x1 + delta_x,
+ rect.y1 + delta_y, /* srcx, srcy */
rect.x1, rect.y1, /* dstx, dsty */
- rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.x2 - rect.x1, rect.y2 - rect.y1,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY);
}
out:
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
index 616101aef99..10a079896ae 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
@@ -252,9 +252,9 @@ do_blit_drawpixels(GLcontext * ctx,
return GL_FALSE;
}
- if (!intel_check_meta_tex_fragment_ops(ctx)) {
+ if (!intel_check_blit_fragment_ops(ctx)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
- _mesa_printf("%s - bad GL fragment state for meta tex\n",
+ _mesa_printf("%s - bad GL fragment state for blitter\n",
__FUNCTION__);
return GL_FALSE;
}
@@ -320,17 +320,19 @@ do_blit_drawpixels(GLcontext * ctx,
rect.x1 - dest_rect.x1,
rect.y2 - dest_rect.y2,
rect.x1,
- rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY);
}
fence = intel_batchbuffer_flush(intel->batch);
driFenceReference(fence);
}
UNLOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects)
+ if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, GL_FALSE);
-
- driFenceUnReference(fence);
+ driFenceUnReference(fence);
+ }
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
index c1cc65674d1..24e49ae0663 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
@@ -271,7 +271,8 @@ do_blit_readpixels(GLcontext * ctx,
rect.y1,
rect.x1 - src_rect.x1,
rect.y2 - src_rect.y2,
- rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.x2 - rect.x1, rect.y2 - rect.y1,
+ GL_COPY);
}
fence = intel_batchbuffer_flush(intel->batch);
@@ -280,11 +281,12 @@ do_blit_readpixels(GLcontext * ctx,
}
UNLOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects)
+ if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
GL_FALSE);
+ driFenceUnReference(fence);
+ }
- driFenceUnReference(fence);
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - DONE\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.c b/src/mesa/drivers/dri/i915tex/intel_regions.c
index 064a34cda81..1205b180ca6 100644
--- a/src/mesa/drivers/dri/i915tex/intel_regions.c
+++ b/src/mesa/drivers/dri/i915tex/intel_regions.c
@@ -318,7 +318,8 @@ intel_region_copy(intelScreenPrivate *intelScreen,
dst->cpp,
src->pitch, src->buffer, src_offset,
dst->pitch, dst->buffer, dst_offset,
- srcx, srcy, dstx, dsty, width, height);
+ srcx, srcy, dstx, dsty, width, height,
+ GL_COPY);
}
/* Fill a rectangular sub-region. Need better logic about when to
@@ -433,7 +434,9 @@ intel_region_cow(intelScreenPrivate *intelScreen, struct intel_region *region)
region->buffer, 0,
region->pitch,
pbo->buffer, 0,
- 0, 0, 0, 0, region->pitch, region->height);
+ 0, 0, 0, 0,
+ region->pitch, region->height,
+ GL_COPY);
intel_batchbuffer_flush(intel->batch);
UNLOCK_HARDWARE(intel);
@@ -445,7 +448,9 @@ intel_region_cow(intelScreenPrivate *intelScreen, struct intel_region *region)
region->buffer, 0,
region->pitch,
pbo->buffer, 0,
- 0, 0, 0, 0, region->pitch, region->height);
+ 0, 0, 0, 0,
+ region->pitch, region->height,
+ GL_COPY);
intel_batchbuffer_flush(intel->batch);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
index 88b62e781c0..b85a25642a2 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
@@ -145,7 +145,8 @@ do_copy_texsubimage(struct intel_context *intel,
intelImage->mt->pitch,
intelImage->mt->region->buffer,
image_offset,
- x, y + height, dstx, dsty, width, height);
+ x, y + height, dstx, dsty, width, height,
+ GL_COPY); /* ? */
intel_batchbuffer_flush(intel->batch);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_image.c b/src/mesa/drivers/dri/i915tex/intel_tex_image.c
index 79f377a4b72..22221e7322c 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_image.c
@@ -232,7 +232,8 @@ try_pbo_upload(struct intel_context *intel,
intelImage->mt->cpp,
src_stride, src_buffer, src_offset,
dst_stride, dst_buffer, dst_offset,
- 0, 0, 0, 0, width, height);
+ 0, 0, 0, 0, width, height,
+ GL_COPY);
intel_batchbuffer_flush(intel->batch);
}
diff --git a/src/mesa/drivers/dri/i965/brw_attrib.h b/src/mesa/drivers/dri/i965/brw_attrib.h
index a8efc3a528b..12659bd1cf0 100644
--- a/src/mesa/drivers/dri/i965/brw_attrib.h
+++ b/src/mesa/drivers/dri/i965/brw_attrib.h
@@ -95,6 +95,7 @@ enum {
} ;
#define BRW_ATTRIB_FIRST_MATERIAL BRW_ATTRIB_MAT_FRONT_AMBIENT
+#define BRW_ATTRIB_LAST_MATERIAL BRW_ATTRIB_MAT_BACK_INDEXES
#define BRW_MAX_COPIED_VERTS 3
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 5c0c5da7eaa..471fda9f7ef 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -209,7 +209,7 @@ static void brw_merge_inputs( struct brw_context *brw,
if (arrays[i] && arrays[i]->Enabled)
{
brw->vb.inputs[i].glarray = arrays[i];
- brw->vb.info.varying |= 1 << i;
+ brw->vb.info.varying |= (GLuint64EXT) 1 << i;
}
else
{
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index cde0aa6481b..57ee294f0cf 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -393,7 +393,7 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
{
GLcontext *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
- GLuint tmp = brw->vs.prog_data->inputs_read;
+ GLuint64EXT tmp = brw->vs.prog_data->inputs_read;
struct brw_vertex_element_packet vep;
struct brw_array_state vbp;
GLuint i;
@@ -414,10 +414,10 @@ GLboolean brw_upload_vertices( struct brw_context *brw,
*/
while (tmp) {
- GLuint i = ffs(tmp)-1;
+ GLuint i = ffsll(tmp)-1;
struct brw_vertex_element *input = &brw->vb.inputs[i];
- tmp &= ~(1<<i);
+ tmp &= ~((GLuint64EXT)1<<i);
enabled[nr_enabled++] = input;
input->index = i;
diff --git a/src/mesa/drivers/dri/i965/brw_save_api.c b/src/mesa/drivers/dri/i965/brw_save_api.c
index c541fbe0f46..06ed1d23aa2 100644
--- a/src/mesa/drivers/dri/i965/brw_save_api.c
+++ b/src/mesa/drivers/dri/i965/brw_save_api.c
@@ -417,7 +417,7 @@ static void _save_copy_to_current( GLcontext *ctx )
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
GLuint i;
- for (i = BRW_ATTRIB_POS+1 ; i <= BRW_ATTRIB_INDEX ; i++) {
+ for (i = BRW_ATTRIB_POS+1 ; i < BRW_ATTRIB_MAX ; i++) {
if (save->attrsz[i]) {
save->currentsz[i][0] = save->attrsz[i];
COPY_CLEAN_4V(save->current[i],
@@ -445,7 +445,7 @@ static void _save_copy_from_current( GLcontext *ctx )
struct brw_save_context *save = IMM_CONTEXT(ctx)->save;
GLint i;
- for (i = BRW_ATTRIB_POS+1 ; i <= BRW_ATTRIB_INDEX ; i++)
+ for (i = BRW_ATTRIB_POS+1 ; i < BRW_ATTRIB_MAX ; i++)
switch (save->attrsz[i]) {
case 4: save->attrptr[i][3] = save->current[i][3];
case 3: save->attrptr[i][2] = save->current[i][2];
@@ -1121,7 +1121,7 @@ static void _save_current_init( GLcontext *ctx )
save->current[i] = ctx->ListState.CurrentAttrib[i];
}
- for (i = BRW_ATTRIB_FIRST_MATERIAL; i < BRW_ATTRIB_INDEX; i++) {
+ for (i = BRW_ATTRIB_FIRST_MATERIAL; i <= BRW_ATTRIB_LAST_MATERIAL; i++) {
const GLuint j = i - BRW_ATTRIB_FIRST_MATERIAL;
ASSERT(j < MAT_ATTRIB_MAX);
save->currentsz[i] = &ctx->ListState.ActiveMaterialSize[j];
diff --git a/src/mesa/drivers/dri/i965/brw_save_draw.c b/src/mesa/drivers/dri/i965/brw_save_draw.c
index 84f74d3f6cf..cebdd8d0607 100644
--- a/src/mesa/drivers/dri/i965/brw_save_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_save_draw.c
@@ -38,7 +38,10 @@
#include "brw_draw.h"
#include "brw_fallback.h"
-
+/*
+ * After playback, copy everything but the position from the
+ * last vertex to the saved state
+ */
static void _playback_copy_to_current( GLcontext *ctx,
const struct brw_save_vertex_list *node )
{
@@ -47,21 +50,30 @@ static void _playback_copy_to_current( GLcontext *ctx,
GLuint i, offset;
if (node->count)
- offset = node->buffer_offset + (node->count-1) * node->vertex_size;
+ offset = (node->buffer_offset +
+ (node->count-1) * node->vertex_size * sizeof(GLfloat));
else
offset = node->buffer_offset;
- ctx->Driver.GetBufferSubData( ctx, 0, offset, node->vertex_size,
+ ctx->Driver.GetBufferSubData( ctx, 0, offset,
+ node->vertex_size * sizeof(GLfloat),
data, node->vertex_store->bufferobj );
- for (i = BRW_ATTRIB_POS+1 ; i <= BRW_ATTRIB_INDEX ; i++) {
+ for (i = 0 ; i < BRW_ATTRIB_MAX ; i++) {
if (node->attrsz[i]) {
- COPY_CLEAN_4V(save->current[i], node->attrsz[i], data);
- data += node->attrsz[i];
+ if (i != BRW_ATTRIB_POS)
+ COPY_CLEAN_4V(save->current[i], node->attrsz[i], data);
if (i >= BRW_ATTRIB_MAT_FRONT_AMBIENT &&
i <= BRW_ATTRIB_MAT_BACK_INDEXES)
ctx->NewState |= _NEW_LIGHT;
+
+ /* Edgeflag requires special treatment:
+ */
+ if (i == BRW_ATTRIB_EDGEFLAG)
+ ctx->Current.EdgeFlag = (data[0] == 1.0);
+
+ data += node->attrsz[i] * sizeof(GLfloat);
}
}
@@ -105,7 +117,7 @@ static void brw_bind_vertex_list( struct brw_save_context *save,
memset(arrays, 0, BRW_ATTRIB_MAX * sizeof(arrays[0]));
- for (attr = 0; attr <= BRW_ATTRIB_INDEX; attr++) {
+ for (attr = 0; attr < BRW_ATTRIB_MAX; attr++) {
if (node->attrsz[attr]) {
arrays[attr].Ptr = (const GLubyte *)data;
arrays[attr].Size = node->attrsz[attr];
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index da9d3bacb0e..8403e1bd7b6 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -78,7 +78,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
*/
c->nr_inputs = 0;
for (i = 0; i < BRW_ATTRIB_MAX; i++) {
- if (c->prog_data.inputs_read & (1<<i)) {
+ if (c->prog_data.inputs_read & ((GLuint64EXT)1<<i)) {
c->nr_inputs++;
c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0);
reg++;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
index 52bdb9d7614..b7893ca3e55 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c
@@ -146,8 +146,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
}
/* BRW_NEW_INPUT_VARYING */
- for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_INDEX ; i++)
- if (brw->vb.info.varying & (1<<i))
+ for (i = BRW_ATTRIB_MAT_FRONT_AMBIENT ; i < BRW_ATTRIB_MAX ; i++)
+ if (brw->vb.info.varying & ((GLuint64EXT)1<<i))
key->light_material_mask |= 1<<(i-BRW_ATTRIB_MAT_FRONT_AMBIENT);
for (i = 0; i < MAX_LIGHTS; i++) {
@@ -374,16 +374,17 @@ static void release_temps( struct tnl_program *p )
static struct ureg register_input( struct tnl_program *p, GLuint input )
{
+ GLuint orig_input = input;
/* Cram the material flags into the generic range. We'll translate
* them back later.
*/
if (input >= BRW_ATTRIB_MAT_FRONT_AMBIENT)
- input -= BRW_ATTRIB_MAT_FRONT_AMBIENT;
+ input -= BRW_ATTRIB_MAT_FRONT_AMBIENT - BRW_ATTRIB_GENERIC0;
assert(input < 32);
p->program->Base.InputsRead |= (1<<input);
- return make_ureg(PROGRAM_INPUT, input);
+ return make_ureg(PROGRAM_INPUT, orig_input);
}
static struct ureg register_output( struct tnl_program *p, GLuint output )
diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 0974f1f80ad..c8c5bf93c95 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -221,6 +221,29 @@ void intelEmitFillBlit( struct intel_context *intel,
ADVANCE_BATCH();
}
+static GLuint translate_raster_op(GLenum logicop)
+{
+ switch(logicop) {
+ case GL_CLEAR: return 0x00;
+ case GL_AND: return 0x88;
+ case GL_AND_REVERSE: return 0x44;
+ case GL_COPY: return 0xCC;
+ case GL_AND_INVERTED: return 0x22;
+ case GL_NOOP: return 0xAA;
+ case GL_XOR: return 0x66;
+ case GL_OR: return 0xEE;
+ case GL_NOR: return 0x11;
+ case GL_EQUIV: return 0x99;
+ case GL_INVERT: return 0x55;
+ case GL_OR_REVERSE: return 0xDD;
+ case GL_COPY_INVERTED: return 0x33;
+ case GL_OR_INVERTED: return 0xBB;
+ case GL_NAND: return 0x77;
+ case GL_SET: return 0xFF;
+ default: return 0;
+ }
+}
+
/* Copy BitBlt
*/
@@ -236,7 +259,8 @@ void intelEmitCopyBlit( struct intel_context *intel,
GLboolean dst_tiled,
GLshort src_x, GLshort src_y,
GLshort dst_x, GLshort dst_y,
- GLshort w, GLshort h )
+ GLshort w, GLshort h,
+ GLenum logic_op )
{
GLuint CMD, BR13;
int dst_y2 = dst_y + h;
@@ -244,12 +268,15 @@ void intelEmitCopyBlit( struct intel_context *intel,
BATCH_LOCALS;
- DBG("%s src:buf(%d)/%d %d,%d dst:buf(%d)/%d %d,%d sz:%dx%d\n",
+ DBG("%s src:buf(%d)/%d %d,%d dst:buf(%d)/%d %d,%d sz:%dx%d op:%d\n",
__FUNCTION__,
src_buffer, src_pitch, src_x, src_y,
dst_buffer, dst_pitch, dst_x, dst_y,
- w,h);
+ w,h,logic_op);
+ assert( logic_op - GL_CLEAR >= 0 );
+ assert( logic_op - GL_CLEAR < 0x10 );
+
src_pitch *= cpp;
dst_pitch *= cpp;
@@ -257,11 +284,12 @@ void intelEmitCopyBlit( struct intel_context *intel,
case 1:
case 2:
case 3:
- BR13 = (0xCC << 16) | (1<<24);
+ BR13 = (translate_raster_op(logic_op) << 16) | (1<<24);
CMD = XY_SRC_COPY_BLT_CMD;
break;
case 4:
- BR13 = (0xCC << 16) | (1<<24) | (1<<25);
+ BR13 = (translate_raster_op(logic_op) << 16) | (1<<24) |
+ (1<<25);
CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
XY_SRC_COPY_BLT_WRITE_RGB);
break;
diff --git a/src/mesa/drivers/dri/i965/intel_blit.h b/src/mesa/drivers/dri/i965/intel_blit.h
index b15fb1c2b7f..8b0cc65243c 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.h
+++ b/src/mesa/drivers/dri/i965/intel_blit.h
@@ -49,7 +49,8 @@ extern void intelEmitCopyBlit( struct intel_context *intel,
GLboolean dst_tiled,
GLshort srcx, GLshort srcy,
GLshort dstx, GLshort dsty,
- GLshort w, GLshort h );
+ GLshort w, GLshort h,
+ GLenum logic_op );
extern void intelEmitFillBlit( struct intel_context *intel,
GLuint cpp,
diff --git a/src/mesa/drivers/dri/i965/intel_pixel_copy.c b/src/mesa/drivers/dri/i965/intel_pixel_copy.c
index d5d48994529..55b58a8f670 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel_copy.c
@@ -92,9 +92,9 @@ intel_check_blit_fragment_ops(GLcontext * ctx)
!ctx->Color.ColorMask[1] ||
!ctx->Color.ColorMask[2] ||
!ctx->Color.ColorMask[3] || /* can do this! */
- ctx->Color.ColorLogicOpEnabled || /* can do this! */
ctx->Texture._EnabledUnits ||
- ctx->FragmentProgram._Enabled);
+ ctx->FragmentProgram._Enabled ||
+ ctx->Color.BlendEnabled);
}
@@ -210,7 +210,9 @@ do_blit_copypixels(GLcontext * ctx,
rect.x1 + delta_x,
rect.y1 + delta_y, /* srcx, srcy */
rect.x1, rect.y1, /* dstx, dsty */
- rect.x2 - rect.x1, rect.y2 - rect.y1);
+ rect.x2 - rect.x1, rect.y2 - rect.y1,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY);
}
intel->need_flush = GL_TRUE;
diff --git a/src/mesa/drivers/dri/i965/intel_regions.c b/src/mesa/drivers/dri/i965/intel_regions.c
index 53f05612377..398b0a0a3b5 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.c
+++ b/src/mesa/drivers/dri/i965/intel_regions.c
@@ -269,7 +269,8 @@ void intel_region_copy( struct intel_context *intel,
dst->pitch, dst->buffer, dst_offset, dst->tiled,
srcx, srcy,
dstx, dsty,
- width, height);
+ width, height,
+ GL_COPY );
}
/* Fill a rectangular sub-region. Need better logic about when to
diff --git a/src/mesa/drivers/dri/r200/r200_fragshader.c b/src/mesa/drivers/dri/r200/r200_fragshader.c
index c350b9aaf3f..5dd3adaef69 100644
--- a/src/mesa/drivers/dri/r200/r200_fragshader.c
+++ b/src/mesa/drivers/dri/r200/r200_fragshader.c
@@ -362,7 +362,7 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
if (shader->NumPasses < 2) {
for (reg = 0; reg < R200_MAX_TEXTURE_UNITS; reg++) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[reg]._Current;
+ GLbitfield targetbit = ctx->Texture.Unit[reg]._ReallyEnabled;
R200_STATECHANGE( rmesa, tex[reg] );
rmesa->hw.tex[reg].cmd[TEX_PP_TXMULTI_CTL] = 0;
if (shader->SetupInst[0][reg].Opcode) {
@@ -385,15 +385,16 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
else {
txformat_x |= R200_TEXCOORD_PROJ;
}
+ rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
}
- else if (texObj->Target == GL_TEXTURE_3D) {
+ else if (targetbit == TEXTURE_3D_BIT) {
txformat_x |= R200_TEXCOORD_VOLUME;
}
- else if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ else if (targetbit == TEXTURE_CUBE_BIT) {
txformat_x |= R200_TEXCOORD_CUBIC_ENV;
}
else if (shader->SetupInst[0][reg].swizzle == GL_SWIZZLE_STR_ATI ||
- shader->SetupInst[0][reg].swizzle == GL_SWIZZLE_STQ_ATI) {
+ shader->SetupInst[0][reg].swizzle == GL_SWIZZLE_STQ_ATI) {
txformat_x |= R200_TEXCOORD_NONPROJ;
}
else {
@@ -401,16 +402,16 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
}
rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT] = txformat;
rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT_X] = txformat_x;
- /* is this a good idea? Could potentially sample from not enabled unit.
- results are probably undefined anyway (?) but I hope it doesn't lock up... */
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
+ /* enabling texturing when unit isn't correctly configured may not be safe */
+ if (targetbit)
+ rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
}
}
} else {
/* setup 1st pass */
for (reg = 0; reg < R200_MAX_TEXTURE_UNITS; reg++) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[reg]._Current;
+ GLbitfield targetbit = ctx->Texture.Unit[reg]._ReallyEnabled;
R200_STATECHANGE( rmesa, tex[reg] );
GLuint txformat_multi = 0;
if (shader->SetupInst[0][reg].Opcode) {
@@ -425,11 +426,12 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
else {
txformat_multi |= R200_PASS1_TEXCOORD_PROJ;
}
+ rmesa->hw.cst.cmd[CST_PP_CNTL_X] |= R200_PPX_TEX_0_ENABLE << reg;
}
- else if (texObj->Target == GL_TEXTURE_3D) {
+ else if (targetbit == TEXTURE_3D_BIT) {
txformat_multi |= R200_PASS1_TEXCOORD_VOLUME;
}
- else if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ else if (targetbit == TEXTURE_CUBE_BIT) {
txformat_multi |= R200_PASS1_TEXCOORD_CUBIC_ENV;
}
else if (shader->SetupInst[0][reg].swizzle == GL_SWIZZLE_STR_ATI ||
@@ -439,14 +441,15 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
else {
txformat_multi |= R200_PASS1_TEXCOORD_PROJ;
}
- rmesa->hw.cst.cmd[CST_PP_CNTL_X] |= R200_PPX_TEX_0_ENABLE << reg;
+ if (targetbit)
+ rmesa->hw.cst.cmd[CST_PP_CNTL_X] |= R200_PPX_TEX_0_ENABLE << reg;
}
rmesa->hw.tex[reg].cmd[TEX_PP_TXMULTI_CTL] = txformat_multi;
}
/* setup 2nd pass */
for (reg=0; reg < R200_MAX_TEXTURE_UNITS; reg++) {
- struct gl_texture_object *texObj = ctx->Texture.Unit[reg]._Current;
+ GLbitfield targetbit = ctx->Texture.Unit[reg]._ReallyEnabled;
if (shader->SetupInst[1][reg].Opcode) {
GLuint coord = shader->SetupInst[1][reg].src;
GLuint txformat = rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT]
@@ -463,15 +466,16 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
else {
txformat_x |= R200_TEXCOORD_PROJ;
}
+ rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
}
- else if (texObj->Target == GL_TEXTURE_3D) {
+ else if (targetbit == TEXTURE_3D_BIT) {
txformat_x |= R200_TEXCOORD_VOLUME;
}
- else if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ else if (targetbit == TEXTURE_CUBE_BIT) {
txformat_x |= R200_TEXCOORD_CUBIC_ENV;
}
else if (shader->SetupInst[1][reg].swizzle == GL_SWIZZLE_STR_ATI ||
- shader->SetupInst[1][reg].swizzle == GL_SWIZZLE_STQ_ATI) {
+ shader->SetupInst[1][reg].swizzle == GL_SWIZZLE_STQ_ATI) {
txformat_x |= R200_TEXCOORD_NONPROJ;
}
else {
@@ -488,7 +492,8 @@ static void r200UpdateFSRouting( GLcontext *ctx ) {
}
rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT_X] = txformat_x;
rmesa->hw.tex[reg].cmd[TEX_PP_TXFORMAT] = txformat;
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
+ if (targetbit)
+ rmesa->hw.ctx.cmd[CTX_PP_CNTL] |= R200_TEX_0_ENABLE << reg;
}
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index cab54512146..32c0128eaa2 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -544,8 +544,6 @@ static pfs_reg_t t_scalar_src(struct r300_fragment_program *rp,
struct prog_src_register src = fpsrc;
int sc = GET_SWZ(fpsrc.Swizzle, 0); /* X */
- printf("sc %d\n",sc);
-
src.Swizzle = ((sc<<0)|(sc<<3)|(sc<<6)|(sc<<9));
return t_src(rp, src);
@@ -1670,7 +1668,7 @@ void r300_translate_fragment_shader(struct r300_fragment_program *rp)
assert(rp->alu_end >= 0);
rp->translated = GL_TRUE;
- if (1) dump_program(rp);
+ if (0) dump_program(rp);
}
update_params(rp);
diff --git a/src/mesa/drivers/x11/sources b/src/mesa/drivers/x11/sources
new file mode 100644
index 00000000000..d76d65eaad1
--- /dev/null
+++ b/src/mesa/drivers/x11/sources
@@ -0,0 +1,8 @@
+# Note: only listing sources needed for X server renderer
+MESA_DRIVER_X11_SOURCES = \
+xm_api.c \
+xm_buffer.c \
+xm_dd.c \
+xm_line.c \
+xm_span.c \
+xm_tri.c
diff --git a/src/mesa/glapi/sources b/src/mesa/glapi/sources
new file mode 100644
index 00000000000..1d5c2528211
--- /dev/null
+++ b/src/mesa/glapi/sources
@@ -0,0 +1,12 @@
+MESA_GLAPI_SOURCES = \
+glapi.c \
+glthread.c
+
+MESA_GLAPI_HEADERS = \
+dispatch.h \
+glapi.h \
+glapioffsets.h \
+glapitable.h \
+glapitemp.h \
+glprocs.h \
+glthread.h
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index 804700118f2..1899975213f 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1051,7 +1051,7 @@ GLboolean _ae_create_context( GLcontext *ctx )
FogCoordFuncs[6] = _gloffset_FogCoordfvEXT;
FogCoordFuncs[7] = _gloffset_FogCoorddvEXT;
- ctx->aelt_context = MALLOC( sizeof(AEcontext) );
+ ctx->aelt_context = CALLOC( sizeof(AEcontext) );
if (!ctx->aelt_context)
return GL_FALSE;
@@ -1076,6 +1076,7 @@ static void check_vbo( AEcontext *actx,
for (i = 0; i < actx->nr_vbos; i++)
if (actx->vbo[i] == vbo)
return;
+ assert(actx->nr_vbos < VERT_ATTRIB_MAX);
actx->vbo[actx->nr_vbos++] = vbo;
}
}
@@ -1094,6 +1095,8 @@ static void _ae_update_state( GLcontext *ctx )
AEattrib *at = actx->attribs;
GLuint i;
+ actx->nr_vbos = 0;
+
/* conventional vertex arrays */
if (ctx->Array.ArrayObj->Index.Enabled) {
aa->array = &ctx->Array.ArrayObj->Index;
@@ -1143,7 +1146,7 @@ static void _ae_update_state( GLcontext *ctx )
[at->array->Size-1]
[TYPE_IDX(at->array->Type)];
at->index = VERT_ATTRIB_TEX0 + i;
- check_vbo(actx, aa->array->BufferObj);
+ check_vbo(actx, at->array->BufferObj);
at++;
}
}
@@ -1170,7 +1173,7 @@ static void _ae_update_state( GLcontext *ctx )
[TYPE_IDX(at->array->Type)];
}
at->index = i;
- check_vbo(actx, aa->array->BufferObj);
+ check_vbo(actx, at->array->BufferObj);
at++;
}
}
@@ -1220,7 +1223,8 @@ void _ae_map_vbos( GLcontext *ctx )
GL_DYNAMIC_DRAW_ARB,
actx->vbo[i]);
- actx->mapped_vbos = GL_TRUE;
+ if (actx->nr_vbos)
+ actx->mapped_vbos = GL_TRUE;
}
void _ae_unmap_vbos( GLcontext *ctx )
@@ -1295,6 +1299,19 @@ void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
{
AEcontext *actx = AE_CONTEXT(ctx);
- assert(!actx->mapped_vbos);
- actx->NewState |= new_state;
+
+ /* Only interested in this subset of mesa state. Need to prune
+ * this down as both tnl/ and the drivers can raise statechanges
+ * for arcane reasons in the middle of seemingly atomic operations
+ * like DrawElements, over which we'd like to keep a known set of
+ * arrays and vbo's mapped.
+ *
+ * Luckily, neither the drivers nor tnl muck with the state that
+ * concerns us here:
+ */
+ new_state &= _NEW_ARRAY | _NEW_PROGRAM;
+ if (new_state) {
+ assert(!actx->mapped_vbos);
+ actx->NewState |= new_state;
+ }
}
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index 51d5af6f5f0..717ef1fc8f0 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -510,7 +510,7 @@ loopback_TexCoord2sv( const GLshort *v )
static void GLAPIENTRY
loopback_TexCoord3dv( const GLdouble *v )
{
- TEXCOORD2((GLfloat) v[0],(GLfloat) v[1]);
+ TEXCOORD3((GLfloat) v[0],(GLfloat) v[1],(GLfloat) v[2]);
}
static void GLAPIENTRY
diff --git a/src/mesa/main/sources b/src/mesa/main/sources
new file mode 100644
index 00000000000..dfcff89e4b6
--- /dev/null
+++ b/src/mesa/main/sources
@@ -0,0 +1,138 @@
+# List of source files in this directory used for X.org xserver build
+MESA_MAIN_SOURCES = \
+accum.c \
+api_arrayelt.c \
+api_loopback.c \
+api_noop.c \
+api_validate.c \
+arrayobj.c \
+attrib.c \
+blend.c \
+bufferobj.c \
+buffers.c \
+clip.c \
+colortab.c \
+context.c \
+convolve.c \
+debug.c \
+depth.c \
+depthstencil.c \
+dlist.c \
+drawpix.c \
+enable.c \
+enums.c \
+eval.c \
+execmem.c \
+extensions.c \
+fbobject.c \
+feedback.c \
+fog.c \
+framebuffer.c \
+get.c \
+getstring.c \
+hash.c \
+hint.c \
+histogram.c \
+image.c \
+imports.c \
+light.c \
+lines.c \
+matrix.c \
+mipmap.c \
+mm.c \
+occlude.c \
+pixel.c \
+points.c \
+polygon.c \
+rastpos.c \
+rbadaptors.c \
+renderbuffer.c \
+state.c \
+stencil.c \
+texcompress.c \
+texcompress_fxt1.c \
+texcompress_s3tc.c \
+texenvprogram.c \
+texformat.c \
+teximage.c \
+texobj.c \
+texrender.c \
+texstate.c \
+texstore.c \
+varray.c \
+$(VSNPRINTF_SOURCES) \
+vtxfmt.c
+
+MESA_VSNPRINTF_SOURCES = \
+vsnprintf.c
+
+MESA_MAIN_HEADERS = \
+accum.h \
+api_arrayelt.h \
+api_eval.h \
+api_loopback.h \
+api_noop.h \
+api_validate.h \
+arrayobj.h \
+attrib.h \
+bitset.h \
+blend.h \
+bufferobj.h \
+buffers.h \
+clip.h \
+colormac.h \
+colortab.h \
+config.h \
+context.h \
+convolve.h \
+dd.h \
+debug.h \
+depth.h \
+depthstencil.h \
+dlist.h \
+drawpix.h \
+enable.h \
+enums.h \
+eval.h \
+extensions.h \
+fbobject.h \
+feedback.h \
+fog.h \
+framebuffer.h \
+get.h \
+glheader.h \
+hash.h \
+hint.h \
+histogram.h \
+image.h \
+imports.h \
+light.h \
+lines.h \
+macros.h \
+matrix.h \
+mipmap.h \
+mm.h \
+mtypes.h \
+occlude.h \
+pixel.h \
+points.h \
+polygon.h \
+rastpos.h \
+rbadaptors.h \
+renderbuffer.h \
+simple_list.h \
+state.h \
+stencil.h \
+texcompress.h \
+texenvprogram.h \
+texformat.h \
+texformat_tmp.h \
+teximage.h \
+texobj.h \
+texrender.h \
+texstate.h \
+texstore.h \
+varray.h \
+version.h \
+vtxfmt.h \
+vtxfmt_tmp.h
diff --git a/src/mesa/math/sources b/src/mesa/math/sources
new file mode 100644
index 00000000000..7c7dcccedfd
--- /dev/null
+++ b/src/mesa/math/sources
@@ -0,0 +1,25 @@
+MESA_MATH_SOURCES = \
+m_debug_clip.c \
+m_debug_norm.c \
+m_debug_xform.c \
+m_eval.c \
+m_matrix.c \
+m_translate.c \
+m_vector.c \
+m_xform.c
+
+MESA_MATH_HEADERS = \
+m_clip_tmp.h \
+m_copy_tmp.h \
+m_debug.h \
+m_debug_util.h \
+m_dotprod_tmp.h \
+m_eval.h \
+m_matrix.h \
+m_norm_tmp.h \
+m_trans_tmp.h \
+m_translate.h \
+m_vector.h \
+m_xform.h \
+m_xform_tmp.h \
+mathmod.h
diff --git a/src/mesa/shader/grammar/sources b/src/mesa/shader/grammar/sources
new file mode 100644
index 00000000000..a6bbfd3ffd3
--- /dev/null
+++ b/src/mesa/shader/grammar/sources
@@ -0,0 +1,8 @@
+MESA_SHADER_GRAMMAR_SOURCES = \
+grammar_mesa.c
+
+MESA_SHADER_GRAMMAR_HEADERS = \
+grammar.c \
+grammar.h \
+grammar_mesa.h \
+grammar_syn.h
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.c b/src/mesa/shader/slang/slang_assemble_constructor.c
index 9d1aa707182..8b5458f7661 100644
--- a/src/mesa/shader/slang/slang_assemble_constructor.c
+++ b/src/mesa/shader/slang/slang_assemble_constructor.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.2
*
* Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
*
@@ -32,348 +32,365 @@
#include "slang_assemble.h"
#include "slang_storage.h"
-/* _slang_is_swizzle() */
-GLboolean _slang_is_swizzle (const char *field, GLuint rows, slang_swizzle *swz)
+
+/**
+ * Checks if a field selector is a general swizzle (an r-value swizzle
+ * with replicated components or an l-value swizzle mask) for a
+ * vector. Returns GL_TRUE if this is the case, <swz> is filled with
+ * swizzle information. Returns GL_FALSE otherwise.
+ */
+GLboolean
+_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle * swz)
{
- GLuint i;
- GLboolean xyzw = GL_FALSE, rgba = GL_FALSE, stpq = GL_FALSE;
-
- /* the swizzle can be at most 4-component long */
- swz->num_components = slang_string_length (field);
- if (swz->num_components > 4)
- return GL_FALSE;
-
- for (i = 0; i < swz->num_components; i++)
- {
- /* mark which swizzle group is used */
- switch (field[i])
- {
- case 'x':
- case 'y':
- case 'z':
- case 'w':
- xyzw = GL_TRUE;
- break;
- case 'r':
- case 'g':
- case 'b':
- case 'a':
- rgba = GL_TRUE;
- break;
- case 's':
- case 't':
- case 'p':
- case 'q':
- stpq = GL_TRUE;
- break;
- default:
- return GL_FALSE;
- }
-
- /* collect swizzle component */
- switch (field[i])
- {
- case 'x':
- case 'r':
- case 's':
- swz->swizzle[i] = 0;
- break;
- case 'y':
- case 'g':
- case 't':
- swz->swizzle[i] = 1;
- break;
- case 'z':
- case 'b':
- case 'p':
- swz->swizzle[i] = 2;
- break;
- case 'w':
- case 'a':
- case 'q':
- swz->swizzle[i] = 3;
- break;
- }
-
- /* check if the component is valid for given vector's row count */
- if (rows <= swz->swizzle[i])
- return GL_FALSE;
- }
-
- /* only one swizzle group can be used */
- if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq))
- return GL_FALSE;
-
- return GL_TRUE;
+ GLuint i;
+ GLboolean xyzw = GL_FALSE, rgba = GL_FALSE, stpq = GL_FALSE;
+
+ /* the swizzle can be at most 4-component long */
+ swz->num_components = slang_string_length(field);
+ if (swz->num_components > 4)
+ return GL_FALSE;
+
+ for (i = 0; i < swz->num_components; i++) {
+ /* mark which swizzle group is used */
+ switch (field[i]) {
+ case 'x':
+ case 'y':
+ case 'z':
+ case 'w':
+ xyzw = GL_TRUE;
+ break;
+ case 'r':
+ case 'g':
+ case 'b':
+ case 'a':
+ rgba = GL_TRUE;
+ break;
+ case 's':
+ case 't':
+ case 'p':
+ case 'q':
+ stpq = GL_TRUE;
+ break;
+ default:
+ return GL_FALSE;
+ }
+
+ /* collect swizzle component */
+ switch (field[i]) {
+ case 'x':
+ case 'r':
+ case 's':
+ swz->swizzle[i] = 0;
+ break;
+ case 'y':
+ case 'g':
+ case 't':
+ swz->swizzle[i] = 1;
+ break;
+ case 'z':
+ case 'b':
+ case 'p':
+ swz->swizzle[i] = 2;
+ break;
+ case 'w':
+ case 'a':
+ case 'q':
+ swz->swizzle[i] = 3;
+ break;
+ }
+
+ /* check if the component is valid for given vector's row count */
+ if (rows <= swz->swizzle[i])
+ return GL_FALSE;
+ }
+
+ /* only one swizzle group can be used */
+ if ((xyzw && rgba) || (xyzw && stpq) || (rgba && stpq))
+ return GL_FALSE;
+
+ return GL_TRUE;
}
-/* _slang_is_swizzle_mask() */
-GLboolean _slang_is_swizzle_mask (const slang_swizzle *swz, GLuint rows)
+
+/**
+ * Checks if a general swizzle is an l-value swizzle - these swizzles
+ * do not have duplicated fields. Returns GL_TRUE if this is a
+ * swizzle mask. Returns GL_FALSE otherwise
+ */
+GLboolean
+_slang_is_swizzle_mask(const slang_swizzle * swz, GLuint rows)
{
- GLuint i, c = 0;
+ GLuint i, c = 0;
- /* the swizzle may not be longer than the vector dim */
- if (swz->num_components > rows)
- return GL_FALSE;
+ /* the swizzle may not be longer than the vector dim */
+ if (swz->num_components > rows)
+ return GL_FALSE;
- /* the swizzle components cannot be duplicated */
- for (i = 0; i < swz->num_components; i++)
- {
- if ((c & (1 << swz->swizzle[i])) != 0)
- return GL_FALSE;
- c |= 1 << swz->swizzle[i];
- }
+ /* the swizzle components cannot be duplicated */
+ for (i = 0; i < swz->num_components; i++) {
+ if ((c & (1 << swz->swizzle[i])) != 0)
+ return GL_FALSE;
+ c |= 1 << swz->swizzle[i];
+ }
- return GL_TRUE;
+ return GL_TRUE;
}
-/* _slang_multiply_swizzles() */
-GLvoid _slang_multiply_swizzles (slang_swizzle *dst, const slang_swizzle *left,
- const slang_swizzle *right)
+
+/**
+ * Combines (multiplies) two swizzles to form single swizzle.
+ * Example: "vec.wzyx.yx" --> "vec.zw".
+ */
+GLvoid
+_slang_multiply_swizzles(slang_swizzle * dst, const slang_swizzle * left,
+ const slang_swizzle * right)
{
- GLuint i;
+ GLuint i;
- dst->num_components = right->num_components;
- for (i = 0; i < right->num_components; i++)
- dst->swizzle[i] = left->swizzle[right->swizzle[i]];
+ dst->num_components = right->num_components;
+ for (i = 0; i < right->num_components; i++)
+ dst->swizzle[i] = left->swizzle[right->swizzle[i]];
}
-/* _slang_assemble_constructor() */
+
static GLboolean
-sizeof_argument (slang_assemble_ctx *A, GLuint *size, slang_operation *op)
+sizeof_argument(slang_assemble_ctx * A, GLuint * size, slang_operation * op)
{
slang_assembly_typeinfo ti;
GLboolean result = GL_FALSE;
slang_storage_aggregate agg;
- if (!slang_assembly_typeinfo_construct (&ti))
+ if (!slang_assembly_typeinfo_construct(&ti))
return GL_FALSE;
- if (!_slang_typeof_operation (A, op, &ti))
+ if (!_slang_typeof_operation(A, op, &ti))
goto end1;
- if (!slang_storage_aggregate_construct (&agg))
+ if (!slang_storage_aggregate_construct(&agg))
goto end1;
- if (!_slang_aggregate_variable (&agg, &ti.spec, 0, A->space.funcs, A->space.structs,
- A->space.vars, A->mach, A->file, A->atoms))
+ if (!_slang_aggregate_variable
+ (&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars,
+ A->mach, A->file, A->atoms))
goto end;
- *size = _slang_sizeof_aggregate (&agg);
+ *size = _slang_sizeof_aggregate(&agg);
result = GL_TRUE;
-end:
- slang_storage_aggregate_destruct (&agg);
-end1:
- slang_assembly_typeinfo_destruct (&ti);
+ end:
+ slang_storage_aggregate_destruct(&agg);
+ end1:
+ slang_assembly_typeinfo_destruct(&ti);
return result;
}
-static GLboolean constructor_aggregate (slang_assemble_ctx *A, const slang_storage_aggregate *flat,
- slang_operation *op, GLuint garbage_size)
+static GLboolean
+constructor_aggregate(slang_assemble_ctx * A,
+ const slang_storage_aggregate * flat,
+ slang_operation * op, GLuint garbage_size)
{
- slang_assembly_typeinfo ti;
- GLboolean result = GL_FALSE;
- slang_storage_aggregate agg, flat_agg;
-
- if (!slang_assembly_typeinfo_construct (&ti))
- return GL_FALSE;
- if (!_slang_typeof_operation (A, op, &ti))
- goto end1;
-
- if (!slang_storage_aggregate_construct (&agg))
- goto end1;
- if (!_slang_aggregate_variable (&agg, &ti.spec, 0, A->space.funcs, A->space.structs,
- A->space.vars, A->mach, A->file, A->atoms))
- goto end2;
-
- if (!slang_storage_aggregate_construct (&flat_agg))
- goto end2;
- if (!_slang_flatten_aggregate (&flat_agg, &agg))
- goto end;
-
- if (!_slang_assemble_operation (A, op, slang_ref_forbid))
- goto end;
-
- /* TODO: convert (generic) elements */
-
- /* free the garbage */
- if (garbage_size != 0)
- {
- GLuint i;
-
- /* move the non-garbage part to the end of the argument */
- if (!slang_assembly_file_push_label (A->file, slang_asm_addr_push, 0))
- goto end;
- for (i = flat_agg.count * 4 - garbage_size; i > 0; i -= 4)
- {
- if (!slang_assembly_file_push_label2 (A->file, slang_asm_float_move,
- garbage_size + i, i))
- {
- goto end;
- }
- }
- if (!slang_assembly_file_push_label (A->file, slang_asm_local_free, garbage_size + 4))
- goto end;
- }
-
- result = GL_TRUE;
-end:
- slang_storage_aggregate_destruct (&flat_agg);
-end2:
- slang_storage_aggregate_destruct (&agg);
-end1:
- slang_assembly_typeinfo_destruct (&ti);
- return result;
+ slang_assembly_typeinfo ti;
+ GLboolean result = GL_FALSE;
+ slang_storage_aggregate agg, flat_agg;
+
+ if (!slang_assembly_typeinfo_construct(&ti))
+ return GL_FALSE;
+ if (!_slang_typeof_operation(A, op, &ti))
+ goto end1;
+
+ if (!slang_storage_aggregate_construct(&agg))
+ goto end1;
+ if (!_slang_aggregate_variable
+ (&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars,
+ A->mach, A->file, A->atoms))
+ goto end2;
+
+ if (!slang_storage_aggregate_construct(&flat_agg))
+ goto end2;
+ if (!_slang_flatten_aggregate(&flat_agg, &agg))
+ goto end;
+
+ if (!_slang_assemble_operation(A, op, slang_ref_forbid))
+ goto end;
+
+ /* TODO: convert (generic) elements */
+
+ /* free the garbage */
+ if (garbage_size != 0) {
+ GLuint i;
+
+ /* move the non-garbage part to the end of the argument */
+ if (!slang_assembly_file_push_label(A->file, slang_asm_addr_push, 0))
+ goto end;
+ for (i = flat_agg.count * 4 - garbage_size; i > 0; i -= 4) {
+ if (!slang_assembly_file_push_label2(A->file, slang_asm_float_move,
+ garbage_size + i, i)) {
+ goto end;
+ }
+ }
+ if (!slang_assembly_file_push_label
+ (A->file, slang_asm_local_free, garbage_size + 4))
+ goto end;
+ }
+
+ result = GL_TRUE;
+ end:
+ slang_storage_aggregate_destruct(&flat_agg);
+ end2:
+ slang_storage_aggregate_destruct(&agg);
+ end1:
+ slang_assembly_typeinfo_destruct(&ti);
+ return result;
}
-GLboolean _slang_assemble_constructor (slang_assemble_ctx *A, slang_operation *op)
+GLboolean
+_slang_assemble_constructor(slang_assemble_ctx * A, slang_operation * op)
{
- slang_assembly_typeinfo ti;
- GLboolean result = GL_FALSE;
- slang_storage_aggregate agg, flat;
- GLuint size, i;
- GLuint arg_sums[2];
-
- /* get typeinfo of the constructor (the result of constructor expression) */
- if (!slang_assembly_typeinfo_construct (&ti))
- return GL_FALSE;
- if (!_slang_typeof_operation (A, op, &ti))
- goto end1;
-
- /* create an aggregate of the constructor */
- if (!slang_storage_aggregate_construct (&agg))
- goto end1;
- if (!_slang_aggregate_variable (&agg, &ti.spec, 0, A->space.funcs, A->space.structs,
- A->space.vars, A->mach, A->file, A->atoms))
- goto end2;
-
- /* calculate size of the constructor */
- size = _slang_sizeof_aggregate (&agg);
-
- /* flatten the constructor */
- if (!slang_storage_aggregate_construct (&flat))
- goto end2;
- if (!_slang_flatten_aggregate (&flat, &agg))
- goto end;
-
- /* collect the last two constructor's argument size sums */
- arg_sums[0] = 0; /* will hold all but the last argument's size sum */
- arg_sums[1] = 0; /* will hold all argument's size sum */
- for (i = 0; i < op->num_children; i++)
- {
- GLuint arg_size = 0;
-
- if (!sizeof_argument (A, &arg_size, &op->children[i]))
- goto end;
- if (i > 0)
- arg_sums[0] = arg_sums[1];
- arg_sums[1] += arg_size;
- }
-
- /* check if there are too many arguments */
- if (arg_sums[0] >= size)
- {
- /* TODO: info log: too many arguments in constructor list */
- goto end;
- }
-
- /* check if there are too few arguments */
- if (arg_sums[1] < size)
- {
- /* TODO: info log: too few arguments in constructor list */
- goto end;
- }
-
- /* traverse the children that form the constructor expression */
- for (i = op->num_children; i > 0; i--)
- {
- GLuint garbage_size;
-
- /* the last argument may be too big - calculate the unnecessary data size */
- if (i == op->num_children)
- garbage_size = arg_sums[1] - size;
- else
- garbage_size = 0;
-
- if (!constructor_aggregate (A, &flat, &op->children[i - 1], garbage_size))
- goto end;
- }
-
- result = GL_TRUE;
-end:
- slang_storage_aggregate_destruct (&flat);
-end2:
- slang_storage_aggregate_destruct (&agg);
-end1:
- slang_assembly_typeinfo_destruct (&ti);
- return result;
+ slang_assembly_typeinfo ti;
+ GLboolean result = GL_FALSE;
+ slang_storage_aggregate agg, flat;
+ GLuint size, i;
+ GLuint arg_sums[2];
+
+ /* get typeinfo of the constructor (the result of constructor expression) */
+ if (!slang_assembly_typeinfo_construct(&ti))
+ return GL_FALSE;
+ if (!_slang_typeof_operation(A, op, &ti))
+ goto end1;
+
+ /* create an aggregate of the constructor */
+ if (!slang_storage_aggregate_construct(&agg))
+ goto end1;
+ if (!_slang_aggregate_variable
+ (&agg, &ti.spec, 0, A->space.funcs, A->space.structs, A->space.vars,
+ A->mach, A->file, A->atoms))
+ goto end2;
+
+ /* calculate size of the constructor */
+ size = _slang_sizeof_aggregate(&agg);
+
+ /* flatten the constructor */
+ if (!slang_storage_aggregate_construct(&flat))
+ goto end2;
+ if (!_slang_flatten_aggregate(&flat, &agg))
+ goto end;
+
+ /* collect the last two constructor's argument size sums */
+ arg_sums[0] = 0; /* will hold all but the last argument's size sum */
+ arg_sums[1] = 0; /* will hold all argument's size sum */
+ for (i = 0; i < op->num_children; i++) {
+ GLuint arg_size = 0;
+
+ if (!sizeof_argument(A, &arg_size, &op->children[i]))
+ goto end;
+ if (i > 0)
+ arg_sums[0] = arg_sums[1];
+ arg_sums[1] += arg_size;
+ }
+
+ /* check if there are too many arguments */
+ if (arg_sums[0] >= size) {
+ /* TODO: info log: too many arguments in constructor list */
+ goto end;
+ }
+
+ /* check if there are too few arguments */
+ if (arg_sums[1] < size) {
+ /* TODO: info log: too few arguments in constructor list */
+ goto end;
+ }
+
+ /* traverse the children that form the constructor expression */
+ for (i = op->num_children; i > 0; i--) {
+ GLuint garbage_size;
+
+ /* the last argument may be too big - calculate the unnecessary
+ * data size
+ */
+ if (i == op->num_children)
+ garbage_size = arg_sums[1] - size;
+ else
+ garbage_size = 0;
+
+ if (!constructor_aggregate
+ (A, &flat, &op->children[i - 1], garbage_size))
+ goto end;
+ }
+
+ result = GL_TRUE;
+ end:
+ slang_storage_aggregate_destruct(&flat);
+ end2:
+ slang_storage_aggregate_destruct(&agg);
+ end1:
+ slang_assembly_typeinfo_destruct(&ti);
+ return result;
}
-/* _slang_assemble_constructor_from_swizzle() */
-GLboolean _slang_assemble_constructor_from_swizzle (slang_assemble_ctx *A, const slang_swizzle *swz,
- slang_type_specifier *spec, slang_type_specifier *master_spec)
+
+GLboolean
+_slang_assemble_constructor_from_swizzle(slang_assemble_ctx * A,
+ const slang_swizzle * swz,
+ slang_type_specifier * spec,
+ slang_type_specifier * master_spec)
{
- GLuint master_rows, i;
-
- master_rows = _slang_type_dim (master_spec->type);
- for (i = 0; i < master_rows; i++)
- {
- switch (_slang_type_base (master_spec->type))
- {
- case slang_spec_bool:
- if (!slang_assembly_file_push_label2 (A->file, slang_asm_bool_copy,
- (master_rows - i) * 4, i * 4))
- return GL_FALSE;
- break;
- case slang_spec_int:
- if (!slang_assembly_file_push_label2 (A->file, slang_asm_int_copy,
- (master_rows - i) * 4, i * 4))
- return GL_FALSE;
- break;
- case slang_spec_float:
- if (!slang_assembly_file_push_label2 (A->file, slang_asm_float_copy,
- (master_rows - i) * 4, i * 4))
- return GL_FALSE;
- break;
- default:
- break;
- }
- }
- if (!slang_assembly_file_push_label (A->file, slang_asm_local_free, 4))
- return GL_FALSE;
- for (i = swz->num_components; i > 0; i--)
- {
- GLuint n = i - 1;
-
- if (!slang_assembly_file_push_label2 (A->file, slang_asm_local_addr, A->local.swizzle_tmp, 16))
- return GL_FALSE;
- if (!slang_assembly_file_push_label (A->file, slang_asm_addr_push, swz->swizzle[n] * 4))
- return GL_FALSE;
- if (!slang_assembly_file_push (A->file, slang_asm_addr_add))
- return GL_FALSE;
- switch (_slang_type_base (master_spec->type))
- {
- case slang_spec_bool:
- if (!slang_assembly_file_push (A->file, slang_asm_bool_deref))
- return GL_FALSE;
- break;
- case slang_spec_int:
- if (!slang_assembly_file_push (A->file, slang_asm_int_deref))
- return GL_FALSE;
- break;
- case slang_spec_float:
- if (!slang_assembly_file_push (A->file, slang_asm_float_deref))
- return GL_FALSE;
- break;
- default:
- break;
- }
- }
-
- return GL_TRUE;
+ GLuint master_rows, i;
+
+ master_rows = _slang_type_dim(master_spec->type);
+ for (i = 0; i < master_rows; i++) {
+ switch (_slang_type_base(master_spec->type)) {
+ case slang_spec_bool:
+ if (!slang_assembly_file_push_label2(A->file, slang_asm_bool_copy,
+ (master_rows - i) * 4, i * 4))
+ return GL_FALSE;
+ break;
+ case slang_spec_int:
+ if (!slang_assembly_file_push_label2(A->file, slang_asm_int_copy,
+ (master_rows - i) * 4, i * 4))
+ return GL_FALSE;
+ break;
+ case slang_spec_float:
+ if (!slang_assembly_file_push_label2(A->file, slang_asm_float_copy,
+ (master_rows - i) * 4, i * 4))
+ return GL_FALSE;
+ break;
+ default:
+ break;
+ }
+ }
+ if (!slang_assembly_file_push_label(A->file, slang_asm_local_free, 4))
+ return GL_FALSE;
+ for (i = swz->num_components; i > 0; i--) {
+ GLuint n = i - 1;
+
+ if (!slang_assembly_file_push_label2
+ (A->file, slang_asm_local_addr, A->local.swizzle_tmp, 16))
+ return GL_FALSE;
+ if (!slang_assembly_file_push_label
+ (A->file, slang_asm_addr_push, swz->swizzle[n] * 4))
+ return GL_FALSE;
+ if (!slang_assembly_file_push(A->file, slang_asm_addr_add))
+ return GL_FALSE;
+ switch (_slang_type_base(master_spec->type)) {
+ case slang_spec_bool:
+ if (!slang_assembly_file_push(A->file, slang_asm_bool_deref))
+ return GL_FALSE;
+ break;
+ case slang_spec_int:
+ if (!slang_assembly_file_push(A->file, slang_asm_int_deref))
+ return GL_FALSE;
+ break;
+ case slang_spec_float:
+ if (!slang_assembly_file_push(A->file, slang_asm_float_deref))
+ return GL_FALSE;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return GL_TRUE;
}
-
diff --git a/src/mesa/shader/slang/slang_assemble_constructor.h b/src/mesa/shader/slang/slang_assemble_constructor.h
index 41a03943cf5..c7aedf3af81 100644
--- a/src/mesa/shader/slang/slang_assemble_constructor.h
+++ b/src/mesa/shader/slang/slang_assemble_constructor.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.2
*
* Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
*
@@ -22,43 +22,35 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if !defined SLANG_ASSEMBLE_CONSTRUCTOR_H
+#ifndef SLANG_ASSEMBLE_CONSTRUCTOR_H
#define SLANG_ASSEMBLE_CONSTRUCTOR_H
#if defined __cplusplus
extern "C" {
#endif
-/*
- * Checks if a field selector is a general swizzle (an r-value swizzle with replicated
- * components or an l-value swizzle mask) for a vector.
- * Returns GL_TRUE if this is the case, <swz> is filled with swizzle information.
- * Returns GL_FALSE otherwise.
- */
-GLboolean _slang_is_swizzle (const char *field, GLuint rows, slang_swizzle *swz);
-/*
- * Checks if a general swizzle is an l-value swizzle - these swizzles do not have
- * duplicated fields.
- * Returns GL_TRUE if this is a swizzle mask.
- * Returns GL_FALSE otherwise
- */
-GLboolean _slang_is_swizzle_mask (const slang_swizzle *swz, GLuint rows);
+extern GLboolean
+_slang_is_swizzle(const char *field, GLuint rows, slang_swizzle *swz);
-/*
- * Combines (multiplies) two swizzles to form single swizzle.
- * Example: "vec.wzyx.yx" --> "vec.zw".
- */
-GLvoid _slang_multiply_swizzles (slang_swizzle *, const slang_swizzle *, const slang_swizzle *);
+extern GLboolean
+_slang_is_swizzle_mask(const slang_swizzle *swz, GLuint rows);
+
+extern GLvoid
+_slang_multiply_swizzles(slang_swizzle *, const slang_swizzle *,
+ const slang_swizzle *);
-GLboolean _slang_assemble_constructor (slang_assemble_ctx *, struct slang_operation_ *);
+extern GLboolean
+_slang_assemble_constructor(slang_assemble_ctx *, struct slang_operation_ *);
-GLboolean _slang_assemble_constructor_from_swizzle (slang_assemble_ctx *, const slang_swizzle *,
- slang_type_specifier *, slang_type_specifier *);
+extern GLboolean
+_slang_assemble_constructor_from_swizzle(slang_assemble_ctx *,
+ const slang_swizzle *,
+ slang_type_specifier *,
+ slang_type_specifier *);
#ifdef __cplusplus
}
#endif
-#endif
-
+#endif /* SLANG_ASSEMBLE_CONSTRUCTOR_H */
diff --git a/src/mesa/shader/slang/slang_assemble_typeinfo.c b/src/mesa/shader/slang/slang_assemble_typeinfo.c
index f4ee573df73..265e417dadd 100644
--- a/src/mesa/shader/slang/slang_assemble_typeinfo.c
+++ b/src/mesa/shader/slang/slang_assemble_typeinfo.c
@@ -594,7 +594,7 @@ _slang_type_base(slang_type_specifier_type ty)
/**
- * Return the number of elements in a vector or matrix type
+ * Return the dimensionality of a vector or matrix type.
*/
GLuint
_slang_type_dim(slang_type_specifier_type ty)
diff --git a/src/mesa/shader/slang/slang_assemble_typeinfo.h b/src/mesa/shader/slang/slang_assemble_typeinfo.h
index 5d951226a1e..777dc21f3a7 100644
--- a/src/mesa/shader/slang/slang_assemble_typeinfo.h
+++ b/src/mesa/shader/slang/slang_assemble_typeinfo.h
@@ -68,8 +68,8 @@ typedef enum slang_type_specifier_type_
typedef struct slang_type_specifier_
{
slang_type_specifier_type type;
- struct slang_struct_ *_struct; /**< type: spec_struct */
- struct slang_type_specifier_ *_array; /**< type: spec_array */
+ struct slang_struct_ *_struct; /**< used if type == spec_struct */
+ struct slang_type_specifier_ *_array; /**< used if type == spec_array */
} slang_type_specifier;
diff --git a/src/mesa/shader/slang/slang_compile_function.h b/src/mesa/shader/slang/slang_compile_function.h
index 8835544bf38..1a7302f29aa 100644
--- a/src/mesa/shader/slang/slang_compile_function.h
+++ b/src/mesa/shader/slang/slang_compile_function.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.2
*
* Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
*
@@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if !defined SLANG_COMPILE_FUNCTION_H
+#ifndef SLANG_COMPILE_FUNCTION_H
#define SLANG_COMPILE_FUNCTION_H
#if defined __cplusplus
@@ -63,12 +63,12 @@ extern GLboolean slang_fixup_save(slang_fixup_table *fixups, GLuint address);
typedef struct slang_function_
{
slang_function_kind kind;
- slang_variable header;
- slang_variable_scope *parameters;
+ slang_variable header; /**< The function's name and return type */
+ slang_variable_scope *parameters; /**< array [param_count] */
unsigned int param_count;
slang_operation *body; /**< The instruction tree */
- unsigned int address;
- slang_fixup_table fixups;
+ unsigned int address; /**< Address of this func in memory */
+ slang_fixup_table fixups; /**< Mem locations which need func's address */
} slang_function;
extern int slang_function_construct(slang_function *);
@@ -99,7 +99,8 @@ extern slang_function *
slang_function_scope_find(slang_function_scope *, slang_function *, int);
extern GLboolean
-_slang_build_export_code_table(slang_export_code_table *, slang_function_scope *,
+_slang_build_export_code_table(slang_export_code_table *,
+ slang_function_scope *,
struct slang_code_unit_ *);
@@ -107,5 +108,4 @@ _slang_build_export_code_table(slang_export_code_table *, slang_function_scope *
}
#endif
-#endif
-
+#endif /* SLANG_COMPILE_FUNCTION_H */
diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/shader/slang/slang_compile_operation.h
index f5fee1e50e6..f3c45de3c2a 100644
--- a/src/mesa/shader/slang/slang_compile_operation.h
+++ b/src/mesa/shader/slang/slang_compile_operation.h
@@ -22,13 +22,14 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if !defined SLANG_COMPILE_OPERATION_H
+#ifndef SLANG_COMPILE_OPERATION_H
#define SLANG_COMPILE_OPERATION_H
#if defined __cplusplus
extern "C" {
#endif
+
/**
* Types of slang operations.
* These are the basic intermediate code representations.
@@ -36,94 +37,95 @@ extern "C" {
*/
typedef enum slang_operation_type_
{
- slang_oper_none,
- slang_oper_block_no_new_scope, /* "{" sequence "}" */
- slang_oper_block_new_scope, /* "{" sequence "}" */
- slang_oper_variable_decl, /* [type] [var] or [var] = [expr] */
- slang_oper_asm,
- slang_oper_break, /* "break" statement */
- slang_oper_continue, /* "continue" statement */
- slang_oper_discard, /* "discard" (kill fragment) statement */
- slang_oper_return, /* "return" [expr] */
- slang_oper_expression, /* [expr] */
- slang_oper_if, /* "if" [0] then [1] else [2] */
- slang_oper_while, /* "while" [cond] [body] */
- slang_oper_do, /* "do" [body] "while" [cond] */
- slang_oper_for, /* "for" [init] [while] [incr] [body] */
- slang_oper_void, /* nop */
- slang_oper_literal_bool, /* "true" or "false" */
- slang_oper_literal_int, /* integer literal */
- slang_oper_literal_float, /* float literal */
- slang_oper_identifier, /* var name, func name, etc */
- slang_oper_sequence, /* [expr] "," [expr] "," etc */
- slang_oper_assign, /* [var] "=" [expr] */
- slang_oper_addassign, /* [var] "+=" [expr] */
- slang_oper_subassign, /* [var] "-=" [expr] */
- slang_oper_mulassign, /* [var] "*=" [expr] */
- slang_oper_divassign, /* [var] "/=" [expr] */
- /*slang_oper_modassign,*/
- /*slang_oper_lshassign,*/
- /*slang_oper_rshassign,*/
- /*slang_oper_orassign,*/
- /*slang_oper_xorassign,*/
- /*slang_oper_andassign,*/
- slang_oper_select, /* [expr] "?" [expr] ":" [expr] */
- slang_oper_logicalor, /* [expr] "||" [expr] */
- slang_oper_logicalxor, /* [expr] "^^" [expr] */
- slang_oper_logicaland, /* [expr] "&&" [expr] */
- /*slang_oper_bitor,*/
- /*slang_oper_bitxor,*/
- /*slang_oper_bitand,*/
- slang_oper_equal, /* [expr] "==" [expr] */
- slang_oper_notequal, /* [expr] "!=" [expr] */
- slang_oper_less, /* [expr] "<" [expr] */
- slang_oper_greater, /* [expr] ">" [expr] */
- slang_oper_lessequal, /* [expr] "<=" [expr] */
- slang_oper_greaterequal, /* [expr] ">=" [expr] */
- /*slang_oper_lshift,*/
- /*slang_oper_rshift,*/
- slang_oper_add, /* [expr] "+" [expr] */
- slang_oper_subtract, /* [expr] "-" [expr] */
- slang_oper_multiply, /* [expr] "*" [expr] */
- slang_oper_divide, /* [expr] "/" [expr] */
- /*slang_oper_modulus,*/
- slang_oper_preincrement, /* "++" [var] */
- slang_oper_predecrement, /* "--" [var] */
- slang_oper_plus, /* "-" [expr] */
- slang_oper_minus, /* "+" [expr] */
- /*slang_oper_complement,*/
- slang_oper_not, /* "!" [expr] */
- slang_oper_subscript, /* [expr] "[" [expr] "]" */
- slang_oper_call, /* [func name] [param] [param] [...] */
- slang_oper_field, /* i.e.: ".next" or ".xzy" or ".xxx" etc */
- slang_oper_postincrement, /* [var] "++" */
- slang_oper_postdecrement /* [var] "--" */
+ slang_oper_none,
+ slang_oper_block_no_new_scope, /* "{" sequence "}" */
+ slang_oper_block_new_scope, /* "{" sequence "}" */
+ slang_oper_variable_decl, /* [type] [var] or [var] = [expr] */
+ slang_oper_asm,
+ slang_oper_break, /* "break" statement */
+ slang_oper_continue, /* "continue" statement */
+ slang_oper_discard, /* "discard" (kill fragment) statement */
+ slang_oper_return, /* "return" [expr] */
+ slang_oper_expression, /* [expr] */
+ slang_oper_if, /* "if" [0] then [1] else [2] */
+ slang_oper_while, /* "while" [cond] [body] */
+ slang_oper_do, /* "do" [body] "while" [cond] */
+ slang_oper_for, /* "for" [init] [while] [incr] [body] */
+ slang_oper_void, /* nop */
+ slang_oper_literal_bool, /* "true" or "false" */
+ slang_oper_literal_int, /* integer literal */
+ slang_oper_literal_float, /* float literal */
+ slang_oper_identifier, /* var name, func name, etc */
+ slang_oper_sequence, /* [expr] "," [expr] "," etc */
+ slang_oper_assign, /* [var] "=" [expr] */
+ slang_oper_addassign, /* [var] "+=" [expr] */
+ slang_oper_subassign, /* [var] "-=" [expr] */
+ slang_oper_mulassign, /* [var] "*=" [expr] */
+ slang_oper_divassign, /* [var] "/=" [expr] */
+ /*slang_oper_modassign, */
+ /*slang_oper_lshassign, */
+ /*slang_oper_rshassign, */
+ /*slang_oper_orassign, */
+ /*slang_oper_xorassign, */
+ /*slang_oper_andassign, */
+ slang_oper_select, /* [expr] "?" [expr] ":" [expr] */
+ slang_oper_logicalor, /* [expr] "||" [expr] */
+ slang_oper_logicalxor, /* [expr] "^^" [expr] */
+ slang_oper_logicaland, /* [expr] "&&" [expr] */
+ /*slang_oper_bitor, */
+ /*slang_oper_bitxor, */
+ /*slang_oper_bitand, */
+ slang_oper_equal, /* [expr] "==" [expr] */
+ slang_oper_notequal, /* [expr] "!=" [expr] */
+ slang_oper_less, /* [expr] "<" [expr] */
+ slang_oper_greater, /* [expr] ">" [expr] */
+ slang_oper_lessequal, /* [expr] "<=" [expr] */
+ slang_oper_greaterequal, /* [expr] ">=" [expr] */
+ /*slang_oper_lshift, */
+ /*slang_oper_rshift, */
+ slang_oper_add, /* [expr] "+" [expr] */
+ slang_oper_subtract, /* [expr] "-" [expr] */
+ slang_oper_multiply, /* [expr] "*" [expr] */
+ slang_oper_divide, /* [expr] "/" [expr] */
+ /*slang_oper_modulus, */
+ slang_oper_preincrement, /* "++" [var] */
+ slang_oper_predecrement, /* "--" [var] */
+ slang_oper_plus, /* "-" [expr] */
+ slang_oper_minus, /* "+" [expr] */
+ /*slang_oper_complement, */
+ slang_oper_not, /* "!" [expr] */
+ slang_oper_subscript, /* [expr] "[" [expr] "]" */
+ slang_oper_call, /* [func name] [param] [param] [...] */
+ slang_oper_field, /* i.e.: ".next" or ".xzy" or ".xxx" etc */
+ slang_oper_postincrement, /* [var] "++" */
+ slang_oper_postdecrement /* [var] "--" */
} slang_operation_type;
/**
* A slang_operation is basically a compiled instruction (such as assignment,
- * a while-loop, a conditiona, a function call, etc).
+ * a while-loop, a conditional, a multiply, a function call, etc).
+ * NOTE: This structure could have been implemented as a union of simpler
+ * structs which would correspond to the operation types above.
*/
typedef struct slang_operation_
{
- slang_operation_type type;
- struct slang_operation_ *children;
- unsigned int num_children;
- float literal; /**< Used for float, int and bool values */
- slang_atom a_id; /**< type: asm, identifier, call, field */
- slang_variable_scope *locals; /**< local vars for scope */
+ slang_operation_type type;
+ struct slang_operation_ *children;
+ unsigned int num_children;
+ float literal; /**< Used for float, int and bool values */
+ slang_atom a_id; /**< type: asm, identifier, call, field */
+ slang_variable_scope *locals; /**< local vars for scope */
} slang_operation;
-extern int slang_operation_construct (slang_operation *);
-extern void slang_operation_destruct (slang_operation *);
-extern int slang_operation_copy (slang_operation *, const slang_operation *);
+extern int slang_operation_construct(slang_operation *);
+extern void slang_operation_destruct(slang_operation *);
+extern int slang_operation_copy(slang_operation *, const slang_operation *);
#ifdef __cplusplus
}
#endif
-#endif
-
+#endif /* SLANG_COMPILE_OPERATION_H */
diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c
index 679d93b951a..92951b85bbc 100644
--- a/src/mesa/shader/slang/slang_compile_variable.c
+++ b/src/mesa/shader/slang/slang_compile_variable.c
@@ -35,89 +35,92 @@
typedef struct
{
- const char *name;
- slang_type_specifier_type type;
+ const char *name;
+ slang_type_specifier_type type;
} type_specifier_type_name;
-static type_specifier_type_name type_specifier_type_names[] = {
- { "void", slang_spec_void },
- { "bool", slang_spec_bool },
- { "bvec2", slang_spec_bvec2 },
- { "bvec3", slang_spec_bvec3 },
- { "bvec4", slang_spec_bvec4 },
- { "int", slang_spec_int },
- { "ivec2", slang_spec_ivec2 },
- { "ivec3", slang_spec_ivec3 },
- { "ivec4", slang_spec_ivec4 },
- { "float", slang_spec_float },
- { "vec2", slang_spec_vec2 },
- { "vec3", slang_spec_vec3 },
- { "vec4", slang_spec_vec4 },
- { "mat2", slang_spec_mat2 },
- { "mat3", slang_spec_mat3 },
- { "mat4", slang_spec_mat4 },
- { "sampler1D", slang_spec_sampler1D },
- { "sampler2D", slang_spec_sampler2D },
- { "sampler3D", slang_spec_sampler3D },
- { "samplerCube", slang_spec_samplerCube },
- { "sampler1DShadow", slang_spec_sampler1DShadow },
- { "sampler2DShadow", slang_spec_sampler2DShadow },
- { NULL, slang_spec_void }
+static const type_specifier_type_name type_specifier_type_names[] = {
+ {"void", slang_spec_void},
+ {"bool", slang_spec_bool},
+ {"bvec2", slang_spec_bvec2},
+ {"bvec3", slang_spec_bvec3},
+ {"bvec4", slang_spec_bvec4},
+ {"int", slang_spec_int},
+ {"ivec2", slang_spec_ivec2},
+ {"ivec3", slang_spec_ivec3},
+ {"ivec4", slang_spec_ivec4},
+ {"float", slang_spec_float},
+ {"vec2", slang_spec_vec2},
+ {"vec3", slang_spec_vec3},
+ {"vec4", slang_spec_vec4},
+ {"mat2", slang_spec_mat2},
+ {"mat3", slang_spec_mat3},
+ {"mat4", slang_spec_mat4},
+ {"sampler1D", slang_spec_sampler1D},
+ {"sampler2D", slang_spec_sampler2D},
+ {"sampler3D", slang_spec_sampler3D},
+ {"samplerCube", slang_spec_samplerCube},
+ {"sampler1DShadow", slang_spec_sampler1DShadow},
+ {"sampler2DShadow", slang_spec_sampler2DShadow},
+ {NULL, slang_spec_void}
};
-slang_type_specifier_type slang_type_specifier_type_from_string (const char *name)
+slang_type_specifier_type
+slang_type_specifier_type_from_string(const char *name)
{
- type_specifier_type_name *p = type_specifier_type_names;
- while (p->name != NULL)
- {
- if (slang_string_compare (p->name, name) == 0)
- break;
- p++;
- }
- return p->type;
+ const type_specifier_type_name *p = type_specifier_type_names;
+ while (p->name != NULL) {
+ if (slang_string_compare(p->name, name) == 0)
+ break;
+ p++;
+ }
+ return p->type;
}
-const char *slang_type_specifier_type_to_string (slang_type_specifier_type type)
+const char *
+slang_type_specifier_type_to_string(slang_type_specifier_type type)
{
- type_specifier_type_name *p = type_specifier_type_names;
- while (p->name != NULL)
- {
- if (p->type == type)
- break;
- p++;
- }
- return p->name;
+ const type_specifier_type_name *p = type_specifier_type_names;
+ while (p->name != NULL) {
+ if (p->type == type)
+ break;
+ p++;
+ }
+ return p->name;
}
/* slang_fully_specified_type */
-int slang_fully_specified_type_construct (slang_fully_specified_type *type)
+int
+slang_fully_specified_type_construct(slang_fully_specified_type * type)
{
- type->qualifier = slang_qual_none;
- slang_type_specifier_ctr (&type->specifier);
- return 1;
+ type->qualifier = slang_qual_none;
+ slang_type_specifier_ctr(&type->specifier);
+ return 1;
}
-void slang_fully_specified_type_destruct (slang_fully_specified_type *type)
+void
+slang_fully_specified_type_destruct(slang_fully_specified_type * type)
{
- slang_type_specifier_dtr (&type->specifier);
+ slang_type_specifier_dtr(&type->specifier);
}
-int slang_fully_specified_type_copy (slang_fully_specified_type *x, const slang_fully_specified_type *y)
+int
+slang_fully_specified_type_copy(slang_fully_specified_type * x,
+ const slang_fully_specified_type * y)
{
- slang_fully_specified_type z;
-
- if (!slang_fully_specified_type_construct (&z))
- return 0;
- z.qualifier = y->qualifier;
- if (!slang_type_specifier_copy (&z.specifier, &y->specifier))
- {
- slang_fully_specified_type_destruct (&z);
- return 0;
- }
- slang_fully_specified_type_destruct (x);
- *x = z;
- return 1;
+ slang_fully_specified_type z;
+
+ if (!slang_fully_specified_type_construct(&z))
+ return 0;
+ z.qualifier = y->qualifier;
+ if (!slang_type_specifier_copy(&z.specifier, &y->specifier)) {
+ slang_fully_specified_type_destruct(&z);
+ return 0;
+ }
+ slang_fully_specified_type_destruct(x);
+ *x = z;
+ return 1;
}
/*
@@ -125,246 +128,255 @@ int slang_fully_specified_type_copy (slang_fully_specified_type *x, const slang_
*/
GLvoid
-_slang_variable_scope_ctr (slang_variable_scope *self)
+_slang_variable_scope_ctr(slang_variable_scope * self)
{
self->variables = NULL;
self->num_variables = 0;
self->outer_scope = NULL;
}
-void slang_variable_scope_destruct (slang_variable_scope *scope)
+void
+slang_variable_scope_destruct(slang_variable_scope * scope)
{
- unsigned int i;
-
- for (i = 0; i < scope->num_variables; i++)
- slang_variable_destruct (scope->variables + i);
- slang_alloc_free (scope->variables);
- /* do not free scope->outer_scope */
+ unsigned int i;
+
+ if (!scope)
+ return;
+ for (i = 0; i < scope->num_variables; i++)
+ slang_variable_destruct(scope->variables + i);
+ slang_alloc_free(scope->variables);
+ /* do not free scope->outer_scope */
}
-int slang_variable_scope_copy (slang_variable_scope *x, const slang_variable_scope *y)
+int
+slang_variable_scope_copy(slang_variable_scope * x,
+ const slang_variable_scope * y)
{
- slang_variable_scope z;
- unsigned int i;
-
- _slang_variable_scope_ctr (&z);
- z.variables = (slang_variable *) slang_alloc_malloc (y->num_variables * sizeof (slang_variable));
- if (z.variables == NULL)
- {
- slang_variable_scope_destruct (&z);
- return 0;
- }
- for (z.num_variables = 0; z.num_variables < y->num_variables; z.num_variables++)
- if (!slang_variable_construct (&z.variables[z.num_variables]))
- {
- slang_variable_scope_destruct (&z);
- return 0;
- }
- for (i = 0; i < z.num_variables; i++)
- if (!slang_variable_copy (&z.variables[i], &y->variables[i]))
- {
- slang_variable_scope_destruct (&z);
- return 0;
- }
- z.outer_scope = y->outer_scope;
- slang_variable_scope_destruct (x);
- *x = z;
- return 1;
+ slang_variable_scope z;
+ unsigned int i;
+
+ _slang_variable_scope_ctr(&z);
+ z.variables = (slang_variable *)
+ slang_alloc_malloc(y->num_variables * sizeof(slang_variable));
+ if (z.variables == NULL) {
+ slang_variable_scope_destruct(&z);
+ return 0;
+ }
+ for (z.num_variables = 0; z.num_variables < y->num_variables;
+ z.num_variables++) {
+ if (!slang_variable_construct(&z.variables[z.num_variables])) {
+ slang_variable_scope_destruct(&z);
+ return 0;
+ }
+ }
+ for (i = 0; i < z.num_variables; i++) {
+ if (!slang_variable_copy(&z.variables[i], &y->variables[i])) {
+ slang_variable_scope_destruct(&z);
+ return 0;
+ }
+ }
+ z.outer_scope = y->outer_scope;
+ slang_variable_scope_destruct(x);
+ *x = z;
+ return 1;
}
/* slang_variable */
-int slang_variable_construct (slang_variable *var)
+int
+slang_variable_construct(slang_variable * var)
{
- if (!slang_fully_specified_type_construct (&var->type))
- return 0;
- var->a_name = SLANG_ATOM_NULL;
- var->array_len = 0;
- var->initializer = NULL;
- var->address = ~0;
- var->size = 0;
- var->global = GL_FALSE;
- return 1;
+ if (!slang_fully_specified_type_construct(&var->type))
+ return 0;
+ var->a_name = SLANG_ATOM_NULL;
+ var->array_len = 0;
+ var->initializer = NULL;
+ var->address = ~0;
+ var->address2 = 0;
+ var->size = 0;
+ var->global = GL_FALSE;
+ return 1;
}
-void slang_variable_destruct (slang_variable *var)
+void
+slang_variable_destruct(slang_variable * var)
{
- slang_fully_specified_type_destruct (&var->type);
- if (var->initializer != NULL)
- {
- slang_operation_destruct (var->initializer);
- slang_alloc_free (var->initializer);
- }
+ slang_fully_specified_type_destruct(&var->type);
+ if (var->initializer != NULL) {
+ slang_operation_destruct(var->initializer);
+ slang_alloc_free(var->initializer);
+ }
}
-int slang_variable_copy (slang_variable *x, const slang_variable *y)
+int
+slang_variable_copy(slang_variable * x, const slang_variable * y)
{
- slang_variable z;
-
- if (!slang_variable_construct (&z))
- return 0;
- if (!slang_fully_specified_type_copy (&z.type, &y->type))
- {
- slang_variable_destruct (&z);
- return 0;
- }
- z.a_name = y->a_name;
- z.array_len = y->array_len;
- if (y->initializer != NULL)
- {
- z.initializer = (slang_operation *) slang_alloc_malloc (sizeof (slang_operation));
- if (z.initializer == NULL)
- {
- slang_variable_destruct (&z);
- return 0;
- }
- if (!slang_operation_construct (z.initializer))
- {
- slang_alloc_free (z.initializer);
- slang_variable_destruct (&z);
- return 0;
- }
- if (!slang_operation_copy (z.initializer, y->initializer))
- {
- slang_variable_destruct (&z);
- return 0;
- }
- }
- z.address = y->address;
- z.size = y->size;
- z.global = y->global;
- slang_variable_destruct (x);
- *x = z;
- return 1;
+ slang_variable z;
+
+ if (!slang_variable_construct(&z))
+ return 0;
+ if (!slang_fully_specified_type_copy(&z.type, &y->type)) {
+ slang_variable_destruct(&z);
+ return 0;
+ }
+ z.a_name = y->a_name;
+ z.array_len = y->array_len;
+ if (y->initializer != NULL) {
+ z.initializer =
+ (slang_operation *) slang_alloc_malloc(sizeof(slang_operation));
+ if (z.initializer == NULL) {
+ slang_variable_destruct(&z);
+ return 0;
+ }
+ if (!slang_operation_construct(z.initializer)) {
+ slang_alloc_free(z.initializer);
+ slang_variable_destruct(&z);
+ return 0;
+ }
+ if (!slang_operation_copy(z.initializer, y->initializer)) {
+ slang_variable_destruct(&z);
+ return 0;
+ }
+ }
+ z.address = y->address;
+ z.size = y->size;
+ z.global = y->global;
+ slang_variable_destruct(x);
+ *x = z;
+ return 1;
}
-slang_variable *_slang_locate_variable (slang_variable_scope *scope, slang_atom a_name, GLboolean all)
+slang_variable *
+_slang_locate_variable(const slang_variable_scope * scope,
+ const slang_atom a_name, GLboolean all)
{
- GLuint i;
-
- for (i = 0; i < scope->num_variables; i++)
- if (a_name == scope->variables[i].a_name)
- return &scope->variables[i];
- if (all && scope->outer_scope != NULL)
- return _slang_locate_variable (scope->outer_scope, a_name, 1);
- return NULL;
+ GLuint i;
+
+ for (i = 0; i < scope->num_variables; i++)
+ if (a_name == scope->variables[i].a_name)
+ return &scope->variables[i];
+ if (all && scope->outer_scope != NULL)
+ return _slang_locate_variable(scope->outer_scope, a_name, 1);
+ return NULL;
}
/*
* _slang_build_export_data_table()
*/
-static GLenum gl_type_from_specifier (const slang_type_specifier *type)
+static GLenum
+gl_type_from_specifier(const slang_type_specifier * type)
{
- switch (type->type)
- {
- case slang_spec_bool:
- return GL_BOOL_ARB;
- case slang_spec_bvec2:
- return GL_BOOL_VEC2_ARB;
- case slang_spec_bvec3:
- return GL_BOOL_VEC3_ARB;
- case slang_spec_bvec4:
- return GL_BOOL_VEC4_ARB;
- case slang_spec_int:
- return GL_INT;
- case slang_spec_ivec2:
- return GL_INT_VEC2_ARB;
- case slang_spec_ivec3:
- return GL_INT_VEC3_ARB;
- case slang_spec_ivec4:
- return GL_INT_VEC4_ARB;
- case slang_spec_float:
- return GL_FLOAT;
- case slang_spec_vec2:
- return GL_FLOAT_VEC2_ARB;
- case slang_spec_vec3:
- return GL_FLOAT_VEC3_ARB;
- case slang_spec_vec4:
- return GL_FLOAT_VEC4_ARB;
- case slang_spec_mat2:
- return GL_FLOAT_MAT2_ARB;
- case slang_spec_mat3:
- return GL_FLOAT_MAT3_ARB;
- case slang_spec_mat4:
- return GL_FLOAT_MAT4_ARB;
- case slang_spec_sampler1D:
- return GL_SAMPLER_1D_ARB;
- case slang_spec_sampler2D:
- return GL_SAMPLER_2D_ARB;
- case slang_spec_sampler3D:
- return GL_SAMPLER_3D_ARB;
- case slang_spec_samplerCube:
- return GL_SAMPLER_CUBE_ARB;
- case slang_spec_sampler1DShadow:
- return GL_SAMPLER_1D_SHADOW_ARB;
- case slang_spec_sampler2DShadow:
- return GL_SAMPLER_2D_SHADOW_ARB;
- case slang_spec_array:
- return gl_type_from_specifier (type->_array);
- default:
- return GL_FLOAT;
- }
+ switch (type->type) {
+ case slang_spec_bool:
+ return GL_BOOL_ARB;
+ case slang_spec_bvec2:
+ return GL_BOOL_VEC2_ARB;
+ case slang_spec_bvec3:
+ return GL_BOOL_VEC3_ARB;
+ case slang_spec_bvec4:
+ return GL_BOOL_VEC4_ARB;
+ case slang_spec_int:
+ return GL_INT;
+ case slang_spec_ivec2:
+ return GL_INT_VEC2_ARB;
+ case slang_spec_ivec3:
+ return GL_INT_VEC3_ARB;
+ case slang_spec_ivec4:
+ return GL_INT_VEC4_ARB;
+ case slang_spec_float:
+ return GL_FLOAT;
+ case slang_spec_vec2:
+ return GL_FLOAT_VEC2_ARB;
+ case slang_spec_vec3:
+ return GL_FLOAT_VEC3_ARB;
+ case slang_spec_vec4:
+ return GL_FLOAT_VEC4_ARB;
+ case slang_spec_mat2:
+ return GL_FLOAT_MAT2_ARB;
+ case slang_spec_mat3:
+ return GL_FLOAT_MAT3_ARB;
+ case slang_spec_mat4:
+ return GL_FLOAT_MAT4_ARB;
+ case slang_spec_sampler1D:
+ return GL_SAMPLER_1D_ARB;
+ case slang_spec_sampler2D:
+ return GL_SAMPLER_2D_ARB;
+ case slang_spec_sampler3D:
+ return GL_SAMPLER_3D_ARB;
+ case slang_spec_samplerCube:
+ return GL_SAMPLER_CUBE_ARB;
+ case slang_spec_sampler1DShadow:
+ return GL_SAMPLER_1D_SHADOW_ARB;
+ case slang_spec_sampler2DShadow:
+ return GL_SAMPLER_2D_SHADOW_ARB;
+ case slang_spec_array:
+ return gl_type_from_specifier(type->_array);
+ default:
+ return GL_FLOAT;
+ }
}
-static GLboolean build_quant (slang_export_data_quant *q, slang_variable *var)
+static GLboolean
+build_quant(slang_export_data_quant * q, const slang_variable * var)
{
- slang_type_specifier *spec = &var->type.specifier;
-
- q->name = var->a_name;
- q->size = var->size;
- if (spec->type == slang_spec_array)
- {
- q->array_len = var->array_len;
- q->size /= var->array_len;
- spec = spec->_array;
- }
- if (spec->type == slang_spec_struct)
- {
- GLuint i;
-
- q->u.field_count = spec->_struct->fields->num_variables;
- q->structure = (slang_export_data_quant *) slang_alloc_malloc (
- q->u.field_count * sizeof (slang_export_data_quant));
- if (q->structure == NULL)
- return GL_FALSE;
-
- for (i = 0; i < q->u.field_count; i++)
- slang_export_data_quant_ctr (&q->structure[i]);
- for (i = 0; i < q->u.field_count; i++)
- if (!build_quant (&q->structure[i], &spec->_struct->fields->variables[i]))
- return GL_FALSE;
- }
- else
- q->u.basic_type = gl_type_from_specifier (spec);
- return GL_TRUE;
+ const slang_type_specifier *spec = &var->type.specifier;
+
+ q->name = var->a_name;
+ q->size = var->size;
+ if (spec->type == slang_spec_array) {
+ q->array_len = var->array_len;
+ q->size /= var->array_len;
+ spec = spec->_array;
+ }
+ if (spec->type == slang_spec_struct) {
+ GLuint i;
+
+ q->u.field_count = spec->_struct->fields->num_variables;
+ q->structure = (slang_export_data_quant *)
+ slang_alloc_malloc(q->u.field_count
+ * sizeof(slang_export_data_quant));
+ if (q->structure == NULL)
+ return GL_FALSE;
+
+ for (i = 0; i < q->u.field_count; i++)
+ slang_export_data_quant_ctr(&q->structure[i]);
+ for (i = 0; i < q->u.field_count; i++) {
+ if (!build_quant(&q->structure[i],
+ &spec->_struct->fields->variables[i]))
+ return GL_FALSE;
+ }
+ }
+ else
+ q->u.basic_type = gl_type_from_specifier(spec);
+ return GL_TRUE;
}
-GLboolean _slang_build_export_data_table (slang_export_data_table *tbl, slang_variable_scope *vars)
+GLboolean
+_slang_build_export_data_table(slang_export_data_table * tbl,
+ slang_variable_scope * vars)
{
- GLuint i;
-
- for (i = 0; i < vars->num_variables; i++)
- {
- slang_variable *var = &vars->variables[i];
- slang_export_data_entry *e;
-
- e = slang_export_data_table_add (tbl);
- if (e == NULL)
- return GL_FALSE;
- if (!build_quant (&e->quant, var))
- return GL_FALSE;
- if (var->type.qualifier == slang_qual_uniform)
- e->access = slang_exp_uniform;
- else if (var->type.qualifier == slang_qual_attribute)
- e->access = slang_exp_attribute;
- else
- e->access = slang_exp_varying;
- e->address = var->address;
- }
-
- if (vars->outer_scope != NULL)
- return _slang_build_export_data_table (tbl, vars->outer_scope);
- return GL_TRUE;
+ GLuint i;
+
+ for (i = 0; i < vars->num_variables; i++) {
+ const slang_variable *var = &vars->variables[i];
+ slang_export_data_entry *e;
+
+ e = slang_export_data_table_add(tbl);
+ if (e == NULL)
+ return GL_FALSE;
+ if (!build_quant(&e->quant, var))
+ return GL_FALSE;
+ if (var->type.qualifier == slang_qual_uniform)
+ e->access = slang_exp_uniform;
+ else if (var->type.qualifier == slang_qual_attribute)
+ e->access = slang_exp_attribute;
+ else
+ e->access = slang_exp_varying;
+ e->address = var->address;
+ }
+
+ if (vars->outer_scope != NULL)
+ return _slang_build_export_data_table(tbl, vars->outer_scope);
+ return GL_TRUE;
}
-
diff --git a/src/mesa/shader/slang/slang_compile_variable.h b/src/mesa/shader/slang/slang_compile_variable.h
index 3b6e1987c82..2f358860f82 100644
--- a/src/mesa/shader/slang/slang_compile_variable.h
+++ b/src/mesa/shader/slang/slang_compile_variable.h
@@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#if !defined SLANG_COMPILE_VARIABLE_H
+#ifndef SLANG_COMPILE_VARIABLE_H
#define SLANG_COMPILE_VARIABLE_H
#if defined __cplusplus
@@ -68,9 +68,28 @@ slang_fully_specified_type_copy(slang_fully_specified_type *,
const slang_fully_specified_type *);
+/**
+ * A shading language program variable.
+ */
+typedef struct slang_variable_
+{
+ slang_fully_specified_type type; /**< Variable's data type */
+ slang_atom a_name; /**< The variable's name (char *) */
+ GLuint array_len; /**< only if type == slang_spec_array */
+ struct slang_operation_ *initializer; /**< Optional initializer code */
+ GLuint address; /**< Storage location */
+ GLuint address2; /**< Storage location */
+ GLuint size; /**< Variable's size in bytes */
+ GLboolean global; /**< A global var? */
+} slang_variable;
+
+
+/**
+ * Basically a list of variables, with a pointer to the parent scope.
+ */
typedef struct slang_variable_scope_
{
- struct slang_variable_ *variables;
+ slang_variable *variables; /**< Array [num_variables] */
GLuint num_variables;
struct slang_variable_scope_ *outer_scope;
} slang_variable_scope;
@@ -86,18 +105,6 @@ slang_variable_scope_copy(slang_variable_scope *,
const slang_variable_scope *);
-typedef struct slang_variable_
-{
- slang_fully_specified_type type;
- slang_atom a_name;
- GLuint array_len; /* type: spec_array */
- struct slang_operation_ *initializer;
- unsigned int address;
- unsigned int size;
- GLboolean global;
-} slang_variable;
-
-
extern int
slang_variable_construct(slang_variable *);
@@ -108,7 +115,7 @@ extern int
slang_variable_copy(slang_variable *, const slang_variable *);
extern slang_variable *
-_slang_locate_variable(slang_variable_scope *, slang_atom a_name,
+_slang_locate_variable(const slang_variable_scope *, const slang_atom a_name,
GLboolean all);
extern GLboolean
@@ -116,8 +123,9 @@ _slang_build_export_data_table(slang_export_data_table *,
slang_variable_scope *);
+
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* SLANG_COMPILE_VARIABLE_H */
diff --git a/src/mesa/shader/slang/sources b/src/mesa/shader/slang/sources
new file mode 100644
index 00000000000..00d617fa8af
--- /dev/null
+++ b/src/mesa/shader/slang/sources
@@ -0,0 +1,44 @@
+MESA_SHADER_SLANG_SOURCES = \
+slang_analyse.c \
+slang_assemble_assignment.c \
+slang_assemble.c \
+slang_assemble_conditional.c \
+slang_assemble_constructor.c \
+slang_assemble_typeinfo.c \
+slang_compile.c \
+slang_compile_function.c \
+slang_compile_operation.c \
+slang_compile_struct.c \
+slang_compile_variable.c \
+slang_execute.c \
+slang_execute_x86.c \
+slang_export.c \
+slang_library_texsample.c \
+slang_library_noise.c \
+slang_link.c \
+slang_preprocess.c \
+slang_storage.c \
+slang_utility.c
+
+MESA_SHADER_SLANG_HEADERS = \
+slang_analyse.h \
+slang_assemble.h \
+slang_assemble_assignment.h \
+slang_assemble_conditional.h \
+slang_assemble_constructor.h \
+slang_assemble_typeinfo.h \
+slang_compile.h \
+slang_compile_function.h \
+slang_compile_operation.h \
+slang_compile_struct.h \
+slang_compile_variable.h \
+slang_execute.h \
+slang_export.h \
+slang_library_noise.h \
+slang_library_texsample.h \
+slang_link.h \
+slang_mesa.h \
+slang_preprocess.h \
+slang_storage.h \
+slang_utility.h \
+traverse_wrap.h
diff --git a/src/mesa/shader/sources b/src/mesa/shader/sources
new file mode 100644
index 00000000000..27871872766
--- /dev/null
+++ b/src/mesa/shader/sources
@@ -0,0 +1,28 @@
+# List of source files in this directory used for X.org xserver build
+MESA_SHADER_SOURCES = \
+arbprogparse.c \
+arbprogram.c \
+atifragshader.c \
+nvfragparse.c \
+nvprogram.c \
+nvvertexec.c \
+nvvertparse.c \
+program.c \
+programopt.c \
+shaderobjects.c \
+shaderobjects_3dlabs.c
+
+MESA_SHADER_HEADERS = \
+arbprogparse.h \
+arbprogram.h \
+arbprogram_syn.h \
+atifragshader.h \
+nvfragparse.h \
+nvprogram.h \
+nvvertexec.h \
+nvvertparse.h \
+programopt.h \
+program.h \
+program_instruction.h \
+shaderobjects.h \
+shaderobjects_3dlabs.h
diff --git a/src/mesa/swrast/sources b/src/mesa/swrast/sources
new file mode 100644
index 00000000000..9ffd4cca722
--- /dev/null
+++ b/src/mesa/swrast/sources
@@ -0,0 +1,65 @@
+# List of source files in this directory used for X.org xserver build
+MESA_SWRAST_SOURCES = \
+s_aaline.c \
+s_aatriangle.c \
+s_accum.c \
+s_alpha.c \
+s_arbshader.c \
+s_atifragshader.c \
+s_bitmap.c \
+s_blend.c \
+s_blit.c \
+s_buffers.c \
+s_context.c \
+s_copypix.c \
+s_depth.c \
+s_drawpix.c \
+s_feedback.c \
+s_fog.c \
+s_imaging.c \
+s_lines.c \
+s_logic.c \
+s_masking.c \
+s_nvfragprog.c \
+s_points.c \
+s_readpix.c \
+s_span.c \
+s_stencil.c \
+s_texcombine.c \
+s_texfilter.c \
+s_texstore.c \
+s_triangle.c \
+s_zoom.c
+
+MESA_SWRAST_HEADERS = \
+s_aaline.h \
+s_aalinetemp.h \
+s_aatriangle.h \
+s_aatritemp.h \
+s_accum.h \
+s_alpha.h \
+s_arbshader.h \
+s_atifragshader.h \
+s_blend.h \
+s_context.h \
+s_depth.h \
+s_drawpix.h \
+s_feedback.h \
+s_fog.h \
+s_lines.h \
+s_linetemp.h \
+s_logic.h \
+s_masking.h \
+s_nvfragprog.h \
+s_points.h \
+s_pointtemp.h \
+s_span.h \
+s_spantemp.h \
+s_stencil.h \
+s_texcombine.h \
+s_texfilter.h \
+s_triangle.h \
+s_trispan.h \
+s_tritemp.h \
+s_zoom.h \
+swrast.h
diff --git a/src/mesa/swrast_setup/sources b/src/mesa/swrast_setup/sources
new file mode 100644
index 00000000000..dee14b6774e
--- /dev/null
+++ b/src/mesa/swrast_setup/sources
@@ -0,0 +1,10 @@
+MESA_SWRAST_SETUP_SOURCES = \
+ss_context.c \
+ss_triangle.c
+
+MESA_SWRAST_SETUP_HEADERS = \
+ss_context.h \
+ss_triangle.h \
+ss_tritmp.h \
+ss_vb.h \
+swrast_setup.h
diff --git a/src/mesa/tnl/sources b/src/mesa/tnl/sources
new file mode 100644
index 00000000000..e01f55dbafb
--- /dev/null
+++ b/src/mesa/tnl/sources
@@ -0,0 +1,46 @@
+# List of source files in this directory used for X.org xserver build
+MESA_TNL_SOURCES = \
+t_array_api.c \
+t_array_import.c \
+t_context.c \
+t_pipeline.c \
+t_save_api.c \
+t_save_loopback.c \
+t_save_playback.c \
+t_vb_arbprogram.c \
+t_vb_arbprogram_sse.c \
+t_vb_arbshader.c \
+t_vb_cull.c \
+t_vb_fog.c \
+t_vb_light.c \
+t_vb_normals.c \
+t_vb_points.c \
+t_vb_program.c \
+t_vb_render.c \
+t_vb_texgen.c \
+t_vb_texmat.c \
+t_vb_vertex.c \
+t_vertex.c \
+t_vertex_generic.c \
+t_vertex_sse.c \
+t_vp_build.c \
+t_vtx_api.c \
+t_vtx_eval.c \
+t_vtx_exec.c \
+t_vtx_generic.c \
+t_vtx_x86.c
+
+MESA_TNL_HEADERS = \
+t_array_api.h \
+t_array_import.h \
+t_context.h \
+t_pipeline.h \
+t_save_api.h \
+t_vb_arbprogram.h \
+t_vb_cliptmp.h \
+t_vb_lighttmp.h \
+t_vb_rendertmp.h \
+t_vertex.h \
+t_vp_build.h \
+t_vtx_api.h \
+tnl.h
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 55b40c0531f..154780cc975 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -246,10 +246,7 @@ void
_tnl_need_projected_coords( GLcontext *ctx, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (tnl->NeedNdcCoords != mode) {
- tnl->NeedNdcCoords = mode;
- _tnl_InvalidateState( ctx, _NEW_PROJECTION );
- }
+ tnl->NeedNdcCoords = mode;
}
void
diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c
index 9504f0fe680..426e94372ec 100644
--- a/src/mesa/tnl/t_save_playback.c
+++ b/src/mesa/tnl/t_save_playback.c
@@ -150,6 +150,7 @@ static void _playback_copy_to_current( GLcontext *ctx,
if (node->have_materials) {
tnl->Driver.NotifyMaterialChange( ctx );
+ ctx->NewState |= _NEW_LIGHT;
}
/* CurrentExecPrimitive
diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c
index b766ce2d2ce..77eec8b3b44 100644
--- a/src/mesa/tnl/t_vtx_api.c
+++ b/src/mesa/tnl/t_vtx_api.c
@@ -171,11 +171,10 @@ static void _tnl_copy_to_current( GLcontext *ctx )
if (tnl->vtx.have_materials) {
tnl->Driver.NotifyMaterialChange( ctx );
+ ctx->NewState |= _NEW_LIGHT;
}
ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
-
- ctx->NewState |= _NEW_LIGHT;
}
diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c
index 57d842f05fe..900c4ab6cc1 100644
--- a/src/mesa/tnl/t_vtx_exec.c
+++ b/src/mesa/tnl/t_vtx_exec.c
@@ -239,6 +239,11 @@ static GLuint _tnl_copy_vertices( GLcontext *ctx )
return 2;
}
case GL_TRIANGLE_STRIP:
+ /* no parity issue, but need to make sure the tri is not drawn twice */
+ if (nr & 1) {
+ tnl->vtx.prim[tnl->vtx.prim_count-1].count--;
+ }
+ /* fallthrough */
case GL_QUAD_STRIP:
switch (nr) {
case 0: ovf = 0; break;