Laurie Brown

  • Content count

  • Joined

  • Last visited

Community Reputation

108 Neutral

About Laurie Brown

  • Rank
  1. Ah thanks, yes that is annoying about not having default values for structs. This didn't change the alpha blending on the device unfortunately, it is still either off or on. If you multiply in the shader by anything below 0.5f it is off and anything above it is on, it isn't blending at all. I also changed the blendStateDesc to use BlendStateDescription.Default() but that didn't change anything. Yes I realise I should have started fresh with the Toolkit but I had already started the code in XNA and then C++ so this project has been moved about a lot. All just for 2D rendering, it's pretty frustrating. Next time I will definitely use Toolkit, it looks a lot more like XNA, which is nice.
  2. Hmm maybe that's the problem then. I am really having trouble switching to DX11 and WP8. It seems like finding the right info out there is incredibly hard. All the tutorials are for DX9. Thanks once again for the help Xoofx, you're really saving me here. I'll edit with an update after I've rewritten it to pass the samplerstate in from code. Edit: Creating a SamplerState causes a SharpDXException for some reason. The device is already set and creating the BlendState works fine: [source lang="csharp"]var samplerStateDesc = new SamplerStateDescription(); samplerStateDesc.Filter = Filter.MinMagMipLinear; samplerStateDesc.AddressU = TextureAddressMode.Mirror; samplerStateDesc.AddressV = TextureAddressMode.Mirror; samplerStateDesc.ComparisonFunction = Comparison.Never; samplerStateDesc.MinimumLod = 0; samplerStateDesc.MaximumLod = int.MaxValue; _samplerState = new SamplerState(_device, ref samplerStateDesc);[/source]
  3. I'm using SharpDX on the Windows Phone 8 and therefore although it uses DirectX11 it is feature level 9_3. This means certain things won't work on the device but will work on the emulator. I have a shader working on the emulator that uses alpha blending but I can't get it working on the phone at all. Basically I am drawing to a render target without clearing it and then drawing that to another one and multiplying the alpha by 0.95 to slowly fade it out over time. On the emulator this creates a nice fading trail behind a moving object. On the phone however the trail is just always the same colour and doesn't fade. I am assuming this has something to do with feature level 9_3 but I can't figure out what it is I am doing that is wrong. Here's the pixel shader: [source lang="cpp"]Texture2D<float4> shaderTexture : register(t0); sampler TextureSampler = sampler_state { Texture = <shaderTexture>; MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; AddressU = Mirror; AddressV = Mirror; }; struct PSInput { float4 ScreenPosition : SV_POSITION; float2 UV : TEXCOORD; }; float4 main( PSInput input ) : SV_TARGET { float4 textureColor = shaderTexture.Sample(TextureSampler, input.UV); textureColor.a *= 0.95f; return textureColor; }[/source] Thanks for any suggestions.