Commit Graph

42781 Commits

Author SHA1 Message Date
Kenneth Graunke c87cb98bb4 glsl: Fix crashes caused by Bison error messages involving "'%'".
Invalid shaders containing the character % at an unexpected location
would cause Bison to call yyerror with a message of:

    syntax error, unexpected '%'

Bison expects yyerror() to take a string, while _mesa_glsl_error() is a
printf-style function.  This hit the classic printf string escape issue:

    _mesa_glsl_error(loc, state, "unexpected '%'");       // invalid!
    _mesa_glsl_error(loc, state, "%s", "unexpected '%'"); // correct.

This caused assertion failures after ralloc_asprintf_append called
vsnprintf to determine the length of the text that would be printed:
vsnprintf would see the invalid format and return -1, an invalid length.

The solution is to define a proper yyerror() wrapper function that calls
_mesa_glsl_error with the "%s".  Since we compile with -p "_mesa_glsl",
yyerror is defined as:

    #define yyerror         _mesa_glsl_error

So we have to #undef yyerror in order to be able to declare it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43564
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-12-13 22:54:16 -08:00
Ian Romanick 7e9cb2ac6d Regenerate files from previous commits
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick 0c6b930322 glapi/glx: For GLX code, use the existing _X_HIDDEN and _X_INTERNAL defines
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick bc35da409b glapi/glx: Generate glapi_gentable.c so that the xserver can use it
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick af50f3bf44 glapi/glx: Generate dispatch.h so that the xserver can use it
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick 2e16875873 glapi/glx: Xserver wants dispatch.h, not glapidispatch.h
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick c0d2f4c123 glapi/glx: Don't send GL API files to the xserver
The versions in the xserver and in libGL have diverged enough that the
xserver doesn't want these.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick e089a0e2ee glapi: Remove mention of nonexistent enums
glext.h doesn't have GL_MIN_PROGRAM_TEXEL_OFFSET_EXT or
GL_MAX_PROGRAM_TEXEL_OFFSET_EXT.  Using them in the XML causes code to
be generated for the xserver that won't compile.  Use the names that
exist instead.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Ian Romanick 090dd9428d glapi/glx: Remove g_disptab.h from xserver generated files
That file was removed from the xserver with commit:

    commit a80780a7638f847c3be20e5e0c7fe85e83d9bdd1
    Author: Adam Jackson <ajax@redhat.com>
    Date:   Wed Nov 17 09:03:06 2010 -0500

        glx: Remove swap barrier and hyperpipe support

        Never implemented in any open source driver.  The implementation
        assumed explicit DDX driver knowledge of how the client-side driver
        worked, since at the time the server's GL renderer was not a DRI driver.
        But now, it is, so any implementation of these should be done with
        additional DRI driver API, like the swap control extension.

        Reviewed-by: Julien Cristau <jcristau@debian.org>
        Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
        Signed-off-by: Adam Jackson <ajax@redhat.com>

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2011-12-13 16:07:17 -08:00
Marek Olšák 35d2764f85 r300g: take advantage of KEEP_TILING_FLAGS flush flag
This fixes at least two multi-context-related races.
2011-12-13 21:34:18 +01:00
Marcin Slusarz 10e931219f nouveau: get rid of winsys object
Its only purpose was to destroy itself.
2011-12-13 21:06:29 +01:00
Stéphane Marchesin 642d11da20 i915g: Roll back to the previous shader limits.
Those shader limits seem to be responsible for a piglit hang.
2011-12-13 11:26:49 -08:00
Stéphane Marchesin f41fd6b6c3 i915g: Update TODO. 2011-12-13 11:26:49 -08:00
Marek Olšák 41b75dc92c winsys/radeon: add flush option not to rewrite tiling flags in registers
Not used yet.
2011-12-13 18:41:17 +01:00
Marek Olšák df809ae923 mesa: add const flags to skip MaxVarying and MaxUniform linker checks (v2)
This is only temporary until a better solution is available.

v2: print warnings and add gallium CAPs

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-13 17:49:00 +01:00
Marek Olšák 8a11d40c4e mesa: fix an out-of-bounds access in prog_print.c
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-13 17:49:00 +01:00
Bryan Cain 3b15f5046c glsl_to_tgsi: fix typo in comment 2011-12-13 10:39:52 -06:00
Bryan Cain d24b44c37d glsl_to_tgsi: emit both operands of shift and bitwise operations
Fixes these operations when native integers are enabled.
2011-12-13 10:39:52 -06:00
Benjamin Franzke 2a58453e25 egl_dri2: Fix some valgrind reported leaks
Free the device_name, reported by Pekka Paalanen.

Destroy wayland display and drm resources,
if created by dri2_initialize_wayland.
2011-12-13 15:32:43 +01:00
Brian Paul cbd65fe149 mesa: update comments for _DepthBuffer, _StencilBuffer fields
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:38 -07:00
Brian Paul 6596aeb4ff mesa: remove _DepthBuffer, _StencilBuffer resize code
This is handled in swrast now when we validate the framebuffer state.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:38 -07:00
Brian Paul d7c0fac90b swrast: add debug code to test combined depth/stencil buffers
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul 8ba9c22cdb mesa: remove unused depthstencil.[ch] files
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul 6e1228976b mesa: move depth/stencil buffer validation to swrast
Since gl_framebuffer::_DepthBuffer and _StencilBuffer are only used
by swrast, do the validation of those fields in swrast too.
The main/depthstencil.[ch] code is no longer used and will be removed
next.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul 2ac02ea29f swrast: update depth/stencil wrapper sizes
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul 23527eb357 mesa: build swrast/s_depthstencil.c
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul ba35094068 swrast: add new s_depthstencil.[ch] files
These files are copies of main/depthstencil.[ch] with s/mesa/swrast/.
The main/depthstencil.[ch] will go away soon.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul c0a55cf68a mesa: move update_depth/stencil_buffer() functions
These functions update the gl_framebuffer::_DepthBuffer and _StencilBuffer
fields, possibly creating renderbuffer wrappers that make a shared
depth+stencil accessible as depth-only or stencil only.
This stuff is only used by swrast now and will be moved there next.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:37 -07:00
Brian Paul 2750809b2e radeon: stop using _DepthBuffer, _StencilBuffer fields
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:36 -07:00
Brian Paul a782db5570 nouveau: stop using _DepthBuffer, _StencilBuffer fields
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:36 -07:00
Brian Paul d124092864 mesa: stop using _Depth, _StencilBuffer fields in _mesa_BlitFramebufferEXT()
We're just looking at the depth/stencil renderbuffers to do error
checking.  We don't need to look at the depth/stencil wrappers to do
that.  Also, remove pointless readRb = depthRb = NULL assignments.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:36 -07:00
Brian Paul 02d12719e3 st/mesa: stop using _DepthBuffer, _StencilBuffer fields
We never want to use the depth/stencil buffer wrappers so always just
use the attachment renderbuffers.  This is a step toward removing the
_DepthBuffer, _StencilBuffer fields.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-13 06:45:36 -07:00
Brian Paul 22e806f570 swrast: add missing state validation calls for Blit, Clear 2011-12-13 06:45:36 -07:00
Marek Olšák fc52534f01 mesa: fix possible precision issues in pack/unpack/fetch functions
GLfloat doesn't have enough precision to exactly represent 0xffffff
and 0xffffffff. (and a reciprocal of those, if I am not mistaken)

If -ffast-math is enabled, using GLfloat causes assertion failures in:
- fbo-blit-d24s8
- fbo-depth-sample-compare
- fbo-readpixels-depth-formats
- glean/depthStencil

For example:
fbo-depth-sample-compare: main/format_unpack.c:1769:
unpack_float_z_Z24_X8: Assertion `dst[i] <= 1.0F' failed.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-12 08:04:51 +01:00
Marek Olšák 4298c88f65 r300g: integer and fixed-point 16.16 textures are not supported 2011-12-12 08:04:51 +01:00
Marek Olšák 1ded658ce0 st/mesa: add color varyings to MaxVarying
The linker now adds color varyings to the number of used varyings and checks
against that limit.

NOTE: This is a candidate for the 7.11 branch.
2011-12-12 08:04:51 +01:00
Michael Karcher 592323de1e i915g: fix debug dump on 64 bit systems 2011-12-11 13:24:10 -08:00
Fatih Aşıcı 13632e64a0 i915g: Fix wrong indices for LINE_LOOP case 2011-12-11 13:23:42 -08:00
Maarten Lankhorst 45bb4b79f6 vl: Add missing mpeg fields to pipe_mpeg12_picture_desc
Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
2011-12-11 01:06:15 -05:00
Tobias Droste e809f4e54c g3dvl/xlib: fix build by changing include order
fixes the following build error since
c83fb4d45f2a47042f395271efe6e5489b2c4aee:

/usr/include/strings.h:46:13: error: expected declaration specifiers or
‘...’ before numeric constant
/usr/include/strings.h:46:13: error: conflicting types for ‘memset’
In file included from
../../../../src/gallium/winsys/g3dvl/xlib/xsp_winsys.c:34:0:
../../../../src/gallium/auxiliary/util/u_inlines.h: In function
‘pipe_buffer_create’:
../../../../src/gallium/auxiliary/util/u_inlines.h:189:4: error: too
many arguments to function ‘memset’
/usr/include/strings.h:46:13: note: declared here

bzero is defined in X11 as: #define bzero(b,len) memset(b,0,len)
including strings.h after the X11 header results in preprocessor
replacing 'bzero' in strings.h and generating unbuildable code.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
2011-12-11 01:03:20 -05:00
Dave Airlie 72cb103cf5 st/mesa: move frag depth up a level.
This fixes the segfault, and seems to put this closer to where other
properties are being set. Hopefully it still conforms.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-10 17:30:37 +00:00
Dave Airlie b1a8b7b019 Revert "st/mesa: only resolve is number of samples is > 1"
This reverts commit 8c713626db.

Didn't mean to push this at all
2011-12-10 09:04:51 +00:00
Dave Airlie 8c713626db st/mesa: only resolve is number of samples is > 1
This fixes the firefox crash but I've no idea if its correct.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-10 09:02:38 +00:00
Dave Airlie f767e96131 mesa: add missing RG_INTEGER and some RED_INTEGER_EXT checks.
This just adds the correct checks and asserts in the right places. This doesn't
fix all the tests that I've sent to piglit, need to add int paths to go alongside the uint paths that don't go via float to fix it up properly.

I'm not sure how much of that could be templated/shared will have a look
once I write it the long way.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-10 09:02:17 +00:00
Marek Olšák 06f217d80f gallium: implement ARB_conservative_depth
This adds a new TGSI property to represent the GLSL layout qualifier in TGSI.
2011-12-10 01:27:11 +01:00
José Fonseca c83fb4d45f util: Add strings.h include on unices
Fixes -Wimplicit-function-declaration for ffs with GCC.  Spotted/tested
by Kai Wasserbäch.
2011-12-09 20:17:34 +00:00
José Fonseca f188c0d0f4 mesa/st: Don't modify the context draw/read buffers.
It sets the wrong values (GL_XXX_LEFT instead of GL_XXX), and no other
Mesa driver does this, given that Mesa sets the right draw/read buffers
provided the Mesa visual has the doublebuffer flag filled correctly
which is the case.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-09 18:34:40 +00:00
nobled eefff37060 mesa,intel: use _mesa_image_offset() for PBOs
This avoids forming invalid pointers needlessly, which even if
never dereferenced is undefined behavior. It also makes
_mesa_validate_pbo_access() more comprehensible.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-08 21:23:59 +00:00
nobled 4a2b9b5305 mesa: add _mesa_image_offset()
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-08 21:20:25 +00:00
nobled f22421e9b9 mesa/image: assert on bad format
NULL as an error indicator is meaningless, since it will return NULL
on success anyway if the caller passes in zero as the image's address
and asks to calculate the offset of the first pixel. For example,
_mesa_validate_pbo_access() does this.

This also matches the code in the non-GL_BITMAP codepath, which
already has an assert like this.

v2: Per Brian Paul's review, remove the function call entirely
and tighten the assert to only accept the two formats compatible with
GL_BITMAP. They always have one component per pixel.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-08 21:20:25 +00:00
nobled 37fd22a091 mesa/image: delete dead store
The return value here is a) always zero, b) never used.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-08 21:20:25 +00:00
Bryan Cain 20b0daf82d glsl_to_tgsi: fix a bug in eliminate_dead_code_advanced()
The bug, reported to me by Vadim Girlin on IRC, was causing overzealous
elimination of code in parallel if statements such as the following:

if (x) {
	r = false;
}
if (y) {
	r = true;
}

Before this commit, the assignment inside the first if block would be
misdetected as dead code and removed.
2011-12-08 13:54:16 -06:00
José Fonseca 6cf7245f69 llvmpipe: Trim the fragment shader cached based on LLVM IR instruction count.
Number of fragment shader variants is not very representative of the
memory used by LLVM, neither is number of shader instructions, as often
texture sampling constitutes most of the generated code.

This change adds an additional trim criteria: least recently used
fragment shader variants will be freed until the total number of LLVM IR
instruction falls below a specified threshold.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-08 17:59:33 +00:00
José Fonseca f32c7232a8 llvmpipe,draw,gallivm: Ensure we don't walk beyond the end of the shader variant list.
u_simple_list.h uses a sentinel element, and not a NULL element. So
ensure list is not empty when reducing the list of shader variants.

Something I noticed while trying to free variants more aggressively.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-08 17:59:33 +00:00
Brian Paul 24e6484909 swrast: use malloc instead of MAX_WIDTH arrays in glCopyPixels, zoom code
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:31 -07:00
Brian Paul bf6aac24c1 mesa: use malloc instead of MAX_WIDTH array in glReadPixels()
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:31 -07:00
Brian Paul 1614de4045 mesa: use malloc instead of MAX_WIDTH array in _mesa_convert_colors()
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:31 -07:00
Brian Paul db247dd7b3 mesa: add MAX_PIXEL_BYTES define
In a few places we need to allocate space for some number of generic
pixels.  Use this new define instead of a magic number like 16 or
4 * sizeof(GLuint).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:31 -07:00
Brian Paul eb3e1d8888 mesa: simplify _mesa_remove_renderbuffer() 2011-12-08 08:56:31 -07:00
Brian Paul e4bb884dfb mesa: remove software-based renderbuffer code from core Mesa
We're now using the functions that live in swrast.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul d0dc75c000 mesa/drivers: use new swrast renderbuffer functions
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul b85284f45e mesa: build new s_renderbuffer.c file
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul 379e0a3ada swrast: remove core renderbuffer functions from s_renderbuffer.[ch]
We'll use the functions that live in main/
Plus, rename the remaining functions with "swrast_" prefix.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul ff8e6420fb swrast: add s_renderbuffer.[ch], copied from main/renderbuffer.[ch]
Copying these files is the first step in moving the software buffer
code from main/renderbuffer.c to swrast/s_renderbuffer.c

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul 6e8c1a92b3 mesa: remove unused functions in depthstencil.c
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul 14721dfe99 mesa: make some renderbuffer functions static
The functions to allocate software color, depth, accum, etc buffers aren't
called from anywhere else.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul bb887b72f7 swrast: remove dead accum buffer context fields 2011-12-08 08:56:30 -07:00
Brian Paul e6e734f143 mesa: remove dead swrast and state tracker accum buffer code 2011-12-08 08:56:30 -07:00
Brian Paul 122c6768e3 mesa: rewrite accum buffer support
Implemented in terms of renderbuffer mapping/unmapping and format
packing/unpacking functions.

The swrast and state tracker code for implementing accumulation are
unused and will be removed in the next commit.

v2: don't use memcpy() in _mesa_clear_accum_buffer()
v3: don't allocate MAX_WIDTH arrays, be more careful with mapping flags

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-08 08:56:30 -07:00
Brian Paul aa6cb952c9 mesa: new format_pack.c code
This code packs colors, Z, stencil, etc. in the various mesa pixel
formats.  Will be used for things like glDrawPixels, glTexImage,
glAccum, etc.
2011-12-08 08:56:30 -07:00
Brian Paul 2f88139145 mesa: remove the ctx->Driver.IsTextureResident() hook
No driver implemented this and we always returned "True" for residence
queries.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-08 08:56:29 -07:00
Brian Paul 5acb291f31 mesa: remove TextureMemCpy driver hook
There's probably no reason to use a special version of memcpy() anymore.
2011-12-08 08:56:29 -07:00
Henri Verbeet d958202663 st/mesa: Use util_blit_pixels_writemask() for depth blits as well in st_copy_texsubimage().
This has no piglit regressions on r600g and softpipe.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-08 12:54:14 +01:00
Thomas Hellstrom 340c0f6f9e st/xa: Update xa_yuv_planar_blit semantics
Change and document the interpretation of the color conversion matrix
in order to make the function more versatile and to simplify the
generated shader.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-12-08 09:51:19 +01:00
Paul Berry d4976158c7 i965 gen6: Implement pass-through GS for transform feedback.
In Gen6, transform feedback is accomplished by having the geometry
shader send vertex data to the data port using "Streamed Vertex Buffer
Write" messages, while simultaneously passing vertices through to the
rest of the graphics pipeline (if rendering is enabled).

This patch adds a geometry shader program that simply passes vertices
through to the rest of the graphics pipeline.  The rest of transform
feedback functionality will be added in future patches.

To make the new geometry shader easier to test, I've added an
environment variable "INTEL_FORCE_GS".  If this environment variable
is enabled, then the pass-through geometry shader will always be used,
regardless of whether transform feedback is in effect.

On my Sandy Bridge laptop, I'm able to enable INTEL_FORCE_GS with no
Piglit regressions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Eric Anholt <eric@anholt.net>
2011-12-07 16:38:01 -08:00
Paul Berry 2252e5e3f1 i965: Clean up misleading defines for DWORD 2 of URB_WRITE header.
R02_PRIM_END and R02_PRIM_START don't actually refer to bits in DWORD
2 of R0 (as the name, and comments in the code, would seem to
indicate).  Actually they refer to bits in DWORD 2 of the header for
URB_WRITE messages.

This patch renames the defines to reflect what they actually mean.  It
also addes a define URB_WRITE_PRIM_TYPE_SHIFT, which previously was
just hardcoded in .c files.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-07 16:38:01 -08:00
Paul Berry 3f2283172b i965 gs: Clean up dodgy register re-use, at the cost of a few MOVs.
Prior to this patch, in the Gen4 and Gen5 GS, we used GRF 0 (called
"R0" in the code) as a staging area to prepare the message header for
the FF_SYNC and URB_WRITE messages.  This cleverly avoided an
unnecessary MOV operation (since the initial value of GRF 0 contains
data that needs to be included in the message header), but it made the
code confusing, since GRF 0 could no longer be relied upon to contain
its initial value once the GS started preparing its first message.
This patch avoids confusion by using a separate register ("header") as
the staging area, at the cost of one MOV instruction.

Worse yet, prior to this patch, the GS would completely overwrite the
contents of GRF 0 with the writeback data it received from a completed
FF_SYNC or URB_WRITE message.  It did this because DWORD 0 of the
writeback data contains the new URB handle, and that neds to be
included in DWORD 0 of the next URB_WRITE message header.  However,
that caused the rest of the message header to be corrupted either with
undefined data or zeros.  Astonishingly, this did not produce any
known failures (probably by dumb luck).  However, it seems really
dodgy--corrupting FFTID in particular seems likely to cause GPU hangs.
This patch avoids the corruption by storing the writeback data in a
temporary register and then copying just DWORD 0 to the header for the
next message.  This costs one extra MOV instruction per message sent,
except for the final message.

Also, this patch moves the logic for overriding DWORD 2 of the header
(which contains PrimType, PrimStart, PrimEnd, and some other data that
we don't care about yet).  This logic is now in the function
brw_gs_overwrite_header_dw2() rather than in brw_gs_emit_vue().  This
saves one MOV instruction in brw_gs_quads() and brw_gs_quad_strip(),
and paves the way for the Gen6 GS, which will need more complex logic
to override DWORD 2 of the header.

Finally, the function brw_gs_alloc_regs() contained a benign bug: it
neglected to increment the register counter when allocating space for
the "temp" register.  This turned out not to have any effect because
the temp register wasn't used on Gen4 and Gen5, the only hardware
models (so far) to require a GS program.  Now, all the registers
allocated by brw_gs_alloc_regs() are actually used, and properly
accounted for.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-07 16:38:01 -08:00
Paul Berry 43e39b58c7 i965 gen6: Allocate URB space for GS
When the GS is not in use, the entire URB space is available for the
VS.  When the GS is in use, we split the URB space 50/50.

The 50/50 split is probably not optimal--we'll probably want tune this
for performance in a future patch.  For example, in most situations,
it's probably worth allocating more than 50% of the space to the VS,
since VS space is used for vertex caching.  But for now this is good
enough.

Based on previous work by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-07 16:38:01 -08:00
Kenneth Graunke 7a63a311e5 i965: Set the maximum number of GS URB entries on Sandybridge.
We never filled this in before because we didn't care.

I'm skeptical these are correct; my sources indicate that both the VS
and GS # of entries are 256 on both GT1 and GT2.

I'm also loathe to change it and break stuff.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
2011-12-07 16:38:00 -08:00
Paul Berry dabe15da4f i965: Only convert if/else to conditional adds prior to Gen6.
Normally when outputting instructions in SPF (single program flow)
mode, we convert IF and ELSE instructions to conditional ADD
instructions applied to the IP register.  On platforms prior to Gen6,
flow control instructions cause an implied thread switch, so this is a
significant savings.

However, according to the SandyBridge PRM (Volume 4 part 2, p79):

   [Errata DevSNB{WA}] - When SPF is ON, IP may not be updated by
   non-flow control instructions.

So we have to disable this optimization on Gen6.

On later platforms, there is no significant benefit to converting flow
control instructions to ADDs, so for the sake of consistency, this
patch disables the optimization on later platforms too.

The reason we never noticed this problem before is that so far we
haven't needed to use SPF mode on Gen6.  However, later patches in
this series will introduce a Gen6 GS program which uses SPF mode.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-07 16:38:00 -08:00
Paul Berry fcae281f06 i965 gs: Remove unnecessary mapping of key->primitive.
Previously, GS generation code contained a lookup table that mapped
primitive types POLYGON, TRISTRIP, and TRIFAN to TRILIST, mapped
LINESTRIP to LINELIST, and left all other primitives unchanged.  This
was silly, because we never generate a GS program for those primitive
types anyhow.

This patch removes the unnecessary lookup table.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-07 16:38:00 -08:00
Paul Berry a98ceee0ee mesa: Track changes to transform feedback state.
This patch adds a new bit to the ctx->NewState bitfield,
_NEW_TRANSFORM_FEEDBACK, to track state changes that affect
ctx->TransformFeedback.  This bit can be used by driver back-ends to
avoid expensive recomputations when transform feedback state has not
been modified.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-07 16:38:00 -08:00
Aaron Plattner 63a6fd6603 glx: Fix indirect fallback when a non-Mesa GLX extension is present.
When driCreateScreen calls driConvertConfigs to try to convert the
configs for swrast, it fails and returns NULL.  Instead of checking,
it just clobbers psc->base.configs.  Then, when the application asks
for the FBconfigs, there aren't any.

Instead, make the caller responsible for freeing the old modes lists
if both calls to driConvertConfigs succeed.

Without the second fix, glxinfo fails unless you run it with
LIBGL_ALWAYS_INDIRECT:

    $ glxinfo
    name of display: :0.0
    Error: couldn't find RGB GLX visual or fbconfig

    $ LIBGL_ALWAYS_INDIRECT=1 glxinfo
    name of display: :0.0
    display: :0  screen: 0
    direct rendering: No (LIBGL_ALWAYS_INDIRECT set)
    server glx vendor string: NVIDIA Corporation
    server glx version string: 1.4
    [...]

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-12-07 17:20:10 -07:00
Anuj Phogat 4558987818 glsl: Fix samplerCubeShadow support in shader compiler
This patch fixes the samplerCubeShadow support in GLSL shader compiler.
shader compiler was picking the 'r' texture coordinate for shadow comparison
when the expected behaviour is to use 'q' texture coordinate in case of cube
shadow maps.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-07 15:11:29 -08:00
Kenneth Graunke 4273943a07 i965: Set Ivybridge's is_array SURFACE_STATE bit.
Fixes piglit tests fbo-array, fbo-depth-array, fbo-generatemipmap-array,
and array-texture, as well as the array variants of my new textureSize
and texelFetch tests.

Not a candidate for 7.11 because EXT_texture_array wasn't supported.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-07 14:51:12 -08:00
Kenneth Graunke d464a21e2d i965: Return BRW_DEPTHBUFFER_D32_FLOAT as the null-depthbuffer format.
Fixes many crashes on Ivybridge due to upload_sf_state calling
brw_depthbuffer_format without an actual depth buffer.  This was a
recent regression on master.

+3992 piglits on Ivybridge.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-07 14:51:12 -08:00
Eric Anholt 5b27e44652 intel: Update comment about how depth/stencil miptrees are handled.
This evolved over several commits, and I also wanted to document some
new information about how we handle formats.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:38:54 -08:00
Eric Anholt 96159c37e3 intel: Rely on miptree mapping for all renderbuffer maps.
Now that all RBs have miptrees, and miptree mapping covered these last
two code paths, consistently use them.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:38:54 -08:00
Eric Anholt 5655ebf466 intel: Add support for LLC-cached reads of X-tiled miptrees using a blit.
This mimics the MapRenderbuffer code, and should improve the
performance of glGetTexImage().

v2: Fix broken error handling.
2011-12-07 13:38:53 -08:00
Eric Anholt 2d2bfd1f26 intel: Handle MapRenderbuffer of fake packed depth/stencil using miptree maps.
This gets the same performance win as the miptree maps did, and
removes a pile of code duplication.
2011-12-07 13:38:53 -08:00
Eric Anholt e0d67a3a8b intel: Track miptrees for fake packed depth/stencil renderbuffers.
Right now the fake packed d/s RBs are creating two sub-renderbuffers
with their own storage, and the hardware setup and the mapping code
have been explicitly referencing them.  By setting miptrees on them,
we'll be able to make our renderbuffer code for fake packed
depth/stencil more consistent with all our other renderbuffers.

The interesting new behavior here is that there is now a mt with a
non-depthstencil format (X8Z24) that has a stencil_mt field
associated.  This looks like it should be safe, and we'll need to be
able to do this for floating point depth/stencil as well.
2011-12-07 13:38:51 -08:00
Eric Anholt ed3aeb56ec intel: Make the fake packed depth/stencil mappings use a cached temporary.
Before, we had an uncached read of S8 to untile, then a RMW (so
uncached penalty) of the packed S8Z24 to store the value, then the
consumer would uncached read that once per pixel.  If data was written
to the map, we would then have to uncached read the written data back
out and do the scatter to the tiled S8 buffer (also uncached access
penalties, since WC couldn't actually combine).  So 3 or 5 uncached
accesses per pixel in the ROI (and we we were ignoring the ROI, so it
was the whole image).

Now we get an uncached read of S8 to untile, and an uncached read of
Z.  The consumer gets to do cached accesses.  Then if data was
written, we do streaming Z writes (WC success), and scattered S8
tiling writes (uncached penalty).  So 2 or 3 uncached accesses per
pixel in the ROI.

This should be a performance win, to the extent that anybody is doing
software accesses of packed depth/stencil buffers.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:38:08 -08:00
Eric Anholt 4cb1d6a25e intel: Make intel_region_map return void *.
We don't gripe about void * arithmetic for our driver, and this
prevents silly casting when assigning the result of mapping to
non-byte types.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:36:57 -08:00
Eric Anholt b48c3bca87 intel: Move separate-stencil s8 mapping logic to intel_miptree_map.
We're going to want to reuse this logic in mapping of fake packed
miptrees wrapping separate depth/stencil miptrees.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:36:57 -08:00
Eric Anholt baeaa062e9 intel: Move the gtt-particular texture mapping logic to a helper function.
This code will be incrementally moving to a model like intel_fbo.c's
renderbuffer mapping with helper functions, as I move that code here.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:36:57 -08:00
Eric Anholt 221a36514b intel: Make mapping of texture slices track the region of interest.
This will be used for things like packed depth/stencil temporaries and
making LLC-cached temporary mappings using blits.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:36:57 -08:00
Eric Anholt b75291c61c intel: Move the teximage mapping logic to a miptree level/slice mapping.
This will let us share teximage mapping logic with renderbuffer
mapping, which has an intel_mipmap_tree but not a gl_texture_image.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:36:57 -08:00
Eric Anholt 5c9a55665d intel: Only prefer separate stencil when we can do HiZ.
This required is_hiz_depth_format to start returning true on S8_Z24 as
well, since that's the format we have here.  The two previous callers
are only calling it on non-depthstencil formats.

This avoids us needing to have HiZ working on a new Z format
immediately upon exposing the format (particularly painful for
Z32_FLOAT_X24S8, which means all the fake packed depth/stencil paths).

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-12-07 13:36:57 -08:00
Thomas Hellstrom 576161289d st/dri: Use depth instead of bpp when communicating formats with the X server v3
Some hardware can't reinterpret the format of hardware buffers and thus
the X server needs to know the format when the buffer is created.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Michel Daenzer <michel@daenzer.net>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2011-12-07 20:05:24 +01:00
Kenneth Graunke 6781fd05e9 i965: Set SURFACE_STATE vertical alignment bit on Ivybridge.
See intel_vertical_texture_alignment_unit() in intel_tex_layout.c;
certain surface types require setting this to VALIGN_4.

Analogous to commit dd0e46c410 on Gen6.

Fixes piglit test fbo-generatemipmap-formats with the
GL_ARB_depth_texture and GL_EXT_packed_depth_stencil arguments.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2011-12-06 15:14:56 -08:00
Patrice Mandin 9419894835 nouveau/nvfx: Add more unsupported PIPE_CAP values
Signed-off-by: Patrice Mandin <patmandin@gmail.com>
2011-12-06 21:42:31 +01:00
Dave Airlie 2ee8704a8a radeon: add original r100 to the always tiled depth list.
According to Alex, he thinks r100 is also covered.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-06 16:10:43 +00:00
Fabio Pedretti 9ab43f7454 vega: remove unused vars
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-12-06 08:44:07 -07:00
Fabio Pedretti 0b34074bdb osmesa: remove unused bpc variable
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-12-06 08:42:54 -07:00
Dave Airlie 781a204bcf radeon/r200: add RV200 detiling + add an always tiled flag
passes readpix sanity on the M7.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-06 15:12:00 +00:00
Dave Airlie 1136da9c6b r200: add Z16 depth detiling.
This passes readPixSanity with z16 visuals.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-06 15:11:36 +00:00
Dave Airlie 61a40581d2 r200: handle Z24 depth buffers correctly
The same detiling pattern applies to X8_Z24 as well.

Signed-off-by: Dave Airlie <Airlied@redhat.com>
2011-12-06 15:11:36 +00:00
Vadim Girlin e98521e0f3 r600g: check shaders presence in r600_draw_vbo
This patch should prevent the crashes when some shaders are absent,
see https://bugs.freedesktop.org/show_bug.cgi?id=43341

Note this is a candidate for the stable branch.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2011-12-06 09:53:35 -05:00
Dave Airlie 81a715605a r200: fix cb microtile setup
We shouldn't see this in buffers from the DDX but just in case.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-06 10:34:16 +00:00
Dave Airlie 4d4cecd05b r200: enable tiling flags on blitter setup.
The r200 blitter also didn't set the correct tiling flags.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-06 10:34:16 +00:00
Anuj Phogat c3aae7745a swrast: Add depth cube map support.
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-05 17:02:13 -08:00
Anuj Phogat 29a7d7784d mesa: Allow glTexImage2D with a depth component cube map.
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-12-05 17:02:05 -08:00
Kenneth Graunke 84d6201567 i965: Fix incorrect comment about single program flow on Ironlake.
The code forces single program flow to be enabled on Ironlake, or
equivalently, disables multiple program flow.  The comment was reversed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-05 17:00:07 -08:00
Jerome Glisse e368eefc68 r600g: fix error path and use util_slab_free
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2011-12-05 18:42:38 -05:00
Jerome Glisse bbc320a94d gallium/radeon: fix indentation
Indentation cleanup, to keep consistency.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2011-12-05 18:40:53 -05:00
Dave Airlie a8bbbcae4a radeon/r200: drop old span depth/stencil code.
This is no longer used with the new renderbuffer code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 19:15:52 +00:00
Dave Airlie 7d91ecf7a3 radeon/r200: add draw/stencil buffer detiling
This moves the detiling to the fbo mapping, r200 depth is always tiled,
and we can't detile it with the blitter.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 19:15:04 +00:00
Dave Airlie c48763643e radeon: fix warnings 2011-12-05 16:51:03 +00:00
Dave Airlie f24e106ead radeon: use mesa renderbuffer accessors for depth for now.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 16:25:27 +00:00
Dave Airlie 5c666bdfdb radeon: add some tiling support for r100.
This sets up the tiling flags on the blitter.

Fixes some piglit tests with tiling enabled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 15:41:24 +00:00
Dave Airlie b2596c36c8 radeon: texture/renderbuffer overhaul.
This could have been split up better, but the driver is just broken now,
so bisecting the brokenness is going to be painful no matter what.

This adds renderbuffer mapping/unmapping along with texture image allocation.
It drops all the old texture upload paths, some of which could possible be
reimplemented with the blitter later.

It also redoes the span code paths to use its own set of image mapping handlers,
along with removing the tiling decode paths for the color buffers, since
we now hope to use the blitter for this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 14:36:19 +00:00
Dave Airlie fd7fcfcc2d radeon: set texture bits to always emit.
I think there is a missing state update or flush somewhere, and every
so often PP_CNTL goes to the kernel with a texture enabled but no texture.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 11:31:15 +00:00
Dave Airlie 4ed8a58584 radeon: update flush according to glXMakeCurrent man page
This also copies code from intel driver to do this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 11:31:15 +00:00
Dave Airlie 6d573c4dd7 radeon: drop border check
now that we strip borders off earlier.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 11:31:15 +00:00
Dave Airlie fbfa807034 radeon: add a bit more debugging to the blit debug code.
For debugging blits it helps if we printed out the offsets as well.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-12-05 11:31:15 +00:00
Eric Anholt 887c349d54 mesa: Reject glDrawPixels(integer format).
When folding GL_EXT_texture_integer into the core, a new (and very
sensible) restriction was added.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-04 14:54:16 -08:00
Brian Paul 1bb59b382a util: add casts in fprintf() calls to silence warnings
And wrap to 80 columns.
2011-12-03 09:31:45 -07:00
Mathias Fröhlich b14c06e10d mesa: Use VERT_{ATTRIB,BIT}* for ARB input validation.
For validating ARB program inputs replace hard
coded bitfield and attribute number with the appropriate
VERT_{ATTRIB,BIT}* variant.

This should fix:

https://bugs.freedesktop.org/show_bug.cgi?id=43407

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2011-12-03 08:13:49 +01:00
Chia-I Wu b7a69cbb71 egl_glx: fix eglDestroyContext
Wrong pointers are passed to glXDestroyContext.

Spotted by Brian Paul.
2011-12-03 11:10:16 +08:00
Stuart Abercrombie aa010157a3 i965: Fix emit of a MOV with bad destination channel on gen6 math in FPs.
Previously a zero writemask would result in dst_chan == -1, meaning an
unnecessary MOV with the destination register dictated by undefined
memory contents would be emitted before returning.  This caused
intermittent GPU hangs, e.g. with glean/texCombine.

Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-02 15:28:44 -08:00
Eric Anholt 079bb3fff7 mesa: Fix assertions for block size handling in glCompressedTexSubImage2D.
Anything of less than (bw, bh) size is possible when you consider
rectangular textures, and this code is (now) safe for those.  Even for
power-of-two textures, width could be 4 for FXT1 while not being
aligned to block size.

Fixes piglit compressedteximage GL_COMPRESSED_RGB_FXT1_3DFX

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 15:28:44 -08:00
Eric Anholt 1e0b6a90d7 mesa: Fix glCompressedTexSubImage (and non-Sub) for height == 2 or 1.
Generally this code works with width and height aligned to compressed
blocks, but at the 2x2 and 1x1 levels of a square texture (or height <
bh in general), we were skipping uploading our single row of blocks.

Fixes piglit compressedteximage GL_COMPRESSED_RGBA_S3TC_DXT5_EXT.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 15:28:44 -08:00
Eric Anholt bda361e0d4 mesa: Fix glCompressedTexImage when dstRowStride != srcRowStride.
Since the MapTextureImage changes on Intel, nwn had corruption in the
scrollbar at the load game menu, and corrupted ground textures in the
starting zone.  Heroes of Newerth's intro screen was also thoroughly
garbled.  A new piglit test "compressedteximage" was created to
regression test this.

The issue was this code now seeing dstRowStride aligned to hardware
requirements instead of a temporary buffer that gets uploaded to
hardware later.  The existing code was just trying to memcpy
srcRowStride * height / bh, while the glCompressedTexSubImage2D()
storage code nearby did the correct walking by blockheight rows at a
time.  Just reuse the subimage upload instead of duplicating that
logic.

v2: Update comment at the top of the function (suggestion by Joel
Forsberg)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41451
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2011-12-02 15:28:44 -08:00
Marcin Slusarz 27e77cb902 nv50/nvc0: fix crash when channel allocation fails 2011-12-02 19:31:50 +01:00
Brian Paul 19b1025172 mesa: add casts to fix unpack_SIGNED_GR1616()
We were passing unsigned values to the macro before.
2011-12-02 07:22:40 -07:00
Brian Paul bbbab8de63 mesa: remove unreachable code in _mesa_unpack_color_span_ubyte()
We checked if srcType == GL_UNSIGNED_BYTE earlier so there was no
way to reach this code.  This was left-over code from the GLchan
removal work.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-02 07:22:40 -07:00
Brian Paul 01cd9a7d92 vbo: remove unreachable _mesa_error() call
If mode is not GL_POINT/LINE/FILL we'll have already reported the
error earlier in the function and returned so we can never get here.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-02 07:22:40 -07:00
Brian Paul 89efc1b839 mesa: move _mesa_error() call in compressedteximage()
We shouldn't call _mesa_error() if the target is a proxy texture.
Errors are handled later in the function.
Fixes a Coverity warning.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-12-02 07:22:39 -07:00
Brian Paul 9ec5050898 mesa: fix potential mem leak in generate_mipmap_compressed()
Fixes a coverity warning.

Reviewed-by: Vinson Lee <vlee@vmware.com>
2011-12-02 07:22:39 -07:00
Brian Paul 98ebe833fe glsl: return visit_stop in ir_validate::visit_enter() to silence warning 2011-12-02 07:22:39 -07:00
Brian Paul 06913497d6 mesa: fix some minor texstore comments
For the texsubimage commands, we're not mapping the whole image/region.
2011-12-02 07:22:39 -07:00
Brian Paul b4aecc4e18 mesa: rename MESA_FORMAT_RG88_REV to MESA_FORMAT_RG88
R is in the high byte, G in the low byte.
2011-12-02 07:22:39 -07:00
Brian Paul 0a3c895f34 mesa: rename MESA_FORMAT_RG88 to MESA_FORMAT_GR88
To better reflect the component ordering and be consistent with other
format names.
2011-12-02 07:22:39 -07:00
Brian Paul 0be753a143 mesa: fix unpacking of RG88_REV texels
R should be in the high byte and G in the low byte for this format.
2011-12-02 07:22:39 -07:00
Kenneth Graunke e304aa3600 i965: Make gen6_resolve_implied_move a no-op for MRF sources.
Attempting to move an MRF to a MRF is not only pointless, it will fail
because MRFs are read-only, resulting in garbage in your register.

If we already set up a MRF source, there's nothing to resolve anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-12-02 02:49:23 -08:00
Mathias Fröhlich ce45aecfda mesa: Renumber the tnl attributes to match VERT_ATTRIB*.
Also renumber the tnl modules vertex attributes to match
the renumbered VERT_ATTRIB_* values.

This should fix

https://bugs.freedesktop.org/show_bug.cgi?id=43353

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Tested-by: Vinson Lee <vlee@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 07:04:49 +01:00
Mathias Fröhlich a4f345e0d2 mesa: Extend BITSET64_*_RANGE to work on arbitrary ranges.
The BITSET64_{TEST,SET,CLEAR}_RANGE macros only work on ranges
wither in the lower 32 or in the upper 32 bits of the bitset.
This change extends these macros to work on arbitrary ranges
possibly crossing the bitset word boundary.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 07:04:49 +01:00
Stéphane Marchesin 52b75c6165 i915g: Implement GL_STREAM_* for textures by using untiled textures. 2011-12-01 18:12:56 -08:00
Stéphane Marchesin d269ce0a39 i915g: Add unsupported PIPE_SHADER_CAP_OUTPUT_READ to silence warnings. 2011-12-01 18:09:18 -08:00
Chia-I Wu cde6c91fd5 st/mesa: add support for GL_OES_compressed_ETC1_RGB8_texture
Have st/mesa recognize MESA_FORMAT_ETC1_RGB8 then we are good to advertise the
extension.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 08:43:46 +08:00
Chia-I Wu 5c31eb78e5 gallium: add PIPE_FORMAT_ETC1_RGB8
The format is defined by GL_OES_compressed_ETC1_RGB8_texture.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2011-12-02 08:43:46 +08:00
Chia-I Wu d4a38e86d4 mesa: add support for GL_OES_compressed_ETC1_RGB8_texture
Add support for GL_OES_compressed_ETC1_RGB8_texture to core mesa.  There is no
driver support yet.

Unlike desktop GL compressed texture formats, GLES compressed texture formats
usually can only be used with glCompressedTexImage2D.  All other gl*Tex*Image*
functions are updated to check for that.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 08:43:46 +08:00
Chia-I Wu 51f4d27254 mesa: add ETC1 decoding routines
The format is defined by GL_OES_compressed_ETC1_RGB8_texture.  These routines
will be used in the following commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 08:43:45 +08:00
Chia-I Wu 4eae2b37a8 glapi: regenerate files for GL_OES_compressed_ETC1_RGB8_texture
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 08:43:45 +08:00
Chia-I Wu 35b506148e glapi: add GL_OES_compressed_ETC1_RGB8_texture for GLES
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-02 08:43:44 +08:00
Mathias Fröhlich a4c952f36f swrast: Fix signed/unsigned problems with negative strides.
In swrast_map_renderbuffer negative strides lead to
render buffer map pointers that are off by 2^32.
Make sure that intermediate negative values are not
converted to an unsigned.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-01 21:44:57 +01:00
Vinson Lee de93347d48 u_vbuf: Silence uninitialized variable warnings.
Fixes these GCC warnings.
u_vbuf.c: In function ‘u_vbuf_draw_begin’:
u_vbuf.c:839:20: warning: ‘max_index’ may be used uninitialized in this function [-Wuninitialized]
u_vbuf.c:838:20: warning: ‘min_index’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Vinson Lee <vlee@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-12-01 11:41:14 -08:00
Brian Paul e10942c8e9 mesa: fix unpack_ARGB1555_REV()
We weren't doing the necessary byte swap.

v2: use same arithmetic as unpack_ARGB1555() to be consistent.

Reviewed-by: Michel Dänzer <michel@daenzer.net>
2011-12-01 08:07:34 -07:00
Brian Paul 478f0d228b mesa: fix indentation in attrib.c 2011-11-30 20:35:02 -07:00
Eric Anholt 51e5a266c1 i965/fs: Fix regression in fbo-alphatest-nocolor.
In the refactor for handling user-defined out params, we failed to set
up the new color output tracking when there was no color drawbuffer in
place but alpha testing was on.  Just always set up at least one when
handling gl_FragColor, since we won't make use of its value unless we
need to.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42806
2011-11-30 11:23:26 -08:00
Eric Anholt a3b8c5ed5b i965/fs: Make register file enum 0 be the undefined register file.
In 6d874d0ee1, I checked whether a
register that had been stored was BAD_FILE (as opposed to a legitimate
GRF), but actually the unset register was ARF NULL because it had been
memset to 0.  Finding BAD_FILE for unset values in debugging was my
intention with that file, so make it the case more often by
rearranging the enum.  There was only one place we relied on the magic
enum register_file to hardware register file correspondance anyway.
2011-11-30 11:23:26 -08:00
Eric Anholt c6abde211f i965: Don't perform the precompile on fragment shaders by default.
It is useful to have this option for shader-db, and it was also good
at the time where we were rejecting shaders due to various internal
limits we hadn't supported yet.  However, at this point the precompile
step takes extra time (since not all NOS is known at link time) and
spews misleading debug in the common case of debugging a real app.

This is left in place for VS, where we still have a couple of codegen
failure paths that result in link failure through precompile.  Those
need to be fixed.

shader-db can still get at the debug info it wants using
"shader_precompile=true" driconf option.  Long term, we can probably
build a good-enough app for shader-db to trigger real codegen.
2011-11-30 11:22:53 -08:00
Kai Wasserbäch 0a22fb6a5d gallium/failover: Remove the deprecated module.
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
2011-11-30 17:26:40 +00:00
Brian Paul 15245cbad4 st/mesa: fix indentation 2011-11-30 07:09:46 -07:00
Brian Paul efcf5aa13f mesa: use _mesa_is_bufferobj() in update_array() 2011-11-30 06:57:38 -07:00
Brian Paul 529fa77529 mesa: use Elements() macro in program printing code 2011-11-30 06:57:37 -07:00
Brian Paul c67d9cfd9d mesa: fix signed/unsigned comparison warning 2011-11-30 06:57:37 -07:00
Brian Paul c3a57841a3 mesa: fix MESA_FORMAT_RG88 format match test
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-30 06:57:37 -07:00
Brian Paul 76374e60cd mesa: fix printf format warning in _mesa_fprint_program_parameters() 2011-11-30 06:57:37 -07:00
Brian Paul 1ad5a1a246 tnl: s/INLINE/inline/ 2011-11-30 06:57:37 -07:00
Brian Paul 22ad02b3ff mesa: regenerated dispatch.h (s/INLINE/inline/) 2011-11-30 06:57:37 -07:00
Brian Paul 919c835835 glapi: s/INLINE/inline/ for dispatch.h file 2011-11-30 06:57:36 -07:00
Brian Paul ea472ffe67 swrast: use STATIC_ASSERT to make sure texfetch table isn't missing entries
When new MESA_FORMAT_x enums are added we need to add a new entry in
the table of texture fetch functions.  In the past this has been
missed if swrast isn't actually tested.  Using a static assertion
should help with that.
2011-11-30 06:57:36 -07:00
Brian Paul 15be8b4bf0 mesa: add STATIC_ASSERT() macro for compile-time assertions
This can be used to check that tables have the right number of entries,
etc. at compile-time.  This will hopefully catch things that are missed
if particular drivers aren't tested, for example.

v2: Simplify the macro to omit the extra line number info (the compiler
already indicates the line number).  And wrap the macro for readability.
2011-11-30 06:57:36 -07:00
Brian Paul 25c8a112ab mesa: access pixels as GLushort in unpack_SL8()
Per the format comments and the texstore code, use a GLushort to access the
pixel.  The code was OK as-is on little endian machines.
2011-11-30 06:57:36 -07:00
Eric Anholt 2134d2f35b mesa: Make _mesa_is_stencil_format() consistent with _mesa_is_depth_format().
There was only one consumer of this API, meta.c, which was intending
to ask "is this format just stencil index (and nothing else)?".
Instead, if one tried to glDrawPixels of GL_DEPTH_STENCIL-type
formats, it would just try to draw the stencil parts.  Nothing good
came of this.

This function looks rather silly at this point, but I'm leaving it in
place to be the obvious parallel API to _mesa_is_depth_format().  Note
that if you want the old behavior, you should use it as
(_mesa_is_stencil_format() || _mesa_is_depthstencil_format()) like is
commonly done for depth-related tests.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-29 16:44:51 -08:00
Eric Anholt ed945b0bc7 mesa: Fix the datatype of GL_DEPTH32F_STENCIL8's depth channel.
Asking for the datatype of MESA_FORMAT_Z32_FLOAT_X24S8 is a bit funny
-- there's a float depth channel, and a stencil channel that doesn't
have a particular GLenum associated with its type, so what's the
correct response?

Because there is no query for stencil, just make this format's
datatype be that of the depth channel.  It fixes the depth query (and
thus a failure in piglit gl-3.0-required-sized-formats), and none of
the other consumers of the _mesa_get_format_datatype() API care.

v2: Add a comment for why the DataType is this way for this format.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-29 16:44:51 -08:00
Eric Anholt d2235b0f46 i965: Always handle GL_DEPTH_TEXTURE_MODE through the shader.
We were already doing it through the shader (layered underneath
GL_EXT_texture_swizzle) in the shadow compare case.  This avoids
having per-format logic for switching out the surface format dependent
on the depth mode.

v2: Also do the swizzling for DEPTH_STENCIL.  oops.

Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-29 16:44:51 -08:00
Eric Anholt f98bfb5d68 i965: Fix EXT_texture_swizzle with a writemask in the FFFS/FP backend.
I tripped over this bug in the next commit, relying on our
EXT_texture_swizzle to do some shadow sampler-related swizzling.  If a
writemask was masking out a channel of the destination that was a live
channel of the texture swizzle, it would read undefined values.

Fixes piglit ARB_fragment_program_shadow/masked.

Reviewed-by: Ian Romanick <idr@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-29 16:44:51 -08:00
Eric Anholt d84a180417 i965: Base HW depth format setup based on MESA_FORMAT, not bpp.
This will make handling new formats (like actually exposing Z32F)
easier and more reliable.

v2: Remove the check for hiz buffer -- the MESA_FORMAT should really
    be giving us the value we want even for hiz.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-29 16:44:51 -08:00
Kai Wasserbäch ccd4d4367f gallium/cell: Remove the driver.
Complicates Gallium3D development and doesn't seem to have active users.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
2011-11-29 20:26:53 +00:00
Eric Anholt 09e67706e9 i965: Don't depth test the fake depthbuffer when one isn't present.
For the non-separate-stencil-only case, we've been using a NULL
surface for depth, so we didn't have to care.  However, to support
separate stencil with no depthbuffer, we have to make the depth
surface non-NULL or the stencil test always fails thanks to separate
stencil inheriting the surface type of depth.

Fixes hiz-depth-stencil-test-d0-s8.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-29 11:18:23 -08:00
Ian Romanick e6c314f7d2 mesa: Allow generic attributes for glGetActiveAttrib and GL_ACTIVE_ATTRIBUTES
Page 77 (page 91 of the PDF) says about glGetActiveAttrib:

    "The returned attribute name can be the name of a generic
    attribute or a conventional attribute (which begin with the prefix
    "gl_", see the OpenGL Shading Language specification for a
    complete list)."

Page 261 (page 275 of the PDF) says about glGetProgramiv:

    "If pname is ACTIVE_ATTRIBUTES, the number of active attributes in
    program is returned."

It doesn't say anything about built-in vs. user-defined attributes.
From the language around glGetActiveAttrib and the lack of an
exclusion of built-in attributes, which exists other places (e.g.,
around glBindAttribLocation), we can infer that GL_ACTIVE_ATTRIBUTES
should include the active attribute count.  It should also be included
in the values returned by glGetActiveAttrib.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43138
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Yi Sun <yi.sun@intel.com>
2011-11-29 11:14:28 -08:00
Chad Versace 03bbcd447c swrast: Fix some static analysis warnings
To each switch statement in s_texfilter.c, add a break statement to the
default case.

Eliminates the Eclipse static analysis warning: No break at the end of
this case.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2011-11-29 10:36:15 -08:00
José Fonseca 10b07665be Remove windows kernel support code.
Not actively used.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-29 17:34:56 +00:00
José Fonseca 57f8e26ca8 gallium/auxiliary: Remove os_stream.
XP kernel mode was the only subsystem lacking stdio FILES.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-29 17:34:30 +00:00
José Fonseca c8db5a3d53 st/vega: Fix warnings about dllimport attributes on windows. 2011-11-29 15:55:40 +00:00
Kai Wasserbäch 2c27f204f1 i965g: Delete this driver.
Never completed, and no plans to do so.

Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Signed-off-by: José Fonseca <jfonseca@vmware.com>
2011-11-29 15:44:09 +00:00
Chia-I Wu 76ba431b97 mesa: distinct gl_client_array arrays are gone
Fix build errors since 762c9766c9.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
2011-11-29 17:13:01 +08:00
Mathias Fröhlich 762c9766c9 mesa: Use VERT_ATTRIB_* indexed array in gl_array_object.
Replace the distinct struct gl_client_array members in gl_array_object by
an array of gl_client_arrays indexed by VERT_ATTRIB_*.
Renumber the vertex attributes slightly to keep the old semantics of the
distinct array members. Make use of the upper 32 bits in VERT_BIT_*.
Update all occurances of the distinct struct members with the array
equivalents.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:37:19 +01:00
Mathias Fröhlich dca6a28a14 mesa: Make gl_program::InputsRead 64 bits.
Make gl_program::InputsRead a 64 bits bitfield.
Adapt the intel and radeon driver to handle a 64 bits
InputsRead value.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:35:44 +01:00
Mathias Fröhlich f364ac1da1 mesa: Make gl_array_object::_Enabled 64 bits.
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:35:44 +01:00
Mathias Fröhlich ed42c25807 vbo: Use The VERT_{ATTRIB,BIT} defines.
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:35:44 +01:00
Mathias Fröhlich 104b81def4 mesa: Replace _NEW_ARRAY_* bits with VERT_BIT_*
Consolidate the two distinct set of flags to use VERT_BIT_*.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:35:44 +01:00
Mathias Fröhlich b57101302d mesa: Introduce more symbolic VERT_{ATTRIB,BIT}* defines.
Introduce a set of defines for VERT_ATTRIB_* and VERT_BIT_*
that will be used in the followup patches.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-29 06:35:44 +01:00
Yuanhan Liu a0a5bd4bb3 mesa: move ElementArrayBufferObj to gl_array_object
According opengl spec 4.2.pdf table 6.12 (Vertex Array Object State) at
page 515, the element buffer object is listed in vertex array object.

So, move the ElementArrayBufferObj inside gl_array_object to make
element buffer object per-vao.

This would fix most of(3 left) intel oglc vao test fail

NOTE: this is a candidate for the 7.11 branch.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-29 09:48:50 +08:00
Brian Paul 4ff212aac3 mesa: update comments for _mesa_format_matches_format_and_type(), 80-column wrapping 2011-11-28 18:10:30 -07:00
Brian Paul 0cbdead62e mesa: add component comments for sRGB formats 2011-11-28 18:10:30 -07:00
Brian Paul ae70caf7eb mesa: update texstore comments for R/G textures 2011-11-28 18:10:30 -07:00
Brian Paul 50b91aa305 mesa: fix comments for RG formats
The position of the red and green bits was misstated in the comments.
Arguably, the names of these formats should be changed to "GR" to reflect
the component ordering and to be consistent with other formats.
2011-11-28 18:10:30 -07:00