Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


HLSL _x4 modifier optimisation not working

This topic is 5374 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Help!! Has anyone got the vertex or pixel shader modifier _x4 to be used in HLSL effect files to work? It states in the document:- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnhlsl/html/shaderx2_introductionto.asp that if you do something like:- static const float N = 2; float4 main( float4 Col[2] : COLOR0) : COLOR0 { return (Col[0] + Col[1] )*N; } you should get code generated like:- ps_1_1 add_x2 r0, v0, v1 If I compile my effect file using:- hr = D3DXCreateEffectFromFile( g.pd3dDevice,FullName,NULL,NULL,D3DXSHADER_DEBUG,NULL,&g.pEffect[Slot],&pBufferErrors ); My admittedly simple pixel shader:- PS_OUTPUT RenderScenePS( VS_OUTPUT In ) { PS_OUTPUT Output; Output.RGBColor = (tex2D(TextureSampler, In.UV0) * In.Diffuse)*N; return Output; } Produces:- ps_1_1 comment DBUG comment CTAB tex t0 mul r0, t0, v0 mov_x4 r0, r0 end Not very efficient I think you will agree! Its even worse to use the modifier in vertex shaders. Any help is much appreciated.

Share this post

Link to post
Share on other sites
For the vertex shaders, there are no modifiers apart from _sat which is only supported on vs_3_0 I believe (at least, thats all I could find in the documentation).

For the pixel shaders, there are sort of mixed setups that are kind of annoying. The modifiers you''re after should be generated on the 1.1 targets, but perhaps you havent got optimisation enabled or something?
On 2.0 or greater targets, I don''t think those modifiers are valid anymore.

Hope some of that''s useful.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!