PS_2_0 Asm Shader sincos question I am trying to transfer a XNA PS shader to HLSL.And maybe try to transfer to GLSL. New to ASM Shader and got this sincos function,no idea what does it mean. sincos r1.y, r0.x, c9, c10 according to MS doc https://ift.tt/2uBDWl7 c9,c10 are const which define like this #define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f c9 = D3DSINCOSCONST1 #define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f c10 = D3DSINCOSCONST2 r1.y is dest r0.x is source So,what does this line mean?How do I know it is sin function or cos function for HLSL? And here is the full PS ASM code from Intel GPA. // // Generated by Microsoft (R) HLSL Shader Compiler 9.26.952.2844 // // Parameters: // // float fTimer; // float stop; // // // Registers: // // Name Reg Size // ------------ ----- ---- // fTimer c0 1 // stop c1 1 // // preshader // mul c0.x, c0.x, (0.15) // add r0.x, c1.x, (-1) // mul c1.x, r0.x, r0.x // neg r0.x, c1.x // add c2.x, r0.x, (1) // // approximately 5 instructions used // // Generated by Microsoft (R) HLSL Shader Compiler 9.26.952.2844 // // Parameters: // // sampler2D ColorMapSampler; // float x; // float y; // // // Registers: // // Name Reg Size // --------------- ----- ---- // x c3 1 // y c4 1 // ColorMapSampler s0 1 // ps_2_0 def c5, 0.600000024, -0.0529000014, 22, 0.319999993 def c6, 0.159154937, 0.5, 6.28318548, -3.14159274 def c7, 0.416666657, 0.0240000002, 0, 0 def c8, -3, 6, 6, 0 def c9, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668 def c10, -0.020833334, -0.125, 1, 0.5 dcl t0.xy dcl_2d s0 mov r0.w, c5.z mad r0.x, t0.x, r0.w, c0.x mad r0.x, r0.x, c6.x, c6.y frc r0.x, r0.x mad r0.x, r0.x, c6.z, c6.w sincos r1.y, r0.x, c9, c10 mul r0.x, r1.y, c5.w add r0.y, t0.y, -c4.x mul r0.y, r0.y, r0.y mul r0.y, r0.y, c5.x add r0.z, t0.x, -c3.x mad r0.y, r0.z, r0.z, r0.y mad r0.z, r0.y, -c7.x, c7.y mad r1.x, r0.x, r0.z, t0.x mad r0.x, t0.y, r0.w, c0.x mad r0.x, r0.x, c6.x, c6.y frc r0.x, r0.x mad r0.x, r0.x, c6.z, c6.w sincos r2.y, r0.x, c9, c10 mul r0.x, r0.z, r2.y mad r1.y, r0.x, c5.w, t0.y add r0.x, r0.y, c5.y add r0.y, -r0.y, -c5.y mul r2.xyz, r0.y, c8 cmp r1.xy, r0.x, t0, r1 texld r1, r1, s0 mov r2.w, c7.z add r2, -r2, r1 cmp r0, r0.x, r1, r2 add r1.xyz, -r0, c2.x abs r1.xyz, r1 cmp r0.xyz, -c1.x, r0, r1 mov oC0, r0 // approximately 47 instruction slots used (1 texture, 46 arithmetic) https://ift.tt/eA8V8J
I am trying to transfer a XNA PS shader to HLSL.And maybe try to transfer to GLSL. New to ASM Shader and got this sincos function,no idea what does it mean. sincos r1.y, r0.x, c9, c10 according to MS doc https://ift.tt/2uBDWl7 c9,c10 are const which define like this #define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f c9 = D3DSINCOSCONST1 #define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f c10 = D3DSINCOSCONST2 r1.y is dest r0.x is source So,what does this line mean?How do I know it is sin function or cos function for HLSL? And here is the full PS ASM code from Intel GPA. // // Generated by Microsoft (R) HLSL Shader Compiler 9.26.952.2844 // // Parameters: // // float fTimer; // float stop; // // // Registers: // // Name Reg Size // ------------ ----- ---- // fTimer c0 1 // stop c1 1 // // preshader // mul c0.x, c0.x, (0.15) // add r0.x, c1.x, (-1) // mul c1.x, r0.x, r0.x // neg r0.x, c1.x // add c2.x, r0.x, (1) // // approximately 5 instructions used // // Generated by Microsoft (R) HLSL Shader Compiler 9.26.952.2844 // // Parameters: // // sampler2D ColorMapSampler; // float x; // float y; // // // Registers: // // Name Reg Size // --------------- ----- ---- // x c3 1 // y c4 1 // ColorMapSampler s0 1 // ps_2_0 def c5, 0.600000024, -0.0529000014, 22, 0.319999993 def c6, 0.159154937, 0.5, 6.28318548, -3.14159274 def c7, 0.416666657, 0.0240000002, 0, 0 def c8, -3, 6, 6, 0 def c9, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668 def c10, -0.020833334, -0.125, 1, 0.5 dcl t0.xy dcl_2d s0 mov r0.w, c5.z mad r0.x, t0.x, r0.w, c0.x mad r0.x, r0.x, c6.x, c6.y frc r0.x, r0.x mad r0.x, r0.x, c6.z, c6.w sincos r1.y, r0.x, c9, c10 mul r0.x, r1.y, c5.w add r0.y, t0.y, -c4.x mul r0.y, r0.y, r0.y mul r0.y, r0.y, c5.x add r0.z, t0.x, -c3.x mad r0.y, r0.z, r0.z, r0.y mad r0.z, r0.y, -c7.x, c7.y mad r1.x, r0.x, r0.z, t0.x mad r0.x, t0.y, r0.w, c0.x mad r0.x, r0.x, c6.x, c6.y frc r0.x, r0.x mad r0.x, r0.x, c6.z, c6.w sincos r2.y, r0.x, c9, c10 mul r0.x, r0.z, r2.y mad r1.y, r0.x, c5.w, t0.y add r0.x, r0.y, c5.y add r0.y, -r0.y, -c5.y mul r2.xyz, r0.y, c8 cmp r1.xy, r0.x, t0, r1 texld r1, r1, s0 mov r2.w, c7.z add r2, -r2, r1 cmp r0, r0.x, r1, r2 add r1.xyz, -r0, c2.x abs r1.xyz, r1 cmp r0.xyz, -c1.x, r0, r1 mov oC0, r0 // approximately 47 instruction slots used (1 texture, 46 arithmetic)
from GameDev.net https://ift.tt/2HZXVlm
from GameDev.net https://ift.tt/2HZXVlm
ليست هناك تعليقات