Revert "[graphite] Fill in basic vertex and index buffers."
This reverts commit b95c83353f
.
Reason for revert: Test-Mac11-Clang-MacMini9.1-GPU-AppleM1-arm64-Debug-All-ASAN_Graphite failure
Original change's description:
> [graphite] Fill in basic vertex and index buffers.
>
> Bug: skia:12466
> Change-Id: I2398fcabc6c797a0bfc2ebccc0289cbf8fd8c72f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466436
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Bug: skia:12466
Change-Id: I2cd986ef78741e699087a23c4ac963e4ddaa61d4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466756
Auto-Submit: Robert Phillips <robertphillips@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
parent
c7c49f5656
commit
15f17c0576
@ -34,12 +34,6 @@ static bool can_fit(size_t requestedSize,
|
||||
}
|
||||
|
||||
std::tuple<VertexWriter, BindBufferInfo> DrawBufferManager::getVertexWriter(size_t requiredBytes) {
|
||||
if (!requiredBytes) {
|
||||
BindBufferInfo bindInfo;
|
||||
bindInfo.fBuffer = nullptr;
|
||||
bindInfo.fOffset = 0;
|
||||
return {VertexWriter(nullptr), bindInfo};
|
||||
}
|
||||
if (fCurrentVertexBuffer &&
|
||||
!can_fit(requiredBytes, fCurrentVertexBuffer.get(), fVertexOffset, /*alignment=*/1)) {
|
||||
fUsedBuffers.push_back(std::move(fCurrentVertexBuffer));
|
||||
@ -63,12 +57,6 @@ std::tuple<VertexWriter, BindBufferInfo> DrawBufferManager::getVertexWriter(size
|
||||
}
|
||||
|
||||
std::tuple<IndexWriter, BindBufferInfo> DrawBufferManager::getIndexWriter(size_t requiredBytes) {
|
||||
if (!requiredBytes) {
|
||||
BindBufferInfo bindInfo;
|
||||
bindInfo.fBuffer = nullptr;
|
||||
bindInfo.fOffset = 0;
|
||||
return {IndexWriter(nullptr), bindInfo};
|
||||
}
|
||||
if (fCurrentIndexBuffer &&
|
||||
!can_fit(requiredBytes, fCurrentIndexBuffer.get(), fIndexOffset, /*alignment=*/1)) {
|
||||
fUsedBuffers.push_back(std::move(fCurrentIndexBuffer));
|
||||
@ -93,12 +81,6 @@ std::tuple<IndexWriter, BindBufferInfo> DrawBufferManager::getIndexWriter(size_t
|
||||
|
||||
std::tuple<UniformWriter, BindBufferInfo> DrawBufferManager::getUniformWriter(
|
||||
size_t requiredBytes) {
|
||||
if (!requiredBytes) {
|
||||
BindBufferInfo bindInfo;
|
||||
bindInfo.fBuffer = nullptr;
|
||||
bindInfo.fOffset = 0;
|
||||
return {UniformWriter(nullptr), bindInfo};
|
||||
}
|
||||
if (fCurrentUniformBuffer &&
|
||||
!can_fit(requiredBytes,
|
||||
fCurrentUniformBuffer.get(),
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "experimental/graphite/src/Renderer.h"
|
||||
#include "include/core/SkShader.h"
|
||||
#include "src/gpu/BufferWriter.h"
|
||||
|
||||
namespace skgpu {
|
||||
|
||||
@ -89,23 +88,4 @@ void DrawList::strokePath(const Transform& localToDevice,
|
||||
// fRenderStepCount += Renderer::StrokePath().numRenderSteps();
|
||||
}
|
||||
|
||||
size_t DrawList::Draw::requiredVertexSpace(int renderStep) const {
|
||||
SkASSERT(renderStep < fRenderer.numRenderSteps());
|
||||
return fRenderer.steps()[renderStep]->requiredVertexSpace(fShape);
|
||||
}
|
||||
|
||||
size_t DrawList::Draw::requiredIndexSpace(int renderStep) const {
|
||||
SkASSERT(renderStep < fRenderer.numRenderSteps());
|
||||
return fRenderer.steps()[renderStep]->requiredIndexSpace(fShape);
|
||||
}
|
||||
|
||||
void DrawList::Draw::writeVertices(VertexWriter vertexWriter,
|
||||
IndexWriter indexWriter,
|
||||
int renderStep) const {
|
||||
SkASSERT(renderStep < fRenderer.numRenderSteps());
|
||||
fRenderer.steps()[renderStep]->writeVertices(std::move(vertexWriter),
|
||||
std::move(indexWriter),
|
||||
fShape);
|
||||
}
|
||||
|
||||
} // namespace skgpu
|
||||
|
@ -25,9 +25,7 @@ struct SkIRect;
|
||||
|
||||
namespace skgpu {
|
||||
|
||||
struct IndexWriter;
|
||||
class Renderer;
|
||||
struct VertexWriter;
|
||||
|
||||
// TBD: If occlusion culling is eliminated as a phase, we can easily move the paint conversion
|
||||
// back to Device when the command is recorded (similar to SkPaint -> GrPaint), and then
|
||||
@ -214,11 +212,6 @@ private:
|
||||
, fOrder(order)
|
||||
, fPaintParams(paint ? skstd::optional<PaintParams>(*paint) : skstd::nullopt)
|
||||
, fStrokeParams(stroke ? skstd::optional<StrokeParams>(*stroke) : skstd::nullopt) {}
|
||||
|
||||
size_t requiredVertexSpace(int renderStep) const;
|
||||
size_t requiredIndexSpace(int renderStep) const;
|
||||
|
||||
void writeVertices(VertexWriter, IndexWriter, int renderStep) const;
|
||||
};
|
||||
|
||||
// The returned Transform reference remains valid for the lifetime of the DrawList.
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "experimental/graphite/src/DrawPass.h"
|
||||
|
||||
#include "experimental/graphite/include/GraphiteTypes.h"
|
||||
#include "experimental/graphite/src/Buffer.h"
|
||||
#include "experimental/graphite/src/ContextUtils.h"
|
||||
#include "experimental/graphite/src/DrawBufferManager.h"
|
||||
#include "experimental/graphite/src/DrawContext.h"
|
||||
@ -22,7 +21,6 @@
|
||||
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/core/SkUtils.h"
|
||||
#include "src/gpu/BufferWriter.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -236,36 +234,8 @@ std::unique_ptr<DrawPass> DrawPass::Make(Recorder* recorder,
|
||||
uint32_t lastShadingUniforms = UniformData::kInvalidUniformID;
|
||||
uint32_t lastGeometryUniforms = 0;
|
||||
SkIRect lastScissor = SkIRect::MakeSize(target->dimensions());
|
||||
Buffer* lastBoundVertexBuffer = nullptr;
|
||||
Buffer* lastBoundIndexBuffer = nullptr;
|
||||
|
||||
for (const SortKey& key : keys) {
|
||||
const DrawList::Draw& draw = *key.draw();
|
||||
int renderStep = key.renderStep();
|
||||
|
||||
size_t vertexSize = draw.requiredVertexSpace(renderStep);
|
||||
size_t indexSize = draw.requiredIndexSpace(renderStep);
|
||||
auto [vertexWriter, vertexInfo] = bufferMgr->getVertexWriter(vertexSize);
|
||||
auto [indexWriter, indexInfo] = bufferMgr->getIndexWriter(indexSize);
|
||||
draw.writeVertices(std::move(vertexWriter), std::move(indexWriter), renderStep);
|
||||
|
||||
if (vertexSize) {
|
||||
SkASSERT(vertexWriter);
|
||||
if (lastBoundVertexBuffer != vertexInfo.fBuffer) {
|
||||
// TODO: Record a vertex bind call that stores the vertexInfo.fBuffer.
|
||||
}
|
||||
// TODO: Store the vertexInfo.fOffset so the draw will know its vertex offset when it
|
||||
// executes.
|
||||
}
|
||||
if (indexSize) {
|
||||
SkASSERT(indexWriter);
|
||||
if (lastBoundIndexBuffer != indexInfo.fBuffer) {
|
||||
// TODO: Record a vertex bind call that stores the vertexInfo.fBuffer.
|
||||
}
|
||||
// TODO: Store the vertexInfo.fOffset so the draw will know its vertex offset when it
|
||||
// executes.
|
||||
}
|
||||
|
||||
// TODO: Have the render step write out vertices and figure out what draw call function and
|
||||
// primitive type it uses. The vertex buffer binding/offset and draw params will be examined
|
||||
// to determine if the active draw can be updated to include the new vertices, or if it has
|
||||
|
@ -16,10 +16,6 @@
|
||||
|
||||
namespace skgpu {
|
||||
|
||||
struct IndexWriter;
|
||||
class Shape;
|
||||
struct VertexWriter;
|
||||
|
||||
class RenderStep {
|
||||
public:
|
||||
virtual ~RenderStep() {}
|
||||
@ -29,10 +25,6 @@ public:
|
||||
virtual bool requiresMSAA() const = 0;
|
||||
virtual bool performsShading() const = 0;
|
||||
|
||||
virtual size_t requiredVertexSpace(const Shape&) const = 0;
|
||||
virtual size_t requiredIndexSpace(const Shape&) const = 0;
|
||||
virtual void writeVertices(VertexWriter, IndexWriter, const Shape&) const = 0;
|
||||
|
||||
// TODO: Actual API to do things
|
||||
// 1. Provide stencil settings
|
||||
// 2. Provide shader key or MSL(?) for the vertex stage
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#include "experimental/graphite/src/Renderer.h"
|
||||
|
||||
#include "experimental/graphite/src/geom/Shape.h"
|
||||
#include "src/gpu/BufferWriter.h"
|
||||
|
||||
namespace skgpu {
|
||||
|
||||
namespace {
|
||||
@ -64,21 +61,6 @@ public:
|
||||
bool requiresMSAA() const override { return false; }
|
||||
bool performsShading() const override { return true; }
|
||||
|
||||
size_t requiredVertexSpace(const Shape&) const override {
|
||||
return 8 * sizeof(float);
|
||||
}
|
||||
|
||||
size_t requiredIndexSpace(const Shape&) const override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void writeVertices(VertexWriter vertexWriter,
|
||||
IndexWriter indexWriter,
|
||||
const Shape& shape) const override {
|
||||
vertexWriter.writeQuad(VertexWriter::TriStripFromRect(shape.bounds().asSkRect()));
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user