Skip to content

Commit

Permalink
Fixed shader format to write the shader code length as 32bit integer.
Browse files Browse the repository at this point in the history
Incremented MGFX version to 5.
  • Loading branch information
tomspilman committed Mar 12, 2013
1 parent 7a516fc commit f651a73
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions MonoGame.Framework/Graphics/Effect/Effect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ internal static byte[] LoadEffectResource(string name)
/// used to detect old packaged content.
/// </summary>
/// <remarks>
/// We should avoid supporting old versions for very long as
/// users should be rebuilding content when packaging their game.
/// We should avoid supporting old versions for very long if at all
/// as users should be rebuilding content when packaging their game.
/// </remarks>
private const int MGFXVersion = 4;
private const int MGFXVersion = 5;

#if !PSM

Expand Down
2 changes: 1 addition & 1 deletion MonoGame.Framework/Graphics/Shader/Shader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ internal Shader(GraphicsDevice device, BinaryReader reader)
var isVertexShader = reader.ReadBoolean();
Stage = isVertexShader ? ShaderStage.Vertex : ShaderStage.Pixel;

var shaderLength = (int)reader.ReadUInt16();
var shaderLength = reader.ReadInt32();
var shaderBytecode = reader.ReadBytes(shaderLength);

var samplerCount = (int)reader.ReadByte();
Expand Down
2 changes: 1 addition & 1 deletion Tools/2MGFX/DXEffectObject.writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal partial class DXEffectObject
{

private const string Header = "MGFX";
private const int Version = 4;
private const int Version = 5;

/// <summary>
/// Writes the effect for loading later.
Expand Down
6 changes: 3 additions & 3 deletions Tools/2MGFX/DXShaderData.writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ internal partial class DXShaderData
{
public void Write(BinaryWriter writer, Options options)
{
writer.Write(IsVertexShader);

writer.Write((ushort)ShaderCode.Length);
writer.Write(IsVertexShader);

writer.Write(ShaderCode.Length);
writer.Write(ShaderCode);

writer.Write((byte)_samplers.Length);
Expand Down

0 comments on commit f651a73

Please sign in to comment.