src/dawn_native/CommandEncoder.cpp
ComputePassEncoder* CommandEncoder::BeginComputePass(const ComputePassDescriptor* descriptor) {
        DeviceBase* device = GetDevice();

        bool success =
            mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
                DAWN_TRY(ValidateComputePassDescriptor(device, descriptor));

                allocator->Allocate<BeginComputePassCmd>(Command::BeginComputePass);

                return {};
            });

        if (success) {
            ComputePassEncoder* passEncoder =
                new ComputePassEncoder(device, this, &mEncodingContext);
            mEncodingContext.EnterPass(passEncoder);
            return passEncoder;
        }

        return ComputePassEncoder::MakeError(device, this, &mEncodingContext);
    }
// Implementation of the API's command recording methods
Implementation of the API's command recording methods
Implementation of the API ' s command recording methods
ComputePassEncoder* CommandEncoder::BeginComputePass(const ComputePassDescriptor* descriptor) {
        DeviceBase* device = GetDevice();
        bool success =
            mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
                DAWN_TRY(ValidateComputePassDescriptor(device, descriptor));
                allocator->Allocate<BeginComputePassCmd>(Command::BeginComputePass);
                return {};
            });
        if (success) {
            ComputePassEncoder* passEncoder =
                new ComputePassEncoder(device, this, &mEncodingContext);
            mEncodingContext.EnterPass(passEncoder);
            return passEncoder;
        }
        return ComputePassEncoder::MakeError(device, this, &mEncodingContext);
    }
ComputePassEncoder * CommandEncoder :: BeginComputePass ( const ComputePassDescriptor * descriptor ) { DeviceBase * device = GetDevice ( ) ; bool success = mEncodingContext . TryEncode ( this , [ & ] ( CommandAllocator * allocator ) -> MaybeError { DAWN_TRY ( ValidateComputePassDescriptor ( device , descriptor ) ) ; allocator -> Allocate < BeginComputePassCmd > ( Command :: BeginComputePass ) ; return { } ; } ) ; if ( success ) { ComputePassEncoder * passEncoder = new ComputePassEncoder ( device , this , & mEncodingContext ) ; mEncodingContext . EnterPass ( passEncoder ) ; return passEncoder ; } return ComputePassEncoder :: MakeError ( device , this , & mEncodingContext ) ; }
Implementation of the API's command recording methods
Implementation of the API ' s command recording methods