Commit c15dfb87 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Create fragment processing state templates and select one.

For now the atifs selection sticks to the old rules, thus it is bound to the available and selected shader capabilities. We may want to change that in the future.
parent bdfaab5a
......@@ -893,6 +893,10 @@ static void init_state_table() {
ATIFSStateTable[STATE_RENDER(WINED3DRS_TEXTUREFACTOR)].representative = STATE_RENDER(WINED3DRS_TEXTUREFACTOR);
}
const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }},
};
/* GL_ATI_fragment_shader backend.It borrows a lot from a the
* ARB shader backend, currently the whole vertex processing
* code. This code would also forward pixel shaders, but if
......
......@@ -2890,6 +2890,20 @@ static const shader_backend_t *select_shader_backend(UINT Adapter, WINED3DDEVTYP
return ret;
}
static const struct StateEntryTemplate *select_fragment_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType) {
int vs_selected_mode;
int ps_selected_mode;
select_shader_mode(&GLINFO_LOCATION, DeviceType, &ps_selected_mode, &vs_selected_mode);
if (ps_selected_mode == SHADER_GLSL || ps_selected_mode == SHADER_ARB) {
return ffp_fragmentstate_template;
} else if (ps_selected_mode != SHADER_NONE && !GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {
return atifs_fragmentstate_template;
} else {
return ffp_fragmentstate_template;
}
}
/* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true
subset of a D3DCAPS9 structure. However, it has to come via a void *
as the d3d8 interface cannot import the d3d9 header */
......@@ -3393,6 +3407,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
IWineD3DDeviceImpl *object = NULL;
IWineD3DImpl *This = (IWineD3DImpl *)iface;
WINED3DDISPLAYMODE mode;
const struct StateEntryTemplate *frag_pipeline = NULL;
int i;
/* Validate the adapter number. If no adapters are available(no GL), ignore the adapter
......@@ -3446,8 +3461,10 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
select_shader_mode(&GLINFO_LOCATION, DeviceType, &object->ps_selected_mode, &object->vs_selected_mode);
object->shader_backend = select_shader_backend(Adapter, DeviceType);
frag_pipeline = select_fragment_implementation(Adapter, DeviceType);
compile_state_table(object->StateTable, object->multistate_funcs,
ffp_vertexstate_template, NULL, misc_state_template,
ffp_vertexstate_template, frag_pipeline, misc_state_template,
object->shader_backend->StateTable_remove);
/* Prefer the vtable with functions optimized for single dirtifyable objects if the shader
......
......@@ -5246,6 +5246,10 @@ const struct StateEntryTemplate ffp_vertexstate_template[] = {
{0 /* Terminate */, { 0, 0 }},
};
const struct StateEntryTemplate ffp_fragmentstate_template[] = {
{0 /* Terminate */, { 0, 0 }},
};
static int num_handlers(APPLYSTATEFUNC *funcs) {
unsigned int i;
for(i = 0; funcs[i]; i++);
......
......@@ -595,6 +595,8 @@ struct StateEntryTemplate
extern const struct StateEntryTemplate misc_state_template[];
extern const struct StateEntryTemplate ffp_vertexstate_template[];
extern const struct StateEntryTemplate ffp_fragmentstate_template[];
extern const struct StateEntryTemplate atifs_fragmentstate_template[];
/* "Base" state table */
extern const struct StateEntry FFPStateTable[];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment