Compare commits
44 Commits
mesa_7_3_r
...
mesa_7_3_r
Author | SHA1 | Date | |
---|---|---|---|
|
8f8435637d | ||
|
7d08091767 | ||
|
b5f32e1d5a | ||
|
0dffd22349 | ||
|
947d1c5b2a | ||
|
c7f43543af | ||
|
5912cdff3e | ||
|
03188b09e0 | ||
|
fae9604727 | ||
|
aac4a0509e | ||
|
b5f89e5f17 | ||
|
c12d24b513 | ||
|
2549c26a8b | ||
|
a98dccca36 | ||
|
1b3e3e6b84 | ||
|
49b53407c7 | ||
|
d911e3e24f | ||
|
658ab3c3ae | ||
|
8f7349dbb4 | ||
|
d687476edd | ||
|
c157a5bb91 | ||
|
14eca6b573 | ||
|
ef0e0f2550 | ||
|
34d17d2bdc | ||
|
01a0938776 | ||
|
1f47388dfe | ||
|
34500a6da5 | ||
|
00c02626d8 | ||
|
eeeed45c2c | ||
|
3a5463d158 | ||
|
de35989cde | ||
|
29f603a270 | ||
|
7f7fc3e3af | ||
|
a0318d7f8e | ||
|
06fdb6a74c | ||
|
88fdddcbbe | ||
|
1598be5083 | ||
|
436024561a | ||
|
0f0922f93c | ||
|
33f6dc3c33 | ||
|
356428d4e4 | ||
|
b4866f8a52 | ||
|
297a9606ea | ||
|
44557bf065 |
9
Makefile
9
Makefile
@@ -174,10 +174,10 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
DIRECTORY = Mesa-7.3-rc1
|
||||
LIB_NAME = MesaLib-7.3-rc1
|
||||
DEMO_NAME = MesaDemos-7.3-rc1
|
||||
GLUT_NAME = MesaGLUT-7.3-rc1
|
||||
DIRECTORY = Mesa-7.3-rc2
|
||||
LIB_NAME = MesaLib-7.3-rc2
|
||||
DEMO_NAME = MesaDemos-7.3-rc2
|
||||
GLUT_NAME = MesaGLUT-7.3-rc2
|
||||
|
||||
MAIN_FILES = \
|
||||
$(DIRECTORY)/Makefile* \
|
||||
@@ -223,6 +223,7 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/src/mesa/sources \
|
||||
$(DIRECTORY)/src/mesa/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/gl.pc.in \
|
||||
$(DIRECTORY)/src/mesa/osmesa.pc.in \
|
||||
$(DIRECTORY)/src/mesa/depend \
|
||||
$(DIRECTORY)/src/mesa/main/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/main/descrip.mms \
|
||||
|
@@ -22,7 +22,7 @@ AC_CONFIG_AUX_DIR([bin])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl Versions for external dependencies
|
||||
LIBDRM_REQUIRED=2.3.1
|
||||
LIBDRM_REQUIRED=2.4.3
|
||||
DRI2PROTO_REQUIRED=1.99.3
|
||||
|
||||
dnl Check for progs
|
||||
@@ -83,11 +83,8 @@ dnl Compiler macros
|
||||
DEFINES=""
|
||||
AC_SUBST([DEFINES])
|
||||
case "$host_os" in
|
||||
*-gnu)
|
||||
if test "x$GCC" = xyes; then
|
||||
DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
|
||||
fi
|
||||
DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS"
|
||||
*-gnu*)
|
||||
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
|
||||
;;
|
||||
solaris*)
|
||||
DEFINES="$DEFINES -DPTHREADS -DSVR4"
|
||||
|
@@ -16,7 +16,7 @@ Status
|
||||
|
||||
Version
|
||||
|
||||
Last Modified Date: 8 June 2000
|
||||
Last Modified Date: 12 January 2009
|
||||
|
||||
Number
|
||||
|
||||
@@ -69,6 +69,12 @@ Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
|
||||
<width> and <height> indicate the size in pixels. Coordinate (0,0)
|
||||
corresponds to the lower-left pixel of the window, like glReadPixels.
|
||||
|
||||
If dpy and drawable are the display and drawable for the calling
|
||||
thread's current context, glXCopySubBufferMESA performs an
|
||||
implicit glFlush before it returns. Subsequent OpenGL commands
|
||||
may be issued immediately after calling glXCopySubBufferMESA, but
|
||||
are not executed until the copy is completed.
|
||||
|
||||
GLX Protocol
|
||||
|
||||
None at this time. The extension is implemented in terms of ordinary
|
||||
@@ -84,5 +90,7 @@ New State
|
||||
|
||||
Revision History
|
||||
|
||||
8 June 2000 - initial specification
|
||||
12 January 2009 Ian Romanick - Added language about implicit flush
|
||||
and command completion.
|
||||
8 June 2000 Brian Paul - initial specification
|
||||
|
||||
|
@@ -43,6 +43,10 @@ tbd
|
||||
<ul>
|
||||
<li>Assorted GLSL bug fixes
|
||||
<li>Assorted i965 driver fixes
|
||||
<li>Fix for wglCreateLayerContext() in WGL/Windows driver
|
||||
<li>Build fixes for OpenBSD and gcc 2.95
|
||||
<li>GLSL preprocessor handles #pragma now
|
||||
<li>Fix incorrect transformation of GL_SPOT_DIRECTION
|
||||
</ul>
|
||||
|
||||
<h2>Changes</h2>
|
||||
|
@@ -113,7 +113,7 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
|
||||
int *x, int *y, int *w, int *h, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
|
||||
__GLXDRIdrawable *pdraw = &(pdp->base);;
|
||||
__GLXDRIdrawable *pdraw = &(pdp->base);
|
||||
Display *dpy = pdraw->psc->dpy;
|
||||
Drawable drawable;
|
||||
|
||||
@@ -141,7 +141,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
|
||||
int x, int y, int w, int h, char *data, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
|
||||
__GLXDRIdrawable *pdraw = &(pdp->base);;
|
||||
__GLXDRIdrawable *pdraw = &(pdp->base);
|
||||
Display *dpy = pdraw->psc->dpy;
|
||||
Drawable drawable;
|
||||
XImage *ximage;
|
||||
@@ -176,7 +176,7 @@ swrastGetImage(__DRIdrawable * draw,
|
||||
int x, int y, int w, int h, char *data, void *loaderPrivate)
|
||||
{
|
||||
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
|
||||
__GLXDRIdrawable *pdraw = &(pdp->base);;
|
||||
__GLXDRIdrawable *pdraw = &(pdp->base);
|
||||
Display *dpy = pdraw->psc->dpy;
|
||||
Drawable drawable;
|
||||
XImage *ximage;
|
||||
|
@@ -220,14 +220,14 @@ GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
||||
unsigned int length;
|
||||
unsigned int i;
|
||||
unsigned int num_attributes;
|
||||
GLboolean use_glx_1_3;
|
||||
|
||||
if ((dpy == NULL) || (drawable == 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
priv = __glXInitialize(dpy);
|
||||
GLboolean use_glx_1_3 = ((priv->majorVersion > 1)
|
||||
|| (priv->minorVersion >= 3));
|
||||
use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
|
||||
|
||||
*value = 0;
|
||||
|
||||
|
@@ -365,7 +365,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
const CARD8 oldOpcode = ((gc == oldGC) || (oldGC == &dummyContext))
|
||||
? opcode : __glXSetupForCommand(oldGC->currentDpy);
|
||||
Bool bindReturnValue;
|
||||
|
||||
__GLXattribute *state;
|
||||
|
||||
if (!opcode || !oldOpcode) {
|
||||
return GL_FALSE;
|
||||
@@ -489,8 +489,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
__GLXattribute *state =
|
||||
(__GLXattribute *) (gc->client_state_private);
|
||||
state = (__GLXattribute *) (gc->client_state_private);
|
||||
|
||||
gc->currentContextTag = reply.contextTag;
|
||||
if (state->array_state == NULL) {
|
||||
|
@@ -143,6 +143,9 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
||||
ctx->Const.MaxCubeTextureLevels = 12;
|
||||
ctx->Const.MaxTextureRectSize = (1<<11);
|
||||
|
||||
/* if conformance mode is set, swrast can handle any size AA point */
|
||||
ctx->Const.MaxPointSizeAA = 255.0;
|
||||
|
||||
/* ctx->Const.MaxNativeVertexProgramTemps = 32; */
|
||||
|
||||
brw_init_attribs( brw );
|
||||
|
@@ -111,9 +111,15 @@ static void brwProgramStringNotify( GLcontext *ctx,
|
||||
struct gl_program *prog )
|
||||
{
|
||||
if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||
struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
|
||||
struct brw_context *brw = brw_context(ctx);
|
||||
struct brw_fragment_program *p = (struct brw_fragment_program *)prog;
|
||||
struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program;
|
||||
if (fprog->FogOption) {
|
||||
_mesa_append_fog_code(ctx, fprog);
|
||||
fprog->FogOption = GL_NONE;
|
||||
}
|
||||
|
||||
if (p == fp)
|
||||
brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
|
||||
p->id = brw->program_id++;
|
||||
|
@@ -73,10 +73,12 @@ static void compile_sf_prog( struct brw_context *brw,
|
||||
c.attr_to_idx[i] = idx;
|
||||
c.idx_to_attr[idx] = i;
|
||||
if (i >= VERT_RESULT_TEX0 && i <= VERT_RESULT_TEX7) {
|
||||
c.point_attrs[i].CoordReplace =
|
||||
brw->attribs.Point->CoordReplace[i - VERT_RESULT_TEX0];
|
||||
} else
|
||||
c.point_attrs[i].CoordReplace = GL_FALSE;
|
||||
c.point_attrs[i].CoordReplace =
|
||||
brw->attribs.Point->CoordReplace[i - VERT_RESULT_TEX0];
|
||||
}
|
||||
else {
|
||||
c.point_attrs[i].CoordReplace = GL_FALSE;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
@@ -106,7 +108,6 @@ static void compile_sf_prog( struct brw_context *brw,
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* get the program
|
||||
*/
|
||||
|
@@ -229,7 +229,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
|
||||
/* XXX clamp max depends on AA vs. non-AA */
|
||||
|
||||
sf.sf7.sprite_point = key->point_sprite;
|
||||
sf.sf7.point_size = CLAMP(nearbyint(key->point_size), 1, 255) * (1<<3);
|
||||
sf.sf7.point_size = CLAMP(rint(key->point_size), 1, 255) * (1<<3);
|
||||
sf.sf7.use_point_size_state = !key->point_attenuated;
|
||||
sf.sf7.aa_line_distance_mode = 0;
|
||||
|
||||
|
@@ -811,57 +811,6 @@ static void precalc_txp( struct brw_wm_compile *c,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Add instructions to perform fog blending
|
||||
*/
|
||||
|
||||
static void fog_blend( struct brw_wm_compile *c,
|
||||
struct prog_src_register fog_factor )
|
||||
{
|
||||
struct prog_dst_register outcolor = dst_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
|
||||
struct prog_src_register fogcolor = search_or_add_param5( c, STATE_FOG_COLOR, 0,0,0,0 );
|
||||
|
||||
/* color.xyz = LRP fog_factor.xxxx, output_color, fog_color */
|
||||
|
||||
emit_op(c,
|
||||
OPCODE_LRP,
|
||||
dst_mask(outcolor, WRITEMASK_XYZ),
|
||||
0, 0, 0,
|
||||
fog_factor,
|
||||
src_reg_from_dst(outcolor),
|
||||
fogcolor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This one is simple - just take the interpolated fog coordinate and
|
||||
* use it as the fog blend factor.
|
||||
*/
|
||||
static void fog_interpolated( struct brw_wm_compile *c )
|
||||
{
|
||||
struct prog_src_register fogc = src_reg(PROGRAM_INPUT, FRAG_ATTRIB_FOGC);
|
||||
|
||||
if (!(c->fp_interp_emitted & (1<<FRAG_ATTRIB_FOGC)))
|
||||
emit_interp(c, FRAG_ATTRIB_FOGC);
|
||||
|
||||
fog_blend( c, src_swizzle1(fogc, GET_SWZ(fogc.Swizzle,X)));
|
||||
}
|
||||
|
||||
static void emit_fog( struct brw_wm_compile *c )
|
||||
{
|
||||
if (!c->fp->program.FogOption)
|
||||
return;
|
||||
|
||||
if (1)
|
||||
fog_interpolated( c );
|
||||
else {
|
||||
/* TODO: per-pixel fog */
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
static void emit_fb_write( struct brw_wm_compile *c )
|
||||
{
|
||||
struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH);
|
||||
@@ -1059,7 +1008,6 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
|
||||
emit_ddy(c, inst);
|
||||
break;
|
||||
case OPCODE_END:
|
||||
emit_fog(c);
|
||||
emit_fb_write(c);
|
||||
break;
|
||||
case OPCODE_PRINT:
|
||||
|
@@ -892,15 +892,19 @@ static void emit_lrp(struct brw_wm_compile *c,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For GLSL shaders, this KIL will be unconditional.
|
||||
* It may be contained inside an IF/ENDIF structure of course.
|
||||
*/
|
||||
static void emit_kil(struct brw_wm_compile *c)
|
||||
{
|
||||
struct brw_compile *p = &c->func;
|
||||
struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
|
||||
brw_push_insn_state(p);
|
||||
brw_set_mask_control(p, BRW_MASK_DISABLE);
|
||||
brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); //IMASK
|
||||
brw_AND(p, depth, c->emit_mask_reg, depth);
|
||||
brw_pop_insn_state(p);
|
||||
struct brw_compile *p = &c->func;
|
||||
struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
|
||||
brw_push_insn_state(p);
|
||||
brw_set_mask_control(p, BRW_MASK_DISABLE);
|
||||
brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); //IMASK
|
||||
brw_AND(p, depth, c->emit_mask_reg, depth);
|
||||
brw_pop_insn_state(p);
|
||||
}
|
||||
|
||||
static void emit_mad(struct brw_wm_compile *c,
|
||||
|
@@ -244,7 +244,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
|
||||
entry->minfilter = texObj->MinFilter;
|
||||
entry->magfilter = texObj->MagFilter;
|
||||
entry->comparemode = texObj->CompareMode;
|
||||
entry->comparefunc = texObj->CompareFunc;
|
||||
entry->comparefunc = texObj->CompareFunc;
|
||||
|
||||
dri_bo_unreference(brw->wm.sdc_bo[unit]);
|
||||
if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
|
||||
|
@@ -192,21 +192,27 @@ brw_create_texture_surface( struct brw_context *brw,
|
||||
if (key->bo)
|
||||
surf.ss0.surface_format = translate_tex_format(key->format, key->depthmode);
|
||||
else {
|
||||
switch(key->depth) {
|
||||
case 32: surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break;
|
||||
default:
|
||||
case 24: surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM; break;
|
||||
case 16: surf.ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; break;
|
||||
}
|
||||
switch (key->depth) {
|
||||
case 32:
|
||||
surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
|
||||
break;
|
||||
default:
|
||||
case 24:
|
||||
surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
|
||||
break;
|
||||
case 16:
|
||||
surf.ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is ok for all textures with channel width 8bit or less:
|
||||
*/
|
||||
/* surf.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
|
||||
if (key->bo)
|
||||
surf.ss1.base_addr = key->bo->offset; /* reloc */
|
||||
surf.ss1.base_addr = key->bo->offset; /* reloc */
|
||||
else
|
||||
surf.ss1.base_addr = key->offset;
|
||||
surf.ss1.base_addr = key->offset;
|
||||
|
||||
surf.ss2.mip_count = key->last_level - key->first_level;
|
||||
surf.ss2.width = key->width - 1;
|
||||
|
@@ -95,7 +95,7 @@ int INTEL_DEBUG = (0);
|
||||
|
||||
#include "extension_helper.h"
|
||||
|
||||
#define DRIVER_DATE "20080716"
|
||||
#define DRIVER_DATE "20090114"
|
||||
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
|
||||
|
||||
static const GLubyte *
|
||||
|
@@ -110,7 +110,10 @@ intel_unpair_depth_stencil(GLcontext *ctx, struct intel_renderbuffer *irb)
|
||||
ASSERT(stencilIrb->PairedDepth == rb->Name);
|
||||
intel_renderbuffer_map(intel, rb);
|
||||
intel_renderbuffer_map(intel, stencilRb);
|
||||
#if 0
|
||||
/* disable for now */
|
||||
_mesa_extract_stencil(ctx, rb, stencilRb);
|
||||
#endif
|
||||
intel_renderbuffer_unmap(intel, stencilRb);
|
||||
intel_renderbuffer_unmap(intel, rb);
|
||||
stencilIrb->PairedDepth = 0;
|
||||
@@ -132,7 +135,10 @@ intel_unpair_depth_stencil(GLcontext *ctx, struct intel_renderbuffer *irb)
|
||||
ASSERT(depthIrb->PairedStencil == rb->Name);
|
||||
intel_renderbuffer_map(intel, rb);
|
||||
intel_renderbuffer_map(intel, depthRb);
|
||||
#if 0
|
||||
/* disable for now */
|
||||
_mesa_extract_stencil(ctx, depthRb, rb);
|
||||
#endif
|
||||
intel_renderbuffer_unmap(intel, depthRb);
|
||||
intel_renderbuffer_unmap(intel, rb);
|
||||
depthIrb->PairedStencil = 0;
|
||||
@@ -177,8 +183,11 @@ intel_validate_paired_depth_stencil(GLcontext * ctx,
|
||||
}
|
||||
else {
|
||||
/* Separate depth/stencil buffers, need to interleave now */
|
||||
ASSERT(depthRb->Base._BaseFormat == GL_DEPTH_COMPONENT);
|
||||
ASSERT(stencilRb->Base._BaseFormat == GL_STENCIL_INDEX);
|
||||
ASSERT(depthRb->Base._BaseFormat == GL_DEPTH_COMPONENT ||
|
||||
depthRb->Base._BaseFormat == GL_DEPTH_STENCIL);
|
||||
ASSERT(stencilRb->Base._BaseFormat == GL_STENCIL_INDEX ||
|
||||
stencilRb->Base._BaseFormat == GL_DEPTH_STENCIL);
|
||||
|
||||
/* may need to interleave depth/stencil now */
|
||||
if (depthRb->PairedStencil == stencilRb->Base.Name) {
|
||||
/* OK, the depth and stencil buffers are already interleaved */
|
||||
|
@@ -248,11 +248,18 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||
cpp = 4;
|
||||
break;
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
#if 0
|
||||
rb->_ActualFormat = GL_DEPTH_COMPONENT16;
|
||||
rb->DataType = GL_UNSIGNED_SHORT;
|
||||
rb->DepthBits = 16;
|
||||
cpp = 2;
|
||||
break;
|
||||
#else
|
||||
/* fall-through.
|
||||
* 16bpp depth renderbuffer can't be paired with a stencil buffer so
|
||||
* always used combined depth/stencil format.
|
||||
*/
|
||||
#endif
|
||||
case GL_DEPTH_COMPONENT:
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
case GL_DEPTH_COMPONENT32:
|
||||
@@ -529,20 +536,25 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
||||
if (texImage->TexFormat == &_mesa_texformat_argb8888) {
|
||||
irb->Base._ActualFormat = GL_RGBA8;
|
||||
irb->Base._BaseFormat = GL_RGBA;
|
||||
irb->Base.DataType = GL_UNSIGNED_BYTE;
|
||||
DBG("Render to RGBA8 texture OK\n");
|
||||
}
|
||||
else if (texImage->TexFormat == &_mesa_texformat_rgb565) {
|
||||
irb->Base._ActualFormat = GL_RGB5;
|
||||
irb->Base._BaseFormat = GL_RGB;
|
||||
irb->Base.DataType = GL_UNSIGNED_SHORT;
|
||||
DBG("Render to RGB5 texture OK\n");
|
||||
}
|
||||
else if (texImage->TexFormat == &_mesa_texformat_z16) {
|
||||
irb->Base._ActualFormat = GL_DEPTH_COMPONENT16;
|
||||
irb->Base._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
irb->Base.DataType = GL_UNSIGNED_SHORT;
|
||||
DBG("Render to DEPTH16 texture OK\n");
|
||||
} else if (texImage->TexFormat == &_mesa_texformat_s8_z24) {
|
||||
}
|
||||
else if (texImage->TexFormat == &_mesa_texformat_s8_z24) {
|
||||
irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT;
|
||||
irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT;
|
||||
irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||
DBG("Render to DEPTH_STENCIL texture OK\n");
|
||||
}
|
||||
else {
|
||||
@@ -554,7 +566,6 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
||||
irb->Base.InternalFormat = irb->Base._ActualFormat;
|
||||
irb->Base.Width = texImage->Width;
|
||||
irb->Base.Height = texImage->Height;
|
||||
irb->Base.DataType = GL_UNSIGNED_BYTE; /* FBO XXX fix */
|
||||
irb->Base.RedBits = texImage->TexFormat->RedBits;
|
||||
irb->Base.GreenBits = texImage->TexFormat->GreenBits;
|
||||
irb->Base.BlueBits = texImage->TexFormat->BlueBits;
|
||||
|
@@ -204,6 +204,14 @@ do_blit_bitmap( GLcontext *ctx,
|
||||
/* Update draw buffer bounds */
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
if (ctx->Depth.Test) {
|
||||
/* The blit path produces incorrect results when depth testing is on.
|
||||
* It seems the blit Z coord is always 1.0 (the far plane) so fragments
|
||||
* will likely be obscured by other, closer geometry.
|
||||
*/
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!dst)
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -357,6 +365,7 @@ intel_texture_bitmap(GLcontext * ctx,
|
||||
GLubyte *unpacked_bitmap;
|
||||
GLubyte *a8_bitmap;
|
||||
int x, y;
|
||||
GLfloat dst_z;
|
||||
|
||||
/* We need a fragment program for the KIL effect */
|
||||
if (!ctx->Extensions.ARB_fragment_program ||
|
||||
@@ -456,21 +465,24 @@ intel_texture_bitmap(GLcontext * ctx,
|
||||
intel_meta_set_passthrough_vertex_program(intel);
|
||||
intel_meta_set_passthrough_transform(intel);
|
||||
|
||||
/* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
|
||||
dst_z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
|
||||
|
||||
vertices[0][0] = dst_x;
|
||||
vertices[0][1] = dst_y;
|
||||
vertices[0][2] = ctx->Current.RasterPos[2];
|
||||
vertices[0][2] = dst_z;
|
||||
vertices[0][3] = 1.0;
|
||||
vertices[1][0] = dst_x + width;
|
||||
vertices[1][1] = dst_y;
|
||||
vertices[1][2] = ctx->Current.RasterPos[2];
|
||||
vertices[1][2] = dst_z;
|
||||
vertices[1][3] = 1.0;
|
||||
vertices[2][0] = dst_x + width;
|
||||
vertices[2][1] = dst_y + height;
|
||||
vertices[2][2] = ctx->Current.RasterPos[2];
|
||||
vertices[2][2] = dst_z;
|
||||
vertices[2][3] = 1.0;
|
||||
vertices[3][0] = dst_x;
|
||||
vertices[3][1] = dst_y + height;
|
||||
vertices[3][2] = ctx->Current.RasterPos[2];
|
||||
vertices[3][2] = dst_z;
|
||||
vertices[3][3] = 1.0;
|
||||
|
||||
texcoords[0][0] = 0.0;
|
||||
|
@@ -71,6 +71,7 @@ intel_texture_drawpixels(GLcontext * ctx,
|
||||
GLuint texname;
|
||||
GLfloat vertices[4][4];
|
||||
GLfloat texcoords[4][2];
|
||||
GLfloat z;
|
||||
|
||||
/* We're going to mess with texturing with no regard to existing texture
|
||||
* state, so if there is some set up we have to bail.
|
||||
@@ -140,6 +141,9 @@ intel_texture_drawpixels(GLcontext * ctx,
|
||||
|
||||
intel_meta_set_passthrough_transform(intel);
|
||||
|
||||
/* convert rasterpos Z from [0,1] to NDC coord in [-1,1] */
|
||||
z = -1.0 + 2.0 * ctx->Current.RasterPos[2];
|
||||
|
||||
/* Create the vertex buffer based on the current raster pos. The x and y
|
||||
* we're handed are ctx->Current.RasterPos[0,1] rounded to integers.
|
||||
* We also apply the depth. However, the W component is already multiplied
|
||||
@@ -147,19 +151,19 @@ intel_texture_drawpixels(GLcontext * ctx,
|
||||
*/
|
||||
vertices[0][0] = x;
|
||||
vertices[0][1] = y;
|
||||
vertices[0][2] = ctx->Current.RasterPos[2];
|
||||
vertices[0][2] = z;
|
||||
vertices[0][3] = 1.0;
|
||||
vertices[1][0] = x + width * ctx->Pixel.ZoomX;
|
||||
vertices[1][1] = y;
|
||||
vertices[1][2] = ctx->Current.RasterPos[2];
|
||||
vertices[1][2] = z;
|
||||
vertices[1][3] = 1.0;
|
||||
vertices[2][0] = x + width * ctx->Pixel.ZoomX;
|
||||
vertices[2][1] = y + height * ctx->Pixel.ZoomY;
|
||||
vertices[2][2] = ctx->Current.RasterPos[2];
|
||||
vertices[2][2] = z;
|
||||
vertices[2][3] = 1.0;
|
||||
vertices[3][0] = x;
|
||||
vertices[3][1] = y + height * ctx->Pixel.ZoomY;
|
||||
vertices[3][2] = ctx->Current.RasterPos[2];
|
||||
vertices[3][2] = z;
|
||||
vertices[3][3] = 1.0;
|
||||
|
||||
texcoords[0][0] = 0.0;
|
||||
|
@@ -633,7 +633,7 @@ intelSpanRenderStart(GLcontext * ctx)
|
||||
intelFlush(&intel->ctx);
|
||||
LOCK_HARDWARE(intel);
|
||||
|
||||
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
|
||||
for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
|
||||
if (ctx->Texture.Unit[i]._ReallyEnabled) {
|
||||
struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
|
||||
intel_tex_map_images(intel, intel_texture_object(texObj));
|
||||
@@ -655,7 +655,7 @@ intelSpanRenderFinish(GLcontext * ctx)
|
||||
|
||||
_swrast_flush(ctx);
|
||||
|
||||
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
|
||||
for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
|
||||
if (ctx->Texture.Unit[i]._ReallyEnabled) {
|
||||
struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
|
||||
intel_tex_unmap_images(intel, intel_texture_object(texObj));
|
||||
|
@@ -134,8 +134,14 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
case GL_DEPTH_COMPONENT32:
|
||||
#if 0
|
||||
return &_mesa_texformat_z16;
|
||||
|
||||
#else
|
||||
/* fall-through.
|
||||
* 16bpp depth texture can't be paired with a stencil buffer so
|
||||
* always used combined depth/stencil format.
|
||||
*/
|
||||
#endif
|
||||
case GL_DEPTH_STENCIL_EXT:
|
||||
case GL_DEPTH24_STENCIL8_EXT:
|
||||
return &_mesa_texformat_s8_z24;
|
||||
@@ -158,7 +164,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
return &_mesa_texformat_srgb_dxt1;
|
||||
return &_mesa_texformat_srgb_dxt1;
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
@@ -294,7 +294,13 @@ extern GLboolean mach64UnbindContext( __DRIcontextPrivate *driContextPriv );
|
||||
#define LE32_OUT( x, y ) do { *(GLuint *)(x) = (y); } while (0)
|
||||
#define LE32_OUT_FLOAT( x, y ) do { *(GLfloat *)(x) = (y); } while (0)
|
||||
#else
|
||||
#ifndef __OpenBSD__
|
||||
#include <byteswap.h>
|
||||
#else
|
||||
#include <machine/endian.h>
|
||||
#define bswap_32 bswap32
|
||||
#endif
|
||||
|
||||
#define LE32_IN( x ) bswap_32( *(GLuint *)(x) )
|
||||
#define LE32_IN_FLOAT( x ) \
|
||||
({ \
|
||||
|
@@ -1675,6 +1675,13 @@ static void r300SetupRSUnit(GLcontext * ctx)
|
||||
rs_col_count += count;
|
||||
}
|
||||
|
||||
if (InputsRead & FRAG_BIT_FOGC) {
|
||||
/* XXX FIX THIS
|
||||
* Just turn off the bit for now.
|
||||
* Need to do something similar to the color/texcoord inputs.
|
||||
*/
|
||||
InputsRead &= ~FRAG_BIT_FOGC;
|
||||
}
|
||||
|
||||
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
|
||||
int swiz;
|
||||
|
@@ -473,6 +473,11 @@ static void allocate_input_registers(struct pair_state *s)
|
||||
alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_COL1, hwindex++);
|
||||
InputsRead &= ~FRAG_BIT_COL1;
|
||||
|
||||
/* Fog coordinate */
|
||||
if (InputsRead & FRAG_BIT_FOGC)
|
||||
alloc_hw_reg(s, PROGRAM_INPUT, FRAG_ATTRIB_FOGC, hwindex++);
|
||||
InputsRead &= ~FRAG_BIT_FOGC;
|
||||
|
||||
/* Anything else */
|
||||
if (InputsRead)
|
||||
error("Don't know how to handle inputs 0x%x\n", InputsRead);
|
||||
|
@@ -601,8 +601,9 @@ WINGDIAPI BOOL GLAPIENTRY wglCopyContext(HGLRC hglrcSrc,
|
||||
WINGDIAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC hdc,
|
||||
int iLayerPlane)
|
||||
{
|
||||
(void) hdc; (void) iLayerPlane;
|
||||
SetLastError(0);
|
||||
if (iLayerPlane == 0)
|
||||
return wglCreateContext( hdc );
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
@@ -298,6 +298,10 @@ _glthread_GetTSD(_glthread_TSD *);
|
||||
extern void
|
||||
_glthread_SetTSD(_glthread_TSD *, void *);
|
||||
|
||||
#if !defined __GNUC__ || __GNUC__ < 3
|
||||
# define __builtin_expect(x, y) x
|
||||
#endif
|
||||
|
||||
#if defined(GLX_USE_TLS)
|
||||
|
||||
extern __thread struct _glapi_table * _glapi_tls_Dispatch
|
||||
|
@@ -146,7 +146,8 @@
|
||||
#include <byteswap.h>
|
||||
#define CPU_TO_LE32( x ) bswap_32( x )
|
||||
#else /*__linux__*/
|
||||
#define CPU_TO_LE32( x ) ( x ) /* fix me for non-Linux big-endian! */
|
||||
#include <sys/endian.h>
|
||||
#define CPU_TO_LE32( x ) bswap32( x )
|
||||
#endif /*__linux__*/
|
||||
#define MESA_BIG_ENDIAN 1
|
||||
#else
|
||||
|
@@ -208,7 +208,8 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
|
||||
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
|
||||
}
|
||||
TRANSFORM_NORMAL(temp, params, ctx->ModelviewMatrixStack.Top->inv);
|
||||
TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m);
|
||||
NORMALIZE_3FV(temp);
|
||||
params = temp;
|
||||
break;
|
||||
case GL_SPOT_EXPONENT:
|
||||
|
@@ -2094,6 +2094,13 @@ struct gl_query_state
|
||||
};
|
||||
|
||||
|
||||
/** Set by #pragma directives */
|
||||
struct gl_sl_pragmas
|
||||
{
|
||||
GLboolean Optimize; /**< defaults on */
|
||||
GLboolean Debug; /**< defaults off */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A GLSL vertex or fragment shader object.
|
||||
@@ -2104,12 +2111,12 @@ struct gl_shader
|
||||
GLuint Name; /**< AKA the handle */
|
||||
GLint RefCount; /**< Reference count */
|
||||
GLboolean DeletePending;
|
||||
|
||||
const GLchar *Source; /**< Source code string */
|
||||
GLboolean CompileStatus;
|
||||
GLboolean Main; /**< shader defines main() */
|
||||
const GLchar *Source; /**< Source code string */
|
||||
struct gl_program *Program; /**< Post-compile assembly code */
|
||||
GLchar *InfoLog;
|
||||
GLboolean Main; /**< shader defines main() */
|
||||
struct gl_sl_pragmas Pragmas;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#define MESA_MAJOR 7
|
||||
#define MESA_MINOR 3
|
||||
#define MESA_PATCH 0
|
||||
#define MESA_VERSION_STRING "7.3-rc1"
|
||||
#define MESA_VERSION_STRING "7.3-rc2"
|
||||
|
||||
/* To make version comparison easy */
|
||||
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
|
||||
|
@@ -189,6 +189,18 @@ do { \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
* Transform a direction by a matrix.
|
||||
*/
|
||||
#define TRANSFORM_DIRECTION( TO, DIR, MAT ) \
|
||||
do { \
|
||||
TO[0] = DIR[0] * MAT[0] + DIR[1] * MAT[4] + DIR[2] * MAT[8]; \
|
||||
TO[1] = DIR[0] * MAT[1] + DIR[1] * MAT[5] + DIR[2] * MAT[9]; \
|
||||
TO[2] = DIR[0] * MAT[2] + DIR[1] * MAT[6] + DIR[2] * MAT[10];\
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
@@ -963,6 +963,8 @@ parse_output_color_num (GLcontext * ctx, const GLubyte ** inst,
|
||||
|
||||
|
||||
/**
|
||||
* Validate the index of a texture coordinate
|
||||
*
|
||||
* \param coord The texture unit index
|
||||
* \return 0 on sucess, 1 on error
|
||||
*/
|
||||
@@ -972,8 +974,8 @@ parse_texcoord_num (GLcontext * ctx, const GLubyte ** inst,
|
||||
{
|
||||
GLint i = parse_integer (inst, Program);
|
||||
|
||||
if ((i < 0) || (i >= (int)ctx->Const.MaxTextureUnits)) {
|
||||
program_error(ctx, Program->Position, "Invalid texture unit index");
|
||||
if ((i < 0) || (i >= (int)ctx->Const.MaxTextureCoordUnits)) {
|
||||
program_error(ctx, Program->Position, "Invalid texture coordinate index");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -981,6 +983,29 @@ parse_texcoord_num (GLcontext * ctx, const GLubyte ** inst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate the index of a texture image unit
|
||||
*
|
||||
* \param coord The texture unit index
|
||||
* \return 0 on sucess, 1 on error
|
||||
*/
|
||||
static GLuint
|
||||
parse_teximage_num (GLcontext * ctx, const GLubyte ** inst,
|
||||
struct arb_program *Program, GLuint * coord)
|
||||
{
|
||||
GLint i = parse_integer (inst, Program);
|
||||
|
||||
if ((i < 0) || (i >= (int)ctx->Const.MaxTextureImageUnits)) {
|
||||
program_error(ctx, Program->Position, "Invalid texture image index");
|
||||
return 1;
|
||||
}
|
||||
|
||||
*coord = (GLuint) i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \param coord The weight index
|
||||
* \return 0 on sucess, 1 on error
|
||||
@@ -3003,7 +3028,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst,
|
||||
return 1;
|
||||
|
||||
/* texImageUnit */
|
||||
if (parse_texcoord_num (ctx, inst, Program, &texcoord))
|
||||
if (parse_teximage_num (ctx, inst, Program, &texcoord))
|
||||
return 1;
|
||||
fp->TexSrcUnit = texcoord;
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.3
|
||||
* Version: 7.3
|
||||
*
|
||||
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2009 VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -157,7 +158,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
|
||||
{ OPCODE_AND, "AND", 2, 1 },
|
||||
{ OPCODE_ARA, "ARA", 1, 1 },
|
||||
{ OPCODE_ARL, "ARL", 1, 1 },
|
||||
{ OPCODE_ARL_NV, "ARL", 1, 1 },
|
||||
{ OPCODE_ARL_NV, "ARL_NV", 1, 1 },
|
||||
{ OPCODE_ARR, "ARL", 1, 1 },
|
||||
{ OPCODE_BGNLOOP,"BGNLOOP", 0, 0 },
|
||||
{ OPCODE_BGNSUB, "BGNSUB", 0, 0 },
|
||||
@@ -186,7 +187,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
|
||||
{ OPCODE_FRC, "FRC", 1, 1 },
|
||||
{ OPCODE_IF, "IF", 1, 0 },
|
||||
{ OPCODE_KIL, "KIL", 1, 0 },
|
||||
{ OPCODE_KIL_NV, "KIL", 0, 0 },
|
||||
{ OPCODE_KIL_NV, "KIL_NV", 0, 0 },
|
||||
{ OPCODE_LG2, "LG2", 1, 1 },
|
||||
{ OPCODE_LIT, "LIT", 1, 1 },
|
||||
{ OPCODE_LOG, "LOG", 1, 1 },
|
||||
@@ -235,7 +236,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
|
||||
{ OPCODE_TXD, "TXD", 3, 1 },
|
||||
{ OPCODE_TXL, "TXL", 1, 1 },
|
||||
{ OPCODE_TXP, "TXP", 1, 1 },
|
||||
{ OPCODE_TXP_NV, "TXP", 1, 1 },
|
||||
{ OPCODE_TXP_NV, "TXP_NV", 1, 1 },
|
||||
{ OPCODE_TRUNC, "TRUNC", 1, 1 },
|
||||
{ OPCODE_UP2H, "UP2H", 1, 1 },
|
||||
{ OPCODE_UP2US, "UP2US", 1, 1 },
|
||||
|
@@ -79,6 +79,12 @@
|
||||
.emtcode BEHAVIOR_WARN 3
|
||||
.emtcode BEHAVIOR_DISABLE 4
|
||||
|
||||
/*
|
||||
* The PRAGMA_* symbols follow TOKEN_PRAGMA
|
||||
*/
|
||||
.emtcode PRAGMA_NO_PARAM 0
|
||||
.emtcode PRAGMA_PARAM 1
|
||||
|
||||
source
|
||||
optional_directive .and .loop source_element .and '\0' .emit ESCAPE_TOKEN .emit TOKEN_END;
|
||||
|
||||
@@ -153,6 +159,7 @@ directive
|
||||
dir_elif .emit TOKEN_ELIF .or
|
||||
dir_endif .emit TOKEN_ENDIF .or
|
||||
dir_ext .emit TOKEN_EXTENSION .or
|
||||
dir_pragma .emit TOKEN_PRAGMA .or
|
||||
dir_line .emit TOKEN_LINE;
|
||||
|
||||
dir_define
|
||||
@@ -187,6 +194,19 @@ dir_ext
|
||||
dir_line
|
||||
optional_space .and '#' .and optional_space .and "line" .and expression;
|
||||
|
||||
dir_pragma
|
||||
optional_space .and '#' .and optional_space .and "pragma" .and symbol .and opt_pragma_param;
|
||||
|
||||
|
||||
opt_pragma_param
|
||||
pragma_param .or .true .emit PRAGMA_NO_PARAM;
|
||||
|
||||
pragma_param
|
||||
optional_space .and '(' .emit PRAGMA_PARAM .and optional_space .and symbol_no_space .and optional_space .and ')';
|
||||
|
||||
symbol_no_space
|
||||
symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
|
||||
|
||||
symbol
|
||||
space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\0';
|
||||
|
||||
|
@@ -20,6 +20,8 @@
|
||||
".emtcode BEHAVIOR_ENABLE 2\n"
|
||||
".emtcode BEHAVIOR_WARN 3\n"
|
||||
".emtcode BEHAVIOR_DISABLE 4\n"
|
||||
".emtcode PRAGMA_NO_PARAM 0\n"
|
||||
".emtcode PRAGMA_PARAM 1\n"
|
||||
"source\n"
|
||||
" optional_directive .and .loop source_element .and '\\0' .emit ESCAPE_TOKEN .emit TOKEN_END;\n"
|
||||
"source_element\n"
|
||||
@@ -76,6 +78,7 @@
|
||||
" dir_elif .emit TOKEN_ELIF .or\n"
|
||||
" dir_endif .emit TOKEN_ENDIF .or\n"
|
||||
" dir_ext .emit TOKEN_EXTENSION .or\n"
|
||||
" dir_pragma .emit TOKEN_PRAGMA .or\n"
|
||||
" dir_line .emit TOKEN_LINE;\n"
|
||||
"dir_define\n"
|
||||
" optional_space .and '#' .and optional_space .and \"define\" .and symbol .and opt_parameters .and\n"
|
||||
@@ -99,6 +102,14 @@
|
||||
" optional_space .and ':' .and optional_space .and extension_behavior;\n"
|
||||
"dir_line\n"
|
||||
" optional_space .and '#' .and optional_space .and \"line\" .and expression;\n"
|
||||
"dir_pragma\n"
|
||||
" optional_space .and '#' .and optional_space .and \"pragma\" .and symbol .and opt_pragma_param;\n"
|
||||
"opt_pragma_param\n"
|
||||
" pragma_param .or .true .emit PRAGMA_NO_PARAM;\n"
|
||||
"pragma_param\n"
|
||||
" optional_space .and '(' .emit PRAGMA_PARAM .and optional_space .and symbol_no_space .and optional_space .and ')';\n"
|
||||
"symbol_no_space\n"
|
||||
" symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\\0';\n"
|
||||
"symbol\n"
|
||||
" space .and symbol_character .emit * .and .loop symbol_character2 .emit * .and .true .emit '\\0';\n"
|
||||
"opt_parameters\n"
|
||||
|
@@ -1161,13 +1161,6 @@ compound_statement_2
|
||||
compound_statement_3
|
||||
lbrace .and statement_list .and rbrace;
|
||||
|
||||
/*
|
||||
* <statement_no_new_scope> ::= <compound_statement_no_new_scope>
|
||||
* | <simple_statement>
|
||||
*/
|
||||
statement_no_new_scope
|
||||
compound_statement_no_new_scope .or simple_statement;
|
||||
|
||||
/*
|
||||
* <compound_statement_no_new_scope> ::= "{" "}"
|
||||
* | "{" <statement_list> "}"
|
||||
@@ -1181,6 +1174,7 @@ compound_statement_no_new_scope_2
|
||||
compound_statement_no_new_scope_3
|
||||
lbrace .and statement_list .and rbrace;
|
||||
|
||||
|
||||
/*
|
||||
* <statement_list> ::= <statement>
|
||||
* | <statement_list> <statement>
|
||||
@@ -1242,8 +1236,7 @@ condition_3
|
||||
/*
|
||||
* <iteration_statement> ::= "while" "(" <condition> ")" <statement>
|
||||
* | "do" <statement> "while" "(" <expression> ")" ";"
|
||||
* | "for" "(" <for_init_statement> <for_rest_statement> ")"
|
||||
* <statement_no_new_scope>
|
||||
* | "for" "(" <for_init_statement> <for_rest_statement> ")" <statement>
|
||||
*/
|
||||
iteration_statement
|
||||
iteration_statement_1 .or iteration_statement_2 .or iteration_statement_3;
|
||||
@@ -1255,7 +1248,7 @@ iteration_statement_2
|
||||
expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;
|
||||
iteration_statement_3
|
||||
"for" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and
|
||||
for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;
|
||||
for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement;
|
||||
|
||||
/*
|
||||
* <for_init_statement> ::= <expression_statement>
|
||||
|
@@ -566,8 +566,6 @@
|
||||
" lbrace .and rbrace;\n"
|
||||
"compound_statement_3\n"
|
||||
" lbrace .and statement_list .and rbrace;\n"
|
||||
"statement_no_new_scope\n"
|
||||
" compound_statement_no_new_scope .or simple_statement;\n"
|
||||
"compound_statement_no_new_scope\n"
|
||||
" compound_statement_no_new_scope_1 .emit OP_BLOCK_BEGIN_NO_NEW_SCOPE .and .true .emit OP_END;\n"
|
||||
"compound_statement_no_new_scope_1\n"
|
||||
@@ -617,7 +615,7 @@
|
||||
" expression .and rparen .error RPAREN_EXPECTED .emit OP_END .and semicolon;\n"
|
||||
"iteration_statement_3\n"
|
||||
" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"
|
||||
" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"
|
||||
" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement;\n"
|
||||
"for_init_statement\n"
|
||||
" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"
|
||||
"conditionopt\n"
|
||||
|
@@ -4238,6 +4238,21 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the given type specifier is a rectangular texture sampler.
|
||||
*/
|
||||
static GLboolean
|
||||
is_rect_sampler_spec(const slang_type_specifier *spec)
|
||||
{
|
||||
while (spec->_array) {
|
||||
spec = spec->_array;
|
||||
}
|
||||
return spec->type == SLANG_SPEC_SAMPLER2DRECT ||
|
||||
spec->type == SLANG_SPEC_SAMPLER2DRECTSHADOW;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called by compiler when a global variable has been parsed/compiled.
|
||||
* Here we examine the variable's type to determine what kind of register
|
||||
@@ -4261,10 +4276,14 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
|
||||
slang_ir_storage *store = NULL;
|
||||
int dbg = 0;
|
||||
const GLenum datatype = _slang_gltype_from_specifier(&var->type.specifier);
|
||||
const GLint texIndex = sampler_to_texture_index(var->type.specifier.type);
|
||||
const GLint size = _slang_sizeof_type_specifier(&var->type.specifier);
|
||||
const GLint arrayLen = _slang_array_length(var);
|
||||
const GLint totalSize = _slang_array_size(size, arrayLen);
|
||||
GLint texIndex = sampler_to_texture_index(var->type.specifier.type);
|
||||
|
||||
/* check for sampler2D arrays */
|
||||
if (texIndex == -1 && var->type.specifier._array)
|
||||
texIndex = sampler_to_texture_index(var->type.specifier._array->type);
|
||||
|
||||
if (texIndex != -1) {
|
||||
/* This is a texture sampler variable...
|
||||
@@ -4278,15 +4297,32 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
|
||||
}
|
||||
#if FEATURE_es2_glsl /* XXX should use FEATURE_texture_rect */
|
||||
/* disallow rect samplers */
|
||||
if (var->type.specifier.type == SLANG_SPEC_SAMPLER2DRECT ||
|
||||
var->type.specifier.type == SLANG_SPEC_SAMPLER2DRECTSHADOW) {
|
||||
if (is_rect_sampler_spec(&var->type.specifier)) {
|
||||
slang_info_log_error(A->log, "invalid sampler type for '%s'", varName);
|
||||
return GL_FALSE;
|
||||
}
|
||||
#else
|
||||
(void) is_rect_sampler_spec; /* silence warning */
|
||||
#endif
|
||||
{
|
||||
GLint sampNum = _mesa_add_sampler(prog->Parameters, varName, datatype);
|
||||
store = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, texIndex);
|
||||
store = _slang_new_ir_storage_sampler(sampNum, texIndex, totalSize);
|
||||
|
||||
/* If we have a sampler array, then we need to allocate the
|
||||
* additional samplers to ensure we don't allocate them elsewhere.
|
||||
* We can't directly use _mesa_add_sampler() as that checks the
|
||||
* varName and gets a match, so we call _mesa_add_parameter()
|
||||
* directly and use the last sampler number from the call above.
|
||||
*/
|
||||
if (arrayLen > 0) {
|
||||
GLint a = arrayLen - 1;
|
||||
GLint i;
|
||||
for (i = 0; i < a; i++) {
|
||||
GLfloat value = (GLfloat)(i + sampNum + 1);
|
||||
(void) _mesa_add_parameter(prog->Parameters, PROGRAM_SAMPLER,
|
||||
varName, 1, datatype, &value, NULL, 0x0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dbg) printf("SAMPLER ");
|
||||
}
|
||||
@@ -4470,7 +4506,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
|
||||
n = _slang_gen_var_decl(A, var, var->initializer);
|
||||
|
||||
/* emit GPU instructions */
|
||||
success = _slang_emit_code(n, A->vartable, A->program, GL_FALSE, A->log);
|
||||
success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_FALSE, A->log);
|
||||
|
||||
_slang_free_ir_tree(n);
|
||||
}
|
||||
@@ -4580,7 +4616,7 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun)
|
||||
#endif
|
||||
|
||||
/* Emit program instructions */
|
||||
success = _slang_emit_code(n, A->vartable, A->program, GL_TRUE, A->log);
|
||||
success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_TRUE, A->log);
|
||||
_slang_free_ir_tree(n);
|
||||
|
||||
/* free codegen context */
|
||||
|
@@ -36,6 +36,7 @@ typedef struct slang_assemble_ctx_
|
||||
slang_atom_pool *atoms;
|
||||
slang_name_space space;
|
||||
struct gl_program *program;
|
||||
struct gl_sl_pragmas *pragmas;
|
||||
slang_var_table *vartable;
|
||||
slang_info_log *log;
|
||||
struct slang_label_ *curFuncEndLabel;
|
||||
|
@@ -144,6 +144,7 @@ typedef struct slang_output_ctx_
|
||||
slang_function_scope *funs;
|
||||
slang_struct_scope *structs;
|
||||
struct gl_program *program;
|
||||
struct gl_sl_pragmas *pragmas;
|
||||
slang_var_table *vartable;
|
||||
GLuint default_precision[TYPE_SPECIFIER_COUNT];
|
||||
GLboolean allow_precision;
|
||||
@@ -1138,26 +1139,8 @@ parse_statement(slang_parse_ctx * C, slang_output_ctx * O,
|
||||
RETURN0;
|
||||
if (!parse_child_operation(C, &o, oper, GL_FALSE))
|
||||
RETURN0;
|
||||
#if 0
|
||||
if (!parse_child_operation(C, &o, oper, GL_TRUE))
|
||||
RETURN0;
|
||||
#else
|
||||
/* force creation of new scope for loop body */
|
||||
{
|
||||
slang_operation *ch;
|
||||
slang_output_ctx oo = o;
|
||||
|
||||
/* grow child array */
|
||||
ch = slang_operation_grow(&oper->num_children, &oper->children);
|
||||
ch->type = SLANG_OPER_BLOCK_NEW_SCOPE;
|
||||
|
||||
ch->locals->outer_scope = o.vars;
|
||||
oo.vars = ch->locals;
|
||||
|
||||
if (!parse_child_operation(C, &oo, ch, GL_TRUE))
|
||||
RETURN0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case OP_PRECISION:
|
||||
@@ -2077,6 +2060,7 @@ parse_init_declarator(slang_parse_ctx * C, slang_output_ctx * O,
|
||||
A.space.structs = O->structs;
|
||||
A.space.vars = O->vars;
|
||||
A.program = O->program;
|
||||
A.pragmas = O->pragmas;
|
||||
A.vartable = O->vartable;
|
||||
A.log = C->L;
|
||||
A.curFuncEndLabel = NULL;
|
||||
@@ -2367,6 +2351,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
|
||||
o.structs = &unit->structs;
|
||||
o.vars = &unit->vars;
|
||||
o.program = shader ? shader->Program : NULL;
|
||||
o.pragmas = shader ? &shader->Pragmas : NULL;
|
||||
o.vartable = _slang_new_var_table(maxRegs);
|
||||
_slang_push_var_table(o.vartable);
|
||||
|
||||
@@ -2435,6 +2420,7 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
|
||||
A.space.structs = o.structs;
|
||||
A.space.vars = o.vars;
|
||||
A.program = o.program;
|
||||
A.pragmas = &shader->Pragmas;
|
||||
A.vartable = o.vartable;
|
||||
A.log = C->L;
|
||||
|
||||
@@ -2493,7 +2479,8 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
|
||||
slang_unit_type type, slang_info_log * infolog,
|
||||
slang_code_unit * builtin,
|
||||
struct gl_shader *shader,
|
||||
const struct gl_extensions *extensions)
|
||||
const struct gl_extensions *extensions,
|
||||
struct gl_sl_pragmas *pragmas)
|
||||
{
|
||||
byte *prod;
|
||||
GLuint size, start, version;
|
||||
@@ -2522,7 +2509,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
|
||||
/* Now preprocess the source string. */
|
||||
slang_string_init(&preprocessed);
|
||||
if (!_slang_preprocess_directives(&preprocessed, &source[start],
|
||||
infolog, extensions)) {
|
||||
infolog, extensions, pragmas)) {
|
||||
slang_string_free(&preprocessed);
|
||||
slang_info_log_error(infolog, "failed to preprocess the source.");
|
||||
return GL_FALSE;
|
||||
@@ -2596,7 +2583,8 @@ static GLboolean
|
||||
compile_object(grammar * id, const char *source, slang_code_object * object,
|
||||
slang_unit_type type, slang_info_log * infolog,
|
||||
struct gl_shader *shader,
|
||||
const struct gl_extensions *extensions)
|
||||
const struct gl_extensions *extensions,
|
||||
struct gl_sl_pragmas *pragmas)
|
||||
{
|
||||
slang_code_unit *builtins = NULL;
|
||||
GLuint base_version = 110;
|
||||
@@ -2695,7 +2683,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
|
||||
|
||||
/* compile the actual shader - pass-in built-in library for external shader */
|
||||
return compile_with_grammar(*id, source, &object->unit, type, infolog,
|
||||
builtins, shader, extensions);
|
||||
builtins, shader, extensions, pragmas);
|
||||
}
|
||||
|
||||
|
||||
@@ -2719,7 +2707,7 @@ compile_shader(GLcontext *ctx, slang_code_object * object,
|
||||
_slang_code_object_ctr(object);
|
||||
|
||||
success = compile_object(&id, shader->Source, object, type, infolog, shader,
|
||||
&ctx->Extensions);
|
||||
&ctx->Extensions, &shader->Pragmas);
|
||||
if (id != 0)
|
||||
grammar_destroy(id);
|
||||
if (!success)
|
||||
|
@@ -1271,6 +1271,20 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n)
|
||||
opcode = OPCODE_TXP;
|
||||
}
|
||||
|
||||
if (n->Children[0]->Opcode == IR_ELEMENT) {
|
||||
/* array is the sampler (a uniform which'll indicate the texture unit) */
|
||||
assert(n->Children[0]->Children[0]->Store);
|
||||
assert(n->Children[0]->Children[0]->Store->File == PROGRAM_SAMPLER);
|
||||
|
||||
emit(emitInfo, n->Children[0]);
|
||||
|
||||
n->Children[0]->Var = n->Children[0]->Children[0]->Var;
|
||||
} else {
|
||||
/* this is the sampler (a uniform which'll indicate the texture unit) */
|
||||
assert(n->Children[0]->Store);
|
||||
assert(n->Children[0]->Store->File == PROGRAM_SAMPLER);
|
||||
}
|
||||
|
||||
/* emit code for the texcoord operand */
|
||||
(void) emit(emitInfo, n->Children[1]);
|
||||
|
||||
@@ -1286,17 +1300,10 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n)
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Child[0] is the sampler (a uniform which'll indicate the texture unit) */
|
||||
assert(n->Children[0]->Store);
|
||||
assert(n->Children[0]->Store->File == PROGRAM_SAMPLER);
|
||||
/* Store->Index is the sampler index */
|
||||
/* Store->Index is the uniform/sampler index */
|
||||
assert(n->Children[0]->Store->Index >= 0);
|
||||
/* Store->Size is the texture target */
|
||||
assert(n->Children[0]->Store->Size >= TEXTURE_1D_INDEX);
|
||||
assert(n->Children[0]->Store->Size <= TEXTURE_RECT_INDEX);
|
||||
|
||||
inst->TexSrcTarget = n->Children[0]->Store->Size;
|
||||
inst->TexSrcUnit = n->Children[0]->Store->Index; /* i.e. uniform's index */
|
||||
inst->TexSrcUnit = n->Children[0]->Store->Index;
|
||||
inst->TexSrcTarget = n->Children[0]->Store->TexTarget;
|
||||
|
||||
/* mark the sampler as being used */
|
||||
_mesa_use_uniform(emitInfo->prog->Parameters,
|
||||
@@ -2370,10 +2377,20 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo)
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert the IR tree into GPU instructions.
|
||||
* \param n root of IR tree
|
||||
* \param vt variable table
|
||||
* \param prog program to put GPU instructions into
|
||||
* \param pragmas controls codegen options
|
||||
* \param withEnd if true, emit END opcode at end
|
||||
* \param log log for emitting errors/warnings/info
|
||||
*/
|
||||
GLboolean
|
||||
_slang_emit_code(slang_ir_node *n, slang_var_table *vt,
|
||||
struct gl_program *prog, GLboolean withEnd,
|
||||
struct gl_program *prog,
|
||||
const struct gl_sl_pragmas *pragmas,
|
||||
GLboolean withEnd,
|
||||
slang_info_log *log)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
@@ -2390,7 +2407,7 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt,
|
||||
|
||||
emitInfo.EmitHighLevelInstructions = ctx->Shader.EmitHighLevelInstructions;
|
||||
emitInfo.EmitCondCodes = ctx->Shader.EmitCondCodes;
|
||||
emitInfo.EmitComments = ctx->Shader.EmitComments;
|
||||
emitInfo.EmitComments = ctx->Shader.EmitComments || pragmas->Debug;
|
||||
emitInfo.EmitBeginEndSub = GL_TRUE;
|
||||
|
||||
if (!emitInfo.EmitCondCodes) {
|
||||
|
@@ -46,7 +46,9 @@ _slang_var_swizzle(GLint size, GLint comp);
|
||||
|
||||
extern GLboolean
|
||||
_slang_emit_code(slang_ir_node *n, slang_var_table *vartable,
|
||||
struct gl_program *prog, GLboolean withEnd,
|
||||
struct gl_program *prog,
|
||||
const struct gl_sl_pragmas *pragmas,
|
||||
GLboolean withEnd,
|
||||
slang_info_log *log);
|
||||
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.1
|
||||
*
|
||||
* Copyright (C) 2005-2008 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -216,6 +216,26 @@ _slang_new_ir_storage_indirect(enum register_file file,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allocate IR storage for a texture sampler.
|
||||
* \param sampNum the sampler number/index
|
||||
* \param texTarget one of TEXTURE_x_INDEX values
|
||||
* \param size number of samplers (in case of sampler array)
|
||||
*/
|
||||
slang_ir_storage *
|
||||
_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size)
|
||||
{
|
||||
slang_ir_storage *st;
|
||||
assert(texTarget < NUM_TEXTURE_TARGETS);
|
||||
st = _slang_new_ir_storage(PROGRAM_SAMPLER, sampNum, size);
|
||||
if (st) {
|
||||
st->TexTarget = texTarget;
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* XXX temporary function */
|
||||
void
|
||||
_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.3
|
||||
*
|
||||
* Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2005-2008 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -168,8 +168,8 @@ typedef enum
|
||||
struct slang_ir_storage_
|
||||
{
|
||||
enum register_file File; /**< PROGRAM_TEMPORARY, PROGRAM_INPUT, etc */
|
||||
GLint Index; /**< -1 means unallocated */
|
||||
GLint Size; /**< number of floats */
|
||||
GLint Index; /**< -1 means unallocated */
|
||||
GLint Size; /**< number of floats or ints */
|
||||
GLuint Swizzle; /**< Swizzle AND writemask info */
|
||||
GLint RefCount; /**< Used during IR tree delete */
|
||||
|
||||
@@ -179,6 +179,7 @@ struct slang_ir_storage_
|
||||
enum register_file IndirectFile;
|
||||
GLint IndirectIndex;
|
||||
GLuint IndirectSwizzle;
|
||||
GLuint TexTarget; /**< If File==PROGRAM_SAMPLER, one of TEXTURE_x_INDEX */
|
||||
|
||||
/** If Parent is non-null, Index is relative to parent.
|
||||
* The other fields are ignored.
|
||||
@@ -254,6 +255,10 @@ _slang_new_ir_storage_indirect(enum register_file file,
|
||||
GLint indirectIndex,
|
||||
GLuint indirectSwizzle);
|
||||
|
||||
extern slang_ir_storage *
|
||||
_slang_new_ir_storage_sampler(GLint sampNum, GLuint texTarget, GLint size);
|
||||
|
||||
|
||||
extern void
|
||||
_slang_copy_ir_storage(slang_ir_storage *dst, const slang_ir_storage *src);
|
||||
|
||||
|
@@ -282,12 +282,14 @@ link_uniform_vars(GLcontext *ctx,
|
||||
for (i = 0; i < prog->NumInstructions; i++) {
|
||||
struct prog_instruction *inst = prog->Instructions + i;
|
||||
if (_mesa_is_tex_instruction(inst->Opcode)) {
|
||||
/*
|
||||
printf("====== remap sampler from %d to %d\n",
|
||||
inst->Sampler, map[ inst->Sampler ]);
|
||||
*/
|
||||
/* here, texUnit is really samplerUnit */
|
||||
const GLint oldSampNum = inst->TexSrcUnit;
|
||||
|
||||
#if 0
|
||||
printf("====== remap sampler from %d to %d\n",
|
||||
inst->TexSrcUnit, samplerMap[ inst->TexSrcUnit ]);
|
||||
#endif
|
||||
|
||||
/* here, texUnit is really samplerUnit */
|
||||
if (oldSampNum < Elements(samplerMap)) {
|
||||
const GLuint newSampNum = samplerMap[oldSampNum];
|
||||
inst->TexSrcUnit = newSampNum;
|
||||
|
@@ -51,6 +51,9 @@ grammar_error_to_log (slang_info_log *log)
|
||||
GLint pos;
|
||||
|
||||
grammar_get_last_error ((byte *) (buf), sizeof (buf), &pos);
|
||||
if (buf[0] == 0) {
|
||||
_mesa_snprintf(buf, sizeof(buf), "Preprocessor error");
|
||||
}
|
||||
slang_info_log_error (log, buf);
|
||||
}
|
||||
|
||||
@@ -528,6 +531,56 @@ pp_ext_set(pp_ext *self, const char *name, GLboolean enable)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pp_pragmas_init(struct gl_sl_pragmas *pragmas)
|
||||
{
|
||||
pragmas->Optimize = GL_TRUE;
|
||||
pragmas->Debug = GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called in response to #pragma. For example, "#pragma debug(on)" would
|
||||
* call this function as pp_pragma("debug", "on").
|
||||
* \return GL_TRUE if pragma is valid, GL_FALSE if invalid
|
||||
*/
|
||||
static GLboolean
|
||||
pp_pragma(struct gl_sl_pragmas *pragmas, const char *pragma, const char *param)
|
||||
{
|
||||
#if 0
|
||||
printf("#pragma %s %s\n", pragma, param);
|
||||
#endif
|
||||
if (_mesa_strcmp(pragma, "optimize") == 0) {
|
||||
if (!param)
|
||||
return GL_FALSE; /* missing required param */
|
||||
if (_mesa_strcmp(param, "on") == 0) {
|
||||
pragmas->Optimize = GL_TRUE;
|
||||
}
|
||||
else if (_mesa_strcmp(param, "off") == 0) {
|
||||
pragmas->Optimize = GL_FALSE;
|
||||
}
|
||||
else {
|
||||
return GL_FALSE; /* invalid param */
|
||||
}
|
||||
}
|
||||
else if (_mesa_strcmp(pragma, "debug") == 0) {
|
||||
if (!param)
|
||||
return GL_FALSE; /* missing required param */
|
||||
if (_mesa_strcmp(param, "on") == 0) {
|
||||
pragmas->Debug = GL_TRUE;
|
||||
}
|
||||
else if (_mesa_strcmp(param, "off") == 0) {
|
||||
pragmas->Debug = GL_FALSE;
|
||||
}
|
||||
else {
|
||||
return GL_FALSE; /* invalid param */
|
||||
}
|
||||
}
|
||||
/* all other pragmas are silently ignored */
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The state of preprocessor: current line, file and version number, list
|
||||
* of all defined macros and the #if/#endif context.
|
||||
@@ -862,11 +915,16 @@ parse_if (slang_string *output, const byte *prod, GLuint *pi, GLint *result, pp_
|
||||
#define BEHAVIOR_WARN 3
|
||||
#define BEHAVIOR_DISABLE 4
|
||||
|
||||
#define PRAGMA_NO_PARAM 0
|
||||
#define PRAGMA_PARAM 1
|
||||
|
||||
|
||||
static GLboolean
|
||||
preprocess_source (slang_string *output, const char *source,
|
||||
grammar pid, grammar eid,
|
||||
slang_info_log *elog,
|
||||
const struct gl_extensions *extensions)
|
||||
const struct gl_extensions *extensions,
|
||||
struct gl_sl_pragmas *pragmas)
|
||||
{
|
||||
static const char *predefined[] = {
|
||||
"__FILE__",
|
||||
@@ -888,6 +946,7 @@ preprocess_source (slang_string *output, const char *source,
|
||||
}
|
||||
|
||||
pp_state_init (&state, elog, extensions);
|
||||
pp_pragmas_init (pragmas);
|
||||
|
||||
/* add the predefined symbols to the symbol table */
|
||||
for (i = 0; predefined[i]; i++) {
|
||||
@@ -940,9 +999,11 @@ preprocess_source (slang_string *output, const char *source,
|
||||
else {
|
||||
const char *id;
|
||||
GLuint idlen;
|
||||
GLubyte token;
|
||||
|
||||
i++;
|
||||
switch (prod[i++]) {
|
||||
token = prod[i++];
|
||||
switch (token) {
|
||||
|
||||
case TOKEN_END:
|
||||
/* End of source string.
|
||||
@@ -1159,6 +1220,25 @@ preprocess_source (slang_string *output, const char *source,
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_PRAGMA:
|
||||
{
|
||||
GLint have_param;
|
||||
const char *pragma, *param;
|
||||
|
||||
pragma = (const char *) (&prod[i]);
|
||||
i += _mesa_strlen(pragma) + 1;
|
||||
have_param = (prod[i++] == PRAGMA_PARAM);
|
||||
if (have_param) {
|
||||
param = (const char *) (&prod[i]);
|
||||
i += _mesa_strlen(param) + 1;
|
||||
}
|
||||
else {
|
||||
param = NULL;
|
||||
}
|
||||
pp_pragma(pragmas, pragma, param);
|
||||
}
|
||||
break;
|
||||
|
||||
case TOKEN_LINE:
|
||||
id = (const char *) (&prod[i]);
|
||||
i += _mesa_strlen (id) + 1;
|
||||
@@ -1223,7 +1303,8 @@ GLboolean
|
||||
_slang_preprocess_directives(slang_string *output,
|
||||
const char *input,
|
||||
slang_info_log *elog,
|
||||
const struct gl_extensions *extensions)
|
||||
const struct gl_extensions *extensions,
|
||||
struct gl_sl_pragmas *pragmas)
|
||||
{
|
||||
grammar pid, eid;
|
||||
GLboolean success;
|
||||
@@ -1239,7 +1320,7 @@ _slang_preprocess_directives(slang_string *output,
|
||||
grammar_destroy (pid);
|
||||
return GL_FALSE;
|
||||
}
|
||||
success = preprocess_source (output, input, pid, eid, elog, extensions);
|
||||
success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas);
|
||||
grammar_destroy (eid);
|
||||
grammar_destroy (pid);
|
||||
return success;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.3
|
||||
*
|
||||
* Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2005-2008 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -35,6 +35,7 @@ _slang_preprocess_version (const char *, GLuint *, GLuint *, slang_info_log *);
|
||||
extern GLboolean
|
||||
_slang_preprocess_directives(slang_string *output, const char *input,
|
||||
slang_info_log *,
|
||||
const struct gl_extensions *extensions);
|
||||
const struct gl_extensions *extensions,
|
||||
struct gl_sl_pragmas *pragmas);
|
||||
|
||||
#endif /* SLANG_PREPROCESS_H */
|
||||
|
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file slang_assemble_typeinfo.c
|
||||
* \file slang_typeinfo.c
|
||||
* slang type info
|
||||
* \author Michal Krol
|
||||
*/
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="mesa"
|
||||
ProjectGUID="{2120C974-2717-4709-B44F-D6E6D0A56448}"
|
||||
RootNamespace="mesa"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
@@ -179,6 +180,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\api_arrayelt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\api_exec.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\api_loopback.c"
|
||||
>
|
||||
@@ -223,6 +228,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\buffers.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\clear.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\clip.c"
|
||||
>
|
||||
@@ -259,6 +268,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\dlist.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\dlopen.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\drawpix.c"
|
||||
>
|
||||
@@ -291,6 +304,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\feedback.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\ffvertex_prog.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\fog.c"
|
||||
>
|
||||
@@ -327,6 +344,10 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\glapi\glapi_getproc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\glapi\glthread.c"
|
||||
>
|
||||
@@ -465,6 +486,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\mm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\multisample.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\nvfragparse.c"
|
||||
>
|
||||
@@ -481,6 +506,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\pixel.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\pixelstore.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\points.c"
|
||||
>
|
||||
@@ -489,6 +518,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\polygon.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\prog_cache.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\prog_debug.c"
|
||||
>
|
||||
@@ -557,6 +590,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\rbadaptors.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\readpix.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\renderbuffer.c"
|
||||
>
|
||||
@@ -677,6 +714,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\swrast\s_zoom.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\scissor.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\shader_api.c"
|
||||
>
|
||||
@@ -857,6 +898,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\tnl\t_pipeline.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\tnl\t_rasterpos.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\tnl\t_vb_cull.c"
|
||||
>
|
||||
@@ -921,6 +966,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\texcompress_s3tc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texenv.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texenvprogram.c"
|
||||
>
|
||||
@@ -929,6 +978,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\texformat.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texgen.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\teximage.c"
|
||||
>
|
||||
@@ -937,6 +990,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\texobj.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texparam.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texrender.c"
|
||||
>
|
||||
@@ -1050,6 +1107,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\api_eval.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\api_exec.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\api_loopback.h"
|
||||
>
|
||||
@@ -1074,6 +1135,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\shader\arbprogram_syn.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\arrayobj.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\atifragshader.h"
|
||||
>
|
||||
@@ -1082,6 +1147,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\attrib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\bitset.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\blend.h"
|
||||
>
|
||||
@@ -1094,6 +1163,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\buffers.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\clear.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\clip.h"
|
||||
>
|
||||
@@ -1138,6 +1211,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\dlist.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\dlopen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\drawpix.h"
|
||||
>
|
||||
@@ -1166,6 +1243,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\feedback.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\ffvertex_prog.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\fog.h"
|
||||
>
|
||||
@@ -1314,6 +1395,18 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\matrix.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\mcompiler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\mfeatures.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\mipmap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\mm.h"
|
||||
>
|
||||
@@ -1322,6 +1415,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\mtypes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\multisample.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\nvfragparse.h"
|
||||
>
|
||||
@@ -1338,6 +1435,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\pixel.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\pixelstore.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\points.h"
|
||||
>
|
||||
@@ -1398,6 +1499,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\rbadaptors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\readpix.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\renderbuffer.h"
|
||||
>
|
||||
@@ -1518,6 +1623,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\swrast\s_zoom.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\scissor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\shader\shader_api.h"
|
||||
>
|
||||
@@ -1674,6 +1783,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\texcompress.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texenv.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texenvprogram.h"
|
||||
>
|
||||
@@ -1686,6 +1799,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\texformat_tmp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texgen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\teximage.h"
|
||||
>
|
||||
@@ -1694,6 +1811,10 @@
|
||||
RelativePath="..\..\..\..\src\mesa\main\texobj.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texparam.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\main\texrender.h"
|
||||
>
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="8,00"
|
||||
Name="glut"
|
||||
ProjectGUID="{0234F0D2-C8A6-4C4D-93E7-0E2248049C67}"
|
||||
RootNamespace="glut"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
@@ -79,6 +80,7 @@
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="../../mesa/Debug"
|
||||
IgnoreAllDefaultLibraries="true"
|
||||
ModuleDefinitionFile="..\..\..\..\src\glut\glx\glut.def"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/GLUT32.pdb"
|
||||
ImportLibrary=".\Debug/GLUT32.lib"
|
||||
@@ -175,6 +177,7 @@
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="../../mesa/Release"
|
||||
IgnoreAllDefaultLibraries="true"
|
||||
ModuleDefinitionFile="..\..\..\..\src\glut\glx\glut.def"
|
||||
ProgramDatabaseFile=".\Release/GLUT32.pdb"
|
||||
ImportLibrary=".\Release/GLUT32.lib"
|
||||
/>
|
||||
@@ -324,6 +327,10 @@
|
||||
RelativePath="..\..\..\..\src\glut\glx\glut_overlay.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glut\glx\glut_ppm.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glut\glx\glut_roman.c"
|
||||
>
|
||||
|
Reference in New Issue
Block a user