Dawn backend: update to Skia API changes.
Update to GrProgramInfo change.
Implement GrCaps::bytesPerPixel().
Change-Id: Ic695fe85f2cd1389918724d17368df60f88ee2db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247796
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.cpp b/src/gpu/dawn/GrDawnProgramBuilder.cpp
index b169372..9415d1a 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.cpp
+++ b/src/gpu/dawn/GrDawnProgramBuilder.cpp
@@ -283,17 +283,13 @@
sk_sp<GrDawnProgram> GrDawnProgramBuilder::Build(GrDawnGpu* gpu,
GrRenderTarget* renderTarget,
- GrSurfaceOrigin origin,
- const GrPipeline& pipeline,
- const GrPrimitiveProcessor& primProc,
- const GrTextureProxy* const primProcProxies[],
+ const GrProgramInfo& programInfo,
GrPrimitiveType primitiveType,
dawn::TextureFormat colorFormat,
bool hasDepthStencil,
dawn::TextureFormat depthStencilFormat,
GrProgramDesc* desc) {
- GrDawnProgramBuilder builder(gpu, renderTarget, origin, primProc, primProcProxies, pipeline,
- desc);
+ GrDawnProgramBuilder builder(gpu, renderTarget, programInfo, desc);
if (!builder.emitAndInstallProcs()) {
return nullptr;
}
@@ -346,6 +342,7 @@
pipelineLayoutDesc.bindGroupLayouts = &result->fBindGroupLayout;
auto pipelineLayout = gpu->device().CreatePipelineLayout(&pipelineLayoutDesc);
result->fBuiltinUniformHandles = builder.fUniformHandles;
+ const GrPipeline& pipeline = programInfo.pipeline();
auto colorState = create_color_state(gpu, pipeline, colorFormat);
dawn::DepthStencilStateDescriptor depthStencilState;
GrStencilSettings stencil;
@@ -353,11 +350,13 @@
int numStencilBits = renderTarget->renderTargetPriv().numStencilBits();
stencil.reset(*pipeline.getUserStencil(), pipeline.hasStencilClip(), numStencilBits);
}
- depthStencilState = create_depth_stencil_state(stencil, depthStencilFormat, origin);
+ depthStencilState = create_depth_stencil_state(stencil, depthStencilFormat,
+ programInfo.origin());
std::vector<dawn::VertexBufferDescriptor> inputs;
std::vector<dawn::VertexAttributeDescriptor> vertexAttributes;
+ const GrPrimitiveProcessor& primProc = programInfo.primProc();
if (primProc.numVertexAttributes() > 0) {
size_t offset = 0;
int i = 0;
@@ -428,12 +427,9 @@
GrDawnProgramBuilder::GrDawnProgramBuilder(GrDawnGpu* gpu,
GrRenderTarget* renderTarget,
- GrSurfaceOrigin origin,
- const GrPrimitiveProcessor& primProc,
- const GrTextureProxy* const primProcProxies[],
- const GrPipeline& pipeline,
+ const GrProgramInfo& programInfo,
GrProgramDesc* desc)
- : INHERITED(renderTarget, origin, primProc, primProcProxies, pipeline, desc)
+ : INHERITED(renderTarget, programInfo, desc)
, fGpu(gpu)
, fVaryingHandler(this)
, fUniformHandler(this) {
@@ -496,10 +492,7 @@
}
dawn::BindGroup GrDawnProgram::setData(GrDawnGpu* gpu, const GrRenderTarget* renderTarget,
- GrSurfaceOrigin origin,
- const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrTextureProxy* const primProcTextures[]) {
+ const GrProgramInfo& programInfo) {
std::vector<dawn::BindGroupBinding> bindings;
GrDawnRingBuffer::Slice geom, frag;
uint32_t geometryUniformSize = fDataManager.geometryUniformSize();
@@ -516,10 +509,15 @@
frag.fBuffer, frag.fOffset,
fragmentUniformSize));
}
- this->setRenderTargetState(renderTarget, origin);
+ this->setRenderTargetState(renderTarget, programInfo.origin());
+ const GrPipeline& pipeline = programInfo.pipeline();
+ const GrPrimitiveProcessor& primProc = programInfo.primProc();
fGeometryProcessor->setData(fDataManager, primProc,
GrFragmentProcessor::CoordTransformIter(pipeline));
int binding = GrDawnUniformHandler::kSamplerBindingBase;
+ auto primProcTextures = programInfo.hasFixedPrimProcTextures() ?
+ programInfo.fixedPrimProcTextures() : nullptr;
+
for (int i = 0; i < primProc.numTextureSamplers(); ++i) {
auto& sampler = primProc.textureSampler(i);
setTexture(gpu, sampler.samplerState(), primProcTextures[i]->peekTexture(), &bindings,