dawn-cmake/src/dawn_native/ProgrammablePassEncoder.h
Jiawei Shao 64fcf3909a Allow one texture as write-only storage and sampled in one compute pass
This patch enables one texture to be used as both write-only storage
texture and sampled texture in one compute pass.

Note that while we don't need to check the usage scope of a texture in
the whole compute pass scope, we still need to verify one texture cannot
be bound to multiple bindings that are used in one dispatch at the same
time. This check will be added in the following patches.

This patch also adds tests to ensure a texture can be used as the
following binding types in one compute pass:
- read-only storage + sampled
- write-only storage + sampled
- read-only storage + write-only storage

BUG=dawn:267
TEST=dawn_unittests

Change-Id: Ibff2b005a5269a0bfa254e0417de4920758add39
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20120
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
2020-04-22 00:55:43 +00:00

60 lines
2.1 KiB
C++

// 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_
#include "dawn_native/CommandEncoder.h"
#include "dawn_native/Error.h"
#include "dawn_native/ObjectBase.h"
#include "dawn_native/PassResourceUsageTracker.h"
#include "dawn_native/dawn_platform.h"
namespace dawn_native {
class CommandAllocator;
class DeviceBase;
// Base class for shared functionality between ComputePassEncoder and RenderPassEncoder.
class ProgrammablePassEncoder : public ObjectBase {
public:
ProgrammablePassEncoder(DeviceBase* device,
EncodingContext* encodingContext,
PassType passType);
void InsertDebugMarker(const char* groupLabel);
void PopDebugGroup();
void PushDebugGroup(const char* groupLabel);
void SetBindGroup(uint32_t groupIndex,
BindGroupBase* group,
uint32_t dynamicOffsetCount,
const uint32_t* dynamicOffsets);
protected:
// Construct an "error" programmable pass encoder.
ProgrammablePassEncoder(DeviceBase* device,
EncodingContext* encodingContext,
ErrorTag errorTag,
PassType passType);
EncodingContext* mEncodingContext = nullptr;
PassResourceUsageTracker mUsageTracker;
};
} // namespace dawn_native
#endif // DAWNNATIVE_PROGRAMMABLEPASSENCODER_H_