1

So I've written and compiled an HLSL pixel shader with Shazzam, placed the resulting .ps file in my project, and am trying to instantiate it. No matter what URI I put, Blend tells me that the resource can't be found whenever I try to view any xaml designer, and Visual Studio just shows me a blank page, both in design view and if I try to run the application.

This is a Silverlight 4 SketchFlow project, in Blend 4 RC and Visual Studio 2010.

I've tried both Resource and EmbeddedResource as the Build Action for the .ps file, neither make any difference (I'm pretty sure it's supposed to be set to Resource).

I've tried the following URI formats:

"ShaderFileName.ps"
"/ShaderFileName.ps"
"AssemblyName;component/ShaderFileName.ps"
"/AssemblyName;component/ShaderFileName.ps"

I also tried moving the shader file from the Screens assembly to the root assembly (that's how SketchFlow projects are created) and that didn't help either.

Anyone have any thoughts?

Grank
  • 5,242
  • 7
  • 33
  • 36

3 Answers3

2

Try this. It works for me:

BuildAction=Resource
Uri = new Uri("/AssemblyName;component/Effects/Shaders/Inverse.ps", UriKind.RelativeOrAbsolute)
Kevin DiTraglia
  • 25,746
  • 19
  • 92
  • 138
termit
  • 200
  • 2
  • 10
0

BuildAction=Resource is right and the format is: "AssemblyName;component/ShaderFileName.ps" Don't forget to add the relative path if the shader .ps file is located inside a folder. Also check the spelling.

Rene Schulte
  • 2,962
  • 1
  • 19
  • 26
  • Unfortunately, that's one of the possibilities I've tried and the .ps is in the root :( – Grank Jun 17 '10 at 19:47
0

BuildAction=Content and path like "/ShaderFileName.ps" if you put it in root of your app

Lex Lavnikov
  • 1,239
  • 9
  • 18