2018-09-21 00:24:37 +00:00
|
|
|
// Copyright 2018 The Dawn Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
#ifndef DAWNNATIVE_PROGRAMMABLEPASSENCODER_H_
|
|
|
|
#define DAWNNATIVE_PROGRAMMABLEPASSENCODER_H_
|
|
|
|
|
2019-02-20 11:46:16 +00:00
|
|
|
#include "dawn_native/CommandEncoder.h"
|
2018-09-21 00:24:37 +00:00
|
|
|
#include "dawn_native/Error.h"
|
2018-10-15 12:54:30 +00:00
|
|
|
#include "dawn_native/ObjectBase.h"
|
2018-09-21 00:24:37 +00:00
|
|
|
|
|
|
|
#include "dawn_native/dawn_platform.h"
|
|
|
|
|
|
|
|
namespace dawn_native {
|
|
|
|
|
|
|
|
class CommandAllocator;
|
|
|
|
class DeviceBase;
|
|
|
|
|
|
|
|
// Base class for shared functionality between ComputePassEncoder and RenderPassEncoder.
|
2018-10-15 12:54:30 +00:00
|
|
|
class ProgrammablePassEncoder : public ObjectBase {
|
2018-09-21 00:24:37 +00:00
|
|
|
public:
|
|
|
|
ProgrammablePassEncoder(DeviceBase* device,
|
2019-02-20 11:46:16 +00:00
|
|
|
CommandEncoderBase* topLevelEncoder,
|
2018-09-21 00:24:37 +00:00
|
|
|
CommandAllocator* allocator);
|
|
|
|
|
|
|
|
void EndPass();
|
|
|
|
|
2019-02-20 20:21:00 +00:00
|
|
|
void InsertDebugMarker(const char* groupLabel);
|
|
|
|
void PopDebugGroup();
|
|
|
|
void PushDebugGroup(const char* groupLabel);
|
|
|
|
|
2019-03-18 06:01:37 +00:00
|
|
|
void SetBindGroup(uint32_t groupIndex,
|
|
|
|
BindGroupBase* group,
|
|
|
|
uint32_t dynamicOffsetCount,
|
|
|
|
const uint32_t* dynamicOffsets);
|
2018-09-21 00:24:37 +00:00
|
|
|
void SetPushConstants(dawn::ShaderStageBit stages,
|
|
|
|
uint32_t offset,
|
|
|
|
uint32_t count,
|
|
|
|
const void* data);
|
|
|
|
|
|
|
|
protected:
|
2019-03-05 01:02:47 +00:00
|
|
|
// Construct an "error" programmable pass encoder.
|
|
|
|
ProgrammablePassEncoder(DeviceBase* device,
|
|
|
|
CommandEncoderBase* topLevelEncoder,
|
|
|
|
ErrorTag errorTag);
|
|
|
|
|
2018-09-21 00:24:37 +00:00
|
|
|
MaybeError ValidateCanRecordCommands() const;
|
|
|
|
|
2019-02-20 11:46:16 +00:00
|
|
|
// The allocator is borrowed from the top level encoder. Keep a reference to the encoder
|
2018-09-21 00:24:37 +00:00
|
|
|
// to make sure the allocator isn't freed.
|
2019-02-20 11:46:16 +00:00
|
|
|
Ref<CommandEncoderBase> mTopLevelEncoder = nullptr;
|
2018-09-21 00:24:37 +00:00
|
|
|
// mAllocator is cleared at the end of the pass so it acts as a tag that EndPass was called
|
|
|
|
CommandAllocator* mAllocator = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dawn_native
|
|
|
|
|
|
|
|
#endif // DAWNNATIVE_PROGRAMMABLEPASSENCODER_H_
|