1#include "shared.rsh" 2#include "rs_graphics.rsh" 3rs_sampler minification; 4rs_sampler magnification; 5rs_sampler wrapS; 6rs_sampler wrapT; 7rs_sampler anisotropy; 8 9static bool test_sampler_getters() { 10 bool failed = false; 11 12 _RS_ASSERT(rsSamplerGetMagnification(minification) == RS_SAMPLER_NEAREST); 13 _RS_ASSERT(rsSamplerGetMinification(minification) == RS_SAMPLER_LINEAR_MIP_LINEAR); 14 _RS_ASSERT(rsSamplerGetWrapS(minification) == RS_SAMPLER_CLAMP); 15 _RS_ASSERT(rsSamplerGetWrapT(minification) == RS_SAMPLER_CLAMP); 16 _RS_ASSERT(rsSamplerGetAnisotropy(minification) == 1.0f); 17 18 _RS_ASSERT(rsSamplerGetMagnification(magnification) == RS_SAMPLER_LINEAR); 19 _RS_ASSERT(rsSamplerGetMinification(magnification) == RS_SAMPLER_NEAREST); 20 _RS_ASSERT(rsSamplerGetWrapS(magnification) == RS_SAMPLER_CLAMP); 21 _RS_ASSERT(rsSamplerGetWrapT(magnification) == RS_SAMPLER_CLAMP); 22 _RS_ASSERT(rsSamplerGetAnisotropy(magnification) == 1.0f); 23 24 _RS_ASSERT(rsSamplerGetMagnification(wrapS) == RS_SAMPLER_NEAREST); 25 _RS_ASSERT(rsSamplerGetMinification(wrapS) == RS_SAMPLER_NEAREST); 26 _RS_ASSERT(rsSamplerGetWrapS(wrapS) == RS_SAMPLER_WRAP); 27 _RS_ASSERT(rsSamplerGetWrapT(wrapS) == RS_SAMPLER_CLAMP); 28 _RS_ASSERT(rsSamplerGetAnisotropy(wrapS) == 1.0f); 29 30 _RS_ASSERT(rsSamplerGetMagnification(wrapT) == RS_SAMPLER_NEAREST); 31 _RS_ASSERT(rsSamplerGetMinification(wrapT) == RS_SAMPLER_NEAREST); 32 _RS_ASSERT(rsSamplerGetWrapS(wrapT) == RS_SAMPLER_CLAMP); 33 _RS_ASSERT(rsSamplerGetWrapT(wrapT) == RS_SAMPLER_WRAP); 34 _RS_ASSERT(rsSamplerGetAnisotropy(wrapT) == 1.0f); 35 36 _RS_ASSERT(rsSamplerGetMagnification(anisotropy) == RS_SAMPLER_NEAREST); 37 _RS_ASSERT(rsSamplerGetMinification(anisotropy) == RS_SAMPLER_NEAREST); 38 _RS_ASSERT(rsSamplerGetWrapS(anisotropy) == RS_SAMPLER_CLAMP); 39 _RS_ASSERT(rsSamplerGetWrapT(anisotropy) == RS_SAMPLER_CLAMP); 40 _RS_ASSERT(rsSamplerGetAnisotropy(anisotropy) == 8.0f); 41 42 if (failed) { 43 rsDebug("test_sampler_getters FAILED", 0); 44 } 45 else { 46 rsDebug("test_sampler_getters PASSED", 0); 47 } 48 49 return failed; 50} 51 52void sampler_test() { 53 bool failed = false; 54 failed |= test_sampler_getters(); 55 56 if (failed) { 57 rsSendToClientBlocking(RS_MSG_TEST_FAILED); 58 } 59 else { 60 rsSendToClientBlocking(RS_MSG_TEST_PASSED); 61 } 62} 63 64