XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

AccessViolationException when trying to vary Pixelshader in Techniques.

Last post 7/1/2009 7:21 AM by Gooni. 2 replies.
  • 6/18/2009 8:44 PM

    AccessViolationException when trying to vary Pixelshader in Techniques.

    I am using the file InstancedModel.fx from the instancing sample and I am trying to use different variations for differnet objects, so I am trying to add the choice of a pixelshader in the techniques:

    int ShaderIndex = 0; 
     
    PixelShader PSArray[2] = 
        compile ps_3_0 PSOne(), 
        compile ps_3_0 PSTwo(), 
    }; 
     
    // Xbox instancing technique. 
    technique VFetchInstancing 
        pass Pass1 
        {
            VertexShader = compile vs_3_0 VFetchInstancingVertexShader(); 
            PixelShader = compile ps_3_0 PSOne();//(PSArray[ShaderIndex]); 
        } 

    You are looking at the version that is working fine. But as soon as I delete "compile..." and use the (PSArray[ShaderIndex]); which is now commented out, I get the following error:

    Building content threw AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
       at CompileEffectFromSourceForXBox(String effectSource, CompilerMacro[] preprocessorDefines, CompilerIncludeHandler includeHandler, CompilerOptions options)
       at Microsoft.Xna.Framework.Graphics.Effect.CompileEffectFromSource(String effectFileSource, CompilerMacro[] preprocessorDefines, CompilerIncludeHandler includeHandler, CompilerOptions options, TargetPlatform platform)
       at Microsoft.Xna.Framework.Content.Pipeline.Processors.EffectProcessor.Process(EffectContent input, ContentProcessorContext context)
       at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
       at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
       at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)

    The code should just work because I simply copied it from BasicEffect-sample?! Any help greatly appreciated...


    EDIT: Exception occurs only when building for Xbox. On Windows everything works just fine...

  • 6/29/2009 2:56 PM In reply to

    Re: AccessViolationException when trying to vary Pixelshader in Techniques.

    Sounds like it could be a problem with the ps_3_0 compiler for xbox.  Have you tried logging the problem through connect.microsoft.com for the xna game studio?
  • 7/1/2009 7:21 AM In reply to

    Re: AccessViolationException when trying to vary Pixelshader in Techniques.

    hi legalize,

    thanks for your reply. I didn't try logging the problem via connect.microsoft.com. I didn't even know such a thing existed. For the moment, my problem is solved: I was able to split the shader up and with less code in it the problem vanished. However thanks for the advice, I will give it a try next time.

    Regards, Gooni.
Page 1 of 1 (3 items) Previous Next