winedd: Move shader_*_add_instruction_modifiers into the shader backend.

This commit is contained in:
Stefan Dösinger 2009-05-03 18:17:07 +02:00 committed by Alexandre Julliard
parent 31f5b01f9a
commit 2fd485ae31
6 changed files with 11 additions and 15 deletions

View File

@ -2247,6 +2247,10 @@ static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup)
return FALSE;
}
static void shader_arb_add_instruction_modifiers(const struct wined3d_shader_instruction *ins) {
/* Nothing to do for now */
}
static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABLE_SIZE] =
{
/* WINED3DSIH_ABS */ shader_hw_map2gl,
@ -2351,6 +2355,7 @@ const shader_backend_t arb_program_shader_backend = {
shader_arb_generate_vshader,
shader_arb_get_caps,
shader_arb_color_fixup_supported,
shader_arb_add_instruction_modifiers,
};
/* ARB_fragment_program fixed function pipeline replacement definitions */

View File

@ -1028,9 +1028,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER *buffer,
hw_fct(&ins);
/* Process instruction modifiers for GLSL apps ( _sat, etc. ) */
/* FIXME: This should be internal to the shader backend.
* Also, right now this is the only reason "shader_mode" exists. */
if (This->baseShader.shader_mode == SHADER_GLSL) shader_glsl_add_instruction_modifiers(&ins);
device->shader_backend->shader_add_instruction_modifiers(&ins);
}
}
@ -1252,6 +1250,7 @@ static GLuint shader_none_generate_vshader(IWineD3DVertexShader *iface,
FIXME("NONE shader backend asked to generate a vertex shader\n");
return 0;
}
static void shader_none_add_instruction_modifiers(const struct wined3d_shader_instruction *ins) {}
#define GLINFO_LOCATION (*gl_info)
static void shader_none_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
@ -1298,4 +1297,5 @@ const shader_backend_t none_shader_backend = {
shader_none_generate_vshader,
shader_none_get_caps,
shader_none_color_fixup_supported,
shader_none_add_instruction_modifiers,
};

View File

@ -1363,7 +1363,7 @@ static DWORD shader_glsl_append_dst(SHADER_BUFFER *buffer, const struct wined3d_
}
/** Process GLSL instruction modifiers */
void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins)
static void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins)
{
glsl_dst_param_t dst_param;
DWORD modifiers;
@ -4401,4 +4401,5 @@ const shader_backend_t glsl_shader_backend = {
shader_glsl_generate_vshader,
shader_glsl_get_caps,
shader_glsl_color_fixup_supported,
shader_glsl_add_instruction_modifiers,
};

View File

@ -207,7 +207,6 @@ static void pshader_set_limits(IWineD3DPixelShaderImpl *This)
static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, CONST DWORD *pFunction) {
IWineD3DPixelShaderImpl *This =(IWineD3DPixelShaderImpl *)iface;
IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *) This->baseShader.device;
unsigned int i, highest_reg_used = 0, num_regs_used = 0;
shader_reg_maps *reg_maps = &This->baseShader.reg_maps;
const struct wined3d_shader_frontend *fe;
@ -285,8 +284,6 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
This->baseShader.load_local_constsF = FALSE;
This->baseShader.shader_mode = deviceImpl->ps_selected_mode;
TRACE("(%p) : Copying the function\n", This);
This->baseShader.function = HeapAlloc(GetProcessHeap(), 0, This->baseShader.functionLength);

View File

@ -285,8 +285,6 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
vshader_set_limits(This);
This->baseShader.shader_mode = deviceImpl->vs_selected_mode;
if(deviceImpl->vs_selected_mode == SHADER_ARB &&
(GLINFO_LOCATION).arb_vs_offset_limit &&
This->min_rel_offset <= This->max_rel_offset) {

View File

@ -807,6 +807,7 @@ typedef struct {
SHADER_BUFFER *buffer, const struct vs_compile_args *args);
void (*shader_get_caps)(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *caps);
BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup);
void (*shader_add_instruction_modifiers)(const struct wined3d_shader_instruction *ins);
} shader_backend_t;
extern const shader_backend_t glsl_shader_backend;
@ -2525,9 +2526,6 @@ extern BOOL vshader_get_input(
extern HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object);
/* GLSL helper functions */
extern void shader_glsl_add_instruction_modifiers(const struct wined3d_shader_instruction *ins);
/*****************************************************************************
* IDirect3DBaseShader implementation structure
*/
@ -2543,9 +2541,6 @@ typedef struct IWineD3DBaseShaderClass
const struct wined3d_shader_frontend *frontend;
void *frontend_data;
/* Type of shader backend */
int shader_mode;
/* Programs this shader is linked with */
struct list linked_programs;