1#include "shared.rsh" 2#include "rs_graphics.rsh" 3 4rs_program_store ditherEnable; 5rs_program_store colorRWriteEnable; 6rs_program_store colorGWriteEnable; 7rs_program_store colorBWriteEnable; 8rs_program_store colorAWriteEnable; 9rs_program_store blendSrc; 10rs_program_store blendDst; 11rs_program_store depthWriteEnable; 12rs_program_store depthFunc; 13 14static bool test_program_store_getters() { 15 bool failed = false; 16 17 _RS_ASSERT(rsgProgramStoreGetDepthFunc(depthFunc) == RS_DEPTH_FUNC_GREATER); 18 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(depthFunc) == false); 19 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(depthFunc) == false); 20 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(depthFunc) == false); 21 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(depthFunc) == false); 22 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( depthFunc) == false); 23 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(depthFunc) == false); 24 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(depthFunc) == RS_BLEND_SRC_ZERO); 25 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(depthFunc) == RS_BLEND_DST_ZERO); 26 27 _RS_ASSERT(rsgProgramStoreGetDepthFunc(depthWriteEnable) == RS_DEPTH_FUNC_ALWAYS); 28 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(depthWriteEnable) == true); 29 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(depthWriteEnable) == false); 30 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(depthWriteEnable) == false); 31 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(depthWriteEnable) == false); 32 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( depthWriteEnable) == false); 33 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(depthWriteEnable) == false); 34 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(depthWriteEnable) == RS_BLEND_SRC_ZERO); 35 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(depthWriteEnable) == RS_BLEND_DST_ZERO); 36 37 _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorRWriteEnable) == RS_DEPTH_FUNC_ALWAYS); 38 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorRWriteEnable) == false); 39 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorRWriteEnable) == true); 40 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorRWriteEnable) == false); 41 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorRWriteEnable) == false); 42 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorRWriteEnable) == false); 43 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorRWriteEnable) == false); 44 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorRWriteEnable) == RS_BLEND_SRC_ZERO); 45 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorRWriteEnable) == RS_BLEND_DST_ZERO); 46 47 _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorGWriteEnable) == RS_DEPTH_FUNC_ALWAYS); 48 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorGWriteEnable) == false); 49 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorGWriteEnable) == false); 50 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorGWriteEnable) == true); 51 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorGWriteEnable) == false); 52 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorGWriteEnable) == false); 53 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorGWriteEnable) == false); 54 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorGWriteEnable) == RS_BLEND_SRC_ZERO); 55 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorGWriteEnable) == RS_BLEND_DST_ZERO); 56 57 _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorBWriteEnable) == RS_DEPTH_FUNC_ALWAYS); 58 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorBWriteEnable) == false); 59 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorBWriteEnable) == false); 60 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorBWriteEnable) == false); 61 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorBWriteEnable) == true); 62 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorBWriteEnable) == false); 63 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorBWriteEnable) == false); 64 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorBWriteEnable) == RS_BLEND_SRC_ZERO); 65 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorBWriteEnable) == RS_BLEND_DST_ZERO); 66 67 _RS_ASSERT(rsgProgramStoreGetDepthFunc(colorAWriteEnable) == RS_DEPTH_FUNC_ALWAYS); 68 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(colorAWriteEnable) == false); 69 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(colorAWriteEnable) == false); 70 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(colorAWriteEnable) == false); 71 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(colorAWriteEnable) == false); 72 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( colorAWriteEnable) == true); 73 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(colorAWriteEnable) == false); 74 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorAWriteEnable) == RS_BLEND_SRC_ZERO); 75 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorAWriteEnable) == RS_BLEND_DST_ZERO); 76 77 _RS_ASSERT(rsgProgramStoreGetDepthFunc(ditherEnable) == RS_DEPTH_FUNC_ALWAYS); 78 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(ditherEnable) == false); 79 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(ditherEnable) == false); 80 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(ditherEnable) == false); 81 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(ditherEnable) == false); 82 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( ditherEnable) == false); 83 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(ditherEnable) == true); 84 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(ditherEnable) == RS_BLEND_SRC_ZERO); 85 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(ditherEnable) == RS_BLEND_DST_ZERO); 86 87 _RS_ASSERT(rsgProgramStoreGetDepthFunc(blendSrc) == RS_DEPTH_FUNC_ALWAYS); 88 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(blendSrc) == false); 89 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(blendSrc) == false); 90 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(blendSrc) == false); 91 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(blendSrc) == false); 92 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( blendSrc) == false); 93 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(blendSrc) == false); 94 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(blendSrc) == RS_BLEND_SRC_DST_COLOR); 95 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(blendSrc) == RS_BLEND_DST_ZERO); 96 97 _RS_ASSERT(rsgProgramStoreGetDepthFunc(blendDst) == RS_DEPTH_FUNC_ALWAYS); 98 _RS_ASSERT(rsgProgramStoreIsDepthMaskEnabled(blendDst) == false); 99 _RS_ASSERT(rsgProgramStoreIsColorMaskRedEnabled(blendDst) == false); 100 _RS_ASSERT(rsgProgramStoreIsColorMaskGreenEnabled(blendDst) == false); 101 _RS_ASSERT(rsgProgramStoreIsColorMaskBlueEnabled(blendDst) == false); 102 _RS_ASSERT(rsgProgramStoreIsColorMaskAlphaEnabled( blendDst) == false); 103 _RS_ASSERT(rsgProgramStoreIsDitherEnabled(blendDst) == false); 104 _RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(blendDst) == RS_BLEND_SRC_ZERO); 105 _RS_ASSERT(rsgProgramStoreGetBlendDstFunc(blendDst) == RS_BLEND_DST_DST_ALPHA); 106 107 if (failed) { 108 rsDebug("test_program_store_getters FAILED", 0); 109 } 110 else { 111 rsDebug("test_program_store_getters PASSED", 0); 112 } 113 114 return failed; 115} 116 117void program_store_test() { 118 bool failed = false; 119 failed |= test_program_store_getters(); 120 121 if (failed) { 122 rsSendToClientBlocking(RS_MSG_TEST_FAILED); 123 } 124 else { 125 rsSendToClientBlocking(RS_MSG_TEST_PASSED); 126 } 127} 128 129