Compare commits

..

32 Commits

Author SHA1 Message Date
Jeremy Huddleston
a96360a951 apple: Implement applegl_unbind_context
glXMakeCurrent(dpy, None, NULL) would not correctly unbind the context
causing subsequent GLX requests to fail in peculiar ways

http://xquartz.macosforge.org/trac/ticket/514

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 5c44c1348e)
2011-10-24 16:26:46 -07:00
Jeremy Huddleston
c8f2665f02 apple: Silence some debug spew
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit 098ecfad83)
2011-10-24 15:54:31 -07:00
Dave Airlie
1e279de4b0 r600g: bump domain selection up one layer.
this is taken from a patch from Mathias Froehlich, just going to
stage it in a few pieces.

Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit ecc051d65b, see
https://bugs.freedesktop.org/show_bug.cgi?id=40979)
2011-10-03 17:00:35 +02:00
Jeremy Huddleston
7c3cf50d99 Fix PPC detection on darwin
Fixes regression introduced by 7004582c18

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit e737a99a6f)
2011-07-31 09:49:02 -07:00
Paul Berry
7b8e7f4450 glsl: Rewrote _mesa_glsl_process_extension to use table-driven logic.
Instead of using a chain of manually maintained if/else blocks to
handle "#extension" directives, we now consult a table that specifies,
for each extension, the circumstances under which it is available, and
what flags in _mesa_glsl_parse_state need to be set in order to
activate it.

This makes it easier to add new GLSL extensions in the future, and
fixes the following bugs:

- Previously, _mesa_glsl_process_extension would sometimes set the
  "_enable" and "_warn" flags for an extension before checking whether
  the extension was supported by the driver; as a result, specifying
  "enable" behavior for an unsupported extension would sometimes cause
  front-end support for that extension to be switched on in spite of
  the fact that back-end support was not available, leading to strange
  failures, such as those in
  https://bugs.freedesktop.org/show_bug.cgi?id=38015.

- "#extension all: warn" and "#extension all: disable" had no effect.

Notes:

- All extensions are currently marked as unavailable in geometry
  shaders.  This should not have any adverse effects since geometry
  shaders aren't supported yet.  When we return to working on geometry
  shader support, we'll need to update the table for those extensions
  that are available in geometry shaders.

- Previous to this commit, if a shader mentioned
  ARB_shader_texture_lod, extension ARB_texture_rectangle would be
  automatically turned on in order to ensure that the types
  sampler2DRect and sampler2DRectShadow would be defined.  This was
  unnecessary, because (a) ARB_shader_texture_lod works perfectly well
  without those types provided that the builtin functions that
  reference them are not called, and (b) ARB_texture_rectangle is
  enabled by default in non-ES contexts anyway.  I eliminated this
  unnecessary behavior in order to make the behavior of all extensions
  consistent.

Some changes were made in glsl_parser_extras.h during cherry pick to
7.10 because 7.11 and master support many extensions that 7.10 does
not.  The unsupported extensions were removed.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2011-07-20 13:36:46 -07:00
Paul Berry
db3d21d676 glsl: Changed extension enable bits to bools.
These were previously 1-bit-wide bitfields.  Changing them to bools
has a negligible performance impact, and allows them to be accessed by
offset as well as by direct structure access.

Some changes were made in glsl_parser_extras.h during cherry pick to
7.10 because 7.11 and master support many extensions that 7.10 does
not.  The unsupported extensions were removed.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 9c4445de6e)
2011-07-20 13:36:46 -07:00
Paul Berry
0a838d1d32 glsl: Ensure that sampler declarations are always uniform or "in" parameters.
This brings us into compliance with page 17 (page 22 of the PDF) of
the GLSL 1.20 spec:

    "[Sampler types] can only be declared as function parameters or
    uniform variables (see Section 4.3.5 "Uniform"). ... [Samplers]
    cannot be used as out or inout function parameters."

The spec isn't explicit about whether this rule applies to
structs/arrays containing shaders, but the intent seems to be to
ensure that it can always be determined at compile time which sampler
is being used in each texture lookup.  So to avoid creating a
loophole, the rule needs to apply to structs/arrays containing shaders
as well.

Fixes piglit tests spec/glsl-1.10/compiler/samplers/*.frag, and fixes
bug 38987.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38987
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit f07221056e)
2011-07-20 13:36:46 -07:00
Paul Berry
94a1fe1fd8 glsl: Move type_contains_sampler() into glsl_type for later reuse.
The new location, as a member function of glsl_type, is more
consistent with queries like is_sampler(), is_boolean(), is_float(),
etc.  Placing the function inside glsl_type also makes it available to
any code that uses glsl_types.
(cherry picked from commit ddc1c96390)
2011-07-20 13:36:46 -07:00
Ian Romanick
f2ef6036e8 linker: Only over-ride built-ins when a prototype has been seen
The GLSL spec says:

    "If a built-in function is redeclared in a shader (i.e., a
    prototype is visible) before a call to it, then the linker will
    only attempt to resolve that call within the set of shaders that
    are linked with it."

This patch enforces this behavior.  When a function call is processed
a flag is set in the ir_call to indicate whether the previously seen
prototype is the built-in or not.  At link time a call will only bind
to an instance of a function that matches the "want built-in" setting
in the ir_call.

This has the odd side effect that first call to abs() in the shader
below will call the built-in and the second will not:

float foo(float x) { return abs(x); }
float abs(float x) { return -x; }
float bar(float x) { return abs(x); }

This seems insane, but it matches what the spec says.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31744
(cherry picked from commit 66f4ac988d)
2011-07-20 13:36:45 -07:00
Henri Verbeet
f81058140f glx: Avoid calling __glXInitialize() in driReleaseDrawables().
This fixes a regression introduced by commit
a26121f375 (fd.o bug #39219).

Since the __glXInitialize() call should be unnecessary anyway, this is
probably a nicer fix for the original problem too.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: padfoot@exemail.com.au
(cherry picked from commit 0f20e2e18f)
2011-07-19 23:34:55 +02:00
Marek Olšák
3871c55a18 swrast: fix depth/stencil blits when there's no colorbuffer
NOTE: This is a candidate for the 7.10 and 7.11 branches.
(cherry picked from commit d1214cca08)
2011-07-11 22:59:48 +02:00
Marek Olšák
7a75fcd657 mesa: return early if mask is cleared to zero in BlitFramebuffer
From ARB_framebuffer_object:
    If a buffer is specified in <mask> and does not exist in both the
    read and draw framebuffers, the corresponding bit is silently
    ignored.
(cherry picked from commit 83478e5d59)
2011-07-11 22:59:38 +02:00
Marek Olšák
e041956cb2 st/mesa: use the first non-VOID channel in st_format_datatype
Otherwise PIPE_FORMAT_X8B8G8R8_UNORM and friends would fail.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 292148dc4b)
2011-07-08 13:24:25 +02:00
Ian Romanick
c286f7870f linker: Assign locations for fragment shader output
Fixes an assertion failure in the piglib out-01.frag
ARB_explicit_attrib_location test.  The locations set via the layout
qualifier in fragment shader were not being applied to the shader
outputs.  As a result all of these variables still had a location of
-1 set.

This may need some more work for pre-3.0 contexts.  The problem is
dealing with generic outputs that lack a layout qualifier.  There is
no way for the application to specify a location
(glBindFragDataLocation is not supported) or query the location
assigned by the linker (glGetFragDataLocation is not supported).

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38624
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Vinson Lee <vlee@vmware.com>
(cherry picked from commit d32d4f780f)
2011-07-07 14:06:01 -07:00
Paul Berry
4e2a5d013d glsl: permit explicit locations on fragment shader outputs, not inputs
From the OpenGL docs for GL_ARB_explicit_attrib_location:

    This extension provides a method to pre-assign attribute locations to
    named vertex shader inputs and color numbers to named fragment shader
    outputs.

This was accidentally implemented for fragment shader inputs.  This
patch fixes it to apply to fragment shader outputs.

Fixes piglit tests
spec/ARB_explicit_attrib_location/1.{10,20}/compiler/layout-{01,03,06,07,08,09,10}.frag

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38624
(cherry picked from commit b078aad8ab)
2011-07-07 14:06:00 -07:00
Ian Romanick
cd73c06eed glsl: Don't choke when printing an anonymous function parameter
This is based on commit 174cef7fee, but
the code is heavily changed.  The original commit modifies
ir_print_visitor::unique_name, but there is no such method in 7.10.
Instead, this code just modifies ir_print_visitor::visit(ir_variable
*ir) to "do the right thing" when ir_variable::name is NULL.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38584
2011-07-06 17:24:54 -07:00
Ian Romanick
7424f9c1fe ir_to_mesa: Allocate temporary instructions on the visitor's ralloc context
And don't delete them.  Let ralloc clean them up.  Deleting the
temporary IR leaves dangling references in the prog_instruction.  That
results in a bad dereference when printing the IR with MESA_GLSL=dump.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38584
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit dbda466fc0)
2011-07-06 17:17:34 -07:00
Ian Romanick
cb6dd6c399 glsl: Track initial mask in constant propagation live set
The set of values initially available (before any kills) must be
tracked with each constant in the set.  Otherwise the wrong component
can be selected after earlier components have been killed.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37383
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Matthias Bentrup <matthias.bentrup@googlemail.com>
(cherry picked from commit 0eb9797958)
2011-07-06 17:17:25 -07:00
Ian Romanick
85b965b462 linker: Reject shaders that use too many varyings
Previously it was up to the driver or later code generator to reject
these shaders.  It turns out that nobody did this.

This will need changes to support geometry shaders.

NOTE: This is a candidate for the stable branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37743
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit de77324d8f)
2011-06-27 16:39:43 -07:00
Marek Olšák
459012b148 r600g: bump shader input limits
(cherry picked from commit 1e5cef96d1)
2011-06-27 16:39:43 -07:00
Ben Skeggs
bd40e7cebd nouveau: fix includes for latest libdrm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
(cherry picked from commit 5c102dd94f)
2011-06-26 18:09:23 +02:00
Marek Olšák
9370ddde85 r300g: drop support for ARGB, ABGR, XRGB, XBGR render targets
Blending and maybe even alpha-test don't work with those formats.

Only supporting RGBA, BGRA, RGBX, BGRX.

NOTE: This is a candidate for the 7.10 and 7.11 branches.
(cherry picked from commit bc517d64da)

Conflicts:

	src/gallium/drivers/r300/r300_texture.c
2011-06-25 20:01:23 +02:00
Marek Olšák
26ab29cf79 mesa: fix a memory leak in _mesa_unpack_depth_span
NOTE: This is a candidate for the 7.10 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 12c105b5de)
2011-06-24 23:18:54 +02:00
Marek Olšák
a312052add mesa: fix texstore of DEPTH24_STENCIL8 if srcFormat is STENCIL_INDEX
NOTE: This is a candidate for the 7.10 branch.
(cherry picked from commit e41a91cea7)
2011-06-24 23:17:34 +02:00
Brian Paul
6128739b75 st/wgl: return height, not width for WGL_PBUFFER_HEIGHT_ARB
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38599
(cherry picked from commit 8a5a28b731)
2011-06-23 06:56:46 -06:00
Alex Deucher
bc46f0c969 r600c: add missing bank tiling case for evergreen
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-06-22 16:51:58 -04:00
Marek Olšák
1ad06c7a25 r300g: fix handling PREP_* options
This should fix rendering >65532 vertices using draw_arrays on r300-r400.

NOTE: This is a candidate for the 7.10 branch.
(cherry picked from commit 7df7eaf845)

Conflicts:

	src/gallium/drivers/r300/r300_render.c
2011-06-18 22:59:28 +02:00
Alex Deucher
bdc518e341 r600c: add tiling support for evergreen+
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
2011-06-14 18:47:11 -04:00
Jeremy Huddleston
338e8e5f14 apple: Dead code removal
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit e903cc17bb)
(cherry picked from commit 5078cb6858)
2011-06-13 23:23:09 -07:00
Jeremy Huddleston
5255e844af apple: applegl_destroy_context: Pass along the correct display
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
(cherry picked from commit c6cf82fb55)
2011-06-13 21:41:26 -07:00
Brian Paul
45f369c74d docs: fix 'release release' typos 2011-06-13 18:29:44 -06:00
Ian Romanick
39ad7dc7b1 docs: Add 7.10.3 md5sums 2011-06-13 16:53:24 -07:00
38 changed files with 679 additions and 312 deletions

View File

@@ -15,21 +15,21 @@
<p>
<a href="relnotes-7.10.3.html">Mesa 7.10.3</a> is released. This is a bug
fix release release.
fix release.
</p>
<h2>April 6, 2011</h2>
<p>
<a href="relnotes-7.10.2.html">Mesa 7.10.2</a> is released. This is a bug
fix release release.
fix release.
</p>
<h2>March 2, 2011</h2>
<p>
<a href="relnotes-7.10.1.html">Mesa 7.10.1</a> is released. This is a bug
fix release release.
fix release.
</p>
<p>

View File

@@ -28,7 +28,12 @@ for DRI hardware acceleration.
<h2>MD5 checksums</h2>
<pre>
tbd
d77b02034c11d6c2a55c07f82367d780 MesaLib-7.10.3.tar.gz
8c38fe8266be8e1ed1d84076ba5a703b MesaLib-7.10.3.tar.bz2
614d063ecd170940d9ae7b355d365d59 MesaLib-7.10.3.zip
8768fd562ede7ed763d92b2d22232d7a MesaGLUT-7.10.3.tar.gz
1496415b89da9549f0f3b34d9622e2e2 MesaGLUT-7.10.3.tar.bz2
1f29d0e7398fd3bf9f36f5db02941198 MesaGLUT-7.10.3.zip
</pre>

View File

@@ -10,7 +10,7 @@
#include "nouveau/nouveau_grobj.h"
#include "nouveau/nouveau_notifier.h"
#include "nouveau/nouveau_resource.h"
#include "nouveau/nouveau_pushbuf.h"
#include "nouveau/nv04_pushbuf.h"
#ifndef NV04_PFIFO_MAX_PACKET_LEN
#define NV04_PFIFO_MAX_PACKET_LEN 2047

View File

@@ -22,7 +22,7 @@
#define __NOUVEAU_PUSH_H__
#include <stdint.h>
#include "nouveau/nouveau_pushbuf.h"
#include "nouveau/nv04_pushbuf.h"
#include "nv50_context.h"
#include "nv50_resource.h"
#include "pipe/p_defines.h"

View File

@@ -34,11 +34,11 @@
#include <stdio.h>
#include <stdint.h>
#include <nouveau/nouveau_device.h>
#include <nouveau/nouveau_pushbuf.h>
#include <nouveau/nouveau_channel.h>
#include <nouveau/nouveau_bo.h>
#include <nouveau/nouveau_notifier.h>
#include <nouveau/nouveau_grobj.h>
#include <nouveau/nv04_pushbuf.h>
#include "nv04_2d.h"
#include "nouveau/nv_object.xml.h"

View File

@@ -9,8 +9,7 @@
#include "nvfx_resource.h"
#include "nouveau/nouveau_channel.h"
#include "nouveau/nouveau_pushbuf.h"
#include "nouveau/nv04_pushbuf.h"
static inline unsigned
util_guess_unique_indices_count(unsigned mode, unsigned indices)

View File

@@ -184,23 +184,22 @@ static boolean r300_reserve_cs_dwords(struct r300_context *r300,
unsigned cs_dwords)
{
boolean flushed = FALSE;
boolean first_draw = flags & PREP_FIRST_DRAW;
boolean emit_aos = flags & PREP_EMIT_AOS;
boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
boolean emit_states = flags & PREP_FIRST_DRAW;
boolean emit_vertex_arrays = flags & PREP_EMIT_AOS;
boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_AOS_SWTCL;
/* Add dirty state, index offset, and AOS. */
if (first_draw) {
if (emit_states)
cs_dwords += r300_get_num_dirty_dwords(r300);
if (r300->screen->caps.index_bias_supported)
cs_dwords += 2; /* emit_index_offset */
if (r300->screen->caps.index_bias_supported)
cs_dwords += 2; /* emit_index_offset */
if (emit_aos)
cs_dwords += 55; /* emit_aos */
if (emit_vertex_arrays)
cs_dwords += 55; /* emit_vertex_arrays */
if (emit_aos_swtcl)
cs_dwords += 7; /* emit_aos_swtcl */
}
if (emit_vertex_arrays_swtcl)
cs_dwords += 7; /* emit_vertex_arrays_swtcl */
cs_dwords += r300_get_num_cs_end_dwords(r300);
@@ -228,14 +227,13 @@ static boolean r300_emit_states(struct r300_context *r300,
int aos_offset,
int index_bias)
{
boolean first_draw = flags & PREP_FIRST_DRAW;
boolean emit_aos = flags & PREP_EMIT_AOS;
boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
boolean emit_states = flags & PREP_FIRST_DRAW;
boolean emit_vertex_arrays = flags & PREP_EMIT_AOS;
boolean emit_vertex_arrays_swtcl = flags & PREP_EMIT_AOS_SWTCL;
boolean indexed = flags & PREP_INDEXED;
boolean validate_vbos = flags & PREP_VALIDATE_VBOS;
/* Validate buffers and emit dirty state if needed. */
if (first_draw) {
if (emit_states) {
/* upload buffers first */
if (r300->screen->caps.has_tcl && r300->any_user_vbs) {
r300_upload_user_buffers(r300);
@@ -257,20 +255,21 @@ static boolean r300_emit_states(struct r300_context *r300,
}
r300_emit_dirty_state(r300);
if (r300->screen->caps.index_bias_supported) {
if (r300->screen->caps.has_tcl)
r500_emit_index_bias(r300, index_bias);
else
r500_emit_index_bias(r300, 0);
}
if (emit_aos)
r300_emit_aos(r300, aos_offset, indexed);
if (emit_aos_swtcl)
r300_emit_aos_swtcl(r300, indexed);
}
if (r300->screen->caps.index_bias_supported) {
if (r300->screen->caps.has_tcl)
r500_emit_index_bias(r300, index_bias);
else
r500_emit_index_bias(r300, 0);
}
if (emit_vertex_arrays)
r300_emit_aos(r300, aos_offset, indexed);
if (emit_vertex_arrays_swtcl)
r300_emit_aos_swtcl(r300, indexed);
return TRUE;
}

View File

@@ -391,19 +391,15 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
/* 32-bit buffers. */
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_X8R8G8B8_UNORM:
case PIPE_FORMAT_A8B8G8R8_UNORM:
/*case PIPE_FORMAT_B8G8R8X8_SNORM:*/
case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8A8_SNORM:
case PIPE_FORMAT_X8B8G8R8_UNORM:
case PIPE_FORMAT_R8G8B8X8_UNORM:
case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
return R300_COLOR_FORMAT_ARGB8888;
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_R10G10B10X2_SNORM:
case PIPE_FORMAT_B10G10R10A2_UNORM:
case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
return R500_COLOR_FORMAT_ARGB2101010; /* R5xx-only? */
/* 64-bit buffers. */
@@ -527,27 +523,11 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
R300_C0_SEL_B | R300_C1_SEL_G |
R300_C2_SEL_R | R300_C3_SEL_A;
/* ARGB outputs. */
case PIPE_FORMAT_A8R8G8B8_UNORM:
case PIPE_FORMAT_X8R8G8B8_UNORM:
return modifier |
R300_C0_SEL_A | R300_C1_SEL_R |
R300_C2_SEL_G | R300_C3_SEL_B;
/* ABGR outputs. */
case PIPE_FORMAT_A8B8G8R8_UNORM:
case PIPE_FORMAT_X8B8G8R8_UNORM:
return modifier |
R300_C0_SEL_A | R300_C1_SEL_B |
R300_C2_SEL_G | R300_C3_SEL_R;
/* RGBA outputs. */
case PIPE_FORMAT_R8G8B8X8_UNORM:
case PIPE_FORMAT_R8G8B8A8_SNORM:
case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
case PIPE_FORMAT_R10G10B10A2_UNORM:
case PIPE_FORMAT_R10G10B10X2_SNORM:
case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_R16G16B16A16_FLOAT:

View File

@@ -367,9 +367,9 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
return 8; /* FIXME */
case PIPE_SHADER_CAP_MAX_INPUTS:
if(shader == PIPE_SHADER_FRAGMENT)
return 10;
return 34;
else
return 16;
return 32;
case PIPE_SHADER_CAP_MAX_TEMPS:
return 256; //max native temporaries
case PIPE_SHADER_CAP_MAX_ADDRS:

View File

@@ -99,9 +99,9 @@
#endif
#endif
#if defined(__PPC__)
#if defined(__ppc__) || defined(__ppc64__) || defined(__PPC__)
#define PIPE_ARCH_PPC
#if defined(__PPC64__)
#if defined(__ppc64__) || defined(__PPC64__)
#define PIPE_ARCH_PPC_64
#endif
#endif

View File

@@ -268,7 +268,7 @@ wglQueryPbufferARB(HPBUFFERARB hPbuffer,
*piValue = fb->width;
return TRUE;
case WGL_PBUFFER_HEIGHT_ARB:
*piValue = fb->width;
*piValue = fb->height;
return TRUE;
case WGL_PBUFFER_LOST_ARB:
/* We assume that no content is ever lost due to display mode change */

View File

@@ -38,7 +38,8 @@ struct r600_bo *r600_bo(struct radeon *radeon,
{
struct r600_bo *bo;
struct radeon_bo *rbo;
uint32_t initial_domain;
if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) {
bo = r600_bomgr_bo_create(radeon->bomgr, size, alignment, *radeon->cfence);
if (bo) {
@@ -46,7 +47,24 @@ struct r600_bo *r600_bo(struct radeon *radeon,
}
}
rbo = radeon_bo(radeon, 0, size, alignment);
if (binding & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER)) {
initial_domain = RADEON_GEM_DOMAIN_GTT;
} else {
switch(usage) {
case PIPE_USAGE_DYNAMIC:
case PIPE_USAGE_STREAM:
case PIPE_USAGE_STAGING:
initial_domain = RADEON_GEM_DOMAIN_GTT;
break;
case PIPE_USAGE_DEFAULT:
case PIPE_USAGE_STATIC:
case PIPE_USAGE_IMMUTABLE:
default:
initial_domain = RADEON_GEM_DOMAIN_VRAM;
break;
}
}
rbo = radeon_bo(radeon, 0, size, alignment, initial_domain);
if (rbo == NULL) {
return NULL;
}
@@ -80,7 +98,7 @@ struct r600_bo *r600_bo_handle(struct radeon *radeon,
struct r600_bo *bo = calloc(1, sizeof(struct r600_bo));
struct radeon_bo *rbo;
rbo = bo->bo = radeon_bo(radeon, handle, 0, 0);
rbo = bo->bo = radeon_bo(radeon, handle, 0, 0, 0);
if (rbo == NULL) {
free(bo);
return NULL;

View File

@@ -116,7 +116,7 @@ unsigned radeon_family_from_device(unsigned device);
* radeon_bo.c
*/
struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
unsigned size, unsigned alignment);
unsigned size, unsigned alignment, unsigned initial_domain);
void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst,
struct radeon_bo *src);
int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);

View File

@@ -69,7 +69,7 @@ static void radeon_bo_fixed_unmap(struct radeon *radeon, struct radeon_bo *bo)
}
struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
unsigned size, unsigned alignment)
unsigned size, unsigned alignment, unsigned initial_domain)
{
struct radeon_bo *bo;
int r;
@@ -102,7 +102,7 @@ struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
args.size = size;
args.alignment = alignment;
args.initial_domain = RADEON_GEM_DOMAIN_CPU;
args.initial_domain = initial_domain;
args.flags = 0;
args.handle = 0;
r = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_CREATE,

View File

@@ -1918,7 +1918,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
break;
case fragment_shader:
if (!global_scope || (var->mode != ir_var_in)) {
if (!global_scope || (var->mode != ir_var_out)) {
fail = true;
string = "output";
}
@@ -2496,6 +2496,17 @@ ast_declarator_list::hir(exec_list *instructions,
: "and integer");
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
*
* "[Sampler types] can only be declared as function
* parameters or uniform variables (see Section 4.3.5
* "Uniform")".
*/
if (var_type->contains_sampler() &&
!this->type->qualifier.flags.q.uniform) {
_mesa_glsl_error(&loc, state, "samplers must be declared uniform");
}
/* Process the initializer and add its instructions to a temporary
* list. This list will be added to the instruction stream (below) after
* the declaration is added. This is done because in some cases (such as
@@ -2656,6 +2667,18 @@ ast_parameter_declarator::hir(exec_list *instructions,
*/
apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc);
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
*
* "Samplers cannot be treated as l-values; hence cannot be used
* as out or inout function parameters, nor can they be assigned
* into."
*/
if ((var->mode == ir_var_inout || var->mode == ir_var_out)
&& type->contains_sampler()) {
_mesa_glsl_error(&loc, state, "out and inout parameters cannot contain samplers");
type = glsl_type::error_type;
}
instructions->push_tail(var);
/* Parameter declarations do not have r-values.
@@ -2784,6 +2807,18 @@ ast_function::hir(exec_list *instructions,
"function `%s' return type has qualifiers", name);
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
*
* "[Sampler types] can only be declared as function parameters
* or uniform variables (see Section 4.3.5 "Uniform")".
*/
if (return_type->contains_sampler()) {
YYLTYPE loc = this->get_location();
_mesa_glsl_error(&loc, state,
"function `%s' return type can't contain a sampler",
name);
}
/* Verify that this function's signature either doesn't match a previously
* seen signature for a function with the same name, or, if a match is found,
* that the previously seen signature does not have an associated definition.

View File

@@ -165,95 +165,237 @@ _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
}
bool
_mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
const char *behavior, YYLTYPE *behavior_locp,
_mesa_glsl_parse_state *state)
{
enum {
extension_disable,
extension_enable,
extension_require,
extension_warn
} ext_mode;
/**
* Enum representing the possible behaviors that can be specified in
* an #extension directive.
*/
enum ext_behavior {
extension_disable,
extension_enable,
extension_require,
extension_warn
};
if (strcmp(behavior, "warn") == 0) {
ext_mode = extension_warn;
} else if (strcmp(behavior, "require") == 0) {
ext_mode = extension_require;
} else if (strcmp(behavior, "enable") == 0) {
ext_mode = extension_enable;
} else if (strcmp(behavior, "disable") == 0) {
ext_mode = extension_disable;
} else {
_mesa_glsl_error(behavior_locp, state,
"Unknown extension behavior `%s'",
behavior);
/**
* Element type for _mesa_glsl_supported_extensions
*/
struct _mesa_glsl_extension {
/**
* Name of the extension when referred to in a GLSL extension
* statement
*/
const char *name;
/** True if this extension is available to vertex shaders */
bool avail_in_VS;
/** True if this extension is available to geometry shaders */
bool avail_in_GS;
/** True if this extension is available to fragment shaders */
bool avail_in_FS;
/** True if this extension is available to desktop GL shaders */
bool avail_in_GL;
/** True if this extension is available to GLES shaders */
bool avail_in_ES;
/**
* Flag in the gl_extensions struct indicating whether this
* extension is supported by the driver, or
* &gl_extensions::dummy_true if supported by all drivers.
*
* Note: the type (GLboolean gl_extensions::*) is a "pointer to
* member" type, the type-safe alternative to the "offsetof" macro.
* In a nutshell:
*
* - foo bar::* p declares p to be an "offset" to a field of type
* foo that exists within struct bar
* - &bar::baz computes the "offset" of field baz within struct bar
* - x.*p accesses the field of x that exists at "offset" p
* - x->*p is equivalent to (*x).*p
*/
const GLboolean gl_extensions::* supported_flag;
/**
* Flag in the _mesa_glsl_parse_state struct that should be set
* when this extension is enabled.
*
* See note in _mesa_glsl_extension::supported_flag about "pointer
* to member" types.
*/
bool _mesa_glsl_parse_state::* enable_flag;
/**
* Flag in the _mesa_glsl_parse_state struct that should be set
* when the shader requests "warn" behavior for this extension.
*
* See note in _mesa_glsl_extension::supported_flag about "pointer
* to member" types.
*/
bool _mesa_glsl_parse_state::* warn_flag;
bool compatible_with_state(const _mesa_glsl_parse_state *state) const;
void set_flags(_mesa_glsl_parse_state *state, ext_behavior behavior) const;
};
#define EXT(NAME, VS, GS, FS, GL, ES, SUPPORTED_FLAG) \
{ "GL_" #NAME, VS, GS, FS, GL, ES, &gl_extensions::SUPPORTED_FLAG, \
&_mesa_glsl_parse_state::NAME##_enable, \
&_mesa_glsl_parse_state::NAME##_warn }
/**
* Table of extensions that can be enabled/disabled within a shader,
* and the conditions under which they are supported.
*/
static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
/* target availability API availability */
/* name VS GS FS GL ES supported flag */
EXT(ARB_draw_buffers, false, false, true, true, false, dummy_true),
EXT(ARB_explicit_attrib_location, true, false, true, true, false, ARB_explicit_attrib_location),
EXT(ARB_fragment_coord_conventions, true, false, true, true, false, ARB_fragment_coord_conventions),
EXT(ARB_texture_rectangle, true, false, true, true, false, dummy_true),
EXT(EXT_texture_array, true, false, true, true, false, EXT_texture_array),
EXT(ARB_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export),
};
#undef EXT
/**
* Determine whether a given extension is compatible with the target,
* API, and extension information in the current parser state.
*/
bool _mesa_glsl_extension::compatible_with_state(const _mesa_glsl_parse_state *
state) const
{
/* Check that this extension matches the type of shader we are
* compiling to.
*/
switch (state->target) {
case vertex_shader:
if (!this->avail_in_VS) {
return false;
}
break;
case geometry_shader:
if (!this->avail_in_GS) {
return false;
}
break;
case fragment_shader:
if (!this->avail_in_FS) {
return false;
}
break;
default:
assert (!"Unrecognized shader target");
return false;
}
bool unsupported = false;
if (strcmp(name, "all") == 0) {
if ((ext_mode == extension_enable) || (ext_mode == extension_require)) {
_mesa_glsl_error(name_locp, state, "Cannot %s all extensions",
(ext_mode == extension_enable)
? "enable" : "require");
return false;
}
} else if (strcmp(name, "GL_ARB_draw_buffers") == 0) {
/* This extension is only supported in fragment shaders.
*/
if (state->target != fragment_shader) {
unsupported = true;
} else {
state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
}
} else if (strcmp(name, "GL_ARB_explicit_attrib_location") == 0) {
state->ARB_explicit_attrib_location_enable =
(ext_mode != extension_disable);
state->ARB_explicit_attrib_location_warn =
(ext_mode == extension_warn);
unsupported = !state->extensions->ARB_explicit_attrib_location;
} else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) {
state->ARB_fragment_coord_conventions_enable =
(ext_mode != extension_disable);
state->ARB_fragment_coord_conventions_warn =
(ext_mode == extension_warn);
unsupported = !state->extensions->ARB_fragment_coord_conventions;
} else if (strcmp(name, "GL_ARB_texture_rectangle") == 0) {
state->ARB_texture_rectangle_enable = (ext_mode != extension_disable);
state->ARB_texture_rectangle_warn = (ext_mode == extension_warn);
} else if (strcmp(name, "GL_EXT_texture_array") == 0) {
state->EXT_texture_array_enable = (ext_mode != extension_disable);
state->EXT_texture_array_warn = (ext_mode == extension_warn);
unsupported = !state->extensions->EXT_texture_array;
} else if (strcmp(name, "GL_ARB_shader_stencil_export") == 0) {
if (state->target != fragment_shader) {
unsupported = true;
} else {
state->ARB_shader_stencil_export_enable = (ext_mode != extension_disable);
state->ARB_shader_stencil_export_warn = (ext_mode == extension_warn);
unsupported = !state->extensions->ARB_shader_stencil_export;
}
/* Check that this extension matches whether we are compiling
* for desktop GL or GLES.
*/
if (state->es_shader) {
if (!this->avail_in_ES) return false;
} else {
unsupported = true;
if (!this->avail_in_GL) return false;
}
if (unsupported) {
static const char *const fmt = "extension `%s' unsupported in %s shader";
/* Check that this extension is supported by the OpenGL
* implementation.
*
* Note: the ->* operator indexes into state->extensions by the
* offset this->supported_flag. See
* _mesa_glsl_extension::supported_flag for more info.
*/
return state->extensions->*(this->supported_flag);
}
if (ext_mode == extension_require) {
_mesa_glsl_error(name_locp, state, fmt,
name, _mesa_glsl_shader_target_name(state->target));
/**
* Set the appropriate flags in the parser state to establish the
* given behavior for this extension.
*/
void _mesa_glsl_extension::set_flags(_mesa_glsl_parse_state *state,
ext_behavior behavior) const
{
/* Note: the ->* operator indexes into state by the
* offsets this->enable_flag and this->warn_flag. See
* _mesa_glsl_extension::supported_flag for more info.
*/
state->*(this->enable_flag) = (behavior != extension_disable);
state->*(this->warn_flag) = (behavior == extension_warn);
}
/**
* Find an extension by name in _mesa_glsl_supported_extensions. If
* the name is not found, return NULL.
*/
static const _mesa_glsl_extension *find_extension(const char *name)
{
for (unsigned i = 0; i < Elements(_mesa_glsl_supported_extensions); ++i) {
if (strcmp(name, _mesa_glsl_supported_extensions[i].name) == 0) {
return &_mesa_glsl_supported_extensions[i];
}
}
return NULL;
}
bool
_mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
const char *behavior_string, YYLTYPE *behavior_locp,
_mesa_glsl_parse_state *state)
{
ext_behavior behavior;
if (strcmp(behavior_string, "warn") == 0) {
behavior = extension_warn;
} else if (strcmp(behavior_string, "require") == 0) {
behavior = extension_require;
} else if (strcmp(behavior_string, "enable") == 0) {
behavior = extension_enable;
} else if (strcmp(behavior_string, "disable") == 0) {
behavior = extension_disable;
} else {
_mesa_glsl_error(behavior_locp, state,
"Unknown extension behavior `%s'",
behavior_string);
return false;
}
if (strcmp(name, "all") == 0) {
if ((behavior == extension_enable) || (behavior == extension_require)) {
_mesa_glsl_error(name_locp, state, "Cannot %s all extensions",
(behavior == extension_enable)
? "enable" : "require");
return false;
} else {
_mesa_glsl_warning(name_locp, state, fmt,
name, _mesa_glsl_shader_target_name(state->target));
for (unsigned i = 0;
i < Elements(_mesa_glsl_supported_extensions); ++i) {
const _mesa_glsl_extension *extension
= &_mesa_glsl_supported_extensions[i];
if (extension->compatible_with_state(state)) {
_mesa_glsl_supported_extensions[i].set_flags(state, behavior);
}
}
}
} else {
const _mesa_glsl_extension *extension = find_extension(name);
if (extension && extension->compatible_with_state(state)) {
extension->set_flags(state, behavior);
} else {
static const char *const fmt = "extension `%s' unsupported in %s shader";
if (behavior == extension_require) {
_mesa_glsl_error(name_locp, state, fmt,
name, _mesa_glsl_shader_target_name(state->target));
return false;
} else {
_mesa_glsl_warning(name_locp, state, fmt,
name, _mesa_glsl_shader_target_name(state->target));
}
}
}

View File

@@ -156,18 +156,18 @@ struct _mesa_glsl_parse_state {
* \name Enable bits for GLSL extensions
*/
/*@{*/
unsigned ARB_draw_buffers_enable:1;
unsigned ARB_draw_buffers_warn:1;
unsigned ARB_explicit_attrib_location_enable:1;
unsigned ARB_explicit_attrib_location_warn:1;
unsigned ARB_fragment_coord_conventions_enable:1;
unsigned ARB_fragment_coord_conventions_warn:1;
unsigned ARB_texture_rectangle_enable:1;
unsigned ARB_texture_rectangle_warn:1;
unsigned EXT_texture_array_enable:1;
unsigned EXT_texture_array_warn:1;
unsigned ARB_shader_stencil_export_enable:1;
unsigned ARB_shader_stencil_export_warn:1;
bool ARB_draw_buffers_enable;
bool ARB_draw_buffers_warn;
bool ARB_explicit_attrib_location_enable;
bool ARB_explicit_attrib_location_warn;
bool ARB_fragment_coord_conventions_enable;
bool ARB_fragment_coord_conventions_warn;
bool ARB_texture_rectangle_enable;
bool ARB_texture_rectangle_warn;
bool EXT_texture_array_enable;
bool EXT_texture_array_warn;
bool ARB_shader_stencil_export_enable;
bool ARB_shader_stencil_export_warn;
/*@}*/
/** Extensions supported by the OpenGL implementation. */

View File

@@ -111,6 +111,22 @@ add_types_to_symbol_table(glsl_symbol_table *symtab,
}
}
bool
glsl_type::contains_sampler() const
{
if (this->is_array()) {
return this->fields.array->contains_sampler();
} else if (this->is_record()) {
for (unsigned int i = 0; i < this->length; i++) {
if (this->fields.structure[i].type->contains_sampler())
return true;
}
return false;
} else {
return this->is_sampler();
}
}
void
glsl_type::generate_100ES_types(glsl_symbol_table *symtab)
{

View File

@@ -295,6 +295,12 @@ struct glsl_type {
return base_type == GLSL_TYPE_SAMPLER;
}
/**
* Query whether or not type is a sampler, or for struct and array
* types, contains a sampler.
*/
bool contains_sampler() const;
/**
* Query whether or not a type is an array
*/

View File

@@ -1023,21 +1023,6 @@ ir_dereference_record::ir_dereference_record(ir_variable *var,
? this->record->type->field_type(field) : glsl_type::error_type;
}
bool type_contains_sampler(const glsl_type *type)
{
if (type->is_array()) {
return type_contains_sampler(type->fields.array);
} else if (type->is_record()) {
for (unsigned int i = 0; i < type->length; i++) {
if (type_contains_sampler(type->fields.structure[i].type))
return true;
}
return false;
} else {
return type->is_sampler();
}
}
bool
ir_dereference::is_lvalue()
{
@@ -1057,7 +1042,7 @@ ir_dereference::is_lvalue()
* as out or inout function parameters, nor can they be
* assigned into."
*/
if (type_contains_sampler(this->type))
if (this->type->contains_sampler())
return false;
return true;

View File

@@ -934,6 +934,7 @@ public:
assert(callee->return_type != NULL);
type = callee->return_type;
actual_parameters->move_nodes_to(& this->actual_parameters);
this->use_builtin = callee->is_builtin;
}
virtual ir_call *clone(void *mem_ctx, struct hash_table *ht) const;
@@ -997,6 +998,9 @@ public:
/* List of ir_rvalue of paramaters passed in this call. */
exec_list actual_parameters;
/** Should this call only bind to a built-in function? */
bool use_builtin;
private:
ir_call()
: callee(NULL)

View File

@@ -104,7 +104,11 @@ void ir_print_visitor::visit(ir_variable *ir)
cent, inv, mode[ir->mode], interp[ir->interpolation]);
print_type(ir->type);
printf(" %s@%p)", ir->name, (void *) ir);
if (ir->name == NULL) {
static unsigned arg = 1;
printf(" parameter@%u)", arg++);
} else
printf(" %s@%p)", ir->name, (void *) ir);
}

View File

@@ -35,7 +35,8 @@
static ir_function_signature *
find_matching_signature(const char *name, const exec_list *actual_parameters,
gl_shader **shader_list, unsigned num_shaders);
gl_shader **shader_list, unsigned num_shaders,
bool use_builtin);
class call_link_visitor : public ir_hierarchical_visitor {
public:
@@ -79,7 +80,8 @@ public:
* final linked shader. If it does, use it as the target of the call.
*/
ir_function_signature *sig =
find_matching_signature(name, &callee->parameters, &linked, 1);
find_matching_signature(name, &callee->parameters, &linked, 1,
ir->use_builtin);
if (sig != NULL) {
ir->set_callee(sig);
return visit_continue;
@@ -89,7 +91,7 @@ public:
* linked. If it's not found there, return an error.
*/
sig = find_matching_signature(name, &ir->actual_parameters, shader_list,
num_shaders);
num_shaders, ir->use_builtin);
if (sig == NULL) {
/* FINISHME: Log the full signature of unresolved function.
*/
@@ -114,7 +116,9 @@ public:
ir_function_signature *linked_sig =
f->exact_matching_signature(&callee->parameters);
if (linked_sig == NULL) {
if ((linked_sig == NULL)
|| ((linked_sig != NULL)
&& (linked_sig->is_builtin != ir->use_builtin))) {
linked_sig = new(linked) ir_function_signature(callee->return_type);
f->add_signature(linked_sig);
}
@@ -245,7 +249,8 @@ private:
*/
ir_function_signature *
find_matching_signature(const char *name, const exec_list *actual_parameters,
gl_shader **shader_list, unsigned num_shaders)
gl_shader **shader_list, unsigned num_shaders,
bool use_builtin)
{
for (unsigned i = 0; i < num_shaders; i++) {
ir_function *const f = shader_list[i]->symbols->get_function(name);
@@ -258,6 +263,13 @@ find_matching_signature(const char *name, const exec_list *actual_parameters,
if ((sig == NULL) || !sig->is_defined)
continue;
/* If this function expects to bind to a built-in function and the
* signature that we found isn't a built-in, keep looking. Also keep
* looking if we expect a non-built-in but found a built-in.
*/
if (use_builtin != sig->is_builtin)
continue;
return sig;
}

View File

@@ -1158,16 +1158,43 @@ find_available_slots(unsigned used_mask, unsigned needed_count)
}
/**
* Assign locations for either VS inputs for FS outputs
*
* \param prog Shader program whose variables need locations assigned
* \param target_index Selector for the program target to receive location
* assignmnets. Must be either \c MESA_SHADER_VERTEX or
* \c MESA_SHADER_FRAGMENT.
* \param max_index Maximum number of generic locations. This corresponds
* to either the maximum number of draw buffers or the
* maximum number of generic attributes.
*
* \return
* If locations are successfully assigned, true is returned. Otherwise an
* error is emitted to the shader link log and false is returned.
*
* \bug
* Locations set via \c glBindFragDataLocation are not currently supported.
* Only locations assigned automatically by the linker, explicitly set by a
* layout qualifier, or explicitly set by a built-in variable (e.g., \c
* gl_FragColor) are supported for fragment shaders.
*/
bool
assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index)
assign_attribute_or_color_locations(gl_shader_program *prog,
unsigned target_index,
unsigned max_index)
{
/* Mark invalid attribute locations as being used.
/* Mark invalid locations as being used.
*/
unsigned used_locations = (max_attribute_index >= 32)
? ~0 : ~((1 << max_attribute_index) - 1);
unsigned used_locations = (max_index >= 32)
? ~0 : ~((1 << max_index) - 1);
gl_shader *const sh = prog->_LinkedShaders[0];
assert(sh->Type == GL_VERTEX_SHADER);
assert((target_index == MESA_SHADER_VERTEX)
|| (target_index == MESA_SHADER_FRAGMENT));
gl_shader *const sh = prog->_LinkedShaders[target_index];
if (sh == NULL)
return true;
/* Operate in a total of four passes.
*
@@ -1184,9 +1211,16 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
* 4. Assign locations to any inputs without assigned locations.
*/
invalidate_variable_locations(sh, ir_var_in, VERT_ATTRIB_GENERIC0);
const int generic_base = (target_index == MESA_SHADER_VERTEX)
? VERT_ATTRIB_GENERIC0 : FRAG_RESULT_DATA0;
if (prog->Attributes != NULL) {
const enum ir_variable_mode direction =
(target_index == MESA_SHADER_VERTEX) ? ir_var_in : ir_var_out;
invalidate_variable_locations(sh, direction, generic_base);
if ((target_index == MESA_SHADER_VERTEX) && (prog->Attributes != NULL)) {
for (unsigned i = 0; i < prog->Attributes->NumParameters; i++) {
ir_variable *const var =
sh->symbols->get_variable(prog->Attributes->Parameters[i].Name);
@@ -1273,15 +1307,15 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
foreach_list(node, sh->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
if ((var == NULL) || (var->mode != ir_var_in))
if ((var == NULL) || (var->mode != direction))
continue;
if (var->explicit_location) {
const unsigned slots = count_attribute_slots(var->type);
const unsigned use_mask = (1 << slots) - 1;
const int attr = var->location - VERT_ATTRIB_GENERIC0;
const int attr = var->location - generic_base;
if ((var->location >= (int)(max_attribute_index + VERT_ATTRIB_GENERIC0))
if ((var->location >= (int)(max_index + generic_base))
|| (var->location < 0)) {
linker_error_printf(prog,
"invalid explicit location %d specified for "
@@ -1289,7 +1323,7 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
(var->location < 0) ? var->location : attr,
var->name);
return false;
} else if (var->location >= VERT_ATTRIB_GENERIC0) {
} else if (var->location >= generic_base) {
used_locations |= (use_mask << attr);
}
}
@@ -1313,14 +1347,16 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
qsort(to_assign, num_attr, sizeof(to_assign[0]), temp_attr::compare);
/* VERT_ATTRIB_GENERIC0 is a psdueo-alias for VERT_ATTRIB_POS. It can only
* be explicitly assigned by via glBindAttribLocation. Mark it as reserved
* to prevent it from being automatically allocated below.
*/
find_deref_visitor find("gl_Vertex");
find.run(sh->ir);
if (find.variable_found())
used_locations |= (1 << 0);
if (target_index == MESA_SHADER_VERTEX) {
/* VERT_ATTRIB_GENERIC0 is a pseudo-alias for VERT_ATTRIB_POS. It can
* only be explicitly assigned by via glBindAttribLocation. Mark it as
* reserved to prevent it from being automatically allocated below.
*/
find_deref_visitor find("gl_Vertex");
find.run(sh->ir);
if (find.variable_found())
used_locations |= (1 << 0);
}
for (unsigned i = 0; i < num_attr; i++) {
/* Mask representing the contiguous slots that will be used by this
@@ -1331,14 +1367,17 @@ assign_attribute_locations(gl_shader_program *prog, unsigned max_attribute_index
int location = find_available_slots(used_locations, to_assign[i].slots);
if (location < 0) {
const char *const string = (target_index == MESA_SHADER_VERTEX)
? "vertex shader input" : "fragment shader output";
linker_error_printf(prog,
"insufficient contiguous attribute locations "
"available for vertex shader input `%s'",
to_assign[i].var->name);
"available for %s `%s'",
string, to_assign[i].var->name);
return false;
}
to_assign[i].var->location = VERT_ATTRIB_GENERIC0 + location;
to_assign[i].var->location = generic_base + location;
used_locations |= (use_mask << location);
}
@@ -1369,8 +1408,9 @@ demote_shader_inputs_and_outputs(gl_shader *sh, enum ir_variable_mode mode)
}
void
assign_varying_locations(struct gl_shader_program *prog,
bool
assign_varying_locations(struct gl_context *ctx,
struct gl_shader_program *prog,
gl_shader *producer, gl_shader *consumer)
{
/* FINISHME: Set dynamically when geometry shader support is added. */
@@ -1426,6 +1466,8 @@ assign_varying_locations(struct gl_shader_program *prog,
}
}
unsigned varying_vectors = 0;
foreach_list(node, consumer->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
@@ -1456,8 +1498,32 @@ assign_varying_locations(struct gl_shader_program *prog,
* value is written by the previous stage.
*/
var->mode = ir_var_auto;
} else {
/* The packing rules are used for vertex shader inputs are also used
* for fragment shader inputs.
*/
varying_vectors += count_attribute_slots(var->type);
}
}
if (ctx->API == API_OPENGLES2 || prog->Version == 100) {
if (varying_vectors > ctx->Const.MaxVarying) {
linker_error_printf(prog, "shader uses too many varying vectors "
"(%u > %u)\n",
varying_vectors, ctx->Const.MaxVarying);
return false;
}
} else {
const unsigned float_components = varying_vectors * 4;
if (float_components > ctx->Const.MaxVarying * 4) {
linker_error_printf(prog, "shader uses too many varying components "
"(%u > %u)\n",
float_components, ctx->Const.MaxVarying * 4);
return false;
}
}
return true;
}
@@ -1608,16 +1674,19 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
assign_uniform_locations(prog);
if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
/* FINISHME: The value of the max_attribute_index parameter is
* FINISHME: implementation dependent based on the value of
* FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
* FINISHME: at least 16, so hardcode 16 for now.
*/
if (!assign_attribute_locations(prog, 16)) {
prog->LinkStatus = false;
goto done;
}
/* FINISHME: The value of the max_attribute_index parameter is
* FINISHME: implementation dependent based on the value of
* FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
* FINISHME: at least 16, so hardcode 16 for now.
*/
if (!assign_attribute_or_color_locations(prog, MESA_SHADER_VERTEX, 16)) {
prog->LinkStatus = false;
goto done;
}
if (!assign_attribute_or_color_locations(prog, MESA_SHADER_FRAGMENT, ctx->Const.MaxDrawBuffers)) {
prog->LinkStatus = false;
goto done;
}
unsigned prev;
@@ -1630,9 +1699,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (prog->_LinkedShaders[i] == NULL)
continue;
assign_varying_locations(prog,
prog->_LinkedShaders[prev],
prog->_LinkedShaders[i]);
if (!assign_varying_locations(ctx, prog,
prog->_LinkedShaders[prev],
prog->_LinkedShaders[i])) {
prog->LinkStatus = false;
goto done;
}
prev = i;
}

View File

@@ -51,11 +51,23 @@ public:
this->var = var;
this->write_mask = write_mask;
this->constant = constant;
this->initial_values = write_mask;
}
acp_entry(const acp_entry *src)
{
this->var = src->var;
this->write_mask = src->write_mask;
this->constant = src->constant;
this->initial_values = src->initial_values;
}
ir_variable *var;
ir_constant *constant;
unsigned write_mask;
/** Mask of values initially available in the constant. */
unsigned initial_values;
};
@@ -172,7 +184,7 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue)
for (int j = 0; j < 4; j++) {
if (j == channel)
break;
if (found->write_mask & (1 << j))
if (found->initial_values & (1 << j))
rhs_channel++;
}
@@ -285,8 +297,7 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions)
/* Populate the initial acp with a constant of the original */
foreach_iter(exec_list_iterator, iter, *orig_acp) {
acp_entry *a = (acp_entry *)iter.get();
this->acp->push_tail(new(this->mem_ctx) acp_entry(a->var, a->write_mask,
a->constant));
this->acp->push_tail(new(this->mem_ctx) acp_entry(a));
}
visit_list_elements(this, instructions);

View File

@@ -332,12 +332,12 @@ XAppleDRICreateSharedBuffer(Display * dpy, int screen, Drawable drawable,
return False;
}
printf("rep.stringLength %d\n", (int) rep.stringLength);
/* printf("rep.stringLength %d\n", (int) rep.stringLength); */
if (rep.stringLength > 0 && rep.stringLength <= pathlen) {
_XReadPad(dpy, path, rep.stringLength);
printf("path: %s\n", path);
/* printf("path: %s\n", path); */
*width = rep.width;
*height = rep.height;
@@ -404,7 +404,7 @@ XAppleDRICreatePixmap(Display * dpy, int screen, Drawable drawable,
if (rep.stringLength > 0 && rep.stringLength <= bufnamesize) {
_XReadPad(dpy, bufname, rep.stringLength);
printf("path: %s\n", bufname);
/* printf("path: %s\n", bufname); */
*width = rep.width;
*height = rep.height;

View File

@@ -43,7 +43,7 @@
static void
applegl_destroy_context(struct glx_context *gc)
{
apple_glx_destroy_context(&gc->driContext, gc->currentDpy);
apple_glx_destroy_context(&gc->driContext, gc->psc->dpy);
}
static int
@@ -65,6 +65,24 @@ applegl_bind_context(struct glx_context *gc, struct glx_context *old,
static void
applegl_unbind_context(struct glx_context *gc, struct glx_context *new)
{
Display *dpy;
bool error;
/* If we don't have a context, then we have nothing to unbind */
if (!gc)
return;
/* If we have a new context, keep this one around and remove it during bind. */
if (new)
return;
dpy = gc->psc->dpy;
error = apple_glx_make_current_context(dpy,
(gc != &dummyContext) ? gc->driContext : NULL,
NULL, None);
apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO");
}
static void
@@ -116,7 +134,6 @@ applegl_create_context(struct glx_screen *psc,
gc->vtable = &applegl_context_vtable;
gc->driContext = NULL;
gc->do_destroy = False;
/* TODO: darwin: Integrate with above to do indirect */
if(apple_glx_create_context(&gc->driContext, dpy, screen, config,

View File

@@ -383,7 +383,7 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
_X_HIDDEN void
driReleaseDrawables(struct glx_context *gc)
{
struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
const struct glx_display *priv = gc->psc->display;
__GLXDRIdrawable *pdraw;
if (priv == NULL)

View File

@@ -343,7 +343,6 @@ struct glx_context
#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_APPLEGL)
void *driContext;
Bool do_destroy;
#endif
/**

View File

@@ -260,25 +260,20 @@ glx_display_free(struct glx_display *priv)
static int
__glXCloseDisplay(Display * dpy, XExtCodes * codes)
{
struct glx_display *priv, **prev, *next;
struct glx_display *priv, **prev;
_XLockMutex(_Xglobal_lock);
prev = &glx_displays;
for (priv = glx_displays; priv; prev = &priv->next, priv = priv->next) {
if (priv->dpy == dpy) {
*prev = priv->next;
break;
}
}
/* Only remove the display from the list after it's destroyed. The cleanup
* code (e.g. driReleaseDrawables()) ends up calling __glXInitialize(),
* which would create a new glx_display while we're trying to destroy this
* one. */
next = priv->next;
glx_display_free(priv);
*prev = next;
_XUnlockMutex(_Xglobal_lock);
glx_display_free(priv);
return 1;
}

View File

@@ -38,7 +38,6 @@
#include <assert.h>
#include "nouveau_device.h"
#include "nouveau_pushbuf.h"
#include "nouveau_grobj.h"
#include "nouveau_channel.h"
#include "nouveau_bo.h"
@@ -46,6 +45,7 @@
#include "nouveau_screen.h"
#include "nouveau_state.h"
#include "nouveau_surface.h"
#include "nv04_pushbuf.h"
#define DRIVER_DATE "20091015"
#define DRIVER_AUTHOR "Nouveau"

View File

@@ -1640,52 +1640,105 @@ radeonCreateScreen2(__DRIscreen *sPriv)
screen->group_bytes = 512;
else
screen->group_bytes = 256;
if (IS_R600_CLASS(screen) && (sPriv->drm_version.minor >= 6) &&
(screen->chip_family < CHIP_FAMILY_CEDAR)) {
ret = radeonGetParam(sPriv, RADEON_INFO_TILE_CONFIG, &temp);
if (ret)
fprintf(stderr, "failed to get tiling info\n");
else {
screen->tile_config = temp;
screen->r7xx_bank_op = 0;
switch((screen->tile_config & 0xe) >> 1) {
case 0:
screen->num_channels = 1;
break;
case 1:
screen->num_channels = 2;
break;
case 2:
screen->num_channels = 4;
break;
case 3:
screen->num_channels = 8;
break;
default:
fprintf(stderr, "bad channels\n");
break;
if (IS_R600_CLASS(screen)) {
if ((sPriv->drm_version.minor >= 6) &&
(screen->chip_family < CHIP_FAMILY_CEDAR)) {
ret = radeonGetParam(sPriv, RADEON_INFO_TILE_CONFIG, &temp);
if (ret)
fprintf(stderr, "failed to get tiling info\n");
else {
screen->tile_config = temp;
screen->r7xx_bank_op = 0;
switch ((screen->tile_config & 0xe) >> 1) {
case 0:
screen->num_channels = 1;
break;
case 1:
screen->num_channels = 2;
break;
case 2:
screen->num_channels = 4;
break;
case 3:
screen->num_channels = 8;
break;
default:
fprintf(stderr, "bad channels\n");
break;
}
switch ((screen->tile_config & 0x30) >> 4) {
case 0:
screen->num_banks = 4;
break;
case 1:
screen->num_banks = 8;
break;
default:
fprintf(stderr, "bad banks\n");
break;
}
switch ((screen->tile_config & 0xc0) >> 6) {
case 0:
screen->group_bytes = 256;
break;
case 1:
screen->group_bytes = 512;
break;
default:
fprintf(stderr, "bad group_bytes\n");
break;
}
}
switch((screen->tile_config & 0x30) >> 4) {
case 0:
screen->num_banks = 4;
break;
case 1:
screen->num_banks = 8;
break;
default:
fprintf(stderr, "bad banks\n");
break;
}
switch((screen->tile_config & 0xc0) >> 6) {
case 0:
screen->group_bytes = 256;
break;
case 1:
screen->group_bytes = 512;
break;
default:
fprintf(stderr, "bad group_bytes\n");
break;
} else if ((sPriv->drm_version.minor >= 7) &&
(screen->chip_family >= CHIP_FAMILY_CEDAR)) {
ret = radeonGetParam(sPriv, RADEON_INFO_TILE_CONFIG, &temp);
if (ret)
fprintf(stderr, "failed to get tiling info\n");
else {
screen->tile_config = temp;
screen->r7xx_bank_op = 0;
switch (screen->tile_config & 0xf) {
case 0:
screen->num_channels = 1;
break;
case 1:
screen->num_channels = 2;
break;
case 2:
screen->num_channels = 4;
break;
case 3:
screen->num_channels = 8;
break;
default:
fprintf(stderr, "bad channels\n");
break;
}
switch ((screen->tile_config & 0xf0) >> 4) {
case 0:
screen->num_banks = 4;
break;
case 1:
screen->num_banks = 8;
break;
case 2:
screen->num_banks = 16;
break;
default:
fprintf(stderr, "bad banks\n");
break;
}
switch ((screen->tile_config & 0xf00) >> 8) {
case 0:
screen->group_bytes = 256;
break;
case 1:
screen->group_bytes = 512;
break;
default:
fprintf(stderr, "bad group_bytes\n");
break;
}
}
}
}

View File

@@ -2447,6 +2447,10 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
}
}
if (!mask) {
return;
}
ASSERT(ctx->Driver.BlitFramebuffer);
ctx->Driver.BlitFramebuffer(ctx,
srcX0, srcY0, srcX1, srcY1,

View File

@@ -4652,6 +4652,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
}
zValues[i] = value & 0xffffff00;
}
free(depthTemp);
return;
}
else {

View File

@@ -3038,10 +3038,12 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
GLint img, row;
ASSERT(dstFormat == MESA_FORMAT_Z24_S8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
srcFormat == GL_DEPTH_COMPONENT ||
srcFormat == GL_STENCIL_INDEX);
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
if (srcFormat != GL_DEPTH_COMPONENT && ctx->Pixel.DepthScale == 1.0f &&
if (srcFormat == GL_DEPTH_STENCIL && ctx->Pixel.DepthScale == 1.0f &&
ctx->Pixel.DepthBias == 0.0f &&
!srcPacking->SwapBytes) {
/* simple path */
@@ -3052,7 +3054,8 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS)
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
else if (srcFormat == GL_DEPTH_COMPONENT) {
else if (srcFormat == GL_DEPTH_COMPONENT ||
srcFormat == GL_STENCIL_INDEX) {
/* In case we only upload depth we need to preserve the stencil */
for (img = 0; img < srcDepth; img++) {
GLuint *dstRow = (GLuint *) dstAddr

View File

@@ -827,48 +827,44 @@ ir_to_mesa_visitor::visit(ir_loop *ir)
ir_dereference_variable *counter = NULL;
if (ir->counter != NULL)
counter = new(ir) ir_dereference_variable(ir->counter);
counter = new(mem_ctx) ir_dereference_variable(ir->counter);
if (ir->from != NULL) {
assert(ir->counter != NULL);
ir_assignment *a = new(ir) ir_assignment(counter, ir->from, NULL);
ir_assignment *a =
new(mem_ctx) ir_assignment(counter, ir->from, NULL);
a->accept(this);
delete a;
}
ir_to_mesa_emit_op0(NULL, OPCODE_BGNLOOP);
if (ir->to) {
ir_expression *e =
new(ir) ir_expression(ir->cmp, glsl_type::bool_type,
counter, ir->to);
ir_if *if_stmt = new(ir) ir_if(e);
new(mem_ctx) ir_expression(ir->cmp, glsl_type::bool_type,
counter, ir->to);
ir_if *if_stmt = new(mem_ctx) ir_if(e);
ir_loop_jump *brk = new(ir) ir_loop_jump(ir_loop_jump::jump_break);
ir_loop_jump *brk =
new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break);
if_stmt->then_instructions.push_tail(brk);
if_stmt->accept(this);
delete if_stmt;
delete e;
delete brk;
}
visit_exec_list(&ir->body_instructions, this);
if (ir->increment) {
ir_expression *e =
new(ir) ir_expression(ir_binop_add, counter->type,
counter, ir->increment);
new(mem_ctx) ir_expression(ir_binop_add, counter->type,
counter, ir->increment);
ir_assignment *a = new(ir) ir_assignment(counter, e, NULL);
ir_assignment *a =
new(mem_ctx) ir_assignment(counter, e, NULL);
a->accept(this);
delete a;
delete e;
}
ir_to_mesa_emit_op0(NULL, OPCODE_ENDLOOP);

View File

@@ -67,10 +67,18 @@ GLenum
st_format_datatype(enum pipe_format format)
{
const struct util_format_description *desc;
int i;
desc = util_format_description(format);
assert(desc);
/* Find the first non-VOID channel. */
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN) {
if (format == PIPE_FORMAT_B5G5R5A1_UNORM ||
format == PIPE_FORMAT_B5G6R5_UNORM) {
@@ -84,21 +92,26 @@ st_format_datatype(enum pipe_format format)
}
else {
const GLuint size = format_max_bits(format);
assert(i < 4);
if (i == 4)
return GL_NONE;
if (size == 8) {
if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED)
if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)
return GL_UNSIGNED_BYTE;
else
return GL_BYTE;
}
else if (size == 16) {
if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED)
if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)
return GL_UNSIGNED_SHORT;
else
return GL_SHORT;
}
else {
assert( size <= 32 );
if (desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED)
if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)
return GL_UNSIGNED_INT;
else
return GL_INT;

View File

@@ -568,9 +568,6 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
};
GLint i;
if (!ctx->DrawBuffer->_NumColorDrawBuffers)
return;
if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1,
&dstX0, &dstY0, &dstX1, &dstY1)) {
return;