| 1 |
/* |
| 2 |
* Copyright 2020 Google LLC |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef GrD3DOpsRenderPass_DEFINED |
| 9 |
#define GrD3DOpsRenderPass_DEFINED |
| 10 |
|
| 11 |
#include "src/gpu/ganesh/GrOpsRenderPass.h" |
| 12 |
|
| 13 |
#include "include/gpu/ganesh/GrTypes.h" |
| 14 |
#include "include/private/gpu/ganesh/GrTypesPriv.h" |
| 15 |
|
| 16 |
class GrD3DGpu; |
| 17 |
class GrD3DPipelineState; |
| 18 |
|
| 19 |
class GrD3DOpsRenderPass : public GrOpsRenderPass { |
| 20 |
public: |
| 21 |
GrD3DOpsRenderPass(GrD3DGpu*); |
| 22 |
|
| 23 |
~GrD3DOpsRenderPass() override; |
| 24 |
|
| 25 |
void inlineUpload(GrOpFlushState* state, GrDeferredTextureUploadFn& upload) override; |
| 26 |
|
| 27 |
void onExecuteDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler>) override {} |
| 28 |
|
| 29 |
bool set(GrRenderTarget*, GrSurfaceOrigin, const SkIRect& bounds, |
| 30 |
const GrOpsRenderPass::LoadAndStoreInfo&, |
| 31 |
const GrOpsRenderPass::StencilLoadAndStoreInfo&, |
| 32 |
const skia_private::TArray<GrSurfaceProxy*, true>& sampledProxies); |
| 33 |
|
| 34 |
void submit(); |
| 35 |
|
| 36 |
private: |
| 37 |
GrGpu* gpu() override; |
| 38 |
|
| 39 |
void onBegin() override; |
| 40 |
|
| 41 |
bool onBindPipeline(const GrProgramInfo&, const SkRect& drawBounds) override; |
| 42 |
void onSetScissorRect(const SkIRect&) override; |
| 43 |
bool onBindTextures(const GrGeometryProcessor&, |
| 44 |
const GrSurfaceProxy* const geomProcTextures[], |
| 45 |
const GrPipeline&) override; |
| 46 |
void onBindBuffers(sk_sp<const GrBuffer> indexBuffer, sk_sp<const GrBuffer> instanceBuffer, |
| 47 |
sk_sp<const GrBuffer> vertexBuffer, GrPrimitiveRestart) override; |
| 48 |
void onDraw(int vertexCount, int baseVertex) override { |
| 49 |
this->onDrawInstanced(1, 0, vertexCount, baseVertex); |
| 50 |
} |
| 51 |
void onDrawIndexed(int indexCount, int baseIndex, uint16_t minIndexValue, |
| 52 |
uint16_t maxIndexValue, int baseVertex) override { |
| 53 |
this->onDrawIndexedInstanced(indexCount, baseIndex, 1, 0, baseVertex); |
| 54 |
} |
| 55 |
void onDrawInstanced(int instanceCount, int baseInstance, int vertexCount, |
| 56 |
int baseVertex) override; |
| 57 |
void onDrawIndexedInstanced(int indexCount, int baseIndex, int instanceCount, int baseInstance, |
| 58 |
int baseVertex) override; |
| 59 |
void onDrawIndirect(const GrBuffer*, size_t offset, int drawCount) override; |
| 60 |
void onDrawIndexedIndirect(const GrBuffer*, size_t offset, int drawCount) override; |
| 61 |
|
| 62 |
void onClear(const GrScissorState& scissor, std::array<float, 4> color) override; |
| 63 |
|
| 64 |
void onClearStencilClip(const GrScissorState& scissor, bool insideStencilMask) override; |
| 65 |
|
| 66 |
GrD3DGpu* fGpu; |
| 67 |
|
| 68 |
GrD3DPipelineState* fCurrentPipelineState = nullptr; |
| 69 |
|
| 70 |
SkIRect fBounds; |
| 71 |
SkIRect fCurrentPipelineBounds; |
| 72 |
|
| 73 |
GrLoadOp fColorLoadOp; |
| 74 |
std::array<float, 4> fClearColor; |
| 75 |
GrLoadOp fStencilLoadOp; |
| 76 |
|
| 77 |
using INHERITED = GrOpsRenderPass; |
| 78 |
}; |
| 79 |
|
| 80 |
#endif |