Esempio n. 1
0
void GrGpuGLShaders::flushTexelSize(int s) {
    const int& uni = fProgramData->fUniLocations.fStages[s].fNormalizedTexelSizeUni;
    if (GrGLProgram::kUnusedUniform != uni) {
        GrGLTexture* texture = (GrGLTexture*) fCurrDrawState.fTextures[s];
        if (texture->allocatedWidth() != fProgramData->fTextureWidth[s] ||
            texture->allocatedHeight() != fProgramData->fTextureWidth[s]) {

            float texelSize[] = {1.f / texture->allocatedWidth(),
                                 1.f / texture->allocatedHeight()};
            GL_CALL(Uniform2fv(uni, 1, texelSize));
        }
    }
}