Compare commits

..

No commits in common. "5b7c39efb6b8dae93850a795a3f5d0ab4fb2ca2b" and "05de9a40664688ba56ccffe79bb1965ad14153a0" have entirely different histories.

4 changed files with 28 additions and 24 deletions

View File

@ -71,7 +71,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfo.Texture.SampleCount;
currentSampleCount = colorAttachmentInfo.SampleCount;
colorFormatOne = colorAttachmentInfo.Texture.Format;
#endif
}
@ -111,7 +111,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount;
currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
#endif
@ -159,7 +159,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount;
currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -215,7 +215,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount;
currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -285,7 +285,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfo.Texture.SampleCount;
currentSampleCount = colorAttachmentInfo.SampleCount;
colorFormatOne = colorAttachmentInfo.Texture.Format;
depthStencilFormat = depthStencilAttachmentInfo.Texture.Format;
#endif
@ -332,7 +332,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount;
currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
depthStencilFormat = depthStencilAttachmentInfo.Texture.Format;
@ -387,7 +387,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount;
currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -450,7 +450,7 @@ namespace MoonWorks.Graphics
#if DEBUG
renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount;
currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -1489,6 +1489,7 @@ namespace MoonWorks.Graphics
/// <summary>
/// Draws using instanced rendering.
/// It is an error to call this method unless two vertex buffers have been bound.
/// </summary>
/// <param name="baseVertex">The starting index offset for the vertex buffer.</param>
/// <param name="startIndex">The starting index offset for the index buffer.</param>
@ -2046,7 +2047,7 @@ namespace MoonWorks.Graphics
private void AssertSameSampleCount(ColorAttachmentInfo a, ColorAttachmentInfo b)
{
if (a.Texture.SampleCount != b.Texture.SampleCount)
if (a.SampleCount != b.SampleCount)
{
throw new System.ArgumentException("All color attachments in a render pass must have the same SampleCount!");
}

View File

@ -181,6 +181,7 @@ namespace MoonWorks.Graphics
public uint Depth;
public uint Layer;
public uint Level;
public SampleCount SampleCount;
public Color ClearColor;
public LoadOp LoadOp;
public StoreOp StoreOp;
@ -188,12 +189,15 @@ namespace MoonWorks.Graphics
public ColorAttachmentInfo(
Texture texture,
Color clearColor,
SampleCount sampleCount = SampleCount.One,
StoreOp storeOp = StoreOp.Store
) {
)
{
Texture = texture;
Depth = 0;
Layer = 0;
Level = 0;
SampleCount = sampleCount;
ClearColor = clearColor;
LoadOp = LoadOp.Clear;
StoreOp = storeOp;
@ -202,12 +206,15 @@ namespace MoonWorks.Graphics
public ColorAttachmentInfo(
Texture texture,
LoadOp loadOp = LoadOp.DontCare,
SampleCount sampleCount = SampleCount.One,
StoreOp storeOp = StoreOp.Store
) {
)
{
Texture = texture;
Depth = 0;
Layer = 0;
Level = 0;
SampleCount = sampleCount;
ClearColor = Color.White;
LoadOp = loadOp;
StoreOp = storeOp;
@ -221,6 +228,7 @@ namespace MoonWorks.Graphics
depth = Depth,
layer = Layer,
level = Level,
sampleCount = (Refresh.SampleCount) SampleCount,
clearColor = new Refresh.Vec4
{
x = ClearColor.R / 255f,

View File

@ -15,7 +15,6 @@ namespace MoonWorks.Graphics
public TextureFormat Format { get; internal set; }
public bool IsCube { get; }
public uint LevelCount { get; }
public SampleCount SampleCount { get; }
public TextureUsageFlags UsageFlags { get; }
// FIXME: this allocates a delegate instance
@ -40,14 +39,13 @@ namespace MoonWorks.Graphics
var byteCount = (uint) (width * height * channels);
TextureCreateInfo textureCreateInfo = new TextureCreateInfo();
TextureCreateInfo textureCreateInfo;
textureCreateInfo.Width = (uint) width;
textureCreateInfo.Height = (uint) height;
textureCreateInfo.Depth = 1;
textureCreateInfo.Format = TextureFormat.R8G8B8A8;
textureCreateInfo.IsCube = false;
textureCreateInfo.LevelCount = 1;
textureCreateInfo.SampleCount = SampleCount.One;
textureCreateInfo.UsageFlags = TextureUsageFlags.Sampler;
var texture = new Texture(device, textureCreateInfo);
@ -132,9 +130,9 @@ namespace MoonWorks.Graphics
uint height,
TextureFormat format,
TextureUsageFlags usageFlags,
uint levelCount = 1,
SampleCount sampleCount = SampleCount.One
) {
uint levelCount = 1
)
{
var textureCreateInfo = new TextureCreateInfo
{
Width = width,
@ -142,7 +140,6 @@ namespace MoonWorks.Graphics
Depth = 1,
IsCube = false,
LevelCount = levelCount,
SampleCount = sampleCount,
Format = format,
UsageFlags = usageFlags
};
@ -168,7 +165,8 @@ namespace MoonWorks.Graphics
TextureFormat format,
TextureUsageFlags usageFlags,
uint levelCount = 1
) {
)
{
var textureCreateInfo = new TextureCreateInfo
{
Width = width,
@ -197,7 +195,8 @@ namespace MoonWorks.Graphics
TextureFormat format,
TextureUsageFlags usageFlags,
uint levelCount = 1
) {
)
{
var textureCreateInfo = new TextureCreateInfo
{
Width = size,
@ -233,7 +232,6 @@ namespace MoonWorks.Graphics
Depth = textureCreateInfo.Depth;
IsCube = textureCreateInfo.IsCube;
LevelCount = textureCreateInfo.LevelCount;
SampleCount = textureCreateInfo.SampleCount;
UsageFlags = textureCreateInfo.UsageFlags;
}
@ -257,7 +255,6 @@ namespace MoonWorks.Graphics
Depth = 1;
IsCube = false;
LevelCount = 1;
SampleCount = SampleCount.One;
UsageFlags = TextureUsageFlags.ColorTarget;
}

View File

@ -9,7 +9,6 @@ namespace MoonWorks.Graphics
public uint Depth;
public bool IsCube;
public uint LevelCount;
public SampleCount SampleCount;
public TextureFormat Format;
public TextureUsageFlags UsageFlags;
@ -22,7 +21,6 @@ namespace MoonWorks.Graphics
depth = Depth,
isCube = Conversions.BoolToByte(IsCube),
levelCount = LevelCount,
sampleCount = (Refresh.SampleCount) SampleCount,
format = (Refresh.TextureFormat) Format,
usageFlags = (Refresh.TextureUsageFlags) UsageFlags
};