From c19cdfa14dd5c64f3c185a7b07ac9ca2ecc2f0e7 Mon Sep 17 00:00:00 2001 From: Jean-Luc Brouillet Date: Tue, 19 May 2015 14:59:42 -0700 Subject: Clean RenderScript warnings Change-Id: Ia7a98c1c977c839c74ae8081e70b5deb4b60c25d --- .../FBOTest/src/com/android/fbotest/fbosync.rs | 3 --- .../FBOTest/src/com/android/fbotest/fbotest.rs | 2 -- .../ModelViewer/src/com/android/modelviewer/simplemodel.rs | 4 +--- .../PerfTest/src/com/android/perftest/rsbench.rs | 4 +--- .../PerfTest/src/com/android/perftest/text_test.rs | 1 - .../PerfTest/src/com/android/perftest/ui_test.rs | 2 -- .../SceneGraph/src/com/android/scenegraph/params.rsh | 11 +++++------ .../SceneGraph/src/com/android/scenegraph/render.rs | 2 +- .../src/com/android/scenegraph/scenegraph_objects.rsh | 10 +++++----- .../SceneGraph/src/com/android/scenegraph/transform.rs | 4 +++- .../SceneGraph/src/com/android/testapp/test_app.rs | 2 -- .../ShadersTest/src/com/android/shaderstest/shaderstest.rs | 1 - 12 files changed, 16 insertions(+), 30 deletions(-) (limited to 'tests/RenderScriptTests') diff --git a/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbosync.rs b/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbosync.rs index 42b1cf1..0c177ef 100644 --- a/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbosync.rs +++ b/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbosync.rs @@ -116,7 +116,6 @@ static void renderAllMeshes() { rs_allocation allMeshes = rsGetAllocation(gMeshes); int size = rsAllocationGetDimX(allMeshes); gLookAt = 0.0f; - float minX, minY, minZ, maxX, maxY, maxZ; for (int i = 0; i < size; i++) { MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); rsgDrawMesh(info->mMesh); @@ -124,7 +123,6 @@ static void renderAllMeshes() { } static void drawDescription() { - uint width = rsgGetWidth(); uint height = rsgGetHeight(); int left = 0, right = 0, top = 0, bottom = 0; @@ -196,7 +194,6 @@ int root(void) { uint32_t w = rsAllocationGetDimX(gOffscreen); uint32_t h = rsAllocationGetDimY(gOffscreen); - uint32_t numElements = w*h; rsgAllocationSyncAll(gOffscreen, RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET); diff --git a/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbotest.rs b/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbotest.rs index 05ef3ac..13a3c85 100644 --- a/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbotest.rs +++ b/tests/RenderScriptTests/FBOTest/src/com/android/fbotest/fbotest.rs @@ -115,7 +115,6 @@ static void renderAllMeshes() { rs_allocation allMeshes = rsGetAllocation(gMeshes); int size = rsAllocationGetDimX(allMeshes); gLookAt = 0.0f; - float minX, minY, minZ, maxX, maxY, maxZ; for (int i = 0; i < size; i++) { MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); rsgDrawMesh(info->mMesh); @@ -123,7 +122,6 @@ static void renderAllMeshes() { } static void drawDescription() { - uint width = rsgGetWidth(); uint height = rsgGetHeight(); int left = 0, right = 0, top = 0, bottom = 0; diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs index de2a0a7..d3dd5b9 100644 --- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs +++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs @@ -123,7 +123,6 @@ static void renderAllMeshes() { rs_allocation allMeshes = rsGetAllocation(gMeshes); int size = rsAllocationGetDimX(allMeshes); gLookAt = 0.0f; - float minX, minY, minZ, maxX, maxY, maxZ; for (int i = 0; i < size; i++) { MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); rsgDrawMesh(info->mMesh); @@ -131,7 +130,6 @@ static void renderAllMeshes() { } void drawDescription() { - uint width = rsgGetWidth(); uint height = rsgGetHeight(); int left = 0, right = 0, top = 0, bottom = 0; @@ -163,7 +161,7 @@ int root(void) { rsMatrixMultiply(&matrix, &gPostureMatrix); rsMatrixRotate(&matrix, gRotateX, 1.0f, 0.0f, 0.0f); rsMatrixRotate(&matrix, gRotateY, 0.0f, 1.0f, 0.0f); - + rsgProgramVertexLoadModelMatrix(&matrix); renderAllMeshes(); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs index 27e5b11..43cf4e0 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs @@ -85,7 +85,7 @@ static void runSubTest(int index) { TestData testData; fillSurfaceParams(&testData); - rs_allocation null_alloc; + rs_allocation null_alloc = {0}; rsForEach(gTestScripts[index].testScript, gTestScripts[index].testData, null_alloc, @@ -125,7 +125,6 @@ static bool checkInit() { static int benchMode = 0; static bool benchmarkSingleTest = false; -static int benchSubMode = 0; static int runningLoops = 0; static bool sendMsgFlag = false; @@ -209,7 +208,6 @@ static void benchmark() { drawOffscreenResult(0, 0, quadW, quadH); int left = 0, right = 0, top = 0, bottom = 0; - uint width = rsgGetWidth(); uint height = rsgGetHeight(); rsgFontColor(0.9f, 0.9f, 0.95f, 1.0f); rsgBindFont(gFontSerif); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/text_test.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/text_test.rs index 7f10019..0f50828 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/text_test.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/text_test.rs @@ -52,7 +52,6 @@ static void displayFontSamples(int fillNum) { fonts[3] = gFontSerif; fonts[4] = gFontSans; - uint width = gRenderSurfaceW; uint height = gRenderSurfaceH; int left = 0, right = 0, top = 0, bottom = 0; rsgMeasureText(sampleText, &left, &right, &top, &bottom); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/ui_test.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/ui_test.rs index 5089092..e87db39 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/ui_test.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/ui_test.rs @@ -143,7 +143,6 @@ static void createParticle(Particle_t *part, int idx, float scale) { float d = fabs(randomGauss()) * gGalaxyRadius * 0.5f + rsRand(64.0f); float id = d / gGalaxyRadius; float z = randomGauss() * 0.4f * (1.0f - id); - float p = -d * ELLIPSE_TWIST; if (d < gGalaxyRadius * 0.33f) { part->color.x = (uchar) (220 + id * 35); @@ -305,7 +304,6 @@ static void drawMeshInPage(float xStart, float yStart, int wResolution, int hRes int left = 0, right = 0, top = 0, bottom = 0; rsgMeasureText(gSampleTextList100[0].item, &left, &right, &top, &bottom); float textHeight = (float)(top - bottom); - float textWidth = (float)(right - left); rs_matrix4x4 matrix; rsMatrixLoadScale(&matrix, size, size, 1.0); diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/params.rsh b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/params.rsh index 575794b..00793c0 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/params.rsh +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/params.rsh @@ -19,7 +19,7 @@ #include "scenegraph_objects.rsh" //#define DEBUG_PARAMS -static void debugParam(SgShaderParam *p, SgShaderParamData *pData) { +static inline void debugParam(SgShaderParam *p, SgShaderParamData *pData) { rsDebug("____________ Param ____________", p); printName(pData->paramName); rsDebug("bufferOffset", p->bufferOffset); @@ -44,8 +44,7 @@ static void debugParam(SgShaderParam *p, SgShaderParamData *pData) { } } - -static void writeFloatData(float *ptr, const float4 *input, uint32_t vecSize) { +static inline void writeFloatData(float *ptr, const float4 *input, uint32_t vecSize) { #ifdef DEBUG_PARAMS rsDebug("Writing value ", *input); rsDebug("Writing vec size ", vecSize); @@ -67,7 +66,7 @@ static void writeFloatData(float *ptr, const float4 *input, uint32_t vecSize) { } } -static bool processParam(SgShaderParam *p, SgShaderParamData *pData, +static inline bool processParam(SgShaderParam *p, SgShaderParamData *pData, uint8_t *constantBuffer, const SgCamera *currentCam, SgFragmentShader *shader) { @@ -155,7 +154,7 @@ static bool processParam(SgShaderParam *p, SgShaderParamData *pData, return true; } -static void processAllParams(rs_allocation shaderConst, +static inline void processAllParams(rs_allocation shaderConst, rs_allocation allParams, const SgCamera *camera) { if (rsIsObject(shaderConst)) { @@ -177,7 +176,7 @@ static void processAllParams(rs_allocation shaderConst, } } -static void processTextureParams(SgFragmentShader *shader) { +static inline void processTextureParams(SgFragmentShader *shader) { int numParams = 0; if (rsIsObject(shader->shaderTextureParams)) { numParams = rsAllocationGetDimX(shader->shaderTextureParams); diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs index 8a73dbd..205b2cb 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/render.rs @@ -78,7 +78,7 @@ static void draw(SgRenderable *obj) { if (rsIsObject(renderState->pr)) { rsgBindProgramRaster(renderState->pr); } else { - rs_program_raster pr; + rs_program_raster pr = {0}; rsgBindProgramRaster(pr); } diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/scenegraph_objects.rsh b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/scenegraph_objects.rsh index bdca3ab..90ae212 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/scenegraph_objects.rsh +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/scenegraph_objects.rsh @@ -208,7 +208,7 @@ typedef struct Texture_s { rs_allocation texture; } SgTexture; -static void printName(rs_allocation name) { +static inline void printName(rs_allocation name) { if (!rsIsObject(name)) { rsDebug("no name", 0); return; @@ -217,7 +217,7 @@ static void printName(rs_allocation name) { rsDebug((const char*)rsGetElementAt(name, 0), 0); } -static void printCameraInfo(const SgCamera *cam) { +static inline void printCameraInfo(const SgCamera *cam) { rsDebug("***** Camera information. ptr:", cam); printName(cam->name); const SgTransform *camTransform = (const SgTransform *)rsGetElementAt(cam->transformMatrix, 0); @@ -233,7 +233,7 @@ static void printCameraInfo(const SgCamera *cam) { rsDebug("View: ", &cam->view); } -static void printLightInfo(const SgLight *light) { +static inline void printLightInfo(const SgLight *light) { rsDebug("***** Light information. ptr:", light); printName(light->name); const SgTransform *lTransform = (const SgTransform *)rsGetElementAt(light->transformMatrix, 0); @@ -246,7 +246,7 @@ static void printLightInfo(const SgLight *light) { rsDebug("Type: ", light->type); } -static void getCameraRay(const SgCamera *cam, int screenX, int screenY, float3 *pnt, float3 *vec) { +static inline void getCameraRay(const SgCamera *cam, int screenX, int screenY, float3 *pnt, float3 *vec) { rsDebug("=================================", screenX); rsDebug("Point X", screenX); rsDebug("Point Y", screenY); @@ -290,7 +290,7 @@ static void getCameraRay(const SgCamera *cam, int screenX, int screenY, float3 * *pnt = cam->position.xyz; } -static bool intersect(const SgRenderable *obj, float3 pnt, float3 vec) { +static inline bool intersect(const SgRenderable *obj, float3 pnt, float3 vec) { // Solving for t^2 + Bt + C = 0 float3 originMinusCenter = pnt - obj->worldBoundingSphere.xyz; float B = dot(originMinusCenter, vec) * 2.0f; diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform.rs index 941b5a8..1d0b5be 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform.rs +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/scenegraph/transform.rs @@ -26,6 +26,7 @@ typedef struct { } ParentData; //#define DEBUG_TRANSFORMS +/* Unused function: static void debugTransform(SgTransform *data, const ParentData *parent) { rsDebug("****** ******", (int)data); printName(data->name); @@ -53,6 +54,7 @@ static void debugTransform(SgTransform *data, const ParentData *parent) { rsDebug("timestamp", data->timestamp); rsDebug("****** ******", (int)data); } +*/ static void appendTransformation(int type, float4 data, rs_matrix4x4 *mat) { rs_matrix4x4 temp; @@ -119,7 +121,7 @@ void root(const rs_allocation *v_in, rs_allocation *v_out, const void *usrData) } if (rsIsObject(data->children)) { - rs_allocation nullAlloc; + rs_allocation nullAlloc = {0}; rsForEach(gTransformScript, data->children, nullAlloc, &toChild, sizeof(toChild)); } diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/test_app.rs b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/test_app.rs index 997a1a7..d94da52 100644 --- a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/test_app.rs +++ b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/test_app.rs @@ -41,9 +41,7 @@ void init() { gRotate = 0.0f; } -static int pos = 50; static float gRotateY = 120.0f; -static float3 gLookAt = 0; static float gZoom = 50.0f; static void displayLoading() { if (rsIsObject(gRobotTex) && rsIsObject(gRobotMesh)) { diff --git a/tests/RenderScriptTests/ShadersTest/src/com/android/shaderstest/shaderstest.rs b/tests/RenderScriptTests/ShadersTest/src/com/android/shaderstest/shaderstest.rs index ae32e3a..735f6b9 100644 --- a/tests/RenderScriptTests/ShadersTest/src/com/android/shaderstest/shaderstest.rs +++ b/tests/RenderScriptTests/ShadersTest/src/com/android/shaderstest/shaderstest.rs @@ -131,7 +131,6 @@ static void renderAllMeshes() { rs_allocation allMeshes = rsGetAllocation(gMeshes); int size = rsAllocationGetDimX(allMeshes); gLookAt = 0.0f; - float minX, minY, minZ, maxX, maxY, maxZ; for (int i = 0; i < size; i++) { MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); rsgDrawMesh(info->mMesh); -- cgit v1.1