st/wgl: whitespace, formatting fixes in stw_pixelformat.c
Trivial.
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright 2008 VMware, Inc.
|
* Copyright 2008 VMware, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the
|
* copy of this software and associated documentation files (the
|
||||||
* "Software"), to deal in the Software without restriction, including
|
* "Software"), to deal in the Software without restriction, including
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
* distribute, sub license, and/or sell copies of the Software, and to
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
* the following conditions:
|
* the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice (including the
|
* The above copyright notice and this permission notice (including the
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
* next paragraph) shall be included in all copies or substantial portions
|
||||||
* of the Software.
|
* of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*
|
*
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "pipe/p_format.h"
|
#include "pipe/p_format.h"
|
||||||
@@ -88,10 +88,10 @@ stw_pf_color[] = {
|
|||||||
|
|
||||||
static const struct stw_pf_color_info
|
static const struct stw_pf_color_info
|
||||||
stw_pf_color_extended[] = {
|
stw_pf_color_extended[] = {
|
||||||
{ PIPE_FORMAT_R32G32B32A32_FLOAT, { 32, 32, 32, 32}, { 0, 32, 64, 96} }
|
{ PIPE_FORMAT_R32G32B32A32_FLOAT, {32, 32, 32, 32}, {0, 32, 64, 96} }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct stw_pf_depth_info
|
static const struct stw_pf_depth_info
|
||||||
stw_pf_depth_stencil[] = {
|
stw_pf_depth_stencil[] = {
|
||||||
/* pure depth */
|
/* pure depth */
|
||||||
{ PIPE_FORMAT_Z32_UNORM, {32, 0} },
|
{ PIPE_FORMAT_Z32_UNORM, {32, 0} },
|
||||||
@@ -104,14 +104,14 @@ stw_pf_depth_stencil[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const boolean
|
static const boolean
|
||||||
stw_pf_doublebuffer[] = {
|
stw_pf_doublebuffer[] = {
|
||||||
FALSE,
|
FALSE,
|
||||||
TRUE,
|
TRUE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const unsigned
|
const unsigned
|
||||||
stw_pf_multisample[] = {
|
stw_pf_multisample[] = {
|
||||||
0,
|
0,
|
||||||
4,
|
4,
|
||||||
@@ -121,19 +121,18 @@ stw_pf_multisample[] = {
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
stw_pixelformat_add(
|
stw_pixelformat_add(struct stw_device *stw_dev,
|
||||||
struct stw_device *stw_dev,
|
boolean extended,
|
||||||
boolean extended,
|
const struct stw_pf_color_info *color,
|
||||||
const struct stw_pf_color_info *color,
|
const struct stw_pf_depth_info *depth,
|
||||||
const struct stw_pf_depth_info *depth,
|
unsigned accum,
|
||||||
unsigned accum,
|
boolean doublebuffer,
|
||||||
boolean doublebuffer,
|
unsigned samples)
|
||||||
unsigned samples )
|
|
||||||
{
|
{
|
||||||
struct stw_pixelformat_info *pfi;
|
struct stw_pixelformat_info *pfi;
|
||||||
|
|
||||||
assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS);
|
assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS);
|
||||||
if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS)
|
if (stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 0) == color->bits.red);
|
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 0) == color->bits.red);
|
||||||
@@ -142,16 +141,16 @@ stw_pixelformat_add(
|
|||||||
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 3) == color->bits.alpha);
|
assert(util_format_get_component_bits(color->format, UTIL_FORMAT_COLORSPACE_RGB, 3) == color->bits.alpha);
|
||||||
assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 0) == depth->bits.depth);
|
assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 0) == depth->bits.depth);
|
||||||
assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 1) == depth->bits.stencil);
|
assert(util_format_get_component_bits(depth->format, UTIL_FORMAT_COLORSPACE_ZS, 1) == depth->bits.stencil);
|
||||||
|
|
||||||
pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count];
|
pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count];
|
||||||
|
|
||||||
memset(pfi, 0, sizeof *pfi);
|
memset(pfi, 0, sizeof *pfi);
|
||||||
|
|
||||||
pfi->pfd.nSize = sizeof pfi->pfd;
|
pfi->pfd.nSize = sizeof pfi->pfd;
|
||||||
pfi->pfd.nVersion = 1;
|
pfi->pfd.nVersion = 1;
|
||||||
|
|
||||||
pfi->pfd.dwFlags = PFD_SUPPORT_OPENGL;
|
pfi->pfd.dwFlags = PFD_SUPPORT_OPENGL;
|
||||||
|
|
||||||
/* TODO: also support non-native pixel formats */
|
/* TODO: also support non-native pixel formats */
|
||||||
if (!extended) {
|
if (!extended) {
|
||||||
pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW;
|
pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW;
|
||||||
@@ -162,10 +161,11 @@ stw_pixelformat_add(
|
|||||||
|
|
||||||
if (doublebuffer)
|
if (doublebuffer)
|
||||||
pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_EXCHANGE;
|
pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_EXCHANGE;
|
||||||
|
|
||||||
pfi->pfd.iPixelType = PFD_TYPE_RGBA;
|
pfi->pfd.iPixelType = PFD_TYPE_RGBA;
|
||||||
|
|
||||||
pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue + color->bits.alpha;
|
pfi->pfd.cColorBits =
|
||||||
|
color->bits.red + color->bits.green + color->bits.blue + color->bits.alpha;
|
||||||
pfi->pfd.cRedBits = color->bits.red;
|
pfi->pfd.cRedBits = color->bits.red;
|
||||||
pfi->pfd.cRedShift = color->shift.red;
|
pfi->pfd.cRedShift = color->shift.red;
|
||||||
pfi->pfd.cGreenBits = color->bits.green;
|
pfi->pfd.cGreenBits = color->bits.green;
|
||||||
@@ -204,7 +204,7 @@ stw_pixelformat_add(
|
|||||||
|
|
||||||
pfi->stvis.samples = samples;
|
pfi->stvis.samples = samples;
|
||||||
pfi->stvis.render_buffer = ST_ATTACHMENT_INVALID;
|
pfi->stvis.render_buffer = ST_ATTACHMENT_INVALID;
|
||||||
|
|
||||||
/* WGL_ARB_render_texture */
|
/* WGL_ARB_render_texture */
|
||||||
if (color->bits.alpha)
|
if (color->bits.alpha)
|
||||||
pfi->bindToTextureRGBA = TRUE;
|
pfi->bindToTextureRGBA = TRUE;
|
||||||
@@ -212,8 +212,8 @@ stw_pixelformat_add(
|
|||||||
pfi->bindToTextureRGB = TRUE;
|
pfi->bindToTextureRGB = TRUE;
|
||||||
|
|
||||||
++stw_dev->pixelformat_extended_count;
|
++stw_dev->pixelformat_extended_count;
|
||||||
|
|
||||||
if(!extended) {
|
if (!extended) {
|
||||||
++stw_dev->pixelformat_count;
|
++stw_dev->pixelformat_count;
|
||||||
assert(stw_dev->pixelformat_count == stw_dev->pixelformat_extended_count);
|
assert(stw_dev->pixelformat_count == stw_dev->pixelformat_extended_count);
|
||||||
}
|
}
|
||||||
@@ -225,8 +225,7 @@ stw_pixelformat_add(
|
|||||||
*/
|
*/
|
||||||
static unsigned
|
static unsigned
|
||||||
add_color_format_variants(const struct stw_pf_color_info *color_formats,
|
add_color_format_variants(const struct stw_pf_color_info *color_formats,
|
||||||
unsigned num_color_formats,
|
unsigned num_color_formats, boolean extended)
|
||||||
boolean extended)
|
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = stw_dev->screen;
|
struct pipe_screen *screen = stw_dev->screen;
|
||||||
unsigned cfmt, ms, db, ds, acc;
|
unsigned cfmt, ms, db, ds, acc;
|
||||||
@@ -288,12 +287,12 @@ add_color_format_variants(const struct stw_pf_color_info *color_formats,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
stw_pixelformat_init( void )
|
stw_pixelformat_init(void)
|
||||||
{
|
{
|
||||||
unsigned num_formats;
|
unsigned num_formats;
|
||||||
|
|
||||||
assert( !stw_dev->pixelformat_count );
|
assert(!stw_dev->pixelformat_count);
|
||||||
assert( !stw_dev->pixelformat_extended_count );
|
assert(!stw_dev->pixelformat_extended_count);
|
||||||
|
|
||||||
/* normal, displayable formats */
|
/* normal, displayable formats */
|
||||||
num_formats = add_color_format_variants(stw_pf_color,
|
num_formats = add_color_format_variants(stw_pf_color,
|
||||||
@@ -304,24 +303,27 @@ stw_pixelformat_init( void )
|
|||||||
add_color_format_variants(stw_pf_color_extended,
|
add_color_format_variants(stw_pf_color_extended,
|
||||||
ARRAY_SIZE(stw_pf_color_extended), TRUE);
|
ARRAY_SIZE(stw_pf_color_extended), TRUE);
|
||||||
|
|
||||||
assert( stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count );
|
assert(stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count);
|
||||||
assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS );
|
assert(stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint
|
uint
|
||||||
stw_pixelformat_get_count( void )
|
stw_pixelformat_get_count(void)
|
||||||
{
|
{
|
||||||
return stw_dev->pixelformat_count;
|
return stw_dev->pixelformat_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint
|
uint
|
||||||
stw_pixelformat_get_extended_count( void )
|
stw_pixelformat_get_extended_count(void)
|
||||||
{
|
{
|
||||||
return stw_dev->pixelformat_extended_count;
|
return stw_dev->pixelformat_extended_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct stw_pixelformat_info *
|
const struct stw_pixelformat_info *
|
||||||
stw_pixelformat_get_info( int iPixelFormat )
|
stw_pixelformat_get_info(int iPixelFormat)
|
||||||
{
|
{
|
||||||
unsigned index;
|
unsigned index;
|
||||||
|
|
||||||
@@ -339,11 +341,8 @@ stw_pixelformat_get_info( int iPixelFormat )
|
|||||||
|
|
||||||
|
|
||||||
LONG APIENTRY
|
LONG APIENTRY
|
||||||
DrvDescribePixelFormat(
|
DrvDescribePixelFormat(HDC hdc, INT iPixelFormat, ULONG cjpfd,
|
||||||
HDC hdc,
|
PIXELFORMATDESCRIPTOR *ppfd)
|
||||||
INT iPixelFormat,
|
|
||||||
ULONG cjpfd,
|
|
||||||
PIXELFORMATDESCRIPTOR *ppfd )
|
|
||||||
{
|
{
|
||||||
uint count;
|
uint count;
|
||||||
const struct stw_pixelformat_info *pfi;
|
const struct stw_pixelformat_info *pfi;
|
||||||
@@ -357,70 +356,61 @@ DrvDescribePixelFormat(
|
|||||||
|
|
||||||
if (ppfd == NULL)
|
if (ppfd == NULL)
|
||||||
return count;
|
return count;
|
||||||
if (cjpfd != sizeof( PIXELFORMATDESCRIPTOR ))
|
|
||||||
|
if (cjpfd != sizeof(PIXELFORMATDESCRIPTOR))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pfi = stw_pixelformat_get_info( iPixelFormat );
|
pfi = stw_pixelformat_get_info(iPixelFormat);
|
||||||
if (!pfi) {
|
if (!pfi) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(ppfd, &pfi->pfd, sizeof( PIXELFORMATDESCRIPTOR ));
|
memcpy(ppfd, &pfi->pfd, sizeof(PIXELFORMATDESCRIPTOR));
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
DrvDescribeLayerPlane(
|
DrvDescribeLayerPlane(HDC hdc, INT iPixelFormat, INT iLayerPlane,
|
||||||
HDC hdc,
|
UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd)
|
||||||
INT iPixelFormat,
|
|
||||||
INT iLayerPlane,
|
|
||||||
UINT nBytes,
|
|
||||||
LPLAYERPLANEDESCRIPTOR plpd )
|
|
||||||
{
|
{
|
||||||
assert(0);
|
assert(0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int APIENTRY
|
int APIENTRY
|
||||||
DrvGetLayerPaletteEntries(
|
DrvGetLayerPaletteEntries(HDC hdc, INT iLayerPlane, INT iStart,
|
||||||
HDC hdc,
|
INT cEntries, COLORREF *pcr)
|
||||||
INT iLayerPlane,
|
|
||||||
INT iStart,
|
|
||||||
INT cEntries,
|
|
||||||
COLORREF *pcr )
|
|
||||||
{
|
{
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int APIENTRY
|
int APIENTRY
|
||||||
DrvSetLayerPaletteEntries(
|
DrvSetLayerPaletteEntries(HDC hdc, INT iLayerPlane, INT iStart,
|
||||||
HDC hdc,
|
INT cEntries, CONST COLORREF *pcr)
|
||||||
INT iLayerPlane,
|
|
||||||
INT iStart,
|
|
||||||
INT cEntries,
|
|
||||||
CONST COLORREF *pcr )
|
|
||||||
{
|
{
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
DrvRealizeLayerPalette(
|
DrvRealizeLayerPalette(HDC hdc, INT iLayerPlane, BOOL bRealize)
|
||||||
HDC hdc,
|
|
||||||
INT iLayerPlane,
|
|
||||||
BOOL bRealize )
|
|
||||||
{
|
{
|
||||||
assert(0);
|
assert(0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Only used by the wgl code, but have it here to avoid exporting the
|
/* Only used by the wgl code, but have it here to avoid exporting the
|
||||||
* pixelformat.h functionality.
|
* pixelformat.h functionality.
|
||||||
*/
|
*/
|
||||||
int stw_pixelformat_choose( HDC hdc,
|
int
|
||||||
CONST PIXELFORMATDESCRIPTOR *ppfd )
|
stw_pixelformat_choose(HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd)
|
||||||
{
|
{
|
||||||
uint count;
|
uint count;
|
||||||
uint index;
|
uint index;
|
||||||
@@ -435,7 +425,7 @@ int stw_pixelformat_choose( HDC hdc,
|
|||||||
|
|
||||||
for (index = 1; index <= count; index++) {
|
for (index = 1; index <= count; index++) {
|
||||||
uint delta = 0;
|
uint delta = 0;
|
||||||
const struct stw_pixelformat_info *pfi = stw_pixelformat_get_info( index );
|
const struct stw_pixelformat_info *pfi = stw_pixelformat_get_info(index);
|
||||||
|
|
||||||
if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) &&
|
if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) &&
|
||||||
!!(ppfd->dwFlags & PFD_DOUBLEBUFFER) !=
|
!!(ppfd->dwFlags & PFD_DOUBLEBUFFER) !=
|
||||||
|
Reference in New Issue
Block a user