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

Ziqing Hui zhui at codeweavers.com
Fri Apr 29 01:50:22 CDT 2022



On 4/29/22 2:02 PM, Nikolay Sivov wrote:
> 
> 
> 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?
> 

Shader objects will be used in ID2D1DrawTransform to create custom transforms which have custom shaders.

ID2D1DrawTransfrom use ID2D1DrawInfo that has functions like SetPixelShader() which accept shader GUID as an input argument.
And that's where the loaded shader objects are used.




More information about the wine-devel mailing list