Found another bug

zeckensack

New member
Radeon32DDR, Win98SE, tried lots of drivers. Am I doing something stoopid? How's the 8500 crowd doing? Here's the whole shebang:

I've found a violation of the gl specs on the original Radeon:
The glClear(...) function performs a color buffer clear even when color writes are disabled with the appropriate call to glColorMask.
This contradicts section 4.2.3 of the glspec version 1.3. Quote:
"When Clear is called, the only per-fragment operations that are applied (if enabled) are the pixel ownership test, the scissor test, and dithering. The masking operations described in the
last section (4.2.2) are also effective."

My environment consists of a Radeon DDR 32MB AGP card, Windows98SE, ATI released driver set 4.13.9016. The used OpenGL driver reports version 1.3.2493. No other
cards/OSes were tested.

I've found the behaviour of glClear with respect to the scissor test and depth mask to be fine.

I've attached C source code for a small glut application that can demonstrate this. With the space bar, you can issue a glClear(GL_COLOR_BUFFER_BIT) on a masked off color buffer
- which should according to spec be without effect, but it isn't. For demonstration purposes, this app also sets up a scissor test, simply to show that this one works.

I hope you can iron this one out.

Code:
//Demonstrates a spec violation in handling glColorMask/glClear on the ATI Radeon (original)
//issue can be reproduced on Win98SE systems with the official driver set 4.13.9016
//reported GL version is 1.3.2493

//Make sure to link with glut

#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h>
#include <stdio.h>
#include <malloc.h>

bool init_done=false;
char description[64];

int clear_color=0;

void
init_gl_stuff()
{
	//clear the whole color buffer once
	glClearColor(0.0f,0.0f,0.0f,1.0f);
	glClear(GL_COLOR_BUFFER_BIT);
	//enable some arbitrary scissor rectangle
	//this merely demonstrates that glClear obeys the scissor test
	glScissor(100,100,440,280);
	glEnable(GL_SCISSOR_TEST);
}

void
display()
{
	if (!init_done)
	{
		init_gl_stuff();
		init_done=true;
	}
//note that color writes are invariantly masked off!
	glColorMask(0,0,0,0);
//this shouldn't do anything, but it does!
	glClear(GL_COLOR_BUFFER_BIT);
	glutSwapBuffers();
}

void
keyboard(unsigned char key,int x,int y)
{
	//check for spacebar
	if (key!=0x20) return;
	//toggle the clear color to make the clear operation visible
	if (clear_color==0)
	{
		glClearColor(0.5f,0.25f,0.0f,1.0f);
		clear_color=1;
	}
	else
	{
		glClearColor(0.0f,0.0f,0.5f,1.0f);
		clear_color=0;
	}
	//display again
	glutPostRedisplay();
}

int
main(int argc,char** argv)
{
	sprintf(description,"Press space to clear the 'masked off' color buffer");
	glutInit(&argc,argv);
	glutInitWindowSize(640,480);
	glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);
	glutCreateWindow(description);
	glutDisplayFunc(display);
	glutKeyboardFunc(keyboard);

	glutMainLoop();
	return(0);
}
 
Ok, just got my confirmation from ATI.

You'll need a driver based on 7.69 stream to see this working properly, the driver you currently have is 7.67 based.

Obviously, I don't have access to any later versions, the 'leaked' 9021 set still exhibits the issue.

I guess I'll just have to wait for more public driver releases and in the meantime keep doing a workaround. Whatever, I'm satisfied.
 
Back
Top