wined3d: Move set_tex_op(_nvrc) to their specific files.
This commit is contained in:
parent
212ff6ff57
commit
eea2c95727
|
@ -65,6 +65,391 @@ void nvts_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, W
|
|||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GLenum input[3];
|
||||
GLenum mapping[3];
|
||||
GLenum component_usage[3];
|
||||
} tex_op_args;
|
||||
|
||||
static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx) {
|
||||
switch (d3dta) {
|
||||
case WINED3DTA_DIFFUSE:
|
||||
return GL_PRIMARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_CURRENT:
|
||||
if (stage) return GL_SPARE0_NV;
|
||||
else return GL_PRIMARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_TEXTURE:
|
||||
if (texture_idx > -1) return GL_TEXTURE0_ARB + texture_idx;
|
||||
else return GL_PRIMARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_TFACTOR:
|
||||
return GL_CONSTANT_COLOR0_NV;
|
||||
|
||||
case WINED3DTA_SPECULAR:
|
||||
return GL_SECONDARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_TEMP:
|
||||
return GL_SPARE1_NV;
|
||||
|
||||
case WINED3DTA_CONSTANT:
|
||||
/* TODO: Support per stage constants (WINED3DTSS_CONSTANT, NV_register_combiners2) */
|
||||
FIXME("WINED3DTA_CONSTANT, not properly supported.\n");
|
||||
return GL_CONSTANT_COLOR1_NV;
|
||||
|
||||
default:
|
||||
FIXME("Unrecognized texture arg %#x\n", d3dta);
|
||||
return GL_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum invert_mapping(GLenum mapping) {
|
||||
if (mapping == GL_UNSIGNED_INVERT_NV) return GL_SIGNED_IDENTITY_NV;
|
||||
else if (mapping == GL_SIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
|
||||
|
||||
FIXME("Unhandled mapping %#x\n", mapping);
|
||||
return mapping;
|
||||
}
|
||||
|
||||
static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
|
||||
/* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
|
||||
* be used. */
|
||||
if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
|
||||
else *mapping = GL_SIGNED_IDENTITY_NV;
|
||||
|
||||
/* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
|
||||
* should be used for all input components. */
|
||||
if (is_alpha || arg & WINED3DTA_ALPHAREPLICATE) *component_usage = GL_ALPHA;
|
||||
else *component_usage = GL_RGB;
|
||||
|
||||
*input = d3dta_to_combiner_input(arg & WINED3DTA_SELECTMASK, stage, texture_idx);
|
||||
}
|
||||
|
||||
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl*)iface;
|
||||
tex_op_args tex_op_args = {{0}, {0}, {0}};
|
||||
GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
|
||||
GLenum target = GL_COMBINER0_NV + stage;
|
||||
GLenum output;
|
||||
IWineD3DStateBlockImpl *stateblock = This->stateBlock; /* For GLINFO_LOCATION */
|
||||
|
||||
TRACE("stage %d, is_alpha %d, op %s, arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
|
||||
stage, is_alpha, debug_d3dtop(op), arg1, arg2, arg3, texture_idx);
|
||||
|
||||
/* If a texture stage references an invalid texture unit the stage just
|
||||
* passes through the result from the previous stage */
|
||||
if (is_invalid_op(This, stage, op, arg1, arg2, arg3)) {
|
||||
arg1 = WINED3DTA_CURRENT;
|
||||
op = WINED3DTOP_SELECTARG1;
|
||||
}
|
||||
|
||||
get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
|
||||
&tex_op_args.mapping[0], &tex_op_args.component_usage[0], texture_idx);
|
||||
get_src_and_opr_nvrc(stage, arg2, is_alpha, &tex_op_args.input[1],
|
||||
&tex_op_args.mapping[1], &tex_op_args.component_usage[1], texture_idx);
|
||||
get_src_and_opr_nvrc(stage, arg3, is_alpha, &tex_op_args.input[2],
|
||||
&tex_op_args.mapping[2], &tex_op_args.component_usage[2], texture_idx);
|
||||
|
||||
|
||||
if(dst == WINED3DTA_TEMP) {
|
||||
output = GL_SPARE1_NV;
|
||||
} else {
|
||||
output = GL_SPARE0_NV;
|
||||
}
|
||||
|
||||
/* This is called by a state handler which has the gl lock held and a context for the thread */
|
||||
switch(op)
|
||||
{
|
||||
case WINED3DTOP_DISABLE:
|
||||
/* Only for alpha */
|
||||
if (!is_alpha) ERR("Shouldn't be called for WINED3DTSS_COLOROP (WINED3DTOP_DISABLE)\n");
|
||||
/* Input, prev_alpha*1 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_SELECTARG1:
|
||||
case WINED3DTOP_SELECTARG2:
|
||||
/* Input, arg*1 */
|
||||
if (op == WINED3DTOP_SELECTARG1) {
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
} else {
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
}
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATE:
|
||||
case WINED3DTOP_MODULATE2X:
|
||||
case WINED3DTOP_MODULATE4X:
|
||||
/* Input, arg1*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
if (op == WINED3DTOP_MODULATE) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_MODULATE2X) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_MODULATE4X) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DTOP_ADD:
|
||||
case WINED3DTOP_ADDSIGNED:
|
||||
case WINED3DTOP_ADDSIGNED2X:
|
||||
/* Input, arg1*1+arg2*1 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
if (op == WINED3DTOP_ADD) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_ADDSIGNED) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_ADDSIGNED2X) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DTOP_SUBTRACT:
|
||||
/* Input, arg1*1+-arg2*1 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[1], GL_SIGNED_NEGATE_NV, tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_ADDSMOOTH:
|
||||
/* Input, arg1*1+(1-arg1)*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_BLENDDIFFUSEALPHA:
|
||||
case WINED3DTOP_BLENDTEXTUREALPHA:
|
||||
case WINED3DTOP_BLENDFACTORALPHA:
|
||||
case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
||||
case WINED3DTOP_BLENDCURRENTALPHA:
|
||||
{
|
||||
GLenum alpha_src = GL_PRIMARY_COLOR_NV;
|
||||
if (op == WINED3DTOP_BLENDDIFFUSEALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDTEXTUREALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDFACTORALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDTEXTUREALPHAPM) alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDCURRENTALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
|
||||
else FIXME("Unhandled WINED3DTOP %s, shouldn't happen\n", debug_d3dtop(op));
|
||||
|
||||
/* Input, arg1*alpha_src+arg2*(1-alpha_src) */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
if (op == WINED3DTOP_BLENDTEXTUREALPHAPM)
|
||||
{
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
} else {
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
alpha_src, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
|
||||
}
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
alpha_src, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
}
|
||||
|
||||
case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
||||
/* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATEALPHA_ADDCOLOR)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
||||
/* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATECOLOR_ADDALPHA)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
||||
/* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
||||
/* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_DOTPRODUCT3:
|
||||
/* Input, arg1 . arg2 */
|
||||
/* FIXME: DX7 uses a different calculation? */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MULTIPLYADD:
|
||||
/* Input, arg3*1+arg1*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_LERP:
|
||||
/* Input, arg3*arg1+(1-arg3)*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[2], invert_mapping(tex_op_args.mapping[2]), tex_op_args.component_usage[2]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_BUMPENVMAPLUMINANCE:
|
||||
case WINED3DTOP_BUMPENVMAP:
|
||||
if(GL_SUPPORT(NV_TEXTURE_SHADER)) {
|
||||
/* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
|
||||
* perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
|
||||
* ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
|
||||
* (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the next stage
|
||||
*/
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
/* Always pass through to CURRENT, ignore temp arg */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
FIXME("Unhandled WINED3DTOP: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
|
||||
stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
|
||||
}
|
||||
|
||||
checkGLcall("set_tex_op_nvrc()\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
||||
|
|
1109
dlls/wined3d/state.c
1109
dlls/wined3d/state.c
File diff suppressed because it is too large
Load Diff
1496
dlls/wined3d/utils.c
1496
dlls/wined3d/utils.c
File diff suppressed because it is too large
Load Diff
|
@ -1730,11 +1730,12 @@ const char *debug_fbostatus(GLenum status);
|
|||
const char *debug_glerror(GLenum error);
|
||||
const char *debug_d3dbasis(WINED3DBASISTYPE basis);
|
||||
const char *debug_d3ddegree(WINED3DDEGREETYPE order);
|
||||
const char* debug_d3dtop(WINED3DTEXTUREOP d3dtop);
|
||||
|
||||
/* Routines for GL <-> D3D values */
|
||||
GLenum StencilOp(DWORD op);
|
||||
GLenum CompareFunc(DWORD func);
|
||||
void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
|
||||
BOOL is_invalid_op(IWineD3DDeviceImpl *This, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
|
||||
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst);
|
||||
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, DWORD coordtype);
|
||||
void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
|
||||
|
|
Loading…
Reference in New Issue