diff options
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 55 | ||||
-rw-r--r-- | src/gpu/gl/GrGLProgramDataManager.cpp | 29 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUniformHandler.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.cpp | 3 |
4 files changed, 45 insertions, 44 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 3f66819a77..29df888f30 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -3474,13 +3474,13 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { } const char* version = shaderCaps->versionDeclString(); - GrShaderVar aVertex("a_vertex", kHalf2_GrSLType, GrShaderVar::kIn_TypeModifier); - GrShaderVar uTexCoordXform("u_texCoordXform", kHalf4_GrSLType, + GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); + GrShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); - GrShaderVar uPosXform("u_posXform", kHalf4_GrSLType, GrShaderVar::kUniform_TypeModifier); + GrShaderVar uPosXform("u_posXform", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); GrShaderVar uTexture("u_texture", samplerType, GrShaderVar::kUniform_TypeModifier); - GrShaderVar vTexCoord("v_texCoord", kHalf2_GrSLType, GrShaderVar::kOut_TypeModifier); - GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType, GrShaderVar::kOut_TypeModifier); + GrShaderVar vTexCoord("v_texCoord", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier); + GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType, GrShaderVar::kOut_TypeModifier); SkString vshaderTxt(version); if (shaderCaps->noperspectiveInterpolationSupport()) { @@ -3504,7 +3504,7 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { "void main() {" " v_texCoord = a_vertex.xy * u_texCoordXform.xy + u_texCoordXform.zw;" " gl_Position.xy = a_vertex * u_posXform.xy + u_posXform.zw;" - " gl_Position.zw = half2(0, 1);" + " gl_Position.zw = float2(0, 1);" "}" ); @@ -3518,6 +3518,8 @@ bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { fshaderTxt.appendf("#extension %s : require\n", shaderCaps->externalTextureExtensionString()); } + GrGLSLAppendDefaultFloatPrecisionDeclaration(kMedium_GrSLPrecision, *shaderCaps, + &fshaderTxt); vTexCoord.setTypeModifier(GrShaderVar::kIn_TypeModifier); vTexCoord.appendDecl(shaderCaps, &fshaderTxt); fshaderTxt.append(";"); @@ -3581,19 +3583,19 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { } const char* version = shaderCaps->versionDeclString(); - GrShaderVar aVertex("a_vertex", kHalf2_GrSLType, GrShaderVar::kIn_TypeModifier); - GrShaderVar uTexCoordXform("u_texCoordXform", kHalf4_GrSLType, + GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); + GrShaderVar uTexCoordXform("u_texCoordXform", kVec4f_GrSLType, GrShaderVar::kUniform_TypeModifier); GrShaderVar uTexture("u_texture", kTexture2DSampler_GrSLType, GrShaderVar::kUniform_TypeModifier); // We need 1, 2, or 4 texture coordinates (depending on parity of each dimension): GrShaderVar vTexCoords[] = { - GrShaderVar("v_texCoord0", kHalf2_GrSLType, GrShaderVar::kOut_TypeModifier), - GrShaderVar("v_texCoord1", kHalf2_GrSLType, GrShaderVar::kOut_TypeModifier), - GrShaderVar("v_texCoord2", kHalf2_GrSLType, GrShaderVar::kOut_TypeModifier), - GrShaderVar("v_texCoord3", kHalf2_GrSLType, GrShaderVar::kOut_TypeModifier), + GrShaderVar("v_texCoord0", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier), + GrShaderVar("v_texCoord1", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier), + GrShaderVar("v_texCoord2", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier), + GrShaderVar("v_texCoord3", kVec2f_GrSLType, GrShaderVar::kOut_TypeModifier), }; - GrShaderVar oFragColor("o_FragColor", kHalf4_GrSLType,GrShaderVar::kOut_TypeModifier); + GrShaderVar oFragColor("o_FragColor", kVec4f_GrSLType,GrShaderVar::kOut_TypeModifier); SkString vshaderTxt(version); if (shaderCaps->noperspectiveInterpolationSupport()) { @@ -3618,27 +3620,27 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { vshaderTxt.append( "// Mipmap Program VS\n" "void main() {" - " gl_Position.xy = a_vertex * half2(2, 2) - half2(1, 1);" - " gl_Position.zw = half2(0, 1);" + " gl_Position.xy = a_vertex * float2(2, 2) - float2(1, 1);" + " gl_Position.zw = float2(0, 1);" ); // Insert texture coordinate computation: if (oddWidth && oddHeight) { vshaderTxt.append( " v_texCoord0 = a_vertex.xy * u_texCoordXform.yw;" - " v_texCoord1 = a_vertex.xy * u_texCoordXform.yw + half2(u_texCoordXform.x, 0);" - " v_texCoord2 = a_vertex.xy * u_texCoordXform.yw + half2(0, u_texCoordXform.z);" + " v_texCoord1 = a_vertex.xy * u_texCoordXform.yw + float2(u_texCoordXform.x, 0);" + " v_texCoord2 = a_vertex.xy * u_texCoordXform.yw + float2(0, u_texCoordXform.z);" " v_texCoord3 = a_vertex.xy * u_texCoordXform.yw + u_texCoordXform.xz;" ); } else if (oddWidth) { vshaderTxt.append( - " v_texCoord0 = a_vertex.xy * half2(u_texCoordXform.y, 1);" - " v_texCoord1 = a_vertex.xy * half2(u_texCoordXform.y, 1) + half2(u_texCoordXform.x, 0);" + " v_texCoord0 = a_vertex.xy * float2(u_texCoordXform.y, 1);" + " v_texCoord1 = a_vertex.xy * float2(u_texCoordXform.y, 1) + float2(u_texCoordXform.x, 0);" ); } else if (oddHeight) { vshaderTxt.append( - " v_texCoord0 = a_vertex.xy * half2(1, u_texCoordXform.w);" - " v_texCoord1 = a_vertex.xy * half2(1, u_texCoordXform.w) + half2(0, u_texCoordXform.z);" + " v_texCoord0 = a_vertex.xy * float2(1, u_texCoordXform.w);" + " v_texCoord1 = a_vertex.xy * float2(1, u_texCoordXform.w) + float2(0, u_texCoordXform.z);" ); } else { vshaderTxt.append( @@ -3654,6 +3656,8 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { fshaderTxt.appendf("#extension %s : require\n", extension); } } + GrGLSLAppendDefaultFloatPrecisionDeclaration(kMedium_GrSLPrecision, *shaderCaps, + &fshaderTxt); for (int i = 0; i < numTaps; ++i) { vTexCoords[i].setTypeModifier(GrShaderVar::kIn_TypeModifier); vTexCoords[i].appendDecl(shaderCaps, &fshaderTxt); @@ -3739,7 +3743,7 @@ bool GrGLGpu::createStencilClipClearProgram() { return false; } - GrShaderVar aVertex("a_vertex", kHalf2_GrSLType, GrShaderVar::kIn_TypeModifier); + GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); const char* version = this->caps()->shaderCaps()->versionDeclString(); SkString vshaderTxt(version); @@ -3748,14 +3752,17 @@ bool GrGLGpu::createStencilClipClearProgram() { vshaderTxt.append( "// Stencil Clip Clear Program VS\n" "void main() {" - " gl_Position = highfloat4(a_vertex.x, a_vertex.y, 0, 1);" + " gl_Position = float4(a_vertex.x, a_vertex.y, 0, 1);" "}"); SkString fshaderTxt(version); + GrGLSLAppendDefaultFloatPrecisionDeclaration(kMedium_GrSLPrecision, + *this->caps()->shaderCaps(), + &fshaderTxt); fshaderTxt.appendf( "// Stencil Clip Clear Program FS\n" "void main() {" - " sk_FragColor = half4(0);" + " sk_FragColor = float4(0);" "}"); const char* str; diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp index a8e3a6345f..3414abac44 100644 --- a/src/gpu/gl/GrGLProgramDataManager.cpp +++ b/src/gpu/gl/GrGLProgramDataManager.cpp @@ -73,7 +73,7 @@ void GrGLProgramDataManager::setImageStorages(const UniformInfoArray& images) co void GrGLProgramDataManager::set1i(UniformHandle u, int32_t i) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kInt_GrSLType || uni.fType == kShort_GrSLType); + SkASSERT(uni.fType == kInt_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fLocation, i)); @@ -84,7 +84,7 @@ void GrGLProgramDataManager::set1iv(UniformHandle u, int arrayCount, const int v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kInt_GrSLType || uni.fType == kShort_GrSLType); + SkASSERT(uni.fType == kInt_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -94,7 +94,7 @@ void GrGLProgramDataManager::set1iv(UniformHandle u, void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat_GrSLType || uni.fType == kHalf_GrSLType); + SkASSERT(uni.fType == kFloat_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fLocation, v0)); @@ -105,7 +105,7 @@ void GrGLProgramDataManager::set1fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat_GrSLType || uni.fType == kHalf_GrSLType); + SkASSERT(uni.fType == kFloat_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); // This assert fires in some instances of the two-pt gradient for its VSParams. @@ -119,7 +119,7 @@ void GrGLProgramDataManager::set1fv(UniformHandle u, void GrGLProgramDataManager::set2f(UniformHandle u, float v0, float v1) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2_GrSLType || uni.fType == kHalf2_GrSLType); + SkASSERT(uni.fType == kVec2f_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fLocation, v0, v1)); @@ -130,7 +130,7 @@ void GrGLProgramDataManager::set2fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2_GrSLType || uni.fType == kHalf2_GrSLType); + SkASSERT(uni.fType == kVec2f_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -140,7 +140,7 @@ void GrGLProgramDataManager::set2fv(UniformHandle u, void GrGLProgramDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat3_GrSLType || uni.fType == kHalf3_GrSLType); + SkASSERT(uni.fType == kVec3f_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fLocation, v0, v1, v2)); @@ -151,7 +151,7 @@ void GrGLProgramDataManager::set3fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat3_GrSLType || uni.fType == kHalf3_GrSLType); + SkASSERT(uni.fType == kVec3f_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -165,7 +165,7 @@ void GrGLProgramDataManager::set4f(UniformHandle u, float v2, float v3) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat4_GrSLType || uni.fType == kHalf4_GrSLType); + SkASSERT(uni.fType == kVec4f_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fLocation, v0, v1, v2, v3)); @@ -176,7 +176,7 @@ void GrGLProgramDataManager::set4fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat4_GrSLType || uni.fType == kHalf4_GrSLType); + SkASSERT(uni.fType == kVec4f_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -214,8 +214,7 @@ template<int N> inline void GrGLProgramDataManager::setMatrices(UniformHandle u, int arrayCount, const float matrices[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2x2_GrSLType + (N - 2) || - uni.fType == kHalf2x2_GrSLType + (N - 2)); + SkASSERT(uni.fType == kMat22f_GrSLType + (N - 2)); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -247,10 +246,8 @@ void GrGLProgramDataManager::setPathFragmentInputTransform(VaryingHandle u, SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); const PathProcVarying& fragmentInput = fPathProcVaryings[u.toIndex()]; - SkASSERT((components == 2 && (fragmentInput.fType == kHighFloat2_GrSLType || - fragmentInput.fType == kHalf2_GrSLType)) || - (components == 3 && (fragmentInput.fType == kHighFloat3_GrSLType || - fragmentInput.fType == kHalf3_GrSLType))); + SkASSERT((components == 2 && fragmentInput.fType == kVec2f_GrSLType) || + (components == 3 && fragmentInput.fType == kVec3f_GrSLType)); fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID, fragmentInput.fLocation, diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp index 914f8bc6c5..4d718a0e4a 100644 --- a/src/gpu/gl/GrGLUniformHandler.cpp +++ b/src/gpu/gl/GrGLUniformHandler.cpp @@ -24,7 +24,7 @@ GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray( const char** outName) { SkASSERT(name && strlen(name)); SkASSERT(0 != visibility); - SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeTemporarilyAcceptsPrecision(type)); + SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeAcceptsPrecision(type)); UniformInfo& uni = fUniforms.push_back(); uni.fVariable.setType(type); diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 31d20f0421..b7d31203aa 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -139,9 +139,6 @@ GrGLProgram* GrGLProgramBuilder::finalize() { return nullptr; } - if (fFS.fForceHighPrecision) { - settings.fForceHighPrecision = true; - } if (!this->compileAndAttachShaders(fFS, programID, GR_GL_FRAGMENT_SHADER, &shadersToDelete, settings, &inputs)) { this->cleanupProgram(programID, shadersToDelete); |