| 1 |
/* |
| 2 |
* Copyright 2014 Google Inc. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef GrGLShaderStringBuilder_DEFINED |
| 9 |
#define GrGLShaderStringBuilder_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkTypes.h" |
| 12 |
#include "include/gpu/ganesh/GrContextOptions.h" |
| 13 |
#include "include/gpu/ganesh/gl/GrGLTypes.h" |
| 14 |
#include "include/private/gpu/ganesh/GrTypesPriv.h" |
| 15 |
#include "src/gpu/SkSLToBackend.h" |
| 16 |
#include "src/gpu/ganesh/GrThreadSafePipelineBuilder.h" |
| 17 |
#include "src/gpu/ganesh/gl/GrGLContext.h" |
| 18 |
#include "src/sksl/codegen/SkSLGLSLCodeGenerator.h" |
| 19 |
|
| 20 |
#include <cstdint> |
| 21 |
#include <string> |
| 22 |
|
| 23 |
class GrGLGpu; |
| 24 |
|
| 25 |
namespace SkSL { |
| 26 |
|
| 27 |
struct NativeShader; |
| 28 |
enum class ProgramKind : int8_t; |
| 29 |
struct ProgramInterface; |
| 30 |
struct ProgramSettings; |
| 31 |
struct ShaderCaps; |
| 32 |
|
| 33 |
} // namespace SkSL |
| 34 |
|
| 35 |
namespace skgpu { |
| 36 |
|
| 37 |
class ShaderErrorHandler; |
| 38 |
|
| 39 |
inline bool SkSLToGLSL(const SkSL::ShaderCaps* caps, |
| 40 |
const std::string& sksl, |
| 41 |
SkSL::ProgramKind programKind, |
| 42 |
const SkSL::ProgramSettings& settings, |
| 43 |
SkSL::NativeShader* glsl, |
| 44 |
SkSL::ProgramInterface* outInterface, |
| 45 |
ShaderErrorHandler* errorHandler) { |
| 46 |
return SkSLToBackend(caps, |
| 47 |
&SkSL::ToGLSL, |
| 48 |
"GLSL", |
| 49 |
sksl, |
| 50 |
programKind, |
| 51 |
settings, |
| 52 |
glsl, |
| 53 |
outInterface, |
| 54 |
errorHandler); |
| 55 |
} |
| 56 |
|
| 57 |
} // namespace skgpu |
| 58 |
|
| 59 |
GrGLuint GrGLCompileAndAttachShader(const GrGLContext& glCtx, |
| 60 |
GrGLuint programId, |
| 61 |
GrGLenum type, |
| 62 |
const SkSL::NativeShader& glsl, |
| 63 |
bool shaderWasCached, |
| 64 |
GrThreadSafePipelineBuilder::Stats*, |
| 65 |
GrContextOptions::ShaderErrorHandler* errorHandler); |
| 66 |
|
| 67 |
bool GrGLCheckLinkStatus(const GrGLGpu* gpu, |
| 68 |
GrGLuint programID, |
| 69 |
bool shaderWasCached, |
| 70 |
GrContextOptions::ShaderErrorHandler* errorHandler, |
| 71 |
const std::string* sksl[kGrShaderTypeCount], |
| 72 |
const SkSL::NativeShader glsl[kGrShaderTypeCount]); |
| 73 |
|
| 74 |
#endif |