[PATCH vkd3d 3/5] tests: Introduce a custom format and parser for shader-based tests.

Zebediah Figura zfigura at codeweavers.com
Wed Sep 30 10:14:48 CDT 2020


On 9/30/20 9:16 AM, Henri Verbeet wrote:
> On Wed, 30 Sep 2020 at 00:45, Zebediah Figura <zfigura at codeweavers.com> wrote:
>> diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c
>> new file mode 100644
>> index 00000000..e9a7387b
>> --- /dev/null
>> +++ b/tests/shader_runner_d3d12.c
>> @@ -0,0 +1,254 @@
>> +/*
>> + * Copyright © 2010 Intel Corporation
>> + * Copyright © 2020 Zebediah Figura for CodeWeavers
>> + *
>> + * 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.
>> + */
>> +
> I think we'd want this to be under the regular vkd3d license. (See
> also the gears and triangle demos for other places where we
> incorporate code under a different but compatible license.)

Sure; I wasn't sure and decided to play it safe...

> 
>> +                case STATE_SHADER_PIXEL:
>> +                    if (!shader_source)
>> +                    {
>> +                        shader_source = strdup(line);
>> +                    }
>> +                    else
>> +                    {
>> +                        shader_source = realloc(shader_source, strlen(shader_source) + strlen(line) + 1);
>> +                        strcat(shader_source, line);
> This isn't terribly efficient. (Both the strcat() after strlen(), and
> the realloc() strategy.) It probably doesn't really matter in
> practice, but we wouldn't want to set any bad examples.
> 

I guess you're proposing to instead use something like array_reserve(),
and e.g.

len = strlen(line);
...
memcpy(shader_source + source_len, line, len);

Both of which struck me as extra complexity for not much reason, but I
don't care too much...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200930/ec7898b5/attachment.sig>


More information about the wine-devel mailing list