Add row pitch to Texture->Buffer and Buffer->Texture copy commands

This commit is contained in:
Austin Eng 2017-07-13 10:04:23 -04:00 committed by Austin Eng
parent c100ca7b3f
commit 359acd6e95
4 changed files with 11 additions and 7 deletions

View File

@ -278,6 +278,7 @@
"args": [
{"name": "buffer", "type": "buffer"},
{"name": "buffer offset", "type": "uint32_t"},
{"name": "row pitch", "type": "uint32_t"},
{"name": "texture", "type": "texture"},
{"name": "x", "type": "uint32_t"},
{"name": "y", "type": "uint32_t"},
@ -291,7 +292,6 @@
"Make pretty with Offset and Extents structures",
"Allow choosing the aspect (depth vs. stencil)?",
"Add these arguments too",
{"name": "row length", "type": "uint32_t"},
{"name": "image height", "type": "uint32_t"}
]
},
@ -307,13 +307,13 @@
{"name": "depth", "type": "uint32_t"},
{"name": "level", "type": "uint32_t"},
{"name": "buffer", "type": "buffer"},
{"name": "buffer offset", "type": "uint32_t"}
{"name": "buffer offset", "type": "uint32_t"},
{"name": "row pitch", "type": "uint32_t"}
],
"TODO": [
"Make pretty with Offset and Extents structures",
"Allow choosing the aspect (depth vs. stencil)?",
"Add these arguments too",
{"name": "row length", "type": "uint32_t"},
{"name": "image height", "type": "uint32_t"}
]
},

View File

@ -630,7 +630,7 @@ namespace backend {
copy->size = size;
}
void CommandBufferBuilder::CopyBufferToTexture(BufferBase* buffer, uint32_t bufferOffset,
void CommandBufferBuilder::CopyBufferToTexture(BufferBase* buffer, uint32_t bufferOffset, uint32_t rowPitch,
TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
uint32_t width, uint32_t height, uint32_t depth, uint32_t level) {
CopyBufferToTextureCmd* copy = allocator.Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture);
@ -645,11 +645,12 @@ namespace backend {
copy->destination.height = height;
copy->destination.depth = depth;
copy->destination.level = level;
copy->rowPitch = rowPitch;
}
void CommandBufferBuilder::CopyTextureToBuffer(TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
uint32_t width, uint32_t height, uint32_t depth, uint32_t level,
BufferBase* buffer, uint32_t bufferOffset) {
BufferBase* buffer, uint32_t bufferOffset, uint32_t rowPitch) {
CopyTextureToBufferCmd* copy = allocator.Allocate<CopyTextureToBufferCmd>(Command::CopyTextureToBuffer);
new(copy) CopyTextureToBufferCmd;
copy->source.texture = texture;
@ -662,6 +663,7 @@ namespace backend {
copy->source.level = level;
copy->destination.buffer = buffer;
copy->destination.offset = bufferOffset;
copy->rowPitch = rowPitch;
}
void CommandBufferBuilder::Dispatch(uint32_t x, uint32_t y, uint32_t z) {

View File

@ -65,12 +65,12 @@ namespace backend {
void BeginRenderPass(RenderPassBase* renderPass, FramebufferBase* framebuffer);
void BeginRenderSubpass();
void CopyBufferToBuffer(BufferBase* source, uint32_t sourceOffset, BufferBase* destination, uint32_t destinationOffset, uint32_t size);
void CopyBufferToTexture(BufferBase* buffer, uint32_t bufferOffset,
void CopyBufferToTexture(BufferBase* buffer, uint32_t bufferOffset, uint32_t rowPitch,
TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
uint32_t width, uint32_t height, uint32_t depth, uint32_t level);
void CopyTextureToBuffer(TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
uint32_t width, uint32_t height, uint32_t depth, uint32_t level,
BufferBase* buffer, uint32_t bufferOffset);
BufferBase* buffer, uint32_t bufferOffset, uint32_t rowPitch);
void Dispatch(uint32_t x, uint32_t y, uint32_t z);
void DrawArrays(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance);
void DrawElements(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstIndex, uint32_t firstInstance);

View File

@ -83,11 +83,13 @@ namespace backend {
struct CopyBufferToTextureCmd {
BufferCopyLocation source;
TextureCopyLocation destination;
uint32_t rowPitch;
};
struct CopyTextureToBufferCmd {
TextureCopyLocation source;
BufferCopyLocation destination;
uint32_t rowPitch;
};
struct DispatchCmd {