1

Closed

MGEffectProcessor generates blank .xnb

description

Discussion at http://monogame.codeplex.com/discussions/399322

Out of a collection of .fx shaders, some will compile at least something while others simply generate files with a header and zeros for the body of the .xnb file.

Content was viewed in a binary/hex editor to verify this after attempts to load the file crashed at run-time.

file attachments

Closed May 28, 2016 at 7:52 PM by TomSpilman

comments

SaintGimp wrote Oct 29, 2012 at 7:47 PM

I'm seeing the same thing. My very simple effect isn't loading because it appears to have been processed into an .xnb incorrectly. When the effect is loaded, the ContentTypeReaderManager seems to load information about the readers ok but when it gets around to actually reading the content, it's just four or five non-zero bytes and all the rest are zero. Here's the effect that I'm starting with (converted to .fxg with 2MGFX then compiled into .xnb with MonoGame Effect content processor, .xnb attached):

float4x4 World;
float4x4 View;
float4x4 Projection;

// TODO: add effect parameters here.

struct VertexShaderInput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float4 Lighting : TEXCOORD0;
};

struct VertexShaderOutput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float4 Lighting : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;

float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);

output.Color = input.Color;
output.Lighting = input.Lighting;

return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
return input.Color * input.Lighting;
}

// TODO: set renderstates here.
technique Technique1
{
pass Pass1
{
    VertexShader = compile vs_2_0 VertexShaderFunction();
    PixelShader = compile ps_2_0 PixelShaderFunction();
}
}

SaintGimp wrote Oct 30, 2012 at 6:48 AM

Never mind - the original poster probably has a valid bug but my problem was user error as a result of misunderstanding the documentation.

wrote Feb 22, 2013 at 1:56 AM

wrote May 28, 2016 at 7:52 PM