Flutter Engine
The Flutter Engine
RuntimeShaderBuilder.java
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8package org.skia.jetski;
9
10import java.lang.String;
11
13 private long mNativeInstance;
14
15 public RuntimeShaderBuilder(String sksl) {
16 mNativeInstance = nCreate(sksl);
17 }
18
19 public RuntimeShaderBuilder setUniform(String name, float val) {
20 nSetUniformFloat(mNativeInstance, name, val);
21 return this;
22 }
23 public RuntimeShaderBuilder setUniform(String name, float valX, float valY, float valZ) {
24 nSetUniformFloat3(mNativeInstance, name, valX, valY, valZ);
25 return this;
26 }
28 nSetUniformMatrix(mNativeInstance, name, mat.getNativeInstance());
29 return this;
30 }
31
32 public Shader makeShader() {
33 return new Shader(nMakeShader(mNativeInstance));
34 }
35
36 /**
37 * Releases any resources associated with this RuntimeShaderBuilder.
38 */
39 public void release() {
40 nRelease(mNativeInstance);
41 mNativeInstance = 0;
42 }
43
44 @Override
45 protected void finalize() throws Throwable {
46 release();
47 }
48
49 private static native long nCreate(String sksl);
50 private static native void nRelease(long nativeInstance);
51
52 private static native void nSetUniformFloat(long nativeInstance, String name, float val);
53 private static native void nSetUniformFloat3(long nativeInstance, String name, float valX, float valY, float valZ);
54 private static native void nSetUniformMatrix(long nativeInstance, String name, long nativeMatrix);
55 private static native long nMakeShader(long nativeInstance);
56}
RuntimeShaderBuilder setUniform(String name, Matrix mat)
RuntimeShaderBuilder setUniform(String name, float valX, float valY, float valZ)
RuntimeShaderBuilder setUniform(String name, float val)
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32