Update Dawn backend to ToT. This is about 3 months of changes.

Remove optional param to SetIndexBuffer().
Update SetVertexBuffers -> SetVertexBuffer.
PipelineStageDescriptor -> ProgrammableStageDescriptor.
Update past generator changes, ring buffer changes, etc.
Add ErrorScopeTracker.cpp/.h to the build.
Add Vulkan MemoryResourceAllocator files.
Fix vertexShader ShaderStageDescriptor.
Fix spirv-cross include path.
TextureUsageBit -> TextureUsage, etc.
DawnErrorCallback fixes.
Removal of texture.CreateDefaultView.
Fix GL supported_extesions mumbo jumbo.
Update past ChromeOS change.
Add PassResourceUsageTracker.cpp/.h to build.
Add GLFormat.cpp/.h to build.
Add Extensions and Toggles to the build.
Add EncodingContext, AttachmentState to build.
Add RenderEncoderBase to Dawn build.
gn format dawn BUILD.gn, spirv-cross BUILD.gn.

Change-Id: I26538d63c93668647048814aad6ad456ae323679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248261
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Stephen White 2019-10-15 13:35:37 -04:00 committed by Skia Commit-Bot
parent ba8752f37d
commit 20c626aa23
18 changed files with 219 additions and 133 deletions

2
DEPS
View File

@ -8,7 +8,7 @@ deps = {
"buildtools" : "https://chromium.googlesource.com/chromium/buildtools.git@505de88083136eefd056e5ee4ca0f01fe9b33de8",
"common" : "https://skia.googlesource.com/common.git@9737551d7a52c3db3262db5856e6bcd62c462b92",
"third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@2d0e5b554d4ffbca76730d0e7308e665675446df",
"third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@472bd1ec29d8d4e03404bf4b4e0233e4fc6031ce",
"third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@3b05a6e03160c1516a7e565b5cebe69dc0325bd5",
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123",
"third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@a0bca08de07c7d7651047bedc0b653cfaaa4f2ae",
"third_party/externals/expat" : "https://android.googlesource.com/platform/external/expat.git@e5aa0a2cb0a5f759ef31c0819dc67d9b14246a4a",

View File

@ -5,8 +5,6 @@
# These are variables that are overridable by projects that include Dawn.
dawn_root = "../externals/dawn"
# The paths to Dawn's dependencies. For now, we leave these unset to
# use Dawn's DEPS. Eventually, we'll move to Skia's copies of as
# many of these as possible. This will require updating Skia's

View File

@ -61,6 +61,10 @@ is_linux = current_os == "linux"
is_mac = current_os == "mac"
is_win = current_os == "win"
# This is just to make the Dawn build files happy. Skia itself uses target_os = "linux"
# for ChromeOS, so this variable will not affect Skia proper.
is_chromeos = false
if (target_cpu == "") {
target_cpu = host_cpu
if (is_android || is_ios) {

View File

@ -10,19 +10,19 @@
#include "src/gpu/dawn/GrDawnGpu.h"
namespace {
dawn::BufferUsageBit GrGpuBufferTypeToDawnUsageBit(GrGpuBufferType type) {
dawn::BufferUsage GrGpuBufferTypeToDawnUsageBit(GrGpuBufferType type) {
switch (type) {
case GrGpuBufferType::kVertex:
return dawn::BufferUsageBit::Vertex;
return dawn::BufferUsage::Vertex;
case GrGpuBufferType::kIndex:
return dawn::BufferUsageBit::Index;
return dawn::BufferUsage::Index;
case GrGpuBufferType::kXferCpuToGpu:
return dawn::BufferUsageBit::CopySrc;
return dawn::BufferUsage::CopySrc;
case GrGpuBufferType::kXferGpuToCpu:
return dawn::BufferUsageBit::CopyDst;
return dawn::BufferUsage::CopyDst;
default:
SkASSERT(!"buffer type not supported by Dawn");
return dawn::BufferUsageBit::Vertex;
return dawn::BufferUsage::Vertex;
}
}
}
@ -33,7 +33,7 @@ GrDawnBuffer::GrDawnBuffer(GrDawnGpu* gpu, size_t sizeInBytes, GrGpuBufferType t
, fStagingBuffer(nullptr) {
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = sizeInBytes;
bufferDesc.usage = GrGpuBufferTypeToDawnUsageBit(type) | dawn::BufferUsageBit::CopyDst;
bufferDesc.usage = GrGpuBufferTypeToDawnUsageBit(type) | dawn::BufferUsage::CopyDst;
fBuffer = this->getDawnGpu()->device().CreateBuffer(&bufferDesc);
this->registerWithCache(SkBudgeted::kYes);
}

View File

@ -125,7 +125,7 @@ GrDawnGpu::GrDawnGpu(GrContext* context, const GrContextOptions& options,
, fDevice(device)
, fQueue(device.CreateQueue())
, fCompiler(new SkSL::Compiler())
, fUniformRingBuffer(this, dawn::BufferUsageBit::Uniform)
, fUniformRingBuffer(this, dawn::BufferUsage::Uniform)
, fRenderPipelineCache(kMaxRenderPipelineEntries)
, fStagingManager(fDevice) {
fCaps.reset(new GrDawnCaps(options));
@ -327,12 +327,12 @@ GrBackendTexture GrDawnGpu::onCreateBackendTexture(int width, int height,
dawn::TextureDescriptor desc;
desc.usage =
dawn::TextureUsageBit::Sampled |
dawn::TextureUsageBit::CopySrc |
dawn::TextureUsageBit::CopyDst;
dawn::TextureUsage::Sampled |
dawn::TextureUsage::CopySrc |
dawn::TextureUsage::CopyDst;
if (GrRenderable::kYes == renderable) {
desc.usage |= dawn::TextureUsageBit::OutputAttachment;
desc.usage |= dawn::TextureUsage::OutputAttachment;
}
desc.size.width = width;
@ -436,8 +436,8 @@ GrBackendRenderTarget GrDawnGpu::createTestingOnlyBackendRenderTarget(int width,
dawn::TextureDescriptor desc;
desc.usage =
dawn::TextureUsageBit::CopySrc |
dawn::TextureUsageBit::OutputAttachment;
dawn::TextureUsage::CopySrc |
dawn::TextureUsage::OutputAttachment;
desc.size.width = width;
desc.size.height = height;
@ -533,7 +533,7 @@ bool GrDawnGpu::onReadPixels(GrSurface* surface, int left, int top, int width, i
int sizeInBytes = rowBytes * height;
dawn::BufferDescriptor desc;
desc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
desc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::MapRead;
desc.size = sizeInBytes;
dawn::Buffer buf = device().CreateBuffer(&desc);

View File

@ -59,7 +59,7 @@ dawn::RenderPassEncoder GrDawnOpsRenderPass::beginRenderPass(dawn::LoadOp colorO
dawn::Texture texture = static_cast<GrDawnRenderTarget*>(fRenderTarget)->texture();
auto stencilAttachment = static_cast<GrDawnStencilAttachment*>(
fRenderTarget->renderTargetPriv().getStencilAttachment());
dawn::TextureView colorView = texture.CreateDefaultView();
dawn::TextureView colorView = texture.CreateView();
const float *c = fColorInfo.fClearColor.vec();
dawn::RenderPassColorAttachmentDescriptor colorAttachment;
@ -71,7 +71,7 @@ dawn::RenderPassEncoder GrDawnOpsRenderPass::beginRenderPass(dawn::LoadOp colorO
dawn::RenderPassColorAttachmentDescriptor* colorAttachments = { &colorAttachment };
dawn::RenderPassDescriptor renderPassDescriptor;
renderPassDescriptor.colorAttachmentCount = 1;
renderPassDescriptor.colorAttachments = &colorAttachments;
renderPassDescriptor.colorAttachments = colorAttachments;
if (stencilAttachment) {
dawn::RenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
depthStencilAttachment.attachment = stencilAttachment->view();
@ -178,9 +178,8 @@ void GrDawnOpsRenderPass::sendInstancedMeshToGpu(GrPrimitiveType,
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);
fPassEncoder.SetVertexBuffer(0, vb);
fPassEncoder.Draw(vertexCount, 1, baseVertex, baseInstance);
fGpu->stats()->incNumDraws();
}
@ -195,12 +194,10 @@ void GrDawnOpsRenderPass::sendIndexedInstancedMeshToGpu(GrPrimitiveType,
int instanceCount,
int baseInstance,
GrPrimitiveRestart restart) {
uint64_t vertexBufferOffsets[1];
vertexBufferOffsets[0] = 0;
dawn::Buffer vb = static_cast<const GrDawnBuffer*>(vertexBuffer)->get();
dawn::Buffer ib = static_cast<const GrDawnBuffer*>(indexBuffer)->get();
fPassEncoder.SetIndexBuffer(ib, 0);
fPassEncoder.SetVertexBuffers(0, 1, &vb, vertexBufferOffsets);
fPassEncoder.SetIndexBuffer(ib);
fPassEncoder.SetVertexBuffer(0, vb);
fPassEncoder.DrawIndexed(indexCount, 1, baseIndex, baseVertex, baseInstance);
fGpu->stats()->incNumDraws();
}

View File

@ -15,9 +15,11 @@
#include "src/sksl/SkSLCompiler.h"
static SkSL::String sksl_to_spirv(const GrDawnGpu* gpu, const char* shaderString,
SkSL::Program::Kind kind, SkSL::Program::Inputs* inputs) {
SkSL::Program::Kind kind, bool flipY,
SkSL::Program::Inputs* inputs) {
SkSL::Program::Settings settings;
settings.fCaps = gpu->caps()->shaderCaps();
settings.fFlipY = flipY;
std::unique_ptr<SkSL::Program> program = gpu->shaderCompiler()->convertProgram(
kind,
shaderString,
@ -307,9 +309,10 @@ sk_sp<GrDawnProgram> GrDawnProgramBuilder::Build(GrDawnGpu* gpu,
uint32_t fragmentUniformSize = builder.fUniformHandler.fCurrentFragmentUBOOffset;
sk_sp<GrDawnProgram> result(
new GrDawnProgram(uniforms, geometryUniformSize, fragmentUniformSize));
auto vsModule = builder.createShaderModule(builder.fVS, SkSL::Program::kVertex_Kind,
bool flipY = programInfo.origin() != kTopLeft_GrSurfaceOrigin;
auto vsModule = builder.createShaderModule(builder.fVS, SkSL::Program::kVertex_Kind, flipY,
&vertInputs);
auto fsModule = builder.createShaderModule(builder.fFS, SkSL::Program::kFragment_Kind,
auto fsModule = builder.createShaderModule(builder.fFS, SkSL::Program::kFragment_Kind, flipY,
&fragInputs);
result->fGeometryProcessor = std::move(builder.fGeometryProcessor);
result->fXferProcessor = std::move(builder.fXferProcessor);
@ -318,19 +321,19 @@ sk_sp<GrDawnProgram> GrDawnProgramBuilder::Build(GrDawnGpu* gpu,
std::vector<dawn::BindGroupLayoutBinding> layoutBindings;
if (0 != geometryUniformSize) {
layoutBindings.push_back({ GrDawnUniformHandler::kGeometryBinding,
dawn::ShaderStageBit::Vertex,
dawn::ShaderStage::Vertex,
dawn::BindingType::UniformBuffer});
}
if (0 != fragmentUniformSize) {
layoutBindings.push_back({ GrDawnUniformHandler::kFragBinding,
dawn::ShaderStageBit::Fragment,
dawn::ShaderStage::Fragment,
dawn::BindingType::UniformBuffer});
}
uint32_t binding = GrDawnUniformHandler::kSamplerBindingBase;
for (int i = 0; i < builder.fUniformHandler.fSamplers.count(); ++i) {
layoutBindings.push_back({ binding++, dawn::ShaderStageBit::Fragment,
layoutBindings.push_back({ binding++, dawn::ShaderStage::Fragment,
dawn::BindingType::Sampler});
layoutBindings.push_back({ binding++, dawn::ShaderStageBit::Fragment,
layoutBindings.push_back({ binding++, dawn::ShaderStage::Fragment,
dawn::BindingType::SampledTexture});
}
dawn::BindGroupLayoutDescriptor bindGroupLayoutDesc;
@ -401,17 +404,17 @@ sk_sp<GrDawnProgram> GrDawnProgramBuilder::Build(GrDawnGpu* gpu,
vertexInput.bufferCount = inputs.size();
vertexInput.buffers = &inputs.front();
dawn::PipelineStageDescriptor vsDesc;
dawn::ProgrammableStageDescriptor vsDesc;
vsDesc.module = vsModule;
vsDesc.entryPoint = "main";
dawn::PipelineStageDescriptor fsDesc;
dawn::ProgrammableStageDescriptor fsDesc;
fsDesc.module = fsModule;
fsDesc.entryPoint = "main";
dawn::RenderPipelineDescriptor rpDesc;
rpDesc.layout = pipelineLayout;
rpDesc.vertexStage = &vsDesc;
rpDesc.vertexStage = vsDesc;
rpDesc.fragmentStage = &fsDesc;
rpDesc.vertexInput = &vertexInput;
rpDesc.primitiveTopology = to_dawn_primitive_topology(primitiveType);
@ -419,8 +422,7 @@ sk_sp<GrDawnProgram> GrDawnProgramBuilder::Build(GrDawnGpu* gpu,
rpDesc.depthStencilState = &depthStencilState;
}
rpDesc.colorStateCount = 1;
dawn::ColorStateDescriptor* colorStatesPtr[] = { &colorState };
rpDesc.colorStates = colorStatesPtr;
rpDesc.colorStates = &colorState;
result->fRenderPipeline = gpu->device().CreateRenderPipeline(&rpDesc);
return result;
}
@ -437,6 +439,7 @@ GrDawnProgramBuilder::GrDawnProgramBuilder(GrDawnGpu* gpu,
dawn::ShaderModule GrDawnProgramBuilder::createShaderModule(const GrGLSLShaderBuilder& builder,
SkSL::Program::Kind kind,
bool flipY,
SkSL::Program::Inputs* inputs) {
dawn::Device device = fGpu->device();
SkString source(builder.fCompilerString.c_str());
@ -446,7 +449,7 @@ dawn::ShaderModule GrDawnProgramBuilder::createShaderModule(const GrGLSLShaderBu
printf("converting program:\n%s\n", sksl.c_str());
#endif
SkSL::String spirvSource = sksl_to_spirv(fGpu, source.c_str(), kind, inputs);
SkSL::String spirvSource = sksl_to_spirv(fGpu, source.c_str(), kind, flipY, inputs);
dawn::ShaderModuleDescriptor desc;
desc.codeSize = spirvSource.size() / 4;

View File

@ -39,7 +39,7 @@ struct GrDawnProgram : public SkRefCnt {
void getRTAdjustmentVec(float* destVec) {
destVec[0] = 2.f / fRenderTargetSize.fWidth;
destVec[1] = -1.f;
if (kBottomLeft_GrSurfaceOrigin == fRenderTargetOrigin) {
if (kTopLeft_GrSurfaceOrigin == fRenderTargetOrigin) {
destVec[2] = -2.f / fRenderTargetSize.fHeight;
destVec[3] = 1.f;
} else {
@ -91,7 +91,7 @@ private:
const GrProgramInfo&,
GrProgramDesc*);
dawn::ShaderModule createShaderModule(const GrGLSLShaderBuilder&, SkSL::Program::Kind,
SkSL::Program::Inputs* inputs);
bool flipY, SkSL::Program::Inputs* inputs);
GrDawnGpu* fGpu;
GrDawnVaryingHandler fVaryingHandler;
GrDawnUniformHandler fUniformHandler;

View File

@ -14,7 +14,7 @@ namespace {
const int kDefaultSize = 512 * 1024;
}
GrDawnRingBuffer::GrDawnRingBuffer(GrDawnGpu* gpu, dawn::BufferUsageBit usage)
GrDawnRingBuffer::GrDawnRingBuffer(GrDawnGpu* gpu, dawn::BufferUsage usage)
: fGpu(gpu) , fUsage(usage) {
}
@ -24,7 +24,7 @@ GrDawnRingBuffer::~GrDawnRingBuffer() {
GrDawnRingBuffer::Slice GrDawnRingBuffer::allocate(int size) {
if (!fBuffer || fOffset + size > kDefaultSize) {
dawn::BufferDescriptor desc;
desc.usage = fUsage | dawn::BufferUsageBit::CopyDst;
desc.usage = fUsage | dawn::BufferUsage::CopyDst;
desc.size = kDefaultSize;
fBuffer = fGpu->device().CreateBuffer(&desc);
fOffset = 0;

View File

@ -16,7 +16,7 @@ class GrDawnGpu;
class GrDawnRingBuffer : public SkRefCnt {
public:
GrDawnRingBuffer(GrDawnGpu* gpu, dawn::BufferUsageBit usage);
GrDawnRingBuffer(GrDawnGpu* gpu, dawn::BufferUsage usage);
~GrDawnRingBuffer() override;
struct Slice {
@ -35,7 +35,7 @@ public:
private:
GrDawnGpu* fGpu;
dawn::BufferUsageBit fUsage;
dawn::BufferUsage fUsage;
dawn::Buffer fBuffer;
int fOffset = 0;
};

View File

@ -28,7 +28,7 @@ GrDawnStagingBuffer* GrDawnStagingManager::findOrCreateStagingBuffer(size_t size
fReadyPool.erase(i);
} else {
dawn::BufferDescriptor desc;
desc.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
desc.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
desc.size = sizePow2;
dawn::CreateBufferMappedResult result = fDevice.CreateBufferMapped(&desc);
std::unique_ptr<GrDawnStagingBuffer> b(new GrDawnStagingBuffer(

View File

@ -30,7 +30,7 @@ GrDawnStencilAttachment* GrDawnStencilAttachment::Create(GrDawnGpu* gpu,
int height,
int sampleCnt) {
dawn::TextureDescriptor desc;
desc.usage = dawn::TextureUsageBit::OutputAttachment;
desc.usage = dawn::TextureUsage::OutputAttachment;
desc.size.width = width;
desc.size.height = height;
desc.size.depth = 1;
@ -39,7 +39,7 @@ GrDawnStencilAttachment* GrDawnStencilAttachment::Create(GrDawnGpu* gpu,
if (!texture) {
return nullptr;
}
dawn::TextureView view = texture.CreateDefaultView();
dawn::TextureView view = texture.CreateView();
if (!view) {
return nullptr;
}

View File

@ -31,12 +31,12 @@ sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, const SkISize& size, Gr
dawn::TextureDescriptor textureDesc;
textureDesc.usage =
dawn::TextureUsageBit::Sampled |
dawn::TextureUsageBit::CopySrc |
dawn::TextureUsageBit::CopyDst;
dawn::TextureUsage::Sampled |
dawn::TextureUsage::CopySrc |
dawn::TextureUsage::CopyDst;
if (renderTarget) {
textureDesc.usage |= dawn::TextureUsageBit::OutputAttachment;
textureDesc.usage |= dawn::TextureUsage::OutputAttachment;
}
textureDesc.size.width = size.fWidth;
@ -52,7 +52,7 @@ sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, const SkISize& size, Gr
return nullptr;
}
dawn::TextureView textureView = tex.CreateDefaultView();
dawn::TextureView textureView = tex.CreateView();
if (!textureView) {
return nullptr;
@ -88,7 +88,7 @@ sk_sp<GrDawnTexture> GrDawnTexture::MakeWrapped(GrDawnGpu* gpu, const SkISize& s
int sampleCnt, GrMipMapsStatus status,
GrWrapCacheable cacheable,
const GrDawnImageInfo& info) {
dawn::TextureView textureView = info.fTexture.CreateDefaultView();
dawn::TextureView textureView = info.fTexture.CreateView();
if (!textureView) {
return nullptr;
}

View File

@ -12,9 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
dawn_root = "../externals/dawn"
import("$dawn_root/generator/dawn_generator.gni")
import("$dawn_root/scripts/dawn_features.gni")
import("../externals/dawn/generator/dawn_generator.gni")
import("../externals/dawn/scripts/dawn_features.gni")
###############################################################################
# Template to wrap the Dawn code generator
@ -45,7 +44,8 @@ import("$dawn_root/scripts/dawn_features.gni")
config("libdawn_public") {
include_dirs = [
target_gen_dir,
"$dawn_gen_root/src/include",
"$dawn_gen_root/src",
"$dawn_root/src/include",
"$dawn_root/src",
]
@ -120,8 +120,8 @@ static_library("dawn_common") {
dawn_json_generator("dawn_headers_gen") {
target = "dawn_headers"
outputs = [
"dawn/dawncpp.h",
"dawn/dawn.h",
"src/include/dawn/dawncpp.h",
"src/include/dawn/dawn.h",
]
}
@ -142,8 +142,8 @@ source_set("dawn_headers") {
dawn_json_generator("libdawn_gen") {
target = "libdawn"
outputs = [
"dawn/dawncpp.cpp",
"dawn/dawn.c",
"src/dawn/dawncpp.cpp",
"src/dawn/dawn.c",
]
}
@ -159,6 +159,24 @@ static_library("libdawn") {
sources = get_target_outputs(":libdawn_gen")
}
###############################################################################
# dawn_platform
###############################################################################
source_set("dawn_platform") {
configs += [ ":dawn_internal" ]
sources =
rebase_path([
"${dawn_root}/src/include/dawn_platform/DawnPlatform.h",
"src/dawn_platform/tracing/EventTracer.cpp",
"src/dawn_platform/tracing/EventTracer.h",
"src/dawn_platform/tracing/TraceEvent.h",
],
".",
"$dawn_root")
}
###############################################################################
# libdawn_native.so
###############################################################################
@ -176,11 +194,11 @@ config("libdawn_native_internal") {
dawn_json_generator("libdawn_native_utils_gen") {
target = "dawn_native_utils"
outputs = [
"dawn_native/ProcTable.cpp",
"dawn_native/dawn_structs_autogen.h",
"dawn_native/dawn_structs_autogen.cpp",
"dawn_native/ValidationUtils_autogen.h",
"dawn_native/ValidationUtils_autogen.cpp",
"src/dawn_native/ProcTable.cpp",
"src/dawn_native/dawn_structs_autogen.h",
"src/dawn_native/dawn_structs_autogen.cpp",
"src/dawn_native/ValidationUtils_autogen.h",
"src/dawn_native/ValidationUtils_autogen.cpp",
]
}
@ -190,11 +208,14 @@ if (dawn_enable_opengl) {
args = [
"--gl-xml",
rebase_path("../externals/opengl-registry/xml/gl.xml", root_build_dir),
"--supported-extensions",
rebase_path("$dawn_root/src/dawn_native/opengl/supported_extensions.json",
root_build_dir),
]
outputs = [
"dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
"dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
"dawn_native/opengl/opengl_platform_autogen.h",
"src/dawn_native/opengl/OpenGLFunctionsBase_autogen.cpp",
"src/dawn_native/opengl/OpenGLFunctionsBase_autogen.h",
"src/dawn_native/opengl/opengl_platform_autogen.h",
]
}
}
@ -237,6 +258,7 @@ source_set("libdawn_native_sources") {
# Set the headers as a public dependency so they are visible to unittests
public_deps = [
":dawn_platform",
":libdawn_native_headers",
]
@ -248,6 +270,8 @@ source_set("libdawn_native_sources") {
sources += rebase_path([
"src/dawn_native/Adapter.cpp",
"src/dawn_native/Adapter.h",
"src/dawn_native/AttachmentState.cpp",
"src/dawn_native/AttachmentState.h",
"src/dawn_native/BackendConnection.cpp",
"src/dawn_native/BackendConnection.h",
"src/dawn_native/BindGroup.cpp",
@ -264,6 +288,8 @@ source_set("libdawn_native_sources") {
"src/dawn_native/CommandBufferStateTracker.h",
"src/dawn_native/CommandEncoder.cpp",
"src/dawn_native/CommandEncoder.h",
"src/dawn_native/CommandValidation.cpp",
"src/dawn_native/CommandValidation.h",
"src/dawn_native/Commands.cpp",
"src/dawn_native/Commands.h",
"src/dawn_native/ComputePassEncoder.cpp",
@ -276,10 +302,18 @@ source_set("libdawn_native_sources") {
"src/dawn_native/DynamicUploader.cpp",
"src/dawn_native/DynamicUploader.h",
"src/dawn_native/Device.h",
"src/dawn_native/EncodingContext.cpp",
"src/dawn_native/EncodingContext.h",
"src/dawn_native/Error.cpp",
"src/dawn_native/Error.h",
"src/dawn_native/ErrorData.cpp",
"src/dawn_native/ErrorData.h",
"src/dawn_native/ErrorScope.cpp",
"src/dawn_native/ErrorScope.h",
"src/dawn_native/ErrorScopeTracker.cpp",
"src/dawn_native/ErrorScopeTracker.h",
"src/dawn_native/Extensions.cpp",
"src/dawn_native/Extensions.h",
"src/dawn_native/Fence.cpp",
"src/dawn_native/Fence.h",
"src/dawn_native/FenceSignalTracker.cpp",
@ -292,6 +326,8 @@ source_set("libdawn_native_sources") {
"src/dawn_native/ObjectBase.h",
"src/dawn_native/ObjectBase.cpp",
"src/dawn_native/PassResourceUsage.h",
"src/dawn_native/PassResourceUsageTracker.cpp",
"src/dawn_native/PassResourceUsageTracker.h",
"src/dawn_native/PerStage.cpp",
"src/dawn_native/PerStage.h",
"src/dawn_native/Pipeline.cpp",
@ -304,12 +340,20 @@ source_set("libdawn_native_sources") {
"src/dawn_native/Queue.h",
"src/dawn_native/RefCounted.cpp",
"src/dawn_native/RefCounted.h",
"src/dawn_native/RenderBundle.cpp",
"src/dawn_native/RenderBundle.h",
"src/dawn_native/RenderBundleEncoder.cpp",
"src/dawn_native/RenderBundleEncoder.h",
"src/dawn_native/RenderEncoderBase.cpp",
"src/dawn_native/RenderEncoderBase.h",
"src/dawn_native/RenderPassEncoder.cpp",
"src/dawn_native/RenderPassEncoder.h",
"src/dawn_native/RenderPipeline.cpp",
"src/dawn_native/RenderPipeline.h",
"src/dawn_native/RingBuffer.cpp",
"src/dawn_native/RingBuffer.h",
"src/dawn_native/ResourceMemoryAllocation.cpp",
"src/dawn_native/ResourceMemoryAllocation.h",
"src/dawn_native/RingBufferAllocator.cpp",
"src/dawn_native/RingBufferAllocator.h",
"src/dawn_native/Sampler.cpp",
"src/dawn_native/Sampler.h",
"src/dawn_native/ShaderModule.cpp",
@ -320,6 +364,8 @@ source_set("libdawn_native_sources") {
"src/dawn_native/SwapChain.h",
"src/dawn_native/Texture.cpp",
"src/dawn_native/Texture.h",
"src/dawn_native/Toggles.cpp",
"src/dawn_native/Toggles.h",
"src/dawn_native/ToBackend.h",
"src/dawn_native/dawn_platform.h",
],
@ -344,6 +390,10 @@ source_set("libdawn_native_sources") {
"src/dawn_native/d3d12/CommandAllocatorManager.h",
"src/dawn_native/d3d12/CommandBufferD3D12.cpp",
"src/dawn_native/d3d12/CommandBufferD3D12.h",
"src/dawn_native/d3d12/CommandRecordingContext.cpp",
"src/dawn_native/d3d12/CommandRecordingContext.h",
"src/dawn_native/d3d12/CommittedResourceAllocatorD3D12.cpp",
"src/dawn_native/d3d12/CommittedResourceAllocatorD3D12.h",
"src/dawn_native/d3d12/ComputePipelineD3D12.cpp",
"src/dawn_native/d3d12/ComputePipelineD3D12.h",
"src/dawn_native/d3d12/D3D12Backend.cpp",
@ -366,6 +416,10 @@ source_set("libdawn_native_sources") {
"src/dawn_native/d3d12/RenderPipelineD3D12.h",
"src/dawn_native/d3d12/ResourceAllocator.cpp",
"src/dawn_native/d3d12/ResourceAllocator.h",
"src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.cpp",
"src/dawn_native/d3d12/ResourceAllocatorManagerD3D12.h",
"src/dawn_native/d3d12/ResourceHeapAllocationD3D12.cpp",
"src/dawn_native/d3d12/ResourceHeapAllocationD3D12.h",
"src/dawn_native/d3d12/SamplerD3D12.cpp",
"src/dawn_native/d3d12/SamplerD3D12.h",
"src/dawn_native/d3d12/ShaderModuleD3D12.cpp",
@ -455,6 +509,8 @@ source_set("libdawn_native_sources") {
"src/dawn_native/opengl/DeviceGL.cpp",
"src/dawn_native/opengl/DeviceGL.h",
"src/dawn_native/opengl/Forward.h",
"src/dawn_native/opengl/GLFormat.h",
"src/dawn_native/opengl/GLFormat.cpp",
"src/dawn_native/opengl/NativeSwapChainImplGL.cpp",
"src/dawn_native/opengl/NativeSwapChainImplGL.h",
"src/dawn_native/opengl/OpenGLFunctions.cpp",
@ -490,60 +546,85 @@ source_set("libdawn_native_sources") {
if (dawn_enable_vulkan) {
configs += [ "//:our_vulkan_headers" ]
include_dirs = [ "../.." ] # for "include/third_party/vulkan/vulkan/vk_platform.h" in vulkan.h
sources += rebase_path([
"src/dawn_native/vulkan/AdapterVk.cpp",
"src/dawn_native/vulkan/AdapterVk.h",
"src/dawn_native/vulkan/BackendVk.cpp",
"src/dawn_native/vulkan/BackendVk.h",
"src/dawn_native/vulkan/BindGroupLayoutVk.cpp",
"src/dawn_native/vulkan/BindGroupLayoutVk.h",
"src/dawn_native/vulkan/BindGroupVk.cpp",
"src/dawn_native/vulkan/BindGroupVk.h",
"src/dawn_native/vulkan/BufferVk.cpp",
"src/dawn_native/vulkan/BufferVk.h",
"src/dawn_native/vulkan/CommandBufferVk.cpp",
"src/dawn_native/vulkan/CommandBufferVk.h",
"src/dawn_native/vulkan/ComputePipelineVk.cpp",
"src/dawn_native/vulkan/ComputePipelineVk.h",
"src/dawn_native/vulkan/DeviceVk.cpp",
"src/dawn_native/vulkan/DeviceVk.h",
"src/dawn_native/vulkan/FencedDeleter.cpp",
"src/dawn_native/vulkan/FencedDeleter.h",
"src/dawn_native/vulkan/Forward.h",
"src/dawn_native/vulkan/MemoryAllocator.cpp",
"src/dawn_native/vulkan/MemoryAllocator.h",
"src/dawn_native/vulkan/NativeSwapChainImplVk.cpp",
"src/dawn_native/vulkan/NativeSwapChainImplVk.h",
"src/dawn_native/vulkan/PipelineLayoutVk.cpp",
"src/dawn_native/vulkan/PipelineLayoutVk.h",
"src/dawn_native/vulkan/QueueVk.cpp",
"src/dawn_native/vulkan/QueueVk.h",
"src/dawn_native/vulkan/RenderPassCache.cpp",
"src/dawn_native/vulkan/RenderPassCache.h",
"src/dawn_native/vulkan/RenderPipelineVk.cpp",
"src/dawn_native/vulkan/RenderPipelineVk.h",
"src/dawn_native/vulkan/SamplerVk.cpp",
"src/dawn_native/vulkan/SamplerVk.h",
"src/dawn_native/vulkan/ShaderModuleVk.cpp",
"src/dawn_native/vulkan/ShaderModuleVk.h",
"src/dawn_native/vulkan/StagingBufferVk.cpp",
"src/dawn_native/vulkan/StagingBufferVk.h",
"src/dawn_native/vulkan/SwapChainVk.cpp",
"src/dawn_native/vulkan/SwapChainVk.h",
"src/dawn_native/vulkan/TextureVk.cpp",
"src/dawn_native/vulkan/TextureVk.h",
"src/dawn_native/vulkan/UtilsVulkan.cpp",
"src/dawn_native/vulkan/UtilsVulkan.h",
"src/dawn_native/vulkan/VulkanBackend.cpp",
"src/dawn_native/vulkan/VulkanError.cpp",
"src/dawn_native/vulkan/VulkanError.h",
"src/dawn_native/vulkan/VulkanFunctions.cpp",
"src/dawn_native/vulkan/VulkanFunctions.h",
"src/dawn_native/vulkan/VulkanInfo.cpp",
"src/dawn_native/vulkan/VulkanInfo.h",
],
".",
"$dawn_root")
sources += rebase_path(
[
"src/dawn_native/vulkan/AdapterVk.cpp",
"src/dawn_native/vulkan/AdapterVk.h",
"src/dawn_native/vulkan/BackendVk.cpp",
"src/dawn_native/vulkan/BackendVk.h",
"src/dawn_native/vulkan/BindGroupLayoutVk.cpp",
"src/dawn_native/vulkan/BindGroupLayoutVk.h",
"src/dawn_native/vulkan/BindGroupVk.cpp",
"src/dawn_native/vulkan/BindGroupVk.h",
"src/dawn_native/vulkan/BufferVk.cpp",
"src/dawn_native/vulkan/BufferVk.h",
"src/dawn_native/vulkan/CommandBufferVk.cpp",
"src/dawn_native/vulkan/CommandBufferVk.h",
"src/dawn_native/vulkan/ComputePipelineVk.cpp",
"src/dawn_native/vulkan/ComputePipelineVk.h",
"src/dawn_native/vulkan/DeviceVk.cpp",
"src/dawn_native/vulkan/DeviceVk.h",
"src/dawn_native/vulkan/ExternalHandle.h",
"src/dawn_native/vulkan/FencedDeleter.cpp",
"src/dawn_native/vulkan/FencedDeleter.h",
"src/dawn_native/vulkan/Forward.h",
"src/dawn_native/vulkan/MemoryAllocator.cpp",
"src/dawn_native/vulkan/MemoryAllocator.h",
"src/dawn_native/vulkan/MemoryResourceAllocatorVk.cpp",
"src/dawn_native/vulkan/MemoryResourceAllocatorVk.h",
"src/dawn_native/vulkan/NativeSwapChainImplVk.cpp",
"src/dawn_native/vulkan/NativeSwapChainImplVk.h",
"src/dawn_native/vulkan/PipelineLayoutVk.cpp",
"src/dawn_native/vulkan/PipelineLayoutVk.h",
"src/dawn_native/vulkan/QueueVk.cpp",
"src/dawn_native/vulkan/QueueVk.h",
"src/dawn_native/vulkan/RenderPassCache.cpp",
"src/dawn_native/vulkan/RenderPassCache.h",
"src/dawn_native/vulkan/RenderPipelineVk.cpp",
"src/dawn_native/vulkan/RenderPipelineVk.h",
"src/dawn_native/vulkan/ResourceMemoryVk.cpp",
"src/dawn_native/vulkan/ResourceMemoryVk.h",
"src/dawn_native/vulkan/SamplerVk.cpp",
"src/dawn_native/vulkan/SamplerVk.h",
"src/dawn_native/vulkan/ShaderModuleVk.cpp",
"src/dawn_native/vulkan/ShaderModuleVk.h",
"src/dawn_native/vulkan/StagingBufferVk.cpp",
"src/dawn_native/vulkan/StagingBufferVk.h",
"src/dawn_native/vulkan/SwapChainVk.cpp",
"src/dawn_native/vulkan/SwapChainVk.h",
"src/dawn_native/vulkan/TextureVk.cpp",
"src/dawn_native/vulkan/TextureVk.h",
"src/dawn_native/vulkan/UtilsVulkan.cpp",
"src/dawn_native/vulkan/UtilsVulkan.h",
"src/dawn_native/vulkan/VulkanBackend.cpp",
"src/dawn_native/vulkan/VulkanError.cpp",
"src/dawn_native/vulkan/VulkanError.h",
"src/dawn_native/vulkan/VulkanFunctions.cpp",
"src/dawn_native/vulkan/VulkanFunctions.h",
"src/dawn_native/vulkan/VulkanInfo.cpp",
"src/dawn_native/vulkan/VulkanInfo.h",
"src/dawn_native/vulkan/external_memory/MemoryService.h",
"src/dawn_native/vulkan/external_semaphore/SemaphoreService.h",
],
".",
"$dawn_root")
if (is_linux) {
sources += rebase_path(
[
"src/dawn_native/vulkan/external_memory/MemoryServiceOpaqueFD.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceOpaqueFD.cpp",
],
".",
"$dawn_root")
} else {
sources += rebase_path(
[
"src/dawn_native/vulkan/external_memory/MemoryServiceNull.cpp",
"src/dawn_native/vulkan/external_semaphore/SemaphoreServiceNull.cpp",
],
".",
"$dawn_root")
}
}
}

View File

@ -1,7 +1,10 @@
spirv_cross = "//third_party/externals/spirv-cross"
config("spirv_cross_config") {
include_dirs = [ "//third_party/externals" ]
include_dirs = [
"//third_party/externals",
"//third_party/externals/spirv-cross",
]
defines = [ "SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS" ]
}

View File

@ -122,7 +122,7 @@ public:
dawn::Buffer buffer;
if (fBuffers.empty()) {
dawn::BufferDescriptor desc;
desc.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
desc.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
desc.size = 1;
buffer = fDevice.CreateBuffer(&desc);
} else {

View File

@ -11,7 +11,7 @@
#include "src/core/SkAutoMalloc.h"
#include "tools/sk_app/DawnWindowContext.h"
static void PrintDeviceError(const char* message, void*) {
static void PrintDeviceError(DawnErrorType, const char* message, void*) {
printf("Device error: %s\n", message);
SkASSERT(false);
}
@ -42,8 +42,8 @@ void DawnWindowContext::initializeContext(int width, int height) {
fContext.reset();
return;
}
fSwapChain.Configure(fSwapChainFormat, dawn::TextureUsageBit::OutputAttachment, width, height);
fDevice.SetErrorCallback(PrintDeviceError, 0);
fSwapChain.Configure(fSwapChainFormat, dawn::TextureUsage::OutputAttachment, width, height);
fDevice.SetUncapturedErrorCallback(PrintDeviceError, 0);
}
DawnWindowContext::~DawnWindowContext() {
@ -97,7 +97,7 @@ void DawnWindowContext::resize(int w, int h) {
fContext.reset();
return;
}
fSwapChain.Configure(fSwapChainFormat, dawn::TextureUsageBit::OutputAttachment, fWidth,
fSwapChain.Configure(fSwapChainFormat, dawn::TextureUsage::OutputAttachment, fWidth,
fHeight);
}

View File

@ -52,7 +52,7 @@ public:
~SwapChainImplMTL() {}
DawnSwapChainError Configure(DawnTextureFormat format, DawnTextureUsageBit,
DawnSwapChainError Configure(DawnTextureFormat format, DawnTextureUsage,
uint32_t width, uint32_t height) {
if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) {
return "unsupported format";