Problems: ColorWriteEnable in DirectX

A3dd48e1deb889dd2b4d5e129550e9fd
0
Hyde 101 Mar 05, 2006 at 08:48

Has anyone tried to use the ColorWriteEnable renderstate for masking rendering, say, only to the Alpha component or something similar?

I have. And setting this renderstate to something different than the standard 0x0f mask doesn’t seem to have any effect, i.e. all the four channels are overwritten regardless of the writemask.

To use this renderstate, one must of course check the Caps to see if the gfxcard supports masking and mine is supposed to do that.

So, I was wondering if anyone had tried this and succeeded/failed in their attempt. Is there some trick to make it work or may there be some bug in my driver?

I’m rendering with a radeon9800pro.

10 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Mar 05, 2006 at 09:18

This isn’t an answer to your precise question, but in OpenGL the equivalent facility is glColorMask and I know it works properly on at least a Radeon 9600 card.

A3dd48e1deb889dd2b4d5e129550e9fd
0
Hyde 101 Mar 05, 2006 at 11:25

Reedbeta: Then the caps shouldn’t be lying, good to know.

The documentation is quite clear on this point, so I suspect a driver bug. I encountered trouble with this renderstate a year ago. Then I did some testing and found that I could use the mask so I could write to the R, G and B respectively but the Alphaonly option failed. I have updated my drivers since then, and was suprised to find out that now I could not get any write mask to work.. sigh.

Unless nobody has the same experience! Then surely I must examine my code again ;)

46462f88a1670d7e9cbbfa360aa20134
0
juhnu 101 Mar 05, 2006 at 13:50

Yeah I think you have some problem in your code as the Radeon9xxx series definitely supports that. `Some old cards such as TNT2 don’t have support for it, but I think almost anything newer has.

A3dd48e1deb889dd2b4d5e129550e9fd
0
Hyde 101 Mar 05, 2006 at 15:27

juhnu: Yes, but have you actually tried this?

I mean, surely, I can not be the only one trying to use this feature in dx with radeon?

Ok, luckily I am only trying to write the A-channel, leaving RGB as they are. Hence I can use the following config:


AlphaBlendEnable = true ;
SEPARATEALPHABLENDENABLE = true ;
SrcBlend = zero ;
DestBlend = one ;
SrcBlendAlpha = one ;
DestBlendAlpha = zero ;
..

Instead of my first attempt which should have the same effect:


COLORWRITEENABLE = ALPHA ;

So problem avoided for this time. But somewhat unsatisfactory, I think.

Still interested in hearing about your experiences with this renderstate, though.

C4b4ac681e11772d2e07ed9a84cffe3f
0
kusma 101 Mar 05, 2006 at 21:32

I’m using colorwriteenable quite heavily in a vj-set i’m working on right now. the stuff is supposed to run off my laptop with a r9600 mobility, and it works like a charm. I don’t use alpha in the rendertargets at all, though.

46462f88a1670d7e9cbbfa360aa20134
0
juhnu 101 Mar 06, 2006 at 01:04

@Hyde

juhnu: Yes, but have you actually tried this?

Yeah we are taking extensive use of the color masking and haven’t encountered any problems with the chipset you mentioned.

6673a7d3bfd3d1db5e05c5676cc040b6
0
Goz 101 Mar 06, 2006 at 10:16

Easiest way to find out if its a driver bug is to run using the reference rasteriser. If it works perfectly its a driver issue if it doesn’t then the issue is with you.

A3dd48e1deb889dd2b4d5e129550e9fd
0
Hyde 101 Mar 09, 2006 at 20:39

Goz: My code works perfectly with the REF device.

All: Thanks for sharing your experiences. I’ll see if there is any newer driver available, but I am not optimistic. Afterwards, I’ll give up. Thanks for input.

A3dd48e1deb889dd2b4d5e129550e9fd
0
Hyde 101 Mar 09, 2006 at 21:03

updated drivers, no change.

46462f88a1670d7e9cbbfa360aa20134
0
juhnu 101 Mar 13, 2006 at 04:25

Maybe something wrong with your card. I don’t think this is a driver version issue.