[PATCH v2 8/8] d2d1: Implement LoadVertexShader().

Nikolay Sivov nsivov at codeweavers.com
Fri Apr 29 01:02:50 CDT 2022



On 4/28/22 13:40, Ziqing Hui wrote:
> +struct d2d_shader
> +{
> +    const GUID *id;
> +    void *shader;
> +};
This could at least use IUnknown, you can probably use a union later to 
avoid casts.

> +    effect_context->shader_count++;
> +    if (effect_context->shaders_size < effect_context->shader_count)
> +    {
> +        if (!d2d_array_reserve((void **)&effect_context->shaders, &effect_context->shaders_size,
> +                effect_context->shader_count, sizeof(*effect_context->shaders)))
> +        {
> +            ERR("Failed to resize shaders array.\n");
> +            ID3D11VertexShader_Release(vertex_shader);
> +            return E_OUTOFMEMORY;
> +        }
> +    }
You should call this to reserve "effect_context->shader_count + 1", no 
need to check size < count explicitly.

Since this is using GUIDs for keys, I suspect it should check for 
duplicates? IsShaderLoaded() takes just a GUID, so that implies all 
shader types are in the same list most likely.

By the way, have you figured out how shader objects are used later?



More information about the wine-devel mailing list