Dawn: update for GrGpuCommandBuffer -> GrOpsRenderPass change.
Change-Id: Ifbe4bcd40bcf316868d23c2edf73b2371c6cb312 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237119 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
parent
7c73d2c5ed
commit
ef2dc90172
@ -715,8 +715,8 @@ skia_dawn_sources = [
|
||||
"$_src/gpu/dawn/GrDawnCaps.h",
|
||||
"$_src/gpu/dawn/GrDawnGpu.cpp",
|
||||
"$_src/gpu/dawn/GrDawnGpu.h",
|
||||
"$_src/gpu/dawn/GrDawnGpuCommandBuffer.cpp",
|
||||
"$_src/gpu/dawn/GrDawnGpuCommandBuffer.h",
|
||||
"$_src/gpu/dawn/GrDawnOpsRenderPass.cpp",
|
||||
"$_src/gpu/dawn/GrDawnOpsRenderPass.h",
|
||||
"$_src/gpu/dawn/GrDawnProgramDataManager.cpp",
|
||||
"$_src/gpu/dawn/GrDawnProgramDataManager.h",
|
||||
"$_src/gpu/dawn/GrDawnProgramBuilder.cpp",
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
#include "src/gpu/dawn/GrDawnBuffer.h"
|
||||
#include "src/gpu/dawn/GrDawnCaps.h"
|
||||
#include "src/gpu/dawn/GrDawnGpuCommandBuffer.h"
|
||||
#include "src/gpu/dawn/GrDawnOpsRenderPass.h"
|
||||
#include "src/gpu/dawn/GrDawnRenderTarget.h"
|
||||
#include "src/gpu/dawn/GrDawnStencilAttachment.h"
|
||||
#include "src/gpu/dawn/GrDawnTexture.h"
|
||||
@ -64,18 +64,12 @@ void GrDawnGpu::disconnect(DisconnectType type) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrGpuRTCommandBuffer* GrDawnGpu::getCommandBuffer(
|
||||
GrOpsRenderPass* GrDawnGpu::getOpsRenderPass(
|
||||
GrRenderTarget* rt, GrSurfaceOrigin origin, const SkRect& bounds,
|
||||
const GrGpuRTCommandBuffer::LoadAndStoreInfo& colorInfo,
|
||||
const GrGpuRTCommandBuffer::StencilLoadAndStoreInfo& stencilInfo) {
|
||||
fRTCommandBuffer.reset(new GrDawnGpuRTCommandBuffer(this, rt, origin, colorInfo, stencilInfo));
|
||||
return fRTCommandBuffer.get();
|
||||
}
|
||||
|
||||
GrGpuTextureCommandBuffer* GrDawnGpu::getCommandBuffer(GrTexture* texture,
|
||||
GrSurfaceOrigin origin) {
|
||||
fTextureCommandBuffer.reset(new GrDawnGpuTextureCommandBuffer(this, texture, origin));
|
||||
return fTextureCommandBuffer.get();
|
||||
const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
|
||||
const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo) {
|
||||
fOpsRenderPass.reset(new GrDawnOpsRenderPass(this, rt, origin, colorInfo, stencilInfo));
|
||||
return fOpsRenderPass.get();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -512,14 +506,8 @@ bool GrDawnGpu::onRegenerateMipMapLevels(GrTexture*) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void GrDawnGpu::submit(GrGpuCommandBuffer* buffer) {
|
||||
if (buffer->asRTCommandBuffer()) {
|
||||
SkASSERT(fRTCommandBuffer.get() == buffer);
|
||||
fRTCommandBuffer->submit();
|
||||
} else {
|
||||
SkASSERT(fTextureCommandBuffer.get() == buffer);
|
||||
fTextureCommandBuffer->submit();
|
||||
}
|
||||
void GrDawnGpu::submit(GrOpsRenderPass* renderPass) {
|
||||
static_cast<GrDawnOpsRenderPass*>(renderPass)->submit();
|
||||
}
|
||||
|
||||
GrFence SK_WARN_UNUSED_RESULT GrDawnGpu::insertFence() {
|
||||
|
@ -12,9 +12,8 @@
|
||||
#include "dawn/dawncpp.h"
|
||||
#include "src/gpu/dawn/GrDawnRingBuffer.h"
|
||||
|
||||
class GrDawnOpsRenderPass;
|
||||
class GrPipeline;
|
||||
class GrDawnGpuRTCommandBuffer;
|
||||
class GrDawnGpuTextureCommandBuffer;
|
||||
|
||||
namespace SkSL {
|
||||
class Compiler;
|
||||
@ -57,18 +56,17 @@ public:
|
||||
int height,
|
||||
int numStencilSamples) override;
|
||||
|
||||
GrGpuRTCommandBuffer* getCommandBuffer(
|
||||
GrOpsRenderPass* getOpsRenderPass(
|
||||
GrRenderTarget*, GrSurfaceOrigin, const SkRect& bounds,
|
||||
const GrGpuRTCommandBuffer::LoadAndStoreInfo&,
|
||||
const GrGpuRTCommandBuffer::StencilLoadAndStoreInfo&) override;
|
||||
|
||||
GrGpuTextureCommandBuffer* getCommandBuffer(GrTexture*, GrSurfaceOrigin) override;
|
||||
const GrOpsRenderPass::LoadAndStoreInfo&,
|
||||
const GrOpsRenderPass::StencilLoadAndStoreInfo&) override;
|
||||
|
||||
SkSL::Compiler* shaderCompiler() const {
|
||||
return fCompiler.get();
|
||||
}
|
||||
|
||||
void submit(GrGpuCommandBuffer* cb) override;
|
||||
void submit(GrOpsRenderPass*) override;
|
||||
|
||||
GrFence SK_WARN_UNUSED_RESULT insertFence() override;
|
||||
bool waitFence(GrFence, uint64_t timeout) override;
|
||||
void deleteFence(GrFence) const override;
|
||||
@ -147,8 +145,7 @@ private:
|
||||
dawn::Device fDevice;
|
||||
dawn::Queue fQueue;
|
||||
std::unique_ptr<SkSL::Compiler> fCompiler;
|
||||
std::unique_ptr<GrDawnGpuRTCommandBuffer> fRTCommandBuffer;
|
||||
std::unique_ptr<GrDawnGpuTextureCommandBuffer> fTextureCommandBuffer;
|
||||
std::unique_ptr<GrDawnOpsRenderPass> fOpsRenderPass;
|
||||
GrDawnRingBuffer fUniformRingBuffer;
|
||||
|
||||
typedef GrGpu INHERITED;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/gpu/dawn/GrDawnGpuCommandBuffer.h"
|
||||
#include "src/gpu/dawn/GrDawnOpsRenderPass.h"
|
||||
|
||||
#include "src/gpu/GrFixedClip.h"
|
||||
#include "src/gpu/GrMesh.h"
|
||||
@ -22,23 +22,6 @@
|
||||
#include "src/gpu/dawn/GrDawnUtil.h"
|
||||
#include "src/sksl/SkSLCompiler.h"
|
||||
|
||||
GrDawnGpuTextureCommandBuffer::GrDawnGpuTextureCommandBuffer(GrDawnGpu* gpu,
|
||||
GrTexture* texture,
|
||||
GrSurfaceOrigin origin)
|
||||
: INHERITED(texture, origin)
|
||||
, fGpu(gpu) {
|
||||
fEncoder = fGpu->device().CreateCommandEncoder();
|
||||
}
|
||||
|
||||
void GrDawnGpuTextureCommandBuffer::submit() {
|
||||
dawn::CommandBuffer commandBuffer = fEncoder.Finish();
|
||||
if (commandBuffer) {
|
||||
fGpu->queue().Submit(1, &commandBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
GrDawnGpuTextureCommandBuffer::~GrDawnGpuTextureCommandBuffer() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static dawn::LoadOp to_dawn_load_op(GrLoadOp loadOp) {
|
||||
@ -59,10 +42,9 @@ static dawn::LoadOp to_dawn_load_op(GrLoadOp loadOp) {
|
||||
}
|
||||
}
|
||||
|
||||
GrDawnGpuRTCommandBuffer::GrDawnGpuRTCommandBuffer(GrDawnGpu* gpu,
|
||||
GrRenderTarget* rt, GrSurfaceOrigin origin,
|
||||
const LoadAndStoreInfo& colorInfo,
|
||||
const StencilLoadAndStoreInfo& stencilInfo)
|
||||
GrDawnOpsRenderPass::GrDawnOpsRenderPass(GrDawnGpu* gpu, GrRenderTarget* rt, GrSurfaceOrigin origin,
|
||||
const LoadAndStoreInfo& colorInfo,
|
||||
const StencilLoadAndStoreInfo& stencilInfo)
|
||||
: INHERITED(rt, origin)
|
||||
, fGpu(gpu)
|
||||
, fColorInfo(colorInfo) {
|
||||
@ -72,8 +54,8 @@ GrDawnGpuRTCommandBuffer::GrDawnGpuRTCommandBuffer(GrDawnGpu* gpu,
|
||||
fPassEncoder = beginRenderPass(colorOp, stencilOp);
|
||||
}
|
||||
|
||||
dawn::RenderPassEncoder GrDawnGpuRTCommandBuffer::beginRenderPass(dawn::LoadOp colorOp,
|
||||
dawn::LoadOp stencilOp) {
|
||||
dawn::RenderPassEncoder GrDawnOpsRenderPass::beginRenderPass(dawn::LoadOp colorOp,
|
||||
dawn::LoadOp stencilOp) {
|
||||
dawn::Texture texture = static_cast<GrDawnRenderTarget*>(fRenderTarget)->texture();
|
||||
auto stencilAttachment = static_cast<GrDawnStencilAttachment*>(
|
||||
fRenderTarget->renderTargetPriv().getStencilAttachment());
|
||||
@ -106,40 +88,40 @@ dawn::RenderPassEncoder GrDawnGpuRTCommandBuffer::beginRenderPass(dawn::LoadOp c
|
||||
return fEncoder.BeginRenderPass(&renderPassDescriptor);
|
||||
}
|
||||
|
||||
GrDawnGpuRTCommandBuffer::~GrDawnGpuRTCommandBuffer() {
|
||||
GrDawnOpsRenderPass::~GrDawnOpsRenderPass() {
|
||||
}
|
||||
|
||||
GrGpu* GrDawnGpuRTCommandBuffer::gpu() { return fGpu; }
|
||||
GrGpu* GrDawnOpsRenderPass::gpu() { return fGpu; }
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::end() {
|
||||
void GrDawnOpsRenderPass::end() {
|
||||
fPassEncoder.EndPass();
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::submit() {
|
||||
void GrDawnOpsRenderPass::submit() {
|
||||
dawn::CommandBuffer commandBuffer = fEncoder.Finish();
|
||||
if (commandBuffer) {
|
||||
fGpu->queue().Submit(1, &commandBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::insertEventMarker(const char* msg) {
|
||||
void GrDawnOpsRenderPass::insertEventMarker(const char* msg) {
|
||||
SkASSERT(!"unimplemented");
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::onClearStencilClip(const GrFixedClip& clip, bool insideStencilMask) {
|
||||
void GrDawnOpsRenderPass::onClearStencilClip(const GrFixedClip& clip, bool insideStencilMask) {
|
||||
fPassEncoder.EndPass();
|
||||
fPassEncoder = beginRenderPass(dawn::LoadOp::Load, dawn::LoadOp::Clear);
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::onClear(const GrFixedClip& clip, const SkPMColor4f& color) {
|
||||
void GrDawnOpsRenderPass::onClear(const GrFixedClip& clip, const SkPMColor4f& color) {
|
||||
fPassEncoder.EndPass();
|
||||
fPassEncoder = beginRenderPass(dawn::LoadOp::Clear, dawn::LoadOp::Load);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::inlineUpload(GrOpFlushState* state,
|
||||
GrDeferredTextureUploadFn& upload) {
|
||||
void GrDawnOpsRenderPass::inlineUpload(GrOpFlushState* state,
|
||||
GrDeferredTextureUploadFn& upload) {
|
||||
SkASSERT(!"unimplemented");
|
||||
}
|
||||
|
||||
@ -190,7 +172,7 @@ static dawn::PrimitiveTopology to_dawn_primitive_topology(GrPrimitiveType primit
|
||||
}
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::setScissorState(
|
||||
void GrDawnOpsRenderPass::setScissorState(
|
||||
const GrPipeline& pipeline,
|
||||
const GrPipeline::FixedDynamicState* fixedDynamicState,
|
||||
const GrPipeline::DynamicStateArrays* dynamicStateArrays) {
|
||||
@ -208,7 +190,7 @@ void GrDawnGpuRTCommandBuffer::setScissorState(
|
||||
fPassEncoder.SetScissorRect(rect.x(), rect.y(), rect.width(), rect.height());
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::applyState(const GrPipeline& pipeline,
|
||||
void GrDawnOpsRenderPass::applyState(const GrPipeline& pipeline,
|
||||
const GrPrimitiveProcessor& primProc,
|
||||
const GrTextureProxy* const primProcProxies[],
|
||||
const GrPipeline::FixedDynamicState* fixedDynamicState,
|
||||
@ -316,13 +298,13 @@ void GrDawnGpuRTCommandBuffer::applyState(const GrPipeline& pipeline,
|
||||
this->setScissorState(pipeline, fixedDynamicState, dynamicStateArrays);
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::onDraw(const GrPrimitiveProcessor& primProc,
|
||||
const GrPipeline& pipeline,
|
||||
const GrPipeline::FixedDynamicState* fixedDynamicState,
|
||||
const GrPipeline::DynamicStateArrays* dynamicStateArrays,
|
||||
const GrMesh meshes[],
|
||||
int meshCount,
|
||||
const SkRect& bounds) {
|
||||
void GrDawnOpsRenderPass::onDraw(const GrPrimitiveProcessor& primProc,
|
||||
const GrPipeline& pipeline,
|
||||
const GrPipeline::FixedDynamicState* fixedDynamicState,
|
||||
const GrPipeline::DynamicStateArrays* dynamicStateArrays,
|
||||
const GrMesh meshes[],
|
||||
int meshCount,
|
||||
const SkRect& bounds) {
|
||||
if (!meshCount) {
|
||||
return;
|
||||
}
|
||||
@ -345,13 +327,13 @@ void GrDawnGpuRTCommandBuffer::onDraw(const GrPrimitiveProcessor& primProc,
|
||||
}
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::sendInstancedMeshToGpu(GrPrimitiveType,
|
||||
const GrBuffer* vertexBuffer,
|
||||
int vertexCount,
|
||||
int baseVertex,
|
||||
const GrBuffer* instanceBuffer,
|
||||
int instanceCount,
|
||||
int baseInstance) {
|
||||
void GrDawnOpsRenderPass::sendInstancedMeshToGpu(GrPrimitiveType,
|
||||
const GrBuffer* vertexBuffer,
|
||||
int vertexCount,
|
||||
int baseVertex,
|
||||
const GrBuffer* instanceBuffer,
|
||||
int instanceCount,
|
||||
int baseInstance) {
|
||||
static const uint64_t vertexBufferOffsets[1] = {0};
|
||||
dawn::Buffer vb = static_cast<const GrDawnBuffer*>(vertexBuffer)->get();
|
||||
fPassEncoder.SetVertexBuffers(0, 1, &vb, vertexBufferOffsets);
|
||||
@ -359,16 +341,16 @@ void GrDawnGpuRTCommandBuffer::sendInstancedMeshToGpu(GrPrimitiveType,
|
||||
fGpu->stats()->incNumDraws();
|
||||
}
|
||||
|
||||
void GrDawnGpuRTCommandBuffer::sendIndexedInstancedMeshToGpu(GrPrimitiveType,
|
||||
const GrBuffer* indexBuffer,
|
||||
int indexCount,
|
||||
int baseIndex,
|
||||
const GrBuffer* vertexBuffer,
|
||||
int baseVertex,
|
||||
const GrBuffer* instanceBuffer,
|
||||
int instanceCount,
|
||||
int baseInstance,
|
||||
GrPrimitiveRestart restart) {
|
||||
void GrDawnOpsRenderPass::sendIndexedInstancedMeshToGpu(GrPrimitiveType,
|
||||
const GrBuffer* indexBuffer,
|
||||
int indexCount,
|
||||
int baseIndex,
|
||||
const GrBuffer* vertexBuffer,
|
||||
int baseVertex,
|
||||
const GrBuffer* instanceBuffer,
|
||||
int instanceCount,
|
||||
int baseInstance,
|
||||
GrPrimitiveRestart restart) {
|
||||
uint64_t vertexBufferOffsets[1];
|
||||
vertexBufferOffsets[0] = 0;
|
||||
dawn::Buffer vb = static_cast<const GrDawnBuffer*>(vertexBuffer)->get();
|
@ -5,10 +5,10 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrDawnGpuCommandBuffer_DEFINED
|
||||
#define GrDawnGpuCommandBuffer_DEFINED
|
||||
#ifndef GrDawnOpsRenderPass_DEFINED
|
||||
#define GrDawnOpsRenderPass_DEFINED
|
||||
|
||||
#include "src/gpu/GrGpuCommandBuffer.h"
|
||||
#include "src/gpu/GrOpsRenderPass.h"
|
||||
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "src/gpu/GrColor.h"
|
||||
@ -18,28 +18,12 @@
|
||||
class GrDawnGpu;
|
||||
class GrDawnRenderTarget;
|
||||
|
||||
class GrDawnGpuTextureCommandBuffer : public GrGpuTextureCommandBuffer {
|
||||
class GrDawnOpsRenderPass : public GrOpsRenderPass, private GrMesh::SendToGpuImpl {
|
||||
public:
|
||||
GrDawnGpuTextureCommandBuffer(GrDawnGpu* gpu, GrTexture* texture, GrSurfaceOrigin origin);
|
||||
~GrDawnGpuTextureCommandBuffer() override;
|
||||
GrDawnOpsRenderPass(GrDawnGpu*, GrRenderTarget*, GrSurfaceOrigin,
|
||||
const LoadAndStoreInfo&, const StencilLoadAndStoreInfo&);
|
||||
|
||||
void insertEventMarker(const char*) override {}
|
||||
void submit();
|
||||
|
||||
private:
|
||||
GrDawnGpu* fGpu;
|
||||
dawn::CommandEncoder fEncoder;
|
||||
|
||||
typedef GrGpuTextureCommandBuffer INHERITED;
|
||||
};
|
||||
|
||||
class GrDawnGpuRTCommandBuffer : public GrGpuRTCommandBuffer, private GrMesh::SendToGpuImpl {
|
||||
public:
|
||||
GrDawnGpuRTCommandBuffer(GrDawnGpu*, GrRenderTarget*, GrSurfaceOrigin,
|
||||
const LoadAndStoreInfo&,
|
||||
const StencilLoadAndStoreInfo&);
|
||||
|
||||
~GrDawnGpuRTCommandBuffer() override;
|
||||
~GrDawnOpsRenderPass() override;
|
||||
|
||||
void begin() override { }
|
||||
void end() override;
|
||||
@ -116,7 +100,7 @@ private:
|
||||
dawn::RenderPassEncoder fPassEncoder;
|
||||
LoadAndStoreInfo fColorInfo;
|
||||
|
||||
typedef GrGpuRTCommandBuffer INHERITED;
|
||||
typedef GrOpsRenderPass INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user