Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bb41dd6 authored by Jason Sams's avatar Jason Sams
Browse files

Add argument checking to sampler builder to disallow illegal modes.

parent 7b7f29a3
Loading
Loading
Loading
Loading
+27 −5
Original line number Diff line number Diff line
@@ -69,23 +69,45 @@ public class Sampler extends BaseObj {
        }

        public void setMin(Value v) {
            if (v == Value.NEAREST ||
                v == Value.LINEAR ||
                v == Value.LINEAR_MIP_LINEAR) {
                mMin = v;
            } else {
                throw new IllegalArgumentException("Invalid value");
            }
        }

        public void setMag(Value v) {
            if (v == Value.NEAREST || v == Value.LINEAR) {
                mMag = v;
            } else {
                throw new IllegalArgumentException("Invalid value");
            }
        }

        public void setWrapS(Value v) {
            if (v == Value.WRAP || v == Value.CLAMP) {
                mWrapS = v;
            } else {
                throw new IllegalArgumentException("Invalid value");
            }
        }

        public void setWrapT(Value v) {
            if (v == Value.WRAP || v == Value.CLAMP) {
                mWrapT = v;
            } else {
                throw new IllegalArgumentException("Invalid value");
            }
        }

        public void setWrapR(Value v) {
            if (v == Value.WRAP || v == Value.CLAMP) {
                mWrapR = v;
            } else {
                throw new IllegalArgumentException("Invalid value");
            }
        }

        static synchronized Sampler internalCreate(RenderScript rs, Builder b) {