[PATCH 5/6] d3d9: Handle stateblocks in d3d9_device_SetVertexShader().
Zebediah Figura
z.figura12 at gmail.com
Fri Feb 22 16:49:49 CST 2019
On 02/22/2019 03:55 PM, Józef Kucia wrote:
> On Fri, Feb 22, 2019 at 7:00 PM Zebediah Figura <z.figura12 at gmail.com> wrote:
>>
>> On 02/22/2019 02:07 AM, Józef Kucia wrote:
>>> On Fri, Feb 22, 2019 at 2:02 AM Zebediah Figura <z.figura12 at gmail.com> wrote:
>>>>
>>>> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
>>>> ---
>>>> dlls/d3d9/d3d9_private.h | 1 +
>>>> dlls/d3d9/device.c | 19 ++++-
>>>> dlls/wined3d/device.c | 6 ++
>>>> dlls/wined3d/wined3d.spec | 1 +
>>>> dlls/wined3d/wined3d_private.h | 128 --------------------------------
>>>> include/wine/wined3d.h | 130 +++++++++++++++++++++++++++++++++
>>>> 6 files changed, 155 insertions(+), 130 deletions(-)
>>>
>>> I don't like the idea of exposing the internal structure of
>>> stateblocks in public wined3d API, and open-coding state updates in
>>> all client libraries. I think it would be preferred to keep helpers
>>> for state updates in wined3d. The main idea was to move stateblocks
>>> out of wined3d core, but it should be still possible to keep
>>> stateblock helpers for client libraries.
>>>
>>
>> Thanks. So to clarify, we want to add a series of methods like this?
>>
>> void wined3d_stateblock_set_vertex_shader(struct wined3d_stateblock
>> *stateblock, struct wined3d_shader *shader);
>
> Methods like this might be fine, initially. In the long term, we need
> something more. We need methods for translating legacy states (e.g.
> some render states) into state objects (blend state objects,
> rasterizer state objects, ...).
>
Right. As long as we're here, can we clarify what we want the end goal
for this architecture to look like? I think I've been misunderstanding
somewhat. E.g. what should the body of d3d9_device_SetRenderState()
resemble? I was originally picturing something like this:
static HRESULT WINAPI DECLSPEC_HOTPATCH
d3d9_device_SetRenderState(IDirect3DDevice9Ex *iface,
D3DRENDERSTATETYPE state, DWORD value)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct wined3d_rasterizer_state *rasterizer_state;
struct wined3d_color factor;
TRACE("iface %p, state %#x, value %#x.\n", iface, state, value);
if (state > WINED3D_HIGHEST_RENDER_STATE)
{
ERR("Invalid render state %#x.\n", state);
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
device->update_state->rs[state] = value;
if (device->recording)
{
device->recording->changed.renderState[state >> 5] |= 1u <<
(state & 0x1f);
wined3d_mutex_unlock();
return D3D_OK;
}
switch (state)
{
case D3DRS_FILLMODE:
case D3DRS_CULLMODE:
case D3DRS_DEPTHBIAS:
case D3DRS_SLOPESCALEDEPTHBIAS:
case D3DRS_SCISSORTESTENABLE:
case D3DRS_MULTISAMPLEANTIALIAS:
case D3DRS_ANTIALIASEDLINEENABLE:
if (FAILED(hr =
d3d9_rasterizer_state_from_render_state(device->state.rs,
&rasterizer_state)))
{
wined3d_mutex_unlock();
return hr;
}
wined3d_rasterizer_state_decref(device->rasterizer_state);
device->rasterizer_state = rasterizer_state;
wined3d_device_set_rasterizer_state(device->wined3d_device,
rasterizer_state);
break;
case D3DRS_SRCBLEND:
case D3DRS_DESTBLEND:
case D3DRS_BLENDOP:
case D3DRS_SRCBLENDALPHA:
case D3DRS_DESTBLENDALPHA:
case D3DRS_BLENDOPALPHA:
case D3DRS_COLORWRITEENABLE:
case D3DRS_COLORWRITEENABLE1:
case D3DRS_COLORWRITEENABLE2:
case D3DRS_COLORWRITEENABLE3:
/* sim. */
case D3DRS_BLENDFACTOR:
wined3d_color_from_d3dcolor(&factor, value);
wined3d_device_set_blend_state(device->wined3d_device, NULL,
&factor);
default:
wined3d_device_set_render_State(device->wined3d_device, state,
value);
}
wined3d_mutex_unlock();
return D3D_OK;
}
but this seems to not quite be what you want; can you please help clarify?
More information about the wine-devel
mailing list