Reputation: 34780
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.
Upvotes: 0
Views: 893
Reputation: 34780
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.
Upvotes: 1