blob: 7e5c009674e79691c4d8ffd6b57379df9eec66d6 [file] [log] [blame]
/*
* Copyright 2023 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef skgpu_graphite_PipelineUtils_DEFINED
#define skgpu_graphite_PipelineUtils_DEFINED
#include "include/gpu/ShaderErrorHandler.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/utils/SkShaderUtils.h"
// This file houses utilities to be shared across pipelines of different backend types.
namespace skgpu::graphite {
// Print the source code for all shaders generated.
#ifdef SK_PRINT_SKSL_SHADERS
static constexpr bool gPrintSKSL = true;
#else
static constexpr bool gPrintSKSL = false;
#endif
// SkSL->SPIR-V is only needed by Dawn + Vulkan backends, but seeing as this is a small wrapper
// function, it's fine to be here even if not all backends end up using it.
bool SkSLToSPIRV(SkSL::Compiler*,
const std::string& sksl,
SkSL::ProgramKind,
const SkSL::ProgramSettings&,
std::string* spirv,
SkSL::Program::Interface*,
ShaderErrorHandler*);
} // namespace skgpu::graphite
#endif // skgpu_graphite_PipelineUtils_DEFINED