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

Nikolay Sivov nsivov at codeweavers.com
Fri Apr 29 02:47:13 CDT 2022



On 4/29/22 09:50, Ziqing Hui wrote:
>
> 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.
>
I see, thanks. Maybe it is a good idea to have dummy custom effect in 
our tests to see how these methods work. Specifically calling with same 
(or null) GUID, and where you can reuse GUID across shader types (I 
suspect you can't).

Later for SetPixelShader() we'll see if it returns meaningful error code 
if you set e.g. compute shader to it, or only forwards d3d error. But 
anyway, IUnknown* should be good for now, instead of void*.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220429/dd903158/attachment.htm>


More information about the wine-devel mailing list