back to using the shared template files.
GLuint VIA_DEBUG = 0;
#endif
#define DMA_SIZE 2
-GLuint VIA_PERFORMANCE = 0;
-#ifdef PERFORMANCE_MEASURE
-GLuint busy = 0;
-GLuint idle = 0;
-hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH];
-#endif
+
/*=* John Sheng [2003.5.31] agp tex *=*/
static GLboolean
FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
-#ifdef PERFORMANCE_MEASURE
- if (getenv("VIA_PERFORMANCE"))
- VIA_PERFORMANCE = 1;
- else
- VIA_PERFORMANCE = 0;
-
- {
- int i, j;
- for (i = 0; i < HASH_TABLE_SIZE; i++) {
- for (j = 0; j < HASH_TABLE_DEPTH; j ++) {
- hash_table[i][j].count = 0;
- sprintf(hash_table[i][j].func, "%s", "NULL");
- }
- }
- }
-#endif
/* I don't understand why this isn't working:
*/
FREE(vmesa);
}
- P_M_R;
-
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) fprintf(stderr, "idle = %d\n", idle);
- if (VIA_PERFORMANCE) fprintf(stderr, "busy = %d\n", busy);
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
};
/*#define DMA_OFFSET 16*/
#define DMA_OFFSET 32
-/*#define PERFORMANCE_MEASURE*/
-extern GLuint VIA_PERFORMANCE;
-
-#ifdef PERFORMANCE_MEASURE
-#define HASH_TABLE_SIZE 1000
-#define HASH_TABLE_DEPTH 10
-typedef struct {
- char func[50];
- GLuint count;
-} hash_element;
-extern hash_element hash_table[HASH_TABLE_SIZE][HASH_TABLE_DEPTH];
-#define P_M \
- do { \
- GLuint h_index,h_depth; \
- h_index = (GLuint)(((GLuint) __FUNCTION__)%HASH_TABLE_SIZE); \
- for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \
- if (!strcmp(hash_table[h_index][h_depth].func, "NULL")) { \
- sprintf(hash_table[h_index][h_depth].func, "%s", __FUNCTION__); \
- hash_table[h_index][h_depth].count++; \
- break; \
- } \
- else if (!strcmp(hash_table[h_index][h_depth].func, __FUNCTION__)) { \
- hash_table[h_index][h_depth].count++; \
- break; \
- } \
- } \
- } while (0)
-
-#define P_M_X \
- do { \
- GLuint h_index,h_depth; \
- char str[80]; \
- strcpy(str, __FUNCTION__); \
- h_index = (GLuint)(((GLuint) __FUNCTION__)%HASH_TABLE_SIZE); \
- for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \
- if (!strcmp(hash_table[h_index][h_depth].func, "NULL")) { \
- sprintf(hash_table[h_index][h_depth].func, "%s_X", __FUNCTION__); \
- hash_table[h_index][h_depth].count++; \
- break; \
- } \
- else if (!strcmp(hash_table[h_index][h_depth].func, strcat(str, "_X"))) { \
- hash_table[h_index][h_depth].count++; \
- break; \
- } \
- } \
- } while (0)
-
-#define P_M_R \
- do { \
- GLuint h_size, h_depth; \
- for (h_size = 0; h_size < HASH_TABLE_SIZE; h_size++) { \
- for (h_depth = 0; h_depth < HASH_TABLE_DEPTH; h_depth++) { \
- if (hash_table[h_size][h_depth].count) { \
- fprintf(stderr, "func:%s count:%d\n", hash_table[h_size][h_depth].func, hash_table[h_size][h_depth].count); \
- } \
- } \
- } \
- } while (0)
-#else /* PERFORMANCE_MEASURE */
-#define P_M {}
-#define P_M_X {}
-#define P_M_R {}
-#endif
#define VIA_CONTEXT(ctx) ((viaContextPtr)(ctx->DriverCtx))
LOCAL_VARS(3);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
v[0] = (VERTEX *)GET_VERTEX(e0);
v[1] = (VERTEX *)GET_VERTEX(e1);
GLuint facing;
LOCAL_VARS(4);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
v[0] = (VERTEX *)GET_VERTEX(e0);
v[1] = (VERTEX *)GET_VERTEX(e1);
v[2] = (VERTEX *)GET_VERTEX(e2);
GLuint e1, GLuint e2, GLuint e3)
{
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
if (DO_UNFILLED) {
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLubyte ef1 = VB->EdgeFlag[e1];
VERTEX *v[2];
LOCAL_VARS(2);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
v[0] = (VERTEX *)GET_VERTEX(e0);
v[1] = (VERTEX *)GET_VERTEX(e1);
int i;
LOCAL_VARS(1);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
if (VB->Elts == 0) {
for (i = first; i < last; i++) {
if (VB->ClipMask[i] == 0) {
GLuint count,
GLuint flags)
{
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_POINTS) {
LOCAL_VARS;
GLuint count,
GLuint flags)
{
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_LINES) {
LOCAL_VARS;
GLuint count,
GLuint flags)
{
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_LINE_STRIPS) {
LOCAL_VARS;
GLuint count,
GLuint flags)
{
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_LINE_STRIPS) {
LOCAL_VARS;
int currentsz = (GET_CURRENT_VB_MAX_VERTS() / 3) * 3;
GLuint j, nr;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
INIT(GL_TRIANGLES);
/* Emit whole number of tris in total. dmasz is already a multiple
GLuint count,
GLuint flags)
{
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_TRI_STRIPS) {
LOCAL_VARS;
GLuint flags)
{
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (HAVE_TRI_FANS) {
LOCAL_VARS;
GLuint j, nr;
GLuint count,
GLuint flags)
{
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_POLYGONS) {
LOCAL_VARS;
GLuint flags)
{
GLuint j, nr;
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (VIA_DEBUG) fprintf(stderr, "%s in\n", __FUNCTION__);
if (HAVE_QUAD_STRIPS) {
LOCAL_VARS;
GLuint flags)
{
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M_X;
-#endif
if (HAVE_QUADS) {
LOCAL_VARS;
int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS() / 4) * 4;
/* Don't handle clipping or indexed vertices.
*/
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
-
if (VB->ClipOrMask || vmesa->renderIndex != 0 || VB->Elts) {
if (VIA_DEBUG) {
fprintf(stderr, "slow path\n");
GLuint last = count-2;
GLuint j;
(void)flags;
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
tnl->Driver.Render.PrimitiveNotify(ctx, GL_TRIANGLES);
for (j = start; j < last; j += 3) {
GLuint pass = 0;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
tnl->Driver.Render.Start(ctx);
tnl->Driver.Render.BuildVertices(ctx, 0, VB->Count, newInputs);
if (VB->ClipOrMask) {
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
COPY_DWORDS(j, vb, vertsize, v2);
GLuint *vb = viaCheckDma(vmesa, 6 * 4 * vertsize);
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
COPY_DWORDS(j, vb, vertsize, v3);
GLuint *vb = viaCheckDma(vmesa, 4 * vertsize);
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
COPY_DWORDS(j, vb, vertsize, v0);
vmesa->dmaLow += 4 * vertsize;
vmesa->primitiveRendered = GL_TRUE;
GLuint *vb = viaCheckDma(vmesa, 2 * 4 * vertsize);
int j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
COPY_DWORDS(j, vb, vertsize, v0);
COPY_DWORDS(j, vb, vertsize, v1);
vmesa->dmaLow += 2 * 4 * vertsize;
{
GLcontext *ctx = vmesa->glCtx;
SWvertex v[3];
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
via_translate_vertex(ctx, v0, &v[0]);
via_translate_vertex(ctx, v1, &v[1]);
via_translate_vertex(ctx, v2, &v[2]);
{
GLcontext *ctx = vmesa->glCtx;
SWvertex v[2];
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
via_translate_vertex(ctx, v0, &v[0]);
via_translate_vertex(ctx, v1, &v[1]);
_swrast_Line(ctx, &v[0], &v[1]);
{
GLcontext *ctx = vmesa->glCtx;
SWvertex v[1];
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
via_translate_vertex(ctx, v0, &v[0]);
_swrast_Point(ctx, &v[0]);
}
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
/* Render the new vertices as an unclipped polygon.
*/
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
vmesa->primitiveRendered = GL_TRUE;
tnl->Driver.Render.Line(ctx, ii, jj);
GLuint *temp2;
int i,j;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
vmesa->primitiveRendered = GL_TRUE;
for (i = 2; i < n; i++) {
GLuint i = 0;
GLuint j = 0;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
*vb++ = HC_HEADER2;
*vb++ = (HC_ParaType_NotTex << 16);
volatile GLuint *pnEngBase = (volatile GLuint *)((GLuint)pnMMIOBase + 0x400);
int nStatus = *pnEngBase;
if (((nStatus & 0xFFFEFFFF) == 0x00020000)) {
-#ifdef PERFORMANCE_MEASURE
- idle++;
-#endif
viaFlushPrims(vmesa);
}
-#ifdef PERFORMANCE_MEASURE
- else {
- busy++;
- }
-#endif
}
if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
GLfloat (*coord)[4] = VB->ClipPtr->data;
GLuint ii = i, jj = j, p;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
VB->LastClipped = VB->Count;
if (mask & 0x3f) {
GLubyte *clipmask = VB->ClipMask;
GLuint n = 3;
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
ASSIGN_3V(inlist, v2, v0, v1); /* pv rotated to slot zero */
VB->LastClipped = VB->Count;
GLubyte *clipmask = VB->ClipMask;
GLuint n = 4;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
ASSIGN_4V(inlist, v3, v0, v1, v2); /* pv rotated to slot zero */
VB->LastClipped = VB->Count;
{
LOCAL_VARS;
(void)flags;
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
RESET_OCCLUSION;
INIT(GL_POINTS);
LOCAL_VARS;
(void)flags;
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
RESET_OCCLUSION;
INIT(GL_LINES);
for (j = start + 1; j < count; j += 2) {
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
RESET_OCCLUSION;
INIT(GL_LINES);
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
RESET_OCCLUSION;
INIT(GL_LINES);
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 2; j < count; j += 3) {
GLuint parity = 0;
LOCAL_VARS;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 2; j < count; j++) {
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 3; j < count; j += 4) {
LOCAL_VARS;
(void)flags;
if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-#ifdef PERFORMANCE_MEASURE
- if (VIA_PERFORMANCE) P_M;
-#endif
INIT(GL_TRIANGLES);
if (NEED_EDGEFLAG_SETUP) {
for (j = start + 3; j < count; j += 2) {