Lines Matching refs:Caches
19 #include "Caches.h"
59 static inline void bindTexture(Caches* caches, Texture* texture, GLenum wrapS, GLenum wrapT) {
60 caches->textureState().bindTexture(texture->id());
120 bool tryStoreGradient(Caches& caches, const SkShader& shader, const Matrix4 modelViewMatrix,
169 outData->gradientTexture = caches.gradientCache.get(
184 void applyGradient(Caches& caches, const SkiaShaderData::GradientShaderData& data) {
186 caches.textureState().activateTexture(data.gradientSampler);
187 bindTexture(&caches, data.gradientTexture, data.wrapST, data.wrapST);
188 glUniform1i(caches.program().getUniform("gradientSampler"), data.gradientSampler);
190 bindUniformColor(caches.program().getUniform("startColor"), data.startColor);
191 bindUniformColor(caches.program().getUniform("endColor"), data.endColor);
197 caches.dither.setupProgram(caches.program(), &ditherSampler);
198 glUniformMatrix4fv(caches.program().getUniform("screenSpace"), 1,
202 bool tryStoreBitmap(Caches& caches, const SkShader& shader, const Matrix4& modelViewMatrix,
217 outData->bitmapTexture = caches.textureCache.getAndBypassAtlas(&bitmap);
226 if (!caches.extensions().hasNPot()
248 void applyBitmap(Caches& caches, const SkiaShaderData::BitmapShaderData& data) {
249 caches.textureState().activateTexture(data.bitmapSampler);
250 bindTexture(&caches, data.bitmapTexture, data.wrapS, data.wrapT);
253 glUniform1i(caches.program().getUniform("bitmapSampler"), data.bitmapSampler);
254 glUniformMatrix4fv(caches.program().getUniform("textureTransform"), 1, GL_FALSE,
256 glUniform2fv(caches.program().getUniform("textureDimension"), 1, &data.textureDimension[0]);
281 void storeCompose(Caches& caches, const SkShader& bitmapShader, const SkShader& gradientShader,
284 LOG_ALWAYS_FATAL_IF(!tryStoreBitmap(caches, bitmapShader, modelViewMatrix,
287 LOG_ALWAYS_FATAL_IF(!tryStoreGradient(caches, gradientShader, modelViewMatrix,
292 bool tryStoreCompose(Caches& caches, const SkShader& shader, const Matrix4& modelViewMatrix,
310 storeCompose(caches, *rec.fShaderA, *rec.fShaderB,
314 storeCompose(caches, *rec.fShaderB, *rec.fShaderA,
324 bool tryStoreLayer(Caches& caches, const SkShader& shader, const Matrix4& modelViewMatrix,
347 void applyLayer(Caches& caches, const SkiaShaderData::LayerShaderData& data) {
348 caches.textureState().activateTexture(data.bitmapSampler);
354 glUniform1i(caches.program().getUniform("bitmapSampler"), data.bitmapSampler);
355 glUniformMatrix4fv(caches.program().getUniform("textureTransform"), 1,
357 glUniform2fv(caches.program().getUniform("textureDimension"), 1, &data.textureDimension[0]);
360 void SkiaShader::store(Caches& caches, const SkShader& shader, const Matrix4& modelViewMatrix,
363 if (tryStoreGradient(caches, shader, modelViewMatrix,
369 if (tryStoreBitmap(caches, shader, modelViewMatrix,
375 if (tryStoreCompose(caches, shader, modelViewMatrix,
381 if (tryStoreLayer(caches, shader, modelViewMatrix,
391 void SkiaShader::apply(Caches& caches, const SkiaShaderData& data) {
395 applyGradient(caches, data.gradientData);
398 applyBitmap(caches, data.bitmapData);
402 applyLayer(caches, data.layerData);