MCPcopy Index your code
hub / github.com/tensorflow/tfjs / drawTextureProgram

Function drawTextureProgram

tfjs-react-native/src/camera/camera_webgl_util.ts:308–331  ·  view source on GitHub ↗
(
    gl: WebGL2RenderingContext, flipHorizontal: boolean, flipVertical: boolean,
    rotation: Rotation)

Source from the content-addressed store, hash-verified

306}
307
308export function drawTextureProgram(
309 gl: WebGL2RenderingContext, flipHorizontal: boolean, flipVertical: boolean,
310 rotation: Rotation): ProgramObjects {
311 if (!programCacheByContext.has(gl)) {
312 programCacheByContext.set(gl, new Map());
313 }
314 const programCache = programCacheByContext.get(gl);
315
316 const cacheKey = `drawTexture_${flipHorizontal}_${flipVertical}_${rotation}`;
317 if (!programCache.has(cacheKey)) {
318 const vertSource = drawTextureProgramInfo.vertexShaderSource(
319 flipHorizontal, flipVertical, rotation);
320 const fragSource = drawTextureProgramInfo.fragmentShaderSource();
321
322 const vertices = drawTextureProgramInfo.vertices();
323 const texCoords = drawTextureProgramInfo.texCoords();
324
325 const programObjects =
326 createProgramObjects(gl, vertSource, fragSource, vertices, texCoords);
327
328 programCache.set(cacheKey, programObjects);
329 }
330 return programCache.get(cacheKey);
331}
332
333function resizeProgram(
334 gl: WebGL2RenderingContext, sourceDims: Dimensions, targetDims: Dimensions,

Callers 2

drawTextureFunction · 0.85
runResizeProgramFunction · 0.85

Calls 4

createProgramObjectsFunction · 0.85
hasMethod · 0.80
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…