Merge pull request #899 from davidgyu/ctest_glimaging_fix

Fixed glImaging errors w/ ctest
This commit is contained in:
Takahito Tejima 2016-10-21 15:11:43 -07:00 committed by GitHub
commit 207cd92bb9
2 changed files with 18 additions and 3 deletions

View File

@ -115,7 +115,9 @@ public:
ss << "#define OSD_ENABLE_PATCH_CULL\n";
ss << "#define GEOMETRY_OUT_LINE\n";
ss << "#define OSD_PATCH_ENABLE_SINGLE_CREASE\n";
if (desc.IsAdaptive() && type == Far::PatchDescriptor::REGULAR) {
ss << "#define OSD_PATCH_ENABLE_SINGLE_CREASE\n";
}
// include osd PatchCommon
ss << Osd::GLSLPatchShaderSource::GetCommonShaderSource();

View File

@ -138,12 +138,18 @@ void main()
layout(triangle_strip, max_vertices = EDGE_VERTS) out;
in block {
OutputVertex v;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
vec2 vSegments;
#endif
OSD_USER_VARYING_DECLARE
} inpt[EDGE_VERTS];
out block {
OutputVertex v;
noperspective out vec4 edgeDistance;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
vec2 vSegments;
#endif
OSD_USER_VARYING_DECLARE
} outpt;
@ -157,6 +163,10 @@ void emit(int index, vec3 normal)
outpt.v.normal = normal;
#endif
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
outpt.vSegments = inpt[index].vSegments;
#endif
outpt.color = inpt[index].color;
gl_Position = ProjectionMatrix * inpt[index].v.position;
@ -187,6 +197,7 @@ void emit(int index, vec3 normal, vec4 edgeVerts[EDGE_VERTS])
edgeDistance(edgeVerts[index], edgeVerts[1], edgeVerts[2]);
#ifdef PRIM_TRI
outpt.edgeDistance[2] =
outpt.edgeDistance[3] =
edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[0]);
#endif
#ifdef PRIM_QUAD
@ -272,6 +283,9 @@ void main()
in block {
OutputVertex v;
noperspective in vec4 edgeDistance;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
vec2 vSegments;
#endif
OSD_USER_VARYING_DECLARE
} inpt;
@ -346,8 +360,7 @@ getAdaptivePatchColor(ivec3 patchParam)
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
// check this after boundary/corner since single crease patch also has edgeCount.
float sharpness = OsdGetPatchSharpness(patchParam);
if (sharpness > 0) {
if (inpt.vSegments.y > 0) {
patchType = 1;
}
#elif defined OSD_PATCH_GREGORY