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.
This commit is contained in:
Stefan Dösinger 2008-07-04 15:01:26 -05:00 committed by Alexandre Julliard
parent bdfaab5a94
commit c15dfb87e9
4 changed files with 28 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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++);

View File

@ -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[];