Mask a renderTexture

I created a gradient background and i want to remove (mask) some parts of the texture.

But mask= / setMask() did not do anything.

const width = 100
const heigth = 200

const rt = this.add.renderTexture(0, 0, width, height).setIsSpriteTexture(true).setVisible(false)
const boxRt = this.add.renderTexture(0, 0, width, height).setIsSpriteTexture(true).setVisible(false)
const gradientRt = this.add.renderTexture(0, 0, width, height).setIsSpriteTexture(true).setVisible(false)

// gradient
const gradient = this.add.graphics().setVisible(false)

gradient.fillGradientStyle(0xff0000, 0xff0000, 0x0000ff, 0x0000ff, 1, 1, 1, 1)
gradient.fillRect(0, 0, this.width + 200, height + 80)
gradient.setAngle(-30)

gradientRt.draw(gradient, -200, 80)

// box
const box = this.add.graphics().setVisible(false)

box.fillStyle(0xffff00, 1)

box.beginPath()
box.moveTo(20, 20)
box.lineTo(40, 20)
box.lineTo(40, 40)
box.lineTo(20, 40)
box.closePath()
box.fillPath()
box.strokePath()

boxRt.draw(box, 0, 0)

// mask
// const boxMask = boxRt.createBitmapMask() // not work
const boxMask = new Phaser.Display.Masks.GeometryMask(this, box) // not work
gradientRt.setMask(boxMask)

// draw
rt.draw(gradientRt)

Is it not possible to mask textures?

You can’t mask a texture itself, only a game object.

Ok, thank you.