Skip to content

Commit 2f2f0d4

Browse files
stephenhinesAndroid (Google) Code Review
authored andcommitted
Merge "Failing uchar4->int4 test" into jb-mr1-dev
2 parents a6d846a + 7bb5745 commit 2f2f0d4

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public void init(RenderScriptGL rs, Resources res, int width, int height) {
8787
unitTests.add(new UT_math_conformance(this, mRes, mCtx));
8888
unitTests.add(new UT_math_agree(this, mRes, mCtx));
8989
unitTests.add(new UT_min(this, mRes, mCtx));
90+
unitTests.add(new UT_int4(this, mRes, mCtx));
9091
unitTests.add(new UT_element(this, mRes, mCtx));
9192
unitTests.add(new UT_sampler(this, mRes, mCtx));
9293
unitTests.add(new UT_program_store(this, mRes, mCtx));
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (C) 2012 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.android.rs.test;
18+
19+
import android.content.Context;
20+
import android.content.res.Resources;
21+
import android.renderscript.*;
22+
23+
public class UT_int4 extends UnitTest {
24+
private Resources mRes;
25+
26+
protected UT_int4(RSTestCore rstc, Resources res, Context ctx) {
27+
super(rstc, "int4", ctx);
28+
mRes = res;
29+
}
30+
31+
public void run() {
32+
RenderScript pRS = RenderScript.create(mCtx);
33+
ScriptC_int4 s = new ScriptC_int4(pRS, mRes, R.raw.int4);
34+
pRS.setMessageHandler(mRsMessage);
35+
s.invoke_int4_test();
36+
pRS.finish();
37+
waitForMessage();
38+
pRS.destroy();
39+
}
40+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include "shared.rsh"
2+
#pragma rs_fp_relaxed
3+
4+
uchar4 u4 = 4;
5+
int4 gi4 = {2, 2, 2, 2};
6+
7+
void int4_test() {
8+
bool failed = false;
9+
int4 i4 = {u4.x, u4.y, u4.z, u4.w};
10+
i4 *= gi4;
11+
12+
rsDebug("i4.x", i4.x);
13+
rsDebug("i4.y", i4.y);
14+
rsDebug("i4.z", i4.z);
15+
rsDebug("i4.w", i4.w);
16+
17+
_RS_ASSERT(i4.x == 8);
18+
_RS_ASSERT(i4.y == 8);
19+
_RS_ASSERT(i4.z == 8);
20+
_RS_ASSERT(i4.w == 8);
21+
22+
if (failed) {
23+
rsSendToClientBlocking(RS_MSG_TEST_FAILED);
24+
}
25+
else {
26+
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
27+
}
28+
}
29+

0 commit comments

Comments
 (0)