* nv30: Support negative offsets in indirect constant access
@ 2012-07-09 21:15 Roy Spliet
[not found] ` <1341868520-11400-1-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Roy Spliet @ 2012-07-09 21:15 UTC (permalink / raw)
To: Nouveau mailinglist
Incoming one patch that fixes a shader compiler problem. Testers wanted, especially for NV3x cards. Please test on piglit testcase vp-address-01 to make sure it now passes.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] nv30: Support negative offsets in indirect constant access
[not found] ` <1341868520-11400-1-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
@ 2012-07-09 21:15 ` Roy Spliet
[not found] ` <1341868520-11400-2-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Roy Spliet @ 2012-07-09 21:15 UTC (permalink / raw)
To: Nouveau mailinglist; +Cc: Roy Spliet
Fixes piglit vp-address-01 amongst several others
Signed-off-by: Roy Spliet <r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
---
src/gallium/drivers/nv30/nv30_state.h | 2 +-
src/gallium/drivers/nv30/nv30_vertprog.c | 4 ++--
src/gallium/drivers/nv30/nvfx_shader.h | 2 +-
src/gallium/drivers/nv30/nvfx_vertprog.c | 10 ++++++++--
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
index 964676a..a44eb59 100644
--- a/src/gallium/drivers/nv30/nv30_state.h
+++ b/src/gallium/drivers/nv30/nv30_state.h
@@ -63,7 +63,7 @@ struct nv30_sampler_view {
struct nv30_shader_reloc {
unsigned location;
- unsigned target;
+ signed target;
};
struct nv30_vertprog_exec {
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
index 9b5ba35..1492c15 100644
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ b/src/gallium/drivers/nv30/nv30_vertprog.c
@@ -150,7 +150,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
target = vp->data->start + reloc->target;
inst[1] &= ~0x0003fc000;
- inst[1] |= target << 14;
+ inst[1] |= (target & 0x1ff) << 14;
reloc++;
}
} else {
@@ -159,7 +159,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
target = vp->data->start + reloc->target;
inst[1] &= ~0x0001ff000;
- inst[1] |= target << 12;
+ inst[1] |= (target & 0x1ff) << 12;
reloc++;
}
}
diff --git a/src/gallium/drivers/nv30/nvfx_shader.h b/src/gallium/drivers/nv30/nvfx_shader.h
index e343bf0..987e1b0 100644
--- a/src/gallium/drivers/nv30/nvfx_shader.h
+++ b/src/gallium/drivers/nv30/nvfx_shader.h
@@ -416,7 +416,7 @@
struct nvfx_reg {
int8_t type;
- uint32_t index;
+ int32_t index;
};
struct nvfx_src {
diff --git a/src/gallium/drivers/nv30/nvfx_vertprog.c b/src/gallium/drivers/nv30/nvfx_vertprog.c
index f41f82d..cf49c56 100644
--- a/src/gallium/drivers/nv30/nvfx_vertprog.c
+++ b/src/gallium/drivers/nv30/nvfx_vertprog.c
@@ -169,8 +169,9 @@ emit_src(struct nv30_context *nv30, struct nvfx_vpc *vpc, uint32_t *hw,
hw[0] |= NVFX_VP(INST_INDEX_INPUT);
else
assert(0);
- if(src.indirect_reg)
+ if(src.indirect_reg) {
hw[0] |= NVFX_VP(INST_ADDR_REG_SELECT_1);
+ }
hw[0] |= src.indirect_swz << NVFX_VP(INST_ADDR_SWZ_SHIFT);
}
@@ -367,7 +368,12 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
src.reg = nvfx_reg(NVFXSR_INPUT, fsrc->Register.Index);
break;
case TGSI_FILE_CONSTANT:
- src.reg = vpc->r_const[fsrc->Register.Index];
+ if(fsrc->Register.Indirect) {
+ src.reg = vpc->r_const[0];
+ src.reg.index = fsrc->Register.Index;
+ } else {
+ src.reg = vpc->r_const[fsrc->Register.Index];
+ }
break;
case TGSI_FILE_IMMEDIATE:
src.reg = vpc->imm[fsrc->Register.Index];
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nv30: Support negative offsets in indirect constant access
[not found] ` <1341868520-11400-2-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
@ 2012-07-10 18:23 ` Lucas Stach
2012-07-15 19:53 ` Roy Spliet
0 siblings, 1 reply; 5+ messages in thread
From: Lucas Stach @ 2012-07-10 18:23 UTC (permalink / raw)
To: Roy Spliet; +Cc: Nouveau mailinglist
One minor nitpick inline, otherwise:
Reviewed-by: Lucas Stach <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
Tested-by: Lucas Stach <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org> on nv49 and nv35
Am Montag, den 09.07.2012, 23:15 +0200 schrieb Roy Spliet:
> Fixes piglit vp-address-01 amongst several others
>
> Signed-off-by: Roy Spliet <r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
> ---
> src/gallium/drivers/nv30/nv30_state.h | 2 +-
> src/gallium/drivers/nv30/nv30_vertprog.c | 4 ++--
> src/gallium/drivers/nv30/nvfx_shader.h | 2 +-
> src/gallium/drivers/nv30/nvfx_vertprog.c | 10 ++++++++--
> 4 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
> index 964676a..a44eb59 100644
> --- a/src/gallium/drivers/nv30/nv30_state.h
> +++ b/src/gallium/drivers/nv30/nv30_state.h
> @@ -63,7 +63,7 @@ struct nv30_sampler_view {
>
> struct nv30_shader_reloc {
> unsigned location;
> - unsigned target;
> + signed target;
> };
>
> struct nv30_vertprog_exec {
> diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
> index 9b5ba35..1492c15 100644
> --- a/src/gallium/drivers/nv30/nv30_vertprog.c
> +++ b/src/gallium/drivers/nv30/nv30_vertprog.c
> @@ -150,7 +150,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
> target = vp->data->start + reloc->target;
>
> inst[1] &= ~0x0003fc000;
> - inst[1] |= target << 14;
> + inst[1] |= (target & 0x1ff) << 14;
> reloc++;
> }
> } else {
> @@ -159,7 +159,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
> target = vp->data->start + reloc->target;
>
> inst[1] &= ~0x0001ff000;
> - inst[1] |= target << 12;
> + inst[1] |= (target & 0x1ff) << 12;
> reloc++;
> }
> }
> diff --git a/src/gallium/drivers/nv30/nvfx_shader.h b/src/gallium/drivers/nv30/nvfx_shader.h
> index e343bf0..987e1b0 100644
> --- a/src/gallium/drivers/nv30/nvfx_shader.h
> +++ b/src/gallium/drivers/nv30/nvfx_shader.h
> @@ -416,7 +416,7 @@
>
> struct nvfx_reg {
> int8_t type;
> - uint32_t index;
> + int32_t index;
> };
>
> struct nvfx_src {
> diff --git a/src/gallium/drivers/nv30/nvfx_vertprog.c b/src/gallium/drivers/nv30/nvfx_vertprog.c
> index f41f82d..cf49c56 100644
> --- a/src/gallium/drivers/nv30/nvfx_vertprog.c
> +++ b/src/gallium/drivers/nv30/nvfx_vertprog.c
> @@ -169,8 +169,9 @@ emit_src(struct nv30_context *nv30, struct nvfx_vpc *vpc, uint32_t *hw,
> hw[0] |= NVFX_VP(INST_INDEX_INPUT);
> else
> assert(0);
> - if(src.indirect_reg)
> + if(src.indirect_reg) {
> hw[0] |= NVFX_VP(INST_ADDR_REG_SELECT_1);
> + }
> hw[0] |= src.indirect_swz << NVFX_VP(INST_ADDR_SWZ_SHIFT);
> }
I don't see the need for the added parentheses here.
>
> @@ -367,7 +368,12 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
> src.reg = nvfx_reg(NVFXSR_INPUT, fsrc->Register.Index);
> break;
> case TGSI_FILE_CONSTANT:
> - src.reg = vpc->r_const[fsrc->Register.Index];
> + if(fsrc->Register.Indirect) {
> + src.reg = vpc->r_const[0];
> + src.reg.index = fsrc->Register.Index;
> + } else {
> + src.reg = vpc->r_const[fsrc->Register.Index];
> + }
> break;
> case TGSI_FILE_IMMEDIATE:
> src.reg = vpc->imm[fsrc->Register.Index];
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nv30: Support negative offsets in indirect constant access
2012-07-10 18:23 ` Lucas Stach
@ 2012-07-15 19:53 ` Roy Spliet
[not found] ` <1342382023-16889-1-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Roy Spliet @ 2012-07-15 19:53 UTC (permalink / raw)
To: Nouveau Mailinglist
Re-did a small part based on logic and ran regression test on NV34. Thanks for your feedback Lucas, agree with this reworked patch too?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] nv30: Support negative offsets in indirect constant access
[not found] ` <1342382023-16889-1-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
@ 2012-07-15 19:53 ` Roy Spliet
0 siblings, 0 replies; 5+ messages in thread
From: Roy Spliet @ 2012-07-15 19:53 UTC (permalink / raw)
To: Nouveau Mailinglist; +Cc: Roy Spliet
Fixes piglit vp-address-01 amongst several others
Signed-off-by: Roy Spliet <r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
---
src/gallium/drivers/nv30/nv30_state.h | 2 +-
src/gallium/drivers/nv30/nv30_vertprog.c | 6 +++---
src/gallium/drivers/nv30/nvfx_shader.h | 2 +-
src/gallium/drivers/nv30/nvfx_vertprog.c | 13 ++++++++++---
4 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
index 964676a..a44eb59 100644
--- a/src/gallium/drivers/nv30/nv30_state.h
+++ b/src/gallium/drivers/nv30/nv30_state.h
@@ -63,7 +63,7 @@ struct nv30_sampler_view {
struct nv30_shader_reloc {
unsigned location;
- unsigned target;
+ signed target;
};
struct nv30_vertprog_exec {
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
index 9b5ba35..06e1b8c 100644
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ b/src/gallium/drivers/nv30/nv30_vertprog.c
@@ -149,8 +149,8 @@ nv30_vertprog_validate(struct nv30_context *nv30)
inst = vp->insns[reloc->location].data;
target = vp->data->start + reloc->target;
- inst[1] &= ~0x0003fc000;
- inst[1] |= target << 14;
+ inst[1] &= ~0x0007fc000;
+ inst[1] |= (target & 0x1ff) << 14;
reloc++;
}
} else {
@@ -159,7 +159,7 @@ nv30_vertprog_validate(struct nv30_context *nv30)
target = vp->data->start + reloc->target;
inst[1] &= ~0x0001ff000;
- inst[1] |= target << 12;
+ inst[1] |= (target & 0x1ff) << 12;
reloc++;
}
}
diff --git a/src/gallium/drivers/nv30/nvfx_shader.h b/src/gallium/drivers/nv30/nvfx_shader.h
index e343bf0..987e1b0 100644
--- a/src/gallium/drivers/nv30/nvfx_shader.h
+++ b/src/gallium/drivers/nv30/nvfx_shader.h
@@ -416,7 +416,7 @@
struct nvfx_reg {
int8_t type;
- uint32_t index;
+ int32_t index;
};
struct nvfx_src {
diff --git a/src/gallium/drivers/nv30/nvfx_vertprog.c b/src/gallium/drivers/nv30/nvfx_vertprog.c
index f41f82d..827d518 100644
--- a/src/gallium/drivers/nv30/nvfx_vertprog.c
+++ b/src/gallium/drivers/nv30/nvfx_vertprog.c
@@ -135,12 +135,13 @@ emit_src(struct nv30_context *nv30, struct nvfx_vpc *vpc, uint32_t *hw,
case NVFXSR_CONST:
sr |= (NVFX_VP(SRC_REG_TYPE_CONST) <<
NVFX_VP(SRC_REG_TYPE_SHIFT));
- if (src.reg.index < 512) {
+ if (src.reg.index < 256 && src.reg.index >= -256) {
reloc.location = vp->nr_insns - 1;
reloc.target = src.reg.index;
util_dynarray_append(&vp->const_relocs, struct nvfx_relocation, reloc);
} else {
- hw[1] |= (src.reg.index - 512) << NVFX_VP(INST_CONST_SRC_SHIFT);
+ hw[1] |= (src.reg.index << NVFX_VP(INST_CONST_SRC_SHIFT)) &
+ NVFX_VP(INST_CONST_SRC_MASK);
}
break;
case NVFXSR_NONE:
@@ -169,6 +170,7 @@ emit_src(struct nv30_context *nv30, struct nvfx_vpc *vpc, uint32_t *hw,
hw[0] |= NVFX_VP(INST_INDEX_INPUT);
else
assert(0);
+
if(src.indirect_reg)
hw[0] |= NVFX_VP(INST_ADDR_REG_SELECT_1);
hw[0] |= src.indirect_swz << NVFX_VP(INST_ADDR_SWZ_SHIFT);
@@ -367,7 +369,12 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
src.reg = nvfx_reg(NVFXSR_INPUT, fsrc->Register.Index);
break;
case TGSI_FILE_CONSTANT:
- src.reg = vpc->r_const[fsrc->Register.Index];
+ if(fsrc->Register.Indirect) {
+ src.reg = vpc->r_const[0];
+ src.reg.index = fsrc->Register.Index;
+ } else {
+ src.reg = vpc->r_const[fsrc->Register.Index];
+ }
break;
case TGSI_FILE_IMMEDIATE:
src.reg = vpc->imm[fsrc->Register.Index];
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-15 19:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-09 21:15 nv30: Support negative offsets in indirect constant access Roy Spliet
[not found] ` <1341868520-11400-1-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
2012-07-09 21:15 ` [PATCH] " Roy Spliet
[not found] ` <1341868520-11400-2-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
2012-07-10 18:23 ` Lucas Stach
2012-07-15 19:53 ` Roy Spliet
[not found] ` <1342382023-16889-1-git-send-email-r.spliet-oe7qfRrRQfeEZXFvZSAUrfP6llvjuJOh@public.gmane.org>
2012-07-15 19:53 ` Roy Spliet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.