ac/llvm: fix amdgcn.rsq for v2f16
[mesa.git] / src / glx / dri_common.c
index fb8a29f099343ec4cec33d836d3cf96833d20c6f..a5fae27fce9dbcfc385b5cf096e48f8fea97eda8 100644 (file)
@@ -166,6 +166,10 @@ static const struct
       __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask),
       __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask),
       __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask),
+      __ATTRIB(__DRI_ATTRIB_RED_SHIFT, redShift),
+      __ATTRIB(__DRI_ATTRIB_GREEN_SHIFT, greenShift),
+      __ATTRIB(__DRI_ATTRIB_BLUE_SHIFT, blueShift),
+      __ATTRIB(__DRI_ATTRIB_ALPHA_SHIFT, alphaShift),
 #endif
       __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth),
       __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
@@ -397,7 +401,7 @@ driReleaseDrawables(struct glx_context *gc)
       if (pdraw->drawable == pdraw->xDrawable) {
         pdraw->refcount --;
         if (pdraw->refcount == 0) {
-           (*pdraw->destroyDrawable)(pdraw);
+           pdraw->destroyDrawable(pdraw);
            __glxHashDelete(priv->drawHash, gc->currentDrawable);
         }
       }
@@ -408,7 +412,7 @@ driReleaseDrawables(struct glx_context *gc)
       if (pdraw->drawable == pdraw->xDrawable) {
         pdraw->refcount --;
         if (pdraw->refcount == 0) {
-           (*pdraw->destroyDrawable)(pdraw);
+           pdraw->destroyDrawable(pdraw);
            __glxHashDelete(priv->drawHash, gc->currentReadable);
         }
       }
@@ -427,6 +431,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
 {
    unsigned i;
    bool got_profile = false;
+   int no_error = 0;
    uint32_t profile;
 
    *major_ver = 1;
@@ -459,6 +464,9 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
       case GLX_CONTEXT_FLAGS_ARB:
         *flags = attribs[i * 2 + 1];
         break;
+      case GLX_CONTEXT_OPENGL_NO_ERROR_ARB:
+        no_error = attribs[i * 2 + 1];
+        break;
       case GLX_CONTEXT_PROFILE_MASK_ARB:
         profile = attribs[i * 2 + 1];
         got_profile = true;
@@ -500,6 +508,10 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
       }
    }
 
+   if (no_error) {
+      *flags |= __DRI_CTX_FLAG_NO_ERROR;
+   }
+
    if (!got_profile) {
       if (*major_ver > 3 || (*major_ver == 3 && *minor_ver >= 2))
         *api = __DRI_API_OPENGL_CORE;
@@ -540,7 +552,8 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
    /* Unknown flag value.
     */
    if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE
-                  | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)) {
+                  | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS
+                  | __DRI_CTX_FLAG_NO_ERROR)) {
       *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
       return false;
    }
@@ -565,4 +578,45 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
    return true;
 }
 
+_X_HIDDEN bool
+dri2_check_no_error(uint32_t flags, struct glx_context *share_context,
+                    int major, unsigned *error)
+{
+   Bool noError = flags & __DRI_CTX_FLAG_NO_ERROR;
+
+   /* The KHR_no_error specs say:
+    *
+    *    Requires OpenGL ES 2.0 or OpenGL 2.0.
+    */
+   if (noError && major < 2) {
+      *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+      return false;
+   }
+
+   /* The GLX_ARB_create_context_no_error specs say:
+    *
+    *    BadMatch is generated if the value of GLX_CONTEXT_OPENGL_NO_ERROR_ARB
+    *    used to create <share_context> does not match the value of
+    *    GLX_CONTEXT_OPENGL_NO_ERROR_ARB for the context being created.
+    */
+   if (share_context && !!share_context->noError != !!noError) {
+      *error = __DRI_CTX_ERROR_BAD_FLAG;
+      return false;
+   }
+
+   /* The GLX_ARB_create_context_no_error specs say:
+    *
+    *    BadMatch is generated if the GLX_CONTEXT_OPENGL_NO_ERROR_ARB is TRUE at
+    *    the same time as a debug or robustness context is specified.
+    *
+    */
+   if (noError && ((flags & __DRI_CTX_FLAG_DEBUG) ||
+                   (flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS))) {
+      *error = __DRI_CTX_ERROR_BAD_FLAG;
+      return false;
+   }
+
+   return true;
+}
+
 #endif /* GLX_DIRECT_RENDERING */