| 1 |
#include "sfn_test_shaders.h" |
| 2 |
|
| 3 |
#include "../sfn_optimizer.h" |
| 4 |
#include "../sfn_ra.h" |
| 5 |
#include "../sfn_scheduler.h" |
| 6 |
#include "../sfn_shader.h" |
| 7 |
#include "../sfn_split_address_loads.h" |
| 8 |
|
| 9 |
using namespace r600; |
| 10 |
using std::ostringstream; |
| 11 |
|
| 12 |
TEST_F(TestShaderFromNir, CombineRegisterToTexSrc) |
| 13 |
{ |
| 14 |
const char *shader_input = |
| 15 |
R"(VS |
| 16 |
CHIPCLASS EVERGREEN |
| 17 |
INPUT LOC:0 |
| 18 |
INPUT LOC:1 |
| 19 |
OUTPUT LOC:0 VARYING_SLOT:0 MASK:15 |
| 20 |
OUTPUT LOC:1 VARYING_SLOT:32 MASK:3 |
| 21 |
REGISTERS R1.xyzw R2.xyzw R6.y R7.x R8.y R9.x R10.y |
| 22 |
ARRAYS A3[2].zw |
| 23 |
SHADER |
| 24 |
BLOCK_START |
| 25 |
ALU MOV R10.y@free : R2.x@fully{sb} {W} |
| 26 |
ALU MOV R9.x@free : R2.y@fully{sb} {W} |
| 27 |
ALU MOV R8.y@free : R2.z@fully{sb} {W} |
| 28 |
ALU MOV R7.x@free : R2.w@fully{sb} {W} |
| 29 |
ALU MOV R6.y@free : I[0] {W} |
| 30 |
LOOP_BEGIN |
| 31 |
BLOCK_END |
| 32 |
BLOCK_START |
| 33 |
IF (( ALU PRED_SETGE_INT __.x : R6.y@free KC0[0].x {LEP} PUSH_BEFORE )) |
| 34 |
BLOCK_END |
| 35 |
BLOCK_START |
| 36 |
BREAK |
| 37 |
BLOCK_END |
| 38 |
BLOCK_START |
| 39 |
ENDIF |
| 40 |
BLOCK_END |
| 41 |
BLOCK_START |
| 42 |
ALU INT_TO_FLT CLAMP S22.y@free{s} : R6.y@free {W} |
| 43 |
ALU TRUNC S24.w@free{s} : S22.y@free{s} {W} |
| 44 |
ALU FLT_TO_INT S25.x@free{s} : S24.w@free{s} {W} |
| 45 |
ALU MOV A3[S25.x@free].z : R10.y@free {W} |
| 46 |
ALU MOV A3[S25.x@free].w : R9.x@free {W} |
| 47 |
ALU MUL_IEEE R5.x@free : R9.x@free I[0.5] {W} |
| 48 |
ALU MUL_IEEE R9.x@free : R8.y@free I[0.5] {W} |
| 49 |
ALU MUL_IEEE R8.y@free : R7.x@free I[0.5] {W} |
| 50 |
ALU MUL_IEEE R7.x@free : R10.y@free I[0.5] {W} |
| 51 |
ALU ADD_INT R6.y@free : R6.y@free I[1] {W} |
| 52 |
ALU MOV R10.y@free : R5.x@free {W} |
| 53 |
LOOP_END |
| 54 |
BLOCK_END |
| 55 |
BLOCK_START |
| 56 |
ALU ADD S47.z@group{s} : A3[0].z A3[1].z {W} |
| 57 |
ALU ADD S47.x@group{s} : A3[0].w A3[1].w {W} |
| 58 |
EXPORT_DONE PARAM 0 S47.zx__ |
| 59 |
EXPORT_DONE POS 0 R1.xyzw |
| 60 |
BLOCK_END)"; |
| 61 |
|
| 62 |
auto sh = from_string(shader_input); |
| 63 |
split_address_loads(*sh); |
| 64 |
schedule(sh); |
| 65 |
} |