wined3d: Add support for GLSL based fixed function fragment shaders.

This commit is contained in:
Henri Verbeet 2012-11-11 18:52:38 +01:00 committed by Alexandre Julliard
parent 67886fed92
commit 10d46bc042
5 changed files with 1049 additions and 68 deletions

View File

@ -6528,20 +6528,6 @@ static void textransform(struct wined3d_context *context, const struct wined3d_s
fragment_prog_arbfp(context, state, state_id);
}
static void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_surface *rt = state->fb->render_targets[0];
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
if (state->render_states[WINED3D_RS_SRGBWRITEENABLE]
&& rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
}
static const struct StateEntryTemplate arbfp_fragmentstate_template[] =
{
{STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), { STATE_RENDER(WINED3D_RS_TEXTUREFACTOR), state_texfactor_arbfp }, WINED3D_GL_EXT_NONE },

View File

@ -2298,13 +2298,17 @@ static const struct fragment_pipeline *select_fragment_implementation(const stru
int vs_selected_mode, ps_selected_mode;
select_shader_mode(gl_info, &ps_selected_mode, &vs_selected_mode);
if ((ps_selected_mode == SHADER_ARB || ps_selected_mode == SHADER_GLSL)
&& gl_info->supported[ARB_FRAGMENT_PROGRAM]) return &arbfp_fragment_pipeline;
else if (ps_selected_mode == SHADER_ATI) return &atifs_fragment_pipeline;
else if (gl_info->supported[NV_REGISTER_COMBINERS]
&& gl_info->supported[NV_TEXTURE_SHADER2]) return &nvts_fragment_pipeline;
else if (gl_info->supported[NV_REGISTER_COMBINERS]) return &nvrc_fragment_pipeline;
else return &ffp_fragment_pipeline;
if (ps_selected_mode == SHADER_GLSL)
return &glsl_fragment_pipe;
if (ps_selected_mode == SHADER_ARB)
return &arbfp_fragment_pipeline;
if (ps_selected_mode == SHADER_ATI)
return &atifs_fragment_pipeline;
if (gl_info->supported[NV_REGISTER_COMBINERS] && gl_info->supported[NV_TEXTURE_SHADER2])
return &nvts_fragment_pipeline;
if (gl_info->supported[NV_REGISTER_COMBINERS])
return &nvrc_fragment_pipeline;
return &ffp_fragment_pipeline;
}
static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info)

File diff suppressed because it is too large Load Diff

View File

@ -4922,6 +4922,20 @@ static void psorigin(struct wined3d_context *context, const struct wined3d_state
}
}
void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_surface *rt = state->fb->render_targets[0];
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
if (state->render_states[WINED3D_RS_SRGBWRITEENABLE]
&& rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE)
gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB);
else
gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB);
}
const struct StateEntryTemplate misc_state_template[] = {
{ STATE_RENDER(WINED3D_RS_SRCBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_DESTBLEND), { STATE_RENDER(WINED3D_RS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },

View File

@ -1206,6 +1206,7 @@ extern const struct fragment_pipeline atifs_fragment_pipeline DECLSPEC_HIDDEN;
extern const struct fragment_pipeline arbfp_fragment_pipeline DECLSPEC_HIDDEN;
extern const struct fragment_pipeline nvts_fragment_pipeline DECLSPEC_HIDDEN;
extern const struct fragment_pipeline nvrc_fragment_pipeline DECLSPEC_HIDDEN;
extern const struct fragment_pipeline glsl_fragment_pipe DECLSPEC_HIDDEN;
/* "Base" state table */
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
@ -2545,6 +2546,8 @@ void state_fogstartend(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
void state_fog_fragpart(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
void state_srgbwrite(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
BOOL getColorBits(const struct wined3d_format *format,
BYTE *redSize, BYTE *greenSize, BYTE *blueSize, BYTE *alphaSize, BYTE *totalSize) DECLSPEC_HIDDEN;