Question

I am trying to use a texture from a shader on Windows Phone 8 using SharpDX, but I have trouble uploading the texture to GPU. I've found these:

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.graphicsdevice.textures.aspx How to pass a Texture2D object to Pixel Shader in XNA 4.0?

Unfortunately, I don't have GraphicsDevice.Textures property available in SharpDX. I couldn't find a way to upload my Texture2D object to the GPU. How do I upload my texture to GPU under SharpDX.

Was it helpful?

Solution

Okay, found out how to do it myself:

shader = Content.Load<Effect>("Shader.tkfxo"); is my shader.

When I was debugging, I found the Parameters property of the effect. I've found that the index at 2 was corresponding to a Texture2D object. It was looking for an array so I used shader.Parameters[2].SetResource<Texture2D>(new Texture2D[] { myTextureObject }); and it worked flawlessly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top