summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-03-20 14:19:10 +1000
committerDave Airlie <airlied@redhat.com>2015-03-20 14:34:31 +1000
commitaca150b35bbffd57ab93223ba4dffe8e4e02da2a (patch)
tree6773688bbab7469d48f8fefb2d616fd3d3159d8b
parent484353ae8ceb72757dcc4b91b2afff8e2b189450 (diff)
renderer: move explicit locations hack into shader cfg
-rw-r--r--src/vrend_renderer.c7
-rw-r--r--src/vrend_shader.c6
-rw-r--r--src/vrend_shader.h1
3 files changed, 7 insertions, 7 deletions
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 61d17a9..1ba7f74 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -61,7 +61,6 @@ static void vrend_update_frontface_state(struct vrend_context *ctx);
static void vrender_get_glsl_version(int *glsl_version);
static void vrend_destroy_resource_object(void *obj_ptr);
static void vrend_renderer_detach_res_ctx_p(struct vrend_context *ctx, int res_handle);
-extern int vrend_shader_use_explicit;
int vrend_dump_shaders;
@@ -111,6 +110,8 @@ struct global_renderer_state {
bool have_bit_encoding;
bool have_vertex_attrib_binding;
+ /* these appeared broken on at least one driver */
+ bool use_explicit_locations;
uint32_t max_uniform_blocks;
struct list_head active_ctx_list;
};
@@ -2292,7 +2293,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
continue;
}
- if (vrend_shader_use_explicit || vrend_state.have_vertex_attrib_binding) {
+ if (vrend_state.use_explicit_locations || vrend_state.have_vertex_attrib_binding) {
loc = i;
} else {
if (ctx->sub->prog->attrib_locs) {
@@ -3570,7 +3571,7 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de
grctx->res_hash = vrend_object_init_ctx_table();
grctx->shader_cfg.use_core_profile = vrend_state.use_core_profile;
-
+ grctx->shader_cfg.use_explicit_locations = vrend_state.use_explicit_locations;
vrend_renderer_create_sub_ctx(grctx, 0);
vrend_renderer_set_sub_ctx(grctx, 0);
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 1135390..bd79936 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -42,8 +42,6 @@ extern int vrend_dump_shaders;
#define INTERP_PREFIX " "
-int vrend_shader_use_explicit = 0;
-
struct vrend_shader_io {
unsigned name;
unsigned gpr;
@@ -1857,7 +1855,7 @@ static char *emit_header(struct dump_ctx *ctx, char *glsl_hdr)
STRCAT_WITH_RET(glsl_hdr, "#version 140\n");
else
STRCAT_WITH_RET(glsl_hdr, "#version 130\n");
- if (ctx->prog_type == TGSI_PROCESSOR_VERTEX && vrend_shader_use_explicit)
+ if (ctx->prog_type == TGSI_PROCESSOR_VERTEX && ctx->cfg->use_explicit_locations)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_explicit_attrib_location : enable\n");
if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT && fs_emit_layout(ctx))
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_fragment_coord_conventions : enable\n");
@@ -1954,7 +1952,7 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
}
for (i = 0; i < ctx->num_inputs; i++) {
if (!ctx->inputs[i].glsl_predefined_no_emit) {
- if (ctx->prog_type == TGSI_PROCESSOR_VERTEX && vrend_shader_use_explicit) {
+ if (ctx->prog_type == TGSI_PROCESSOR_VERTEX && ctx->cfg->use_explicit_locations) {
snprintf(buf, 255, "layout(location=%d) ", ctx->inputs[i].first);
STRCAT_WITH_RET(glsl_hdr, buf);
}
diff --git a/src/vrend_shader.h b/src/vrend_shader.h
index 5e27c5f..d21b5f1 100644
--- a/src/vrend_shader.h
+++ b/src/vrend_shader.h
@@ -67,6 +67,7 @@ struct vrend_shader_key {
struct vrend_shader_cfg {
int glsl_version;
bool use_core_profile;
+ bool use_explicit_locations;
};
bool vrend_patch_vertex_shader_interpolants(char *program,