misc fixes
parent
8813a0139d
commit
ee8331a96b
|
@ -1388,18 +1388,19 @@ namespace MoonWorks.Graphics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="writeOption">Specifies data dependency behavior.</param>
|
/// <param name="writeOption">Specifies data dependency behavior.</param>
|
||||||
public void Blit(
|
public void Blit(
|
||||||
TextureSlice source,
|
TextureRegion source,
|
||||||
TextureSlice destination,
|
TextureRegion destination,
|
||||||
Filter filter,
|
Filter filter,
|
||||||
WriteOptions writeOption
|
WriteOptions writeOption
|
||||||
) {
|
) {
|
||||||
var sampler = filter == Filter.Linear ? Device.LinearSampler : Device.PointSampler;
|
var sampler = filter == Filter.Linear ? Device.LinearSampler : Device.PointSampler;
|
||||||
|
|
||||||
// FIXME: this will break with non-2D textures
|
// FIXME: this will break with non-2D textures
|
||||||
// FIXME: this should take a TextureRegion
|
// FIXME: the source texture region does nothing right now
|
||||||
BeginRenderPass(new ColorAttachmentInfo(destination, writeOption));
|
BeginRenderPass(new ColorAttachmentInfo(destination.TextureSlice, writeOption));
|
||||||
|
SetViewport(new Viewport(destination.X, destination.Y, destination.Width, destination.Height));
|
||||||
BindGraphicsPipeline(Device.BlitPipeline);
|
BindGraphicsPipeline(Device.BlitPipeline);
|
||||||
BindFragmentSamplers(new TextureSamplerBinding(source.Texture, sampler));
|
BindFragmentSamplers(new TextureSamplerBinding(source.TextureSlice.Texture, sampler));
|
||||||
DrawPrimitives(0, 2);
|
DrawPrimitives(0, 2);
|
||||||
EndRenderPass();
|
EndRenderPass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,8 +127,10 @@ namespace MoonWorks.Graphics.Font
|
||||||
TransferBuffer.SetData(vertexSpan, TransferOptions.Cycle);
|
TransferBuffer.SetData(vertexSpan, TransferOptions.Cycle);
|
||||||
TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Unsafe);
|
TransferBuffer.SetData(indexSpan, (uint) vertexSpan.Length, TransferOptions.Unsafe);
|
||||||
|
|
||||||
|
commandBuffer.BeginCopyPass();
|
||||||
commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), WriteOptions.Cycle);
|
commandBuffer.UploadToBuffer(TransferBuffer, VertexBuffer, new BufferCopy(0, 0, (uint) vertexSpan.Length), WriteOptions.Cycle);
|
||||||
commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), WriteOptions.Cycle);
|
commandBuffer.UploadToBuffer(TransferBuffer, IndexBuffer, new BufferCopy((uint) vertexSpan.Length, 0, (uint) indexSpan.Length), WriteOptions.Cycle);
|
||||||
|
commandBuffer.EndCopyPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
PrimitiveCount = vertexCount / 2;
|
PrimitiveCount = vertexCount / 2;
|
||||||
|
|
|
@ -386,6 +386,24 @@ namespace MoonWorks.Graphics
|
||||||
WriteOption = writeOption;
|
WriteOption = writeOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DepthStencilAttachmentInfo(
|
||||||
|
TextureSlice textureSlice,
|
||||||
|
WriteOptions writeOption,
|
||||||
|
DepthStencilValue clearValue,
|
||||||
|
LoadOp loadOp,
|
||||||
|
StoreOp storeOp,
|
||||||
|
LoadOp stencilLoadOp,
|
||||||
|
StoreOp stencilStoreOp
|
||||||
|
) {
|
||||||
|
TextureSlice = textureSlice;
|
||||||
|
DepthStencilClearValue = clearValue;
|
||||||
|
LoadOp = loadOp;
|
||||||
|
StoreOp = storeOp;
|
||||||
|
StencilLoadOp = stencilLoadOp;
|
||||||
|
StencilStoreOp = stencilStoreOp;
|
||||||
|
WriteOption = writeOption;
|
||||||
|
}
|
||||||
|
|
||||||
public Refresh.DepthStencilAttachmentInfo ToRefresh()
|
public Refresh.DepthStencilAttachmentInfo ToRefresh()
|
||||||
{
|
{
|
||||||
return new Refresh.DepthStencilAttachmentInfo
|
return new Refresh.DepthStencilAttachmentInfo
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace MoonWorks.Graphics
|
||||||
uint resourceOffset;
|
uint resourceOffset;
|
||||||
fixed (T* dataPtr = data)
|
fixed (T* dataPtr = data)
|
||||||
{
|
{
|
||||||
resourceOffset = CopyTextureData(dataPtr, dataLengthInBytes, Texture.TexelSize(textureRegion.TextureSlice.Texture.Format));
|
resourceOffset = CopyTextureData(dataPtr, dataLengthInBytes, Texture.BytesPerPixel(textureRegion.TextureSlice.Texture.Format));
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureUploads.Add((textureRegion, resourceOffset, option));
|
TextureUploads.Add((textureRegion, resourceOffset, option));
|
||||||
|
|
Loading…
Reference in New Issue