Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 08 Mar 2011
Offline Last Active Oct 28 2012 01:45 PM

Topics I've Started

asdouble intrinsic crashes compiler

02 October 2012 - 10:42 AM

Hi, I have simple shader:

void vs()
	asdouble(uint(1), uint(2));

I try to compile it using following command:

fxc /T vs_5_0 /E vs test.hlsl

And this results in program crash (Microsoft DirectX blah blah blah has stopped working).
I'm sure this feature once worked for me under Win7. I'm using Shader Compiler 9.29.952.3111 (D3DCompiler_43.dll). Under Win8 (D3DCompiler_46.dll) it does work.
Have you any experience using this function?


18 September 2012 - 07:07 AM

I want to run my application on GeForce GTX 670. It's designed for D3D11.1 and works properly under Ref Device so I want to test it on hardware. I tried with two drivers: 306.23 and 306.02 BETA on Win8 RTM x86 and both doesn't support this feature level. According to Wikipedia and release notes, this card model should support it. Do you have any information explaining this situation?

f32tof16 confusion

17 August 2012 - 02:36 AM

I try to find out why this intrinsic is always returning zero. Here's my code:

float4 PS(in float4 vPosition : SV_POSITION) : SV_TARGET
	float o = 1.5f;
	uint res = f32tof16(o);
	float resf = asfloat(res);
	return float4(resf, 1, 1, 1);

I tried with different values.
The result should be in the lower part of returned value.

Function is compiled with ps_5_0 profile. Render target's format is R32G32B32_FLOAT. Device: nVidia Quadro 1000M, feature level 11.0.

checked with command-line compiler fxc. The result is:
// Generated by Microsoft ® HLSL Shader Compiler 9.29.952.3111
//   fxc /T ps_5_0 /E ps test.hlsl /Od
// Input signature:
// Name				 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// SV_POSITION			  0   xyzw		0	  POS  float
// Output signature:
// Name				 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// SV_TARGET				0   xyzw		0   TARGET  float   xyzw
dcl_globalFlags refactoringAllowed
dcl_output o0.xyzw
mov o0.xyzw, l(0,1.000000,1.000000,1.000000)
// Approximately 2 instruction slots used
I'm wondering, why the compiler skips the code without any warning...

Applying mask to texture

26 February 2012 - 05:21 AM

I have a problem with applying mask to texture. The steps are as follows:

			mask = new RenderTarget2D(GraphicsDevice,
				graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight,
				false, SurfaceFormat.Color, DepthFormat.None);



			spriteBatch.Draw(terrain, Vector2.Zero, Color.White);

			BlendState bs = new BlendState();

			bs.ColorSourceBlend = Blend.One;
			bs.ColorDestinationBlend = Blend.One;
			bs.ColorBlendFunction = BlendFunction.Add;

			bs.AlphaSourceBlend = Blend.One;
			bs.AlphaDestinationBlend = Blend.One;
			bs.AlphaBlendFunction = BlendFunction.Add;

			spriteBatch.Begin(SpriteSortMode.FrontToBack, bs);
			spriteBatch.Draw(tex2, new Vector2(100f, 250f), Color.White);


			spriteBatch.Draw((Texture2D)rt, Vector2.Zero, Color.White);

The mask and terrain are PNG textures with alpha channel. I just want to take alpha value of each pixel from mask and "put" them into render target (strictly, multilply alpha values of source and destination). BlendState class has (almost) no documentation but I don't want to use shaders. Do you happen to know how to configure this object?

Thank you for not responding. Posted Image This motivated myself to investigate the problem thoroughly.
My configuration is:

bs.ColorSourceBlend = Blend.Zero;
			bs.ColorDestinationBlend = Blend.SourceAlpha;
			bs.ColorBlendFunction = BlendFunction.Add;

			bs.AlphaSourceBlend = Blend.Zero;
			bs.AlphaDestinationBlend = Blend.SourceAlpha;
			bs.AlphaBlendFunction = BlendFunction.Add;
Now, it works perfectly.