d3dx9: d3dx9_base_effect_get_pass_desc
Matteo Bruni
matteo.mystral at gmail.com
Mon Oct 31 10:29:16 CDT 2016
2016-10-29 21:11 GMT+02:00 Luis C. Busquets PĂ©rez <luis.busquets at ilidium.com>:
> Could anyone help improving this patch so that it makes it to the wine
> tree?
>
>
>> ---
>> dlls/d3dx9_36/effect.c | 46
>> ++++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 44 insertions(+), 2 deletions(-)
>>
>> diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
>> index 42f5aea..c69b73c 100644
>> --- a/dlls/d3dx9_36/effect.c
>> +++ b/dlls/d3dx9_36/effect.c
>> @@ -150,6 +150,7 @@ struct d3dx9_base_effect
>> UINT parameter_count;
>> UINT technique_count;
>> UINT object_count;
>> + BOOL clonable;
>>
>> struct d3dx_parameter *parameters;
>> struct d3dx_technique *techniques;
>> @@ -999,6 +1000,11 @@ static HRESULT
>> d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base,
>> D3DXHANDLE pass, D3DXPASS_DESC *desc)
>> {
>> struct d3dx_pass *p = get_valid_pass(base, pass);
>> + struct d3dx_state *s;
>> + struct d3dx_parameter *param;
>> + IDirect3DVertexShader9 *vshader;
>> + IDirect3DPixelShader9 *pshader;
>> + UINT i, size;
>>
>> if (!desc || !p)
>> {
>> @@ -1008,11 +1014,45 @@ static HRESULT
>> d3dx9_base_effect_get_pass_desc(struct d3dx9_base_effect *base,
>>
>> desc->Name = p->name;
>> desc->Annotations = p->annotation_count;
>> -
>> - FIXME("Pixel shader and vertex shader are not supported,
>> yet.\n");
>> desc->pVertexShaderFunction = NULL;
>> desc->pPixelShaderFunction = NULL;
>>
>> + if (base->clonable)
>> + {
>> + for (i=0; i < p->state_count; i++)
>> + {
>> + s = p->states + i;
>> + if (state_table[s->operation].class == SC_VERTEXSHADER)
>> + {
>> + param = &(s->parameter);
>> + vshader = *(struct IDirect3DVertexShader9 **)param-
>> >
>> > data;
>> + if (vshader)
>> + {
>> + IDirect3DVertexShader9_GetFunction(vshader,
>> NULL,
>> &size);
>> + if (desc->pVertexShaderFunction)
>> + free((void *)desc->pVertexShaderFunction);
>> + desc->pVertexShaderFunction = malloc(size);
>> + IDirect3DVertexShader9_GetFunction(vshader,
>> (void
>> *)(desc->pVertexShaderFunction), &size);
>> + }
>> + }
>> + if (state_table[s->operation].class == SC_PIXELSHADER)
>> + {
>> + param = &(s->parameter);
>> + pshader = *(struct IDirect3DPixelShader9 **)param-
>> >
>> > data;
>> + if (pshader)
>> + {
>> + IDirect3DPixelShader9_GetFunction(pshader, NULL,
>> &size);
>> + if (desc->pPixelShaderFunction)
>> + free((void *)desc->pPixelShaderFunction);
>> + desc->pPixelShaderFunction = malloc(size);
>> + IDirect3DPixelShader9_GetFunction(pshader, (void
>> *)(desc->pPixelShaderFunction), &size);
>> + }
>> + }
>> + }
>> + }
You probably want to take the shader code from the "objects" array instead.
Also that doesn't work for ST_ARRAY_SELECTOR vertex / pixel shader
states. It isn't even obvious what should be the returned value in
that case i.e. it needs tests.
I think Paul had a look at this at some point although I don't know if
there is any relevant patch attached to a bug or something.
More information about the wine-devel
mailing list