Modify GLSL version declaration to allow access to compat. features
R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://chromiumcodereview.appspot.com/23526008 git-svn-id: http://skia.googlecode.com/svn/trunk@11033 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
46fbfe0cd1
commit
06f0598957
@ -33,26 +33,30 @@ GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding, const GrGLInterface* g
|
||||
}
|
||||
}
|
||||
|
||||
const char* GrGetGLSLVersionDecl(GrGLBinding binding, GrGLSLGeneration gen) {
|
||||
switch (gen) {
|
||||
const char* GrGetGLSLVersionDecl(const GrGLContextInfo& info) {
|
||||
switch (info.glslGeneration()) {
|
||||
case k110_GrGLSLGeneration:
|
||||
if (kES_GrGLBinding == binding) {
|
||||
if (kES_GrGLBinding == info.binding()) {
|
||||
// ES2s shader language is based on version 1.20 but is version
|
||||
// 1.00 of the ES language.
|
||||
return "#version 100\n";
|
||||
} else {
|
||||
SkASSERT(kDesktop_GrGLBinding == binding);
|
||||
SkASSERT(kDesktop_GrGLBinding == info.binding());
|
||||
return "#version 110\n";
|
||||
}
|
||||
case k130_GrGLSLGeneration:
|
||||
SkASSERT(kDesktop_GrGLBinding == binding);
|
||||
SkASSERT(kDesktop_GrGLBinding == info.binding());
|
||||
return "#version 130\n";
|
||||
case k140_GrGLSLGeneration:
|
||||
SkASSERT(kDesktop_GrGLBinding == binding);
|
||||
SkASSERT(kDesktop_GrGLBinding == info.binding());
|
||||
return "#version 140\n";
|
||||
case k150_GrGLSLGeneration:
|
||||
SkASSERT(kDesktop_GrGLBinding == binding);
|
||||
return "#version 150\n";
|
||||
SkASSERT(kDesktop_GrGLBinding == info.binding());
|
||||
if (info.caps()->isCoreProfile()) {
|
||||
return "#version 150\n";
|
||||
} else {
|
||||
return "#version 150 compatibility\n";
|
||||
}
|
||||
default:
|
||||
GrCrash("Unknown GL version.");
|
||||
return ""; // suppress warning
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "GrColor.h"
|
||||
#include "GrTypesPriv.h"
|
||||
|
||||
class GrGLContextInfo;
|
||||
class GrGLShaderVar;
|
||||
class SkString;
|
||||
|
||||
@ -83,8 +84,7 @@ GrGLSLGeneration GrGetGLSLGeneration(GrGLBinding binding,
|
||||
* Returns a string to include at the beginning of a shader to declare the GLSL
|
||||
* version.
|
||||
*/
|
||||
const char* GrGetGLSLVersionDecl(GrGLBinding binding,
|
||||
GrGLSLGeneration v);
|
||||
const char* GrGetGLSLVersionDecl(const GrGLContextInfo&);
|
||||
|
||||
/**
|
||||
* Depending on the GLSL version being emitted there may be an assumed output
|
||||
|
@ -589,7 +589,7 @@ void GrGLShaderBuilder::appendUniformDecls(ShaderType stype, SkString* out) cons
|
||||
}
|
||||
|
||||
void GrGLShaderBuilder::getShader(ShaderType type, SkString* shaderStr) const {
|
||||
const char* version = GrGetGLSLVersionDecl(fCtxInfo.binding(), fCtxInfo.glslGeneration());
|
||||
const char* version = GrGetGLSLVersionDecl(fCtxInfo);
|
||||
|
||||
switch (type) {
|
||||
case kVertex_ShaderType:
|
||||
|
Loading…
Reference in New Issue
Block a user