summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-12-06 15:24:23 -0500
committerRob Clark <[email protected]>2014-12-09 18:03:01 -0500
commiteb6fd3b8eb9c19bb501a091d1696e5db1ac4c690 (patch)
tree26e04dc2caada820f1ebc8cdb942189615f827e8 /src/gallium/drivers/freedreno/ir3
parent5b38a1740beccf1f33b9dfe4d38f00a711b6b2e0 (diff)
freedreno/ir3: lower TXP as needed
On a3xx, lower TXP for 3D textures, on a4xx lower all TXP. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler.c8
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.c12
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.h2
3 files changed, 19 insertions, 3 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index 6cc21acaf3f..ade4b1cdc56 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -170,6 +170,14 @@ compile_init(struct ir3_compile_context *ctx, struct ir3_shader_variant *so,
break;
}
+ if (ir3_shader_gpuid(so->shader) >= 400) {
+ /* a4xx seems to have *no* sam.p */
+ lconfig.lower_TXP = ~0; /* lower all txp */
+ } else {
+ /* a3xx just needs to avoid sam.p for 3d tex */
+ lconfig.lower_TXP = (1 << TGSI_TEXTURE_3D);
+ }
+
ctx->tokens = tgsi_transform_lowering(&lconfig, tokens, &ctx->info);
ctx->free_tokens = !!ctx->tokens;
if (!ctx->tokens) {
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
index 0c74f2f26f2..c21d0a2d576 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
@@ -54,9 +54,10 @@ static void
assemble_variant(struct ir3_shader_variant *v)
{
struct fd_context *ctx = fd_context(v->shader->pctx);
+ uint32_t gpu_id = ir3_shader_gpuid(v->shader);
uint32_t sz, *bin;
- bin = ir3_assemble(v->ir, &v->info, ctx->screen->gpu_id);
+ bin = ir3_assemble(v->ir, &v->info, gpu_id);
sz = v->info.sizedwords * 4;
v->bo = fd_bo_new(ctx->dev, sz,
@@ -67,7 +68,7 @@ assemble_variant(struct ir3_shader_variant *v)
free(bin);
- if (ctx->screen->gpu_id >= 400) {
+ if (gpu_id >= 400) {
v->instrlen = v->info.sizedwords / (2 * 16);
} else {
v->instrlen = v->info.sizedwords / (2 * 4);
@@ -177,6 +178,13 @@ fail:
return NULL;
}
+uint32_t
+ir3_shader_gpuid(struct ir3_shader *shader)
+{
+ struct fd_context *ctx = fd_context(shader->pctx);
+ return ctx->screen->gpu_id;
+}
+
struct ir3_shader_variant *
ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
{
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
index 89442cec128..fcd589534a2 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
@@ -214,7 +214,7 @@ struct ir3_shader {
struct ir3_shader * ir3_shader_create(struct pipe_context *pctx,
const struct tgsi_token *tokens, enum shader_t type);
void ir3_shader_destroy(struct ir3_shader *shader);
-
+uint32_t ir3_shader_gpuid(struct ir3_shader *shader);
struct ir3_shader_variant * ir3_shader_variant(struct ir3_shader *shader,
struct ir3_shader_key key);