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 #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfo.Texture.SampleCount; currentSampleCount = colorAttachmentInfo.SampleCount;
colorFormatOne = colorAttachmentInfo.Texture.Format; colorFormatOne = colorAttachmentInfo.Texture.Format;
#endif #endif
} }
@ -111,7 +111,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount; currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format; colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format; colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
#endif #endif
@ -159,7 +159,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount; currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format; colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format; colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format; colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -215,7 +215,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount; currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format; colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format; colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format; colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -285,7 +285,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfo.Texture.SampleCount; currentSampleCount = colorAttachmentInfo.SampleCount;
colorFormatOne = colorAttachmentInfo.Texture.Format; colorFormatOne = colorAttachmentInfo.Texture.Format;
depthStencilFormat = depthStencilAttachmentInfo.Texture.Format; depthStencilFormat = depthStencilAttachmentInfo.Texture.Format;
#endif #endif
@ -332,7 +332,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount; currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format; colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format; colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
depthStencilFormat = depthStencilAttachmentInfo.Texture.Format; depthStencilFormat = depthStencilAttachmentInfo.Texture.Format;
@ -387,7 +387,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount; currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format; colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format; colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format; colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -450,7 +450,7 @@ namespace MoonWorks.Graphics
#if DEBUG #if DEBUG
renderPassActive = true; renderPassActive = true;
currentSampleCount = colorAttachmentInfoOne.Texture.SampleCount; currentSampleCount = colorAttachmentInfoOne.SampleCount;
colorFormatOne = colorAttachmentInfoOne.Texture.Format; colorFormatOne = colorAttachmentInfoOne.Texture.Format;
colorFormatTwo = colorAttachmentInfoTwo.Texture.Format; colorFormatTwo = colorAttachmentInfoTwo.Texture.Format;
colorFormatThree = colorAttachmentInfoThree.Texture.Format; colorFormatThree = colorAttachmentInfoThree.Texture.Format;
@ -1489,6 +1489,7 @@ namespace MoonWorks.Graphics
/// <summary> /// <summary>
/// Draws using instanced rendering. /// Draws using instanced rendering.
/// It is an error to call this method unless two vertex buffers have been bound.
/// </summary> /// </summary>
/// <param name="baseVertex">The starting index offset for the vertex buffer.</param> /// <param name="baseVertex">The starting index offset for the vertex buffer.</param>
/// <param name="startIndex">The starting index offset for the index 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) 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!"); 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 Depth;
public uint Layer; public uint Layer;
public uint Level; public uint Level;
public SampleCount SampleCount;
public Color ClearColor; public Color ClearColor;
public LoadOp LoadOp; public LoadOp LoadOp;
public StoreOp StoreOp; public StoreOp StoreOp;
@ -188,12 +189,15 @@ namespace MoonWorks.Graphics
public ColorAttachmentInfo( public ColorAttachmentInfo(
Texture texture, Texture texture,
Color clearColor, Color clearColor,
SampleCount sampleCount = SampleCount.One,
StoreOp storeOp = StoreOp.Store StoreOp storeOp = StoreOp.Store
) { )
{
Texture = texture; Texture = texture;
Depth = 0; Depth = 0;
Layer = 0; Layer = 0;
Level = 0; Level = 0;
SampleCount = sampleCount;
ClearColor = clearColor; ClearColor = clearColor;
LoadOp = LoadOp.Clear; LoadOp = LoadOp.Clear;
StoreOp = storeOp; StoreOp = storeOp;
@ -202,12 +206,15 @@ namespace MoonWorks.Graphics
public ColorAttachmentInfo( public ColorAttachmentInfo(
Texture texture, Texture texture,
LoadOp loadOp = LoadOp.DontCare, LoadOp loadOp = LoadOp.DontCare,
SampleCount sampleCount = SampleCount.One,
StoreOp storeOp = StoreOp.Store StoreOp storeOp = StoreOp.Store
) { )
{
Texture = texture; Texture = texture;
Depth = 0; Depth = 0;
Layer = 0; Layer = 0;
Level = 0; Level = 0;
SampleCount = sampleCount;
ClearColor = Color.White; ClearColor = Color.White;
LoadOp = loadOp; LoadOp = loadOp;
StoreOp = storeOp; StoreOp = storeOp;
@ -221,6 +228,7 @@ namespace MoonWorks.Graphics
depth = Depth, depth = Depth,
layer = Layer, layer = Layer,
level = Level, level = Level,
sampleCount = (Refresh.SampleCount) SampleCount,
clearColor = new Refresh.Vec4 clearColor = new Refresh.Vec4
{ {
x = ClearColor.R / 255f, x = ClearColor.R / 255f,

View File

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

View File

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