<div dir="ltr"><div dir="ltr">Hi Ian,<div><br></div><div>Thanks for the explanation. I've just sent a patch for review with the compile time check <a href="https://patchwork.freedesktop.org/patch/255542/">https://patchwork.freedesktop.org/patch/255542/</a></div><div><br></div><div>Regards,</div><div>Vadym</div></div></div><br><div class="gmail_quote"><div dir="ltr">пт, 5 окт. 2018 г. в 16:55, Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/03/2018 11:52 PM, Iago Toral wrote:<br>
> On Wed, 2018-10-03 at 16:24 +0300, Vadim Shovkoplias wrote:<br>
>> Hi Iago,<br>
>><br>
>> I also think that compiler is the best place for the fix. But from my<br>
>> understanding compiler fix will be limited to distinct shader objects<br>
>> (not the shader stage).<br>
>> In GLSL spec mentioned: "A program will fail to compile or link if any<br>
>> *shader or stage* contains two or more functions with the same name if<br>
>> the name is <br>
>> associated with a subroutine type".<br>
>> So if I understand the spec correctly such restriction for the shader<br>
>> stage can be fixed only in linker. E.g. consider the use case when<br>
>> fragment shader is linked from <br>
>> two fragment shader objects. One object contains function foo() which<br>
>> is associated with subroutine type and second shader object has some<br>
>> regular foo() function <br>
>> with the same name. I suppose compiler fix won't be able to detect this.<br>
> <br>
> Yes, that is correct, good point.<br>
> <br>
>> IMHO the best way to fix this is to implement 2 patches:<br>
>> 1) One patch for linker to implement restriction for the shader stages<br>
>> (already done in this patch)<br>
>> 2) Another one for compiler to check the restriction for distinct<br>
>> shader objects.<br>
>><br>
>> What do you think ?<br>
> <br>
> Since we need to keep the link-time check, any compile-time checks we<br>
> add would be redundant with that, so I think we should just go with the<br>
> link-time check only (your original patch)<br>
<br>
The spec quotation is pretty clear: "A program will fail to compile ...<br>
if any shader ... contains two or more functions with the same name if<br>
the name is associated with a subroutine type." To be strictly correct,<br>
both checks are necessary. Before doing that extra work, someone should<br>
check that glslang has the compile-time check.<br>
</blockquote></div>