Commit Graph

47647 Commits

Author SHA1 Message Date
Marek Olšák c5ae81652d r300g: implement PIPE_QUERY_GPU_FINISHED 2011-11-10 22:53:54 +01:00
Marek Olšák 014b3aa07d r300g: implement PIPE_QUERY_OCCLUSION_PREDICATE 2011-11-10 22:53:54 +01:00
Dave Airlie 4fd485666a llvmpipe/u_format: add support for EXT_texture_shared_exponent + EXT_packed_float
These two are fairly unique types so add specific cases for decoding them.

Passes piglit fbo-clear-format and fbo-generatemipmap-format tests for these
two extensions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-10 20:37:55 +00:00
Dave Airlie ab14915dce llvmpipe: add NV_conditional_render support.
This ports the softpipe NV_conditional_render support to llvmpipe.

This passes the nv_conditional_render-* piglit tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-10 20:32:13 +00:00
Marek Olšák dbd24b5df6 r600g: remove useless texture barrier 2011-11-10 18:49:26 +01:00
Marek Olšák ec3d2c7f08 r600g: flush the whole context when CS is full, not just hw_context
Because we disable render condition in r600_flush, but not in r600_context_flush.
2011-11-10 18:48:23 +01:00
Marek Olšák 6a490149d9 r600g: turn some CS overflow checks into assertions
They're not really exhaustive and not so useful either.
2011-11-10 18:09:10 +01:00
Marek Olšák 5222e16e2b r600g: put the rest of CS overflow checks in r600_need_cs_space 2011-11-10 18:09:10 +01:00
Marek Olšák 30a570e450 r600g: flush caches regardless of render condition
What if somebody enables render condition just before we flush...
2011-11-10 18:09:10 +01:00
Marek Olšák 578b211be6 r600g: disable render condition at the end of CS, re-enable at the beginning 2011-11-10 18:09:10 +01:00
Marek Olšák 9564185b0a r600g: don't suspend queries if they have already been suspended by blitter
And add some assertions.
2011-11-10 18:09:10 +01:00
Marek Olšák cb7c6c30d0 r600g: properly reserve CS space for queries_suspend 2011-11-10 18:09:10 +01:00
Marek Olšák 1d09831253 r600g: reserve CS space for a draw command in begin_query and render_condition
There's no point in emitting those if you can't emit a draw command too.
2011-11-10 18:09:10 +01:00
Marek Olšák 11bdd28796 r600g: consolidate checking whether CS is full
This adds a new function r600_need_cs_space. Currently, it's easy to overflow
the CS - queries are not counted in. I guess that's not the only case where
the driver may crap out.
2011-11-10 18:09:09 +01:00
Dave Airlie 216be4120d radeon: fix tex1d-border2d
Fixes pigit test with T wrap usage.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-10 15:49:40 +00:00
Dave Airlie c8fb700f2b radeon: fix 3-coordinate swtcl emission
This fixes mipmap generation on swtcl rv100.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-11-10 15:49:40 +00:00
Eric Anholt 11a90af1ef swrast: Add support for glReadPixels() to integer types.
With this change, i965 passes
GL_EXT_texture_integer/fbo_integer_precision_clear

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:59:20 -08:00
Eric Anholt e34c9edcda mesa: Add support for unpacking 32-bit integer formats to int spans.
This is the inverse operation to _mesa_pack_rgba_span_int.  The 16-bit
code isn't done because of lack of testing and not being sure how sign
extension/clamping should be handled between, say, 16-bit int and
32-bit int or uint.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:59:20 -08:00
Eric Anholt 84277cb7d3 meta: Add support for glClear() to integer color buffers.
This requires using a new fragment shader to get the integer color
output, and a new vertex shader because #version has to match between
the two.

v2: Clarify that there's no need for BindFragDataLocation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2011-11-09 12:59:20 -08:00
Eric Anholt 42c5552b0e i965: Claim to support rendering to integer FBOs.
We're missing support for the software paths still, but basic
rendering is working.

v2: Override RGB_INT32/UINT32 to not be renderable, since the hardware
    can't do it but we do allow texturing from it now.  Drop the
    DataType override, since the _mesa_problem() isn't in that path
    any more.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2011-11-09 12:59:20 -08:00
Eric Anholt 6d874d0ee1 i965/fs: Add support for user-defined out variables.
Before, I was tracking the ir_variable * found for gl_FragColor or
gl_FragData[].  Instead, when visiting those variables, set up an
array of per-render-target fs_regs to copy the output data from.  This
cleans up the color emit path, while making handling of multiple
user-defined out variables easier.

v2: incorporate idr's feedback about ir->location (changes by Kenneth Graunke)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:59:20 -08:00
Eric Anholt e988d816e1 i965/fs: Preserve the source register type when doing color writes.
When rendering to integer color buffers, we need to be careful to use
MRFs of the correct type when emitting color writes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:59:20 -08:00
Eric Anholt e19dfc75b6 i965: Make brw_type_for_base_type return the element type for arrays.
Previously, brw_type_for_base_type returned UD for array variables,
similar to structures.  For structures, each field may have a different
type, so every field access must explicitly override the register's type
with that field's type.  We chose to return UD in this case since it was
the least common, so errors would be more obvious.

For arrays, it makes far more sense to return the type corresponding to
an element of the array.  This allows normal array access to work
without the hassle of explicitly overriding the register's type.

This should obsolete a bunch of type overrides throughout the code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:59:19 -08:00
Eric Anholt a00c5a71cd i965: Enable ChooseTexFormat for supported GL_EXT_texture_integer formats.
v2: s/GL_TRUE/true/, and re-enable RGB_INT32 based on discussion
    yesterday about required RB formats vs texture formats.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2011-11-09 12:59:19 -08:00
Eric Anholt 35be4ae77e i965: Add mapping from MESA_FORMAT to BRW_SURFACEFORMAT for integer.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:59:09 -08:00
Eric Anholt 704b7551e8 intel: Expose GL_EXT_texture_integer when GL 3.0 override is set.
This will let the feature be incrementally developed, hidden behind
the flag we're all using as we work on GL 3.0 support.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:38:58 -08:00
Eric Anholt 6e610a0485 docs: Note EXT_texture_array on i965.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:38:30 -08:00
Eric Anholt e56aecf249 i965: Add support for 16-bit unorm L, A, and I textures.
While not required by any particular spec version, mplayer was asking
for L16 and hoping for actual L16 without checking.  The 8 bits
allocated led to 10-bit planar video data stored in the lower 10 bits
giving only 2 bits of precision in video.  While it was an amusing
effect, give them what they actually wanted instead.

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

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-09 12:04:39 -08:00
Eric Anholt b5444a6ebd intel: Don't _mesa_problem when asked for an RB of a texturing-only type.
We want to be able to support some formats for texturing that we can't
render to, which means that some choices for RenderbufferStorage end
up being incomplete (for example, L8 currently).  For these, where we
don't render to them, we don't want to have to make up an rb->DataType
that's only used for GetRow()/PutRow().
2011-11-09 12:04:39 -08:00
Paul Berry 01ccddbed6 r200: remove dangling radeon.h symlink.
Commit 1401b96b (radeon: cleanup radeon shared code after r300 and
r600 classic drivers removal) removed the file
src/mesa/drivers/dri/radeon/server/radeon.h, but it left behind the
symlink which was used to share that file into the
src/mesa/drivers/dri/r200/server directory.

This patch removes the dangling symlink.

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
2011-11-09 11:26:27 -08:00
Paul Berry 871ddb919b glsl: Assign transform feedback varying slots in linker.
This patch modifies the GLSL linker to assign additional slots for
varying variables used by transform feedback, and record the varying
slots used by transform feedback for use by the driver back-end.

This required modifying assign_varying_locations() so that it assigns
a varying location if either (a) the varying is used by the next stage
of the GL pipeline, or (b) the varying is required by transform
feedback.  In order to avoid duplicating the code to assign a single
varying location, I moved it into its own function,
assign_varying_location().

In addition, to support transform feedback in the case where there is
no fragment shader, it is now possible to call
assign_varying_locations() with a consumer of NULL.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Marek Olšák <maraeo@gmail.com>
2011-11-09 11:12:47 -08:00
Ian Romanick 6f5c737970 glsl: Clamp vector indices when lowering to swizzles
This prevents other code from seeing a swizzle of the 16th component
of a vector, for example.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42517
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Christian Holler <choller@mozilla.com>
2011-11-09 10:50:35 -08:00
José Fonseca 1d1c0fa2f3 scons: Disable deprecated POSIX name MSVC warnings. 2011-11-09 10:33:21 +00:00
José Fonseca 63e7a4c6e5 mesa,glsl,mapi: Put extern "C" { ... } where appropriate.
Probably a several places missing, but enough to cover all headers
(in)directly included by uniform_query.cpp, and fix the MSVC build.
2011-11-09 10:24:37 +00:00
José Fonseca f4b42aa5b7 scons: Don't list m_xform.c twice. 2011-11-09 10:24:37 +00:00
José Fonseca 9b8ee08248 glu: Fix deprecated conversion from string constant to ‘char*’ warning. 2011-11-09 10:24:37 +00:00
Marek Olšák 60302f83e2 r600g: clarify meaning of one variable in shader codegen
It's easier to read now.
2011-11-09 00:18:53 +01:00
Marek Olšák 1b375f8413 r600g: cosmetic changes in query code
Mainly updating comments and removing one use of a magic number.
2011-11-09 00:18:53 +01:00
Marek Olšák 8187ad0754 r600g: use modulo for computing index into query (ring) buffers 2011-11-09 00:18:53 +01:00
Marek Olšák 552e90bd6a r600g: make r600_query_result more generic
We'll soon start adding new query types, maybe even querying more than
one value per query.
2011-11-09 00:18:52 +01:00
José Fonseca 4eb3225b38 Remove tgsi_sse2.
tgsi_exec is simple. llvm is fast. tgsi_sse2 ends up being neither.
2011-11-08 22:57:34 +00:00
Brian Paul 207a016eca mesa: fix signed/unsigned integer comparison warnings
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2011-11-08 13:51:50 -07:00
Brian Paul fab8882273 glsl: remove trailing comma to silence warning 2011-11-08 13:51:50 -07:00
Ian Romanick 59012c3133 mesa: Implement glGetFragDataLocation
Fixes piglit's getfragdatalocation test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-08 11:10:11 -08:00
Ian Romanick b12b5d9ab5 linker: Use app-specified fragment data location during linking
Fixes piglit's bindfragdata-link-error.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-08 11:10:11 -08:00
Ian Romanick 4464a4b27b mesa: Stub implementation of glBindFragDataLocation
This just validates the input parameters so far.

Fixes piglit's bindfragdata-invalid-parameters test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-08 11:10:07 -08:00
Morgan Armand 0a0d820f7b softpipe: don't clamp or do logical operations on floating-point buffers.
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-11-08 08:36:39 -07:00
Vinson Lee 3210cad3f2 st/mesa: Fix memory leak on error path.
Fixes Coverity resource leak defect.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-11-07 20:41:21 -08:00
Vinson Lee f4515d106c st/dri: Fix memory leak on error path.
Fixes Coverity resource leak defect.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
2011-11-07 20:36:07 -08:00
Dan McCabe 5c02e2e2de glsl: Generate IR for switch statements
Up until now modifying the GLSL compiler has been pretty straightforward.
This is where things get interesting. But still pretty straightforward.

Switch statements can be thought of a series of if/then/else statements.
Case labels are compared with the value of a test expression and the case
statements are executed if the comparison is true.

There are a couple of aspects of switch statements that complicate this simple
view of the world. The primary one is that cases can fall through sequentially
to subsequent case, unless a break statement is encountered, in which case,
the switch statement exits completely.

But break handling is further complicated by the fact that a break statement
can impact the exit of a loop. Thus, we need to coordinate break processing
between switch statements and loop statements.

The code generated by a switch statement maintains three temporary state
variables:
    int test_value;
    bool is_fallthru;
    bool is_break;

test_value is initialized to the value of the test expression at the head of
the switch statement. This is the value that case labels are compared against.

is_fallthru is used to sequentially fall through to subsequent cases and is
initialized to false. When a case label matches the test expression, this
state variable is set to true. It will also be forced to false if a break
statement has been encountered. This forcing to false on break MUST be
after every case test. In practice, we defer that forcing to immediately after
the last case comparison prior to executing a case statement, but that is
an optimization.

is_break is used to indicate that a break statement has been executed and is
initialized to false. When a break statement is encountered, it is set to true.
This state variable is then used to conditionally force is_fallthru to to false
to prevent subsequent case statements from executing.

Code generation for break statements depends on whether the break statement is
inside a switch statement or inside a loop statement. If it inside a loop
statement is inside a break statement, the same code as before gets generated.
But if a switch statement is inside a loop statement, code is emitted to set
the is_break state to true.

Just as ASTs for loop statements are managed in a stack-like
manner to handle nesting, we also add a bool to capture the innermost switch
or loop condition. Note that we still need to maintain a loop AST stack to
properly handle for-loop code generation on a continue statement. Technically,
we don't (yet) need a switch AST stack, but I am using one for orthogonality
with loop statements, in anticipation of future use. Note that a simple
boolean stack would have sufficed.

We will illustrate a switch statement with its analogous conditional code that
a switch statement corresponds to by examining an example.

Consider the following switch statement:
	switch (42) {
	case 0:
	case 1:
		gl_FragColor = vec4(1.0, 2.0, 3.0, 4.0);
	case 2:
	case 3:
		gl_FragColor = vec4(4.0, 3.0, 2.0, 1.0);
		break;
	case 4:
	default:
		gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
	}

Note that case 0 and case 1 fall through to cases 2 and 3 if they occur.

Note that case 4 and the default case must be reached explicitly, since cases
2 and 3 break at the end of their case.

Finally, note that case 4 and the default case don't break but simply fall
through to the end of the switch.

For this code, the equivalent code can be expressed as:
	int test_val = 42; // capture value of test expression
	bool is_fallthru = false; // prevent initial fall through
	bool is_break = false; // capture the execution of a break stmt

	is_fallthru |= (test_val == 0); // enable fallthru on case 0
	is_fallthru |= (test_val == 1); // enable fallthru on case 1
	is_fallthru &= !is_break; // inhibit fallthru on previous break
	if (is_fallthru) {
		gl_FragColor = vec4(1.0, 2.0, 3.0, 4.0);
	}

	is_fallthru |= (test_val == 2); // enable fallthru on case 2
	is_fallthru |= (test_val == 3); // enable fallthru on case 3
	is_fallthru &= !is_break; // inhibit fallthru on previous break
	if (is_fallthru) {
		gl_FragColor = vec4(4.0, 3.0, 2.0, 1.0);
		is_break = true; // inhibit all subsequent fallthru for break
	}

	is_fallthru |= (test_val == 4); // enable fallthru on case 4
	is_fallthru = true; // enable fallthru for default case
	is_fallthru &= !is_break; // inhibit fallthru on previous break
	if (is_fallthru) {
		gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
	}

The code generate for |= and &= uses the conditional assignment capabilities
of the IR.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2011-11-07 16:31:22 -08:00