summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2016-09-14 20:37:12 +0200
committerSamuel Pitoiset <[email protected]>2016-09-26 19:39:04 +0200
commitac859d68f474694f9cb1de007997c936d735a48c (patch)
treee87dd4bf80f17a5ed340f89212c4011a917d9724
parente05042b3678f260385e1e21499025cb35310c6ad (diff)
nvc0: allow to force compiling programs in debug build
This adds a new envvar called NV50_PROG_CHIPSET which allows to compile shaders with a different target, especially useful for shader-db. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_program.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index 9f29b2983cc..e0586304b94 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -562,6 +562,14 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
info->bin.sourceRep = NV50_PROGRAM_IR_TGSI;
info->bin.source = (void *)prog->pipe.tokens;
+#ifdef DEBUG
+ info->target = debug_get_num_option("NV50_PROG_CHIPSET", chipset);
+ info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3);
+ info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0);
+#else
+ info->optLevel = 3;
+#endif
+
info->io.genUserClip = prog->vp.num_ucps;
info->io.auxCBSlot = 15;
info->io.msInfoCBSlot = 15;
@@ -570,12 +578,12 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
info->io.msInfoBase = NVC0_CB_AUX_MS_INFO;
info->io.bufInfoBase = NVC0_CB_AUX_BUF_INFO(0);
info->io.suInfoBase = NVC0_CB_AUX_SU_INFO(0);
- if (chipset >= NVISA_GK104_CHIPSET) {
+ if (info->target >= NVISA_GK104_CHIPSET) {
info->io.texBindBase = NVC0_CB_AUX_TEX_INFO(0);
}
if (prog->type == PIPE_SHADER_COMPUTE) {
- if (chipset >= NVISA_GK104_CHIPSET) {
+ if (info->target >= NVISA_GK104_CHIPSET) {
info->io.auxCBSlot = 7;
info->io.msInfoCBSlot = 7;
info->io.uboInfoBase = NVC0_CB_AUX_UBO_INFO(0);
@@ -587,13 +595,6 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
info->assignSlots = nvc0_program_assign_varying_slots;
-#ifdef DEBUG
- info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3);
- info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0);
-#else
- info->optLevel = 3;
-#endif
-
ret = nv50_ir_generate_code(info);
if (ret) {
NOUVEAU_ERR("shader translation failed: %i\n", ret);