13ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/* 23ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * Copyright © 2011 Intel Corporation 33ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * 43ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * Permission is hereby granted, free of charge, to any person obtaining a 53ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * copy of this software and associated documentation files (the "Software"), 63ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * to deal in the Software without restriction, including without limitation 73ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * the rights to use, copy, modify, merge, publish, distribute, sublicense, 83ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * and/or sell copies of the Software, and to permit persons to whom the 93ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * Software is furnished to do so, subject to the following conditions: 103ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * 113ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * The above copyright notice and this permission notice (including the next 123ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * paragraph) shall be included in all copies or substantial portions of the 133ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * Software. 143ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * 153ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 163ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 173ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 183ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 193ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 203ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 213ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * DEALINGS IN THE SOFTWARE. 223ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 233ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include <gtest/gtest.h> 243ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include <string.h> 253ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 263ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" { 273ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include "glxclient.h" 283ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include "glx_error.h" 293ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 303ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 313ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include <xcb/glx.h> 323ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include "mock_xdisplay.h" 333ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick#include "fake_glx_screen.h" 343ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 353ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickstatic bool CreateContextAttribsARB_was_sent; 363ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickstatic xcb_glx_create_context_attribs_arb_request_t req; 373ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickstatic uint32_t sent_attribs[1024]; 383ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickstatic uint32_t next_id; 393ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 403ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 413ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickstruct glx_screen *psc; 423ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 433ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" Bool 443ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickglx_context_init(struct glx_context *gc, 453ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_screen *psc, struct glx_config *config) 463ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 473ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->majorOpcode = 123; 483ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->screen = psc->scr; 493ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->psc = psc; 503ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->config = config; 513ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->isDirect = GL_TRUE; 523ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->currentContextTag = -1; 533ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 543ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick return GL_TRUE; 553ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 563ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 573ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" struct glx_screen * 583ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickGetGLXScreenConfigs(Display * dpy, int scrn) 593ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 603ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick (void) dpy; 613ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick (void) scrn; 623ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick return psc; 633ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 643ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 653ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" uint32_t 663ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickxcb_generate_id(xcb_connection_t *c) 673ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 683ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick (void) c; 693ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 703ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick return next_id++; 713ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 723ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 733ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" xcb_void_cookie_t 743ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickxcb_glx_create_context_attribs_arb_checked(xcb_connection_t *c, 753ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick xcb_glx_context_t context, 763ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick uint32_t fbconfig, 773ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick uint32_t screen, 783ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick uint32_t share_list, 793ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick uint8_t is_direct, 803ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick uint32_t num_attribs, 813ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick const uint32_t *attribs) 823ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 833ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick (void) c; 843ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 853ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick CreateContextAttribsARB_was_sent = true; 863ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick req.context = context; 873ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick req.fbconfig = fbconfig; 883ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick req.screen = screen; 893ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick req.share_list = share_list; 903ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick req.is_direct = is_direct; 913ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick req.num_attribs = num_attribs; 923ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 933ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick if (num_attribs != 0 && attribs != NULL) 943ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick memcpy(sent_attribs, attribs, num_attribs * 2 * sizeof(uint32_t)); 953ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 963ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick xcb_void_cookie_t cookie; 973ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick cookie.sequence = 0xbadc0de; 983ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 993ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick return cookie; 1003ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1013ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1023ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" xcb_generic_error_t * 1033ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickxcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie) 1043ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1053ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick return NULL; 1063ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1073ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1083ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" void 1093ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick__glXSendErrorForXcb(Display * dpy, const xcb_generic_error_t *err) 1103ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1113ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1123ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1133ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickextern "C" void 1143ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick__glXSendError(Display * dpy, int_fast8_t errorCode, uint_fast32_t resourceID, 1153ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick uint_fast16_t minorCode, bool coreX11error) 1163ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1173ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1183ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1193ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickclass glXCreateContextAttribARB_test : public ::testing::Test { 1203ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickpublic: 1213ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick virtual void SetUp(); 1223ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1233ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick /** 1243ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * Replace the existing screen with a direct-rendering screen 1253ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 1263ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick void use_direct_rendering_screen(); 1273ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1283ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick mock_XDisplay *dpy; 1293ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_config fbc; 1303ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick}; 1313ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1323ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickvoid 1333ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickglXCreateContextAttribARB_test::SetUp() 1343ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1353ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick CreateContextAttribsARB_was_sent = false; 1363ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick memset(&req, 0, sizeof(req)); 1373ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick next_id = 99; 1383ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick fake_glx_context::contexts_allocated = 0; 1393ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc = new fake_glx_screen(NULL, 0, ""); 1403ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1413ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->dpy = new mock_XDisplay(1); 1423ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1433ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick memset(&this->fbc, 0, sizeof(this->fbc)); 1443ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->fbc.fbconfigID = 0xbeefcafe; 1453ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1463ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1473ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanickvoid 1483ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickglXCreateContextAttribARB_test::use_direct_rendering_screen() 1493ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1503ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_screen *direct_psc = 1513ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick new fake_glx_screen_direct(psc->display, 1523ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc->scr, 1533ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc->serverGLXexts); 1543ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1553ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick delete psc; 1563ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc = direct_psc; 1573ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1583ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1593ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/** 1603ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * \name Verify detection of client-side errors 1613ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 1623ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/*@{*/ 1633ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, NULL_display_returns_None) 1643ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1653ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 1663ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(NULL, (GLXFBConfig) &this->fbc, 0, 1673ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 1683ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1693ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(None, ctx); 1703ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(0, fake_glx_context::contexts_allocated); 1713ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1723ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1733ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, NULL_fbconfig_returns_None) 1743ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1753ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 1763ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, NULL, 0, False, NULL); 1773ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1783ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(None, ctx); 1793ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(0, fake_glx_context::contexts_allocated); 1803ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1813ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1823ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, NULL_screen_returns_None) 1833ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 1843ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick delete psc; 1853ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc = NULL; 1863ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1873ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 1883ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 1893ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 1903ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1913ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(None, ctx); 1923ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(0, fake_glx_context::contexts_allocated); 1933ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 1943ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/*@}*/ 1953ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1963ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/** 1973ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * \name Verify that correct protocol bits are sent to the server. 1983ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 1993ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/*@{*/ 2003ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, does_send_protocol) 2013ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2023ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2033ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2043ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2053ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_TRUE(CreateContextAttribsARB_was_sent); 2063ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2073ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2083ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_context) 2093ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2103ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2113ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2123ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 213f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ(99u, req.context); 2143ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2153ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2163ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_fbconfig) 2173ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2183ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2193ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2203ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2213ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(0xbeefcafe, req.fbconfig); 2223ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2233ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2243ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_share_list) 2253ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2263ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext share = 2273ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2283ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2293ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2303ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, share); 2313ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2323ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, share, 2333ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2343ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2353ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *glx_ctx = (struct glx_context *) share; 2363ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(glx_ctx->xid, req.share_list); 2373ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2383ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2393ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_indirect_screen_and_direct_set_to_true) 2403ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2413ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2423ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick True, NULL); 2433ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2443ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_FALSE(req.is_direct); 2453ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2463ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2473ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_indirect_screen_and_direct_set_to_false) 2483ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2493ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2503ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2513ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2523ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_FALSE(req.is_direct); 2533ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2543ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2553ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_direct_screen_and_direct_set_to_true) 2563ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2573ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->use_direct_rendering_screen(); 2583ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2593ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2603ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick True, NULL); 2613ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2623ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_TRUE(req.is_direct); 2633ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2643ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2653ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_is_direct_for_direct_screen_and_direct_set_to_false) 2663ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2673ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->use_direct_rendering_screen(); 2683ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2693ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2703ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2713ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2723ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_FALSE(req.is_direct); 2733ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2743ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2753ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_screen) 2763ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2773ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->fbc.screen = 7; 2783ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc->scr = 7; 2793ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2803ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 2813ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 2823ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 283f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ(7u, req.screen); 2843ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 2853ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2863ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs) 2873ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 2883ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick /* Use zeros in the second half of each attribute pair to try and trick the 2893ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * implementation into termiating the list early. 2903ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * 2913ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * Use non-zero in the second half of the last attribute pair to try and 2923ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * trick the implementation into not terminating the list early enough. 2933ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 2943ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick static const int attribs[] = { 2953ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 1, 0, 2963ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 2, 0, 2973ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3, 0, 2983ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4, 0, 2993ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 0, 6, 3003ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 0, 0 3013ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick }; 3023ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3033ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3043ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, attribs); 3053ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 306f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ(4u, req.num_attribs); 3073ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 3083ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3093ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs_empty_list) 3103ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 3113ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick static const int attribs[] = { 3123ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 0, 3133ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick }; 3143ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3153ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3163ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, attribs); 3173ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 318f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ(0u, req.num_attribs); 3193ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 3203ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3213ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_num_attribs_NULL_list_pointer) 3223ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 3233ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3243ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 3253ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 326f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ(0u, req.num_attribs); 3273ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 3283ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3293ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, sent_correct_attrib_list) 3303ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 3313ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick int attribs[] = { 3323ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLX_RENDER_TYPE, GLX_RGBA_TYPE, 3333ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLX_CONTEXT_MAJOR_VERSION_ARB, 1, 3343ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLX_CONTEXT_MINOR_VERSION_ARB, 2, 3353ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 0 3363ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick }; 3373ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3383ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3393ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, attribs); 3403ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3413ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick for (unsigned i = 0; i < 6; i++) { 342f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ((uint32_t) attribs[i], sent_attribs[i]); 3433ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick } 3443ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 3453ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/*@}*/ 3463ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3473ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/** 3483ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * \name Verify details of the returned GLXContext 3493ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 3503ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/*@{*/ 3513ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context) 3523ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 3533ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 3543ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3553ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 3563ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3573ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick /* Since the server did not return an error, the GLXContext should not be 3583ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * NULL. 3593ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 3603ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_NE((GLXContext)0, ctx); 3613ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3623ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick /* It shouldn't be the XID of the context either. 3633ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 3643ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_NE((GLXContext)99, ctx); 3653ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 3663ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3673ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_xid) 3683ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 3693ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 3703ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3713ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 3723ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3733ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick /* Since the server did not return an error, the GLXContext should not be 3743ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick * NULL. 3753ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick */ 3763ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext)0, ctx); 3773ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3783ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *glx_ctx = (struct glx_context *) ctx; 379f2f05e50b1e88b431cb98348bf67e6d5a35d8cf1Paul Berry EXPECT_EQ(99u, glx_ctx->xid); 3803ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 3813ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3823ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_share_xid) 3833ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 3843ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext first = 3853ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 3863ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 3873ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3883ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, first); 3893ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3903ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext second = 3913ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, first, 3923ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 3933ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3943ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, second); 3953ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 3963ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *share = (struct glx_context *) first; 3973ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *ctx = (struct glx_context *) second; 3983ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(share->xid, ctx->share_xid); 3993ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4003ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4013ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_indirect_screen_and_direct_set_to_true) 4023ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4033ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4043ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4053ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick True, NULL); 4063ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4073ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4083ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4093ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4103ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4113ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_FALSE(gc->isDirect); 4123ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4133ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4143ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_indirect_screen_and_direct_set_to_false) 4153ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4163ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4173ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4183ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 4193ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4203ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4213ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4223ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4233ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4243ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_FALSE(gc->isDirect); 4253ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4263ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4273ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_direct_screen_and_direct_set_to_true) 4283ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4293ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->use_direct_rendering_screen(); 4303ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4313ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4323ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4333ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick True, NULL); 4343ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4353ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4363ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4373ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4383ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4393ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_TRUE(gc->isDirect); 4403ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4413ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4423ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_isDirect_for_direct_screen_and_direct_set_to_false) 4433ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4443ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->use_direct_rendering_screen(); 4453ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4463ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4473ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4483ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 4493ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4503ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4513ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4523ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4533ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4543ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_FALSE(gc->isDirect); 4553ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4563ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4573ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_indirect_context_client_state_private) 4583ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4593ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4603ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4613ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 4623ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4633ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4643ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4653ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4663ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4673ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_FALSE(gc->isDirect); 4683ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ((struct __GLXattributeRec *) 0xcafebabe, 4693ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick gc->client_state_private); 4703ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4713ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4723ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_indirect_context_config) 4733ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4743ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4753ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4763ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 4773ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4783ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4793ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4803ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4813ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4823ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(&this->fbc, gc->config); 4833ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 4843ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4853ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_screen_number) 4863ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 4873ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick this->fbc.screen = 7; 4883ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick psc->scr = 7; 4893ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4903ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 4913ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 4923ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 4933ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4943ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 4953ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4963ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 4973ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 4983ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(7, gc->screen); 4993ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 5003ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 5013ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian RomanickTEST_F(glXCreateContextAttribARB_test, correct_context_screen_pointer) 5023ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick{ 5033ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick GLXContext ctx = 5043ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick glXCreateContextAttribsARB(this->dpy, (GLXFBConfig) &this->fbc, 0, 5053ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick False, NULL); 5063ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 5073ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick ASSERT_NE((GLXContext) 0, ctx); 5083ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 5093ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick struct glx_context *gc = (struct glx_context *) ctx; 5103ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick 5113ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick EXPECT_EQ(psc, gc->psc); 5123ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick} 5133ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4Ian Romanick/*@}*/ 514