Compare commits
32 Commits
mesa-7.10.
...
7.10
Author | SHA1 | Date | |
---|---|---|---|
|
a96360a951 | ||
|
c8f2665f02 | ||
|
1e279de4b0 | ||
|
7c3cf50d99 | ||
|
7b8e7f4450 | ||
|
db3d21d676 | ||
|
0a838d1d32 | ||
|
94a1fe1fd8 | ||
|
f2ef6036e8 | ||
|
f81058140f | ||
|
3871c55a18 | ||
|
7a75fcd657 | ||
|
e041956cb2 | ||
|
c286f7870f | ||
|
4e2a5d013d | ||
|
cd73c06eed | ||
|
7424f9c1fe | ||
|
cb6dd6c399 | ||
|
85b965b462 | ||
|
459012b148 | ||
|
bd40e7cebd | ||
|
9370ddde85 | ||
|
26ab29cf79 | ||
|
a312052add | ||
|
6128739b75 | ||
|
bc46f0c969 | ||
|
1ad06c7a25 | ||
|
bdc518e341 | ||
|
338e8e5f14 | ||
|
5255e844af | ||
|
45f369c74d | ||
|
39ad7dc7b1 |
@@ -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>
|
||||
|
@@ -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>
|
||||
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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"
|
||||
|
@@ -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"
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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:
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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 */
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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,
|
||||
|
@@ -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.
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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. */
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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,
|
||||
|
@@ -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)
|
||||
|
@@ -343,7 +343,6 @@ struct glx_context
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && defined(GLX_USE_APPLEGL)
|
||||
void *driContext;
|
||||
Bool do_destroy;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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"
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
|
@@ -4652,6 +4652,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
|
||||
}
|
||||
zValues[i] = value & 0xffffff00;
|
||||
}
|
||||
free(depthTemp);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user