Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
Let me know if a test is useful for this, as it seems like implementation detail. To see the crash it's enough to create two shaders with matching descriptions, containing gaps.
dlls/wined3d/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d2147447ee0..4f7a46340d4 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5620,7 +5620,9 @@ static int wined3d_so_desc_compare(const void *key, const struct wine_rb_entry *
if ((ret = (a->stream_idx - b->stream_idx))) return ret; - if ((ret = strcmp(a->semantic_name, b->semantic_name))) + if (!!a->semantic_name ^ !!b->semantic_name) + return a->semantic_name ? -1 : 1; + if (a->semantic_name && (ret = strcmp(a->semantic_name, b->semantic_name))) return ret; if ((ret = (a->semantic_idx - b->semantic_idx))) return ret;
On Mon, 6 Sept 2021 at 13:54, Nikolay Sivov nsivov@codeweavers.com wrote:
if (!!a->semantic_name ^ !!b->semantic_name)
return a->semantic_name ? -1 : 1;
I suppose that's fine, although "if (!a->semantic_name != !b->semantic_name)" would work just as well. Alternatively, we could do something like
if ((ret = (!a->semantic_name - !b->semantic_name))) return ret;
which would perhaps better fit the rest of the function.
On 9/9/21 6:46 PM, Henri Verbeet wrote:
On Mon, 6 Sept 2021 at 13:54, Nikolay Sivov nsivov@codeweavers.com wrote:
if (!!a->semantic_name ^ !!b->semantic_name)
return a->semantic_name ? -1 : 1;
I suppose that's fine, although "if (!a->semantic_name != !b->semantic_name)" would work just as well. Alternatively, we could do something like
if ((ret = (!a->semantic_name - !b->semantic_name))) return ret;
which would perhaps better fit the rest of the function.
Thanks, that looks much better. I sent a v2.