mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[dxvk] Add source offset/extent to copyPackedBufferToDepthStencilImage
This commit is contained in:
parent
a14884c652
commit
f50c5234dc
@ -1249,7 +1249,10 @@ namespace dxvk {
|
|||||||
VkOffset2D { cDstOffset.x, cDstOffset.y },
|
VkOffset2D { cDstOffset.x, cDstOffset.y },
|
||||||
VkExtent2D { cDstExtent.width, cDstExtent.height },
|
VkExtent2D { cDstExtent.width, cDstExtent.height },
|
||||||
cStagingSlice.buffer(),
|
cStagingSlice.buffer(),
|
||||||
cStagingSlice.offset(), cPackedFormat);
|
cStagingSlice.offset(),
|
||||||
|
VkOffset2D { 0, 0 },
|
||||||
|
VkExtent2D { cDstExtent.width, cDstExtent.height },
|
||||||
|
cPackedFormat);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -370,7 +370,10 @@ namespace dxvk {
|
|||||||
VkOffset2D { dstOffset.x, dstOffset.y },
|
VkOffset2D { dstOffset.x, dstOffset.y },
|
||||||
VkExtent2D { dstExtent.width, dstExtent.height },
|
VkExtent2D { dstExtent.width, dstExtent.height },
|
||||||
cStagingSlice.buffer(),
|
cStagingSlice.buffer(),
|
||||||
cStagingSlice.offset(), cPackedFormat);
|
cStagingSlice.offset(),
|
||||||
|
VkOffset2D { dstOffset.x, dstOffset.y },
|
||||||
|
VkExtent2D { dstExtent.width, dstExtent.height },
|
||||||
|
cPackedFormat);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -529,7 +529,10 @@ namespace dxvk {
|
|||||||
cDstImage, cDstLayers,
|
cDstImage, cDstLayers,
|
||||||
VkOffset2D { 0, 0 },
|
VkOffset2D { 0, 0 },
|
||||||
VkExtent2D { cDstLevelExtent.width, cDstLevelExtent.height },
|
VkExtent2D { cDstLevelExtent.width, cDstLevelExtent.height },
|
||||||
cSrcBuffer, 0, cPackedFormat);
|
cSrcBuffer, 0,
|
||||||
|
VkOffset2D { 0, 0 },
|
||||||
|
VkExtent2D { cDstLevelExtent.width, cDstLevelExtent.height },
|
||||||
|
cPackedFormat);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1239,7 +1239,9 @@ namespace dxvk {
|
|||||||
VkOffset2D dstOffset,
|
VkOffset2D dstOffset,
|
||||||
VkExtent2D dstExtent,
|
VkExtent2D dstExtent,
|
||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const Rc<DxvkBuffer>& srcBuffer,
|
||||||
VkDeviceSize srcOffset,
|
VkDeviceSize srcBufferOffset,
|
||||||
|
VkOffset2D srcOffset,
|
||||||
|
VkExtent2D srcExtent,
|
||||||
VkFormat format) {
|
VkFormat format) {
|
||||||
this->spillRenderPass(true);
|
this->spillRenderPass(true);
|
||||||
this->prepareImage(m_execBarriers, dstImage, vk::makeSubresourceRange(dstSubresource));
|
this->prepareImage(m_execBarriers, dstImage, vk::makeSubresourceRange(dstSubresource));
|
||||||
@ -1311,15 +1313,17 @@ namespace dxvk {
|
|||||||
DxvkMetaUnpackDescriptors descriptors;
|
DxvkMetaUnpackDescriptors descriptors;
|
||||||
descriptors.dstDepth = tmpBufferViewD->handle();
|
descriptors.dstDepth = tmpBufferViewD->handle();
|
||||||
descriptors.dstStencil = tmpBufferViewS->handle();
|
descriptors.dstStencil = tmpBufferViewS->handle();
|
||||||
descriptors.srcBuffer = srcBuffer->getDescriptor(srcOffset, VK_WHOLE_SIZE).buffer;
|
descriptors.srcBuffer = srcBuffer->getDescriptor(srcBufferOffset, VK_WHOLE_SIZE).buffer;
|
||||||
|
|
||||||
VkDescriptorSet dset = allocateDescriptorSet(pipeInfo.dsetLayout);
|
VkDescriptorSet dset = allocateDescriptorSet(pipeInfo.dsetLayout);
|
||||||
m_cmd->updateDescriptorSetWithTemplate(dset, pipeInfo.dsetTemplate, &descriptors);
|
m_cmd->updateDescriptorSetWithTemplate(dset, pipeInfo.dsetTemplate, &descriptors);
|
||||||
|
|
||||||
// Unpack the source buffer to temporary buffers
|
// Unpack the source buffer to temporary buffers
|
||||||
DxvkMetaUnpackArgs args;
|
DxvkMetaPackArgs args;
|
||||||
|
args.srcOffset = srcOffset;
|
||||||
|
args.srcExtent = srcExtent;
|
||||||
|
args.dstOffset = VkOffset2D { 0, 0 };
|
||||||
args.dstExtent = dstExtent;
|
args.dstExtent = dstExtent;
|
||||||
args.srcExtent = dstExtent;
|
|
||||||
|
|
||||||
m_cmd->cmdBindPipeline(
|
m_cmd->cmdBindPipeline(
|
||||||
VK_PIPELINE_BIND_POINT_COMPUTE,
|
VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||||
@ -2293,7 +2297,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
copyPackedBufferToDepthStencilImage(
|
copyPackedBufferToDepthStencilImage(
|
||||||
image, subresources, imageOffset, imageExtent,
|
image, subresources, imageOffset, imageExtent,
|
||||||
tmpBuffer, 0, format);
|
tmpBuffer, 0, VkOffset2D { 0, 0 }, imageExtent,
|
||||||
|
format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -487,7 +487,9 @@ namespace dxvk {
|
|||||||
* \param [in] dstOffset Image area offset
|
* \param [in] dstOffset Image area offset
|
||||||
* \param [in] dstExtent Image area size
|
* \param [in] dstExtent Image area size
|
||||||
* \param [in] srcBuffer Packed data buffer
|
* \param [in] srcBuffer Packed data buffer
|
||||||
* \param [in] srcOffset Packed data offset
|
* \param [in] srcBufferOffset Buffer offset of source image
|
||||||
|
* \param [in] srcOffset Offset into the source image
|
||||||
|
* \param [in] srcExtent Total size of the source image
|
||||||
* \param [in] format Packed data format
|
* \param [in] format Packed data format
|
||||||
*/
|
*/
|
||||||
void copyPackedBufferToDepthStencilImage(
|
void copyPackedBufferToDepthStencilImage(
|
||||||
@ -496,7 +498,9 @@ namespace dxvk {
|
|||||||
VkOffset2D dstOffset,
|
VkOffset2D dstOffset,
|
||||||
VkExtent2D dstExtent,
|
VkExtent2D dstExtent,
|
||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const Rc<DxvkBuffer>& srcBuffer,
|
||||||
VkDeviceSize srcOffset,
|
VkDeviceSize srcBufferOffset,
|
||||||
|
VkOffset2D srcOffset,
|
||||||
|
VkExtent2D srcExtent,
|
||||||
VkFormat format);
|
VkFormat format);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,7 @@ namespace dxvk {
|
|||||||
m_dsetLayoutPack (createPackDescriptorSetLayout()),
|
m_dsetLayoutPack (createPackDescriptorSetLayout()),
|
||||||
m_dsetLayoutUnpack(createUnpackDescriptorSetLayout()),
|
m_dsetLayoutUnpack(createUnpackDescriptorSetLayout()),
|
||||||
m_pipeLayoutPack (createPipelineLayout(m_dsetLayoutPack, sizeof(DxvkMetaPackArgs))),
|
m_pipeLayoutPack (createPipelineLayout(m_dsetLayoutPack, sizeof(DxvkMetaPackArgs))),
|
||||||
m_pipeLayoutUnpack(createPipelineLayout(m_dsetLayoutUnpack, sizeof(DxvkMetaUnpackArgs))),
|
m_pipeLayoutUnpack(createPipelineLayout(m_dsetLayoutUnpack, sizeof(DxvkMetaPackArgs))),
|
||||||
m_templatePack (createPackDescriptorUpdateTemplate()),
|
m_templatePack (createPackDescriptorUpdateTemplate()),
|
||||||
m_templateUnpack (createUnpackDescriptorUpdateTemplate()),
|
m_templateUnpack (createUnpackDescriptorUpdateTemplate()),
|
||||||
m_pipePackD24S8 (createPipeline(m_pipeLayoutPack, dxvk_pack_d24s8)),
|
m_pipePackD24S8 (createPipeline(m_pipeLayoutPack, dxvk_pack_d24s8)),
|
||||||
|
@ -21,18 +21,6 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Unpacking arguments
|
|
||||||
*
|
|
||||||
* Passed in as push constants
|
|
||||||
* to the compute shader.
|
|
||||||
*/
|
|
||||||
struct DxvkMetaUnpackArgs {
|
|
||||||
VkExtent2D dstExtent;
|
|
||||||
VkExtent2D srcExtent;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Packing pipeline
|
* \brief Packing pipeline
|
||||||
*
|
*
|
||||||
|
@ -15,19 +15,24 @@ readonly buffer s_buffer_t {
|
|||||||
|
|
||||||
layout(push_constant)
|
layout(push_constant)
|
||||||
uniform u_info_t {
|
uniform u_info_t {
|
||||||
uvec2 dst_extent;
|
uvec2 src_offset;
|
||||||
uvec2 src_extent;
|
uvec2 src_extent;
|
||||||
|
uvec2 dst_offset;
|
||||||
|
uvec2 dst_extent;
|
||||||
} u_info;
|
} u_info;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
|
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
|
||||||
uint src_index = gl_GlobalInvocationID.x
|
uvec3 src_coord = uvec3(
|
||||||
+ gl_GlobalInvocationID.y * u_info.src_extent.x
|
gl_GlobalInvocationID.xy + u_info.src_offset,
|
||||||
+ gl_GlobalInvocationID.z * u_info.src_extent.y;
|
gl_GlobalInvocationID.z);
|
||||||
|
|
||||||
uint dst_index = gl_GlobalInvocationID.x
|
uvec3 dst_coord = uvec3(
|
||||||
+ gl_GlobalInvocationID.y * u_info.dst_extent.x
|
gl_GlobalInvocationID.xy + u_info.dst_offset,
|
||||||
+ gl_GlobalInvocationID.z * u_info.dst_extent.y;
|
gl_GlobalInvocationID.z);
|
||||||
|
|
||||||
|
uint src_index = src_coord.x + u_info.src_extent.x * (src_coord.y + u_info.src_extent.y * src_coord.z);
|
||||||
|
uint dst_index = dst_coord.x + u_info.dst_extent.x * (dst_coord.y + u_info.dst_extent.y * dst_coord.z);
|
||||||
|
|
||||||
uint src_data = s_buffer.data[src_index];
|
uint src_data = s_buffer.data[src_index];
|
||||||
imageStore(u_depth, int(dst_index), uvec4(src_data & 0xFFFFFF));
|
imageStore(u_depth, int(dst_index), uvec4(src_data & 0xFFFFFF));
|
||||||
|
@ -15,19 +15,24 @@ readonly buffer s_buffer_t {
|
|||||||
|
|
||||||
layout(push_constant)
|
layout(push_constant)
|
||||||
uniform u_info_t {
|
uniform u_info_t {
|
||||||
uvec2 dst_extent;
|
uvec2 src_offset;
|
||||||
uvec2 src_extent;
|
uvec2 src_extent;
|
||||||
|
uvec2 dst_offset;
|
||||||
|
uvec2 dst_extent;
|
||||||
} u_info;
|
} u_info;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
|
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
|
||||||
uint src_index = gl_GlobalInvocationID.x
|
uvec3 src_coord = uvec3(
|
||||||
+ gl_GlobalInvocationID.y * u_info.src_extent.x
|
gl_GlobalInvocationID.xy + u_info.src_offset,
|
||||||
+ gl_GlobalInvocationID.z * u_info.src_extent.y;
|
gl_GlobalInvocationID.z);
|
||||||
|
|
||||||
uint dst_index = gl_GlobalInvocationID.x
|
uvec3 dst_coord = uvec3(
|
||||||
+ gl_GlobalInvocationID.y * u_info.dst_extent.x
|
gl_GlobalInvocationID.xy + u_info.dst_offset,
|
||||||
+ gl_GlobalInvocationID.z * u_info.dst_extent.y;
|
gl_GlobalInvocationID.z);
|
||||||
|
|
||||||
|
uint src_index = src_coord.x + u_info.src_extent.x * (src_coord.y + u_info.src_extent.y * src_coord.z);
|
||||||
|
uint dst_index = dst_coord.x + u_info.dst_extent.x * (dst_coord.y + u_info.dst_extent.y * dst_coord.z);
|
||||||
|
|
||||||
uint src_data = s_buffer.data[src_index];
|
uint src_data = s_buffer.data[src_index];
|
||||||
imageStore(u_depth, int(dst_index), vec4(float(src_data & 0xFFFFFF) / float(0xFFFFFF)));
|
imageStore(u_depth, int(dst_index), vec4(float(src_data & 0xFFFFFF) / float(0xFFFFFF)));
|
||||||
|
@ -20,19 +20,24 @@ readonly buffer s_buffer_t {
|
|||||||
|
|
||||||
layout(push_constant)
|
layout(push_constant)
|
||||||
uniform u_info_t {
|
uniform u_info_t {
|
||||||
uvec2 dst_extent;
|
uvec2 src_offset;
|
||||||
uvec2 src_extent;
|
uvec2 src_extent;
|
||||||
|
uvec2 dst_offset;
|
||||||
|
uvec2 dst_extent;
|
||||||
} u_info;
|
} u_info;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
|
if (all(lessThan(gl_GlobalInvocationID.xy, u_info.dst_extent))) {
|
||||||
uint src_index = gl_GlobalInvocationID.x
|
uvec3 src_coord = uvec3(
|
||||||
+ gl_GlobalInvocationID.y * u_info.src_extent.x
|
gl_GlobalInvocationID.xy + u_info.src_offset,
|
||||||
+ gl_GlobalInvocationID.z * u_info.src_extent.y;
|
gl_GlobalInvocationID.z);
|
||||||
|
|
||||||
uint dst_index = gl_GlobalInvocationID.x
|
uvec3 dst_coord = uvec3(
|
||||||
+ gl_GlobalInvocationID.y * u_info.dst_extent.x
|
gl_GlobalInvocationID.xy + u_info.dst_offset,
|
||||||
+ gl_GlobalInvocationID.z * u_info.dst_extent.y;
|
gl_GlobalInvocationID.z);
|
||||||
|
|
||||||
|
uint src_index = src_coord.x + u_info.src_extent.x * (src_coord.y + u_info.src_extent.y * src_coord.z);
|
||||||
|
uint dst_index = dst_coord.x + u_info.dst_extent.x * (dst_coord.y + u_info.dst_extent.y * dst_coord.z);
|
||||||
|
|
||||||
d32s8_t src_data = s_buffer.data[src_index];
|
d32s8_t src_data = s_buffer.data[src_index];
|
||||||
imageStore(u_depth, int(dst_index), vec4(src_data.d32));
|
imageStore(u_depth, int(dst_index), vec4(src_data.d32));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user