ReactOS  0.4.14-dev-115-g4576127
sw_extensions.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * PURPOSE: Tests extensions exposed by the software implementation
5  * PROGRAMMERS: Jérôme Gardou
6  */
7 
8 #include <windows.h>
9 #include <wingdi.h>
10 #include <GL/gl.h>
11 
12 #include "wine/test.h"
13 
14 START_TEST(sw_extensions)
15 {
16  BITMAPINFO biDst;
18  HBITMAP bmpDst, bmpOld;
19  INT nFormats, iPixelFormat, res, i;
21  const char* output;
22  HGLRC Context;
23  UINT *dstBuffer = NULL;
24 
25  memset(&biDst, 0, sizeof(BITMAPINFO));
26  biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
27  biDst.bmiHeader.biWidth = 4;
28  biDst.bmiHeader.biHeight = -4;
29  biDst.bmiHeader.biPlanes = 1;
30  biDst.bmiHeader.biBitCount = 32;
32 
33  bmpDst = CreateDIBSection(0, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, NULL, 0);
34 
35  bmpOld = SelectObject(hdcDst, bmpDst);
36 
37  /* Choose a pixel format */
38  nFormats = DescribePixelFormat(hdcDst, 0, 0, NULL);
39  for(i=1; i<=nFormats; i++)
40  {
41  memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
43 
46  (pfd.cColorBits == 32) &&
47  (pfd.cAlphaBits == 8) )
48  {
49  iPixelFormat = i;
50  break;
51  }
52  }
53 
54  ok(pfd.dwFlags & PFD_GENERIC_FORMAT, "We found a pixel format for drawing to bitmap which is not generic !\n");
55  ok (iPixelFormat >= 1 && iPixelFormat <= nFormats, "Could not find a suitable pixel format.\n");
57  ok (res != 0, "SetPixelFormat failed.\n");
59  ok(Context != NULL, "We failed to create a GL context.\n");
61 
62  /* Get the version */
63  output = (const char*)glGetString(GL_VERSION);
64  ok(strcmp(output, "1.1.0") == 0, "Expected version 1.1.0, got \"%s\".\n", output);
65 
66  /* Get the extensions list */
67  output = (const char*)glGetString(GL_EXTENSIONS);
68  trace("GL extensions are %s.\n", output);
69  ok (strlen(output) == strlen("GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture"), "Wrong extension list : \"%s\".\n", output);
70  ok(strstr(output, "GL_WIN_swap_hint") != NULL, "GL_WIN_swap_hint extension is not present.\n");
71  ok(strstr(output, "GL_EXT_bgra") != NULL, "GL_EXT_bgra extension is not present.\n");
72  ok(strstr(output, "GL_EXT_paletted_texture") != NULL, "GL_EXT_paletted_texture extension is not present.\n");
73 
74  /* cleanup */
76  SelectObject(hdcDst, bmpOld);
78 }
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define PFD_DRAW_TO_BITMAP
Definition: wingdi.h:303
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define GL_EXTENSIONS
Definition: gl.h:690
int32_t INT
Definition: typedefs.h:56
BOOL WINAPI SetPixelFormat(_In_ HDC, _In_ int, _In_ const PIXELFORMATDESCRIPTOR *)
#define GL_VERSION
Definition: gl.h:689
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int WINAPI DescribePixelFormat(_In_ HDC hdc, _In_ int iPixelFormat, _In_ UINT nBytes, _Out_writes_bytes_opt_(nBytes) LPPIXELFORMATDESCRIPTOR ppfd)
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
#define trace
Definition: atltest.h:70
START_TEST(sw_extensions)
Definition: sw_extensions.c:14
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
#define PFD_GENERIC_FORMAT
Definition: wingdi.h:306
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
Definition: wgl.c:650
static HDC hdcDst
Definition: xlate.c:32
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
_In_ LONG iPixelFormat
Definition: winddi.h:3488
unsigned int UINT
Definition: ndis.h:50
GLuint res
Definition: glext.h:9613
struct tagContext Context
Definition: acpixf.h:1024
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static HBITMAP
Definition: button.c:44
#define PFD_SUPPORT_OPENGL
Definition: wingdi.h:305
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:34
HGLRC WINAPI wglCreateContext(HDC hdc)
Definition: wgl.c:383
GLAPI const GLubyte *GLAPIENTRY glGetString(GLenum name)