0

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.

Community
  • 1
  • 1
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389

1 Answers1

1

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.

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389