summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RenderScript.h2
-rw-r--r--java/ImageProcessing/res/raw/threshold.rs80
-rw-r--r--java/ImageProcessing/res/raw/threshold_bc.bcbin8524 -> 8372 bytes
-rw-r--r--java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java10
-rw-r--r--java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java216
-rw-r--r--java/ModelViewer/res/raw/modelviewer_bc.bcbin1404 -> 1688 bytes
-rw-r--r--java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java4
-rw-r--r--java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java42
-rw-r--r--java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java96
-rw-r--r--rsComponent.cpp81
-rw-r--r--rsComponent.h1
-rw-r--r--rsElement.cpp39
-rw-r--r--rsElement.h2
-rw-r--r--rsProgramVertex.cpp7
-rw-r--r--scriptc/rs_cl.rsh6
15 files changed, 296 insertions, 290 deletions
diff --git a/RenderScript.h b/RenderScript.h
index f01eadd4..6302b906 100644
--- a/RenderScript.h
+++ b/RenderScript.h
@@ -85,6 +85,8 @@ enum RsDataType {
RS_TYPE_UNSIGNED_32,
RS_TYPE_UNSIGNED_64,
+ RS_TYPE_BOOLEAN,
+
RS_TYPE_UNSIGNED_5_6_5,
RS_TYPE_UNSIGNED_5_5_5_1,
RS_TYPE_UNSIGNED_4_4_4_4,
diff --git a/java/ImageProcessing/res/raw/threshold.rs b/java/ImageProcessing/res/raw/threshold.rs
index 93a1a365..a8eb1648 100644
--- a/java/ImageProcessing/res/raw/threshold.rs
+++ b/java/ImageProcessing/res/raw/threshold.rs
@@ -10,13 +10,9 @@ int height;
int width;
int radius;
-typedef struct c4u_s {
- uint8_t r, g, b, a;
-} c4u_t;
-
-c4u_t * InPixel;
-c4u_t * OutPixel;
-c4u_t * ScratchPixel;
+uchar4 * InPixel;
+uchar4 * OutPixel;
+uchar4 * ScratchPixel;
float inBlack;
float outBlack;
@@ -31,7 +27,7 @@ static float outWMinOutB;
static float overInWMinInB;
//static float3 gammaV;
-#pragma rs export_var(height, width, radius, InPixel, OutPixel, ScratchPixel, inBlack, outBlack, inWhite, outWhite, gamma, saturation)
+#pragma rs export_var(height, width, radius, InPixel, OutPixel, ScratchPixel, inBlack, outBlack, inWhite, outWhite, gamma, saturation, InPixel, OutPixel, ScratchPixel)
#pragma rs export_func(filter, filterBenchmark);
// Store our coefficients here
@@ -166,19 +162,21 @@ static void processNoBlur() {
for(h = 0; h < height; h ++) {
for(w = 0; w < width; w ++) {
- c4u_t *input = InPixel + h*width + w;
+ uchar4 *input = InPixel + h*width + w;
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ //currentPixel.xyz = convert_float3(input.xyz);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
currentPixel = levelsSaturation(currentPixel);
- c4u_t *output = OutPixel + h*width + w;
- output->r = (uint8_t)currentPixel.x;
- output->g = (uint8_t)currentPixel.y;
- output->b = (uint8_t)currentPixel.z;
- output->a = input->a;
+ uchar4 *output = OutPixel + h*width + w;
+ //output.xyz = convert_uchar3(currentPixel.xyz);
+ output->x = (uint8_t)currentPixel.x;
+ output->y = (uint8_t)currentPixel.y;
+ output->z = (uint8_t)currentPixel.z;
+ output->w = input->w;
}
}
rsSendToClient(&count, 1, 4, 0);
@@ -205,21 +203,21 @@ static void horizontalBlur() {
validW = width - 1;
}
- c4u_t *input = InPixel + h*width + validW;
+ uchar4 *input = InPixel + h*width + validW;
float weight = gaussian[r + radius];
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
//currentPixel.w = (float)(input->a);
blurredPixel += currentPixel*weight;
}
- c4u_t *output = ScratchPixel + h*width + w;
- output->r = (uint8_t)blurredPixel.x;
- output->g = (uint8_t)blurredPixel.y;
- output->b = (uint8_t)blurredPixel.z;
+ uchar4 *output = ScratchPixel + h*width + w;
+ output->x = (uint8_t)blurredPixel.x;
+ output->y = (uint8_t)blurredPixel.y;
+ output->z = (uint8_t)blurredPixel.z;
//output->a = (uint8_t)blurredPixel.w;
}
}
@@ -246,12 +244,12 @@ static void horizontalBlurLevels() {
validW = width - 1;
}
- c4u_t *input = InPixel + h*width + validW;
+ uchar4 *input = InPixel + h*width + validW;
float weight = gaussian[r + radius];
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
//currentPixel.w = (float)(input->a);
blurredPixel += currentPixel*weight;
@@ -259,10 +257,10 @@ static void horizontalBlurLevels() {
blurredPixel = levelsSaturation(blurredPixel);
- c4u_t *output = ScratchPixel + h*width + w;
- output->r = (uint8_t)blurredPixel.x;
- output->g = (uint8_t)blurredPixel.y;
- output->b = (uint8_t)blurredPixel.z;
+ uchar4 *output = ScratchPixel + h*width + w;
+ output->x = (uint8_t)blurredPixel.x;
+ output->y = (uint8_t)blurredPixel.y;
+ output->z = (uint8_t)blurredPixel.z;
//output->a = (uint8_t)blurredPixel.w;
}
}
@@ -287,23 +285,23 @@ static void verticalBlur() {
validH = height - 1;
}
- c4u_t *input = ScratchPixel + validH*width + w;
+ uchar4 *input = ScratchPixel + validH*width + w;
float weight = gaussian[r + radius];
- currentPixel.x = (float)(input->r);
- currentPixel.y = (float)(input->g);
- currentPixel.z = (float)(input->b);
+ currentPixel.x = (float)(input->x);
+ currentPixel.y = (float)(input->y);
+ currentPixel.z = (float)(input->z);
//currentPixel.w = (float)(input->a);
blurredPixel += currentPixel*weight;
}
- c4u_t *output = OutPixel + h*width + w;
+ uchar4 *output = OutPixel + h*width + w;
- output->r = (uint8_t)blurredPixel.x;
- output->g = (uint8_t)blurredPixel.y;
- output->b = (uint8_t)blurredPixel.z;
+ output->x = (uint8_t)blurredPixel.x;
+ output->y = (uint8_t)blurredPixel.y;
+ output->z = (uint8_t)blurredPixel.z;
//output->a = (uint8_t)blurredPixel.w;
}
}
diff --git a/java/ImageProcessing/res/raw/threshold_bc.bc b/java/ImageProcessing/res/raw/threshold_bc.bc
index 4cf0629b..fd60f765 100644
--- a/java/ImageProcessing/res/raw/threshold_bc.bc
+++ b/java/ImageProcessing/res/raw/threshold_bc.bc
Binary files differ
diff --git a/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
index b39d1412..7bf65962 100644
--- a/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ b/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
@@ -285,7 +285,7 @@ public class ImageProcessingActivity extends Activity
long t = java.lang.System.currentTimeMillis();
if (true) {
- mScript.invokable_Filter();
+ mScript.invoke_filter();
mRS.finish();
} else {
javaFilter();
@@ -355,7 +355,7 @@ public class ImageProcessingActivity extends Activity
public void surfaceCreated(SurfaceHolder holder) {
createScript();
- mScript.invokable_Filter();
+ mScript.invoke_filter();
mRS.finish();
}
@@ -373,7 +373,7 @@ public class ImageProcessingActivity extends Activity
mOutPixelsAllocation = Allocation.createBitmapRef(mRS, mBitmapOut);
mScratchPixelsAllocation = Allocation.createBitmapRef(mRS, mBitmapScratch);
- mScript = new ScriptC_Threshold(mRS, getResources(), false);
+ mScript = new ScriptC_Threshold(mRS, getResources(), R.raw.threshold_bc, false);
mScript.set_width(mBitmapIn.getWidth());
mScript.set_height(mBitmapIn.getHeight());
mScript.set_radius(mRadius);
@@ -413,7 +413,7 @@ public class ImageProcessingActivity extends Activity
long t = java.lang.System.currentTimeMillis();
- mScript.invokable_FilterBenchmark();
+ mScript.invoke_filterBenchmark();
mRS.finish();
t = java.lang.System.currentTimeMillis() - t;
@@ -426,7 +426,7 @@ public class ImageProcessingActivity extends Activity
mRadius = oldRadius;
mScript.set_radius(mRadius);
- mScript.invokable_Filter();
+ mScript.invoke_filter();
mRS.finish();
}
}
diff --git a/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java b/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java
index 42adb276..ea363d36 100644
--- a/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java
+++ b/java/ImageProcessing/src/com/android/rs/image/ScriptC_Threshold.java
@@ -1,115 +1,175 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.android.rs.image;
-import android.content.res.Resources;
import android.renderscript.*;
+import android.content.res.Resources;
import android.util.Log;
-public class ScriptC_Threshold
- extends android.renderscript.ScriptC
-{
- private final static int mFieldIndex_height = 0;
- private final static int mFieldIndex_width = 1;
- private final static int mFieldIndex_radius = 2;
- private final static int mFieldIndex_InPixel = 3;
- private final static int mFieldIndex_OutPixel = 4;
- private final static int mFieldIndex_ScratchPixel = 5;
-
- private final static int mFieldIndex_inBlack = 6;
- private final static int mFieldIndex_outBlack = 7;
- private final static int mFieldIndex_inWhite = 8;
- private final static int mFieldIndex_outWhite = 9;
- private final static int mFieldIndex_gamma = 10;
-
- private final static int mFieldIndex_saturation = 11;
- private final static int mFieldIndex_hue = 12;
-
- private Allocation mField_InPixel;
- private Allocation mField_OutPixel;
- private Allocation mField_ScratchPixel;
-
- public ScriptC_Threshold(RenderScript rs, Resources resources, boolean isRoot) {
- super(rs, resources, R.raw.threshold_bc, isRoot);
- }
-
- public void bind_InPixel(Allocation f) {
- if (f != null) {
- //if (f.getType().getElement() != Element.ATTRIB_COLOR_U8_4(mRS)) {
- //throw new IllegalArgumentException("Element type mismatch.");
- //}
- }
- bindAllocation(f, mFieldIndex_InPixel);
- mField_InPixel = f;
- }
- public Allocation get_InPixel() {
- return mField_InPixel;
- }
-
- public void bind_OutPixel(Allocation f) {
- if (f != null) {
- //if (f.getType().getElement() != Element.ATTRIB_COLOR_U8_4(mRS)) {
- //throw new IllegalArgumentException("Element type mismatch.");
- //}
- }
- bindAllocation(f, mFieldIndex_OutPixel);
- mField_OutPixel = f;
- }
- public void bind_ScratchPixel(Allocation f) {
- if (f != null) {
- //if (f.getType().getElement() != Element.ATTRIB_COLOR_U8_4(mRS)) {
- //throw new IllegalArgumentException("Element type mismatch.");
- //}
- }
- bindAllocation(f, mFieldIndex_ScratchPixel);
- mField_ScratchPixel = f;
- }
- public Allocation get_OutPixel() {
- return mField_OutPixel;
+public class ScriptC_Threshold extends ScriptC {
+ // Constructor
+ public ScriptC_Threshold(RenderScript rs, Resources resources, int id, boolean isRoot) {
+ super(rs, resources, id, isRoot);
}
+ private final static int mExportVarIdx_height = 0;
+ private int mExportVar_height;
public void set_height(int v) {
- setVar(mFieldIndex_height, v);
+ mExportVar_height = v;
+ setVar(mExportVarIdx_height, v);
}
+ public int get_height() {
+ return mExportVar_height;
+ }
+
+ private final static int mExportVarIdx_width = 1;
+ private int mExportVar_width;
public void set_width(int v) {
- setVar(mFieldIndex_width, v);
+ mExportVar_width = v;
+ setVar(mExportVarIdx_width, v);
}
+ public int get_width() {
+ return mExportVar_width;
+ }
+
+ private final static int mExportVarIdx_radius = 2;
+ private int mExportVar_radius;
public void set_radius(int v) {
- setVar(mFieldIndex_radius, v);
+ mExportVar_radius = v;
+ setVar(mExportVarIdx_radius, v);
+ }
+
+ public int get_radius() {
+ return mExportVar_radius;
+ }
+
+ private final static int mExportVarIdx_InPixel = 3;
+ private Allocation mExportVar_InPixel;
+ public void bind_InPixel(Allocation v) {
+ mExportVar_InPixel = v;
+ if(v == null) bindAllocation(null, mExportVarIdx_InPixel);
+ else bindAllocation(v, mExportVarIdx_InPixel);
+ }
+
+ public Allocation get_InPixel() {
+ return mExportVar_InPixel;
+ }
+
+ private final static int mExportVarIdx_OutPixel = 4;
+ private Allocation mExportVar_OutPixel;
+ public void bind_OutPixel(Allocation v) {
+ mExportVar_OutPixel = v;
+ if(v == null) bindAllocation(null, mExportVarIdx_OutPixel);
+ else bindAllocation(v, mExportVarIdx_OutPixel);
+ }
+
+ public Allocation get_OutPixel() {
+ return mExportVar_OutPixel;
+ }
+
+ private final static int mExportVarIdx_ScratchPixel = 5;
+ private Allocation mExportVar_ScratchPixel;
+ public void bind_ScratchPixel(Allocation v) {
+ mExportVar_ScratchPixel = v;
+ if(v == null) bindAllocation(null, mExportVarIdx_ScratchPixel);
+ else bindAllocation(v, mExportVarIdx_ScratchPixel);
}
+ public Allocation get_ScratchPixel() {
+ return mExportVar_ScratchPixel;
+ }
+
+ private final static int mExportVarIdx_inBlack = 6;
+ private float mExportVar_inBlack;
public void set_inBlack(float v) {
- setVar(mFieldIndex_inBlack, v);
+ mExportVar_inBlack = v;
+ setVar(mExportVarIdx_inBlack, v);
}
+
+ public float get_inBlack() {
+ return mExportVar_inBlack;
+ }
+
+ private final static int mExportVarIdx_outBlack = 7;
+ private float mExportVar_outBlack;
public void set_outBlack(float v) {
- setVar(mFieldIndex_outBlack, v);
+ mExportVar_outBlack = v;
+ setVar(mExportVarIdx_outBlack, v);
}
+
+ public float get_outBlack() {
+ return mExportVar_outBlack;
+ }
+
+ private final static int mExportVarIdx_inWhite = 8;
+ private float mExportVar_inWhite;
public void set_inWhite(float v) {
- setVar(mFieldIndex_inWhite, v);
+ mExportVar_inWhite = v;
+ setVar(mExportVarIdx_inWhite, v);
}
+
+ public float get_inWhite() {
+ return mExportVar_inWhite;
+ }
+
+ private final static int mExportVarIdx_outWhite = 9;
+ private float mExportVar_outWhite;
public void set_outWhite(float v) {
- setVar(mFieldIndex_outWhite, v);
+ mExportVar_outWhite = v;
+ setVar(mExportVarIdx_outWhite, v);
+ }
+
+ public float get_outWhite() {
+ return mExportVar_outWhite;
}
+
+ private final static int mExportVarIdx_gamma = 10;
+ private float mExportVar_gamma;
public void set_gamma(float v) {
- setVar(mFieldIndex_gamma, v);
+ mExportVar_gamma = v;
+ setVar(mExportVarIdx_gamma, v);
+ }
+
+ public float get_gamma() {
+ return mExportVar_gamma;
}
+ private final static int mExportVarIdx_saturation = 11;
+ private float mExportVar_saturation;
public void set_saturation(float v) {
- setVar(mFieldIndex_saturation, v);
+ mExportVar_saturation = v;
+ setVar(mExportVarIdx_saturation, v);
}
- public void set_hue(float v) {
- setVar(mFieldIndex_hue, v);
+
+ public float get_saturation() {
+ return mExportVar_saturation;
}
- private final static int mInvokableIndex_Filter = 4;
- public void invokable_Filter() {
- invoke(mInvokableIndex_Filter);
+ private final static int mExportFuncIdx_filter = 0;
+ public void invoke_filter() {
+ invoke(mExportFuncIdx_filter);
}
- private final static int mInvokableIndex_FilterBenchmark = 5;
- public void invokable_FilterBenchmark() {
- invoke(mInvokableIndex_FilterBenchmark);
+ private final static int mExportFuncIdx_filterBenchmark = 1;
+ public void invoke_filterBenchmark() {
+ invoke(mExportFuncIdx_filterBenchmark);
}
+
}
diff --git a/java/ModelViewer/res/raw/modelviewer_bc.bc b/java/ModelViewer/res/raw/modelviewer_bc.bc
index b02250b7..367a3f4a 100644
--- a/java/ModelViewer/res/raw/modelviewer_bc.bc
+++ b/java/ModelViewer/res/raw/modelviewer_bc.bc
Binary files differ
diff --git a/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java b/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java
index dd529551..e581520c 100644
--- a/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java
+++ b/java/ModelViewer/src/com/android/modelviewer/ModelViewerRS.java
@@ -57,7 +57,7 @@ public class ModelViewerRS {
private SimpleMesh mMesh;
- private ScriptC_ModelViewer mScript;
+ private ScriptC_Modelviewer mScript;
int mLastX;
int mLastY;
@@ -130,7 +130,7 @@ public class ModelViewerRS {
private void initRS() {
- mScript = new ScriptC_ModelViewer(mRS, mRes, true);
+ mScript = new ScriptC_Modelviewer(mRS, mRes, R.raw.modelviewer_bc, true);
initPFS();
initPF();
diff --git a/java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java b/java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java
deleted file mode 100644
index f617c772..00000000
--- a/java/ModelViewer/src/com/android/modelviewer/ScriptC_ModelViewer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-
-package com.android.modelviewer;
-
-import android.content.res.Resources;
-import android.renderscript.*;
-import android.util.Log;
-
-
-
-public class ScriptC_ModelViewer
- extends android.renderscript.ScriptC
-{
- public ScriptC_ModelViewer(RenderScript rs, Resources resources, boolean isRoot) {
- super(rs, resources, R.raw.modelviewer_bc, isRoot);
- }
-
- public void set_gPVBackground(ProgramVertex v) {
- setVar(0, v.getID());
- }
-
- public void set_gPFBackground(ProgramFragment v) {
- setVar(1, v.getID());
- }
-
- public void set_gTGrid(Allocation v) {
- setVar(2, v.getID());
- }
-
- public void set_gTestMesh(SimpleMesh v) {
- setVar(3, v.getID());
- }
-
- public void set_gPFSBackground(ProgramStore v) {
- setVar(4, v.getID());
- }
-
- public void set_gRotate(float v) {
- setVar(5, v);
- }
-
-}
-
diff --git a/java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java b/java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java
new file mode 100644
index 00000000..7a965b8b
--- /dev/null
+++ b/java/ModelViewer/src/com/android/modelviewer/ScriptC_Modelviewer.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.modelviewer;
+
+import android.renderscript.*;
+import android.content.res.Resources;
+import android.util.Log;
+
+public class ScriptC_Modelviewer extends ScriptC {
+ // Constructor
+ public ScriptC_Modelviewer(RenderScript rs, Resources resources, int id, boolean isRoot) {
+ super(rs, resources, id, isRoot);
+ }
+
+ private final static int mExportVarIdx_gPVBackground = 0;
+ private ProgramVertex mExportVar_gPVBackground;
+ public void set_gPVBackground(ProgramVertex v) {
+ mExportVar_gPVBackground = v;
+ setVar(mExportVarIdx_gPVBackground, (v == null) ? 0 : v.getID());
+ }
+
+ public ProgramVertex get_gPVBackground() {
+ return mExportVar_gPVBackground;
+ }
+
+ private final static int mExportVarIdx_gPFBackground = 1;
+ private ProgramFragment mExportVar_gPFBackground;
+ public void set_gPFBackground(ProgramFragment v) {
+ mExportVar_gPFBackground = v;
+ setVar(mExportVarIdx_gPFBackground, (v == null) ? 0 : v.getID());
+ }
+
+ public ProgramFragment get_gPFBackground() {
+ return mExportVar_gPFBackground;
+ }
+
+ private final static int mExportVarIdx_gTGrid = 2;
+ private Allocation mExportVar_gTGrid;
+ public void set_gTGrid(Allocation v) {
+ mExportVar_gTGrid = v;
+ setVar(mExportVarIdx_gTGrid, (v == null) ? 0 : v.getID());
+ }
+
+ public Allocation get_gTGrid() {
+ return mExportVar_gTGrid;
+ }
+
+ private final static int mExportVarIdx_gTestMesh = 3;
+ private SimpleMesh mExportVar_gTestMesh;
+ public void set_gTestMesh(SimpleMesh v) {
+ mExportVar_gTestMesh = v;
+ setVar(mExportVarIdx_gTestMesh, (v == null) ? 0 : v.getID());
+ }
+
+ public SimpleMesh get_gTestMesh() {
+ return mExportVar_gTestMesh;
+ }
+
+ private final static int mExportVarIdx_gPFSBackground = 4;
+ private ProgramStore mExportVar_gPFSBackground;
+ public void set_gPFSBackground(ProgramStore v) {
+ mExportVar_gPFSBackground = v;
+ setVar(mExportVarIdx_gPFSBackground, (v == null) ? 0 : v.getID());
+ }
+
+ public ProgramStore get_gPFSBackground() {
+ return mExportVar_gPFSBackground;
+ }
+
+ private final static int mExportVarIdx_gRotate = 5;
+ private float mExportVar_gRotate;
+ public void set_gRotate(float v) {
+ mExportVar_gRotate = v;
+ setVar(mExportVarIdx_gRotate, v);
+ }
+
+ public float get_gRotate() {
+ return mExportVar_gRotate;
+ }
+
+}
+
diff --git a/rsComponent.cpp b/rsComponent.cpp
index b120c21a..8e509ad7 100644
--- a/rsComponent.cpp
+++ b/rsComponent.cpp
@@ -152,6 +152,10 @@ void Component::set(RsDataType dt, RsDataKind dk, bool norm, uint32_t vecSize)
case RS_TYPE_UNSIGNED_64:
mTypeBits = 64;
break;
+
+ case RS_TYPE_BOOLEAN:
+ mTypeBits = 8;
+ break;
}
mBits = mTypeBits * mVectorSize;
@@ -192,82 +196,6 @@ uint32_t Component::getGLFormat() const
return 0;
}
-static const char * gCTypeStrings[] = {
- 0,
- 0,//"F16",
- "float",
- "double",
- "char",
- "short",
- "int",
- 0,//"S64",
- "char",//U8",
- "short",//U16",
- "int",//U32",
- 0,//"U64",
- 0,//"UP_565",
- 0,//"UP_5551",
- 0,//"UP_4444",
- 0,//"ELEMENT",
- 0,//"TYPE",
- 0,//"ALLOCATION",
- 0,//"SAMPLER",
- 0,//"SCRIPT",
- 0,//"MESH",
- 0,//"PROGRAM_FRAGMENT",
- 0,//"PROGRAM_VERTEX",
- 0,//"PROGRAM_RASTER",
- 0,//"PROGRAM_STORE",
-};
-
-static const char * gCVecTypeStrings[] = {
- 0,
- 0,//"F16",
- "vecF32",
- "vecF64",
- "vecI8",
- "vecI16",
- "vecI32",
- 0,//"S64",
- "vecU8",//U8",
- "vecU16",//U16",
- "vecU32",//U32",
- 0,//"U64",
- 0,//"UP_565",
- 0,//"UP_5551",
- 0,//"UP_4444",
- 0,//"ELEMENT",
- 0,//"TYPE",
- 0,//"ALLOCATION",
- 0,//"SAMPLER",
- 0,//"SCRIPT",
- 0,//"MESH",
- 0,//"PROGRAM_FRAGMENT",
- 0,//"PROGRAM_VERTEX",
- 0,//"PROGRAM_RASTER",
- 0,//"PROGRAM_STORE",
-};
-
-String8 Component::getCType() const
-{
- char buf[64];
- if (mVectorSize == 1) {
- return String8(gCTypeStrings[mType]);
- }
-
- // Yuck, acc WAR
- // Appears to have problems packing chars
- if (mVectorSize == 4 && mType == RS_TYPE_UNSIGNED_8) {
- return String8("int");
- }
-
-
- String8 s(gCVecTypeStrings[mType]);
- sprintf(buf, "_%i_t", mVectorSize);
- s.append(buf);
- return s;
-}
-
String8 Component::getGLSLType() const
{
if (mType == RS_TYPE_SIGNED_32) {
@@ -302,6 +230,7 @@ static const char * gTypeStrings[] = {
"U16",
"U32",
"U64",
+ "BOOLEAN",
"UP_565",
"UP_5551",
"UP_4444",
diff --git a/rsComponent.h b/rsComponent.h
index 0f93a915..15fd5ddc 100644
--- a/rsComponent.h
+++ b/rsComponent.h
@@ -35,7 +35,6 @@ public:
uint32_t getGLType() const;
uint32_t getGLFormat() const;
- String8 getCType() const;
String8 getGLSLType() const;
void dumpLOGV(const char *prefix) const;
diff --git a/rsElement.cpp b/rsElement.cpp
index 8fbf0046..aa20275c 100644
--- a/rsElement.cpp
+++ b/rsElement.cpp
@@ -232,45 +232,6 @@ const Element * Element::create(Context *rsc, size_t count, const Element **ein,
return e;
}
-String8 Element::getCStructBody(uint32_t indent) const
-{
- String8 si;
- for (uint32_t ct=0; ct < indent; ct++) {
- si.append(" ");
- }
-
- String8 s(si);
- s.append("{\n");
- for (uint32_t ct = 0; ct < mFieldCount; ct++) {
- s.append(si);
- s.append(mFields[ct].e->getCType(indent+4));
- s.append(" ");
- s.append(mFields[ct].name);
- s.append(";\n");
- }
- s.append(si);
- s.append("}");
- return s;
-}
-
-String8 Element::getCType(uint32_t indent) const
-{
- String8 s;
- for (uint32_t ct=0; ct < indent; ct++) {
- s.append(" ");
- }
-
- if (!mFieldCount) {
- // Basic component.
- s.append(mComponent.getCType());
- } else {
- s.append("struct ");
- s.append(getCStructBody(indent));
- }
-
- return s;
-}
-
String8 Element::getGLSLType(uint32_t indent) const
{
String8 s;
diff --git a/rsElement.h b/rsElement.h
index 5c4f5c4a..90e7cc8f 100644
--- a/rsElement.h
+++ b/rsElement.h
@@ -54,8 +54,6 @@ public:
RsDataKind getKind() const {return mComponent.getKind();}
uint32_t getBits() const {return mBits;}
- String8 getCType(uint32_t indent=0) const;
- String8 getCStructBody(uint32_t indent=0) const;
String8 getGLSLType(uint32_t indent=0) const;
void dumpLOGV(const char *prefix) const;
diff --git a/rsProgramVertex.cpp b/rsProgramVertex.cpp
index e7292c00..b8d1461a 100644
--- a/rsProgramVertex.cpp
+++ b/rsProgramVertex.cpp
@@ -138,6 +138,11 @@ void ProgramVertex::createShader()
const Element *e = mConstantTypes[ct]->getElement();
for (uint32_t field=0; field < e->getFieldCount(); field++) {
const Element *f = e->getField(field);
+ const char *fn = e->getFieldName(field);
+
+ if (fn[0] == '#') {
+ continue;
+ }
// Cannot be complex
rsAssert(!f->getFieldCount());
@@ -150,7 +155,7 @@ void ProgramVertex::createShader()
rsAssert(0);
}
- mShader.append(e->getFieldName(field));
+ mShader.append(fn);
mShader.append(";\n");
}
}
diff --git a/scriptc/rs_cl.rsh b/scriptc/rs_cl.rsh
index 69e7902d..64844a48 100644
--- a/scriptc/rs_cl.rsh
+++ b/scriptc/rs_cl.rsh
@@ -7,15 +7,15 @@
// Conversions
#define CVT_FUNC_2(typeout, typein) \
static typeout##2 __attribute__((overloadable)) convert_##typeout##2(typein##2 v) { \
- typeout##2 r = {v.x, v.y}; \
+ typeout##2 r = {(typeout)v.x, (typeout)v.y}; \
return r; \
} \
static typeout##3 __attribute__((overloadable)) convert_##typeout##3(typein##3 v) { \
- typeout##3 r = {v.x, v.y, v.z}; \
+ typeout##3 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z}; \
return r; \
} \
static typeout##4 __attribute__((overloadable)) convert_##typeout##4(typein##4 v) { \
- typeout##4 r = {v.x, v.y, v.z, v.w}; \
+ typeout##4 r = {(typeout)v.x, (typeout)v.y, (typeout)v.z, (typeout)v.w}; \
return r; \
}