I don't have shpeck/milkdrop 2.25c (which played these presets correctly) anymore but I'll post the comparisons with milkdrop3 which is essentially the same thing.
P.S. since you mention that this is based on ProjectM I suppose this is to be expected as people have stated on the official winamp/milkdrop forums that ProjectM doesn't render shader heavy presets correctly.
Firstly, nothing to do with ProjectM since that part is only for the Expression Evaluation Library. This component uses the open source MilkDrop2 library, period. You can see the code. The original EEL and EEL2 actually come from AVS. The issue at hand is that the shaders don't compile.
My bad for not displaying the HLSL compiler errors. As you can see, they are a bit large and require copying/sharing/moving large buffers across the component. That said, the problems are in the presets themselves. I cannot update all of the presets myself and, in my view, that other programs are lax in their acceptance of errors is not correct. It gives a false sense of correctness by lowering the quality across the board. Also tells me that much of the testing of these presets was ad hoc and the implicit assumption here that they should "just work" is overly optimistic.
Here is the output of "martin - gentle happiness" D3DCompile:
Error compiling ps_4_0_level_9_3 warp shader:
Shader@0x000000FF7672F280(165,7-43): warning X3206: implicit truncation of vector type
Shader@0x000000FF7672F280(174,9-38): warning X3206: implicit truncation of vector type
Shader@0x000000FF7672F280(177,8-19): warning X3205: conversion from larger type to smaller, possible loss of data
Shader@0x000000FF7672F280(181,43-58): warning X3205: 'tan': conversion from larger type to smaller, possible loss of data
Shader@0x000000FF7672F280(181,1-60): warning X3205: conversion from larger type to smaller, possible loss of data
Shader@0x000000FF7672F280(172,9-28): error X3684: ps_4_0_level_9_3 does not support double-precision floating-point
This is simple, it's complaining about these two lines:
double3 ist = GetBlur1(uv*1);
double3 crisp = tex2D(sampler_main,uv);
From "martin - lonely goose":
Error compiling ps_4_0_level_9_3 warp shader:
Shader@0x000000FF77561E10(165,24-37): error X3005: 'pow': identifier represents a variable, not a function
Another simple one, this function uses pow as a variable and also the "pow()" function:
float2 cpow(float2 base, float ex) {
float moduz = sqrt(base.x*base.x + base.y*base.y);
float thetaz = atan2(base.y, base.x);
float2 pow = float2(pow(moduz, ex)*cos(thetaz*ex), pow(moduz, ex)*sin(thetaz*ex));
return pow;
}
Slightly more complex is the output of "Martin - Hades' Disquotheqe - headache edition" from D3DCompile:
Error compiling ps_4_0_level_9_3 composite shader:
Shader@0x000000D42B382040(187,2-78): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(195,1-41): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(197,7-60): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(200,8-52): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(207,35-45): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(207,8-73): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(208,33-41): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(215,1-67): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(233,16-59): warning X3206: implicit truncation of vector type
Shader@0x000000D42B382040(237,15-52): warning X3206: 'dot': implicit truncation of vector type
internal error: blob content mismatch between level9 and d3d10 shader
This last one above is intermittent and doesn't show up always. I don't know what this one means. For reference, here is the exact string being passed to the HLSL compiler with all of the setup code before the preset shader code (comments are stripped before getting passed to the compiler as below):
#define M_PI 3.14159265359
#define M_PI_2 6.28318530718
#define M_INV_PI_2 0.159154943091895
float4 rand_frame;
float4 rand_preset;
float4 _c0;
float4 _c1, _c2, _c3, _c4;
float4 _c5;
float4 _c6;
float4 _c7;
float4 _c8;
float4 _c9;
float4 _c10;
float4 _c11;
float4 _c12;
float4 _c13;
float4 _qa;
float4 _qb;
float4 _qc;
float4 _qd;
float4 _qe;
float4 _qf;
float4 _qg;
float4 _qh;
float4x3 rot_s1;
float4x3 rot_s2;
float4x3 rot_s3;
float4x3 rot_s4;
float4x3 rot_d1;
float4x3 rot_d2;
float4x3 rot_d3;
float4x3 rot_d4;
float4x3 rot_f1;
float4x3 rot_f2;
float4x3 rot_f3;
float4x3 rot_f4;
float4x3 rot_vf1;
float4x3 rot_vf2;
float4x3 rot_vf3;
float4x3 rot_vf4;
float4x3 rot_uf1;
float4x3 rot_uf2;
float4x3 rot_uf3;
float4x3 rot_uf4;
float4x3 rot_rand1;
float4x3 rot_rand2;
float4x3 rot_rand3;
float4x3 rot_rand4;
#define time _c2.x
#define fps _c2.y
#define frame _c2.z
#define progress _c2.w
#define bass _c3.x
#define mid _c3.y
#define treb _c3.z
#define vol _c3.w
#define bass_att _c4.x
#define mid_att _c4.y
#define treb_att _c4.z
#define vol_att _c4.w
#define q1 _qa.x
#define q2 _qa.y
#define q3 _qa.z
#define q4 _qa.w
#define q5 _qb.x
#define q6 _qb.y
#define q7 _qb.z
#define q8 _qb.w
#define q9 _qc.x
#define q10 _qc.y
#define q11 _qc.z
#define q12 _qc.w
#define q13 _qd.x
#define q14 _qd.y
#define q15 _qd.z
#define q16 _qd.w
#define q17 _qe.x
#define q18 _qe.y
#define q19 _qe.z
#define q20 _qe.w
#define q21 _qf.x
#define q22 _qf.y
#define q23 _qf.z
#define q24 _qf.w
#define q25 _qg.x
#define q26 _qg.y
#define q27 _qg.z
#define q28 _qg.w
#define q29 _qh.x
#define q30 _qh.y
#define q31 _qh.z
#define q32 _qh.w
#define aspect _c0
#define texsize _c7
#define roam_cos _c8
#define roam_sin _c9
#define slow_roam_cos _c10
#define slow_roam_sin _c11
#define mip_x _c12.x
#define mip_y _c12.y
#define mip_xy _c12.xy
#define mip_avg _c12.z
#define blur1_min _c6.z
#define blur1_max _c6.w
#define blur2_min _c13.x
#define blur2_max _c13.y
#define blur3_min _c13.z
#define blur3_max _c13.w
#define GetMain(uv) (tex2D(sampler_main, uv).xyz)
#define GetPixel(uv) (tex2D(sampler_main, uv).xyz)
#define GetBlur1(uv) (tex2D(sampler_blur1, uv).xyz * _c5.x + _c5.y)
#define GetBlur2(uv) (tex2D(sampler_blur2, uv).xyz * _c5.z + _c5.w)
#define GetBlur3(uv) (tex2D(sampler_blur3, uv).xyz * _c6.x + _c6.y)
#define lum(x) (dot(x, float3(0.32, 0.49, 0.29)))
#define tex2d tex2D
#define tex3d tex3D
texture PrevFrameImage;
sampler2D sampler_main = sampler_state { Texture = <PrevFrameImage>; };
sampler2D sampler_fc_main = sampler_state { Texture = <PrevFrameImage>; };
sampler2D sampler_pc_main = sampler_state { Texture = <PrevFrameImage>; };
sampler2D sampler_fw_main = sampler_state { Texture = <PrevFrameImage>; };
sampler2D sampler_pw_main = sampler_state { Texture = <PrevFrameImage>; };
#define sampler_FC_main sampler_fc_main
#define sampler_PC_main sampler_pc_main
#define sampler_FW_main sampler_fw_main
#define sampler_PW_main sampler_pw_main
sampler2D sampler_noise_lq;
sampler2D sampler_noise_lq_lite;
sampler2D sampler_noise_mq;
sampler2D sampler_noise_hq;
sampler3D sampler_noisevol_lq;
sampler3D sampler_noisevol_hq;
float4 texsize_noise_lq;
float4 texsize_noise_lq_lite;
float4 texsize_noise_mq;
float4 texsize_noise_hq;
float4 texsize_noisevol_lq;
float4 texsize_noisevol_hq;
sampler2D sampler_blur1;
sampler2D sampler_blur2;
sampler2D sampler_blur3;
#define rad _rad_ang.x
#define ang _rad_ang.y
#define uv _uv.xy
#define uv_orig _uv.xy
#define hue_shader _vDiffuse.xyz
sampler sampler_pw_noise_lq;
static float quality = 2, depth = q31;
float3 neu, rsl, rsl2, rsl3, ret1, screen3, back,lcol, sky;
float2 uv0, uv1, uv2, uv4;
float lprof,lprof2,m,n,dist,cloud,mask, shadow, mask1,lmask,leaves,clshadow,gmask;
static float lav_gnd = 0;
static const float anz = 3;
static float2 mov = float2 (q5,q6);
static float3 t = float3(q14,q15,q16);
static float3 s = float3(q17,q18,q19);
static float3 ts = -cross(s,t);
static float3 pos = float3 (q11,q12,q13);
float3 project (float3 pos, float dist) {
float z;
z = dist/mul(cross(ts,-t),screen3) *(1-lav_gnd);
gmask = (z <= 0)*(z >= -8);
return gmask* float3(mul(float2x3(ts,t),cross(pos,screen3))*z/256,-z);}
float3 lproject (float3 pos, float dist) {
float z;
z = dist/mul(cross(ts,-t),screen3) *(1-lav_gnd) ;
return (z<=0)*(z>=-4)* float3(mul(float2x3(ts,t),cross(pos,screen3))*z/256,-z);}
float noise2 (float2 uvi)
{return 1*(tex2D (sampler_noise_hq,uvi) + 0*tex2D (sampler_noise_hq,uvi*4)/4);}
void PS( float4 _vDiffuse : COLOR, float2 _uv : TEXCOORD0, float2 _rad_ang : TEXCOORD1, out float4 _return_value : COLOR0 )
{ float3 ret = 0;
uv0 = uv;
screen3 = float3 ((uv-.5)*aspect.xy,1);
lav_gnd = tex2D (sampler_noise_hq,uv)*.03;
rsl3 = lproject(pos,1.5) + float3 (q29,-time/118,0) + float3 (mov,0);
float glmask = tex2D (sampler_pw_noise_lq,rsl3.x*.004) >= .3;
uv2 = rsl3.xy*16;
uv2.y += tex2D (sampler_pw_noise_lq,uv2.x/256).g*-2*time;
float3 noise = 8*tex2D (sampler_pw_noise_lq,uv2/256);
lmask = noise.g >= 7.; lmask *= glmask;
uv2 = frac(uv2);
float lside = sin((noise.b-8)*2*time+q32);
float lsize = 3*(noise.g-6);
leaves = lmask*lsize *(3+frac(4*uv2.x/uv2.y))/4
-26*length((uv2-.5)*float2(1,2/lside));
lcol = (1+tex2D (sampler_noise_hq,uv2/8+noise))* float3 (.8+lside/4,.5,0);;
lcol -= tex2D (sampler_noise_hq,uv2+noise).r*.25;
leaves = saturate(leaves);
lav_gnd = 0;
rsl = project (pos, 1)+float3 (time*.006,.6,0);
back = saturate(1-rsl.y);
cloud = saturate(noise2(rsl.xy/8*float2(1,4))-.4)*saturate(.5+back);
back *= float3(.7,.77,.96);
sky = lerp(back,2*cloud,cloud/2);
ret1 = sky;
lprof2 = 0;
for (n=anz; n >= 1; n--) {
dist = (n); lav_gnd = 0; mov += n/anz;
for (m=1; m <= quality; m++) {
rsl = project (pos, dist)+float3 (mov,0);
lprof = .5-lum(GetBlur1(frac(rsl.xy)));
lav_gnd -= lprof/quality*depth/rsl.z;
}
rsl = project (pos, dist)+float3 (mov,0) ;
rsl2 = project (pos, dist)+float3 (0,0,0);
int first = (n==1);
if (!first) {shadow = saturate(4*GetPixel(frac(rsl2.xy))) ;}
neu = GetPixel(frac(rsl.xy));
float dista = length(rsl.xy)*.001;
mask = saturate(16/dist*lum(neu))*gmask;
neu *= 1-.5*lum(tex2D (sampler_noise_lq,rsl.xy*4));
clshadow = clamp (q20*1.6-noise2(rsl.xy*float2(.02,.1)+float2(time*.01,0)),.2,1);
neu *= (1-shadow*.5* (!first))*clshadow;
neu = lerp(back, neu, saturate(5-rsl.z));
ret1 = lerp(ret1,neu,mask) ;
}
rsl = project (pos, dist)+float3 (mov+lprof/2,0);
ret1 = lerp(ret1,leaves*(1-shadow/2)*clshadow*lcol, leaves*.5*saturate(!mask));
ret = ret1;
_return_value = float4(ret.xyz, _vDiffuse.w);
}
But through some trial and error, it appears the correct fallback is to use plain ps_4_0:
- fxc.exe /nologo /Gec /E PS /T ps_2_a test.hlsl --> Passes compile but fails in DirectX 11.
- fxc.exe /nologo /Gec /E PS /T ps_4_0_level_9_3 test.hlsl --> Fails compile with the error above.
- fxc.exe /nologo /Gec /E PS /T ps_4_0 test.hlsl --> Passes compile and works fine with DirectX 11.
I'll test this theory a bit more and make a release if it pans out. However, the issue with the function/variable name collision and the unsupported double type is on the preset authors. And given how simple to verify the preset shader code is it is a shame that they are not tested more thoroughly (looks fine, ship it mentality).