37#define ATIFS_CONST_BUMPMAT(i) (GL_CON_0_ATI + i)
38#define ATIFS_CONST_STAGE(i) (GL_CON_0_ATI + i)
39#define ATIFS_CONST_TFACTOR GL_CON_6_ATI
78 default:
return "Unexpected modifier\n";
88 return "GL_2X_BIT_ATI";
90 return "GL_COMP_BIT_ATI";
92 return "GL_NEGATE_BIT_ATI";
94 return "GL_BIAS_BIT_ATI";
97 return "GL_2X_BIT_ATI | GL_COMP_BIT_ATI";
99 return "GL_2X_BIT_ATI | GL_NEGATE_BIT_ATI";
101 return "GL_2X_BIT_ATI | GL_BIAS_BIT_ATI";
103 return "GL_COMP_BIT_ATI | GL_NEGATE_BIT_ATI";
105 return "GL_COMP_BIT_ATI | GL_BIAS_BIT_ATI";
107 return "GL_NEGATE_BIT_ATI | GL_BIAS_BIT_ATI";
110 return "GL_COMP_BIT_ATI | GL_NEGATE_BIT_ATI | GL_BIAS_BIT_ATI";
112 return "GL_2X_BIT_ATI | GL_NEGATE_BIT_ATI | GL_BIAS_BIT_ATI";
114 return "GL_2X_BIT_ATI | GL_COMP_BIT_ATI | GL_BIAS_BIT_ATI";
116 return "GL_2X_BIT_ATI | GL_COMP_BIT_ATI | GL_NEGATE_BIT_ATI";
119 return "GL_2X_BIT_ATI | GL_COMP_BIT_ATI | GL_NEGATE_BIT_ATI | GL_BIAS_BIT_ATI";
122 return "Unexpected argmod combination\n";
143 case GL_ZERO:
return "GL_ZERO";
144 case GL_ONE:
return "GL_ONE";
148 default:
return "Unknown register\n";
158 default:
return "unknown swizzle";
164 case GL_NONE:
return "GL_NONE";
165 case GL_RED:
return "GL_RED";
167 case GL_BLUE:
return "GL_BLUE";
169 default:
return "unknown argrep";
186 default:
return "unexpected op";
192 case GL_NONE:
return "GL_NONE";
200 default:
return "Unexpected writemask";
223 TRACE(
"glAlphaFragmentOp2ATI(%s, %s, %s, %s, %s, %s, %s, %s, %s)\n",
debug_op(
op),
debug_register(
dst),
debug_dstmod(
dstMod),
228 TRACE(
"glColorFragmentOp2ATI(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n",
debug_op(
op),
debug_register(
dst),
242 TRACE(
"glAlphaFragmentOp3ATI(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n",
debug_op(
op),
debug_register(
dst),
debug_dstmod(
dstMod),
251 TRACE(
"glColorFragmentOp3ATI(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n",
debug_op(
op),
debug_register(
dst),
310 FIXME(
"Unknown source argument %d\n",
arg);
327 int lowest_read = -1;
328 int lowest_write = -1;
332 memset(tex_used, 0,
sizeof(tex_used));
338 if(lowest_read == -1 &&
355 if(lowest_read == -1)
return GL_NONE;
357 if(lowest_write >= lowest_read) {
358 FIXME(
"Temp register read before being written\n");
361 if(lowest_write == -1) {
363 FIXME(
"Temp register read without being written\n");
365 }
else if(lowest_write >= 1) {
375 for(
i = 1;
i < 6;
i++) {
381 FIXME(
"Could not find a register for the temporary register\n");
445 ERR(
"Unsupported color fixup.\n");
477 GLuint dstmod, argmod0, argmod1, argmod2, argmodextra;
485 ERR(
"Failed to generate a GL_ATI_fragment_shader shader id\n");
489 checkGLcall(
"GL_EXTCALL(glBindFragmentShaderATI(ret))");
491 TRACE(
"glBeginFragmentShaderATI()\n");
493 checkGLcall(
"GL_EXTCALL(glBeginFragmentShaderATI())");
496 for (stage = 0; stage < gl_info->
limits.textures; ++stage)
506 TRACE(
"glSampleMapATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, GL_SWIZZLE_STR_ATI)\n",
518 TRACE(
"glPassTexCoordATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, %s)\n",
526 for (stage = 0; stage < gl_info->
limits.textures; ++stage)
528 GLuint argmodextra_x, argmodextra_y;
537 fixup =
op[stage].color_fixup;
540 FIXME(
"Swizzles not implemented\n");
577 for (stage = 0; stage < gl_info->
limits.textures; ++stage)
596 TRACE(
"glSampleMapATI(GL_REG_%d_ATI, GL_REG_%d_ATI, GL_SWIZZLE_STR_ATI)\n",
602 TRACE(
"glSampleMapATI(GL_REG_%d_ATI, GL_TEXTURE_%d_ARB, %s)\n",
631 if(tmparg ==
GL_NONE)
continue;
657 FIXME(
"Constant %u already used.\n", stage);
664 switch (
op[stage].cop)
673 arg1, rep1, argmod1);
686 arg2, rep2, argmod2);
699 arg2, rep2, argmodextra | argmod2);
706 arg2, rep2, argmod2);
716 arg1, rep1, argmodextra,
717 arg1, rep1, argmod1);
738 arg2, rep2, argmod2);
746 arg1, rep1, argmod1);
756 argmodextra = argmod1;
760 arg1, rep1, argmod1);
768 argmodextra = argmod1;
771 arg1, rep1, argmodextra,
785 arg0, rep0, argmod0);
792 arg2, rep2, argmod2);
795 default:
FIXME(
"Unhandled color operation %d on stage %d\n",
op[stage].cop, stage);
805 switch (
op[stage].aop)
928 ERR(
"Application uses an invalid alpha operation\n");
931 default:
FIXME(
"Unhandled alpha operation %d on stage %d\n",
op[stage].aop, stage);
936 FIXME(
"Texture factor constant already used.\n");
946 TRACE(
"glEndFragmentShaderATI()\n");
948 checkGLcall(
"GL_EXTCALL(glEndFragmentShaderATI())");
964 checkGLcall(
"glSetFragmentShaderConstantATI(ATIFS_CONST_TFACTOR, &color.r)");
988 mat[0][0] = (
mat[0][0] + 1.0f) * 0.5f;
989 mat[1][0] = (
mat[1][0] + 1.0f) * 0.5f;
990 mat[0][1] = (
mat[0][1] + 1.0f) * 0.5f;
991 mat[1][1] = (
mat[1][1] + 1.0f) * 0.5f;
993 checkGLcall(
"glSetFragmentShaderConstantATI(ATIFS_CONST_BUMPMAT(stage), mat)");
1009 checkGLcall(
"glSetFragmentShaderConstantATI(ATIFS_CONST_STAGE(stage), &color.r)");
1030 if (!(new_desc = heap_alloc_zero(
sizeof(*new_desc))))
1032 ERR(
"Out of memory\n");
1036 for (
i = 0;
i < d3d_info->
limits.ffp_blend_stages; ++
i)
1046 TRACE(
"Allocated fixed function replacement shader descriptor %p.\n", new_desc);
1053 for (
i = 0;
i <
desc->num_textures_used; ++
i)
1055 mapped_stage =
context->tex_unit_map[
i];
1071 switch (
desc->constants[
i])
1086 ERR(
"Unexpected constant type %u.\n",
desc->constants[
i]);
1100 WARN(
"sRGB writes are not supported by this fragment pipe.\n");
1324 if (!(priv = heap_alloc_zero(
sizeof(*priv))))
1338 checkGLcall(
"glDeleteFragmentShaderATI(entry->shader)");
1364 if (!(priv = heap_alloc_zero(
sizeof(*priv))))
1366 context->fragment_pipe_data = priv;
std::map< E_MODULE, HMODULE > mod
struct mke2fs_defaults settings[]
static BOOL heap_free(void *mem)
static void atifs_tfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static DWORD atifs_get_emul_mask(const struct wined3d_gl_info *gl_info)
static void set_tex_op_atifs(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static BOOL op_reads_constant(const struct texture_stage_op *op)
static const char * debug_register(GLuint reg)
#define ATIFS_CONST_STAGE(i)
static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
static const char * debug_rep(GLuint rep)
static BOOL atifs_color_fixup_supported(struct color_fixup_desc fixup)
static void wrap_op3(const struct wined3d_gl_info *gl_info, GLuint op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod)
static const struct StateEntryTemplate atifs_fragmentstate_template[]
#define ATIFS_CONST_TFACTOR
static void set_bumpmat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *cb_ctx)
static void wrap_op2(const struct wined3d_gl_info *gl_info, GLuint op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod)
static const char * debug_op(GLuint op)
static BOOL op_reads_texture(const struct texture_stage_op *op)
static void atifs_color_fixup(const struct wined3d_gl_info *gl_info, struct color_fixup_desc fixup, GLuint reg)
static const struct color_fixup_desc color_fixup_rgl
static BOOL op_reads_tfactor(const struct texture_stage_op *op)
static BOOL atifs_alloc_context_data(struct wined3d_context *context)
static void textransform(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static GLuint find_tmpreg(const struct texture_stage_op op[MAX_TEXTURES])
static const struct color_fixup_desc color_fixup_rg
static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps)
static const char * debug_argmod(GLuint mod)
static const struct color_fixup_desc color_fixup_rgba
static void atifs_stage_constant(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static void * atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv)
static void atifs_srgbwriteenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static GLuint register_for_arg(DWORD arg, const struct wined3d_gl_info *gl_info, unsigned int stage, GLuint *mod, GLuint *rep, GLuint tmparg)
#define ATIFS_CONST_BUMPMAT(i)
static const char * debug_swizzle(GLuint swizzle)
static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], const struct wined3d_gl_info *gl_info, enum atifs_constant_value *constants)
static const char * debug_dstmod(GLuint mod)
const struct fragment_pipeline atifs_fragment_pipeline
static void wrap_op1(const struct wined3d_gl_info *gl_info, GLuint op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod)
static const char * debug_mask(GLuint mask)
static void atifs_free_context_data(struct wined3d_context *context)
static void atifs_free(struct wined3d_device *device)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit)
void state_nop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void state_fogstartend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void state_fogcolor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void state_alpha_test(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void state_fogdensity(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void state_shademode(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
const struct ffp_frag_desc * find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders, const struct ffp_frag_settings *settings)
int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_entry *entry)
void sampler_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc)
void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d_state *state, struct ffp_frag_settings *settings, BOOL ignore_textype)
#define WINE_DECLARE_DEBUG_CHANNEL(x)
GLuint GLuint GLuint GLuint GLuint GLuint arg1Mod
#define GL_QUARTER_BIT_ATI
#define GL_SWIZZLE_STR_DR_ATI
GLuint GLuint GLuint GLuint GLuint arg1Rep
#define GL_SWIZZLE_STQ_ATI
#define GL_SWIZZLE_STQ_DQ_ATI
#define GL_SWIZZLE_STR_ATI
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
#define GL_NEGATE_BIT_ATI
#define GL_SECONDARY_INTERPOLATOR_ATI
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3Mod
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2Mod
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2Rep
#define GL_EIGHTH_BIT_ATI
#define GL_FRAGMENT_SHADER_ATI
#define GL_SATURATE_BIT_ATI
GLuint GLuint GLuint dstMod
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3Rep
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static const WCHAR desc[]
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
#define WINE_RB_ENTRY_VALUE(element, type, field)
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
const struct atifs_ffp_desc * last_shader
unsigned int num_textures_used
struct ffp_frag_desc parent
enum atifs_constant_value constants[MAX_TEXTURES]
struct wine_rb_tree fragment_shaders
unsigned short y_sign_fixup
unsigned short x_sign_fixup
DWORD MaxSimultaneousTextures
DWORD MaxTextureBlendStages
struct wined3d_d3d_limits limits
struct opengl_funcs gl_ops
struct wined3d_gl_limits limits
#define WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR
#define WINED3DTEXOPCAPS_ADD
#define WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA
#define WINED3DTA_SPECULAR
#define WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA
#define WINED3DTA_COMPLEMENT
#define WINED3DPMISCCAPS_PERSTAGECONSTANT
@ WINED3D_RS_TEXTUREFACTOR
@ WINED3D_RS_COLORKEYENABLE
@ WINED3D_RS_SRGBWRITEENABLE
@ WINED3D_RS_FOGTABLEMODE
@ WINED3D_RS_FOGVERTEXMODE
@ WINED3D_RS_ALPHATESTENABLE
#define WINED3DTEXOPCAPS_BLENDTEXTUREALPHA
#define WINED3DTEXOPCAPS_MODULATE2X
#define WINED3DTA_SELECTMASK
#define WINED3DTEXOPCAPS_DISABLE
#define WINED3DTEXOPCAPS_SELECTARG1
#define WINED3DTA_TFACTOR
#define WINED3DTEXOPCAPS_SUBTRACT
@ WINED3D_TSS_BUMPENV_MAT11
@ WINED3D_TSS_BUMPENV_MAT10
@ WINED3D_TSS_BUMPENV_MAT01
@ WINED3D_TSS_BUMPENV_MAT00
@ WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS
#define WINED3DTEXOPCAPS_BUMPENVMAP
#define WINED3DTA_CURRENT
#define WINED3DTEXOPCAPS_ADDSIGNED2X
#define WINED3DTEXOPCAPS_MODULATE4X
@ WINED3D_TOP_SELECT_ARG1
@ WINED3D_TOP_BLEND_DIFFUSE_ALPHA
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA_PM
@ WINED3D_TOP_BLEND_CURRENT_ALPHA
@ WINED3D_TOP_ADD_SIGNED_2X
@ WINED3D_TOP_MODULATE_INVCOLOR_ADD_ALPHA
@ WINED3D_TOP_MULTIPLY_ADD
@ WINED3D_TOP_MODULATE_INVALPHA_ADD_COLOR
@ WINED3D_TOP_BUMPENVMAP_LUMINANCE
@ WINED3D_TOP_MODULATE_COLOR_ADD_ALPHA
@ WINED3D_TOP_MODULATE_4X
@ WINED3D_TOP_SELECT_ARG2
@ WINED3D_TOP_MODULATE_ALPHA_ADD_COLOR
@ WINED3D_TOP_BLEND_TEXTURE_ALPHA
@ WINED3D_TOP_DOTPRODUCT3
@ WINED3D_TOP_MODULATE_2X
@ WINED3D_TOP_BLEND_FACTOR_ALPHA
#define WINED3DTEXOPCAPS_ADDSMOOTH
#define WINED3DTA_ALPHAREPLICATE
#define WINED3DPMISCCAPS_TSSARGTEMP
#define WINED3DTEXOPCAPS_MULTIPLYADD
#define WINED3D_HIGHEST_TEXTURE_STATE
#define WINED3DTEXOPCAPS_BLENDFACTORALPHA
#define WINED3DTA_DIFFUSE
#define WINED3DTEXOPCAPS_ADDSIGNED
#define WINED3DTEXOPCAPS_DOTPRODUCT3
#define WINED3DTA_CONSTANT
#define WINED3DTEXOPCAPS_LERP
#define WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM
#define WINED3DTEXOPCAPS_SELECTARG2
#define WINED3DTEXOPCAPS_MODULATE
#define WINED3DTA_TEXTURE
#define WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA
#define WINED3DTEXOPCAPS_BLENDCURRENTALPHA
#define WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR
static BOOL is_same_fixup(struct color_fixup_desc f1, struct color_fixup_desc f2)
#define GL_EXT_EMUL_EXT_FOG_COORD
#define GL_EXT_EMUL_ARB_MULTITEXTURE
#define STATE_SAMPLER(num)
static void wined3d_color_from_d3dcolor(struct wined3d_color *wined3d_color, DWORD d3d_color)
static BOOL is_identity_fixup(struct color_fixup_desc fixup)
#define WINED3D_FRAGMENT_CAP_PROJ_CONTROL
@ WINED3D_SHADER_TYPE_PIXEL
#define STATE_TEXTURESTAGE(stage, num)
static BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
#define WINED3D_UNMAPPED_STAGE