2004-10-25 22:09:16 +01:00
|
|
|
/*
|
Update to SGI FreeB 2.0.
Under the terms of version 1.1, "once Covered Code has been published
under a particular version of the License, Recipient may, for the
duration of the License, continue to use it under the terms of that
version, or choose to use such Covered Code under the terms of any
subsequent version published by SGI."
FreeB 2.0 license refers to "dates of first publication". They are here
taken to be 1991-2000, as noted in the original license text:
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
Official FreeB 2.0 text:
http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf
As always, this code has not been tested for conformance with the OpenGL
specification. OpenGL conformance testing is available from
http://khronos.org/ and is required for use of the OpenGL logo in
product advertising and promotion.
2008-09-19 22:16:53 +01:00
|
|
|
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
|
|
|
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
|
|
|
*
|
2022-12-14 18:27:16 +00:00
|
|
|
* SPDX-License-Identifier: SGI-B-2.0
|
Update to SGI FreeB 2.0.
Under the terms of version 1.1, "once Covered Code has been published
under a particular version of the License, Recipient may, for the
duration of the License, continue to use it under the terms of that
version, or choose to use such Covered Code under the terms of any
subsequent version published by SGI."
FreeB 2.0 license refers to "dates of first publication". They are here
taken to be 1991-2000, as noted in the original license text:
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
Official FreeB 2.0 text:
http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf
As always, this code has not been tested for conformance with the OpenGL
specification. OpenGL conformance testing is available from
http://khronos.org/ and is required for use of the OpenGL logo in
product advertising and promotion.
2008-09-19 22:16:53 +01:00
|
|
|
*/
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
#include "glxclient.h"
|
2004-12-01 08:02:50 +00:00
|
|
|
#include "indirect.h"
|
2005-02-22 22:36:31 +00:00
|
|
|
#include "indirect_vertex_array.h"
|
2004-10-25 22:09:16 +01:00
|
|
|
|
Fix build of appleglx
Define GLX_USE_APPLEGL, as config/darwin used to, to turn on specific code to
use the applegl direct renderer
Convert src/glx/apple/Makefile to automake
Since the applegl libGL is now built by linking libappleglx into libGL, rather
than by linking selected files into a special libGL:
- Remove duplicate code in apple/glxreply.c and apple/apple_glx.c. This makes
apple/glxreply.c empty, so remove it
- Some indirect rendering code is already guarded by !GLX_USE_APPLEGL, but we
need to add those guards to indirect_glx.c, indirect_init.c (via it's
generator), render2.c and vertarr.c so they don't generate anything
Fix and update various includes
glapi_gentable.c (which is only used on darwin), should be included in shared
glapi as well, to provide _glapi_create_table_from_handle()
Note that neither swrast nor indirect is supported in the APPLEGL path at the
moment, which makes things more complex than they need to be. More untangling
is needed to allow that
v2: Correct apple/Makefile.am for srcdir != builddir
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-05-12 10:47:07 +01:00
|
|
|
#ifndef GLX_USE_APPLEGL
|
2004-10-25 22:09:16 +01:00
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2004-12-01 08:15:01 +00:00
|
|
|
/**
|
|
|
|
* \name Vertex array pointer bridge functions
|
|
|
|
*
|
|
|
|
* When EXT_vertex_array was moved into the core GL spec, the \c count
|
|
|
|
* parameter was lost. This libGL really only wants to implement the GL 1.1
|
|
|
|
* version, but we need to support applications that were written to the old
|
|
|
|
* interface. These bridge functions are part of the glue that makes this
|
|
|
|
* happen.
|
|
|
|
*/
|
|
|
|
/*@{*/
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride,
|
|
|
|
GLsizei count, const GLvoid * pointer)
|
2004-12-01 08:15:01 +00:00
|
|
|
{
|
2008-10-13 13:41:33 +01:00
|
|
|
(void) count;
|
|
|
|
__indirect_glColorPointer(size, type, stride, pointer);
|
2004-12-01 08:15:01 +00:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glEdgeFlagPointerEXT(GLsizei stride,
|
|
|
|
GLsizei count, const GLboolean * pointer)
|
2004-12-01 08:15:01 +00:00
|
|
|
{
|
2008-10-13 13:41:33 +01:00
|
|
|
(void) count;
|
|
|
|
__indirect_glEdgeFlagPointer(stride, pointer);
|
2004-12-01 08:15:01 +00:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glIndexPointerEXT(GLenum type, GLsizei stride,
|
|
|
|
GLsizei count, const GLvoid * pointer)
|
2004-12-01 08:15:01 +00:00
|
|
|
{
|
2008-10-13 13:41:33 +01:00
|
|
|
(void) count;
|
|
|
|
__indirect_glIndexPointer(type, stride, pointer);
|
2004-12-01 08:15:01 +00:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
|
|
|
|
const GLvoid * pointer)
|
2004-12-01 08:15:01 +00:00
|
|
|
{
|
2008-10-13 13:41:33 +01:00
|
|
|
(void) count;
|
|
|
|
__indirect_glNormalPointer(type, stride, pointer);
|
2004-12-01 08:15:01 +00:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
|
|
|
|
GLsizei count, const GLvoid * pointer)
|
2004-12-01 08:15:01 +00:00
|
|
|
{
|
2008-10-13 13:41:33 +01:00
|
|
|
(void) count;
|
|
|
|
__indirect_glTexCoordPointer(size, type, stride, pointer);
|
2004-12-01 08:15:01 +00:00
|
|
|
}
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride,
|
|
|
|
GLsizei count, const GLvoid * pointer)
|
2004-12-01 08:15:01 +00:00
|
|
|
{
|
2008-10-13 13:41:33 +01:00
|
|
|
(void) count;
|
|
|
|
__indirect_glVertexPointer(size, type, stride, pointer);
|
2004-12-01 08:15:01 +00:00
|
|
|
}
|
2008-10-13 13:41:33 +01:00
|
|
|
|
2004-12-01 08:15:01 +00:00
|
|
|
/*@}*/
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
void
|
|
|
|
__indirect_glInterleavedArrays(GLenum format, GLsizei stride,
|
|
|
|
const GLvoid * pointer)
|
2004-10-25 22:09:16 +01:00
|
|
|
{
|
2010-07-28 16:16:00 +01:00
|
|
|
struct glx_context *gc = __glXGetCurrentContext();
|
2008-10-13 13:41:33 +01:00
|
|
|
__GLXattribute *state = (__GLXattribute *) (gc->client_state_private);
|
2005-11-30 00:06:48 +00:00
|
|
|
|
|
|
|
#define NONE {0, 0, 0}
|
|
|
|
#define F(x) {GL_FLOAT, x, x * sizeof(GLfloat)}
|
|
|
|
#define UB4 {GL_UNSIGNED_BYTE, 4, 4 * sizeof(GLubyte)}
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
/* Each row in this array describes the elements of a particular
|
|
|
|
* interleaved array mode. Each column describes, in the order in which
|
|
|
|
* they appear in the interleaved arrays, one of the four possible types
|
|
|
|
* of vertex data that can appear in an interleaved array.
|
|
|
|
*/
|
|
|
|
struct
|
|
|
|
{
|
2005-11-30 00:06:48 +00:00
|
|
|
/**
|
|
|
|
* The enum describing the GL type, as would be passed to the
|
|
|
|
* appropriate gl*Pointer function.
|
|
|
|
*/
|
2008-10-13 13:41:33 +01:00
|
|
|
GLushort type;
|
2005-11-30 00:06:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Number of elements in the subarray, as would be passed (as the
|
|
|
|
* \c size parameter) to the appropriate gl*Pointer function.
|
|
|
|
*/
|
2008-10-13 13:41:33 +01:00
|
|
|
GLubyte count;
|
|
|
|
|
2005-11-30 00:06:48 +00:00
|
|
|
/**
|
|
|
|
* True size of a single element in the subarray, as would be passed
|
|
|
|
* (as the \c stride parameter) to the appropriate gl*Pointer
|
|
|
|
* function.
|
|
|
|
*/
|
2008-10-13 13:41:33 +01:00
|
|
|
GLubyte size;
|
|
|
|
}
|
|
|
|
static const modes[14][4] = {
|
2005-11-30 00:06:48 +00:00
|
|
|
/* texture color normal vertex */
|
2008-10-13 13:41:33 +01:00
|
|
|
{NONE, NONE, NONE, F(2)}, /* GL_V2F */
|
|
|
|
{NONE, NONE, NONE, F(3)}, /* GL_V3F */
|
|
|
|
{NONE, UB4, NONE, F(2)}, /* GL_C4UB_V2F */
|
|
|
|
{NONE, UB4, NONE, F(3)}, /* GL_C4UB_V3F */
|
|
|
|
{NONE, F(3), NONE, F(3)}, /* GL_C3F_V3F */
|
|
|
|
{NONE, NONE, F(3), F(3)}, /* GL_N3F_V3F */
|
|
|
|
{NONE, F(4), F(3), F(3)}, /* GL_C4F_N3F_V3F */
|
|
|
|
{F(2), NONE, NONE, F(3)}, /* GL_T2F_V3F */
|
|
|
|
{F(4), NONE, NONE, F(4)}, /* GL_T4F_V4F */
|
|
|
|
{F(2), UB4, NONE, F(3)}, /* GL_T2F_C4UB_V3F */
|
|
|
|
{F(2), F(3), NONE, F(3)}, /* GL_T2F_C3F_V3F */
|
|
|
|
{F(2), NONE, F(3), F(3)}, /* GL_T2F_N3F_V3F */
|
|
|
|
{F(2), F(4), F(3), F(3)}, /* GL_T2F_C4F_N3F_V3F */
|
|
|
|
{F(4), F(4), F(3), F(4)}, /* GL_T4F_C4F_N3F_V4F */
|
|
|
|
};
|
2005-11-30 00:06:48 +00:00
|
|
|
#undef NONE
|
|
|
|
#undef F
|
|
|
|
#undef UB4
|
|
|
|
|
2008-10-13 13:41:33 +01:00
|
|
|
GLint trueStride, size;
|
|
|
|
int offsets[4];
|
|
|
|
unsigned i;
|
|
|
|
const int idx = format - GL_V2F;
|
|
|
|
|
|
|
|
|
|
|
|
/* All valid formats are on the range [GL_V2F, GL_V2F+0x0D]. Since idx
|
|
|
|
* is just the format biased by -GL_V2F, all valid idx values are on the
|
|
|
|
* range [0, 0x0D].
|
|
|
|
*/
|
|
|
|
if ((idx < 0) || (idx > 0x0D)) {
|
|
|
|
__glXSetError(gc, GL_INVALID_ENUM);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stride < 0) {
|
|
|
|
__glXSetError(gc, GL_INVALID_VALUE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* If the 'count' for a subarray is non-zero, then the offset of its
|
|
|
|
* first element is at the currently accumulated 'size'.
|
|
|
|
*/
|
|
|
|
size = 0;
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
offsets[i] = (modes[idx][i].count != 0) ? size : -1;
|
|
|
|
size += modes[idx][i].size;
|
|
|
|
}
|
|
|
|
|
|
|
|
trueStride = (stride == 0) ? size : stride;
|
|
|
|
|
|
|
|
__glXArrayDisableAll(state);
|
|
|
|
|
|
|
|
if (offsets[0] >= 0) {
|
|
|
|
__indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
|
|
__indirect_glTexCoordPointer(modes[idx][0].count, GL_FLOAT,
|
|
|
|
trueStride, (const char *) pointer);
|
|
|
|
}
|
|
|
|
if (offsets[1] >= 0) {
|
|
|
|
__indirect_glEnableClientState(GL_COLOR_ARRAY);
|
|
|
|
__indirect_glColorPointer(modes[idx][1].count, modes[idx][1].type,
|
|
|
|
trueStride,
|
|
|
|
(const char *) pointer + offsets[1]);
|
|
|
|
}
|
|
|
|
if (offsets[2] >= 0) {
|
|
|
|
__indirect_glEnableClientState(GL_NORMAL_ARRAY);
|
|
|
|
__indirect_glNormalPointer(GL_FLOAT, trueStride,
|
|
|
|
(const char *) pointer + offsets[2]);
|
|
|
|
}
|
|
|
|
__indirect_glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
__indirect_glVertexPointer(modes[idx][3].count, GL_FLOAT,
|
|
|
|
trueStride,
|
|
|
|
(const char *) pointer + offsets[3]);
|
2004-10-25 22:09:16 +01:00
|
|
|
}
|
Fix build of appleglx
Define GLX_USE_APPLEGL, as config/darwin used to, to turn on specific code to
use the applegl direct renderer
Convert src/glx/apple/Makefile to automake
Since the applegl libGL is now built by linking libappleglx into libGL, rather
than by linking selected files into a special libGL:
- Remove duplicate code in apple/glxreply.c and apple/apple_glx.c. This makes
apple/glxreply.c empty, so remove it
- Some indirect rendering code is already guarded by !GLX_USE_APPLEGL, but we
need to add those guards to indirect_glx.c, indirect_init.c (via it's
generator), render2.c and vertarr.c so they don't generate anything
Fix and update various includes
glapi_gentable.c (which is only used on darwin), should be included in shared
glapi as well, to provide _glapi_create_table_from_handle()
Note that neither swrast nor indirect is supported in the APPLEGL path at the
moment, which makes things more complex than they need to be. More untangling
is needed to allow that
v2: Correct apple/Makefile.am for srcdir != builddir
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-05-12 10:47:07 +01:00
|
|
|
|
|
|
|
#endif
|