mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 18:05:31 +00:00
Separate the types for compute and render pass usage data
This change is a preparation for making the compute pass track the synchronization scope usages per dispatch instead of for the whole pass. This CL just separates the Compute and RenderPassResourceUsage types. This requires making the difference between SyncScope/ComputePass/RenderPass ResourceUsageTracker instead of having a single combined tracker. This change also duplicates SetBindGroup by removing the common handling in ProgrammablePassEncoder and putting it in ComputePassEncoder and RenderEncoderBase. This is necessary because the UsageTracker types are now split, but it will also help have different handling of SetBindGroup for compute and render in follow-up CLs. There are no functional changes. Bug: dawn:632 Change-Id: I482c04483d8b734fb10e44e717071eedcff2f15f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/49884 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
d98b3076f5
commit
ec7ea6aaaa
@@ -27,15 +27,14 @@ namespace dawn_native {
|
||||
ComputePassEncoder::ComputePassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext)
|
||||
: ProgrammablePassEncoder(device, encodingContext, PassType::Compute),
|
||||
mCommandEncoder(commandEncoder) {
|
||||
: ProgrammablePassEncoder(device, encodingContext), mCommandEncoder(commandEncoder) {
|
||||
}
|
||||
|
||||
ComputePassEncoder::ComputePassEncoder(DeviceBase* device,
|
||||
CommandEncoder* commandEncoder,
|
||||
EncodingContext* encodingContext,
|
||||
ErrorTag errorTag)
|
||||
: ProgrammablePassEncoder(device, encodingContext, errorTag, PassType::Compute),
|
||||
: ProgrammablePassEncoder(device, encodingContext, errorTag),
|
||||
mCommandEncoder(commandEncoder) {
|
||||
}
|
||||
|
||||
@@ -55,8 +54,7 @@ namespace dawn_native {
|
||||
|
||||
return {};
|
||||
})) {
|
||||
mEncodingContext->ExitPass(this, mUsageTracker.AcquireResourceUsage(),
|
||||
PassType::Compute);
|
||||
mEncodingContext->ExitPass(this, mUsageTracker.AcquireResourceUsage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +132,29 @@ namespace dawn_native {
|
||||
});
|
||||
}
|
||||
|
||||
void ComputePassEncoder::APISetBindGroup(uint32_t groupIndexIn,
|
||||
BindGroupBase* group,
|
||||
uint32_t dynamicOffsetCount,
|
||||
const uint32_t* dynamicOffsets) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
BindGroupIndex groupIndex(groupIndexIn);
|
||||
|
||||
if (IsValidationEnabled()) {
|
||||
DAWN_TRY(
|
||||
ValidateSetBindGroup(groupIndex, group, dynamicOffsetCount, dynamicOffsets));
|
||||
}
|
||||
|
||||
RecordSetBindGroup(allocator, groupIndex, group, dynamicOffsetCount, dynamicOffsets);
|
||||
mCommandBufferState.SetBindGroup(groupIndex, group);
|
||||
|
||||
// TODO(dawn:632): This doesn't match the WebGPU specification. Instead the
|
||||
// synchronization scopes should be created on Dispatch().
|
||||
mUsageTracker.AddBindGroup(group);
|
||||
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
void ComputePassEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
||||
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
if (IsValidationEnabled()) {
|
||||
|
||||
Reference in New Issue
Block a user