Cleanup includes for rs/cpp to not expose internal details.
Change-Id: Ib23f591f8418d3318f61ab1d3f6f2b684bf95692
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index e2fd651..4474741 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -21,6 +21,7 @@
#include "RenderScript.h"
#include "rsCppStructs.h"
#include "rsCppInternal.h"
+#include "rsDispatch.h"
#include <dlfcn.h>
#include <unistd.h>
diff --git a/cpp/Sampler.cpp b/cpp/Sampler.cpp
index bf99125..500651f 100644
--- a/cpp/Sampler.cpp
+++ b/cpp/Sampler.cpp
@@ -15,6 +15,7 @@
*/
#include "RenderScript.h"
+#include "rsCppInternal.h"
using namespace android;
using namespace RSC;
diff --git a/cpp/ScriptC.cpp b/cpp/ScriptC.cpp
index d431355..b107901 100644
--- a/cpp/ScriptC.cpp
+++ b/cpp/ScriptC.cpp
@@ -15,6 +15,7 @@
*/
#include "RenderScript.h"
+#include "rsCppInternal.h"
using namespace android;
using namespace RSC;
diff --git a/cpp/rsCppInternal.h b/cpp/rsCppInternal.h
index 81b690f..69857d7 100644
--- a/cpp/rsCppInternal.h
+++ b/cpp/rsCppInternal.h
@@ -17,8 +17,11 @@
#ifndef ANDROID_RS_CPP_INTERNAL_H
#define ANDROID_RS_CPP_INTERNAL_H
+
#define LOG_TAG "rsC++"
#include "rsCppUtils.h"
+#include "rsInternalDefines.h"
+#include "rsDispatch.h"
#define tryDispatch(rs, dispatch) \
if (rs->getError() == RS_SUCCESS) { \
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index 12dc186..cd7f29ea 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -19,7 +19,6 @@
#include "rsDefines.h"
#include "util/RefBase.h"
-#include "rsDispatch.h"
#include <vector>
#include <string>
@@ -31,9 +30,12 @@
*/
#define RS_CPU_ALLOCATION_ALIGNMENT 16
+struct dispatchTable;
+
namespace android {
namespace RSC {
+
typedef void (*ErrorHandlerFunc_t)(uint32_t errorNum, const char *errorText);
typedef void (*MessageHandlerFunc_t)(uint32_t msgNum, const void *msgData, size_t msgLen);
diff --git a/cpp/rsDispatch.h b/cpp/rsDispatch.h
index 614f5a4..394a6b1 100644
--- a/cpp/rsDispatch.h
+++ b/cpp/rsDispatch.h
@@ -17,7 +17,7 @@
#ifndef ANDROID_RSDISPATCH_H
#define ANDROID_RSDISPATCH_H
-#include "rsDefines.h"
+#include "rsInternalDefines.h"
typedef const void* (*AllocationGetTypeFnPtr)(RsContext con, RsAllocation va);
typedef void (*TypeGetNativeDataFnPtr)(RsContext, RsType, uintptr_t *typeData, uint32_t typeDataSize);
@@ -87,7 +87,7 @@
typedef void (*AllocationIoReceiveFnPtr) (RsContext, RsAllocation);
typedef void * (*AllocationGetPointerFnPtr) (RsContext, RsAllocation, uint32_t lod, RsAllocationCubemapFace face, uint32_t z, uint32_t array, size_t *stride);
-typedef struct {
+struct dispatchTable {
// inserted by hand from rs.h
AllocationGetTypeFnPtr AllocationGetType;
TypeGetNativeDataFnPtr TypeGetNativeData;
@@ -158,6 +158,6 @@
AllocationIoSendFnPtr AllocationIoSend;
AllocationIoReceiveFnPtr AllocationIoReceive;
AllocationGetPointerFnPtr AllocationGetPointer;
-} dispatchTable;
+};
#endif
diff --git a/rs.h b/rs.h
index e31762d..603085f 100644
--- a/rs.h
+++ b/rs.h
@@ -20,7 +20,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include "rsDefines.h"
+#include "rsInternalDefines.h"
// Legacy graphics functions
// Not extern C because not used from C++ API
diff --git a/rsAnimation.h b/rsAnimation.h
index 4e0cc89..de4957e 100644
--- a/rsAnimation.h
+++ b/rsAnimation.h
@@ -19,7 +19,7 @@
#include "rsUtils.h"
#include "rsObjectBase.h"
-#include "rsDefines.h"
+#include "rsInternalDefines.h"
// ---------------------------------------------------------------------------
namespace android {
namespace renderscript {
diff --git a/rsDebugHelper.h b/rsDebugHelper.h
index 2ac9afd..a70fe4d 100644
--- a/rsDebugHelper.h
+++ b/rsDebugHelper.h
@@ -18,7 +18,7 @@
#define ANDROID_RS_DEBUG_HELPER_H
#include "rsUtils.h"
-#include "rsDefines.h"
+#include "rsInternalDefines.h"
#ifndef RS_SERVER
// This shouldn't ever be defined with RS_SERVER
diff --git a/rsDefines.h b/rsDefines.h
index 35b5b94..0a91ea8 100644
--- a/rsDefines.h
+++ b/rsDefines.h
@@ -82,28 +82,6 @@
RS_CONTEXT_TYPE_PROFILE
};
-typedef struct {
- uint32_t colorMin;
- uint32_t colorPref;
- uint32_t alphaMin;
- uint32_t alphaPref;
- uint32_t depthMin;
- uint32_t depthPref;
- uint32_t stencilMin;
- uint32_t stencilPref;
- uint32_t samplesMin;
- uint32_t samplesPref;
- float samplesQ;
-} RsSurfaceConfig;
-
-enum RsMessageToClientType {
- RS_MESSAGE_TO_CLIENT_NONE = 0,
- RS_MESSAGE_TO_CLIENT_EXCEPTION = 1,
- RS_MESSAGE_TO_CLIENT_RESIZE = 2,
- RS_MESSAGE_TO_CLIENT_ERROR = 3,
- RS_MESSAGE_TO_CLIENT_USER = 4,
- RS_MESSAGE_TO_CLIENT_NEW_BUFFER = 5
-};
enum RsAllocationUsageType {
RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
@@ -207,11 +185,6 @@
RS_SAMPLER_INVALID = 100,
};
-enum RsTextureTarget {
- RS_TEXTURE_2D,
- RS_TEXTURE_CUBE
-};
-
enum RsDimension {
RS_DIMENSION_X,
RS_DIMENSION_Y,
@@ -226,71 +199,6 @@
RS_DIMENSION_MAX = RS_DIMENSION_ARRAY_3
};
-enum RsDepthFunc {
- RS_DEPTH_FUNC_ALWAYS,
- RS_DEPTH_FUNC_LESS,
- RS_DEPTH_FUNC_LEQUAL,
- RS_DEPTH_FUNC_GREATER,
- RS_DEPTH_FUNC_GEQUAL,
- RS_DEPTH_FUNC_EQUAL,
- RS_DEPTH_FUNC_NOTEQUAL
-};
-
-enum RsBlendSrcFunc {
- RS_BLEND_SRC_ZERO, // 0
- RS_BLEND_SRC_ONE, // 1
- RS_BLEND_SRC_DST_COLOR, // 2
- RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
- RS_BLEND_SRC_SRC_ALPHA, // 4
- RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
- RS_BLEND_SRC_DST_ALPHA, // 6
- RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
- RS_BLEND_SRC_SRC_ALPHA_SATURATE, // 8
- RS_BLEND_SRC_INVALID = 100,
-};
-
-enum RsBlendDstFunc {
- RS_BLEND_DST_ZERO, // 0
- RS_BLEND_DST_ONE, // 1
- RS_BLEND_DST_SRC_COLOR, // 2
- RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
- RS_BLEND_DST_SRC_ALPHA, // 4
- RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
- RS_BLEND_DST_DST_ALPHA, // 6
- RS_BLEND_DST_ONE_MINUS_DST_ALPHA, // 7
-
- RS_BLEND_DST_INVALID = 100,
-};
-
-enum RsTexEnvMode {
- RS_TEX_ENV_MODE_NONE,
- RS_TEX_ENV_MODE_REPLACE,
- RS_TEX_ENV_MODE_MODULATE,
- RS_TEX_ENV_MODE_DECAL
-};
-
-enum RsProgramParam {
- RS_PROGRAM_PARAM_INPUT,
- RS_PROGRAM_PARAM_OUTPUT,
- RS_PROGRAM_PARAM_CONSTANT,
- RS_PROGRAM_PARAM_TEXTURE_TYPE,
-};
-
-enum RsPrimitive {
- RS_PRIMITIVE_POINT,
- RS_PRIMITIVE_LINE,
- RS_PRIMITIVE_LINE_STRIP,
- RS_PRIMITIVE_TRIANGLE,
- RS_PRIMITIVE_TRIANGLE_STRIP,
- RS_PRIMITIVE_TRIANGLE_FAN,
-
- RS_PRIMITIVE_INVALID = 100,
-};
-
-enum RsPathPrimitive {
- RS_PATH_PRIMITIVE_QUADRATIC_BEZIER,
- RS_PATH_PRIMITIVE_CUBIC_BEZIER
-};
enum RsError {
RS_ERROR_NONE = 0,
@@ -308,74 +216,6 @@
RS_ERROR_FATAL_PROGRAM_LINK = 0x1002
};
-enum RsAnimationInterpolation {
- RS_ANIMATION_INTERPOLATION_STEP,
- RS_ANIMATION_INTERPOLATION_LINEAR,
- RS_ANIMATION_INTERPOLATION_BEZIER,
- RS_ANIMATION_INTERPOLATION_CARDINAL,
- RS_ANIMATION_INTERPOLATION_HERMITE,
- RS_ANIMATION_INTERPOLATION_BSPLINE
-};
-
-enum RsAnimationEdge {
- RS_ANIMATION_EDGE_UNDEFINED,
- RS_ANIMATION_EDGE_CONSTANT,
- RS_ANIMATION_EDGE_GRADIENT,
- RS_ANIMATION_EDGE_CYCLE,
- RS_ANIMATION_EDGE_OSCILLATE,
- RS_ANIMATION_EDGE_CYLE_RELATIVE
-};
-
-enum RsA3DClassID {
- RS_A3D_CLASS_ID_UNKNOWN,
- RS_A3D_CLASS_ID_MESH,
- RS_A3D_CLASS_ID_TYPE,
- RS_A3D_CLASS_ID_ELEMENT,
- RS_A3D_CLASS_ID_ALLOCATION,
- RS_A3D_CLASS_ID_PROGRAM_VERTEX,
- RS_A3D_CLASS_ID_PROGRAM_RASTER,
- RS_A3D_CLASS_ID_PROGRAM_FRAGMENT,
- RS_A3D_CLASS_ID_PROGRAM_STORE,
- RS_A3D_CLASS_ID_SAMPLER,
- RS_A3D_CLASS_ID_ANIMATION,
- RS_A3D_CLASS_ID_ADAPTER_1D,
- RS_A3D_CLASS_ID_ADAPTER_2D,
- RS_A3D_CLASS_ID_SCRIPT_C,
- RS_A3D_CLASS_ID_SCRIPT_KERNEL_ID,
- RS_A3D_CLASS_ID_SCRIPT_FIELD_ID,
- RS_A3D_CLASS_ID_SCRIPT_METHOD_ID,
- RS_A3D_CLASS_ID_SCRIPT_GROUP
-};
-
-enum RsCullMode {
- RS_CULL_BACK,
- RS_CULL_FRONT,
- RS_CULL_NONE,
- RS_CULL_INVALID = 100,
-};
-
-enum RsScriptIntrinsicID {
- RS_SCRIPT_INTRINSIC_ID_UNDEFINED = 0,
- RS_SCRIPT_INTRINSIC_ID_CONVOLVE_3x3 = 1,
- RS_SCRIPT_INTRINSIC_ID_COLOR_MATRIX = 2,
- RS_SCRIPT_INTRINSIC_ID_LUT = 3,
- RS_SCRIPT_INTRINSIC_ID_CONVOLVE_5x5 = 4,
- RS_SCRIPT_INTRINSIC_ID_BLUR = 5,
- RS_SCRIPT_INTRINSIC_ID_YUV_TO_RGB = 6,
- RS_SCRIPT_INTRINSIC_ID_BLEND = 7,
- RS_SCRIPT_INTRINSIC_ID_3DLUT = 8,
- RS_SCRIPT_INTRINSIC_ID_HISTOGRAM = 9,
- // unused 10, 11
- RS_SCRIPT_INTRINSIC_ID_RESIZE = 12,
-
- RS_SCRIPT_INTRINSIC_ID_OEM_START = 0x10000000
-};
-
-typedef struct {
- RsA3DClassID classID;
- const char* objectName;
-} RsFileIndexEntry;
-
enum RsForEachStrategy {
RS_FOR_EACH_STRATEGY_SERIAL = 0,
RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
diff --git a/rsElement.h b/rsElement.h
index 5c44ba0..ccf69eb 100644
--- a/rsElement.h
+++ b/rsElement.h
@@ -21,7 +21,7 @@
#include "rsComponent.h"
#include "rsUtils.h"
-#include "rsDefines.h"
+#include "rsInternalDefines.h"
#include "rsObjectBase.h"
// ---------------------------------------------------------------------------
diff --git a/rsInternalDefines.h b/rsInternalDefines.h
new file mode 100644
index 0000000..19f2122
--- /dev/null
+++ b/rsInternalDefines.h
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef RENDER_SCRIPT_INTERNAL_DEFINES_H
+#define RENDER_SCRIPT_INTERNAL_DEFINES_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include "rsDefines.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//////////////////////////////////////////////////////
+//
+
+
+typedef void (* RsBitmapCallback_t)(void *);
+
+
+typedef struct {
+ uint32_t colorMin;
+ uint32_t colorPref;
+ uint32_t alphaMin;
+ uint32_t alphaPref;
+ uint32_t depthMin;
+ uint32_t depthPref;
+ uint32_t stencilMin;
+ uint32_t stencilPref;
+ uint32_t samplesMin;
+ uint32_t samplesPref;
+ float samplesQ;
+} RsSurfaceConfig;
+
+enum RsMessageToClientType {
+ RS_MESSAGE_TO_CLIENT_NONE = 0,
+ RS_MESSAGE_TO_CLIENT_EXCEPTION = 1,
+ RS_MESSAGE_TO_CLIENT_RESIZE = 2,
+ RS_MESSAGE_TO_CLIENT_ERROR = 3,
+ RS_MESSAGE_TO_CLIENT_USER = 4,
+ RS_MESSAGE_TO_CLIENT_NEW_BUFFER = 5
+};
+
+enum RsTextureTarget {
+ RS_TEXTURE_2D,
+ RS_TEXTURE_CUBE
+};
+
+enum RsDepthFunc {
+ RS_DEPTH_FUNC_ALWAYS,
+ RS_DEPTH_FUNC_LESS,
+ RS_DEPTH_FUNC_LEQUAL,
+ RS_DEPTH_FUNC_GREATER,
+ RS_DEPTH_FUNC_GEQUAL,
+ RS_DEPTH_FUNC_EQUAL,
+ RS_DEPTH_FUNC_NOTEQUAL
+};
+
+enum RsBlendSrcFunc {
+ RS_BLEND_SRC_ZERO, // 0
+ RS_BLEND_SRC_ONE, // 1
+ RS_BLEND_SRC_DST_COLOR, // 2
+ RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
+ RS_BLEND_SRC_SRC_ALPHA, // 4
+ RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
+ RS_BLEND_SRC_DST_ALPHA, // 6
+ RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
+ RS_BLEND_SRC_SRC_ALPHA_SATURATE, // 8
+ RS_BLEND_SRC_INVALID = 100,
+};
+
+enum RsBlendDstFunc {
+ RS_BLEND_DST_ZERO, // 0
+ RS_BLEND_DST_ONE, // 1
+ RS_BLEND_DST_SRC_COLOR, // 2
+ RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
+ RS_BLEND_DST_SRC_ALPHA, // 4
+ RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
+ RS_BLEND_DST_DST_ALPHA, // 6
+ RS_BLEND_DST_ONE_MINUS_DST_ALPHA, // 7
+
+ RS_BLEND_DST_INVALID = 100,
+};
+
+enum RsTexEnvMode {
+ RS_TEX_ENV_MODE_NONE,
+ RS_TEX_ENV_MODE_REPLACE,
+ RS_TEX_ENV_MODE_MODULATE,
+ RS_TEX_ENV_MODE_DECAL
+};
+
+enum RsProgramParam {
+ RS_PROGRAM_PARAM_INPUT,
+ RS_PROGRAM_PARAM_OUTPUT,
+ RS_PROGRAM_PARAM_CONSTANT,
+ RS_PROGRAM_PARAM_TEXTURE_TYPE,
+};
+
+enum RsPrimitive {
+ RS_PRIMITIVE_POINT,
+ RS_PRIMITIVE_LINE,
+ RS_PRIMITIVE_LINE_STRIP,
+ RS_PRIMITIVE_TRIANGLE,
+ RS_PRIMITIVE_TRIANGLE_STRIP,
+ RS_PRIMITIVE_TRIANGLE_FAN,
+
+ RS_PRIMITIVE_INVALID = 100,
+};
+
+enum RsPathPrimitive {
+ RS_PATH_PRIMITIVE_QUADRATIC_BEZIER,
+ RS_PATH_PRIMITIVE_CUBIC_BEZIER
+};
+
+enum RsAnimationInterpolation {
+ RS_ANIMATION_INTERPOLATION_STEP,
+ RS_ANIMATION_INTERPOLATION_LINEAR,
+ RS_ANIMATION_INTERPOLATION_BEZIER,
+ RS_ANIMATION_INTERPOLATION_CARDINAL,
+ RS_ANIMATION_INTERPOLATION_HERMITE,
+ RS_ANIMATION_INTERPOLATION_BSPLINE
+};
+
+enum RsAnimationEdge {
+ RS_ANIMATION_EDGE_UNDEFINED,
+ RS_ANIMATION_EDGE_CONSTANT,
+ RS_ANIMATION_EDGE_GRADIENT,
+ RS_ANIMATION_EDGE_CYCLE,
+ RS_ANIMATION_EDGE_OSCILLATE,
+ RS_ANIMATION_EDGE_CYLE_RELATIVE
+};
+
+enum RsA3DClassID {
+ RS_A3D_CLASS_ID_UNKNOWN,
+ RS_A3D_CLASS_ID_MESH,
+ RS_A3D_CLASS_ID_TYPE,
+ RS_A3D_CLASS_ID_ELEMENT,
+ RS_A3D_CLASS_ID_ALLOCATION,
+ RS_A3D_CLASS_ID_PROGRAM_VERTEX,
+ RS_A3D_CLASS_ID_PROGRAM_RASTER,
+ RS_A3D_CLASS_ID_PROGRAM_FRAGMENT,
+ RS_A3D_CLASS_ID_PROGRAM_STORE,
+ RS_A3D_CLASS_ID_SAMPLER,
+ RS_A3D_CLASS_ID_ANIMATION,
+ RS_A3D_CLASS_ID_ADAPTER_1D,
+ RS_A3D_CLASS_ID_ADAPTER_2D,
+ RS_A3D_CLASS_ID_SCRIPT_C,
+ RS_A3D_CLASS_ID_SCRIPT_KERNEL_ID,
+ RS_A3D_CLASS_ID_SCRIPT_FIELD_ID,
+ RS_A3D_CLASS_ID_SCRIPT_METHOD_ID,
+ RS_A3D_CLASS_ID_SCRIPT_GROUP
+};
+
+enum RsCullMode {
+ RS_CULL_BACK,
+ RS_CULL_FRONT,
+ RS_CULL_NONE,
+ RS_CULL_INVALID = 100,
+};
+
+enum RsScriptIntrinsicID {
+ RS_SCRIPT_INTRINSIC_ID_UNDEFINED = 0,
+ RS_SCRIPT_INTRINSIC_ID_CONVOLVE_3x3 = 1,
+ RS_SCRIPT_INTRINSIC_ID_COLOR_MATRIX = 2,
+ RS_SCRIPT_INTRINSIC_ID_LUT = 3,
+ RS_SCRIPT_INTRINSIC_ID_CONVOLVE_5x5 = 4,
+ RS_SCRIPT_INTRINSIC_ID_BLUR = 5,
+ RS_SCRIPT_INTRINSIC_ID_YUV_TO_RGB = 6,
+ RS_SCRIPT_INTRINSIC_ID_BLEND = 7,
+ RS_SCRIPT_INTRINSIC_ID_3DLUT = 8,
+ RS_SCRIPT_INTRINSIC_ID_HISTOGRAM = 9,
+ // unused 10, 11
+ RS_SCRIPT_INTRINSIC_ID_RESIZE = 12,
+
+ RS_SCRIPT_INTRINSIC_ID_OEM_START = 0x10000000
+};
+
+typedef struct {
+ RsA3DClassID classID;
+ const char* objectName;
+} RsFileIndexEntry;
+
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // RENDER_SCRIPT_DEFINES_H
+
+
+
+
diff --git a/rs_hal.h b/rs_hal.h
index 945bf2a..419827b 100644
--- a/rs_hal.h
+++ b/rs_hal.h
@@ -17,7 +17,7 @@
#ifndef RS_HAL_H
#define RS_HAL_H
-#include <rsDefines.h>
+#include <rsInternalDefines.h>
struct ANativeWindow;