[Mesa-dev] [Bug 99311] [regression, bisected, core] Commit 8b5749f65ac434961308ccb579fb8a816e4f29d5 breaks SDDM (white screen on launch)
https://bugs.freedesktop.org/show_bug.cgi?id=99311 Kai changed: What|Removed |Added Status|RESOLVED|VERIFIED --- Comment #3 from Kai --- (In reply to Kenneth Graunke from comment #2) > Patches reverted, reopen if things are still broken. Sorry for the trouble. Thanks for the quick revert! I can confirm, that a build of faa1edeeb7bbe9321c79587e592dce812e8caa78 (which includes the reverting commit) is fine again. And no worries: this is why this is a development version. Breakage can happen. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/10] nir: Convert ineg(b2i(a)) to a if it's a boolean.
On Sat, 2017-01-07 at 11:03 -0800, Matt Turner wrote: > On Sat, Jan 7, 2017 at 3:58 AM, Timothy Arceri > wrote: > > From: Kenneth Graunke > > > > On BDW: > > > > total instructions in shared programs: 13071119 -> 13070371 (- > > 0.01%) > > instructions in affected programs: 83424 -> 82676 (-0.90%) > > helped: 505 > > HURT: 45 (all TCS, all hurt by a single instruction) > > I investigated these hurt programs when Ken originally sent the > patch. > They're all because of the extra not.nz instruction. > > I sent a patch "i965: Turn not.nz x into cmp.z x,0." that fixed that, > was Ken noticed it was subtly wrong. Maybe you can spot another way > of > doing the same thing. It looks like the real issue is with: (('ieq', 'a@bool', False), ('inot', 'a')), This opt just allows the above opt to make progress. We could probably add something to not match an expression if its used by an if. > > Regardless, > > Reviewed-by: Matt Turner > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99319] godot engine poor performance
https://bugs.freedesktop.org/show_bug.cgi?id=99319 --- Comment #1 from Thomas Helland --- I did a small profiling session with my mesa-git RX460 setup. It appears we are spending almost all of our time in amdgpu_cs_context_cleanup. Haven't invested more time into debuging this yet, but thought I'd mention it in case somebody starts working on it. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/10] nir/algebraic: add support for declaring that an expression is not used by an if
--- src/compiler/nir/nir_algebraic.py | 4 +++- src/compiler/nir/nir_search.c | 3 +++ src/compiler/nir/nir_search.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 04c7423..c0ec019 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -91,6 +91,7 @@ static const ${val.c_type} ${val.name} = { nir_op_${val.opcode}, { ${', '.join(src.c_ptr for src in val.sources)} }, ${'true' if val.is_many else 'false'}, + ${'true' if val.is_not_used_by_if else 'false'}, % endif };""") @@ -186,7 +187,7 @@ class Variable(Value): elif self.required_type == 'float': return "nir_type_float" -_opcode_re = re.compile(r"(?P~)?(?P%)?(?P\w+)(?:@(?P\d+))?") +_opcode_re = re.compile(r"(?P~)?(?P%)?(?P!)?(?P\w+)(?:@(?P\d+))?") class Expression(Value): def __init__(self, expr, name_base, varset): @@ -200,6 +201,7 @@ class Expression(Value): self.bit_size = int(m.group('bits')) if m.group('bits') else 0 self.inexact = m.group('inexact') is not None self.is_many = m.group('many') is not None + self.is_not_used_by_if = m.group('not_used_by_if') is not None self.sources = [ Value.create(src, "{0}_{1}".format(name_base, i), varset) for (i, src) in enumerate(expr[1:]) ] diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 8318c27..e80ec8e 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -264,6 +264,9 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr, list_is_singular(&instr->dest.dest.ssa.if_uses return false; + if (expr->is_not_used_by_if && !list_empty(&instr->dest.dest.ssa.if_uses)) + return false; + if (instr->op != expr->opcode) return false; diff --git a/src/compiler/nir/nir_search.h b/src/compiler/nir/nir_search.h index 5f1b949..a14f606 100644 --- a/src/compiler/nir/nir_search.h +++ b/src/compiler/nir/nir_search.h @@ -106,6 +106,9 @@ typedef struct { /* Specifies that this expression is used more than once */ bool is_many; + + /* Specifies that this expression is not used by an if */ + bool is_not_used_by_if; } nir_search_expression; NIR_DEFINE_CAST(nir_search_value_as_variable, nir_search_value, -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/10] nir: add inot/fnot to move comparison list
On BDW: total instructions in shared programs: 13060680 -> 13060620 (-0.00%) instructions in affected programs: 6060 -> 6000 (-0.99%) helped: 7 HURT: 0 total cycles in shared programs: 256601956 -> 256590950 (-0.00%) cycles in affected programs: 1269546 -> 1258540 (-0.87%) helped: 23 HURT: 11 --- src/compiler/nir/nir_opt_move_comparisons.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_opt_move_comparisons.c b/src/compiler/nir/nir_opt_move_comparisons.c index e6bee94..1cb3e55 100644 --- a/src/compiler/nir/nir_opt_move_comparisons.c +++ b/src/compiler/nir/nir_opt_move_comparisons.c @@ -66,6 +66,8 @@ is_comparison(nir_op op) case nir_op_ine: case nir_op_i2b: case nir_op_f2b: + case nir_op_inot: + case nir_op_fnot: return true; default: return false; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/10] nir: don't turn ieq/ine into inot if used by an if
Otherwise we will end up with an extra instruction to compare the result of the inot. On BDW: total instructions in shared programs: 13060620 -> 13060481 (-0.00%) instructions in affected programs: 103379 -> 103240 (-0.13%) helped: 127 HURT: 0 total cycles in shared programs: 256590950 -> 256587408 (-0.00%) cycles in affected programs: 11324730 -> 11321188 (-0.03%) helped: 114 HURT: 21 --- src/compiler/nir/nir_opt_algebraic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 1ad7708..bfb8d8d 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -270,9 +270,9 @@ optimizations = [ (('~frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'), # Boolean simplifications (('ieq', 'a@bool', True), a), - (('ine', 'a@bool', True), ('inot', a)), + (('!ine', 'a@bool', True), ('inot', a)), (('ine', 'a@bool', False), a), - (('ieq', 'a@bool', False), ('inot', 'a')), + (('!ieq', 'a@bool', False), ('inot', 'a')), (('bcsel', a, True, False), a), (('bcsel', a, False, True), ('inot', a)), (('bcsel@32', a, 1.0, 0.0), ('b2f', a)), -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/10] nir: Convert ineg(b2i(a)) to a if it's a boolean.
On Sat, 2017-01-07 at 11:03 -0800, Matt Turner wrote: > On Sat, Jan 7, 2017 at 3:58 AM, Timothy Arceri > wrote: > > From: Kenneth Graunke > > > > On BDW: > > > > total instructions in shared programs: 13071119 -> 13070371 (- > > 0.01%) > > instructions in affected programs: 83424 -> 82676 (-0.90%) > > helped: 505 > > HURT: 45 (all TCS, all hurt by a single instruction) > > I investigated these hurt programs when Ken originally sent the > patch. > They're all because of the extra not.nz instruction. > > I sent a patch "i965: Turn not.nz x into cmp.z x,0." that fixed that, > was Ken noticed it was subtly wrong. Maybe you can spot another way > of > doing the same thing. Please see follow-up patches 12 & 13 for a fix for the hurt. > > Regardless, > > Reviewed-by: Matt Turner > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99319] godot engine poor performance
https://bugs.freedesktop.org/show_bug.cgi?id=99319 --- Comment #2 from Thomas Helland --- A small update: It appears we are spending all of the time walking in a for-loop at the bottom of context_cleanup: for (i = 0; i < ARRAY_SIZE(cs->buffer_indices_hashlist); i++) { cs->buffer_indices_hashlist[i] = -1; } -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/12] glcpp: Print preprocessor output to string_buffer
Some spelling suggestions, since you seem to be doing another version of these patches: On Sat, Jan 7, 2017 at 9:02 PM, Vladislav Egorov wrote: > glcpp's printing is an obvious low hanging fruit: > > 1. It unnecessarily uses formatted printing to print output of >preprocessing. To print just one character '+' it first uses >vsnprintf("%s", "+") to calculate number of characters in the >formatted string (while it's known statically), then resizes >buffer increasing it by 1 and then again uses vsnprintf() to >actually print the string to the resized buffer. > > 2. It linearly grows output string buffer. Each time preprocessor >prints anything, it reallocates output buffer increasing it by >the exact size of appended string. It's bad for two reasons - >a) unnecesary realloc() calls, b) to print formatted string it unnecessary > diff --git a/src/compiler/glsl/glcpp/pp.c b/src/compiler/glsl/glcpp/pp.c > index b591279..7fbadf9 100644 > --- a/src/compiler/glsl/glcpp/pp.c > +++ b/src/compiler/glsl/glcpp/pp.c > @@ -24,7 +24,135 @@ > #include > #include > #include > +#include > +#include > #include "glcpp.h" > +#include "util/bitscan.h" > +#include "util/u_math.h" > + > +/* Overhead of ralloc allocation in bytes. Should be equal to > + * sizeof(ralloc_header), but ralloc_header is not a part of > + * the ralloc public API. Assume it's 48. It's a slight > + * overestimation, but it's enough for practical purposes. > + */ > +#define RALLOC_OVERHEAD 48 > + > +bool > +glcpp_strbuffer_ensure_capacity(glcpp_parser_t *parser, > + struct string_buffer *str, size_t len_append) > +{ > + /* Existing string length + 1 null-character + new characters */ > + size_t min_capacity = str->length + 1 + len_append; > + if (unlikely(min_capacity <= str->length)) > + return false; > + if (unlikely(min_capacity > str->capacity)) { > + char *new_buf; > + size_t new_capacity = str->capacity; > + size_t overhead_capacity;; > + do { > + /* Grow factor = 1.5. Most of string implementations > +* have grow factor 1.5 (MSVC, Clang, FBVector), with > +* exception of GCC that has grow factor of 2. > +*/ > + new_capacity = 3 * (new_capacity + 1) / 2; > + if (unlikely(new_capacity < str->capacity)) { > + new_capacity = min_capacity; > + break; > + } > + } while (new_capacity < min_capacity); > + > + /* Jemalloc optimization. Older jemalloc allocates blocks > +* large than 4 KiB in 4 KiB chunks, e.g. malloc(5000) will larger than > +* allocate 8 KiB block and 3 KiB will be wasted. Newer > +* jemalloc will allocate sizes 5 KiB, 6 KiB (+1 KiB), 7, 8, > +* 10 (+2), 12, 14, 16, 20 (+4), 24, 28, 32, 40 (+8), and so > +* on. Size classes will also depends on platform classes will also depend > +* and compilation keys. > +* > +* So optimize for both cases rounding to sizes 4 KiB, > +* 8 KiB, 12, ..., 32, 40, 48, 56, etc. It will improve > +* jemalloc and will not pessimize other allocators, because > +* there is nothing unreasonable in allocating such sizes. > +* > +* Check for INT_MAX for the only reason that utility "... only for the only reason that ..." sounds better to me. > +* function align() accepts signed integers. > +*/ > + overhead_capacity = new_capacity + RALLOC_OVERHEAD; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/12] glcpp: Print preprocessor output to string_buffer
On Sun, Jan 8, 2017 at 4:05 PM, Grazvydas Ignotas wrote: > On Sat, Jan 7, 2017 at 9:02 PM, Vladislav Egorov wrote: >> +* >> +* Check for INT_MAX for the only reason that utility > > "... only for the only reason that ..." sounds better to me. whoops, "... only for the reason that ..." ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/12] glcpp: Create fast path hand-written scanner
On Sat, Jan 7, 2017 at 9:02 PM, Vladislav Egorov wrote: > @@ -582,6 +609,333 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? > > %% > > +static void > +glcpp_fast_skip_singleline_comment (glcpp_parser_t *parser, char **input) > +{ > + /* Skip // */ > + char *buf = *input + 2; > + > + while (true) { > + char ch = *buf; > + if (ch == '\r' || ch == '\n' || ch == '\0') > + break; > + buf++; > + } Looks like strpbrk() could be used here too? Also null char handling looks suspicious. Gražvydas ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/12] glcpp: Create fast path hand-written scanner
On Sun, Jan 8, 2017 at 4:11 PM, Grazvydas Ignotas wrote: > On Sat, Jan 7, 2017 at 9:02 PM, Vladislav Egorov wrote: >> @@ -582,6 +609,333 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? >> >> %% >> >> +static void >> +glcpp_fast_skip_singleline_comment (glcpp_parser_t *parser, char **input) >> +{ >> + /* Skip // */ >> + char *buf = *input + 2; >> + >> + while (true) { >> + char ch = *buf; >> + if (ch == '\r' || ch == '\n' || ch == '\0') >> + break; >> + buf++; >> + } > > Looks like strpbrk() could be used here too? > Also null char handling looks suspicious. Ignore the null char comment, I've misread the code :( ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/10] nir/algebraic: add support for declaring that an expression is not used by an if
The number of little single-character prefixes is starting to get out-of-hand. Could we instead work the condition function pointer stuff a bit and use that for "is used in if" and "has multiple uses"? I've got some more detailed ideas about that but I need to be in front of my laptop to really discuss them. On Jan 8, 2017 5:06 AM, "Timothy Arceri" wrote: --- src/compiler/nir/nir_algebraic.py | 4 +++- src/compiler/nir/nir_search.c | 3 +++ src/compiler/nir/nir_search.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_ algebraic.py index 04c7423..c0ec019 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -91,6 +91,7 @@ static const ${val.c_type} ${val.name} = { nir_op_${val.opcode}, { ${', '.join(src.c_ptr for src in val.sources)} }, ${'true' if val.is_many else 'false'}, + ${'true' if val.is_not_used_by_if else 'false'}, % endif };""") @@ -186,7 +187,7 @@ class Variable(Value): elif self.required_type == 'float': return "nir_type_float" -_opcode_re = re.compile(r"(?P~)?(?P%)?(?P\w+)(?:@( ?P\d+))?") +_opcode_re = re.compile(r"(?P~)?(?P%)?(?P! )?(?P\w+)(?:@(?P\d+))?") class Expression(Value): def __init__(self, expr, name_base, varset): @@ -200,6 +201,7 @@ class Expression(Value): self.bit_size = int(m.group('bits')) if m.group('bits') else 0 self.inexact = m.group('inexact') is not None self.is_many = m.group('many') is not None + self.is_not_used_by_if = m.group('not_used_by_if') is not None self.sources = [ Value.create(src, "{0}_{1}".format(name_base, i), varset) for (i, src) in enumerate(expr[1:]) ] diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 8318c27..e80ec8e 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -264,6 +264,9 @@ match_expression(const nir_search_expression *expr, nir_alu_instr *instr, list_is_singular(&instr->dest.dest.ssa.if_uses return false; + if (expr->is_not_used_by_if && !list_empty(&instr->dest.dest. ssa.if_uses)) + return false; + if (instr->op != expr->opcode) return false; diff --git a/src/compiler/nir/nir_search.h b/src/compiler/nir/nir_search.h index 5f1b949..a14f606 100644 --- a/src/compiler/nir/nir_search.h +++ b/src/compiler/nir/nir_search.h @@ -106,6 +106,9 @@ typedef struct { /* Specifies that this expression is used more than once */ bool is_many; + + /* Specifies that this expression is not used by an if */ + bool is_not_used_by_if; } nir_search_expression; NIR_DEFINE_CAST(nir_search_value_as_variable, nir_search_value, -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] nir: Fix anonymous union initialization with older GCC.
Fix this build error with GCC 4.4.7. CC nir/nir_opt_copy_prop_vars.lo nir/nir_opt_copy_prop_vars.c: In function ‘copy_prop_vars_block’: nir/nir_opt_copy_prop_vars.c:765: error: unknown field ‘deref’ specified in initializer nir/nir_opt_copy_prop_vars.c:765: warning: missing braces around initializer nir/nir_opt_copy_prop_vars.c:765: warning: (near initialization for ‘(anonymous).’) nir/nir_opt_copy_prop_vars.c:765: warning: initialization from incompatible pointer type Fixes: 62332d139c8f ("nir: Add a local variable-based copy propagation pass") Signed-off-by: Vinson Lee --- src/compiler/nir/nir_opt_copy_prop_vars.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index 8c24cd7..7f17469 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -762,7 +762,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state, } else { value = (struct value) { .is_ssa = false, - .deref = src, + { .deref = src }, }; } -- 1.7.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mapi: update the asm code to support x32
Fixes crashes when both glx-tls and asm are enabled on x32. Cc: mesa-sta...@lists.freedesktop.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94512 Signed-off-by: Grazvydas Ignotas --- no commit access, please push src/mapi/entry_x86-64_tls.h | 31 --- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h index 8f3fa91..1e29bde 100644 --- a/src/mapi/entry_x86-64_tls.h +++ b/src/mapi/entry_x86-64_tls.h @@ -41,11 +41,23 @@ __asm__(".text\n" ".balign 32\n"\ func ":" +#ifndef __ILP32__ + #define STUB_ASM_CODE(slot) \ "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \ "movq %fs:(%rax), %r11\n\t" \ "jmp *(8 * " slot ")(%r11)" +#else + +#define STUB_ASM_CODE(slot) \ + "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \ + "movl %fs:(%rax), %r11d\n\t" \ + "movl 4*" slot "(%r11d), %r11d\n\t" \ + "jmp *%r11" + +#endif + #define MAPI_TMP_STUB_ASM_GCC #include "mapi_tmp.h" @@ -72,19 +84,32 @@ void entry_patch(mapi_func entry, int slot) { char *code = (char *) entry; - *((unsigned int *) (code + 12)) = slot * sizeof(mapi_func); + int offset = 12; +#ifdef __ILP32__ + offset = 13; +#endif + *((unsigned int *) (code + offset)) = slot * sizeof(mapi_func); } mapi_func entry_generate(int slot) { - const char code_templ[16] = { + const char code_templ[] = { +#ifndef __ILP32__ /* movq %fs:0, %r11 */ 0x64, 0x4c, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, /* jmp *0x1234(%r11) */ 0x41, 0xff, 0xa3, 0x34, 0x12, 0x00, 0x00, +#else + /* movl %fs:0, %r11d */ + 0x64, 0x44, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, + /* movl 0x1234(%r11d), %r11d */ + 0x67, 0x45, 0x8b, 0x9b, 0x34, 0x12, 0x00, 0x00, + /* jmp *%r11 */ + 0x41, 0xff, 0xe3, +#endif }; - unsigned long addr; + unsigned long long addr; char *code; mapi_func entry; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 94512] X segfaults with glx-tls enabled in a x32 environment
https://bugs.freedesktop.org/show_bug.cgi?id=94512 Grazvydas Ignotas changed: What|Removed |Added CC||e...@xmw.de --- Comment #11 from Grazvydas Ignotas --- Ignore the previous patch, it's botched. I've compiled the x32 deps, so could test what allowed to produce a working patch: https://lists.freedesktop.org/archives/mesa-dev/2017-January/139946.html -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 94512] X segfaults with glx-tls enabled in a x32 environment
https://bugs.freedesktop.org/show_bug.cgi?id=94512 --- Comment #12 from EoD --- (In reply to Grazvydas Ignotas from comment #11) > Ignore the previous patch, it's botched. > I've compiled the x32 deps, so could test what allowed to produce a working > patch: > https://lists.freedesktop.org/archives/mesa-dev/2017-January/139946.html I tried both patches and only the one on the ML is working. I am no expert, but don't you want to use exact-length types instead of "long long"? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mapi: update the asm code to support x32
This seems reasonable. I spent a bit of time thinking about how this could be improved, but couldn't come up with anything. Going to leave this on-list for a bit though so others better versed in the mapi logic can provide feedback. In the meanwhile, this is Reviewed-by: Ilia Mirkin On Sun, Jan 8, 2017 at 12:38 PM, Grazvydas Ignotas wrote: > Fixes crashes when both glx-tls and asm are enabled on x32. > > Cc: mesa-sta...@lists.freedesktop.org > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94512 > Signed-off-by: Grazvydas Ignotas > --- > no commit access, please push > > src/mapi/entry_x86-64_tls.h | 31 --- > 1 file changed, 28 insertions(+), 3 deletions(-) > > diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h > index 8f3fa91..1e29bde 100644 > --- a/src/mapi/entry_x86-64_tls.h > +++ b/src/mapi/entry_x86-64_tls.h > @@ -41,11 +41,23 @@ __asm__(".text\n" > ".balign 32\n"\ > func ":" > > +#ifndef __ILP32__ > + > #define STUB_ASM_CODE(slot) \ > "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \ > "movq %fs:(%rax), %r11\n\t" \ > "jmp *(8 * " slot ")(%r11)" > > +#else > + > +#define STUB_ASM_CODE(slot) \ > + "movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t" \ > + "movl %fs:(%rax), %r11d\n\t" \ > + "movl 4*" slot "(%r11d), %r11d\n\t" \ > + "jmp *%r11" > + > +#endif > + > #define MAPI_TMP_STUB_ASM_GCC > #include "mapi_tmp.h" > > @@ -72,19 +84,32 @@ void > entry_patch(mapi_func entry, int slot) > { > char *code = (char *) entry; > - *((unsigned int *) (code + 12)) = slot * sizeof(mapi_func); > + int offset = 12; > +#ifdef __ILP32__ > + offset = 13; > +#endif > + *((unsigned int *) (code + offset)) = slot * sizeof(mapi_func); > } > > mapi_func > entry_generate(int slot) > { > - const char code_templ[16] = { > + const char code_templ[] = { > +#ifndef __ILP32__ >/* movq %fs:0, %r11 */ >0x64, 0x4c, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, >/* jmp *0x1234(%r11) */ >0x41, 0xff, 0xa3, 0x34, 0x12, 0x00, 0x00, > +#else > + /* movl %fs:0, %r11d */ > + 0x64, 0x44, 0x8b, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00, > + /* movl 0x1234(%r11d), %r11d */ > + 0x67, 0x45, 0x8b, 0x9b, 0x34, 0x12, 0x00, 0x00, > + /* jmp *%r11 */ > + 0x41, 0xff, 0xe3, > +#endif > }; > - unsigned long addr; > + unsigned long long addr; > char *code; > mapi_func entry; > > -- > 2.7.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/10] nir/algebraic: add support for declaring that an expression is not used by an if
On Sun, 2017-01-08 at 08:17 -0800, Jason Ekstrand wrote: > The number of little single-character prefixes is starting to get > out-of-hand. I had a feeling you wouldn't like them but I just thought I'd put out there what was useful and we could discuss. > Could we instead work the condition function pointer stuff a bit > and use that for "is used in if" and "has multiple uses"? I'm not really sure what you mean by condition function pointer stuff but I'm happy to discuss. > I've got some more detailed ideas about that but I need to be in > front of my laptop to really discuss them. > > On Jan 8, 2017 5:06 AM, "Timothy Arceri" m> wrote: > --- > src/compiler/nir/nir_algebraic.py | 4 +++- > src/compiler/nir/nir_search.c | 3 +++ > src/compiler/nir/nir_search.h | 3 +++ > 3 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/src/compiler/nir/nir_algebraic.py > b/src/compiler/nir/nir_algebraic.py > index 04c7423..c0ec019 100644 > --- a/src/compiler/nir/nir_algebraic.py > +++ b/src/compiler/nir/nir_algebraic.py > @@ -91,6 +91,7 @@ static const ${val.c_type} ${val.name} = { > nir_op_${val.opcode}, > { ${', '.join(src.c_ptr for src in val.sources)} }, > ${'true' if val.is_many else 'false'}, > + ${'true' if val.is_not_used_by_if else 'false'}, > % endif > };""") > > @@ -186,7 +187,7 @@ class Variable(Value): > elif self.required_type == 'float': > return "nir_type_float" > > -_opcode_re = > re.compile(r"(?P~)?(?P%)?(?P\w+)(?:@(?P\ > d+))?") > +_opcode_re = > re.compile(r"(?P~)?(?P%)?(?P!)?(?P ode>\w+)(?:@(?P\d+))?") > > class Expression(Value): > def __init__(self, expr, name_base, varset): > @@ -200,6 +201,7 @@ class Expression(Value): > self.bit_size = int(m.group('bits')) if m.group('bits') else 0 > self.inexact = m.group('inexact') is not None > self.is_many = m.group('many') is not None > + self.is_not_used_by_if = m.group('not_used_by_if') is not None > self.sources = [ Value.create(src, "{0}_{1}".format(name_base, > i), varset) > for (i, src) in enumerate(expr[1:]) ] > > diff --git a/src/compiler/nir/nir_search.c > b/src/compiler/nir/nir_search.c > index 8318c27..e80ec8e 100644 > --- a/src/compiler/nir/nir_search.c > +++ b/src/compiler/nir/nir_search.c > @@ -264,6 +264,9 @@ match_expression(const nir_search_expression > *expr, nir_alu_instr *instr, > list_is_singular(&instr->dest.dest.ssa.if_uses > return false; > > + if (expr->is_not_used_by_if && !list_empty(&instr- > >dest.dest.ssa.if_uses)) > + return false; > + > if (instr->op != expr->opcode) > return false; > > diff --git a/src/compiler/nir/nir_search.h > b/src/compiler/nir/nir_search.h > index 5f1b949..a14f606 100644 > --- a/src/compiler/nir/nir_search.h > +++ b/src/compiler/nir/nir_search.h > @@ -106,6 +106,9 @@ typedef struct { > > /* Specifies that this expression is used more than once */ > bool is_many; > + > + /* Specifies that this expression is not used by an if */ > + bool is_not_used_by_if; > } nir_search_expression; > > NIR_DEFINE_CAST(nir_search_value_as_variable, nir_search_value, > -- > 2.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 92954] [softpipe] piglit drawbuffer-modes regression
https://bugs.freedesktop.org/show_bug.cgi?id=92954 --- Comment #2 from Karl Lessard --- The reason this has stopped working is because the drawable is not refreshed with the data written to the front buffer before reading its pixels. Since https://cgit.freedesktop.org/mesa/mesa/commit/?id=2b676570960277d47477822ffeccc672613f9142, the drawable act as the source for reading the front buffer data. Since this test writes directly to the front buffer, all operations have to be flushed and reflected by the drawable before attempting to read it. On a explicit flush, the state tracker take care of refreshing the drawable with the front buffer data after flushing (see st_glFlush). But in the drawbuffer-modes test, the flush is done implicitly by calling glReadPixels and is handled by the soft/llvm pipes themselves (see *pipe_transfer_map). The drawable does not get refreshed in this case, therefore when the test reads the front buffer data, it reads garbage. It is tricky to refresh the drawable after flushing from the pipes because at that level, we don't know the nature of the resource being mapped for reading (front buffer, back buffer...). Unless I miss something? -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 94512] X segfaults with glx-tls enabled in a x32 environment
https://bugs.freedesktop.org/show_bug.cgi?id=94512 --- Comment #13 from Grazvydas Ignotas --- (In reply to EoD from comment #12) > I am no expert, but don't you want to use exact-length types instead of > "long long"? mapi doesn't use such types and I did not want to drag in a dependency. Also the modified file is for x86-64 only and has asm in GNU syntax, anything compiling that should have long long of 8 bytes. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mapi: update the asm code to support x32
On Sun, Jan 8, 2017 at 9:38 AM, Grazvydas Ignotas wrote: > Fixes crashes when both glx-tls and asm are enabled on x32. > > Cc: mesa-sta...@lists.freedesktop.org > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94512 > Signed-off-by: Grazvydas Ignotas Thanks, this is great. Who ever commits this (maybe me :) should also put Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=575458 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Bug 50338]radeon: TGSI takes more than two cfiles from r600_shader.
Hello Ilia Thank you for the irc reference, I'll check there for live responses the next time I look into this. I will post here what I have found out for now, just to write it down: Running with R600_DEBUG=nosb yields the same results. It makes sense because the driver kicks the bytecode out before the sb phase takes place. With further reading of the Evergreen ISA, I can see that in chapter 4.6.4 "ALU Constants" it says that the Trans ALU can only reference two constants. My custom R600_ERR messages keep outputting this: EE r600_asm.c:426 reserve_cfile - Failed to reserve cfile when looking for 517 EE r600_asm.c:427 reserve_cfile - hw_cfile_addr are [514,514,-1,-1] EE r600_asm.c:594 check_and_set_bank_swizzle - Scalar couldn't be checked for alu: 4 That is, when trying to assign cfile 517, the driver finds that there are already two of them reserved, and returns with an error. This happens for ALU number 4, which is the ALU.Trans. After a while I get some more errors with another ALUs here and there, but they are seldom compared to the Trans one. I think this may be fixed in the TGSI -> r600_asm phase, but before bytecode checks. I'm still unfamiliar with how GPRs and constants are assigned from TGSI to r600 so I still have no clue where to fiddle with the code. I will keep looking it up. Greetings Jaime García Villena On 7 January 2017 at 18:33, Ilia Mirkin wrote: > On Sat, Jan 7, 2017 at 10:30 AM, Jaime García Villena > wrote: > > I can't find the place where TGSI src registers are assigned into r600 > GPR > > or CFILE registers. I'm planning to make an exception for these kind of > > chips, and prevent the 3rd CFILE assignation, somehow. > > > > Where does r600 shader operands assignation happen? Can you give some > > directions on where to look? > > Someone might probably answer in some more depth, but there are two > stages - one is to convert TGSI -> r600 asm, which happens in > r600_asm.c as you've found. Then there's an optimizing compiler, > called "sb", which takes the asm and optimizes it, based on various > internal rules; the logic for this is in the r600/sb directory. A > restriction of the sort you're talking about would have to be taken > into account by sb as well. You can test to see if that's the issue by > running with R600_DEBUG=nosb, which will skip the second stage. If > that works, then the issue definitely lies in sb. Otherwise it's in > the tgsi -> r600 asm phase. > > More generally, you may find it faster to get help in #radeon and > #dri-devel on irc.freenode.net than asking in emails (since it's > easier to ask follow-up questions). > > Cheers, > > -ilia > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 94512] X segfaults with glx-tls enabled in a x32 environment
https://bugs.freedesktop.org/show_bug.cgi?id=94512 EoD changed: What|Removed |Added CC|e...@xmw.de | -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/8] android: fix building on lollipop
2017-01-06 18:35 GMT+01:00 Wu Zhen : > From: WuZhen > > this commit fixes mesa building on lollipop, however, > llvm on lollipop is too old to build amdgpu > > based on initial work by Mauro Rossi > > Change-Id: I98d646f9e1c61fe2754479382885718386a8bbb7 > Reviewed-by: Mauro Rossi > Reviewed-by: Chih-Wei Huang > --- > Android.common.mk | 2 +- > Android.mk | 5 - > src/gbm/Android.mk | 1 + > src/mesa/Android.libmesa_st_mesa.mk | 1 + > 4 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/Android.common.mk b/Android.common.mk > index 9f64c220f8..7ab3942ee2 100644 > --- a/Android.common.mk > +++ b/Android.common.mk > @@ -91,7 +91,7 @@ endif > endif > > LOCAL_CPPFLAGS += \ > - $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-D_USING_LIBCXX) \ > + $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-std=c++11) \ > -Wno-error=non-virtual-dtor \ > -Wno-non-virtual-dtor > > diff --git a/Android.mk b/Android.mk > index fb29105a60..b52e7f8232 100644 > --- a/Android.mk > +++ b/Android.mk > @@ -95,10 +95,13 @@ SUBDIRS := \ > src/mesa \ > src/util \ > src/egl \ > - src/amd \ > src/intel \ > src/mesa/drivers/dri > > +ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),) > +SUBDIRS += src/amd > +endif > + > INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS)) > > ifeq ($(strip $(MESA_BUILD_GALLIUM)),true) > diff --git a/src/gbm/Android.mk b/src/gbm/Android.mk > index a3f8fbbeab..89127766e6 100644 > --- a/src/gbm/Android.mk > +++ b/src/gbm/Android.mk > @@ -33,6 +33,7 @@ LOCAL_C_INCLUDES := \ > $(LOCAL_PATH)/main > > LOCAL_STATIC_LIBRARIES := libmesa_loader > +LOCAL_SHARED_LIBRARIES := libdl > LOCAL_MODULE := libgbm > > LOCAL_SRC_FILES := \ > diff --git a/src/mesa/Android.libmesa_st_mesa.mk > b/src/mesa/Android.libmesa_st_mesa.mk > index 3905ddcf24..90e4ccd210 100644 > --- a/src/mesa/Android.libmesa_st_mesa.mk > +++ b/src/mesa/Android.libmesa_st_mesa.mk > @@ -67,6 +67,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES += \ > > LOCAL_STATIC_LIBRARIES += libmesa_nir libmesa_glsl > > +include external/libcxx/libcxx.mk Hi, if I recall correctly, we reviewed an updated version, because libcxx.mk is not present in Android 6 and 7 (this would stop the android build) and stlport is used in kitkat Similar scenario in src/gallium/drivers/r600 and src/gallium/drivers/nouveau, has the following if/else/endif, and it works also here: +ifeq ($(MESA_LOLLIPOP_BUILD),true) +LOCAL_C_INCLUDES += external/libcxx/include +else +include external/stlport/libstlport.mk +endif NOTE: MESA_LOLLIPOP_BUILD currently has the meaning of "lollipop and later", equivalent to say "we're using c++11" > include $(LOCAL_PATH)/Android.gen.mk > include $(MESA_COMMON_MK) > include $(BUILD_STATIC_LIBRARY) > -- > 2.11.0 > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/12] glcpp: Create fast path hand-written scanner
08.01.2017 17:11, Grazvydas Ignotas пишет: On Sat, Jan 7, 2017 at 9:02 PM, Vladislav Egorov wrote: @@ -582,6 +609,333 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? %% +static void +glcpp_fast_skip_singleline_comment (glcpp_parser_t *parser, char **input) +{ + /* Skip // */ + char *buf = *input + 2; + + while (true) { + char ch = *buf; + if (ch == '\r' || ch == '\n' || ch == '\0') + break; + buf++; + } Looks like strpbrk() could be used here too? Also null char handling looks suspicious. Gražvydas strpbrk() returns NULL if it encountered '\0', not '\0's position. It seems that strcspn() is needed here. On my system GCC inlines it and generates more or less the same code as loop/if variant, without significant change in profiler, so it probably will be fine. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/12] glcpp: Print preprocessor output to string_buffer
08.01.2017 17:05, Grazvydas Ignotas пишет: Some spelling suggestions, since you seem to be doing another version of these patches: Yes, the fuzzer uncovered many bugs and deviations in behaviour from the old flex/bison path. Trivial, but numerous. So I need some time to hunt all the problem down. Testing on just dumped shaders (that are already well-formed and don't contain any weirdness like illegal characters) was a mistake. And the Mesa's preprocessor's test suite is too small to find much. Thanks for your comments. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Fix number of slots in SSO mode when there are no user varyings.
We want vue_map->num_slots to be one more than the final slot. When assigning fixed slots, built-in slots, and non-SSO user varyings, we do slot++. This leaves "slot" as one past the most recently assigned slot. But for SSO user varyings, we computed slot based on the varying location value...and left it at that slot value. To work around this inconsistency, I made num_slots be "slot + 1" if separate and "slot" otherwise. The problem is...if there are no user varyings in SSO mode...then we would have done slot++ when assigning built-ins, so it would be off by one. This resulted in loops from 0 to vue_map->num_slots hitting a bonus BRW_VARYING_SLOT_PAD at the end. This used to break the SIMD8 VS/TES backends, but I fixed that in commit 480d6c1653713dcae617ac523b2ca5deee01c845. It's probably safe at this point, but we should fix it anyway. To fix this, do slot++ in all cases. For SSO mode, we overwrite slot for every varying, so this increment only matters on the last varying. Because we process varyings in order, this will set slot to 1 more than the highest assigned slot. Signed-off-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_vue_map.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vue_map.c b/src/mesa/drivers/dri/i965/brw_vue_map.c index 982a31f9034..0d8f6c700b6 100644 --- a/src/mesa/drivers/dri/i965/brw_vue_map.c +++ b/src/mesa/drivers/dri/i965/brw_vue_map.c @@ -181,14 +181,12 @@ brw_compute_vue_map(const struct gen_device_info *devinfo, const int varying = ffsll(generics) - 1; if (separate) { slot = first_generic_slot + varying - VARYING_SLOT_VAR0; - assign_vue_slot(vue_map, varying, slot); - } else { - assign_vue_slot(vue_map, varying, slot++); } + assign_vue_slot(vue_map, varying, slot++); generics &= ~BITFIELD64_BIT(varying); } - vue_map->num_slots = separate ? slot + 1 : slot; + vue_map->num_slots = slot; vue_map->num_per_vertex_slots = 0; vue_map->num_per_patch_slots = 0; } -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH V3] nir: Introduce a nir_opt_move_comparisons() pass.
From: Kenneth Graunke This tries to move comparisons (a common source of boolean values) closer to their first use. For GPUs which use condition codes, this can eliminate a lot of temporary booleans and comparisons which reload the condition code register based on a boolean. V2: (Timothy Arceri) - fix move comparision for phis so we dont end up with: vec1 32 ssa_227 = phi block_34: ssa_1, block_38: ssa_240 vec1 32 ssa_235 = feq ssa_227, ssa_1 vec1 32 ssa_230 = phi block_34: ssa_221, block_38: ssa_235 - add nir_op_i2b/nir_op_f2b to the list of comparisons. V3: (Timothy Arceri) - tidy ups suggested by Jason. - add inot/fnot to move comparison list Signed-off-by: Kenneth Graunke Reviewed-by: Ian Romanick [v1] --- src/compiler/Makefile.sources | 1 + src/compiler/nir/nir.h | 2 + src/compiler/nir/nir_opt_move_comparisons.c | 172 3 files changed, 175 insertions(+) create mode 100644 src/compiler/nir/nir_opt_move_comparisons.c diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 52f6e54..6da854e 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -245,6 +245,7 @@ NIR_FILES = \ nir/nir_opt_global_to_local.c \ nir/nir_opt_if.c \ nir/nir_opt_loop_unroll.c \ + nir/nir_opt_move_comparisons.c \ nir/nir_opt_peephole_select.c \ nir/nir_opt_remove_phis.c \ nir/nir_opt_trivial_continues.c \ diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index d17924c..325d73b 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2563,6 +2563,8 @@ bool nir_opt_if(nir_shader *shader); bool nir_opt_loop_unroll(nir_shader *shader, nir_variable_mode indirect_mask); +bool nir_opt_move_comparisons(nir_shader *shader); + bool nir_opt_peephole_select(nir_shader *shader, unsigned limit); bool nir_opt_remove_phis(nir_shader *shader); diff --git a/src/compiler/nir/nir_opt_move_comparisons.c b/src/compiler/nir/nir_opt_move_comparisons.c new file mode 100644 index 000..15c1cc9 --- /dev/null +++ b/src/compiler/nir/nir_opt_move_comparisons.c @@ -0,0 +1,172 @@ +/* + * Copyright © 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "nir.h" + +/** + * \file nir_opt_move_comparisons.c + * + * This pass moves ALU comparison operations just before their first use. + * + * It only moves instructions within a single basic block; cross-block + * movement is left to global code motion. + * + * Many GPUs generate condition codes for comparisons, and use predication + * for conditional selects and control flow. In a sequence such as: + * + * vec1 32 ssa_1 = flt a b + * + * vec1 32 ssa_2 = bcsel ssa_1 c d + * + * the backend would likely do the comparison, producing condition codes, + * then save those to a boolean value. The intervening operations might + * trash the condition codes. Then, in order to do the bcsel, it would + * need to re-populate the condition code register based on the boolean. + * + * By moving the comparison just before the bcsel, the condition codes could + * be used directly. This eliminates the need to reload them from the boolean + * (generally eliminating an instruction). It may also eliminate the need to + * create a boolean value altogether (unless it's used elsewhere), which could + * lower register pressure. + */ + +static bool +is_comparison(nir_op op) +{ + switch (op) { + case nir_op_flt: + case nir_op_fge: + case nir_op_feq: + case nir_op_fne: + case nir_op_ilt: + case nir_op_ult: + case nir_op_ige: + case nir_op_uge: + case nir_op_ieq: + case nir_op_ine: + case nir_op_i2b: + case nir_op_f2b: + case nir_op_inot: + case nir_op_fnot: + return true; + default: + return false; + } +} + +static bool +move_comparison_source(nir_src *sr
Re: [Mesa-dev] [PATCH 04/10] nir: Introduce a nir_opt_move_comparisons() pass.
On Sat, 2017-01-07 at 07:45 -0800, Jason Ekstrand wrote: > Looks functionally correct. I left a few simple comments. > > On Jan 7, 2017 3:59 AM, "Timothy Arceri" m> wrote: > From: Kenneth Graunke > > This tries to move comparisons (a common source of boolean values) > closer to their first use. For GPUs which use condition codes, > this can eliminate a lot of temporary booleans and comparisons > which reload the condition code register based on a boolean. > > V2: (Timothy Arceri) > - fix move comparision for phis so we dont end up with: > > vec1 32 ssa_227 = phi block_34: ssa_1, block_38: ssa_240 > vec1 32 ssa_235 = feq ssa_227, ssa_1 > vec1 32 ssa_230 = phi block_34: ssa_221, block_38: ssa_235 > > - add nir_op_i2b/nir_op_f2b to the list of comparisons. > > Signed-off-by: Kenneth Graunke > Reviewed-by: Ian Romanick [v1] > --- > src/compiler/Makefile.sources | 1 + > src/compiler/nir/nir.h | 2 + > src/compiler/nir/nir_opt_move_comparisons.c | 176 > > 3 files changed, 179 insertions(+) > create mode 100644 src/compiler/nir/nir_opt_move_comparisons.c > > diff --git a/src/compiler/Makefile.sources > b/src/compiler/Makefile.sources > index 52f6e54..6da854e 100644 > --- a/src/compiler/Makefile.sources > +++ b/src/compiler/Makefile.sources > @@ -245,6 +245,7 @@ NIR_FILES = \ > nir/nir_opt_global_to_local.c \ > nir/nir_opt_if.c \ > nir/nir_opt_loop_unroll.c \ > + nir/nir_opt_move_comparisons.c \ > nir/nir_opt_peephole_select.c \ > nir/nir_opt_remove_phis.c \ > nir/nir_opt_trivial_continues.c \ > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h > index d17924c..325d73b 100644 > --- a/src/compiler/nir/nir.h > +++ b/src/compiler/nir/nir.h > @@ -2563,6 +2563,8 @@ bool nir_opt_if(nir_shader *shader); > > bool nir_opt_loop_unroll(nir_shader *shader, nir_variable_mode > indirect_mask); > > +bool nir_opt_move_comparisons(nir_shader *shader); > + > bool nir_opt_peephole_select(nir_shader *shader, unsigned limit); > > bool nir_opt_remove_phis(nir_shader *shader); > diff --git a/src/compiler/nir/nir_opt_move_comparisons.c > b/src/compiler/nir/nir_opt_move_comparisons.c > new file mode 100644 > index 000..e6bee94 > --- /dev/null > +++ b/src/compiler/nir/nir_opt_move_comparisons.c > @@ -0,0 +1,176 @@ > +/* > + * Copyright © 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person > obtaining a > + * copy of this software and associated documentation files (the > "Software"), > + * to deal in the Software without restriction, including without > limitation > + * the rights to use, copy, modify, merge, publish, distribute, > sublicense, > + * and/or sell copies of the Software, and to permit persons to whom > the > + * Software is furnished to do so, subject to the following > conditions: > + * > + * The above copyright notice and this permission notice (including > the next > + * paragraph) shall be included in all copies or substantial > portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO > EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES > OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > OTHER DEALINGS > + * IN THE SOFTWARE. > + */ > + > +#include "nir.h" > + > +/** > + * \file nir_opt_move_comparisons.c > + * > + * This pass moves ALU comparison operations just before their first > use. > + * > + * It only moves instructions within a single basic block; cross- > block > + * movement is left to global code motion. > + * > + * Many GPUs generate condition codes for comparisons, and use > predication > + * for conditional selects and control flow. In a sequence such as: > + * > + * vec1 32 ssa_1 = flt a b > + * > + * vec1 32 ssa_2 = bcsel ssa_1 c d > + * > + * the backend would likely do the comparison, producing condition > codes, > + * then save those to a boolean value. The intervening operations > might > + * trash the condition codes. Then, in order to do the bcsel, it > would > + * need to re-populate the condition code register based on the > boolean. > + * > + * By moving the comparison just before the bcsel, the condition > codes could > + * be used directly. This eliminates the need to reload them from > the boolean > + * (generally eliminating an instruction). It may also eliminate > the need to > + * create a boolean value altogether (unless it's used elsewhere), > which could > + * lower register pressure. > + */ > + > +static bool > +is_comparison(nir_op op) > +{ > + switch (op) { > + case nir_op_flt: > + case nir_op_fge: > +
Re: [Mesa-dev] [PATCH] i965: Fix number of slots in SSO mode when there are no user varyings.
Reviewed-by: Jordan Justen On 2017-01-08 15:45:49, Kenneth Graunke wrote: > We want vue_map->num_slots to be one more than the final slot. > > When assigning fixed slots, built-in slots, and non-SSO user varyings, > we do slot++. This leaves "slot" as one past the most recently assigned > slot. But for SSO user varyings, we computed slot based on the varying > location value...and left it at that slot value. > > To work around this inconsistency, I made num_slots be "slot + 1" if > separate and "slot" otherwise. The problem is...if there are no user > varyings in SSO mode...then we would have done slot++ when assigning > built-ins, so it would be off by one. This resulted in loops from 0 > to vue_map->num_slots hitting a bonus BRW_VARYING_SLOT_PAD at the end. > > This used to break the SIMD8 VS/TES backends, but I fixed that in > commit 480d6c1653713dcae617ac523b2ca5deee01c845. It's probably safe > at this point, but we should fix it anyway. > > To fix this, do slot++ in all cases. For SSO mode, we overwrite slot > for every varying, so this increment only matters on the last varying. > Because we process varyings in order, this will set slot to 1 more > than the highest assigned slot. > > Signed-off-by: Kenneth Graunke > --- > src/mesa/drivers/dri/i965/brw_vue_map.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vue_map.c > b/src/mesa/drivers/dri/i965/brw_vue_map.c > index 982a31f9034..0d8f6c700b6 100644 > --- a/src/mesa/drivers/dri/i965/brw_vue_map.c > +++ b/src/mesa/drivers/dri/i965/brw_vue_map.c > @@ -181,14 +181,12 @@ brw_compute_vue_map(const struct gen_device_info > *devinfo, >const int varying = ffsll(generics) - 1; >if (separate) { > slot = first_generic_slot + varying - VARYING_SLOT_VAR0; > - assign_vue_slot(vue_map, varying, slot); > - } else { > - assign_vue_slot(vue_map, varying, slot++); >} > + assign_vue_slot(vue_map, varying, slot++); >generics &= ~BITFIELD64_BIT(varying); > } > > - vue_map->num_slots = separate ? slot + 1 : slot; > + vue_map->num_slots = slot; > vue_map->num_per_vertex_slots = 0; > vue_map->num_per_patch_slots = 0; > } > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 99319] godot engine poor performance
https://bugs.freedesktop.org/show_bug.cgi?id=99319 --- Comment #3 from Bas Nieuwenhuizen --- It seems a VBO with a stride of 14 gets used, the u_vbuf determines that is not 4 byte aligned and then translates it on the CPU to be 4-byte aligned. For the 3 vertex attributes each it maps the VBO read-only, for which radeonsi uses a staging buffer. As the copy to staging buffer needs to finish during the map we do an IB flush. In the end we end up with 3 GFX IB flushes per draw call, which costs a lot of performance. In the end I don't think the translation is even necessary, as all attributes are vectors of GL_BYTE and GL_HALF_FLOAT. Two things to improve: - don't use a staging buffer for small maps (or if we decide to do it to serve future maps, make sure we actually share the staging buffer) - make u_vbuf smarter so that it doesn't translate ion this case. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 5/5] radv: Create single RADV_DEBUG env var.
On 4 January 2017 at 08:06, Bas Nieuwenhuizen wrote: > Also changed RADV_SHOW_QUEUES to a no compute queue option. That > would make more sense later when the compute queue is established, > but the transfer queue still experimental. > > v2: Don't include the trace flag. Reviewed-by: Dave Airlie for the series. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/11] spirv: Add tessellation varying and built-in support.
We need to: - handle the extra array level for per-vertex varyings - handle the patch qualifier correctly - assign varying locations Signed-off-by: Kenneth Graunke --- src/compiler/spirv/vtn_private.h | 1 + src/compiler/spirv/vtn_variables.c | 56 ++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 9302611803f..8b450106543 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -280,6 +280,7 @@ struct vtn_variable { unsigned descriptor_set; unsigned binding; unsigned input_attachment_index; + bool patch; nir_variable *var; nir_variable **members; diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index e3845365bdd..dcd0609626b 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -935,10 +935,19 @@ vtn_get_builtin_location(struct vtn_builder *b, unreachable("invalid stage for SpvBuiltInViewportIndex"); break; case SpvBuiltInTessLevelOuter: + *location = VARYING_SLOT_TESS_LEVEL_OUTER; + break; case SpvBuiltInTessLevelInner: + *location = VARYING_SLOT_TESS_LEVEL_INNER; + break; case SpvBuiltInTessCoord: + *location = SYSTEM_VALUE_TESS_COORD; + set_mode_system_value(mode); + break; case SpvBuiltInPatchVertices: - unreachable("no tessellation support"); + *location = SYSTEM_VALUE_VERTICES_IN; + set_mode_system_value(mode); + break; case SpvBuiltInFragCoord: *location = VARYING_SLOT_POS; assert(*mode == nir_var_shader_in); @@ -1052,6 +1061,11 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var, vtn_get_builtin_location(b, builtin, &nir_var->data.location, &mode); nir_var->data.mode = mode; + if (builtin == SpvBuiltInTessLevelOuter || + builtin == SpvBuiltInTessLevelInner) { + nir_var->data.compact = true; + } + if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition) nir_var->data.origin_upper_left = b->origin_upper_left; @@ -1076,7 +1090,7 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var, break; /* Do nothing with these here */ case SpvDecorationPatch: - vtn_warn("Tessellation not yet supported"); + nir_var->data.patch = true; break; case SpvDecorationLocation: @@ -1116,6 +1130,15 @@ apply_var_decoration(struct vtn_builder *b, nir_variable *nir_var, } static void +var_is_patch_cb(struct vtn_builder *b, struct vtn_value *val, int member, +const struct vtn_decoration *dec, void *out_is_patch) +{ + if (dec->decoration == SpvDecorationPatch) { + *((bool *) out_is_patch) = true; + } +} + +static void var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, const struct vtn_decoration *dec, void *void_var) { @@ -1132,6 +1155,9 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, case SpvDecorationInputAttachmentIndex: vtn_var->input_attachment_index = dec->literals[0]; return; + case SpvDecorationPatch: + vtn_var->patch = true; + break; default: break; } @@ -1162,7 +1188,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, } else if (vtn_var->mode == vtn_variable_mode_input || vtn_var->mode == vtn_variable_mode_output) { is_vertex_input = false; - location += VARYING_SLOT_VAR0; + location += vtn_var->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0; } else { unreachable("Location must be on input or output variable"); } @@ -1209,6 +1235,24 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, } } +static bool +is_per_vertex_inout(const struct vtn_variable *var, gl_shader_stage stage) +{ + if (var->patch || !glsl_type_is_array(var->type->type)) + return false; + + if (var->mode == vtn_variable_mode_input) { + return stage == MESA_SHADER_TESS_CTRL || + stage == MESA_SHADER_TESS_EVAL || + stage == MESA_SHADER_GEOMETRY; + } + + if (var->mode == vtn_variable_mode_output) + return stage == MESA_SHADER_TESS_CTRL; + + return false; +} + void vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, const uint32_t *w, unsigned count) @@ -1308,6 +1352,9 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, case vtn_variable_mode_input: case vtn_variable_mode_output: { + var->patch = false; + vtn_foreach_decoration(b, val, var_is_patch_cb, &var->patch); + /* For inputs and outputs, we immediately split structures. This * is for a couple of reasons. For one, builtins may all come in * a struct and w
[Mesa-dev] [PATCH 04/11] nir: Add a pass to lower TES patch_vertices intrinsics to a constant.
In Vulkan, we always have both the TCS and TES available in the same pipeline, so we can simply use the TCS OutputVertices execution mode value as the TES PatchVertices built-in. For GLSL, we handle this in the linker. But we could use this pass in the case when both TCS and TES are linked together, if we wanted. Signed-off-by: Kenneth Graunke --- src/compiler/Makefile.sources | 1 + src/compiler/nir/nir.h | 1 + src/compiler/nir/nir_lower_patch_vertices.c | 53 + 3 files changed, 55 insertions(+) create mode 100644 src/compiler/nir/nir_lower_patch_vertices.c diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 52f6e5428f4..7479afae047 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -218,6 +218,7 @@ NIR_FILES = \ nir/nir_lower_io_to_scalar.c \ nir/nir_lower_io_types.c \ nir/nir_lower_passthrough_edgeflags.c \ + nir/nir_lower_patch_vertices.c \ nir/nir_lower_phis_to_scalar.c \ nir/nir_lower_regs_to_ssa.c \ nir/nir_lower_returns.c \ diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index d17924c2aac..cb8f7749745 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2464,6 +2464,7 @@ void nir_lower_two_sided_color(nir_shader *shader); void nir_lower_clamp_color_outputs(nir_shader *shader); void nir_lower_passthrough_edgeflags(nir_shader *shader); +void nir_lower_tes_patch_vertices(nir_shader *tes, unsigned patch_vertices); typedef struct nir_lower_wpos_ytransform_options { int state_tokens[5]; diff --git a/src/compiler/nir/nir_lower_patch_vertices.c b/src/compiler/nir/nir_lower_patch_vertices.c new file mode 100644 index 000..d196576b993 --- /dev/null +++ b/src/compiler/nir/nir_lower_patch_vertices.c @@ -0,0 +1,53 @@ +/* + * Copyright © 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "nir_builder.h" + +void +nir_lower_tes_patch_vertices(nir_shader *tes_nir, unsigned patch_vertices) +{ + nir_foreach_function(function, tes_nir) { + if (function->impl) { + nir_foreach_block(block, function->impl) { +nir_builder b; +nir_builder_init(&b, function->impl); +nir_foreach_instr_safe(instr, block) { + if (instr->type == nir_instr_type_intrinsic) { + nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); + if (intr->intrinsic != nir_intrinsic_load_patch_vertices_in) + continue; + + b.cursor = nir_before_instr(&intr->instr); + nir_ssa_def *val = nir_imm_int(&b, patch_vertices); + nir_ssa_def_rewrite_uses(&intr->dest.ssa, + nir_src_for_ssa(val)); + nir_instr_remove(instr); + } +} + } + + nir_metadata_preserve(function->impl, nir_metadata_block_index | + nir_metadata_dominance); + } + } +} -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/11] anv: Initialize physical device limits for tessellation
Signed-off-by: Kenneth Graunke --- src/intel/vulkan/anv_device.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 062fab6fabe..a0240d289ba 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -544,14 +544,14 @@ void anv_GetPhysicalDeviceProperties( .maxVertexInputAttributeOffset= 2047, .maxVertexInputBindingStride = 2048, .maxVertexOutputComponents= 128, - .maxTessellationGenerationLevel = 0, - .maxTessellationPatchSize = 0, - .maxTessellationControlPerVertexInputComponents = 0, - .maxTessellationControlPerVertexOutputComponents = 0, - .maxTessellationControlPerPatchOutputComponents = 0, - .maxTessellationControlTotalOutputComponents = 0, - .maxTessellationEvaluationInputComponents = 0, - .maxTessellationEvaluationOutputComponents = 0, + .maxTessellationGenerationLevel = 64, + .maxTessellationPatchSize = 32, + .maxTessellationControlPerVertexInputComponents = 128, + .maxTessellationControlPerVertexOutputComponents = 128, + .maxTessellationControlPerPatchOutputComponents = 128, + .maxTessellationControlTotalOutputComponents = 2048, + .maxTessellationEvaluationInputComponents = 128, + .maxTessellationEvaluationOutputComponents = 128, .maxGeometryShaderInvocations = 32, .maxGeometryInputComponents = 64, .maxGeometryOutputComponents = 128, -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/11] spirv: Silence unsupported tessellation capability warnings.
This is all implemented now. Signed-off-by: Kenneth Graunke --- src/compiler/spirv/spirv_to_nir.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 8f19afa77ee..2ea836bd7f6 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -515,7 +515,6 @@ struct_member_decoration_cb(struct vtn_builder *b, break; case SpvDecorationPatch: - vtn_warn("Tessellation not yet supported"); break; case SpvDecorationSpecId: @@ -2505,11 +2504,11 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, case SpvCapabilityInputAttachment: case SpvCapabilityImageGatherExtended: case SpvCapabilityStorageImageExtendedFormats: + case SpvCapabilityTessellation: + case SpvCapabilityTessellationPointSize: break; case SpvCapabilityGeometryStreams: - case SpvCapabilityTessellation: - case SpvCapabilityTessellationPointSize: case SpvCapabilityLinkage: case SpvCapabilityVector16: case SpvCapabilityFloat16Buffer: -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/11] anv: Emit 3DSTATE_HS/TE/DS packets.
Signed-off-by: Kenneth Graunke --- src/intel/vulkan/anv_private.h | 2 + src/intel/vulkan/genX_pipeline.c | 87 src/intel/vulkan/genX_state.c| 4 -- 3 files changed, 89 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 9e3b72e77bd..47b9eb3e94d 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1476,6 +1476,8 @@ get_##prefix##_prog_data(struct anv_pipeline *pipeline) \ } ANV_DECL_GET_PROG_DATA_FUNC(vs, MESA_SHADER_VERTEX) +ANV_DECL_GET_PROG_DATA_FUNC(tcs, MESA_SHADER_TESS_CTRL) +ANV_DECL_GET_PROG_DATA_FUNC(tes, MESA_SHADER_TESS_EVAL) ANV_DECL_GET_PROG_DATA_FUNC(gs, MESA_SHADER_GEOMETRY) ANV_DECL_GET_PROG_DATA_FUNC(wm, MESA_SHADER_FRAGMENT) ANV_DECL_GET_PROG_DATA_FUNC(cs, MESA_SHADER_COMPUTE) diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 9ff84cd2921..80b7c75a47c 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -965,6 +965,92 @@ emit_3dstate_vs(struct anv_pipeline *pipeline) } static void +emit_3dstate_hs_te_ds(struct anv_pipeline *pipeline) +{ + if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL)) { + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_HS), hs); + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_TE), te); + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_DS), ds); + return; + } + + const struct gen_device_info *devinfo = &pipeline->device->info; + const struct anv_shader_bin *tcs_bin = + pipeline->shaders[MESA_SHADER_TESS_CTRL]; + const struct anv_shader_bin *tes_bin = + pipeline->shaders[MESA_SHADER_TESS_EVAL]; + + const struct brw_tcs_prog_data *tcs_prog_data = get_tcs_prog_data(pipeline); + const struct brw_tes_prog_data *tes_prog_data = get_tes_prog_data(pipeline); + + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_HS), hs) { + hs.Enable = true; + hs.StatisticsEnable = true; + hs.SamplerCount = get_sampler_count(tcs_bin); + hs.BindingTableEntryCount = get_binding_table_entry_count(tcs_bin); + hs.MaximumNumberofThreads = devinfo->max_tcs_threads - 1; + hs.InstanceCount = tcs_prog_data->instances - 1; + hs.KernelStartPointer = tcs_bin->kernel.offset; + + hs.PerThreadScratchSpace = get_scratch_space(tcs_bin); + hs.ScratchSpaceBasePointer = + get_scratch_address(pipeline, MESA_SHADER_TESS_CTRL, tcs_bin); + + hs.IncludeVertexHandles = true; + hs.DispatchGRFStartRegisterForURBData = + tcs_prog_data->base.base.dispatch_grf_start_reg; + hs.VertexURBEntryReadLength = 0; + hs.VertexURBEntryReadOffset = 0; + } + + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_TE), te) { + te.Partitioning = tes_prog_data->partitioning; + te.OutputTopology = tes_prog_data->output_topology; + te.TEDomain = tes_prog_data->domain; + te.TEEnable = true; + te.MaximumTessellationFactorOdd = 63.0; + te.MaximumTessellationFactorNotOdd = 64.0; + } + + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_DS), ds) { + ds.KernelStartPointer = tes_bin->kernel.offset; + ds.SamplerCount = get_sampler_count(tes_bin); + ds.BindingTableEntryCount = get_binding_table_entry_count(tes_bin); + + ds.PerThreadScratchSpace = get_scratch_space(tes_bin); + ds.ScratchSpaceBasePointer = + get_scratch_address(pipeline, MESA_SHADER_TESS_EVAL, tes_bin); + + ds.DispatchGRFStartRegisterForURBData = + tes_prog_data->base.base.dispatch_grf_start_reg; + ds.PatchURBEntryReadLength = tes_prog_data->base.urb_read_length; + ds.PatchURBEntryReadOffset = 0; + ds.MaximumNumberofThreads = devinfo->max_tes_threads - 1; + ds.StatisticsEnable = true; + + ds.ComputeWCoordinateEnable = + tes_prog_data->domain == BRW_TESS_DOMAIN_TRI; + ds.FunctionEnable = true; + +#if GEN_GEN >= 8 + ds.DispatchMode = + tes_prog_data->base.dispatch_mode == DISPATCH_MODE_SIMD8 ? +DISPATCH_MODE_SIMD8_SINGLE_PATCH : +DISPATCH_MODE_SIMD4X2; + + ds.UserClipDistanceClipTestEnableBitmask = + tes_prog_data->base.clip_distance_mask; + ds.UserClipDistanceCullTestEnableBitmask = + tes_prog_data->base.cull_distance_mask; + + ds.VertexURBEntryOutputReadOffset = 1; + ds.VertexURBEntryOutputLength = + (tes_prog_data->base.vue_map.num_slots + 1) / 2 - 1; +#endif + } +} + +static void emit_3dstate_gs(struct anv_pipeline *pipeline) { const struct gen_device_info *devinfo = &pipeline->device->info; @@ -1315,6 +1401,7 @@ genX(graphics_pipeline_create)( #endif emit_3dstate_vs(pipeline); + emit_3dstate_hs_te_ds(pipeline); emit_3dstate_gs(pipeline); emit_3dstate_sbe(pipeline); emit_3dstate_wm(pipeline, subpass, pCreateInfo->pMultisampleState); diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.
[Mesa-dev] [PATCH 11/11] anv: Enable tessellation shaders.
Signed-off-by: Kenneth Graunke --- src/intel/vulkan/anv_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) I'm not clear whether we want to do this yet. On Skylake, the status is: 99.3% of the CTS passing, Sascha demos work. There are two remaining sets of failures: - dEQP-VK.tessellation.primitive_discard.*_point_mode (20 failures) (points appear in the wrong position - at least different than GLES) - dEQP-VK.tessellation.user_defined_io.per_patch_block_array.vertex_io_array_size_* (9 failures) (not sure what the problem is) On Haswell, the status is: [6581/6581] skip: 4364, pass: 2217 Most tests skip because we don't advertise image load/store and SSBOs in vec4 stages. Notably, all failing tests on Gen8+ skip. So, everything technically passes. It probably has the same bugs. diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index a0240d289ba..34f267dff8b 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -445,7 +445,7 @@ void anv_GetPhysicalDeviceFeatures( .imageCubeArray = true, .independentBlend = true, .geometryShader = true, - .tessellationShader = false, + .tessellationShader = true, .sampleRateShading= true, .dualSrcBlend = true, .logicOp = true, -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/11] spirv: Handle tessellation execution modes.
Signed-off-by: Kenneth Graunke --- src/compiler/spirv/spirv_to_nir.c | 28 ++-- 1 file changed, 22 insertions(+), 6 deletions(-) One totally bogus thing here: we set CCW backwards. In all three driver backends (i965, nvc0, radeonsi), we invert CCW because it doesn't seem to match the HW. That means that Vulkan CCW and HW CCW match, and it's just OpenGL that's backwards. We should figure out what's actually going on here and decide which meaning we want to go with. diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 41da0e85c9d..8f19afa77ee 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2655,8 +2655,12 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, break; /* Nothing to do with this */ case SpvExecutionModeOutputVertices: - assert(b->shader->stage == MESA_SHADER_GEOMETRY); - b->shader->info->gs.vertices_out = mode->literals[0]; + if (b->shader->stage == MESA_SHADER_TESS_CTRL) { + b->shader->info->tcs.vertices_out = mode->literals[0]; + } else { + assert(b->shader->stage == MESA_SHADER_GEOMETRY); + b->shader->info->gs.vertices_out = mode->literals[0]; + } break; case SpvExecutionModeInputPoints: @@ -2666,11 +2670,13 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, case SpvExecutionModeInputTrianglesAdjacency: case SpvExecutionModeQuads: case SpvExecutionModeIsolines: - if (b->shader->stage == MESA_SHADER_GEOMETRY) { + if (b->shader->stage == MESA_SHADER_TESS_EVAL) { + b->shader->info->tes.primitive_mode = +gl_primitive_from_spv_execution_mode(mode->exec_mode); + } else { + assert(b->shader->stage == MESA_SHADER_GEOMETRY); b->shader->info->gs.vertices_in = vertices_in_from_spv_execution_mode(mode->exec_mode); - } else { - assert(!"Tesselation shaders not yet supported"); } break; @@ -2683,12 +2689,22 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point, break; case SpvExecutionModeSpacingEqual: + b->shader->info->tes.spacing = TESS_SPACING_EQUAL; + break; case SpvExecutionModeSpacingFractionalEven: + b->shader->info->tes.spacing = TESS_SPACING_FRACTIONAL_EVEN; + break; case SpvExecutionModeSpacingFractionalOdd: + b->shader->info->tes.spacing = TESS_SPACING_FRACTIONAL_ODD; + break; case SpvExecutionModeVertexOrderCw: + b->shader->info->tes.ccw = true; + break; case SpvExecutionModeVertexOrderCcw: + b->shader->info->tes.ccw = false; + break; case SpvExecutionModePointMode: - assert(!"TODO: Add tessellation metadata"); + b->shader->info->tes.point_mode = true; break; case SpvExecutionModePixelCenterInteger: -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/11] anv: Compile TCS/TES shaders.
Signed-off-by: Kenneth Graunke --- src/intel/vulkan/anv_pipeline.c | 156 +++- 1 file changed, 154 insertions(+), 2 deletions(-) There's one majorly bogus thing here: caching is totally disabled. We set key fields based on the NIR, which breaks the dataflow expectations for the program cache. A few of those we could look up from the SPIR-V. Others...not so much. I'm not sure what to do about it. Another somewhat bogus thing: we might need to apply the PointMode "it can be in either stage" hack to more fields. It's ugly, but unfortunately SPIR-V opted not to decide, so we have to look in either place... diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index b34759a5406..743f82ad69c 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -492,6 +492,151 @@ anv_pipeline_compile_vs(struct anv_pipeline *pipeline, } static VkResult +anv_pipeline_compile_tcs_tes(struct anv_pipeline *pipeline, + struct anv_pipeline_cache *cache, + const VkGraphicsPipelineCreateInfo *info, + struct anv_shader_module *tcs_module, + const char *tcs_entrypoint, + const VkSpecializationInfo *tcs_spec_info, + struct anv_shader_module *tes_module, + const char *tes_entrypoint, + const VkSpecializationInfo *tes_spec_info) +{ + const struct gen_device_info *devinfo = &pipeline->device->info; + const struct brw_compiler *compiler = + pipeline->device->instance->physicalDevice.compiler; + struct anv_pipeline_bind_map tcs_map; + struct anv_pipeline_bind_map tes_map; + struct brw_tcs_prog_key tcs_key = { 0, }; + struct brw_tes_prog_key tes_key = { 0, }; + struct anv_shader_bin *tcs_bin = NULL; + struct anv_shader_bin *tes_bin = NULL; + unsigned char tcs_sha1[20]; + unsigned char tes_sha1[20]; + + populate_sampler_prog_key(&pipeline->device->info, &tcs_key.tex); + populate_sampler_prog_key(&pipeline->device->info, &tes_key.tex); + tcs_key.input_vertices = info->pTessellationState->patchControlPoints; + + if (tcs_module->size > 0 || tes_module->size > 0) { + anv_hash_shader(tcs_sha1, &tcs_key, sizeof(tcs_key), tcs_module, + tcs_entrypoint, pipeline->layout, tcs_spec_info); + anv_hash_shader(tes_sha1, &tes_key, sizeof(tes_key), tes_module, + tes_entrypoint, pipeline->layout, tes_spec_info); + //tcs_bin = anv_pipeline_cache_search(cache, tcs_sha1, 20); + //tes_bin = anv_pipeline_cache_search(cache, tes_sha1, 20); + } + + if (tcs_bin == NULL || tes_bin == NULL) { + struct brw_tcs_prog_data tcs_prog_data = { 0, }; + struct brw_tes_prog_data tes_prog_data = { 0, }; + struct anv_pipeline_binding tcs_surface_to_descriptor[256]; + struct anv_pipeline_binding tcs_sampler_to_descriptor[256]; + struct anv_pipeline_binding tes_surface_to_descriptor[256]; + struct anv_pipeline_binding tes_sampler_to_descriptor[256]; + + tcs_map = (struct anv_pipeline_bind_map) { + .surface_to_descriptor = tcs_surface_to_descriptor, + .sampler_to_descriptor = tcs_sampler_to_descriptor + }; + tes_map = (struct anv_pipeline_bind_map) { + .surface_to_descriptor = tes_surface_to_descriptor, + .sampler_to_descriptor = tes_sampler_to_descriptor + }; + + nir_shader *tcs_nir = + anv_pipeline_compile(pipeline, tcs_module, tcs_entrypoint, + MESA_SHADER_TESS_CTRL, tcs_spec_info, + &tcs_prog_data.base.base, &tcs_map); + nir_shader *tes_nir = + anv_pipeline_compile(pipeline, tes_module, tes_entrypoint, + MESA_SHADER_TESS_EVAL, tes_spec_info, + &tes_prog_data.base.base, &tes_map); + if (tcs_nir == NULL || tes_nir == NULL) + return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + + nir_lower_tes_patch_vertices(tes_nir, tcs_nir->info->tcs.vertices_out); + + /* The Vulkan 1.0.29 spec, section 21.1 Tessellator says: + * + *"PointMode. Controls generation of points rather than triangles + * or lines. This functionality defaults to disabled, and is + * enabled if either shader stage includes the execution mode. + * + * The backend looks at the TES, so OR in the flag from the TCS. + */ + tes_nir->info->tes.point_mode |= tcs_nir->info->tes.point_mode; + + anv_fill_binding_table(&tcs_prog_data.base.base, 0); + anv_fill_binding_table(&tes_prog_data.base.base, 0); + + void *mem_ctx = ralloc_context(NULL); + + ralloc_steal(mem_ctx, tcs_nir); + ralloc_steal(mem_ctx, tes_nir); + + tcs_key.tes_primitive_mode = tes_nir->info->tes.primitive_mode; + tcs_key.
[Mesa-dev] [PATCH 08/11] anv: Use the TES output VUE map when it's the last enabled stage.
Signed-off-by: Kenneth Graunke --- src/intel/vulkan/genX_pipeline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 80b7c75a47c..9a8d2a19b63 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -252,6 +252,7 @@ static void emit_3dstate_sbe(struct anv_pipeline *pipeline) { const struct brw_vs_prog_data *vs_prog_data = get_vs_prog_data(pipeline); + const struct brw_tes_prog_data *tes_prog_data = get_tes_prog_data(pipeline); const struct brw_gs_prog_data *gs_prog_data = get_gs_prog_data(pipeline); const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline); const struct brw_vue_map *fs_input_map; @@ -266,6 +267,8 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline) if (gs_prog_data) fs_input_map = &gs_prog_data->base.vue_map; + else if (tes_prog_data) + fs_input_map = &tes_prog_data->base.vue_map; else fs_input_map = &vs_prog_data->base.vue_map; -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/11] anv: Handle patch primitives.
Signed-off-by: Kenneth Graunke --- src/intel/vulkan/anv_pipeline.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 17491e34fc0..b34759a5406 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -212,7 +212,6 @@ static const uint32_t vk_to_gen_primitive_type[] = { [VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ, [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY] = _3DPRIM_TRILIST_ADJ, [VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ, -/* [VK_PRIMITIVE_TOPOLOGY_PATCH_LIST]= _3DPRIM_PATCHLIST_1 */ }; static void @@ -1086,8 +1085,14 @@ anv_pipeline_init(struct anv_pipeline *pipeline, const VkPipelineInputAssemblyStateCreateInfo *ia_info = pCreateInfo->pInputAssemblyState; + const VkPipelineTessellationStateCreateInfo *tess_info = + pCreateInfo->pTessellationState; pipeline->primitive_restart = ia_info->primitiveRestartEnable; - pipeline->topology = vk_to_gen_primitive_type[ia_info->topology]; + + if (tess_info) + pipeline->topology = _3DPRIM_PATCHLIST(tess_info->patchControlPoints); + else + pipeline->topology = vk_to_gen_primitive_type[ia_info->topology]; return VK_SUCCESS; -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/11] anv: Clamp depth buffer dimensions to be at least 1.
When there are no framebuffer attachments, fb->width and fb->height will be 0. Subtracting 1 results in 4294967295 which is too large for the field, causing genxml assertions when trying to create the packet. In this case, we can just program it to 1. Caught by dEQP-VK.tessellation.tesscoord.triangles_equal_spacing. Signed-off-by: Kenneth Graunke --- src/intel/vulkan/genX_cmd_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) I'm expecting a NAK from Jason on this patch. Hopefully we can find a real solution to this problem... diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 6131cfb60e3..0c638d6b02d 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2159,8 +2159,8 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer) db.SurfaceType = SURFTYPE_2D; } db.SurfaceFormat= D32_FLOAT; - db.Width= fb->width - 1; - db.Height = fb->height - 1; + db.Width= MAX2(fb->width, 1) - 1; + db.Height = MAX2(fb->height, 1) - 1; db.StencilWriteEnable = has_stencil; } } -- 2.11.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/11] anv: Enable tessellation shaders.
Woohoo! I'll review tomorrow. On Jan 8, 2017 9:28 PM, "Kenneth Graunke" wrote: > Signed-off-by: Kenneth Graunke > --- > src/intel/vulkan/anv_device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > I'm not clear whether we want to do this yet. > > On Skylake, the status is: 99.3% of the CTS passing, Sascha demos work. > There are two remaining sets of failures: > > - dEQP-VK.tessellation.primitive_discard.*_point_mode (20 failures) > (points appear in the wrong position - at least different than GLES) > - > dEQP-VK.tessellation.user_defined_io.per_patch_block_array.vertex_io_array_size_* > (9 failures) > (not sure what the problem is) > > On Haswell, the status is: > > [6581/6581] skip: 4364, pass: 2217 > > Most tests skip because we don't advertise image load/store and SSBOs in > vec4 stages. Notably, all failing tests on Gen8+ skip. So, everything > technically passes. It probably has the same bugs. > > diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c > index a0240d289ba..34f267dff8b 100644 > --- a/src/intel/vulkan/anv_device.c > +++ b/src/intel/vulkan/anv_device.c > @@ -445,7 +445,7 @@ void anv_GetPhysicalDeviceFeatures( >.imageCubeArray = true, >.independentBlend = true, >.geometryShader = true, > - .tessellationShader = false, > + .tessellationShader = true, >.sampleRateShading= true, >.dualSrcBlend = true, >.logicOp = true, > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Clean ups (hopefully last time)
Sorry to keep spamming the list with these but a bunch have now landed and theire was a bug fix and a bunch of rebasing required in the remaining patches. Thanks to all that have help review the series so far. Patches 4-6 is the big change everything else shouldn't be too hard to review. Patches 4-6 also need to be squash to avoid compile issues and functionality regressions. I would like to have split them up more but couldn't see a nice way of doing it. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/25] mesa: update active relinked program
This likely fixes a subroutine bug were _mesa_shader_program_init_subroutine_defaults() would never have been called for the relinked program as we previously just set _NEW_PROGRAM as dirty and never called the _mesa_use* functions. We also switch to using gl_program for the CurrentProgram array so this change will need to be sqashed with the previous two. --- src/mesa/main/shaderapi.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 9fa8ce1..f03c47d 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1098,7 +1098,8 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg) unsigned programs_in_use = 0; if (ctx->_Shader) for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) { - if (ctx->_Shader->CurrentProgram[stage] == shProg) { + if (ctx->_Shader->CurrentProgram[stage] && + ctx->_Shader->CurrentProgram[stage]->Id == shProg->Name) { programs_in_use |= 1 << stage; } } @@ -1117,7 +1118,15 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg) * is attached." */ if (shProg->data->LinkStatus && programs_in_use) { - ctx->NewState |= _NEW_PROGRAM; + while (programs_in_use) { + const int stage = u_bit_scan(&programs_in_use); + + struct gl_program *prog = NULL; + if (shProg->_LinkedShaders[stage]) +prog = shProg->_LinkedShaders[stage]->Program; + + _mesa_use_program(ctx, stage, prog, ctx->_Shader); + } } /* Capture .shader_test files. */ -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/25] mesa: use gl_program for CurrentProgram rather than gl_shader_program
This makes much more sense and should be more performant in some critical paths such as SSO validation which is called at draw time. Previously the CurrentProgram array could have contained multiple pointers to the same struct which was confusing and we would often need to fish out the information we were really after from the gl_program anyway. Also it was error prone to depend on the _LinkedShader array for programs in current use because a failed linking attempt will lose the infomation about the current program in use which is still valid. V2: fix validate_io() to compare linked_stages rather than the consumer and producer to decide if we are looking at inward facing shader interfaces which don't need validation. --- src/mesa/drivers/common/meta.c| 11 ++-- src/mesa/drivers/common/meta.h| 2 +- src/mesa/drivers/dri/i965/brw_context.c | 10 ++-- src/mesa/drivers/dri/i965/brw_ff_gs.c | 4 +- src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 8 +-- src/mesa/drivers/dri/i965/brw_tcs_surface_state.c | 8 +-- src/mesa/drivers/dri/i965/brw_tes_surface_state.c | 8 +-- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 9 +--- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 ++-- src/mesa/drivers/dri/i965/gen6_sol.c | 24 - src/mesa/drivers/dri/i965/gen7_l3_state.c | 6 +-- src/mesa/main/api_validate.c | 57 src/mesa/main/ff_fragment_shader.cpp | 6 +-- src/mesa/main/mtypes.h| 2 +- src/mesa/main/pipelineobj.c | 52 +-- src/mesa/main/shader_query.cpp| 38 ++ src/mesa/main/shaderapi.c | 63 ++- src/mesa/main/state.c | 50 +++--- src/mesa/main/texstate.c | 5 +- src/mesa/main/transformfeedback.c | 2 +- src/mesa/main/uniform_query.cpp | 21 +++- src/mesa/state_tracker/st_atom_atomicbuf.c| 20 +++ src/mesa/state_tracker/st_atom_constbuf.c | 43 +--- src/mesa/state_tracker/st_atom_image.c| 42 +-- src/mesa/state_tracker/st_atom_storagebuf.c | 48 + src/mesa/state_tracker/st_cb_compute.c| 4 +- 26 files changed, 198 insertions(+), 355 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 0d5661b..15d28b2 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -594,8 +594,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) * that we don't have to worry about the current pipeline state. */ for (i = 0; i < MESA_SHADER_STAGES; i++) { - _mesa_reference_shader_program(ctx, &save->Shader[i], -ctx->Shader.CurrentProgram[i]); + _mesa_reference_program(ctx, &save->Program[i], + ctx->Shader.CurrentProgram[i]); } _mesa_reference_shader_program(ctx, &save->ActiveShader, ctx->Shader.ActiveProgram); @@ -972,16 +972,15 @@ _mesa_meta_end(struct gl_context *ctx) * program object must be NULL. _mesa_use_shader_program is a no-op * in that case. */ - _mesa_use_shader_program(ctx, targets[i], - save->Shader[i], + _mesa_use_shader_program(ctx, targets[i], save->Program[i], &ctx->Shader); /* Do this *before* killing the reference. :) */ - if (save->Shader[i] != NULL) + if (save->Program[i] != NULL) any_shader = true; - _mesa_reference_shader_program(ctx, &save->Shader[i], NULL); + _mesa_reference_program(ctx, &save->Program[i], NULL); } _mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 0a913e9..1b5cf42 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -125,7 +125,7 @@ struct save_state GLboolean FragmentProgramEnabled; struct gl_program *FragmentProgram; GLboolean ATIFragmentShaderEnabled; - struct gl_shader_program *Shader[MESA_SHADER_STAGES]; + struct gl_program *Program[MESA_SHADER_STAGES]; struct gl_shader_program *ActiveShader; struct gl_pipeline_object *Pipeline; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 84d34c0..0b3ac89 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -274,14 +274,12 @@ intel_update_state(struct gl_context * ctx, GLuint new_state) /* Resolve color for each active shader image. */ for (unsigned i =
[Mesa-dev] [PATCH 01/25] mesa/glsl: move ProgramResourceList to gl_shader_program_data
We also move NumProgramResourceList at the same time. GLES does interface validation on SSO at runtime so we need to move this to be able to switch to storing gl_program pointers in CurrentProgram. --- src/compiler/glsl/linker.cpp | 20 +-- src/mesa/main/mtypes.h | 8 src/mesa/main/program_resource.c | 40 ++--- src/mesa/main/shader_query.cpp | 43 +++- src/mesa/main/shaderobj.c| 8 5 files changed, 63 insertions(+), 56 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index d187b66..dfee70a 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3534,25 +3534,25 @@ add_program_resource(struct gl_shader_program *prog, if (_mesa_set_search(resource_set, data)) return true; - prog->ProgramResourceList = + prog->data->ProgramResourceList = reralloc(prog, - prog->ProgramResourceList, + prog->data->ProgramResourceList, gl_program_resource, - prog->NumProgramResourceList + 1); + prog->data->NumProgramResourceList + 1); - if (!prog->ProgramResourceList) { + if (!prog->data->ProgramResourceList) { linker_error(prog, "Out of memory during linking.\n"); return false; } struct gl_program_resource *res = - &prog->ProgramResourceList[prog->NumProgramResourceList]; + &prog->data->ProgramResourceList[prog->data->NumProgramResourceList]; res->Type = type; res->Data = data; res->StageReferences = stages; - prog->NumProgramResourceList++; + prog->data->NumProgramResourceList++; _mesa_set_add(resource_set, data); @@ -4196,10 +4196,10 @@ build_program_resource_list(struct gl_context *ctx, struct gl_shader_program *shProg) { /* Rebuild resource list. */ - if (shProg->ProgramResourceList) { - ralloc_free(shProg->ProgramResourceList); - shProg->ProgramResourceList = NULL; - shProg->NumProgramResourceList = 0; + if (shProg->data->ProgramResourceList) { + ralloc_free(shProg->data->ProgramResourceList); + shProg->data->ProgramResourceList = NULL; + shProg->data->NumProgramResourceList = 0; } int input_stage = MESA_SHADER_STAGES, output_stage = 0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 793a527..8608b66 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2668,6 +2668,10 @@ struct gl_shader_program_data struct gl_active_atomic_buffer *AtomicBuffers; unsigned NumAtomicBuffers; + /** List of all active resources after linking. */ + struct gl_program_resource *ProgramResourceList; + unsigned NumProgramResourceList; + GLboolean LinkStatus; /**< GL_LINK_STATUS */ GLboolean Validated; GLchar *InfoLog; @@ -2857,10 +2861,6 @@ struct gl_shader_program */ struct gl_linked_shader *_LinkedShaders[MESA_SHADER_STAGES]; - /** List of all active resources after linking. */ - struct gl_program_resource *ProgramResourceList; - unsigned NumProgramResourceList; - /* True if any of the fragment shaders attached to this program use: * #extension ARB_fragment_coord_conventions: enable */ diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index 5461c4e..4b5be6f 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -119,8 +119,8 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, /* Validate pname against interface. */ switch(pname) { case GL_ACTIVE_RESOURCES: - for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) - if (shProg->ProgramResourceList[i].Type == programInterface) + for (i = 0, *params = 0; i < shProg->data->NumProgramResourceList; i++) + if (shProg->data->ProgramResourceList[i].Type == programInterface) (*params)++; break; case GL_MAX_NAME_LENGTH: @@ -135,32 +135,32 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, /* Name length consists of base name, 3 additional chars '[0]' if * resource is an array and finally 1 char for string terminator. */ - for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { - if (shProg->ProgramResourceList[i].Type != programInterface) + for (i = 0, *params = 0; i < shProg->data->NumProgramResourceList; i++) { + if (shProg->data->ProgramResourceList[i].Type != programInterface) continue; unsigned len = -_mesa_program_resource_name_len(&shProg->ProgramResourceList[i]); + _mesa_program_resource_name_len(&shProg->data->ProgramResourceList[i]); *params = MAX2(*params, len + 1); } break; case GL_MAX_NUM_ACTIVE_VARIABLES: switch (programInterface) { case GL_UNIFORM_B
[Mesa-dev] [PATCH 02/25] mesa: don't always set _NEW_PROGRAM when linking
We only need to set it when linking was successful and the program being linked is currently active. The programs_in_use mask is just used as a flag for now but in a following patch we will use it to update the CurrentProgram array. V2: make sure to flush vertices before linking (suggested by Marek) --- src/mesa/main/shaderapi.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index e67dc52..23f8fdd 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1097,10 +1097,31 @@ _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *shProg) return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM); + unsigned programs_in_use = 0; + if (ctx->_Shader) + for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) { + if (ctx->_Shader->CurrentProgram[stage] == shProg) { +programs_in_use |= 1 << stage; + } + } + FLUSH_VERTICES(ctx, 0); _mesa_glsl_link_shader(ctx, shProg); + /* From section 7.3 (Program Objects) of the OpenGL 4.5 spec: +* +*"If LinkProgram or ProgramBinary successfully re-links a program +* object that is active for any shader stage, then the newly generated +* executable code will be installed as part of the current rendering +* state for all shader stages where the program is active. +* Additionally, the newly generated executable code is made part of +* the state of any program pipeline for all stages where the program +* is attached." +*/ + if (shProg->data->LinkStatus && programs_in_use) { + ctx->NewState |= _NEW_PROGRAM; + } + /* Capture .shader_test files. */ const char *capture_path = _mesa_get_shader_capture_path(); if (shProg->Name != 0 && shProg->Name != ~0 && capture_path != NULL) { -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/25] glsl: use last_vert_prog to get last {clip, cull}_distance_array_size
--- src/compiler/glsl/link_varyings.cpp | 6 -- src/compiler/glsl/linker.cpp| 14 -- src/mesa/main/mtypes.h | 7 --- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 147a7c3..da51fd8 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -743,10 +743,12 @@ tfeedback_decl::assign_location(struct gl_context *ctx, unsigned actual_array_size; switch (this->lowered_builtin_array_variable) { case clip_distance: - actual_array_size = prog->LastClipDistanceArraySize; + actual_array_size = prog->last_vert_prog ? +prog->last_vert_prog->info.clip_distance_array_size : 0; break; case cull_distance: - actual_array_size = prog->LastCullDistanceArraySize; + actual_array_size = prog->last_vert_prog ? +prog->last_vert_prog->info.cull_distance_array_size : 0; break; case tess_level_outer: actual_array_size = 4; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index efe5cb7..0c81ced 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4930,20 +4930,6 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) } } - if (num_shaders[MESA_SHADER_GEOMETRY] > 0) { - prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->info.clip_distance_array_size; - prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->info.cull_distance_array_size; - } else if (num_shaders[MESA_SHADER_TESS_EVAL] > 0) { - prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->info.clip_distance_array_size; - prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->info.cull_distance_array_size; - } else if (num_shaders[MESA_SHADER_VERTEX] > 0) { - prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program->info.clip_distance_array_size; - prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program->info.cull_distance_array_size; - } else { - prog->LastClipDistanceArraySize = 0; /* Not used */ - prog->LastCullDistanceArraySize = 0; /* Not used */ - } - /* Here begins the inter-stage linking phase. Some initial validation is * performed, then locations are assigned for uniforms, attributes, and * varyings. diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2e9af53..960efea 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2794,13 +2794,6 @@ struct gl_shader_program struct exec_list EmptyUniformLocations; /** -* Size of the gl_ClipDistance array that is output from the last pipeline -* stage before the fragment shader. -*/ - unsigned LastClipDistanceArraySize; - unsigned LastCullDistanceArraySize; - - /** * Map of active uniform names to locations * * Maps any active uniform that is not an array element to a location. -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/25] mesa: change init subroutine defaults helper to work per gl_program
A later patch will result in SSO programs calling this helper per gl_program rather than per gl_shader_program. --- src/mesa/main/pipelineobj.c | 10 -- src/mesa/main/shaderapi.c | 30 ++ src/mesa/main/shaderapi.h | 4 ++-- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 9651a40..e777f99 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -468,8 +468,14 @@ _mesa_bind_pipeline(struct gl_context *ctx, FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - for (i = 0; i < MESA_SHADER_STAGES; i++) - _mesa_shader_program_init_subroutine_defaults(ctx, ctx->_Shader->CurrentProgram[i]); + for (i = 0; i < MESA_SHADER_STAGES; i++) { + if (ctx->_Shader->CurrentProgram[i]) { +struct gl_linked_shader *sh = + ctx->_Shader->CurrentProgram[i]->_LinkedShaders[i]; +if (sh) + _mesa_program_init_subroutine_defaults(ctx, sh->Program); + } + } } } diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 23f8fdd..a7aa544 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1242,8 +1242,15 @@ use_shader_program(struct gl_context *ctx, gl_shader_stage stage, if ((shProg != NULL) && (shProg->_LinkedShaders[stage] == NULL)) shProg = NULL; - if (shProg) - _mesa_shader_program_init_subroutine_defaults(ctx, shProg); + if (shProg) { + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { + struct gl_linked_shader *sh = shProg->_LinkedShaders[i]; + if (!sh) +continue; + + _mesa_program_init_subroutine_defaults(ctx, sh->Program); + } + } if (*target != shProg) { /* Program is current, flush it */ @@ -2897,7 +2904,7 @@ _mesa_shader_write_subroutine_indices(struct gl_context *ctx, ctx->_Shader->CurrentProgram[stage]->_LinkedShaders[stage]->Program); } -static void +void _mesa_program_init_subroutine_defaults(struct gl_context *ctx, struct gl_program *p) { @@ -2919,20 +2926,3 @@ _mesa_program_init_subroutine_defaults(struct gl_context *ctx, binding->IndexPtr[i] = find_compat_subroutine(p, uni->type); } } - -void -_mesa_shader_program_init_subroutine_defaults(struct gl_context *ctx, - struct gl_shader_program *shProg) -{ - int i; - - if (!shProg) - return; - - for (i = 0; i < MESA_SHADER_STAGES; i++) { - if (!shProg->_LinkedShaders[i]) - continue; - - _mesa_program_init_subroutine_defaults(ctx, shProg->_LinkedShaders[i]->Program); - } -} diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h index 50929f4..06de11f 100644 --- a/src/mesa/main/shaderapi.h +++ b/src/mesa/main/shaderapi.h @@ -288,8 +288,8 @@ _mesa_PatchParameterfv(GLenum pname, const GLfloat *values); /* GL_ARB_shader_subroutine */ void -_mesa_shader_program_init_subroutine_defaults(struct gl_context *ctx, - struct gl_shader_program *shProg); +_mesa_program_init_subroutine_defaults(struct gl_context *ctx, + struct gl_program *prog); extern GLint GLAPIENTRY _mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype, -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/25] mesa/glsl: set {clip, cull}_distance_array_size directly in gl_program
There are some line wrapping violations here but those lines will get deleted in the following patch. --- src/compiler/glsl/glsl_to_nir.cpp | 2 -- src/compiler/glsl/linker.cpp| 32 +++ src/mesa/drivers/dri/i965/brw_vs.c | 2 +- src/mesa/main/mtypes.h | 38 - src/mesa/main/shaderapi.c | 8 src/mesa/state_tracker/st_program.c | 16 6 files changed, 25 insertions(+), 73 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 69d4c2b..70cb517 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -149,8 +149,6 @@ glsl_to_nir(const struct gl_shader_program *shader_prog, shader->info->name = ralloc_asprintf(shader, "GLSL%d", shader_prog->Name); if (shader_prog->Label) shader->info->label = ralloc_strdup(shader, shader_prog->Label); - shader->info->clip_distance_array_size = sh->Program->ClipDistanceArraySize; - shader->info->cull_distance_array_size = sh->Program->CullDistanceArraySize; shader->info->has_transform_feedback_varyings = shader_prog->TransformFeedback.NumVarying > 0; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 1d91c68..efe5cb7 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -633,8 +633,8 @@ analyze_clip_cull_usage(struct gl_shader_program *prog, /** * Verify that a vertex shader executable meets all semantic requirements. * - * Also sets prog->Vert.ClipDistanceArraySize and - * prog->Vert.CullDistanceArraySize as a side effect. + * Also sets info.clip_distance_array_size and + * info.cull_distance_array_size as a side effect. * * \param shader Vertex shader executable to be verified */ @@ -689,8 +689,8 @@ validate_vertex_shader_executable(struct gl_shader_program *prog, } analyze_clip_cull_usage(prog, shader, ctx, - &prog->Vert.ClipDistanceArraySize, - &prog->Vert.CullDistanceArraySize); + &shader->Program->info.clip_distance_array_size, + &shader->Program->info.cull_distance_array_size); } void @@ -702,8 +702,8 @@ validate_tess_eval_shader_executable(struct gl_shader_program *prog, return; analyze_clip_cull_usage(prog, shader, ctx, - &prog->TessEval.ClipDistanceArraySize, - &prog->TessEval.CullDistanceArraySize); + &shader->Program->info.clip_distance_array_size, + &shader->Program->info.cull_distance_array_size); } @@ -734,8 +734,8 @@ validate_fragment_shader_executable(struct gl_shader_program *prog, /** * Verify that a geometry shader executable meets all semantic requirements * - * Also sets prog->Geom.VerticesIn, and prog->Geom.ClipDistanceArraySize and - * prog->Geom.CullDistanceArraySize as a side effect. + * Also sets prog->Geom.VerticesIn, and info.clip_distance_array_sizeand + * info.cull_distance_array_size as a side effect. * * \param shader Geometry shader executable to be verified */ @@ -751,8 +751,8 @@ validate_geometry_shader_executable(struct gl_shader_program *prog, prog->Geom.VerticesIn = num_vertices; analyze_clip_cull_usage(prog, shader, ctx, - &prog->Geom.ClipDistanceArraySize, - &prog->Geom.CullDistanceArraySize); + &shader->Program->info.clip_distance_array_size, + &shader->Program->info.cull_distance_array_size); } /** @@ -4931,14 +4931,14 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) } if (num_shaders[MESA_SHADER_GEOMETRY] > 0) { - prog->LastClipDistanceArraySize = prog->Geom.ClipDistanceArraySize; - prog->LastCullDistanceArraySize = prog->Geom.CullDistanceArraySize; + prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->info.clip_distance_array_size; + prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program->info.cull_distance_array_size; } else if (num_shaders[MESA_SHADER_TESS_EVAL] > 0) { - prog->LastClipDistanceArraySize = prog->TessEval.ClipDistanceArraySize; - prog->LastCullDistanceArraySize = prog->TessEval.CullDistanceArraySize; + prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->info.clip_distance_array_size; + prog->LastCullDistanceArraySize = prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]->Program->info.cull_distance_array_size; } else if (num_shaders[MESA_SHADER_VERTEX] > 0) { - prog->LastClipDistanceArraySize = prog->Vert.ClipDistanceArraySize; - prog->LastCullDistanceArraySize = prog->Vert.CullDistanceArraySize; + prog->LastClipDistanceArraySize = prog->_LinkedShaders[MESA_SHA
[Mesa-dev] [PATCH 10/25] i965: get outputs_written from gl_program
There is no need to go via the pointer in nir_shader. This change is required for the shader cache as we don't create a nir_shader. --- src/mesa/drivers/dri/i965/brw_vs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 46b69f3..fae7eaf 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -322,7 +322,7 @@ brw_vs_populate_key(struct brw_context *brw, } } - if (prog->nir->info->outputs_written & + if (prog->info.outputs_written & (VARYING_BIT_COL0 | VARYING_BIT_COL1 | VARYING_BIT_BFC0 | VARYING_BIT_BFC1)) { /* _NEW_LIGHT | _NEW_BUFFERS */ @@ -376,7 +376,7 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_program *prog) brw_setup_tex_for_precompile(brw, &key.tex, prog); key.program_string_id = bvp->id; key.clamp_vertex_color = - (prog->nir->info->outputs_written & + (prog->info.outputs_written & (VARYING_BIT_COL0 | VARYING_BIT_COL1 | VARYING_BIT_BFC0 | VARYING_BIT_BFC1)); -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/25] mesa/meta: rewrite _mesa_shader_program_use() and _mesa_program_use()
These are rewritten to do what the function name suggests, that is _mesa_shader_program_use() sets the use of all stage and _mesa_program_use() sets the use of a single stage. This patch is split out to make review easier but will be squashed into mesa: use gl_program for CurrentProgram rather than gl_shader_program before pushing. --- src/mesa/drivers/common/meta.c | 19 --- src/mesa/main/pipelineobj.c| 24 ++-- src/mesa/main/shaderapi.c | 34 -- src/mesa/main/shaderapi.h | 9 + 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 15d28b2..5b99c6b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -167,7 +167,7 @@ _mesa_meta_use_program(struct gl_context *ctx, _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader); /* Update the program */ - _mesa_use_program(ctx, sh_prog); + _mesa_use_shader_program(ctx, sh_prog); } void @@ -931,16 +931,6 @@ _mesa_meta_end(struct gl_context *ctx) } if (state & MESA_META_SHADER) { - static const GLenum targets[] = { - GL_VERTEX_SHADER, - GL_TESS_CONTROL_SHADER, - GL_TESS_EVALUATION_SHADER, - GL_GEOMETRY_SHADER, - GL_FRAGMENT_SHADER, - GL_COMPUTE_SHADER, - }; - STATIC_ASSERT(MESA_SHADER_STAGES == ARRAY_SIZE(targets)); - bool any_shader; if (ctx->Extensions.ARB_vertex_program) { @@ -966,14 +956,13 @@ _mesa_meta_end(struct gl_context *ctx) any_shader = false; for (i = 0; i < MESA_SHADER_STAGES; i++) { - /* It is safe to call _mesa_use_shader_program even if the extension + /* It is safe to call _mesa_use_program even if the extension * necessary for that program state is not supported. In that case, * the saved program object must be NULL and the currently bound - * program object must be NULL. _mesa_use_shader_program is a no-op + * program object must be NULL. _mesa_use_program is a no-op * in that case. */ - _mesa_use_shader_program(ctx, targets[i], save->Program[i], - &ctx->Shader); + _mesa_use_program(ctx, i, save->Program[i], &ctx->Shader); /* Do this *before* killing the reference. :) */ diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index d3f9cec..ec5df89 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -218,6 +218,18 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx, } } +static void +use_program_stage(struct gl_context *ctx, GLenum type, + struct gl_shader_program *shProg, + struct gl_pipeline_object *pipe) { + gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type); + struct gl_program *prog = NULL; + if (shProg && shProg->_LinkedShaders[stage]) + prog = shProg->_LinkedShaders[stage]->Program; + + _mesa_use_program(ctx, stage, prog, pipe); +} + /** * Bound program to severals stages of the pipeline */ @@ -325,22 +337,22 @@ _mesa_UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) * configured for the indicated shader stages." */ if ((stages & GL_VERTEX_SHADER_BIT) != 0) - _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, shProg, pipe); + use_program_stage(ctx, GL_VERTEX_SHADER, shProg, pipe); if ((stages & GL_FRAGMENT_SHADER_BIT) != 0) - _mesa_use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg, pipe); + use_program_stage(ctx, GL_FRAGMENT_SHADER, shProg, pipe); if ((stages & GL_GEOMETRY_SHADER_BIT) != 0) - _mesa_use_shader_program(ctx, GL_GEOMETRY_SHADER, shProg, pipe); + use_program_stage(ctx, GL_GEOMETRY_SHADER, shProg, pipe); if ((stages & GL_TESS_CONTROL_SHADER_BIT) != 0) - _mesa_use_shader_program(ctx, GL_TESS_CONTROL_SHADER, shProg, pipe); + use_program_stage(ctx, GL_TESS_CONTROL_SHADER, shProg, pipe); if ((stages & GL_TESS_EVALUATION_SHADER_BIT) != 0) - _mesa_use_shader_program(ctx, GL_TESS_EVALUATION_SHADER, shProg, pipe); + use_program_stage(ctx, GL_TESS_EVALUATION_SHADER, shProg, pipe); if ((stages & GL_COMPUTE_SHADER_BIT) != 0) - _mesa_use_shader_program(ctx, GL_COMPUTE_SHADER, shProg, pipe); + use_program_stage(ctx, GL_COMPUTE_SHADER, shProg, pipe); pipe->Validated = false; } diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index d92b013..9fa8ce1 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1230,17 +1230,12 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, static void -use_shader_program(struct gl_context *ctx, gl_shader_stage stage, - struct gl_shader_program *shProg, - struct gl_pipeline_ob
[Mesa-dev] [PATCH 07/25] st/mesa/glsl: change xfb_program field to last_vert_prog
Now that the i965 backend doesn't depend on this field we can make it more generic and short circuit a bunch of code paths. The new field will be used in a following patch for another clean-up. --- src/compiler/glsl/link_varyings.cpp| 5 +++- src/compiler/glsl/linker.cpp | 47 +++--- src/mesa/main/mtypes.h | 2 +- src/mesa/main/shader_query.cpp | 2 +- src/mesa/main/transformfeedback.c | 5 +++- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 +++- src/mesa/state_tracker/st_program.c| 10 +-- 7 files changed, 44 insertions(+), 32 deletions(-) diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index e1a29b0..147a7c3 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -1074,6 +1074,9 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, unsigned num_tfeedback_decls, tfeedback_decl *tfeedback_decls, bool has_xfb_qualifiers) { + if (!prog->last_vert_prog) + return true; + /* Make sure MaxTransformFeedbackBuffers is less than 32 so the bitmask for * tracking the number of buffers doesn't overflow. */ @@ -1082,7 +1085,7 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, bool separate_attribs_mode = prog->TransformFeedback.BufferMode == GL_SEPARATE_ATTRIBS; - struct gl_program *xfb_prog = prog->xfb_program; + struct gl_program *xfb_prog = prog->last_vert_prog; xfb_prog->sh.LinkedTransformFeedback = rzalloc(xfb_prog, struct gl_transform_feedback_info); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index dfee70a..1d91c68 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4247,27 +4247,29 @@ build_program_resource_list(struct gl_context *ctx, output_stage, GL_PROGRAM_OUTPUT)) return; - struct gl_transform_feedback_info *linked_xfb = - shProg->xfb_program->sh.LinkedTransformFeedback; - - /* Add transform feedback varyings. */ - if (linked_xfb->NumVarying > 0) { - for (int i = 0; i < linked_xfb->NumVarying; i++) { - if (!add_program_resource(shProg, resource_set, - GL_TRANSFORM_FEEDBACK_VARYING, - &linked_xfb->Varyings[i], 0)) - return; + if (shProg->last_vert_prog) { + struct gl_transform_feedback_info *linked_xfb = + shProg->last_vert_prog->sh.LinkedTransformFeedback; + + /* Add transform feedback varyings. */ + if (linked_xfb->NumVarying > 0) { + for (int i = 0; i < linked_xfb->NumVarying; i++) { +if (!add_program_resource(shProg, resource_set, + GL_TRANSFORM_FEEDBACK_VARYING, + &linked_xfb->Varyings[i], 0)) +return; + } } - } - /* Add transform feedback buffers. */ - for (unsigned i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) { - if ((linked_xfb->ActiveBuffers >> i) & 1) { - linked_xfb->Buffers[i].Binding = i; - if (!add_program_resource(shProg, resource_set, - GL_TRANSFORM_FEEDBACK_BUFFER, - &linked_xfb->Buffers[i], 0)) - return; + /* Add transform feedback buffers. */ + for (unsigned i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) { + if ((linked_xfb->ActiveBuffers >> i) & 1) { +linked_xfb->Buffers[i].Binding = i; +if (!add_program_resource(shProg, resource_set, + GL_TRANSFORM_FEEDBACK_BUFFER, + &linked_xfb->Buffers[i], 0)) +return; + } } } @@ -4593,15 +4595,12 @@ link_varyings_and_uniforms(unsigned first, unsigned last, varying_names = prog->TransformFeedback.VaryingNames; } - /* Find the program used for xfb. Even if we don't use xfb we still want to -* set this so we can fill the default values for program interface query. -*/ - prog->xfb_program = prog->_LinkedShaders[last]->Program; + prog->last_vert_prog = NULL; for (int i = MESA_SHADER_GEOMETRY; i >= MESA_SHADER_VERTEX; i--) { if (prog->_LinkedShaders[i] == NULL) continue; - prog->xfb_program = prog->_LinkedShaders[i]->Program; + prog->last_vert_prog = prog->_LinkedShaders[i]->Program; break; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4064052..07a5838 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2742,7 +2742,7 @@ struct gl_shader_program GLchar **VaryingNames; /**< Array [NumVarying] of char * */ } TransformFeedback; - struct gl_program *xfb_program; + struct gl_program *last_ver
[Mesa-dev] [PATCH 19/25] glsl: set InnerCoverage directly in gl_program
Also move out of the shared gl_shader_info. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 3 +-- src/mesa/main/mtypes.h | 3 +-- src/mesa/main/shaderapi.c| 1 - 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 063ca45..a6b695c 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1815,7 +1815,7 @@ set_shader_inout_layout(struct gl_shader *shader, shader->ARB_fragment_coord_conventions_enable = state->ARB_fragment_coord_conventions_enable; shader->EarlyFragmentTests = state->fs_early_fragment_tests; - shader->info.InnerCoverage = state->fs_inner_coverage; + shader->InnerCoverage = state->fs_inner_coverage; shader->PostDepthCoverage = state->fs_post_depth_coverage; shader->BlendSupport = state->fs_blend_support; break; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index f81e96a..c1e22f3 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1877,8 +1877,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, linked_shader->Program->info.fs.early_fragment_tests |= shader->EarlyFragmentTests; - linked_shader->info.InnerCoverage |= - shader->info.InnerCoverage; + linked_shader->Program->info.fs.inner_coverage |= shader->InnerCoverage; linked_shader->Program->info.fs.post_depth_coverage |= shader->PostDepthCoverage; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ac7d149..f192675 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2238,8 +2238,6 @@ struct gl_subroutine_function */ struct gl_shader_info { - bool InnerCoverage; - struct { /** Global xfb_stride out qualifier if any */ GLuint BufferStride[MAX_FEEDBACK_BUFFERS]; @@ -2426,6 +2424,7 @@ struct gl_shader bool uses_gl_fragcoord; bool PostDepthCoverage; + bool InnerCoverage; /** * Fragment shader state from GLSL 1.50 layout qualifiers. diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index c62c573..53a29e5 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -,7 +,6 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src, } case MESA_SHADER_FRAGMENT: { dst->info.fs.depth_layout = src->FragDepthLayout; - dst->info.fs.inner_coverage = dst_sh->info.InnerCoverage; break; } case MESA_SHADER_COMPUTE: { -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/25] mesa/glsl: move redeclares_gl_fragcoord to gl_shader
This is never used in gl_linked_shader other than as a temp during linking so just use a temp instead. --- src/compiler/glsl/glsl_parser_extras.cpp | 3 +-- src/compiler/glsl/linker.cpp | 21 - src/mesa/main/mtypes.h | 3 ++- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index d84a3f8..99bdfcc 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1808,8 +1808,7 @@ set_shader_inout_layout(struct gl_shader *shader, break; case MESA_SHADER_FRAGMENT: - shader->info.redeclares_gl_fragcoord = - state->fs_redeclares_gl_fragcoord; + shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord; shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord; shader->info.pixel_center_integer = state->fs_pixel_center_integer; shader->info.origin_upper_left = state->fs_origin_upper_left; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 05c168c..db030e9 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1825,7 +1825,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->info.redeclares_gl_fragcoord = false; + bool redeclares_gl_fragcoord = false; linked_shader->info.uses_gl_fragcoord = false; linked_shader->info.origin_upper_left = false; linked_shader->info.pixel_center_integer = false; @@ -1843,12 +1843,10 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, *it must be redeclared in all the fragment shaders in that program *that have a static use gl_FragCoord." */ - if ((linked_shader->info.redeclares_gl_fragcoord - && !shader->info.redeclares_gl_fragcoord - && shader->info.uses_gl_fragcoord) - || (shader->info.redeclares_gl_fragcoord - && !linked_shader->info.redeclares_gl_fragcoord - && linked_shader->info.uses_gl_fragcoord)) { + if ((redeclares_gl_fragcoord && !shader->redeclares_gl_fragcoord && + shader->info.uses_gl_fragcoord) + || (shader->redeclares_gl_fragcoord && !redeclares_gl_fragcoord && + linked_shader->info.uses_gl_fragcoord)) { linker_error(prog, "fragment shader defined with conflicting " "layout qualifiers for gl_FragCoord\n"); } @@ -1858,8 +1856,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, * "All redeclarations of gl_FragCoord in all fragment shaders in a *single program must have the same set of qualifiers." */ - if (linked_shader->info.redeclares_gl_fragcoord && - shader->info.redeclares_gl_fragcoord && + if (redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord && (shader->info.origin_upper_left != linked_shader->info.origin_upper_left || shader->info.pixel_center_integer != @@ -1873,10 +1870,8 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, * are multiple redeclarations, all the fields except uses_gl_fragcoord * are already known to be the same. */ - if (shader->info.redeclares_gl_fragcoord || - shader->info.uses_gl_fragcoord) { - linked_shader->info.redeclares_gl_fragcoord = -shader->info.redeclares_gl_fragcoord; + if (shader->redeclares_gl_fragcoord || shader->info.uses_gl_fragcoord) { + redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord; linked_shader->info.uses_gl_fragcoord = linked_shader->info.uses_gl_fragcoord || shader->info.uses_gl_fragcoord; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 149db72..671154e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2239,7 +2239,6 @@ struct gl_subroutine_function struct gl_shader_info { bool uses_gl_fragcoord; - bool redeclares_gl_fragcoord; bool PostDepthCoverage; bool InnerCoverage; @@ -2431,6 +2430,8 @@ struct gl_shader bool ARB_fragment_coord_conventions_enable; + bool redeclares_gl_fragcoord; + struct gl_shader_info info; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/25] mesa/glsl: move ARB_fragment_coord_conventions_enable field
This is only used by gl_shader not gl_linked_shader so move it there. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 2 +- src/mesa/main/mtypes.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 2b4dce0..d84a3f8 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1813,7 +1813,7 @@ set_shader_inout_layout(struct gl_shader *shader, shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord; shader->info.pixel_center_integer = state->fs_pixel_center_integer; shader->info.origin_upper_left = state->fs_origin_upper_left; - shader->info.ARB_fragment_coord_conventions_enable = + shader->ARB_fragment_coord_conventions_enable = state->ARB_fragment_coord_conventions_enable; shader->EarlyFragmentTests = state->fs_early_fragment_tests; shader->info.InnerCoverage = state->fs_inner_coverage; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 7479fa8..05c168c 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4813,7 +4813,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) goto done; } - if (prog->Shaders[i]->info.ARB_fragment_coord_conventions_enable) { + if (prog->Shaders[i]->ARB_fragment_coord_conventions_enable) { prog->ARB_fragment_coord_conventions_enable = true; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2e4e270..149db72 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2242,7 +2242,6 @@ struct gl_shader_info bool redeclares_gl_fragcoord; bool PostDepthCoverage; bool InnerCoverage; - bool ARB_fragment_coord_conventions_enable; /** * Fragment shader state from GLSL 1.50 layout qualifiers. @@ -2430,6 +2429,8 @@ struct gl_shader */ bool EarlyFragmentTests; + bool ARB_fragment_coord_conventions_enable; + struct gl_shader_info info; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/25] glsl: tidy up PostDepthCoverage shader field
There is no reason for this to be in the shared gl_shader_info or to copy it to gl_program at the end of linking (its already there). --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 2 +- src/mesa/main/mtypes.h | 3 ++- src/mesa/main/shaderapi.c| 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 70bde06..063ca45 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1816,7 +1816,7 @@ set_shader_inout_layout(struct gl_shader *shader, state->ARB_fragment_coord_conventions_enable; shader->EarlyFragmentTests = state->fs_early_fragment_tests; shader->info.InnerCoverage = state->fs_inner_coverage; - shader->info.PostDepthCoverage = state->fs_post_depth_coverage; + shader->PostDepthCoverage = state->fs_post_depth_coverage; shader->BlendSupport = state->fs_blend_support; break; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index a6a2baa..f81e96a 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1880,7 +1880,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, linked_shader->info.InnerCoverage |= shader->info.InnerCoverage; linked_shader->Program->info.fs.post_depth_coverage |= - shader->info.PostDepthCoverage; + shader->PostDepthCoverage; linked_shader->Program->sh.fs.BlendSupport |= shader->BlendSupport; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index de2821e..ac7d149 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2238,7 +2238,6 @@ struct gl_subroutine_function */ struct gl_shader_info { - bool PostDepthCoverage; bool InnerCoverage; struct { @@ -2426,6 +2425,8 @@ struct gl_shader bool redeclares_gl_fragcoord; bool uses_gl_fragcoord; + bool PostDepthCoverage; + /** * Fragment shader state from GLSL 1.50 layout qualifiers. */ diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index a987536..c62c573 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2223,7 +2223,6 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src, case MESA_SHADER_FRAGMENT: { dst->info.fs.depth_layout = src->FragDepthLayout; dst->info.fs.inner_coverage = dst_sh->info.InnerCoverage; - dst->info.fs.post_depth_coverage = dst_sh->info.PostDepthCoverage; break; } case MESA_SHADER_COMPUTE: { -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/25] mesa/glsl: move uses_gl_fragcoord to gl_shader
This is only used by gl_linked_shader as a temp during linking so use a temp there instead. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 12 +--- src/mesa/main/mtypes.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 99bdfcc..afb7260 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1809,7 +1809,7 @@ set_shader_inout_layout(struct gl_shader *shader, case MESA_SHADER_FRAGMENT: shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord; - shader->info.uses_gl_fragcoord = state->fs_uses_gl_fragcoord; + shader->uses_gl_fragcoord = state->fs_uses_gl_fragcoord; shader->info.pixel_center_integer = state->fs_pixel_center_integer; shader->info.origin_upper_left = state->fs_origin_upper_left; shader->ARB_fragment_coord_conventions_enable = diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index db030e9..01c3aa3 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1826,7 +1826,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, unsigned num_shaders) { bool redeclares_gl_fragcoord = false; - linked_shader->info.uses_gl_fragcoord = false; + bool uses_gl_fragcoord = false; linked_shader->info.origin_upper_left = false; linked_shader->info.pixel_center_integer = false; @@ -1844,9 +1844,9 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, *that have a static use gl_FragCoord." */ if ((redeclares_gl_fragcoord && !shader->redeclares_gl_fragcoord && - shader->info.uses_gl_fragcoord) + shader->uses_gl_fragcoord) || (shader->redeclares_gl_fragcoord && !redeclares_gl_fragcoord && - linked_shader->info.uses_gl_fragcoord)) { + uses_gl_fragcoord)) { linker_error(prog, "fragment shader defined with conflicting " "layout qualifiers for gl_FragCoord\n"); } @@ -1870,11 +1870,9 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, * are multiple redeclarations, all the fields except uses_gl_fragcoord * are already known to be the same. */ - if (shader->redeclares_gl_fragcoord || shader->info.uses_gl_fragcoord) { + if (shader->redeclares_gl_fragcoord || shader->uses_gl_fragcoord) { redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord; - linked_shader->info.uses_gl_fragcoord = -linked_shader->info.uses_gl_fragcoord || -shader->info.uses_gl_fragcoord; + uses_gl_fragcoord |= shader->uses_gl_fragcoord; linked_shader->info.origin_upper_left = shader->info.origin_upper_left; linked_shader->info.pixel_center_integer = diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 671154e..03c99c2 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2238,7 +2238,6 @@ struct gl_subroutine_function */ struct gl_shader_info { - bool uses_gl_fragcoord; bool PostDepthCoverage; bool InnerCoverage; @@ -2431,6 +2430,7 @@ struct gl_shader bool ARB_fragment_coord_conventions_enable; bool redeclares_gl_fragcoord; + bool uses_gl_fragcoord; struct gl_shader_info info; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/25] st/mesa/glsl: set early_fragment_tests directly in shader_info
We also move EarlyFragmentTests out of the gl_shader_info struct as it is now only used by gl_shader. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 4 ++-- src/mesa/main/mtypes.h | 12 ++-- src/mesa/main/shaderapi.c | 1 - src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 1b84876..2b4dce0 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1815,7 +1815,7 @@ set_shader_inout_layout(struct gl_shader *shader, shader->info.origin_upper_left = state->fs_origin_upper_left; shader->info.ARB_fragment_coord_conventions_enable = state->ARB_fragment_coord_conventions_enable; - shader->info.EarlyFragmentTests = state->fs_early_fragment_tests; + shader->EarlyFragmentTests = state->fs_early_fragment_tests; shader->info.InnerCoverage = state->fs_inner_coverage; shader->info.PostDepthCoverage = state->fs_post_depth_coverage; shader->BlendSupport = state->fs_blend_support; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 9f86aae..7479fa8 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1886,8 +1886,8 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, shader->info.pixel_center_integer; } - linked_shader->info.EarlyFragmentTests |= - shader->info.EarlyFragmentTests; + linked_shader->Program->info.fs.early_fragment_tests |= + shader->EarlyFragmentTests; linked_shader->info.InnerCoverage |= shader->info.InnerCoverage; linked_shader->Program->info.fs.post_depth_coverage |= diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 960efea..2e4e270 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2312,12 +2312,6 @@ struct gl_shader_info } Geom; /** -* Whether early fragment tests are enabled as defined by -* ARB_shader_image_load_store. -*/ - bool EarlyFragmentTests; - - /** * Compute shader state from ARB_compute_shader and * ARB_compute_variable_group_size layout qualifiers. */ @@ -2430,6 +2424,12 @@ struct gl_shader */ GLbitfield BlendSupport; + /** +* Whether early fragment tests are enabled as defined by +* ARB_shader_image_load_store. +*/ + bool EarlyFragmentTests; + struct gl_shader_info info; }; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 442e1a8..a987536 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -,7 +,6 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src, } case MESA_SHADER_FRAGMENT: { dst->info.fs.depth_layout = src->FragDepthLayout; - dst->info.fs.early_fragment_tests = dst_sh->info.EarlyFragmentTests; dst->info.fs.inner_coverage = dst_sh->info.InnerCoverage; dst->info.fs.post_depth_coverage = dst_sh->info.PostDepthCoverage; break; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index bc00a4e..545e0b7 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -6142,7 +6142,7 @@ st_translate_program( } if (procType == PIPE_SHADER_FRAGMENT) { - if (program->shader->info.EarlyFragmentTests) + if (program->shader->Program->info.fs.early_fragment_tests) ureg_property(ureg, TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL, 1); if (proginfo->info.inputs_read & VARYING_BIT_POS) { -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 16/25] mesa/glsl: move origin_upper_left to gl_shader
This is only used by gl_linked_shader as a temp during linking so use a temp there instead. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 8 +++- src/mesa/main/mtypes.h | 9 + 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index afb7260..fe49423 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1811,7 +1811,7 @@ set_shader_inout_layout(struct gl_shader *shader, shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord; shader->uses_gl_fragcoord = state->fs_uses_gl_fragcoord; shader->info.pixel_center_integer = state->fs_pixel_center_integer; - shader->info.origin_upper_left = state->fs_origin_upper_left; + shader->origin_upper_left = state->fs_origin_upper_left; shader->ARB_fragment_coord_conventions_enable = state->ARB_fragment_coord_conventions_enable; shader->EarlyFragmentTests = state->fs_early_fragment_tests; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 01c3aa3..0bcf745 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1827,7 +1827,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, { bool redeclares_gl_fragcoord = false; bool uses_gl_fragcoord = false; - linked_shader->info.origin_upper_left = false; + bool origin_upper_left = false; linked_shader->info.pixel_center_integer = false; if (linked_shader->Stage != MESA_SHADER_FRAGMENT || @@ -1857,8 +1857,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, *single program must have the same set of qualifiers." */ if (redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord && - (shader->info.origin_upper_left != - linked_shader->info.origin_upper_left || + (shader->origin_upper_left != origin_upper_left || shader->info.pixel_center_integer != linked_shader->info.pixel_center_integer)) { linker_error(prog, "fragment shader defined with conflicting " @@ -1873,8 +1872,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, if (shader->redeclares_gl_fragcoord || shader->uses_gl_fragcoord) { redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord; uses_gl_fragcoord |= shader->uses_gl_fragcoord; - linked_shader->info.origin_upper_left = -shader->info.origin_upper_left; + origin_upper_left = shader->origin_upper_left; linked_shader->info.pixel_center_integer = shader->info.pixel_center_integer; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 03c99c2..4edfaac 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2241,10 +2241,6 @@ struct gl_shader_info bool PostDepthCoverage; bool InnerCoverage; - /** -* Fragment shader state from GLSL 1.50 layout qualifiers. -*/ - bool origin_upper_left; bool pixel_center_integer; struct { @@ -2432,6 +2428,11 @@ struct gl_shader bool redeclares_gl_fragcoord; bool uses_gl_fragcoord; + /** +* Fragment shader state from GLSL 1.50 layout qualifiers. +*/ + bool origin_upper_left; + struct gl_shader_info info; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/11] spirv: Handle tessellation execution modes.
On 9 January 2017 at 15:26, Kenneth Graunke wrote: > Signed-off-by: Kenneth Graunke > --- > src/compiler/spirv/spirv_to_nir.c | 28 ++-- > 1 file changed, 22 insertions(+), 6 deletions(-) > > One totally bogus thing here: we set CCW backwards. In all three driver > backends (i965, nvc0, radeonsi), we invert CCW because it doesn't seem to > match the HW. That means that Vulkan CCW and HW CCW match, and it's just > OpenGL that's backwards. We should figure out what's actually going on > here and decide which meaning we want to go with. Maybe put this comment in the code where we assign it backwards, Otherwise: Reviewed-by: Dave Airlie > > diff --git a/src/compiler/spirv/spirv_to_nir.c > b/src/compiler/spirv/spirv_to_nir.c > index 41da0e85c9d..8f19afa77ee 100644 > --- a/src/compiler/spirv/spirv_to_nir.c > +++ b/src/compiler/spirv/spirv_to_nir.c > @@ -2655,8 +2655,12 @@ vtn_handle_execution_mode(struct vtn_builder *b, > struct vtn_value *entry_point, >break; /* Nothing to do with this */ > > case SpvExecutionModeOutputVertices: > - assert(b->shader->stage == MESA_SHADER_GEOMETRY); > - b->shader->info->gs.vertices_out = mode->literals[0]; > + if (b->shader->stage == MESA_SHADER_TESS_CTRL) { > + b->shader->info->tcs.vertices_out = mode->literals[0]; > + } else { > + assert(b->shader->stage == MESA_SHADER_GEOMETRY); > + b->shader->info->gs.vertices_out = mode->literals[0]; > + } >break; > > case SpvExecutionModeInputPoints: > @@ -2666,11 +2670,13 @@ vtn_handle_execution_mode(struct vtn_builder *b, > struct vtn_value *entry_point, > case SpvExecutionModeInputTrianglesAdjacency: > case SpvExecutionModeQuads: > case SpvExecutionModeIsolines: > - if (b->shader->stage == MESA_SHADER_GEOMETRY) { > + if (b->shader->stage == MESA_SHADER_TESS_EVAL) { > + b->shader->info->tes.primitive_mode = > +gl_primitive_from_spv_execution_mode(mode->exec_mode); > + } else { > + assert(b->shader->stage == MESA_SHADER_GEOMETRY); > b->shader->info->gs.vertices_in = > vertices_in_from_spv_execution_mode(mode->exec_mode); > - } else { > - assert(!"Tesselation shaders not yet supported"); >} >break; > > @@ -2683,12 +2689,22 @@ vtn_handle_execution_mode(struct vtn_builder *b, > struct vtn_value *entry_point, >break; > > case SpvExecutionModeSpacingEqual: > + b->shader->info->tes.spacing = TESS_SPACING_EQUAL; > + break; > case SpvExecutionModeSpacingFractionalEven: > + b->shader->info->tes.spacing = TESS_SPACING_FRACTIONAL_EVEN; > + break; > case SpvExecutionModeSpacingFractionalOdd: > + b->shader->info->tes.spacing = TESS_SPACING_FRACTIONAL_ODD; > + break; > case SpvExecutionModeVertexOrderCw: > + b->shader->info->tes.ccw = true; > + break; > case SpvExecutionModeVertexOrderCcw: > + b->shader->info->tes.ccw = false; > + break; > case SpvExecutionModePointMode: > - assert(!"TODO: Add tessellation metadata"); > + b->shader->info->tes.point_mode = true; >break; > > case SpvExecutionModePixelCenterInteger: > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 21/25] mesa/glsl: move TransformFeedbackBufferStride to gl_shader
Here we remove the single use of this field in gl_linked_shader which allows us to move the field out of gl_shader_info While we are at it we rewrite link_xfb_stride_layout_qualifiers() to be more clear. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/link_varyings.cpp | 3 +- src/compiler/glsl/link_varyings.h| 1 + src/compiler/glsl/linker.cpp | 73 +++- src/mesa/main/mtypes.h | 8 ++-- 5 files changed, 42 insertions(+), 45 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index a6b695c..0e8f008 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1704,7 +1704,7 @@ set_shader_inout_layout(struct gl_shader *shader, if (state->out_qualifier->out_xfb_stride[i]-> process_qualifier_constant(state, "xfb_stride", &xfb_stride, true)) { -shader->info.TransformFeedback.BufferStride[i] = xfb_stride; +shader->TransformFeedbackBufferStride[i] = xfb_stride; } } } diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index 398e1da..f032f2a 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -108,6 +108,7 @@ create_xfb_varying_names(void *mem_ctx, const glsl_type *t, char **name, bool process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh, + struct gl_shader_program *prog, unsigned *num_tfeedback_decls, char ***varying_names) { @@ -118,7 +119,7 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh, * xfb_stride to interface block members so this will catch that case also. */ for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) { - if (sh->info.TransformFeedback.BufferStride[j]) { + if (prog->TransformFeedback.BufferStride[j]) { has_xfb_qualifiers = true; break; } diff --git a/src/compiler/glsl/link_varyings.h b/src/compiler/glsl/link_varyings.h index afce56e..2abe3ca 100644 --- a/src/compiler/glsl/link_varyings.h +++ b/src/compiler/glsl/link_varyings.h @@ -301,6 +301,7 @@ parse_tfeedback_decls(struct gl_context *ctx, struct gl_shader_program *prog, bool process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh, + struct gl_shader_program *prog, unsigned *num_tfeedback_decls, char ***varying_names); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index c1e22f3..36e1e86 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1587,6 +1587,29 @@ private: hash_table *unnamed_interfaces; }; +static bool +validate_xfb_buffer_stride(struct gl_context *ctx, unsigned idx, + struct gl_shader_program *prog) +{ + /* We will validate doubles at a later stage */ + if (prog->TransformFeedback.BufferStride[idx] % 4) { + linker_error(prog, "invalid qualifier xfb_stride=%d must be a " + "multiple of 4 or if its applied to a type that is " + "or contains a double a multiple of 8.", + prog->TransformFeedback.BufferStride[idx]); + return false; + } + + if (prog->TransformFeedback.BufferStride[idx] / 4 > + ctx->Const.MaxTransformFeedbackInterleavedComponents) { + linker_error(prog, "The MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS " + "limit has been exceeded."); + return false; + } + + return true; +} + /** * Check for conflicting xfb_stride default qualifiers and store buffer stride * for later use. @@ -1599,54 +1622,28 @@ link_xfb_stride_layout_qualifiers(struct gl_context *ctx, unsigned num_shaders) { for (unsigned i = 0; i < MAX_FEEDBACK_BUFFERS; i++) { - linked_shader->info.TransformFeedback.BufferStride[i] = 0; + prog->TransformFeedback.BufferStride[i] = 0; } for (unsigned i = 0; i < num_shaders; i++) { struct gl_shader *shader = shader_list[i]; for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) { - if (shader->info.TransformFeedback.BufferStride[j]) { -if (linked_shader->info.TransformFeedback.BufferStride[j] != 0 && -shader->info.TransformFeedback.BufferStride[j] != 0 && -linked_shader->info.TransformFeedback.BufferStride[j] != - shader->info.TransformFeedback.BufferStride[j]) { + if (shader->TransformFeedbackBufferStride[j]) { +if (prog->TransformFeedback.BufferStride[j] == 0) { + prog->TransformFeedback.BufferStride[j] = + shader->TransformFeedbackBufferStride[j]; +
[Mesa-dev] [PATCH 25/25] mesa: remove unused gl_shader_info field from gl_linked_shader
--- src/mesa/main/mtypes.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index aff426f..e3d9e62 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2354,8 +2354,6 @@ struct gl_linked_shader struct exec_list *packed_varyings; struct exec_list *fragdata_arrays; struct glsl_symbol_table *symbols; - - struct gl_shader_info info; }; static inline GLbitfield gl_external_samplers(struct gl_program *prog) -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/25] glsl: exit loop early if we find xfb layout qualifers
--- src/compiler/glsl/link_varyings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp index da51fd8..398e1da 100644 --- a/src/compiler/glsl/link_varyings.cpp +++ b/src/compiler/glsl/link_varyings.cpp @@ -120,6 +120,7 @@ process_xfb_layout_qualifiers(void *mem_ctx, const gl_linked_shader *sh, for (unsigned j = 0; j < MAX_FEEDBACK_BUFFERS; j++) { if (sh->info.TransformFeedback.BufferStride[j]) { has_xfb_qualifiers = true; + break; } } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 23/25] mesa/glsl: set and get gs layouts directly to and from shader_info
--- src/compiler/glsl/linker.cpp | 70 +++- src/mesa/main/shaderapi.c| 12 +++- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 41a566a..53ee7e6 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -747,7 +747,8 @@ validate_geometry_shader_executable(struct gl_shader_program *prog, if (shader == NULL) return; - unsigned num_vertices = vertices_per_prim(shader->info.Geom.InputType); + unsigned num_vertices = + vertices_per_prim(shader->Program->info.gs.input_primitive); prog->Geom.VerticesIn = num_vertices; analyze_clip_cull_usage(prog, shader, ctx, @@ -802,7 +803,8 @@ validate_geometry_shader_emissions(struct gl_context *ctx, * EmitStreamVertex() or EmitEndPrimitive() are called with a non-zero * stream. */ - if (prog->Geom.UsesStreams && sh->info.Geom.OutputType != GL_POINTS) { + if (prog->Geom.UsesStreams && + sh->Program->info.gs.output_primitive != GL_POINTS) { linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) " "with n>0 requires point output\n"); } @@ -1890,22 +1892,23 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, */ static void link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, -struct gl_linked_shader *linked_shader, +struct gl_program *gl_prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->info.Geom.VerticesOut = -1; - linked_shader->info.Geom.Invocations = 0; - linked_shader->info.Geom.InputType = PRIM_UNKNOWN; - linked_shader->info.Geom.OutputType = PRIM_UNKNOWN; - /* No in/out qualifiers defined for anything but GLSL 1.50+ * geometry shaders so far. */ - if (linked_shader->Stage != MESA_SHADER_GEOMETRY || + if (gl_prog->info.stage != MESA_SHADER_GEOMETRY || prog->data->Version < 150) return; + int vertices_out = -1; + + gl_prog->info.gs.invocations = 0; + gl_prog->info.gs.input_primitive = PRIM_UNKNOWN; + gl_prog->info.gs.output_primitive = PRIM_UNKNOWN; + /* From the GLSL 1.50 spec, page 46: * * "All geometry shader output layout declarations in a program @@ -1920,51 +1923,49 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader *shader = shader_list[i]; if (shader->info.Geom.InputType != PRIM_UNKNOWN) { - if (linked_shader->info.Geom.InputType != PRIM_UNKNOWN && - linked_shader->info.Geom.InputType != + if (gl_prog->info.gs.input_primitive != PRIM_UNKNOWN && + gl_prog->info.gs.input_primitive != shader->info.Geom.InputType) { linker_error(prog, "geometry shader defined with conflicting " "input types\n"); return; } - linked_shader->info.Geom.InputType = shader->info.Geom.InputType; + gl_prog->info.gs.input_primitive = shader->info.Geom.InputType; } if (shader->info.Geom.OutputType != PRIM_UNKNOWN) { - if (linked_shader->info.Geom.OutputType != PRIM_UNKNOWN && - linked_shader->info.Geom.OutputType != + if (gl_prog->info.gs.output_primitive != PRIM_UNKNOWN && + gl_prog->info.gs.output_primitive != shader->info.Geom.OutputType) { linker_error(prog, "geometry shader defined with conflicting " "output types\n"); return; } - linked_shader->info.Geom.OutputType = shader->info.Geom.OutputType; + gl_prog->info.gs.output_primitive = shader->info.Geom.OutputType; } if (shader->info.Geom.VerticesOut != -1) { - if (linked_shader->info.Geom.VerticesOut != -1 && - linked_shader->info.Geom.VerticesOut != - shader->info.Geom.VerticesOut) { + if (vertices_out != -1 && + vertices_out != shader->info.Geom.VerticesOut) { linker_error(prog, "geometry shader defined with conflicting " "output vertex count (%d and %d)\n", - linked_shader->info.Geom.VerticesOut, - shader->info.Geom.VerticesOut); + vertices_out, shader->info.Geom.VerticesOut); return; } - linked_shader->info.Geom.VerticesOut = shader->info.Geom.VerticesOut; + vertices_out = shader->info.Geom.VerticesOut; } if (shader->info.Geom.Invocations != 0) { - if (linked_shader->info.Geom.Invocations != 0 && - linked_shader->info.Geom.Invocations != - shader->info.Geom.Invocations) { + if (gl_prog->info.gs.invocations != 0 &&
[Mesa-dev] [PATCH 11/25] mesa/glsl/i965: set and use tcs vertices_out directly
--- src/compiler/glsl/linker.cpp| 25 - src/mesa/drivers/dri/i965/brw_tcs.c | 6 ++ src/mesa/main/shaderapi.c | 6 +- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 0c81ced..9f86aae 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1659,15 +1659,15 @@ link_xfb_stride_layout_qualifiers(struct gl_context *ctx, */ static void link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, - struct gl_linked_shader *linked_shader, + struct gl_program *gl_prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->info.TessCtrl.VerticesOut = 0; - - if (linked_shader->Stage != MESA_SHADER_TESS_CTRL) + if (gl_prog->info.stage != MESA_SHADER_TESS_CTRL) return; + gl_prog->info.tcs.vertices_out = 0; + /* From the GLSL 4.0 spec (chapter 4.3.8.2): * * "All tessellation control shader layout declarations in a program @@ -1682,17 +1682,16 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader *shader = shader_list[i]; if (shader->info.TessCtrl.VerticesOut != 0) { - if (linked_shader->info.TessCtrl.VerticesOut != 0 && - linked_shader->info.TessCtrl.VerticesOut != - shader->info.TessCtrl.VerticesOut) { + if (gl_prog->info.tcs.vertices_out != 0 && + gl_prog->info.tcs.vertices_out != + (unsigned) shader->info.TessCtrl.VerticesOut) { linker_error(prog, "tessellation control shader defined with " "conflicting output vertex count (%d and %d)\n", - linked_shader->info.TessCtrl.VerticesOut, + gl_prog->info.tcs.vertices_out, shader->info.TessCtrl.VerticesOut); return; } - linked_shader->info.TessCtrl.VerticesOut = -shader->info.TessCtrl.VerticesOut; + gl_prog->info.tcs.vertices_out = shader->info.TessCtrl.VerticesOut; } } @@ -1700,7 +1699,7 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->info.TessCtrl.VerticesOut == 0) { + if (gl_prog->info.tcs.vertices_out == 0) { linker_error(prog, "tessellation control shader didn't declare " "vertices out layout qualifier\n"); return; @@ -2218,7 +2217,7 @@ link_intrastage_shaders(void *mem_ctx, clone_ir_list(mem_ctx, linked->ir, main->ir); link_fs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); - link_tcs_out_layout_qualifiers(prog, linked, shader_list, num_shaders); + link_tcs_out_layout_qualifiers(prog, gl_prog, shader_list, num_shaders); link_tes_in_layout_qualifiers(prog, linked, shader_list, num_shaders); link_gs_inout_layout_qualifiers(prog, linked, shader_list, num_shaders); link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders); @@ -2431,7 +2430,7 @@ resize_tes_inputs(struct gl_context *ctx, * known until draw time. */ const int num_vertices = tcs - ? tcs->info.TessCtrl.VerticesOut + ? tcs->Program->info.tcs.vertices_out : ctx->Const.MaxPatchVertices; array_resize_visitor input_resize_visitor(num_vertices, prog, diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 9e9d9eb..27a53e3 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -392,10 +392,8 @@ brw_tcs_precompile(struct gl_context *ctx, brw_setup_tex_for_precompile(brw, &key.tex, prog); /* Guess that the input and output patches have the same dimensionality. */ - if (brw->gen < 8) { - key.input_vertices = shader_prog-> - _LinkedShaders[MESA_SHADER_TESS_CTRL]->info.TessCtrl.VerticesOut; - } + if (brw->gen < 8) + key.input_vertices = prog->info.tcs.vertices_out; struct brw_program *btep; if (tes) { diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 1de6d89..442e1a8 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -821,7 +821,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, break; if (check_tcs_query(ctx, shProg)) { *params = shProg->_LinkedShaders[MESA_SHADER_TESS_CTRL]-> -info.TessCtrl.VerticesOut; +Program->info.tcs.vertices_out; } return; case GL_TESS_GEN_MODE: @@ -2203,10 +2203,6 @@ _mesa_copy_linked_program_data(const struct gl_shader_program *src, dst->info.separate_shader = src->SeparateShader; switch (dst_sh->Stage) { - case MESA_SHADER_TESS_CTRL: { -
[Mesa-dev] [PATCH 22/25] mesa/glsl/i965: set and get tes layouts directly to and from shader_info
--- src/compiler/glsl/linker.cpp| 63 +++-- src/mesa/drivers/dri/i965/brw_tcs.c | 6 ++-- src/mesa/main/shaderapi.c | 15 +++-- 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 36e1e86..41a566a 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1712,18 +1712,19 @@ link_tcs_out_layout_qualifiers(struct gl_shader_program *prog, */ static void link_tes_in_layout_qualifiers(struct gl_shader_program *prog, - struct gl_linked_shader *linked_shader, + struct gl_program *gl_prog, struct gl_shader **shader_list, unsigned num_shaders) { - linked_shader->info.TessEval.PrimitiveMode = PRIM_UNKNOWN; - linked_shader->info.TessEval.Spacing = TESS_SPACING_UNSPECIFIED; - linked_shader->info.TessEval.VertexOrder = 0; - linked_shader->info.TessEval.PointMode = -1; - - if (linked_shader->Stage != MESA_SHADER_TESS_EVAL) + if (gl_prog->info.stage != MESA_SHADER_TESS_EVAL) return; + int point_mode = -1; + unsigned vertex_order = 0; + + gl_prog->info.tes.primitive_mode = PRIM_UNKNOWN; + gl_prog->info.tes.spacing = TESS_SPACING_UNSPECIFIED; + /* From the GLSL 4.0 spec (chapter 4.3.8.1): * * "At least one tessellation evaluation shader (compilation unit) in @@ -1742,49 +1743,44 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader *shader = shader_list[i]; if (shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN) { - if (linked_shader->info.TessEval.PrimitiveMode != PRIM_UNKNOWN && - linked_shader->info.TessEval.PrimitiveMode != + if (gl_prog->info.tes.primitive_mode != PRIM_UNKNOWN && + gl_prog->info.tes.primitive_mode != shader->info.TessEval.PrimitiveMode) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting input primitive modes.\n"); return; } - linked_shader->info.TessEval.PrimitiveMode = shader->info.TessEval.PrimitiveMode; + gl_prog->info.tes.primitive_mode = shader->info.TessEval.PrimitiveMode; } if (shader->info.TessEval.Spacing != 0) { - if (linked_shader->info.TessEval.Spacing != 0 && - linked_shader->info.TessEval.Spacing != + if (gl_prog->info.tes.spacing != 0 && gl_prog->info.tes.spacing != shader->info.TessEval.Spacing) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting vertex spacing.\n"); return; } - linked_shader->info.TessEval.Spacing = shader->info.TessEval.Spacing; + gl_prog->info.tes.spacing = shader->info.TessEval.Spacing; } if (shader->info.TessEval.VertexOrder != 0) { - if (linked_shader->info.TessEval.VertexOrder != 0 && - linked_shader->info.TessEval.VertexOrder != - shader->info.TessEval.VertexOrder) { + if (vertex_order != 0 && + vertex_order != shader->info.TessEval.VertexOrder) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting ordering.\n"); return; } - linked_shader->info.TessEval.VertexOrder = -shader->info.TessEval.VertexOrder; + vertex_order = shader->info.TessEval.VertexOrder; } if (shader->info.TessEval.PointMode != -1) { - if (linked_shader->info.TessEval.PointMode != -1 && - linked_shader->info.TessEval.PointMode != - shader->info.TessEval.PointMode) { + if (point_mode != -1 && + point_mode != shader->info.TessEval.PointMode) { linker_error(prog, "tessellation evaluation shader defined with " "conflicting point modes.\n"); return; } - linked_shader->info.TessEval.PointMode = -shader->info.TessEval.PointMode; + point_mode = shader->info.TessEval.PointMode; } } @@ -1793,21 +1789,26 @@ link_tes_in_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->info.TessEval.PrimitiveMode == PRIM_UNKNOWN) { + if (gl_prog->info.tes.primitive_mode == PRIM_UNKNOWN) { linker_error(prog, "tessellation evaluation shader didn't declare input " "primitive modes.\n"); return; } - if (linked_shader->info.TessEval.Spacing == TESS_SPACING_UNSPECIFIED) - linked_shader->info.TessEval.Spacing = TESS_SPACING_EQUAL; + if (gl_prog->info.tes.spacing == TESS_SPACING_UNSPECIFIED) +
[Mesa-dev] [PATCH 17/25] mesa/glsl: move pixel_center_integer to gl_shader
This is only used by gl_linked_shader as a temp during linking so use a temp there instead. --- src/compiler/glsl/glsl_parser_extras.cpp | 2 +- src/compiler/glsl/linker.cpp | 8 +++- src/mesa/main/mtypes.h | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index fe49423..70bde06 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -1810,7 +1810,7 @@ set_shader_inout_layout(struct gl_shader *shader, case MESA_SHADER_FRAGMENT: shader->redeclares_gl_fragcoord = state->fs_redeclares_gl_fragcoord; shader->uses_gl_fragcoord = state->fs_uses_gl_fragcoord; - shader->info.pixel_center_integer = state->fs_pixel_center_integer; + shader->pixel_center_integer = state->fs_pixel_center_integer; shader->origin_upper_left = state->fs_origin_upper_left; shader->ARB_fragment_coord_conventions_enable = state->ARB_fragment_coord_conventions_enable; diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 0bcf745..a6a2baa 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -1828,7 +1828,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, bool redeclares_gl_fragcoord = false; bool uses_gl_fragcoord = false; bool origin_upper_left = false; - linked_shader->info.pixel_center_integer = false; + bool pixel_center_integer = false; if (linked_shader->Stage != MESA_SHADER_FRAGMENT || (prog->data->Version < 150 && @@ -1858,8 +1858,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, */ if (redeclares_gl_fragcoord && shader->redeclares_gl_fragcoord && (shader->origin_upper_left != origin_upper_left || - shader->info.pixel_center_integer != - linked_shader->info.pixel_center_integer)) { + shader->pixel_center_integer != pixel_center_integer)) { linker_error(prog, "fragment shader defined with conflicting " "layout qualifiers for gl_FragCoord\n"); } @@ -1873,8 +1872,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog, redeclares_gl_fragcoord = shader->redeclares_gl_fragcoord; uses_gl_fragcoord |= shader->uses_gl_fragcoord; origin_upper_left = shader->origin_upper_left; - linked_shader->info.pixel_center_integer = -shader->info.pixel_center_integer; + pixel_center_integer = shader->pixel_center_integer; } linked_shader->Program->info.fs.early_fragment_tests |= diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4edfaac..de2821e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2241,8 +2241,6 @@ struct gl_shader_info bool PostDepthCoverage; bool InnerCoverage; - bool pixel_center_integer; - struct { /** Global xfb_stride out qualifier if any */ GLuint BufferStride[MAX_FEEDBACK_BUFFERS]; @@ -2432,6 +2430,7 @@ struct gl_shader * Fragment shader state from GLSL 1.50 layout qualifiers. */ bool origin_upper_left; + bool pixel_center_integer; struct gl_shader_info info; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/11] spirv: Add tessellation varying and built-in support.
On 9 January 2017 at 15:26, Kenneth Graunke wrote: > We need to: > - handle the extra array level for per-vertex varyings > - handle the patch qualifier correctly > - assign varying locations > > Signed-off-by: Kenneth Graunke Seems sane, Reviewed-by: Dave Airlie > --- > src/compiler/spirv/vtn_private.h | 1 + > src/compiler/spirv/vtn_variables.c | 56 > ++ > 2 files changed, 52 insertions(+), 5 deletions(-) > > diff --git a/src/compiler/spirv/vtn_private.h > b/src/compiler/spirv/vtn_private.h > index 9302611803f..8b450106543 100644 > --- a/src/compiler/spirv/vtn_private.h > +++ b/src/compiler/spirv/vtn_private.h > @@ -280,6 +280,7 @@ struct vtn_variable { > unsigned descriptor_set; > unsigned binding; > unsigned input_attachment_index; > + bool patch; > > nir_variable *var; > nir_variable **members; > diff --git a/src/compiler/spirv/vtn_variables.c > b/src/compiler/spirv/vtn_variables.c > index e3845365bdd..dcd0609626b 100644 > --- a/src/compiler/spirv/vtn_variables.c > +++ b/src/compiler/spirv/vtn_variables.c > @@ -935,10 +935,19 @@ vtn_get_builtin_location(struct vtn_builder *b, > unreachable("invalid stage for SpvBuiltInViewportIndex"); >break; > case SpvBuiltInTessLevelOuter: > + *location = VARYING_SLOT_TESS_LEVEL_OUTER; > + break; > case SpvBuiltInTessLevelInner: > + *location = VARYING_SLOT_TESS_LEVEL_INNER; > + break; > case SpvBuiltInTessCoord: > + *location = SYSTEM_VALUE_TESS_COORD; > + set_mode_system_value(mode); > + break; > case SpvBuiltInPatchVertices: > - unreachable("no tessellation support"); > + *location = SYSTEM_VALUE_VERTICES_IN; > + set_mode_system_value(mode); > + break; > case SpvBuiltInFragCoord: >*location = VARYING_SLOT_POS; >assert(*mode == nir_var_shader_in); > @@ -1052,6 +1061,11 @@ apply_var_decoration(struct vtn_builder *b, > nir_variable *nir_var, >vtn_get_builtin_location(b, builtin, &nir_var->data.location, &mode); >nir_var->data.mode = mode; > > + if (builtin == SpvBuiltInTessLevelOuter || > + builtin == SpvBuiltInTessLevelInner) { > + nir_var->data.compact = true; > + } > + >if (builtin == SpvBuiltInFragCoord || builtin == > SpvBuiltInSamplePosition) > nir_var->data.origin_upper_left = b->origin_upper_left; > > @@ -1076,7 +1090,7 @@ apply_var_decoration(struct vtn_builder *b, > nir_variable *nir_var, >break; /* Do nothing with these here */ > > case SpvDecorationPatch: > - vtn_warn("Tessellation not yet supported"); > + nir_var->data.patch = true; >break; > > case SpvDecorationLocation: > @@ -1116,6 +1130,15 @@ apply_var_decoration(struct vtn_builder *b, > nir_variable *nir_var, > } > > static void > +var_is_patch_cb(struct vtn_builder *b, struct vtn_value *val, int member, > +const struct vtn_decoration *dec, void *out_is_patch) > +{ > + if (dec->decoration == SpvDecorationPatch) { > + *((bool *) out_is_patch) = true; > + } > +} > + > +static void > var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, >const struct vtn_decoration *dec, void *void_var) > { > @@ -1132,6 +1155,9 @@ var_decoration_cb(struct vtn_builder *b, struct > vtn_value *val, int member, > case SpvDecorationInputAttachmentIndex: >vtn_var->input_attachment_index = dec->literals[0]; >return; > + case SpvDecorationPatch: > + vtn_var->patch = true; > + break; > default: >break; > } > @@ -1162,7 +1188,7 @@ var_decoration_cb(struct vtn_builder *b, struct > vtn_value *val, int member, >} else if (vtn_var->mode == vtn_variable_mode_input || > vtn_var->mode == vtn_variable_mode_output) { > is_vertex_input = false; > - location += VARYING_SLOT_VAR0; > + location += vtn_var->patch ? VARYING_SLOT_PATCH0 : > VARYING_SLOT_VAR0; >} else { > unreachable("Location must be on input or output variable"); >} > @@ -1209,6 +1235,24 @@ var_decoration_cb(struct vtn_builder *b, struct > vtn_value *val, int member, > } > } > > +static bool > +is_per_vertex_inout(const struct vtn_variable *var, gl_shader_stage stage) > +{ > + if (var->patch || !glsl_type_is_array(var->type->type)) > + return false; > + > + if (var->mode == vtn_variable_mode_input) { > + return stage == MESA_SHADER_TESS_CTRL || > + stage == MESA_SHADER_TESS_EVAL || > + stage == MESA_SHADER_GEOMETRY; > + } > + > + if (var->mode == vtn_variable_mode_output) > + return stage == MESA_SHADER_TESS_CTRL; > + > + return false; > +} > + > void > vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, > const uint32_t *w, unsigned count) > @@ -1308,6 +1352,9 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp > opcode
[Mesa-dev] [PATCH 24/25] mesa/glsl: set and get cs layouts to and from shader_info
--- src/compiler/glsl/linker.cpp | 35 +++ src/mesa/main/mtypes.h | 10 -- src/mesa/main/shaderapi.c| 6 ++ src/mesa/main/shaderobj.c| 2 -- 4 files changed, 17 insertions(+), 36 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 53ee7e6..f822778 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2005,21 +2005,21 @@ link_gs_inout_layout_qualifiers(struct gl_shader_program *prog, */ static void link_cs_input_layout_qualifiers(struct gl_shader_program *prog, -struct gl_linked_shader *linked_shader, +struct gl_program *gl_prog, struct gl_shader **shader_list, unsigned num_shaders) { - for (int i = 0; i < 3; i++) - linked_shader->info.Comp.LocalSize[i] = 0; - - linked_shader->info.Comp.LocalSizeVariable = false; - /* This function is called for all shader stages, but it only has an effect * for compute shaders. */ - if (linked_shader->Stage != MESA_SHADER_COMPUTE) + if (gl_prog->info.stage != MESA_SHADER_COMPUTE) return; + for (int i = 0; i < 3; i++) + gl_prog->info.cs.local_size[i] = 0; + + gl_prog->info.cs.local_size_variable = false; + /* From the ARB_compute_shader spec, in the section describing local size * declarations: * @@ -2034,9 +2034,9 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, struct gl_shader *shader = shader_list[sh]; if (shader->info.Comp.LocalSize[0] != 0) { - if (linked_shader->info.Comp.LocalSize[0] != 0) { + if (gl_prog->info.cs.local_size[0] != 0) { for (int i = 0; i < 3; i++) { - if (linked_shader->info.Comp.LocalSize[i] != + if (gl_prog->info.cs.local_size[i] != shader->info.Comp.LocalSize[i]) { linker_error(prog, "compute shader defined with conflicting " "local sizes\n"); @@ -2045,11 +2045,11 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, } } for (int i = 0; i < 3; i++) { -linked_shader->info.Comp.LocalSize[i] = +gl_prog->info.cs.local_size[i] = shader->info.Comp.LocalSize[i]; } } else if (shader->info.Comp.LocalSizeVariable) { - if (linked_shader->info.Comp.LocalSize[0] != 0) { + if (gl_prog->info.cs.local_size[0] != 0) { /* The ARB_compute_variable_group_size spec says: * * If one compute shader attached to a program declares a @@ -2061,7 +2061,7 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, "variable local group size\n"); return; } - linked_shader->info.Comp.LocalSizeVariable = true; + gl_prog->info.cs.local_size_variable = true; } } @@ -2069,17 +2069,12 @@ link_cs_input_layout_qualifiers(struct gl_shader_program *prog, * since we already know we're in the right type of shader program * for doing it. */ - if (linked_shader->info.Comp.LocalSize[0] == 0 && - !linked_shader->info.Comp.LocalSizeVariable) { + if (gl_prog->info.cs.local_size[0] == 0 && + !gl_prog->info.cs.local_size_variable) { linker_error(prog, "compute shader must contain a fixed or a variable " "local group size\n"); return; } - for (int i = 0; i < 3; i++) - prog->Comp.LocalSize[i] = linked_shader->info.Comp.LocalSize[i]; - - prog->Comp.LocalSizeVariable = - linked_shader->info.Comp.LocalSizeVariable; } @@ -2209,7 +2204,7 @@ link_intrastage_shaders(void *mem_ctx, link_tcs_out_layout_qualifiers(prog, gl_prog, shader_list, num_shaders); link_tes_in_layout_qualifiers(prog, gl_prog, shader_list, num_shaders); link_gs_inout_layout_qualifiers(prog, gl_prog, shader_list, num_shaders); - link_cs_input_layout_qualifiers(prog, linked, shader_list, num_shaders); + link_cs_input_layout_qualifiers(prog, gl_prog, shader_list, num_shaders); link_xfb_stride_layout_qualifiers(ctx, prog, linked, shader_list, num_shaders); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2004720..aff426f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2760,19 +2760,9 @@ struct gl_shader_program */ struct { /** - * If this shader contains a compute stage, size specified using - * local_size_{x,y,z}. Otherwise undefined. - */ - unsigned LocalSize[3]; - /** * Size of shared variables accessed by the compute shader. */ unsigned SharedSize; - - /** - * Whether a variable work group size has been specified. - */ - bool LocalSi
Re: [Mesa-dev] [PATCH 03/11] spirv: Silence unsupported tessellation capability warnings.
On 9 January 2017 at 15:26, Kenneth Graunke wrote: > This is all implemented now. Do we want to key these off the nir_spirv_supported_extensions thing I added? Dave. > > Signed-off-by: Kenneth Graunke > --- > src/compiler/spirv/spirv_to_nir.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/compiler/spirv/spirv_to_nir.c > b/src/compiler/spirv/spirv_to_nir.c > index 8f19afa77ee..2ea836bd7f6 100644 > --- a/src/compiler/spirv/spirv_to_nir.c > +++ b/src/compiler/spirv/spirv_to_nir.c > @@ -515,7 +515,6 @@ struct_member_decoration_cb(struct vtn_builder *b, >break; > > case SpvDecorationPatch: > - vtn_warn("Tessellation not yet supported"); >break; > > case SpvDecorationSpecId: > @@ -2505,11 +2504,11 @@ vtn_handle_preamble_instruction(struct vtn_builder > *b, SpvOp opcode, >case SpvCapabilityInputAttachment: >case SpvCapabilityImageGatherExtended: >case SpvCapabilityStorageImageExtendedFormats: > + case SpvCapabilityTessellation: > + case SpvCapabilityTessellationPointSize: > break; > >case SpvCapabilityGeometryStreams: > - case SpvCapabilityTessellation: > - case SpvCapabilityTessellationPointSize: >case SpvCapabilityLinkage: >case SpvCapabilityVector16: >case SpvCapabilityFloat16Buffer: > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/11] nir: Add a pass to lower TES patch_vertices intrinsics to a constant.
On 9 January 2017 at 15:26, Kenneth Graunke wrote: > In Vulkan, we always have both the TCS and TES available in the same > pipeline, so we can simply use the TCS OutputVertices execution mode > value as the TES PatchVertices built-in. > > For GLSL, we handle this in the linker. But we could use this pass > in the case when both TCS and TES are linked together, if we wanted. > > Signed-off-by: Kenneth Graunke Reviewed-by: Dave Airlie though I'd like someone more NIR focused to also look at it. Dave. > --- > src/compiler/Makefile.sources | 1 + > src/compiler/nir/nir.h | 1 + > src/compiler/nir/nir_lower_patch_vertices.c | 53 > + > 3 files changed, 55 insertions(+) > create mode 100644 src/compiler/nir/nir_lower_patch_vertices.c > > diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources > index 52f6e5428f4..7479afae047 100644 > --- a/src/compiler/Makefile.sources > +++ b/src/compiler/Makefile.sources > @@ -218,6 +218,7 @@ NIR_FILES = \ > nir/nir_lower_io_to_scalar.c \ > nir/nir_lower_io_types.c \ > nir/nir_lower_passthrough_edgeflags.c \ > + nir/nir_lower_patch_vertices.c \ > nir/nir_lower_phis_to_scalar.c \ > nir/nir_lower_regs_to_ssa.c \ > nir/nir_lower_returns.c \ > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h > index d17924c2aac..cb8f7749745 100644 > --- a/src/compiler/nir/nir.h > +++ b/src/compiler/nir/nir.h > @@ -2464,6 +2464,7 @@ void nir_lower_two_sided_color(nir_shader *shader); > void nir_lower_clamp_color_outputs(nir_shader *shader); > > void nir_lower_passthrough_edgeflags(nir_shader *shader); > +void nir_lower_tes_patch_vertices(nir_shader *tes, unsigned patch_vertices); > > typedef struct nir_lower_wpos_ytransform_options { > int state_tokens[5]; > diff --git a/src/compiler/nir/nir_lower_patch_vertices.c > b/src/compiler/nir/nir_lower_patch_vertices.c > new file mode 100644 > index 000..d196576b993 > --- /dev/null > +++ b/src/compiler/nir/nir_lower_patch_vertices.c > @@ -0,0 +1,53 @@ > +/* > + * Copyright © 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > DEALINGS > + * IN THE SOFTWARE. > + */ > + > +#include "nir_builder.h" > + > +void > +nir_lower_tes_patch_vertices(nir_shader *tes_nir, unsigned patch_vertices) > +{ > + nir_foreach_function(function, tes_nir) { > + if (function->impl) { > + nir_foreach_block(block, function->impl) { > +nir_builder b; > +nir_builder_init(&b, function->impl); > +nir_foreach_instr_safe(instr, block) { > + if (instr->type == nir_instr_type_intrinsic) { > + nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); > + if (intr->intrinsic != > nir_intrinsic_load_patch_vertices_in) > + continue; > + > + b.cursor = nir_before_instr(&intr->instr); > + nir_ssa_def *val = nir_imm_int(&b, patch_vertices); > + nir_ssa_def_rewrite_uses(&intr->dest.ssa, > + nir_src_for_ssa(val)); > + nir_instr_remove(instr); > + } > +} > + } > + > + nir_metadata_preserve(function->impl, nir_metadata_block_index | > + nir_metadata_dominance); > + } > + } > +} > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri: don't load .drirc from $HOME
On 07/01/17 11:46 PM, Marek Olšák wrote: > From: Marek Olšák > > ~/.drirc is created by the driconf tool (GPL license) and it overrides > system drirc settings and can't be changed by Mesa updates. > This drops support for the tool. It has been a source of major pain > for us and it continues to cause problems. > > If people wanna keep this and enjoy the pain, I will make a v2 that > applies it to radeon drivers only. > > v2: update comments and docs The problem is the driconf application (and possibly documentation recommending its use), not the ~/.drirc file. This is throwing out the proverbial baby with the bathwater. Fix the problem instead. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri: don't load .drirc from $HOME
On 09/01/17 03:13 PM, Michel Dänzer wrote: > On 07/01/17 11:46 PM, Marek Olšák wrote: >> From: Marek Olšák >> >> ~/.drirc is created by the driconf tool (GPL license) and it overrides >> system drirc settings and can't be changed by Mesa updates. >> This drops support for the tool. It has been a source of major pain >> for us and it continues to cause problems. >> >> If people wanna keep this and enjoy the pain, I will make a v2 that >> applies it to radeon drivers only. >> >> v2: update comments and docs > > The problem is the driconf application (and possibly documentation > recommending its use), not the ~/.drirc file. This is throwing out the > proverbial baby with the bathwater. Fix the problem instead. As for something that could be done about this issue in Mesa, how about adding terminal output about which driconf options are set to what values from where, enabled e.g. via LIBGL_DEBUG=verbose ? -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/22] i965/disasm: also print nibctrl in IVB for execsize=8
On 01/05, Samuel Iglesias Gonsálvez wrote: From: Iago Toral Quiroga 4-wide DF operations where NibCtrl applies require and execsize of 8 in IvyBridge/Valleyview. Wow, the documentation is bad in this area. The QtrCtrl description in IVB's Vol4 Part3 explicitly says "NibCtrl is only allowed for SIMD4 instructions with (DF) double precision source and/or destination." and shows NibCtrl only being enabled with ExecSize=4. That's very unclear and I hope that didn't trip you guys up. --- src/mesa/drivers/dri/i965/brw_disasm.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c index 167067a..7c3791d 100644 --- a/src/mesa/drivers/dri/i965/brw_disasm.c +++ b/src/mesa/drivers/dri/i965/brw_disasm.c @@ -1209,6 +1209,13 @@ qtr_ctrl(FILE *file, const struct gen_device_info *devinfo, brw_inst *inst) string(file, " 4Q"); break; } + if (devinfo->gen == 7 && !devinfo->is_haswell) { + int nib_ctl = brw_inst_nib_control(devinfo, inst); + if (nib_ctl == 0) +string(file, " 1N"); + else +string(file, " 2N"); + } This looks like it will print 1N/2N in addition to the 1Q/2Q/3Q/4Q from immediately before. I don't think that's the intention. Perhaps we can do a slight refactor and change the structure to const unsigned nib_ctrl = devinfo->gen < 7 ? 0 : brw_inst_nib_control(devinfo, inst); if (nib_ctrl) { format(file, " %dN", qtr_ctl * 2 + nib_ctl + 1); } else if (exec_size == 8) { ... } else if (exec_size == 16) { ... } this is just the disassembler, so we don't need to implement logic that decides when NibCtrl is valid and when it's not -- just disassemble what's there :) (I renamed nib_ctl -> nib_ctrl in the above block intentionally to match the field name). You can preemptively put a Reviewed-by: Matt Turner on such a patch. signature.asc Description: Digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/22] i965/fs: duplicate regioning parameters and execsize for DF in IVB/VLV
On 01/05, Samuel Iglesias Gonsálvez wrote: From: "Juan A. Suarez Romero" In IVB and VLV, both regioning parameters and execution sizes are measured as floats. So when we have something like: mov(8) g2<1>DF g3<4,4,1>DF We are not actually moving 8 doubles (our intention), but 4 doubles. We need to duplicate the parameters to cope with this issue. s/duplicate/double/ --- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 47 ++ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 0710be9..90ee7c1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -54,13 +54,14 @@ brw_file_from_reg(fs_reg *reg) } static struct brw_reg -brw_reg_from_fs_reg(fs_inst *inst, fs_reg *reg, unsigned gen, bool compressed) +brw_reg_from_fs_reg(const struct brw_compiler *compiler, fs_inst *inst, I think we should pass a const struct gen_device_info *devinfo instead of a brw_compiler* +fs_reg *reg, bool compressed) { struct brw_reg brw_reg; switch (reg->file) { case MRF: - assert((reg->nr & ~BRW_MRF_COMPR4) < BRW_MAX_MRF(gen)); + assert((reg->nr & ~BRW_MRF_COMPR4) < BRW_MAX_MRF(compiler->devinfo->gen)); /* Fallthrough */ case VGRF: if (reg->stride == 0) { @@ -93,6 +94,37 @@ brw_reg_from_fs_reg(fs_inst *inst, fs_reg *reg, unsigned gen, bool compressed) const unsigned width = MIN2(reg_width, phys_width); brw_reg = brw_vecn_reg(width, brw_file_from_reg(reg), reg->nr, 0); brw_reg = stride(brw_reg, width * reg->stride, width, reg->stride); + /* From the Ivy PRM (EU Changes by Processor Generation, page 13): s/Ivy/Ivy Bridge/ + * "Each DF (Double Float) operand uses an element size of 4 rather + * than 8 and all regioning parameters are twice what the values align each additional line of the quotation with the first line: "Each DF (Double Float) operand uses an element size of 4 rather than 8 and all regioning parameters are twice what the values ... + * would be based on the true element size: ExecSize, Width, + * HorzStride, and VertStride. Each DF operand uses a pair of + * channels and all masking and swizzing should be adjusted + * appropriately." + * + * From the Ivy PRM (Special Requirements for Handling Double s/Ivy/Ivy Bridge/ + * Precision Data Types, page 71): + * "In Align1 mode, all regioning parameters like stride, execution + * size, and width must use the syntax of a pair of packed + * floats. The offsets for these data types must be 64-bit + * aligned. The execution size and regioning parameters are in terms + * of floats." alignment + * + * All these paragraphs summarizes that in Ivy, when handling DF, + * exec_size, width and vertstride must be duplicated. And Horzstride + * should be duplicated when it is greater than 1. I'd rewrite this a little bit. How about Summarized: when handling DF-typed arguments, ExecSize, VertStride, and Width must be doubled, and HorzStride must be doubled when the region is not scalar. + * + * It applies to Valleyview too. I just looked -- we actually do a surprisingly good job of always using the name BayTrail (BYT) instead of Valleyview (VLV) in i965. Let's s/Valleyview/BayTrail/ This also applies to BayTrail. Reviewed-by: Matt Turner signature.asc Description: Digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/22] i965/fs: add lowering step to duplicate sources with stride 0.
On 01/05, Samuel Iglesias Gonsálvez wrote: From: "Juan A. Suarez Romero" When dealing with DF uniforms with just 1 component, we set stride 0 to use the value along the operation. However, when duplicating the regioning parameters in IVB/VLV, we are violating the regioning restrictions. So instead of using the value with stride 0, we just duplicate it in a register, and then use the register instead, avoiding a DF with stride 0. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 63 src/mesa/drivers/dri/i965/brw_fs.h | 1 + 2 files changed, 64 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index eb3b4aa..78f2124 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2168,6 +2168,62 @@ fs_visitor::lower_constant_loads() invalidate_live_intervals(); } +/** + * When dealing with double-precision floats (DF) in IVB/VLV, we need to + * duplicate the regioning parameters. This means that for a DF scalar + * (regioning <0,1,0>) we will end up using regioning <0,2,0>. But according + * to General Restrictions on Regioning Parameters (Ivy PRM, Vol. 4 Part 3, + * page 69), if VertStride = HorzStride = 0, Width must be 1 regardless of the + * value of ExecSize. So we would be violating the restriction. To overcome + * it, this lowering step duplicates the scalar in a couple of registers, + * reading it as two floats to avoid the restriction. Huh, I would have thought that a <0,1,0>DF region would have done what we wanted, without the need to double any of the region parameters. I haven't tested yet, so I'll play with it tomorrow and see if it blows up. signature.asc Description: Digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/22] i965 Ivybridge ARB_gpu_shader_fp64 / OpenGL 4.0
I have just started reviewing the series, and I have two trivial comments that seem to apply to a number of patches. The first is that we prefer to use the name BayTrail (abbreviation BYT) instead of Valleyview (and its abbreviation VLV) in comments. I'm not really sure why, to be honest. The other is that unlike in Spanish where duplicar means "to make a copy of" or "to multiply by two", in English "duplicate" only means the former, whereas the intended meaning of the comments is the latter. That is, use "double" and not "duplicate" :) I'll continue reviewing tomorrow and add IVB DF support to my EU assembly validator. I expect this series should make it into the 17.0 branch. I'll be looking for the VA64 series as well :) Thanks! signature.asc Description: Digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/8] android: fix building on lollipop
Sorry, my bad, I'll post a new revision incorporating Rob's review comment 2017-01-09 7:07 GMT+08:00 Mauro Rossi : > 2017-01-06 18:35 GMT+01:00 Wu Zhen : > > From: WuZhen > > > > this commit fixes mesa building on lollipop, however, > > llvm on lollipop is too old to build amdgpu > > > > based on initial work by Mauro Rossi > > > > Change-Id: I98d646f9e1c61fe2754479382885718386a8bbb7 > > Reviewed-by: Mauro Rossi > > Reviewed-by: Chih-Wei Huang > > --- > > Android.common.mk | 2 +- > > Android.mk | 5 - > > src/gbm/Android.mk | 1 + > > src/mesa/Android.libmesa_st_mesa.mk | 1 + > > 4 files changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/Android.common.mk b/Android.common.mk > > index 9f64c220f8..7ab3942ee2 100644 > > --- a/Android.common.mk > > +++ b/Android.common.mk > > @@ -91,7 +91,7 @@ endif > > endif > > > > LOCAL_CPPFLAGS += \ > > - $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-D_USING_LIBCXX) \ > > + $(if $(filter true,$(MESA_LOLLIPOP_BUILD)),-std=c++11) \ > > -Wno-error=non-virtual-dtor \ > > -Wno-non-virtual-dtor > > > > diff --git a/Android.mk b/Android.mk > > index fb29105a60..b52e7f8232 100644 > > --- a/Android.mk > > +++ b/Android.mk > > @@ -95,10 +95,13 @@ SUBDIRS := \ > > src/mesa \ > > src/util \ > > src/egl \ > > - src/amd \ > > src/intel \ > > src/mesa/drivers/dri > > > > +ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),) > > +SUBDIRS += src/amd > > +endif > > + > > INC_DIRS := $(call all-named-subdir-makefiles,$(SUBDIRS)) > > > > ifeq ($(strip $(MESA_BUILD_GALLIUM)),true) > > diff --git a/src/gbm/Android.mk b/src/gbm/Android.mk > > index a3f8fbbeab..89127766e6 100644 > > --- a/src/gbm/Android.mk > > +++ b/src/gbm/Android.mk > > @@ -33,6 +33,7 @@ LOCAL_C_INCLUDES := \ > > $(LOCAL_PATH)/main > > > > LOCAL_STATIC_LIBRARIES := libmesa_loader > > +LOCAL_SHARED_LIBRARIES := libdl > > LOCAL_MODULE := libgbm > > > > LOCAL_SRC_FILES := \ > > diff --git a/src/mesa/Android.libmesa_st_mesa.mk b/src/mesa/ > Android.libmesa_st_mesa.mk > > index 3905ddcf24..90e4ccd210 100644 > > --- a/src/mesa/Android.libmesa_st_mesa.mk > > +++ b/src/mesa/Android.libmesa_st_mesa.mk > > @@ -67,6 +67,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES += \ > > > > LOCAL_STATIC_LIBRARIES += libmesa_nir libmesa_glsl > > > > +include external/libcxx/libcxx.mk > > Hi, if I recall correctly, we reviewed an updated version, > because libcxx.mk is not present in Android 6 and 7 (this would stop > the android build) > and stlport is used in kitkat > > Similar scenario in src/gallium/drivers/r600 and > src/gallium/drivers/nouveau, > has the following if/else/endif, and it works also here: > > +ifeq ($(MESA_LOLLIPOP_BUILD),true) > +LOCAL_C_INCLUDES += external/libcxx/include > +else > +include external/stlport/libstlport.mk > +endif > > NOTE: MESA_LOLLIPOP_BUILD currently has the meaning of "lollipop and > later", > equivalent to say "we're using c++11" > > > include $(LOCAL_PATH)/Android.gen.mk > > include $(MESA_COMMON_MK) > > include $(BUILD_STATIC_LIBRARY) > > -- > > 2.11.0 > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 97879] [amdgpu] Rocket League: long hangs (several seconds) when loading assets (models/textures/shaders?)
https://bugs.freedesktop.org/show_bug.cgi?id=97879 --- Comment #48 from Jani Kärkkäinen --- Using AMDGPU-PRO the hangs are non-existent. So there must be SOMETHING in the whole mesa-driver stack, that causes the hangs, if not the GL drivers themselves. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/22] i965 Ivybridge ARB_gpu_shader_fp64 / OpenGL 4.0
On Sun, 2017-01-08 at 22:59 -0800, Matt Turner wrote: > I have just started reviewing the series, and I have two trivial > comments that seem to apply to a number of patches. The first is that > we > prefer to use the name BayTrail (abbreviation BYT) instead of > Valleyview > (and its abbreviation VLV) in comments. I'm not really sure why, to > be > honest. > OK, I will rename it! > The other is that unlike in Spanish where duplicar means "to make a > copy > of" or "to multiply by two", in English "duplicate" only means the > former, whereas the intended meaning of the comments is the latter. > That > is, use "double" and not "duplicate" :) > Oops, you are right! > I'll continue reviewing tomorrow and add IVB DF support to my EU > assembly validator. I expect this series should make it into the 17.0 > branch. I'll be looking for the VA64 series as well :) > > Thanks! Thanks a lot! Sam signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 06/22] spirv: fix SpvOpSpecConstantOp with SpvOpVectorShuffle working with double-based vecs
On Thu, 2017-01-05 at 17:32 +0100, Erik Faye-Lund wrote: > > > On Jan 5, 2017 10:20, "Samuel Iglesias Gonsálvez" om> wrote: > We need to pick two 32-bit values per component to perform the right > shuffle operation. > > v2 (Jason): > - Add assert to check matching bit sizes (Jason) > - Simplify the code to pick components (Jason) > > Signed-off-by: Samuel Iglesias Gonsálvez > --- > src/compiler/spirv/spirv_to_nir.c | 40 > ++- > 1 file changed, 31 insertions(+), 9 deletions(-) > > diff --git a/src/compiler/spirv/spirv_to_nir.c > b/src/compiler/spirv/spirv_to_nir.c > index b44b8e823d2..a9c1bef1411 100644 > --- a/src/compiler/spirv/spirv_to_nir.c > +++ b/src/compiler/spirv/spirv_to_nir.c > @@ -1076,18 +1076,40 @@ vtn_handle_constant(struct vtn_builder *b, > SpvOp opcode, > unsigned len0 = glsl_get_vector_elements(v0->const_type); > unsigned len1 = glsl_get_vector_elements(v1->const_type); > > - uint32_t u[8]; > - for (unsigned i = 0; i < len0; i++) > - u[i] = v0->constant->values[0].u32[i]; > - for (unsigned i = 0; i < len1; i++) > - u[len0 + i] = v1->constant->values[0].u32[i]; > + uint32_t u32[8]; > + uint64_t u64[8]; > + assert(len0 + len1 < 16); > + > + unsigned bit_size = glsl_get_bit_size(val->const_type); > + assert(bit_size == glsl_get_bit_size(v0->const_type) && > + bit_size == glsl_get_bit_size(v1->const_type)); > + > + for (unsigned i = 0; i < len0; i++) { > + if (bit_size == 64) > + u64[i] = v0->constant->values[0].u64[i]; > + else > + u32[i] = v0->constant->values[0].u32[i]; > + } > + > + for (unsigned i = 0; i < len1; i++) { > + if (bit_size == 64) > + u64[len0 + i] = v1->constant->values[0].u64[i]; > + else > + u32[len0 + i] = v1->constant->values[0].u32[i]; > + } > > - for (unsigned i = 0; i < count - 6; i++) { > + for (unsigned i = 0, j = 0; i < count - 6; i++, j++) { > uint32_t comp = w[i + 6]; > - if (comp == (uint32_t)-1) { > - val->constant->values[0].u32[i] = 0xdeadbeef; > + if (bit_size == 64) { > + if (comp == (uint32_t)-1) > + val->constant->values[0].u64[j] = > 0xdeadbeefdeadbeef; > > If this is really intended, shouldn't there be some explanation? > Right. I am going to add a comment. Thanks, Sam > + else > + val->constant->values[0].u64[j] = u64[comp]; > } else { > - val->constant->values[0].u32[i] = u[comp]; > + if (comp == (uint32_t)-1) > + val->constant->values[0].u32[j] = 0xdeadbeef; > > Same... > > + else > + val->constant->values[0].u32[j] = u32[comp]; > } > } > break; > -- > 2.11.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] isl: render target cube maps should be handled as 2D images, not cubes
On Fri, 2017-01-06 at 10:24 -0800, Jason Ekstrand wrote: > On Jan 6, 2017 10:18, "Jason Ekstrand" wrote: > Thanks for catching this. I wonder how I managed to switch the GL > driver over to using ISL for emitting surface states without > regressing anything... > > Reviewed-by: Jason Ekstrand > > On Jan 6, 2017 05:42, "Iago Toral Quiroga" wrote: > > This fixes layered rendering Vulkan CTS tests with cube (arrays). > > We > > also do this in the GL driver, see this code from > > gen8_depth_state.c > > for example: > > > > case GL_TEXTURE_CUBE_MAP_ARRAY: > > case GL_TEXTURE_CUBE_MAP: > > /* The PRM claims that we should use BRW_SURFACE_CUBE for this > > * situation, but experiments show that gl_Layer doesn't work > > when we do > > * this. So we use BRW_SURFACE_2D, since for rendering purposes > > this is > > * equivalent. > > */ > > surftype = BRW_SURFACE_2D; > > depth *= 6; > > break; > > > > So I guess we simply forgot to port this workaround to Vulkan. > > > > Fixes: > > dEQP-VK.geometry.layered.cube* > > --- > > > > With this (and the previous patch I sent to fix the SBE state > > packet to not > > skip the VUE header when we need the layer information) all the > > layered > > rendering tests in Vulkan CTS seem to pass. > > > > src/intel/isl/isl_surface_state.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/src/intel/isl/isl_surface_state.c > > b/src/intel/isl/isl_surface_state.c > > index 3bb0abd..0960a90 100644 > > --- a/src/intel/isl/isl_surface_state.c > > +++ b/src/intel/isl/isl_surface_state.c > > @@ -113,8 +113,9 @@ get_surftype(enum isl_surf_dim dim, > > isl_surf_usage_flags_t usage) > > assert(!(usage & ISL_SURF_USAGE_CUBE_BIT)); > > return SURFTYPE_1D; > > case ISL_SURF_DIM_2D: > > - if (usage & ISL_SURF_USAGE_STORAGE_BIT) { > > - /* Storage images are always plain 2-D, not cube */ > > + if ((usage & ISL_SURF_USAGE_STORAGE_BIT) || > > + (usage & ISL_SURF_USAGE_RENDER_TARGET_BIT)) { > > + /* Storage / Render images are always plain 2-D, not cube > > */ > > return SURFTYPE_2D; > > } else if (usage & ISL_SURF_USAGE_CUBE_BIT) { > On second thought... I wonder if the right thing to do here wouldnt > be to just change the other condition a bit to > > if ((usage & ISL_SURF_USAGE_CUBE_BIT) && > (usage & ISL_SURF_USAGE_TEXTURE_BIT)) { > /* We need SURFTYPE_CUBE to make cube sampling work */ > return SURFTYPE_CUBE; > } else { > /* Everything else (render and storage) treat cubes a plain 2D > array textures */ > return SURFTYPE_2D; > } > > It seems like textures, and not render targets, are the special case > here. Yep this seems to be a better way to look at it and Jenkins is happy with it too, so I'll push this version. Thanks! > > > > return SURFTYPE_CUBE; > > > > -- > > > > 2.7.4 > > > > > > __> > _ > > > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev