am 4b478370: Merge "Clean RenderScript warnings" into mnc-dev

* commit '4b478370acad3e5757dd39956a526237be4c09da':
  Clean RenderScript warnings
This commit is contained in:
Jean-Luc Brouillet
2015-05-20 22:26:57 +00:00
committed by Android Git Automerger
12 changed files with 16 additions and 30 deletions

View File

@@ -116,7 +116,6 @@ static void renderAllMeshes() {
rs_allocation allMeshes = rsGetAllocation(gMeshes); rs_allocation allMeshes = rsGetAllocation(gMeshes);
int size = rsAllocationGetDimX(allMeshes); int size = rsAllocationGetDimX(allMeshes);
gLookAt = 0.0f; gLookAt = 0.0f;
float minX, minY, minZ, maxX, maxY, maxZ;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i);
rsgDrawMesh(info->mMesh); rsgDrawMesh(info->mMesh);
@@ -124,7 +123,6 @@ static void renderAllMeshes() {
} }
static void drawDescription() { static void drawDescription() {
uint width = rsgGetWidth();
uint height = rsgGetHeight(); uint height = rsgGetHeight();
int left = 0, right = 0, top = 0, bottom = 0; int left = 0, right = 0, top = 0, bottom = 0;
@@ -196,7 +194,6 @@ int root(void) {
uint32_t w = rsAllocationGetDimX(gOffscreen); uint32_t w = rsAllocationGetDimX(gOffscreen);
uint32_t h = rsAllocationGetDimY(gOffscreen); uint32_t h = rsAllocationGetDimY(gOffscreen);
uint32_t numElements = w*h;
rsgAllocationSyncAll(gOffscreen, RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET); rsgAllocationSyncAll(gOffscreen, RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET);

View File

@@ -115,7 +115,6 @@ static void renderAllMeshes() {
rs_allocation allMeshes = rsGetAllocation(gMeshes); rs_allocation allMeshes = rsGetAllocation(gMeshes);
int size = rsAllocationGetDimX(allMeshes); int size = rsAllocationGetDimX(allMeshes);
gLookAt = 0.0f; gLookAt = 0.0f;
float minX, minY, minZ, maxX, maxY, maxZ;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i);
rsgDrawMesh(info->mMesh); rsgDrawMesh(info->mMesh);
@@ -123,7 +122,6 @@ static void renderAllMeshes() {
} }
static void drawDescription() { static void drawDescription() {
uint width = rsgGetWidth();
uint height = rsgGetHeight(); uint height = rsgGetHeight();
int left = 0, right = 0, top = 0, bottom = 0; int left = 0, right = 0, top = 0, bottom = 0;

View File

@@ -123,7 +123,6 @@ static void renderAllMeshes() {
rs_allocation allMeshes = rsGetAllocation(gMeshes); rs_allocation allMeshes = rsGetAllocation(gMeshes);
int size = rsAllocationGetDimX(allMeshes); int size = rsAllocationGetDimX(allMeshes);
gLookAt = 0.0f; gLookAt = 0.0f;
float minX, minY, minZ, maxX, maxY, maxZ;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i);
rsgDrawMesh(info->mMesh); rsgDrawMesh(info->mMesh);
@@ -131,7 +130,6 @@ static void renderAllMeshes() {
} }
void drawDescription() { void drawDescription() {
uint width = rsgGetWidth();
uint height = rsgGetHeight(); uint height = rsgGetHeight();
int left = 0, right = 0, top = 0, bottom = 0; int left = 0, right = 0, top = 0, bottom = 0;
@@ -163,7 +161,7 @@ int root(void) {
rsMatrixMultiply(&matrix, &gPostureMatrix); rsMatrixMultiply(&matrix, &gPostureMatrix);
rsMatrixRotate(&matrix, gRotateX, 1.0f, 0.0f, 0.0f); rsMatrixRotate(&matrix, gRotateX, 1.0f, 0.0f, 0.0f);
rsMatrixRotate(&matrix, gRotateY, 0.0f, 1.0f, 0.0f); rsMatrixRotate(&matrix, gRotateY, 0.0f, 1.0f, 0.0f);
rsgProgramVertexLoadModelMatrix(&matrix); rsgProgramVertexLoadModelMatrix(&matrix);
renderAllMeshes(); renderAllMeshes();

View File

@@ -85,7 +85,7 @@ static void runSubTest(int index) {
TestData testData; TestData testData;
fillSurfaceParams(&testData); fillSurfaceParams(&testData);
rs_allocation null_alloc; rs_allocation null_alloc = {0};
rsForEach(gTestScripts[index].testScript, rsForEach(gTestScripts[index].testScript,
gTestScripts[index].testData, gTestScripts[index].testData,
null_alloc, null_alloc,
@@ -125,7 +125,6 @@ static bool checkInit() {
static int benchMode = 0; static int benchMode = 0;
static bool benchmarkSingleTest = false; static bool benchmarkSingleTest = false;
static int benchSubMode = 0;
static int runningLoops = 0; static int runningLoops = 0;
static bool sendMsgFlag = false; static bool sendMsgFlag = false;
@@ -209,7 +208,6 @@ static void benchmark() {
drawOffscreenResult(0, 0, quadW, quadH); drawOffscreenResult(0, 0, quadW, quadH);
int left = 0, right = 0, top = 0, bottom = 0; int left = 0, right = 0, top = 0, bottom = 0;
uint width = rsgGetWidth();
uint height = rsgGetHeight(); uint height = rsgGetHeight();
rsgFontColor(0.9f, 0.9f, 0.95f, 1.0f); rsgFontColor(0.9f, 0.9f, 0.95f, 1.0f);
rsgBindFont(gFontSerif); rsgBindFont(gFontSerif);

View File

@@ -52,7 +52,6 @@ static void displayFontSamples(int fillNum) {
fonts[3] = gFontSerif; fonts[3] = gFontSerif;
fonts[4] = gFontSans; fonts[4] = gFontSans;
uint width = gRenderSurfaceW;
uint height = gRenderSurfaceH; uint height = gRenderSurfaceH;
int left = 0, right = 0, top = 0, bottom = 0; int left = 0, right = 0, top = 0, bottom = 0;
rsgMeasureText(sampleText, &left, &right, &top, &bottom); 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 d = fabs(randomGauss()) * gGalaxyRadius * 0.5f + rsRand(64.0f);
float id = d / gGalaxyRadius; float id = d / gGalaxyRadius;
float z = randomGauss() * 0.4f * (1.0f - id); float z = randomGauss() * 0.4f * (1.0f - id);
float p = -d * ELLIPSE_TWIST;
if (d < gGalaxyRadius * 0.33f) { if (d < gGalaxyRadius * 0.33f) {
part->color.x = (uchar) (220 + id * 35); 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; int left = 0, right = 0, top = 0, bottom = 0;
rsgMeasureText(gSampleTextList100[0].item, &left, &right, &top, &bottom); rsgMeasureText(gSampleTextList100[0].item, &left, &right, &top, &bottom);
float textHeight = (float)(top - bottom); float textHeight = (float)(top - bottom);
float textWidth = (float)(right - left);
rs_matrix4x4 matrix; rs_matrix4x4 matrix;
rsMatrixLoadScale(&matrix, size, size, 1.0); rsMatrixLoadScale(&matrix, size, size, 1.0);

View File

@@ -19,7 +19,7 @@
#include "scenegraph_objects.rsh" #include "scenegraph_objects.rsh"
//#define DEBUG_PARAMS //#define DEBUG_PARAMS
static void debugParam(SgShaderParam *p, SgShaderParamData *pData) { static inline void debugParam(SgShaderParam *p, SgShaderParamData *pData) {
rsDebug("____________ Param ____________", p); rsDebug("____________ Param ____________", p);
printName(pData->paramName); printName(pData->paramName);
rsDebug("bufferOffset", p->bufferOffset); rsDebug("bufferOffset", p->bufferOffset);
@@ -44,8 +44,7 @@ static void debugParam(SgShaderParam *p, SgShaderParamData *pData) {
} }
} }
static inline void writeFloatData(float *ptr, const float4 *input, uint32_t vecSize) {
static void writeFloatData(float *ptr, const float4 *input, uint32_t vecSize) {
#ifdef DEBUG_PARAMS #ifdef DEBUG_PARAMS
rsDebug("Writing value ", *input); rsDebug("Writing value ", *input);
rsDebug("Writing vec size ", vecSize); 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, uint8_t *constantBuffer,
const SgCamera *currentCam, const SgCamera *currentCam,
SgFragmentShader *shader) { SgFragmentShader *shader) {
@@ -155,7 +154,7 @@ static bool processParam(SgShaderParam *p, SgShaderParamData *pData,
return true; return true;
} }
static void processAllParams(rs_allocation shaderConst, static inline void processAllParams(rs_allocation shaderConst,
rs_allocation allParams, rs_allocation allParams,
const SgCamera *camera) { const SgCamera *camera) {
if (rsIsObject(shaderConst)) { 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; int numParams = 0;
if (rsIsObject(shader->shaderTextureParams)) { if (rsIsObject(shader->shaderTextureParams)) {
numParams = rsAllocationGetDimX(shader->shaderTextureParams); numParams = rsAllocationGetDimX(shader->shaderTextureParams);

View File

@@ -78,7 +78,7 @@ static void draw(SgRenderable *obj) {
if (rsIsObject(renderState->pr)) { if (rsIsObject(renderState->pr)) {
rsgBindProgramRaster(renderState->pr); rsgBindProgramRaster(renderState->pr);
} else { } else {
rs_program_raster pr; rs_program_raster pr = {0};
rsgBindProgramRaster(pr); rsgBindProgramRaster(pr);
} }

View File

@@ -208,7 +208,7 @@ typedef struct Texture_s {
rs_allocation texture; rs_allocation texture;
} SgTexture; } SgTexture;
static void printName(rs_allocation name) { static inline void printName(rs_allocation name) {
if (!rsIsObject(name)) { if (!rsIsObject(name)) {
rsDebug("no name", 0); rsDebug("no name", 0);
return; return;
@@ -217,7 +217,7 @@ static void printName(rs_allocation name) {
rsDebug((const char*)rsGetElementAt(name, 0), 0); 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); rsDebug("***** Camera information. ptr:", cam);
printName(cam->name); printName(cam->name);
const SgTransform *camTransform = (const SgTransform *)rsGetElementAt(cam->transformMatrix, 0); const SgTransform *camTransform = (const SgTransform *)rsGetElementAt(cam->transformMatrix, 0);
@@ -233,7 +233,7 @@ static void printCameraInfo(const SgCamera *cam) {
rsDebug("View: ", &cam->view); rsDebug("View: ", &cam->view);
} }
static void printLightInfo(const SgLight *light) { static inline void printLightInfo(const SgLight *light) {
rsDebug("***** Light information. ptr:", light); rsDebug("***** Light information. ptr:", light);
printName(light->name); printName(light->name);
const SgTransform *lTransform = (const SgTransform *)rsGetElementAt(light->transformMatrix, 0); const SgTransform *lTransform = (const SgTransform *)rsGetElementAt(light->transformMatrix, 0);
@@ -246,7 +246,7 @@ static void printLightInfo(const SgLight *light) {
rsDebug("Type: ", light->type); 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("=================================", screenX);
rsDebug("Point X", screenX); rsDebug("Point X", screenX);
rsDebug("Point Y", screenY); rsDebug("Point Y", screenY);
@@ -290,7 +290,7 @@ static void getCameraRay(const SgCamera *cam, int screenX, int screenY, float3 *
*pnt = cam->position.xyz; *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 // Solving for t^2 + Bt + C = 0
float3 originMinusCenter = pnt - obj->worldBoundingSphere.xyz; float3 originMinusCenter = pnt - obj->worldBoundingSphere.xyz;
float B = dot(originMinusCenter, vec) * 2.0f; float B = dot(originMinusCenter, vec) * 2.0f;

View File

@@ -26,6 +26,7 @@ typedef struct {
} ParentData; } ParentData;
//#define DEBUG_TRANSFORMS //#define DEBUG_TRANSFORMS
/* Unused function:
static void debugTransform(SgTransform *data, const ParentData *parent) { static void debugTransform(SgTransform *data, const ParentData *parent) {
rsDebug("****** <Transform> ******", (int)data); rsDebug("****** <Transform> ******", (int)data);
printName(data->name); printName(data->name);
@@ -53,6 +54,7 @@ static void debugTransform(SgTransform *data, const ParentData *parent) {
rsDebug("timestamp", data->timestamp); rsDebug("timestamp", data->timestamp);
rsDebug("****** </Transform> ******", (int)data); rsDebug("****** </Transform> ******", (int)data);
} }
*/
static void appendTransformation(int type, float4 data, rs_matrix4x4 *mat) { static void appendTransformation(int type, float4 data, rs_matrix4x4 *mat) {
rs_matrix4x4 temp; 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)) { if (rsIsObject(data->children)) {
rs_allocation nullAlloc; rs_allocation nullAlloc = {0};
rsForEach(gTransformScript, data->children, nullAlloc, &toChild, sizeof(toChild)); rsForEach(gTransformScript, data->children, nullAlloc, &toChild, sizeof(toChild));
} }

View File

@@ -41,9 +41,7 @@ void init() {
gRotate = 0.0f; gRotate = 0.0f;
} }
static int pos = 50;
static float gRotateY = 120.0f; static float gRotateY = 120.0f;
static float3 gLookAt = 0;
static float gZoom = 50.0f; static float gZoom = 50.0f;
static void displayLoading() { static void displayLoading() {
if (rsIsObject(gRobotTex) && rsIsObject(gRobotMesh)) { if (rsIsObject(gRobotTex) && rsIsObject(gRobotMesh)) {

View File

@@ -131,7 +131,6 @@ static void renderAllMeshes() {
rs_allocation allMeshes = rsGetAllocation(gMeshes); rs_allocation allMeshes = rsGetAllocation(gMeshes);
int size = rsAllocationGetDimX(allMeshes); int size = rsAllocationGetDimX(allMeshes);
gLookAt = 0.0f; gLookAt = 0.0f;
float minX, minY, minZ, maxX, maxY, maxZ;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i); MeshInfo_t *info = (MeshInfo_t*)rsGetElementAt(allMeshes, i);
rsgDrawMesh(info->mMesh); rsgDrawMesh(info->mMesh);