summaryrefslogtreecommitdiff
path: root/dist/Mesa/src/mesa/swrast
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-07-09 21:09:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-07-09 21:09:02 +0000
commit473dc96b5bfcd9b8163bba1931980c767d4e8a86 (patch)
tree792db8214c0e02c8c286cc22b67ad99ff928095f /dist/Mesa/src/mesa/swrast
parent90414e9e8766ee4a4f0ba93d8206de27cf984ce6 (diff)
Merge Mesa 10.2.3
tested by matthieu@ kettenis@ mpi@ brett@ and myself across a diverse range of hardware
Diffstat (limited to 'dist/Mesa/src/mesa/swrast')
-rw-r--r--dist/Mesa/src/mesa/swrast/s_blit.c16
-rw-r--r--dist/Mesa/src/mesa/swrast/s_context.c26
-rw-r--r--dist/Mesa/src/mesa/swrast/s_context.h2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_depth.c56
-rw-r--r--dist/Mesa/src/mesa/swrast/s_drawpix.c14
-rw-r--r--dist/Mesa/src/mesa/swrast/s_fragprog.c2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_stencil.c10
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texcombine.c24
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texfilter.c17
-rw-r--r--dist/Mesa/src/mesa/swrast/s_texrender.c2
-rw-r--r--dist/Mesa/src/mesa/swrast/s_triangle.c44
-rw-r--r--dist/Mesa/src/mesa/swrast/swrast.h2
12 files changed, 118 insertions, 97 deletions
diff --git a/dist/Mesa/src/mesa/swrast/s_blit.c b/dist/Mesa/src/mesa/swrast/s_blit.c
index bbb0013e6..e3b45f146 100644
--- a/dist/Mesa/src/mesa/swrast/s_blit.c
+++ b/dist/Mesa/src/mesa/swrast/s_blit.c
@@ -29,6 +29,7 @@
#include "main/macros.h"
#include "main/format_unpack.h"
#include "main/format_pack.h"
+#include "main/condrender.h"
#include "s_context.h"
@@ -166,8 +167,8 @@ blit_nearest(struct gl_context *ctx,
* using the core helpers for pack/unpack, we avoid needing to handle
* masking for things like DEPTH copies of Z24S8.
*/
- if (readRb->Format == MESA_FORMAT_Z32_FLOAT ||
- readRb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) {
+ if (readRb->Format == MESA_FORMAT_Z_FLOAT32 ||
+ readRb->Format == MESA_FORMAT_Z32_FLOAT_S8X24_UINT) {
mode = UNPACK_Z_FLOAT;
} else {
mode = UNPACK_Z_INT;
@@ -536,7 +537,7 @@ blit_linear(struct gl_context *ctx,
GLint srcBufferY0 = -1, srcBufferY1 = -1;
GLvoid *dstBuffer;
- gl_format readFormat = _mesa_get_srgb_format_linear(readRb->Format);
+ mesa_format readFormat = _mesa_get_srgb_format_linear(readRb->Format);
GLuint bpp = _mesa_get_format_bytes(readFormat);
GLenum pixelType;
@@ -571,7 +572,7 @@ blit_linear(struct gl_context *ctx,
GLint idx = drawFb->_ColorDrawBufferIndexes[i];
struct gl_renderbuffer_attachment *drawAtt;
struct gl_renderbuffer *drawRb;
- gl_format drawFormat;
+ mesa_format drawFormat;
if (idx == -1)
continue;
@@ -748,6 +749,13 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
};
GLint i;
+ /* Page 679 of OpenGL 4.4 spec says:
+ * "Added BlitFramebuffer to commands affected by conditional rendering in
+ * section 10.10 (Bug 9562)."
+ */
+ if (!_mesa_check_conditional_render(ctx))
+ return; /* Do not blit */
+
if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1,
&dstX0, &dstY0, &dstX1, &dstY1)) {
return;
diff --git a/dist/Mesa/src/mesa/swrast/s_context.c b/dist/Mesa/src/mesa/swrast/s_context.c
index 8934088df..ad11aa2c1 100644
--- a/dist/Mesa/src/mesa/swrast/s_context.c
+++ b/dist/Mesa/src/mesa/swrast/s_context.c
@@ -22,7 +22,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Keith Whitwell <keith@tungstengraphics.com> Brian Paul
+ * Keith Whitwell <keithw@vmware.com> Brian Paul
*/
#include "main/imports.h"
@@ -61,7 +61,7 @@ _swrast_update_rasterflags( struct gl_context *ctx )
if (ctx->Color.BlendEnabled) rasterMask |= BLEND_BIT;
if (ctx->Depth.Test) rasterMask |= DEPTH_BIT;
if (swrast->_FogEnabled) rasterMask |= FOG_BIT;
- if (ctx->Scissor.Enabled) rasterMask |= CLIP_BIT;
+ if (ctx->Scissor.EnableFlags) rasterMask |= CLIP_BIT;
if (ctx->Stencil._Enabled) rasterMask |= STENCIL_BIT;
for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
if (!ctx->Color.ColorMask[i][0] ||
@@ -73,11 +73,11 @@ _swrast_update_rasterflags( struct gl_context *ctx )
}
}
if (ctx->Color.ColorLogicOpEnabled) rasterMask |= LOGIC_OP_BIT;
- if (ctx->Texture._EnabledUnits) rasterMask |= TEXTURE_BIT;
- if ( ctx->Viewport.X < 0
- || ctx->Viewport.X + ctx->Viewport.Width > (GLint) ctx->DrawBuffer->Width
- || ctx->Viewport.Y < 0
- || ctx->Viewport.Y + ctx->Viewport.Height > (GLint) ctx->DrawBuffer->Height) {
+ if (ctx->Texture._MaxEnabledTexImageUnit >= 0) rasterMask |= TEXTURE_BIT;
+ if ( ctx->ViewportArray[0].X < 0
+ || ctx->ViewportArray[0].X + ctx->ViewportArray[0].Width > (GLfloat) ctx->DrawBuffer->Width
+ || ctx->ViewportArray[0].Y < 0
+ || ctx->ViewportArray[0].Y + ctx->ViewportArray[0].Height > (GLfloat) ctx->DrawBuffer->Height) {
rasterMask |= CLIP_BIT;
}
@@ -286,7 +286,7 @@ _swrast_update_specular_vertex_add(struct gl_context *ctx)
ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
swrast->SpecularVertexAdd = (separateSpecular
- && ctx->Texture._EnabledUnits == 0x0
+ && ctx->Texture._MaxEnabledTexImageUnit == -1
&& !_swrast_use_fragment_program(ctx)
&& !ctx->ATIFragmentShader._Enabled);
}
@@ -523,7 +523,7 @@ _swrast_update_active_attribs(struct gl_context *ctx)
if (swrast->_FogEnabled)
attribsMask |= VARYING_BIT_FOGC;
- attribsMask |= (ctx->Texture._EnabledUnits << VARYING_SLOT_TEX0);
+ attribsMask |= (ctx->Texture._EnabledCoordUnits << VARYING_SLOT_TEX0);
}
swrast->_ActiveAttribMask = attribsMask;
@@ -794,9 +794,9 @@ _swrast_CreateContext( struct gl_context *ctx )
swrast->PointSpan.facing = 0;
swrast->PointSpan.array = swrast->SpanArrays;
- init_program_native_limits(&ctx->Const.VertexProgram);
- init_program_native_limits(&ctx->Const.GeometryProgram);
- init_program_native_limits(&ctx->Const.FragmentProgram);
+ init_program_native_limits(&ctx->Const.Program[MESA_SHADER_VERTEX]);
+ init_program_native_limits(&ctx->Const.Program[MESA_SHADER_GEOMETRY]);
+ init_program_native_limits(&ctx->Const.Program[MESA_SHADER_FRAGMENT]);
ctx->swrast_context = swrast;
@@ -923,7 +923,7 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
v->attrib[VARYING_SLOT_POS][3]);
for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
- if (ctx->Texture.Unit[i]._ReallyEnabled)
+ if (ctx->Texture.Unit[i]._Current)
_mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i,
v->attrib[VARYING_SLOT_TEX0 + i][0],
v->attrib[VARYING_SLOT_TEX0 + i][1],
diff --git a/dist/Mesa/src/mesa/swrast/s_context.h b/dist/Mesa/src/mesa/swrast/s_context.h
index eec711f51..d6fbc5d54 100644
--- a/dist/Mesa/src/mesa/swrast/s_context.h
+++ b/dist/Mesa/src/mesa/swrast/s_context.h
@@ -26,7 +26,7 @@
/**
* \file swrast/s_context.h
* \brief Software rasterization context and private types.
- * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Keith Whitwell <keithw@vmware.com>
*/
/**
diff --git a/dist/Mesa/src/mesa/swrast/s_depth.c b/dist/Mesa/src/mesa/swrast/s_depth.c
index 0f4fb9506..134f897c0 100644
--- a/dist/Mesa/src/mesa/swrast/s_depth.c
+++ b/dist/Mesa/src/mesa/swrast/s_depth.c
@@ -171,12 +171,12 @@ _swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span )
GLfloat min_f, max_f;
GLuint i;
- if (ctx->Viewport.Near < ctx->Viewport.Far) {
- min_f = ctx->Viewport.Near;
- max_f = ctx->Viewport.Far;
+ if (ctx->ViewportArray[0].Near < ctx->ViewportArray[0].Far) {
+ min_f = ctx->ViewportArray[0].Near;
+ max_f = ctx->ViewportArray[0].Far;
} else {
- min_f = ctx->Viewport.Far;
- max_f = ctx->Viewport.Near;
+ min_f = ctx->ViewportArray[0].Far;
+ max_f = ctx->ViewportArray[0].Near;
}
/* Convert floating point values in [0,1] to device Z coordinates in
@@ -217,7 +217,7 @@ get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
const GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
- if (rb->Format == MESA_FORMAT_Z32) {
+ if (rb->Format == MESA_FORMAT_Z_UNORM32) {
const GLint rowStride = srb->RowStride;
for (i = 0; i < count; i++) {
if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
@@ -252,7 +252,7 @@ put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
- if (rb->Format == MESA_FORMAT_Z32) {
+ if (rb->Format == MESA_FORMAT_Z_UNORM32) {
const GLint rowStride = srb->RowStride;
for (i = 0; i < count; i++) {
if (mask[i] && x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
@@ -300,12 +300,12 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span)
else
zStart = _swrast_pixel_address(rb, span->x, span->y);
- if (rb->Format == MESA_FORMAT_Z16 && !(span->arrayMask & SPAN_XY)) {
+ if (rb->Format == MESA_FORMAT_Z_UNORM16 && !(span->arrayMask & SPAN_XY)) {
/* directly read/write row of 16-bit Z values */
zBufferVals = zStart;
ztest16 = GL_TRUE;
}
- else if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) {
+ else if (rb->Format == MESA_FORMAT_Z_UNORM32 && !(span->arrayMask & SPAN_XY)) {
/* directly read/write row of 32-bit Z values */
zBufferVals = zStart;
}
@@ -439,7 +439,7 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span )
else
zStart = _swrast_pixel_address(rb, span->x, span->y);
- if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) {
+ if (rb->Format == MESA_FORMAT_Z_UNORM32 && !(span->arrayMask & SPAN_XY)) {
/* directly access 32-bit values in the depth buffer */
zBufferVals = (const GLuint *) zStart;
}
@@ -552,10 +552,10 @@ _swrast_clear_depth_buffer(struct gl_context *ctx)
height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin;
mapMode = GL_MAP_WRITE_BIT;
- if (rb->Format == MESA_FORMAT_S8_Z24 ||
- rb->Format == MESA_FORMAT_X8_Z24 ||
- rb->Format == MESA_FORMAT_Z24_S8 ||
- rb->Format == MESA_FORMAT_Z24_X8) {
+ if (rb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT ||
+ rb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT ||
+ rb->Format == MESA_FORMAT_S8_UINT_Z24_UNORM ||
+ rb->Format == MESA_FORMAT_X8_UINT_Z24_UNORM) {
mapMode |= GL_MAP_READ_BIT;
}
@@ -567,7 +567,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx)
}
switch (rb->Format) {
- case MESA_FORMAT_Z16:
+ case MESA_FORMAT_Z_UNORM16:
{
GLfloat clear = (GLfloat) ctx->Depth.Clear;
GLushort clearVal = 0;
@@ -587,8 +587,8 @@ _swrast_clear_depth_buffer(struct gl_context *ctx)
}
}
break;
- case MESA_FORMAT_Z32:
- case MESA_FORMAT_Z32_FLOAT:
+ case MESA_FORMAT_Z_UNORM32:
+ case MESA_FORMAT_Z_FLOAT32:
{
GLfloat clear = (GLfloat) ctx->Depth.Clear;
GLuint clearVal = 0;
@@ -602,17 +602,17 @@ _swrast_clear_depth_buffer(struct gl_context *ctx)
}
}
break;
- case MESA_FORMAT_S8_Z24:
- case MESA_FORMAT_X8_Z24:
- case MESA_FORMAT_Z24_S8:
- case MESA_FORMAT_Z24_X8:
+ case MESA_FORMAT_Z24_UNORM_S8_UINT:
+ case MESA_FORMAT_Z24_UNORM_X8_UINT:
+ case MESA_FORMAT_S8_UINT_Z24_UNORM:
+ case MESA_FORMAT_X8_UINT_Z24_UNORM:
{
GLfloat clear = (GLfloat) ctx->Depth.Clear;
GLuint clearVal = 0;
GLuint mask;
- if (rb->Format == MESA_FORMAT_S8_Z24 ||
- rb->Format == MESA_FORMAT_X8_Z24)
+ if (rb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT ||
+ rb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT)
mask = 0xff000000;
else
mask = 0xff;
@@ -628,7 +628,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx)
}
break;
- case MESA_FORMAT_Z32_FLOAT_X24S8:
+ case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
/* XXX untested */
{
GLfloat clearVal = (GLfloat) ctx->Depth.Clear;
@@ -692,15 +692,15 @@ _swrast_clear_depth_stencil_buffer(struct gl_context *ctx)
}
switch (rb->Format) {
- case MESA_FORMAT_S8_Z24:
- case MESA_FORMAT_Z24_S8:
+ case MESA_FORMAT_Z24_UNORM_S8_UINT:
+ case MESA_FORMAT_S8_UINT_Z24_UNORM:
{
GLfloat zClear = (GLfloat) ctx->Depth.Clear;
GLuint clear = 0, mask;
_mesa_pack_float_z_row(rb->Format, 1, &zClear, &clear);
- if (rb->Format == MESA_FORMAT_S8_Z24) {
+ if (rb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT) {
mask = ((~writeMask) & 0xff) << 24;
clear |= (ctx->Stencil.Clear & writeMask & 0xff) << 24;
}
@@ -725,7 +725,7 @@ _swrast_clear_depth_stencil_buffer(struct gl_context *ctx)
}
}
break;
- case MESA_FORMAT_Z32_FLOAT_X24S8:
+ case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
/* XXX untested */
{
const GLfloat zClear = (GLfloat) ctx->Depth.Clear;
diff --git a/dist/Mesa/src/mesa/swrast/s_drawpix.c b/dist/Mesa/src/mesa/swrast/s_drawpix.c
index 1786de1a3..f7926e426 100644
--- a/dist/Mesa/src/mesa/swrast/s_drawpix.c
+++ b/dist/Mesa/src/mesa/swrast/s_drawpix.c
@@ -223,8 +223,8 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y,
if (format == GL_RGB &&
type == GL_UNSIGNED_BYTE &&
- (rb->Format == MESA_FORMAT_XRGB8888 ||
- rb->Format == MESA_FORMAT_ARGB8888)) {
+ (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM ||
+ rb->Format == MESA_FORMAT_B8G8R8A8_UNORM)) {
fast_draw_rgb_ubyte_pixels(ctx, rb, x, y, width, height,
&unpack, pixels);
return GL_TRUE;
@@ -232,8 +232,8 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y,
if (format == GL_RGBA &&
type == GL_UNSIGNED_BYTE &&
- (rb->Format == MESA_FORMAT_XRGB8888 ||
- rb->Format == MESA_FORMAT_ARGB8888)) {
+ (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM ||
+ rb->Format == MESA_FORMAT_B8G8R8A8_UNORM)) {
fast_draw_rgba_ubyte_pixels(ctx, rb, x, y, width, height,
&unpack, pixels);
return GL_TRUE;
@@ -500,7 +500,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
/**
- * Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_S8_Z24
+ * Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_Z24_UNORM_S8_UINT
* renderbuffer. No masking, zooming, scaling, etc.
*/
static void
@@ -572,8 +572,8 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
ASSERT(stencilRb);
if (depthRb == stencilRb &&
- (depthRb->Format == MESA_FORMAT_Z24_S8 ||
- depthRb->Format == MESA_FORMAT_S8_Z24) &&
+ (depthRb->Format == MESA_FORMAT_S8_UINT_Z24_UNORM ||
+ depthRb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT) &&
type == GL_UNSIGNED_INT_24_8 &&
!scaleOrBias &&
!zoom &&
diff --git a/dist/Mesa/src/mesa/swrast/s_fragprog.c b/dist/Mesa/src/mesa/swrast/s_fragprog.c
index 4e9ac394e..21699f3ea 100644
--- a/dist/Mesa/src/mesa/swrast/s_fragprog.c
+++ b/dist/Mesa/src/mesa/swrast/s_fragprog.c
@@ -182,7 +182,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
machine->Samplers = program->Base.SamplerUnits;
/* if running a GLSL program (not ARB_fragment_program) */
- if (ctx->Shader.CurrentFragmentProgram) {
+ if (ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT]) {
/* Store front/back facing value */
machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing;
}
diff --git a/dist/Mesa/src/mesa/swrast/s_stencil.c b/dist/Mesa/src/mesa/swrast/s_stencil.c
index 3eeeb24b2..eba9da863 100644
--- a/dist/Mesa/src/mesa/swrast/s_stencil.c
+++ b/dist/Mesa/src/mesa/swrast/s_stencil.c
@@ -61,7 +61,7 @@ ENDIF
* within the 4-byte pixel will be either 0 or 3.
*/
static GLint
-get_stencil_offset(gl_format format)
+get_stencil_offset(mesa_format format)
{
const GLubyte one = 1;
GLubyte pixel[MAX_PIXEL_BYTES];
@@ -300,7 +300,7 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
const GLubyte *map = _swrast_pixel_address(rb, 0, 0);
GLuint i;
- if (rb->Format == MESA_FORMAT_S8) {
+ if (rb->Format == MESA_FORMAT_S_UINT8) {
const GLint rowStride = srb->RowStride;
for (i = 0; i < count; i++) {
if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
@@ -587,7 +587,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx)
}
switch (rb->Format) {
- case MESA_FORMAT_S8:
+ case MESA_FORMAT_S_UINT8:
{
GLubyte clear = ctx->Stencil.Clear & writeMask & 0xff;
GLubyte mask = (~writeMask) & 0xff;
@@ -614,7 +614,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx)
}
}
break;
- case MESA_FORMAT_S8_Z24:
+ case MESA_FORMAT_Z24_UNORM_S8_UINT:
{
GLuint clear = (ctx->Stencil.Clear & writeMask & 0xff) << 24;
GLuint mask = (((~writeMask) & 0xff) << 24) | 0xffffff;
@@ -627,7 +627,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx)
}
}
break;
- case MESA_FORMAT_Z24_S8:
+ case MESA_FORMAT_S8_UINT_Z24_UNORM:
{
GLuint clear = ctx->Stencil.Clear & writeMask & 0xff;
GLuint mask = 0xffffff00 | ((~writeMask) & 0xff);
diff --git a/dist/Mesa/src/mesa/swrast/s_texcombine.c b/dist/Mesa/src/mesa/swrast/s_texcombine.c
index 7e07f4f8a..c1a152aa8 100644
--- a/dist/Mesa/src/mesa/swrast/s_texcombine.c
+++ b/dist/Mesa/src/mesa/swrast/s_texcombine.c
@@ -189,7 +189,7 @@ texture_combine( struct gl_context *ctx, GLuint unit,
{
const GLuint srcUnit = srcRGB - GL_TEXTURE0;
ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
- if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
+ if (!ctx->Texture.Unit[srcUnit]._Current)
goto end;
argRGB[term] = get_texel_array(swrast, srcUnit);
}
@@ -279,7 +279,7 @@ texture_combine( struct gl_context *ctx, GLuint unit,
{
const GLuint srcUnit = srcA - GL_TEXTURE0;
ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
- if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
+ if (!ctx->Texture.Unit[srcUnit]._Current)
goto end;
argA[term] = get_texel_array(swrast, srcUnit);
}
@@ -602,6 +602,14 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
if (!swrast->TexelBuffer) {
#ifdef _OPENMP
const GLint maxThreads = omp_get_max_threads();
+
+ /* TexelBuffer memory allocation needs to be done in a critical section
+ * as this code runs in a parallel loop.
+ * When entering the section, first check if TexelBuffer has been
+ * initialized already by another thread while this thread was waiting.
+ */
+ #pragma omp critical
+ if (!swrast->TexelBuffer) {
#else
const GLint maxThreads = 1;
#endif
@@ -611,8 +619,12 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
* thread.
*/
swrast->TexelBuffer =
- malloc(ctx->Const.FragmentProgram.MaxTextureImageUnits * maxThreads *
+ malloc(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits * maxThreads *
SWRAST_MAX_WIDTH * 4 * sizeof(GLfloat));
+#ifdef _OPENMP
+ } /* critical section */
+#endif
+
if (!swrast->TexelBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture_combine");
return;
@@ -645,7 +657,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if (texUnit->_ReallyEnabled &&
+ if (texUnit->_Current &&
texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) {
const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
span->array->attribs[VARYING_SLOT_TEX0 + unit];
@@ -711,7 +723,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if (texUnit->_ReallyEnabled &&
+ if (texUnit->_Current &&
texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) {
const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
span->array->attribs[VARYING_SLOT_TEX0 + unit];
@@ -775,7 +787,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
* We modify the span->color.rgba values.
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
- if (ctx->Texture.Unit[unit]._ReallyEnabled)
+ if (ctx->Texture.Unit[unit]._Current)
texture_combine(ctx, unit, primary_rgba, swrast->TexelBuffer, span);
}
diff --git a/dist/Mesa/src/mesa/swrast/s_texfilter.c b/dist/Mesa/src/mesa/swrast/s_texfilter.c
index 0920a640c..c3fd900b4 100644
--- a/dist/Mesa/src/mesa/swrast/s_texfilter.c
+++ b/dist/Mesa/src/mesa/swrast/s_texfilter.c
@@ -274,6 +274,7 @@ linear_texel_locations(GLenum wrapMode,
break;
default:
_mesa_problem(NULL, "Bad wrap mode");
+ *i0 = *i1 = 0;
u = 0.0F;
break;
}
@@ -1427,7 +1428,7 @@ opt_sample_rgb_2d(struct gl_context *ctx,
ASSERT(samp->WrapS==GL_REPEAT);
ASSERT(samp->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_RGB888);
+ ASSERT(img->TexFormat == MESA_FORMAT_BGR_UNORM8);
ASSERT(swImg->_IsPowerOfTwo);
(void) swImg;
@@ -1472,7 +1473,7 @@ opt_sample_rgba_2d(struct gl_context *ctx,
ASSERT(samp->WrapS==GL_REPEAT);
ASSERT(samp->WrapT==GL_REPEAT);
ASSERT(img->Border==0);
- ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888);
+ ASSERT(img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM);
ASSERT(swImg->_IsPowerOfTwo);
(void) swImg;
@@ -1520,11 +1521,11 @@ sample_lambda_2d(struct gl_context *ctx,
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
- case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR_UNORM8:
opt_sample_rgb_2d(ctx, samp, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
- case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_A8B8G8R8_UNORM:
opt_sample_rgba_2d(ctx, samp, tObj, m, texcoords + minStart,
NULL, rgba + minStart);
break;
@@ -1577,11 +1578,11 @@ sample_lambda_2d(struct gl_context *ctx,
case GL_NEAREST:
if (repeatNoBorderPOT) {
switch (tImg->TexFormat) {
- case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR_UNORM8:
opt_sample_rgb_2d(ctx, samp, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
- case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_A8B8G8R8_UNORM:
opt_sample_rgba_2d(ctx, samp, tObj, m, texcoords + magStart,
NULL, rgba + magStart);
break;
@@ -3759,9 +3760,9 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
sampler->WrapT == GL_REPEAT &&
swImg->_IsPowerOfTwo &&
img->Border == 0) {
- if (img->TexFormat == MESA_FORMAT_RGB888)
+ if (img->TexFormat == MESA_FORMAT_BGR_UNORM8)
func = &opt_sample_rgb_2d;
- else if (img->TexFormat == MESA_FORMAT_RGBA8888)
+ else if (img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM)
func = &opt_sample_rgba_2d;
}
diff --git a/dist/Mesa/src/mesa/swrast/s_texrender.c b/dist/Mesa/src/mesa/swrast/s_texrender.c
index 751d7767b..d67e48ad3 100644
--- a/dist/Mesa/src/mesa/swrast/s_texrender.c
+++ b/dist/Mesa/src/mesa/swrast/s_texrender.c
@@ -33,7 +33,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
struct gl_renderbuffer *rb = att->Renderbuffer;
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
struct swrast_texture_image *swImage;
- gl_format format;
+ mesa_format format;
GLuint zOffset;
(void) ctx;
diff --git a/dist/Mesa/src/mesa/swrast/s_triangle.c b/dist/Mesa/src/mesa/swrast/s_triangle.c
index 085021b58..164906643 100644
--- a/dist/Mesa/src/mesa/swrast/s_triangle.c
+++ b/dist/Mesa/src/mesa/swrast/s_triangle.c
@@ -136,7 +136,7 @@ _swrast_culltriangle( struct gl_context *ctx,
const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \
const GLint smask = texImg->Width - 1; \
const GLint tmask = texImg->Height - 1; \
- ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \
+ ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \
if (!rb || !texture) { \
return; \
}
@@ -194,7 +194,7 @@ _swrast_culltriangle( struct gl_context *ctx,
const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \
const GLint smask = texImg->Width - 1; \
const GLint tmask = texImg->Height - 1; \
- ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \
+ ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \
if (!rb || !texture) { \
return; \
}
@@ -417,7 +417,7 @@ affine_span(struct gl_context *ctx, SWspan *span,
switch (info->filter) {
case GL_NEAREST:
switch (info->format) {
- case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR_UNORM8:
switch (info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGB;MODULATE,3);
@@ -437,7 +437,7 @@ affine_span(struct gl_context *ctx, SWspan *span,
return;
}
break;
- case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_A8B8G8R8_UNORM:
switch(info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGBA;MODULATE,4);
@@ -466,7 +466,7 @@ affine_span(struct gl_context *ctx, SWspan *span,
span->intTex[0] -= FIXED_HALF;
span->intTex[1] -= FIXED_HALF;
switch (info->format) {
- case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR_UNORM8:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGB;MODULATE,3);
@@ -486,7 +486,7 @@ affine_span(struct gl_context *ctx, SWspan *span,
return;
}
break;
- case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_A8B8G8R8_UNORM:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGBA;MODULATE,4);
@@ -572,10 +572,10 @@ affine_span(struct gl_context *ctx, SWspan *span,
} \
\
switch (info.format) { \
- case MESA_FORMAT_RGB888: \
+ case MESA_FORMAT_BGR_UNORM8: \
info.tbytesline = texImg->Width * 3; \
break; \
- case MESA_FORMAT_RGBA8888: \
+ case MESA_FORMAT_A8B8G8R8_UNORM: \
info.tbytesline = texImg->Width * 4; \
break; \
default: \
@@ -689,7 +689,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
switch (info->filter) {
case GL_NEAREST:
switch (info->format) {
- case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR_UNORM8:
switch (info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGB;MODULATE,3);
@@ -709,7 +709,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
return;
}
break;
- case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_A8B8G8R8_UNORM:
switch(info->envmode) {
case GL_MODULATE:
SPAN_NEAREST(NEAREST_RGBA;MODULATE,4);
@@ -736,7 +736,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
case GL_LINEAR:
switch (info->format) {
- case MESA_FORMAT_RGB888:
+ case MESA_FORMAT_BGR_UNORM8:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGB;MODULATE,3);
@@ -756,7 +756,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
return;
}
break;
- case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_A8B8G8R8_UNORM:
switch (info->envmode) {
case GL_MODULATE:
SPAN_LINEAR(LINEAR_RGBA;MODULATE,4);
@@ -838,10 +838,10 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
} \
\
switch (info.format) { \
- case MESA_FORMAT_RGB888: \
+ case MESA_FORMAT_BGR_UNORM8: \
info.tbytesline = texImg->Width * 3; \
break; \
- case MESA_FORMAT_RGBA8888: \
+ case MESA_FORMAT_A8B8G8R8_UNORM: \
info.tbytesline = texImg->Width * 4; \
break; \
default: \
@@ -887,7 +887,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span,
ASSERT(ctx->Depth.Test); \
ASSERT(!ctx->Depth.Mask); \
ASSERT(ctx->Depth.Func == GL_LESS); \
- assert(rb->Format == MESA_FORMAT_Z16); \
+ assert(rb->Format == MESA_FORMAT_Z_UNORM16); \
if (!q) { \
return; \
}
@@ -1025,7 +1025,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
ctx->Depth.Func == GL_LESS &&
!ctx->Stencil._Enabled &&
depthRb &&
- depthRb->Format == MESA_FORMAT_Z16) {
+ depthRb->Format == MESA_FORMAT_Z_UNORM16) {
if (ctx->Color.ColorMask[0][0] == 0 &&
ctx->Color.ColorMask[0][1] == 0 &&
ctx->Color.ColorMask[0][2] == 0 &&
@@ -1050,7 +1050,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
const struct gl_texture_image *texImg;
const struct swrast_texture_image *swImg;
GLenum minFilter, magFilter, envMode;
- gl_format format;
+ mesa_format format;
texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX];
if (ctx->Texture.Unit[0].Sampler)
samp = ctx->Texture.Unit[0].Sampler;
@@ -1071,8 +1071,8 @@ _swrast_choose_triangle( struct gl_context *ctx )
if (ctx->Texture._EnabledCoordUnits == 0x1
&& !_swrast_use_fragment_program(ctx)
&& !ctx->ATIFragmentShader._Enabled
- && ctx->Texture._EnabledUnits == 0x1
- && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
+ && ctx->Texture._MaxEnabledTexImageUnit == 0
+ && ctx->Texture.Unit[0]._Current->Target == GL_TEXTURE_2D
&& samp->WrapS == GL_REPEAT
&& samp->WrapT == GL_REPEAT
&& texObj2D->_Swizzle == SWIZZLE_NOOP
@@ -1080,7 +1080,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
&& texImg->Border == 0
&& (_mesa_format_row_stride(format, texImg->Width) ==
swImg->RowStride)
- && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888)
+ && (format == MESA_FORMAT_BGR_UNORM8 || format == MESA_FORMAT_A8B8G8R8_UNORM)
&& minFilter == magFilter
&& ctx->Light.Model.ColorControl == GL_SINGLE_COLOR
&& !swrast->_FogEnabled
@@ -1088,7 +1088,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
&& ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) {
if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) {
if (minFilter == GL_NEAREST
- && format == MESA_FORMAT_RGB888
+ && format == MESA_FORMAT_BGR_UNORM8
&& (envMode == GL_REPLACE || envMode == GL_DECAL)
&& ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT)
&& ctx->Depth.Func == GL_LESS
@@ -1107,7 +1107,7 @@ _swrast_choose_triangle( struct gl_context *ctx )
#if CHAN_BITS != 8
USE(general_triangle);
#else
- if (format == MESA_FORMAT_RGBA8888 && !_mesa_little_endian()) {
+ if (format == MESA_FORMAT_A8B8G8R8_UNORM && !_mesa_little_endian()) {
/* We only handle RGBA8888 correctly on little endian
* in the optimized code above.
*/
diff --git a/dist/Mesa/src/mesa/swrast/swrast.h b/dist/Mesa/src/mesa/swrast/swrast.h
index 3a3e451b6..ac3dbe304 100644
--- a/dist/Mesa/src/mesa/swrast/swrast.h
+++ b/dist/Mesa/src/mesa/swrast/swrast.h
@@ -26,7 +26,7 @@
/**
* \file swrast/swrast.h
* \brief Public interface to the software rasterization functions.
- * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Keith Whitwell <keithw@vmware.com>
*/
#ifndef SWRAST_H