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_RENDERPASSENCODER_H_
|
|
|
|
#define DAWNNATIVE_RENDERPASSENCODER_H_
|
|
|
|
|
|
|
|
#include "dawn_native/Error.h"
|
2019-07-20 01:34:56 +00:00
|
|
|
#include "dawn_native/RenderEncoderBase.h"
|
2018-09-21 00:24:37 +00:00
|
|
|
|
|
|
|
namespace dawn_native {
|
|
|
|
|
2019-08-13 22:12:54 +00:00
|
|
|
class RenderBundleBase;
|
|
|
|
|
2019-11-13 17:00:37 +00:00
|
|
|
class RenderPassEncoder final : public RenderEncoderBase {
|
2018-09-21 00:24:37 +00:00
|
|
|
public:
|
2019-11-13 17:00:37 +00:00
|
|
|
RenderPassEncoder(DeviceBase* device,
|
|
|
|
CommandEncoder* commandEncoder,
|
2019-11-21 22:09:41 +00:00
|
|
|
EncodingContext* encodingContext,
|
2020-10-11 18:39:32 +00:00
|
|
|
PassResourceUsageTracker usageTracker,
|
|
|
|
uint32_t renderTargetWidth,
|
|
|
|
uint32_t renderTargetHeight);
|
2018-09-21 00:24:37 +00:00
|
|
|
|
2019-11-13 17:00:37 +00:00
|
|
|
static RenderPassEncoder* MakeError(DeviceBase* device,
|
|
|
|
CommandEncoder* commandEncoder,
|
|
|
|
EncodingContext* encodingContext);
|
2019-03-05 01:02:47 +00:00
|
|
|
|
2019-07-20 01:34:56 +00:00
|
|
|
void EndPass();
|
2018-09-21 00:24:37 +00:00
|
|
|
|
|
|
|
void SetStencilReference(uint32_t reference);
|
2019-02-05 12:13:10 +00:00
|
|
|
void SetBlendColor(const Color* color);
|
2019-07-04 15:30:59 +00:00
|
|
|
void SetViewport(float x,
|
|
|
|
float y,
|
|
|
|
float width,
|
|
|
|
float height,
|
|
|
|
float minDepth,
|
|
|
|
float maxDepth);
|
2018-09-21 00:24:37 +00:00
|
|
|
void SetScissorRect(uint32_t x, uint32_t y, uint32_t width, uint32_t height);
|
2019-08-13 22:12:54 +00:00
|
|
|
void ExecuteBundles(uint32_t count, RenderBundleBase* const* renderBundles);
|
2018-09-21 00:24:37 +00:00
|
|
|
|
2020-07-01 10:48:16 +00:00
|
|
|
void WriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex);
|
|
|
|
|
2019-03-05 01:02:47 +00:00
|
|
|
protected:
|
2019-11-13 17:00:37 +00:00
|
|
|
RenderPassEncoder(DeviceBase* device,
|
|
|
|
CommandEncoder* commandEncoder,
|
|
|
|
EncodingContext* encodingContext,
|
|
|
|
ErrorTag errorTag);
|
2019-07-24 18:15:24 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// For render and compute passes, the encoding context is borrowed from the command encoder.
|
|
|
|
// Keep a reference to the encoder to make sure the context isn't freed.
|
2019-11-13 17:00:37 +00:00
|
|
|
Ref<CommandEncoder> mCommandEncoder;
|
2020-10-11 18:39:32 +00:00
|
|
|
|
|
|
|
uint32_t mRenderTargetWidth;
|
|
|
|
uint32_t mRenderTargetHeight;
|
2018-09-21 00:24:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dawn_native
|
|
|
|
|
|
|
|
#endif // DAWNNATIVE_RENDERPASSENCODER_H_
|