Clean RenderScript warnings

Change-Id: Ia7a98c1c977c839c74ae8081e70b5deb4b60c25d
This commit is contained in:
Jean-Luc Brouillet
2015-05-19 14:59:42 -07:00
parent b300d31bf1
commit c19cdfa14d
12 changed files with 16 additions and 30 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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();

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -26,6 +26,7 @@ typedef struct {
} ParentData;
//#define DEBUG_TRANSFORMS
/* Unused function:
static void debugTransform(SgTransform *data, const ParentData *parent) {
rsDebug("****** <Transform> ******", (int)data);
printName(data->name);
@@ -53,6 +54,7 @@ static void debugTransform(SgTransform *data, const ParentData *parent) {
rsDebug("timestamp", data->timestamp);
rsDebug("****** </Transform> ******", (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));
}

View File

@@ -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)) {

View File

@@ -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);