wined3d: Add sincos support to arb shaders.
This commit is contained in:
parent
daf2290ea4
commit
20872abc9c
|
@ -1499,6 +1499,30 @@ void shader_hw_nrm(SHADER_OPCODE_ARG* arg) {
|
|||
pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
|
||||
}
|
||||
|
||||
void shader_hw_sincos(SHADER_OPCODE_ARG* arg) {
|
||||
/* This instruction exists in ARB, but the d3d instruction takes two extra parameters which
|
||||
* must contain fixed constants. So we need a separate functin to filter those constants and
|
||||
* can't use map2gl
|
||||
*/
|
||||
SHADER_BUFFER* buffer = arg->buffer;
|
||||
char dst_name[50];
|
||||
char src_name[50];
|
||||
char dst_wmask[20];
|
||||
DWORD shift = (arg->dst & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
|
||||
BOOL sat = (arg->dst & WINED3DSP_DSTMOD_MASK) & WINED3DSPDM_SATURATE;
|
||||
|
||||
pshader_get_register_name(arg->dst, dst_name);
|
||||
shader_arb_get_write_mask(arg, arg->dst, dst_wmask);
|
||||
|
||||
pshader_gen_input_modifier_line(buffer, arg->src[0], 0, src_name);
|
||||
shader_addline(buffer, "SCS%s %s%s, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask,
|
||||
src_name);
|
||||
|
||||
if (shift != 0)
|
||||
pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
|
||||
|
||||
}
|
||||
|
||||
/* TODO: merge with pixel shader */
|
||||
/* Map the opcode 1-to-1 to the GL code */
|
||||
void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg) {
|
||||
|
|
|
@ -178,8 +178,8 @@ CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
|||
{WINED3DSIO_POW, "pow", "POW", 1, 3, pshader_hw_map2gl, shader_glsl_pow, 0, 0},
|
||||
{WINED3DSIO_CRS, "crs", "XPD", 1, 3, pshader_hw_map2gl, shader_glsl_cross, 0, 0},
|
||||
{WINED3DSIO_NRM, "nrm", NULL, 1, 2, shader_hw_nrm, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, NULL, shader_glsl_sincos, WINED3DPS_VERSION(2,0), WINED3DPS_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, NULL, shader_glsl_sincos, WINED3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, shader_hw_sincos, shader_glsl_sincos, WINED3DPS_VERSION(2,0), WINED3DPS_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, "sincos", "SCS", 1, 2, shader_hw_sincos, shader_glsl_sincos, WINED3DPS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_DP2ADD, "dp2add", NULL, 1, 4, pshader_hw_dp2add, pshader_glsl_dp2add, WINED3DPS_VERSION(2,0), -1},
|
||||
/* Matrix */
|
||||
{WINED3DSIO_M4x4, "m4x4", "undefined", 1, 3, NULL, shader_glsl_mnxn, 0, 0},
|
||||
|
|
|
@ -115,8 +115,8 @@ CONST SHADER_OPCODE IWineD3DVertexShaderImpl_shader_ins[] = {
|
|||
MUL out, tmp, vec*/
|
||||
{WINED3DSIO_SGN, "sgn", NULL, 1, 2, NULL, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_NRM, "nrm", NULL, 1, 2, shader_hw_nrm, shader_glsl_map2gl, 0, 0},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, NULL, shader_glsl_sincos, WINED3DVS_VERSION(2,0), WINED3DVS_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 2, NULL, shader_glsl_sincos, WINED3DVS_VERSION(3,0), -1},
|
||||
{WINED3DSIO_SINCOS, "sincos", NULL, 1, 4, shader_hw_sincos, shader_glsl_sincos, WINED3DVS_VERSION(2,0), WINED3DVS_VERSION(2,1)},
|
||||
{WINED3DSIO_SINCOS, "sincos", "SCS", 1, 2, shader_hw_sincos, shader_glsl_sincos, WINED3DVS_VERSION(3,0), -1},
|
||||
/* Matrix */
|
||||
{WINED3DSIO_M4x4, "m4x4", "undefined", 1, 3, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0},
|
||||
{WINED3DSIO_M4x3, "m4x3", "undefined", 1, 3, vshader_hw_mnxn, shader_glsl_mnxn, 0, 0},
|
||||
|
|
|
@ -1791,6 +1791,7 @@ extern void pshader_hw_dp2add(SHADER_OPCODE_ARG* arg);
|
|||
|
||||
/* ARB vertex / pixel shader common prototypes */
|
||||
extern void shader_hw_nrm(SHADER_OPCODE_ARG* arg);
|
||||
extern void shader_hw_sincos(SHADER_OPCODE_ARG* arg);
|
||||
|
||||
/* ARB vertex shader prototypes */
|
||||
extern void vshader_hw_map2gl(SHADER_OPCODE_ARG* arg);
|
||||
|
|
Loading…
Reference in New Issue