Skip to content

Commit

Permalink
Ticket MonoGame#3471: Exposing ConstantBuffer API
Browse files Browse the repository at this point in the history
  • Loading branch information
rds1983 committed Apr 10, 2017
1 parent c8933c1 commit 182f9ba
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion MonoGame.Framework/Graphics/Shader/ConstantBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ private bool Dirty
get { return _dirty; }
}

public int Size
{
get { return _buffer.Length; }
}

public ConstantBuffer(ConstantBuffer cloneSource)
{
GraphicsDevice = cloneSource.GraphicsDevice;
Expand Down Expand Up @@ -95,6 +100,11 @@ private void SetData(int offset, int rows, int columns, object data)
}
}

public void SetParameter(int offset, byte[] data)
{
Buffer.BlockCopy(data, 0, _buffer, offset, data.Length);
}

private int SetParameter(int offset, EffectParameter param)
{
const int elementSize = 4;
Expand Down Expand Up @@ -140,7 +150,7 @@ private int SetParameter(int offset, EffectParameter param)
return rowsUsed;
}

public void Update(EffectParameterCollection parameters)
internal void Update(EffectParameterCollection parameters)
{
// TODO: We should be doing some sort of dirty state
// testing here.
Expand Down

0 comments on commit 182f9ba

Please sign in to comment.