skia2/include/private/GrGLSL.h
Robert Phillips 8296e752fa Switch atlas clients over to using absolute texture coordinates (take 2)
This is a prerequisite for being able to resize the atlas with impunity.

Change-Id: Iccc9c7ced43f38a7d8483a7bd12a458d59a3453a
Reviewed-on: https://skia-review.googlesource.com/38362
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2017-08-25 15:19:27 +00:00

91 lines
2.1 KiB
C++

/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrGLSL_DEFINED
#define GrGLSL_DEFINED
#include "GrTypesPriv.h"
#include "SkString.h"
class GrShaderCaps;
// Limited set of GLSL versions we build shaders for. Caller should round
// down the GLSL version to one of these enums.
enum GrGLSLGeneration {
/**
* Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20)
*/
k110_GrGLSLGeneration,
/**
* Desktop GLSL 1.30
*/
k130_GrGLSLGeneration,
/**
* Desktop GLSL 1.40
*/
k140_GrGLSLGeneration,
/**
* Desktop GLSL 1.50
*/
k150_GrGLSLGeneration,
/**
* Desktop GLSL 3.30, and ES GLSL 3.00
*/
k330_GrGLSLGeneration,
/**
* Desktop GLSL 4.00
*/
k400_GrGLSLGeneration,
/**
* Desktop GLSL 4.20
*/
k420_GrGLSLGeneration,
/**
* ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular
*/
k310es_GrGLSLGeneration,
/**
* ES GLSL 3.20
*/
k320es_GrGLSLGeneration,
};
bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration);
/**
* Adds a line of GLSL code to declare the default precision for float types.
*/
void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision,
const GrShaderCaps&,
SkString* out);
/**
* Converts a GrSLPrecision to its corresponding GLSL precision qualifier.
*/
static inline const char* GrGLSLPrecisionString(GrSLPrecision p) {
switch (p) {
case kLow_GrSLPrecision:
return "lowp";
case kMedium_GrSLPrecision:
return "mediump";
case kHigh_GrSLPrecision:
return "highp";
case kDefault_GrSLPrecision:
return "";
default:
SK_ABORT("Unexpected precision type.");
return "";
}
}
/**
* Converts a GrSLType to a string containing the name of the equivalent GLSL type.
*/
const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t);
#endif