aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-22 21:05:48 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-22 21:05:48 +0000
commit77cf460e5df7dd5272e71f9835880ded48fe8d12 (patch)
tree014373044710597de18ed0fabbf0742a1d83596f /src/gpu
parent5d7ca957edcc57f7f0be2741183e8d3c36cb5129 (diff)
Add non-separable xfer modes to GPU backend.
Review URL: https://codereview.chromium.org/14371014 git-svn-id: http://skia.googlecode.com/svn/trunk@8815 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/gl/GrGLShaderBuilder.cpp12
-rw-r--r--src/gpu/gl/GrGLShaderVar.h17
2 files changed, 19 insertions, 10 deletions
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index 60e9188252..752464cf4a 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -386,7 +386,7 @@ void GrGLShaderBuilder::addVarying(GrSLType type,
const char** fsInName) {
fVSOutputs.push_back();
fVSOutputs.back().setType(type);
- fVSOutputs.back().setTypeModifier(GrGLShaderVar::kOut_TypeModifier);
+ fVSOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier);
if (kNonStageIdx == fCurrentStageIdx) {
fVSOutputs.back().accessName()->printf("v%s", name);
} else {
@@ -402,12 +402,12 @@ void GrGLShaderBuilder::addVarying(GrSLType type,
// and output as non-array.
fGSInputs.push_back();
fGSInputs.back().setType(type);
- fGSInputs.back().setTypeModifier(GrGLShaderVar::kIn_TypeModifier);
+ fGSInputs.back().setTypeModifier(GrGLShaderVar::kVaryingIn_TypeModifier);
fGSInputs.back().setUnsizedArray();
*fGSInputs.back().accessName() = fVSOutputs.back().getName();
fGSOutputs.push_back();
fGSOutputs.back().setType(type);
- fGSOutputs.back().setTypeModifier(GrGLShaderVar::kOut_TypeModifier);
+ fGSOutputs.back().setTypeModifier(GrGLShaderVar::kVaryingOut_TypeModifier);
if (kNonStageIdx == fCurrentStageIdx) {
fGSOutputs.back().accessName()->printf("g%s", name);
} else {
@@ -419,7 +419,7 @@ void GrGLShaderBuilder::addVarying(GrSLType type,
}
fFSInputs.push_back();
fFSInputs.back().setType(type);
- fFSInputs.back().setTypeModifier(GrGLShaderVar::kIn_TypeModifier);
+ fFSInputs.back().setTypeModifier(GrGLShaderVar::kVaryingIn_TypeModifier);
fFSInputs.back().setName(*fsName);
if (fsInName) {
*fsInName = fsName->c_str();
@@ -487,11 +487,11 @@ void GrGLShaderBuilder::emitFunction(ShaderType shader,
GrAssert(kFragment_ShaderType == shader);
fFSFunctions.append(GrGLSLTypeString(returnType));
if (kNonStageIdx != fCurrentStageIdx) {
- outName->printf(" %s_%d", name, fCurrentStageIdx);
+ outName->printf("%s_%d", name, fCurrentStageIdx);
} else {
*outName = name;
}
- fFSFunctions.append(*outName);
+ fFSFunctions.appendf(" %s", outName->c_str());
fFSFunctions.append("(");
for (int i = 0; i < argCnt; ++i) {
args[i].appendDecl(fCtxInfo, &fFSFunctions);
diff --git a/src/gpu/gl/GrGLShaderVar.h b/src/gpu/gl/GrGLShaderVar.h
index 7f2bf458a8..c79589772a 100644
--- a/src/gpu/gl/GrGLShaderVar.h
+++ b/src/gpu/gl/GrGLShaderVar.h
@@ -29,8 +29,11 @@ public:
kNone_TypeModifier,
kOut_TypeModifier,
kIn_TypeModifier,
+ kInOut_TypeModifier,
kUniform_TypeModifier,
- kAttribute_TypeModifier
+ kAttribute_TypeModifier,
+ kVaryingIn_TypeModifier,
+ kVaryingOut_TypeModifier
};
enum Precision {
@@ -303,14 +306,20 @@ private:
switch (t) {
case kNone_TypeModifier:
return "";
- case kOut_TypeModifier:
- return k110_GrGLSLGeneration == gen ? "varying" : "out";
case kIn_TypeModifier:
- return k110_GrGLSLGeneration == gen ? "varying" : "in";
+ return "in";
+ case kInOut_TypeModifier:
+ return "inout";
+ case kOut_TypeModifier:
+ return "out";
case kUniform_TypeModifier:
return "uniform";
case kAttribute_TypeModifier:
return k110_GrGLSLGeneration == gen ? "attribute" : "in";
+ case kVaryingIn_TypeModifier:
+ return k110_GrGLSLGeneration == gen ? "varying" : "in";
+ case kVaryingOut_TypeModifier:
+ return k110_GrGLSLGeneration == gen ? "varying" : "out";
default:
GrCrash("Unknown shader variable type modifier.");
return ""; // suppress warning