Project

General

Profile

« Previous | Next » 

Revision 6637d0f2

Added by Leszek Koltunski over 7 years ago

Speed up shaders (both compilation and execution) by explicitly enabling only the needed effects.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java
28 28
import org.distorted.library.Distorted;
29 29
import org.distorted.library.DistortedEffects;
30 30
import org.distorted.library.DistortedScreen;
31
import org.distorted.library.EffectNames;
31 32
import org.distorted.library.MeshFlat;
32 33
import org.distorted.library.DistortedTexture;
33 34
import org.distorted.library.EffectTypes;
......
135 136
      mScreen.detachAll();
136 137
      mScreen.attach(texture, mEffects, mesh );
137 138

  
139
      DistortedEffects.enableEffect(EffectNames.DISTORT);
140
      DistortedEffects.enableEffect(EffectNames.SINK);
141
      DistortedEffects.enableEffect(EffectNames.PINCH);
142
      DistortedEffects.enableEffect(EffectNames.SWIRL);
143
      DistortedEffects.enableEffect(EffectNames.CHROMA);
144
      DistortedEffects.enableEffect(EffectNames.SMOOTH_CHROMA);
145
      DistortedEffects.enableEffect(EffectNames.CONTRAST);
146

  
138 147
      try
139 148
        {
140 149
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/bean/BeanRenderer.java
29 29

  
30 30
import org.distorted.library.DistortedEffects;
31 31
import org.distorted.library.DistortedScreen;
32
import org.distorted.library.EffectNames;
32 33
import org.distorted.library.EffectTypes;
33 34
import org.distorted.library.Distorted;
34 35
import org.distorted.library.DistortedTexture;
......
156 157
      mScreen.detachAll();
157 158
      mScreen.attach(texture,mEffects,mesh);
158 159

  
160
      DistortedEffects.enableEffect(EffectNames.DISTORT);
161

  
159 162
      try
160 163
        {
161 164
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/blur/BlurRenderer.java
29 29
import org.distorted.library.DistortedEffects;
30 30
import org.distorted.library.DistortedScreen;
31 31
import org.distorted.library.DistortedTexture;
32
import org.distorted.library.EffectNames;
32 33
import org.distorted.library.EffectTypes;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.type.Dynamic1D;
......
142 143
      mScreen.detachAll();
143 144
      mScreen.attach(texture,mEffects,mMesh);
144 145

  
146
      DistortedEffects.enableEffect(EffectNames.BLUR);
147

  
145 148
      try
146 149
        {
147 150
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
30 30
import org.distorted.library.DistortedEffects;
31 31
import org.distorted.library.DistortedScreen;
32 32
import org.distorted.library.DistortedTexture;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.EffectTypes;
35 36
import org.distorted.library.type.Dynamic1D;
......
119 120
      mScreen.detachAll();
120 121
      mScreen.attach(texture,mEffects,mMesh);
121 122

  
123
      DistortedEffects.enableEffect(EffectNames.SMOOTH_CHROMA);
124
      DistortedEffects.enableEffect(EffectNames.ALPHA);
125

  
122 126
      try
123 127
        {
124 128
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/check/CheckRenderer.java
31 31
import org.distorted.library.DistortedEffects;
32 32
import org.distorted.library.DistortedScreen;
33 33
import org.distorted.library.DistortedTexture;
34
import org.distorted.library.EffectNames;
34 35
import org.distorted.library.MeshFlat;
35 36
import org.distorted.library.EffectTypes;
36 37
import org.distorted.library.type.Dynamic3D;
......
182 183
        Log.e("Check", "Failed to add Chroma effect!");
183 184
        }
184 185

  
186
      DistortedEffects.enableEffect(EffectNames.SWIRL);
187
      DistortedEffects.enableEffect(EffectNames.DEFORM);
188
      DistortedEffects.enableEffect(EffectNames.CHROMA);
189

  
185 190
      try
186 191
        {
187 192
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/deform/DeformRenderer.java
232 232
     {
233 233
     GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
234 234

  
235
     DistortedEffects.enableEffect(EffectNames.DISTORT);
236
     DistortedEffects.enableEffect(EffectNames.DEFORM);
237

  
235 238
     try
236 239
       {
237 240
       Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java
31 31
import org.distorted.library.DistortedScreen;
32 32
import org.distorted.library.DistortedTexture;
33 33
import org.distorted.library.DistortedEffects;
34
import org.distorted.library.EffectNames;
34 35
import org.distorted.library.MeshFlat;
35 36
import org.distorted.library.EffectTypes;
36 37
import org.distorted.library.type.Dynamic3D;
......
171 172
      mScreen.detachAll();
172 173
      for(int i=NUM-1; i>=0; i--) mScreen.attach(texture[i], mEffects[i], mesh);
173 174

  
175
      DistortedEffects.enableEffect(EffectNames.SINK);
176
      DistortedEffects.enableEffect(EffectNames.DISTORT);
177

  
174 178
      try
175 179
        {
176 180
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
30 30
import org.distorted.library.Distorted;
31 31
import org.distorted.library.DistortedEffects;
32 32
import org.distorted.library.DistortedScreen;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.DistortedTexture;
35 36
import org.distorted.library.EffectTypes;
......
171 172
     mScreen.detachAll();
172 173
     for(int i=NUM-1; i>=0; i--) mScreen.attach(texture, mEffects[i], mesh);
173 174

  
175
     DistortedEffects.enableEffect(EffectNames.SINK);
176
     DistortedEffects.enableEffect(EffectNames.DISTORT);
177
     DistortedEffects.enableEffect(EffectNames.CHROMA);
178

  
174 179
     try
175 180
       {
176 181
       Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
108 108
    mScreen.detachAll();
109 109
    mScreen.attach(mTexture,mEffects,mMesh);
110 110

  
111
    DistortedEffects.enableEffect(EffectNames.DISTORT);
112
    DistortedEffects.enableEffect(EffectNames.SINK);
113
    DistortedEffects.enableEffect(EffectNames.SMOOTH_ALPHA);
114
    DistortedEffects.enableEffect(EffectNames.SATURATION);
115
    DistortedEffects.enableEffect(EffectNames.SMOOTH_CHROMA);
116

  
111 117
    try
112 118
      {
113 119
      Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
30 30
import org.distorted.library.DistortedNode;
31 31
import org.distorted.library.DistortedScreen;
32 32
import org.distorted.library.DistortedTexture;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.MeshObject;
35 36
import org.distorted.library.EffectTypes;
......
276 277
      mCenterTexture.setTexture(bitmapC);
277 278
      mRegionTexture.setTexture(bitmapR);
278 279

  
280
      EffectTypes type;
281

  
282
      for( EffectNames name : EffectNames.values() )
283
        {
284
        type = name.getType();
285

  
286
        if( type== EffectTypes.VERTEX || type==EffectTypes.FRAGMENT )
287
          {
288
          DistortedEffects.enableEffect(name);
289
          }
290
        }
291

  
279 292
      try
280 293
        {
281 294
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/fbo/FBORenderer.java
32 32
import org.distorted.library.DistortedNode;
33 33
import org.distorted.library.DistortedScreen;
34 34
import org.distorted.library.Distorted;
35
import org.distorted.library.EffectNames;
35 36
import org.distorted.library.MeshCubes;
36 37
import org.distorted.library.MeshFlat;
37 38
import org.distorted.library.DistortedTexture;
......
189 190
      chromaDyn.add(new Static1D(1.0f));
190 191

  
191 192
      mEffects.chroma(chromaDyn, new Static3D(0,0,1) );
192
      
193

  
194
      DistortedEffects.enableEffect(EffectNames.SINK);
195
      DistortedEffects.enableEffect(EffectNames.CHROMA);
196

  
193 197
      try
194 198
        {
195 199
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/flag/FlagRenderer.java
28 28
import org.distorted.library.Distorted;
29 29
import org.distorted.library.DistortedEffects;
30 30
import org.distorted.library.DistortedScreen;
31
import org.distorted.library.EffectNames;
31 32
import org.distorted.library.MeshCubes;
32 33
import org.distorted.library.DistortedTexture;
33 34
import org.distorted.library.EffectTypes;
......
196 197
        }  
197 198
      
198 199
      mTexture.setTexture(bitmap);
199
      
200

  
201
      DistortedEffects.enableEffect(EffectNames.WAVE);
202

  
200 203
      try
201 204
        {
202 205
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/girl/GirlRenderer.java
29 29

  
30 30
import org.distorted.library.Distorted;
31 31
import org.distorted.library.DistortedScreen;
32
import org.distorted.library.EffectNames;
32 33
import org.distorted.library.MeshFlat;
33 34
import org.distorted.library.DistortedTexture;
34 35
import org.distorted.library.DistortedEffects;
......
213 214
      mScreen.detachAll();
214 215
      mScreen.attach(texture,mEffects,mesh);
215 216

  
217
      DistortedEffects.enableEffect(EffectNames.DISTORT);
218
      DistortedEffects.enableEffect(EffectNames.SINK);
219
      DistortedEffects.enableEffect(EffectNames.SWIRL);
220

  
216 221
      try
217 222
        {
218 223
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/listener/ListenerRenderer.java
166 166
      mScreen.attach(texture,mEffects,mesh);
167 167

  
168 168
      for(int i=0; i<NUM_BUBBLES; i++) randomizeNewBubble();
169
      
169

  
170
      DistortedEffects.enableEffect(EffectNames.DISTORT);
171

  
170 172
      try
171 173
        {
172 174
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/mirror/MirrorRenderer.java
30 30
import org.distorted.library.DistortedFramebuffer;
31 31
import org.distorted.library.DistortedScreen;
32 32
import org.distorted.library.DistortedTexture;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.type.Dynamic3D;
35 36
import org.distorted.library.type.Static1D;
......
195 196
      mTextureMirror.setTexture(bitmapM);
196 197
      mTextureHead.setTexture(bitmapH);
197 198

  
199
      DistortedEffects.enableEffect(EffectNames.BRIGHTNESS);
200

  
198 201
      try
199 202
        {
200 203
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java
30 30
import org.distorted.library.DistortedEffects;
31 31
import org.distorted.library.DistortedScreen;
32 32
import org.distorted.library.DistortedTexture;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.EffectTypes;
35 36
import org.distorted.library.type.Dynamic3D;
......
139 140
      mScreen.detachAll();
140 141
      mScreen.attach(texture,mEffects,mesh);
141 142

  
143
      DistortedEffects.enableEffect(EffectNames.DISTORT);
144

  
142 145
      try
143 146
        {
144 147
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
32 32
import org.distorted.library.DistortedScreen;
33 33
import org.distorted.library.DistortedTexture;
34 34
import org.distorted.library.DistortedEffects;
35
import org.distorted.library.EffectNames;
35 36
import org.distorted.library.MeshFlat;
36 37
import org.distorted.library.Distorted;
37 38

  
......
108 109

  
109 110
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
110 111
     {
112
     DistortedEffects.enableEffect(EffectNames.SWIRL);
113
     DistortedEffects.enableEffect(EffectNames.SMOOTH_ALPHA);
114
     DistortedEffects.enableEffect(EffectNames.SMOOTH_CHROMA);
115
     DistortedEffects.enableEffect(EffectNames.DISTORT);
116
     DistortedEffects.enableEffect(EffectNames.SINK);
117

  
111 118
     try
112 119
       {
113 120
       Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java
29 29
import org.distorted.library.DistortedEffects;
30 30
import org.distorted.library.DistortedScreen;
31 31
import org.distorted.library.DistortedTexture;
32
import org.distorted.library.EffectNames;
32 33
import org.distorted.library.EffectTypes;
33 34
import org.distorted.library.MeshCubes;
34 35
import org.distorted.library.type.DynamicQuat;
......
169 170
      mTex1.setTexture(bitmap1);
170 171
      mTex2.setTexture(bitmap2);
171 172

  
173
      DistortedEffects.enableEffect(EffectNames.BLUR);
174

  
172 175
      try
173 176
        {
174 177
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java
30 30
import org.distorted.library.DistortedEffects;
31 31
import org.distorted.library.DistortedScreen;
32 32
import org.distorted.library.DistortedNode;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.EffectTypes;
34 35
import org.distorted.library.MeshFlat;
35 36
import org.distorted.library.type.Dynamic1D;
......
209 210
        }  
210 211
      
211 212
      mLeaf.setTexture(leaf);
212
      
213

  
214
      DistortedEffects.enableEffect(EffectNames.CHROMA);
215

  
213 216
      try
214 217
        {
215 218
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
33 33
import org.distorted.library.Distorted;
34 34
import org.distorted.library.DistortedEffects;
35 35
import org.distorted.library.DistortedScreen;
36
import org.distorted.library.EffectNames;
36 37
import org.distorted.library.MeshFlat;
37 38
import org.distorted.library.DistortedTexture;
38 39
import org.distorted.library.EffectTypes;
......
216 217
    mScreen.detachAll();
217 218
    mScreen.attach(texture,mEffects,mesh);
218 219

  
220
    DistortedEffects.enableEffect(EffectNames.DISTORT);
221

  
219 222
    try
220 223
      {
221 224
      Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
25 25
import org.distorted.library.Distorted;
26 26
import org.distorted.library.DistortedEffects;
27 27
import org.distorted.library.DistortedScreen;
28
import org.distorted.library.EffectNames;
28 29
import org.distorted.library.MeshFlat;
29 30
import org.distorted.library.DistortedTexture;
30 31
import org.distorted.library.type.Static3D;
......
131 132
      {
132 133
      GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
133 134

  
135
      DistortedEffects.enableEffect(EffectNames.DISTORT);
136

  
134 137
      try
135 138
        {
136 139
        Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/save/SaveRenderer.java
34 34
import org.distorted.library.DistortedEffects;
35 35
import org.distorted.library.DistortedScreen;
36 36
import org.distorted.library.DistortedTexture;
37
import org.distorted.library.EffectNames;
37 38
import org.distorted.library.MeshFlat;
38 39
import org.distorted.library.DistortedFramebuffer;
39 40
import org.distorted.library.EffectTypes;
......
255 256
    mScreen.detachAll();
256 257
    mScreen.attach(texture,mEffects,mesh);
257 258

  
259
    DistortedEffects.enableEffect(EffectNames.SINK);
260

  
258 261
    try
259 262
      {
260 263
      Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/sink/SinkRenderer.java
30 30
import org.distorted.library.Distorted;
31 31
import org.distorted.library.DistortedEffects;
32 32
import org.distorted.library.DistortedScreen;
33
import org.distorted.library.EffectNames;
33 34
import org.distorted.library.MeshFlat;
34 35
import org.distorted.library.DistortedTexture;
35 36
import org.distorted.library.EffectTypes;
......
133 134
    mScreen.detachAll();
134 135
    mScreen.attach(texture,mEffects,mesh);
135 136

  
137
    DistortedEffects.enableEffect(EffectNames.SINK);
138

  
136 139
    try
137 140
      {
138 141
      Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
187 187

  
188 188
    setupBitmaps();
189 189

  
190
    DistortedEffects.enableEffect(EffectNames.SMOOTH_ALPHA);
191
    DistortedEffects.enableEffect(EffectNames.ALPHA);
192

  
190 193
    try
191 194
      {
192 195
      Distorted.onCreate(mView.getContext());
src/main/java/org/distorted/examples/wind/WindRenderer.java
27 27
import org.distorted.examples.R;
28 28
import org.distorted.library.Distorted;
29 29
import org.distorted.library.DistortedScreen;
30
import org.distorted.library.EffectNames;
30 31
import org.distorted.library.MeshCubes;
31 32
import org.distorted.library.DistortedEffects;
32 33
import org.distorted.library.DistortedTexture;
......
128 129

  
129 130
      mTexture.setTexture(bitmap);
130 131

  
132
      DistortedEffects.enableEffect(EffectNames.DEFORM);
133
      DistortedEffects.enableEffect(EffectNames.WAVE);
134

  
131 135
      try
132 136
        {
133 137
        Distorted.onCreate(mView.getContext());

Also available in: Unified diff