Add row pitch to Texture->Buffer and Buffer->Texture copy commands
This commit is contained in:
parent
c100ca7b3f
commit
359acd6e95
|
@ -278,6 +278,7 @@
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "buffer", "type": "buffer"},
|
{"name": "buffer", "type": "buffer"},
|
||||||
{"name": "buffer offset", "type": "uint32_t"},
|
{"name": "buffer offset", "type": "uint32_t"},
|
||||||
|
{"name": "row pitch", "type": "uint32_t"},
|
||||||
{"name": "texture", "type": "texture"},
|
{"name": "texture", "type": "texture"},
|
||||||
{"name": "x", "type": "uint32_t"},
|
{"name": "x", "type": "uint32_t"},
|
||||||
{"name": "y", "type": "uint32_t"},
|
{"name": "y", "type": "uint32_t"},
|
||||||
|
@ -291,7 +292,6 @@
|
||||||
"Make pretty with Offset and Extents structures",
|
"Make pretty with Offset and Extents structures",
|
||||||
"Allow choosing the aspect (depth vs. stencil)?",
|
"Allow choosing the aspect (depth vs. stencil)?",
|
||||||
"Add these arguments too",
|
"Add these arguments too",
|
||||||
{"name": "row length", "type": "uint32_t"},
|
|
||||||
{"name": "image height", "type": "uint32_t"}
|
{"name": "image height", "type": "uint32_t"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -307,13 +307,13 @@
|
||||||
{"name": "depth", "type": "uint32_t"},
|
{"name": "depth", "type": "uint32_t"},
|
||||||
{"name": "level", "type": "uint32_t"},
|
{"name": "level", "type": "uint32_t"},
|
||||||
{"name": "buffer", "type": "buffer"},
|
{"name": "buffer", "type": "buffer"},
|
||||||
{"name": "buffer offset", "type": "uint32_t"}
|
{"name": "buffer offset", "type": "uint32_t"},
|
||||||
|
{"name": "row pitch", "type": "uint32_t"}
|
||||||
],
|
],
|
||||||
"TODO": [
|
"TODO": [
|
||||||
"Make pretty with Offset and Extents structures",
|
"Make pretty with Offset and Extents structures",
|
||||||
"Allow choosing the aspect (depth vs. stencil)?",
|
"Allow choosing the aspect (depth vs. stencil)?",
|
||||||
"Add these arguments too",
|
"Add these arguments too",
|
||||||
{"name": "row length", "type": "uint32_t"},
|
|
||||||
{"name": "image height", "type": "uint32_t"}
|
{"name": "image height", "type": "uint32_t"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -630,7 +630,7 @@ namespace backend {
|
||||||
copy->size = size;
|
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,
|
TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
|
||||||
uint32_t width, uint32_t height, uint32_t depth, uint32_t level) {
|
uint32_t width, uint32_t height, uint32_t depth, uint32_t level) {
|
||||||
CopyBufferToTextureCmd* copy = allocator.Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture);
|
CopyBufferToTextureCmd* copy = allocator.Allocate<CopyBufferToTextureCmd>(Command::CopyBufferToTexture);
|
||||||
|
@ -645,11 +645,12 @@ namespace backend {
|
||||||
copy->destination.height = height;
|
copy->destination.height = height;
|
||||||
copy->destination.depth = depth;
|
copy->destination.depth = depth;
|
||||||
copy->destination.level = level;
|
copy->destination.level = level;
|
||||||
|
copy->rowPitch = rowPitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBufferBuilder::CopyTextureToBuffer(TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
|
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,
|
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);
|
CopyTextureToBufferCmd* copy = allocator.Allocate<CopyTextureToBufferCmd>(Command::CopyTextureToBuffer);
|
||||||
new(copy) CopyTextureToBufferCmd;
|
new(copy) CopyTextureToBufferCmd;
|
||||||
copy->source.texture = texture;
|
copy->source.texture = texture;
|
||||||
|
@ -662,6 +663,7 @@ namespace backend {
|
||||||
copy->source.level = level;
|
copy->source.level = level;
|
||||||
copy->destination.buffer = buffer;
|
copy->destination.buffer = buffer;
|
||||||
copy->destination.offset = bufferOffset;
|
copy->destination.offset = bufferOffset;
|
||||||
|
copy->rowPitch = rowPitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBufferBuilder::Dispatch(uint32_t x, uint32_t y, uint32_t z) {
|
void CommandBufferBuilder::Dispatch(uint32_t x, uint32_t y, uint32_t z) {
|
||||||
|
|
|
@ -65,12 +65,12 @@ namespace backend {
|
||||||
void BeginRenderPass(RenderPassBase* renderPass, FramebufferBase* framebuffer);
|
void BeginRenderPass(RenderPassBase* renderPass, FramebufferBase* framebuffer);
|
||||||
void BeginRenderSubpass();
|
void BeginRenderSubpass();
|
||||||
void CopyBufferToBuffer(BufferBase* source, uint32_t sourceOffset, BufferBase* destination, uint32_t destinationOffset, uint32_t size);
|
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,
|
TextureBase* texture, uint32_t x, uint32_t y, uint32_t z,
|
||||||
uint32_t width, uint32_t height, uint32_t depth, uint32_t level);
|
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,
|
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,
|
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 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 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);
|
void DrawElements(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstIndex, uint32_t firstInstance);
|
||||||
|
|
|
@ -83,11 +83,13 @@ namespace backend {
|
||||||
struct CopyBufferToTextureCmd {
|
struct CopyBufferToTextureCmd {
|
||||||
BufferCopyLocation source;
|
BufferCopyLocation source;
|
||||||
TextureCopyLocation destination;
|
TextureCopyLocation destination;
|
||||||
|
uint32_t rowPitch;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CopyTextureToBufferCmd {
|
struct CopyTextureToBufferCmd {
|
||||||
TextureCopyLocation source;
|
TextureCopyLocation source;
|
||||||
BufferCopyLocation destination;
|
BufferCopyLocation destination;
|
||||||
|
uint32_t rowPitch;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DispatchCmd {
|
struct DispatchCmd {
|
||||||
|
|
Loading…
Reference in New Issue