Hide Label when it's only partially visible accesssing depth buffer?


I have a label on the map,but if it is partially visible,I want it to be fully hidden.
Is there a way to access depth buffer in your custom primitive?I tried to make a screen quad to visiualize screen depth,but nothing renders


  class MyPrimitive {
    constructor() {
      var positions = new Float32Array(
        [
          -1, -1, 0,
          1, -1, 0,
          1, 1, 0,
          -1, 1, 0
        ]
      );
      var uvs = new Float32Array([
        0, 0,
        1, 0,
        1, 1,
        0, 1
      ]);

      var indices = new Uint16Array([
        0, 1, 2, 0, 2, 3,
      ]);

      var attributeLocations = {
        position: 0,
        uv: 1,
      };

      var vertexShader =
        `
in vec3 position;
in vec2 uv;
out vec2 v_uv;

void main()
{
    gl_Position = vec4(position, 1.0f);
    v_uv = uv;
}
`;

      var fragmentShader =
        `
in vec2 v_uv;
// uniform sampler2D depthTexture;

void main()
{
    // float depth = czm_readDepth(czm_globeDepthTexture, v_uv);
    // out_FragColor = vec4(vec3(depth), 1.0);
    out_FragColor = texture(czm_globeDepthTexture, v_uv);
    // out_FragColor = vec4(1.0f, 0.0f, 0.0f, 1.0f);
    // out_FragColor = vec4(v_uv, 0.0f, 0.6f);

}
`;

      // 1.8 创建vertexArray
      function createVertexArray(context) {
        var geometry = new Cesium.Geometry({
          attributes: {
            position: new Cesium.GeometryAttribute({
              componentDatatype: Cesium.ComponentDatatype.FLOAT,
              componentsPerAttribute: 3,
              values: positions
            }),
            uv: new Cesium.GeometryAttribute({
              componentDatatype: Cesium.ComponentDatatype.FLOAT,
              componentsPerAttribute: 2,
              values: uvs
            })
          },
          indices: indices,
          primitiveType: Cesium.PrimitiveType.TRIANGLES,
          boundingSphere: Cesium.BoundingSphere.fromVertices(positions)
        });

        var vertexArray = Cesium.VertexArray.fromGeometry({
          context: context,
          geometry: geometry,
          attributeLocations: attributeLocations,
          bufferUsage: Cesium.BufferUsage.STATIC_DRAW,
          // interleave : true
        });

        return vertexArray;
      };

      // 1.9 创建command
      function createCommand(context) {
        var translucent = true;
        var closed = true;
        var rawRenderState = Cesium.Appearance.getDefaultRenderState(translucent, closed, undefined);
        rawRenderState.depthTest.enabled = false;

        var renderState = Cesium.RenderState.fromCache(rawRenderState);
        var vertexShaderSource = new Cesium.ShaderSource({
          sources: [vertexShader]
        });

        var fragmentShaderSource = new Cesium.ShaderSource({
          sources: [fragmentShader]
        });

        var uniformMap = {
          // depthTexture: function() {
          //   // return viewer.scene.context.uniformState.globeDepthTexture;
          // }
        }

        var shaderProgram = Cesium.ShaderProgram.fromCache({
          context: context,
          vertexShaderSource: vertexShaderSource,
          fragmentShaderSource: fragmentShaderSource,
          attributeLocations: attributeLocations
        });

        window.prog = shaderProgram;


        return new Cesium.DrawCommand({
          vertexArray: createVertexArray(context),
          primitiveType: Cesium.PrimitiveType.TRIANGLES,
          renderState: renderState,
          shaderProgram: shaderProgram,
          uniformMap: uniformMap,
          owner: this,
          // framebuffer : framebuffer,
          pass: Cesium.Pass.TRANSLUCENT,
          // pass: Cesium.Pass.OPAQUE,
          modelMatrix: Cesium.Matrix4.IDENTITY,
        });
      }

      this.show = true;
      this._command = undefined;
      this._createCommand = createCommand;
    }

    update(frameState) {
      if (!this.show) {
        return;
      }

      if (!Cesium.defined(this._command)) {
        this._command = this._createCommand(frameState.context);
      }

      if (Cesium.defined(this._command)) {
        frameState.commandList.push(this._command);
      }
    }

    isDestroyed() {
      return false;
    }

    destroy() {
      if (Cesium.defined(this._command)) {
        this._command.shaderProgram = this._command.shaderProgram && this._command.shaderProgram.destroy();
      }
      return destroyObject(this);
    };
  }


  var instance = viewer.scene.primitives.add(new MyPrimitive())