Culling the glitches away

Truecolor ZDoom with extra features and some unofficial/beta GZDoom features.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Libs (Win)] [Repo] [Bugs&Suggestions]

Moderators: Rachael, dpJudas

User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

If it caches it, that's enough for me, I really prefer it that way as I've said before. But it's really up to you.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

Well, it works. And its pretty low priority for me to improve it. To be perfectly honest, LLVM's stability as a library isn't as good as I had hoped. They do a lot of stuff that a library shouldn't really be doing, which means that sooner or later their hacks are going to explode in the face of anyone not using it exactly as they do themselves. I don't want that to be me. They use it as a clang.exe that boots, compiles something, outputs it and exits. At some point I'm going to do the same. :)
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

I understand.

I haven't noticed a huge performance difference between haswell and core2 codegen, assuming those targets are generations apart. But if the codegen must be taken out of the executable, I would rather it recompile every time if something changes rather than having to specify it. :)
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

I think core2 is pretty old - it only supports SSE 3. I was only planning on having four steps: sse2, sse4.1, avx and avx-2. Some of them might even perform identically.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

I've started working on manipulating the sprite code, just letting you know, but it might be some time before I figure everything out. It's a new system so I'm taking it in chunks at a time rather than all at once.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

That's okay - take your time. :)
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

Could you give some examples on how to work this system? I can't get it to change the alpha values, for example, and this produces a high-contrast result that I am unable to change:

Code: Select all

	if (thing->RenderStyle == LegacyRenderStyles[STYLE_Normal])
	{
		(args.translation) ?
			PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::TranslateAlphaBlend) :
			PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::AlphaBlend);
	}
	else
	{
		uniforms.srcalpha = (uint32_t)(1.0 * 256);
		uniforms.destalpha = (uint32_t)(thing->Alpha * 256);
		(args.translation) ?
			PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::TranslateAdd) :
			PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::Add);
	}
... and yes, I know the if statement is a bit simplistic, there is more to add to it later, I was just trying to get *any* transparency working. ;)


EDIT: Nevermind - I put args.uniforms in front of it and it worked. :P
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

It is probably best to change the code so that it always changes args.uniforms directly instead of first creating a TriUniforms object. There isn't really a good reason why I'm doing it the way I'm doing it today.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

If you need to change anything, maybe it's best to push the work in progress I have now so there will be no conflicts later on?

Also, I am not able to activate Fuzz or Stencil blend modes - have they been implemented?
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

Fuzz is currently not implemented (it effectively just means Fill right now). It is a bit problematic to do with multithreading.

Stencil doesn't output anything on the screen - it just marks things in the stencil buffer. It is used to mark which areas have already been drawn when doing the opaque pass.

Edit: forgot to say that I'm not changing this uniform stuff right now - just that if you feel its easier to get rid of "TriUniforms uniforms;" and just call args.uniforms.xx instead then feel free to make such a change.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

I think you and I are talking about different stencils. You like your blues pinky, right? ;)

In ZDoom it's simply an object that is rendered as a single color.

For now, for fuzz, I just copy-pasted the Shadow render mode.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

Oh you mean THAT kind of stencil. That translates to a fill color, I think. So Fill, FillAdd, FillSub, etc., with the bgra color in args.uniforms.color. Or maybe it's the Shaded mode, or AddSolid.
User avatar
Rachael
Developer
Developer
Posts: 3639
Joined: Sat May 13, 2006 10:30

Re: Culling the glitches away

Post by Rachael »

Yeah I am not seeing those in my handy dandy list.

This is what I am working from:

Code: Select all

src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::Copy:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::AlphaBlend:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::AddSolid:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::Add:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::Sub:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::RevSub:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::Shaded:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::TranslateCopy:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::TranslateAlphaBlend:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::TranslateAdd:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::TranslateSub:
src/r_compiler/fixedfunction/drawtrianglecodegen.cpp:   case TriBlendMode::TranslateRevSub:



src/thingdef/thingdef_properties.cpp:           STYLE_None, STYLE_Normal, STYLE_Fuzzy, STYLE_SoulTrans, STYLE_OptFuzzy,
src/thingdef/thingdef_properties.cpp:                   STYLE_TranslucentStencil, STYLE_Translucent, STYLE_Add, STYLE_Shaded,
src/thingdef/thingdef_properties.cpp:                   STYLE_Shadow, STYLE_Subtract, STYLE_AddStencil, STYLE_AddShaded};
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

Note sure how much this helps, but the old column drawers mapped as follows:

R_DrawColumn - TriBlendMode::AlphaBlend
R_DrawAddColumn - TriBlendMode::Add
R_DrawTranslatedColumn- TriBlendMode::TranslateCopy
R_DrawTlatedAddColumn - TriBlendMode::TranslateAdd
R_DrawShadedColumn - TriBlendMode::Shaded
R_DrawAddClampColumn - TriBlendMode::Add
R_DrawAddClampTranslatedColumn - TriBlendMode::TranslateAdd
R_DrawSubClampColumn - TriBlendMode::Sub
R_DrawSubClampTranslatedColumn - TriBlendMode::TranslateSub
R_DrawRevSubClampColumn - TriBlendMode::RevSub
R_DrawRevSubClampTranslatedColumn - TriBlendMode::TranslateRevSub
R_FillColumn - TriBlendMode::Copy w/FillSubsector
R_FillAddColumn - TriBlendMode::Add w/FillSubsector
R_FillAddClampColumn - TriBlendMode::Add w/FillSubsector
R_FillSubClampColumn - TriBlendMode::TranslateSub w/FillSubsector
R_FillRevSubClampColumn - TriBlendMode::RevSub w/FillSubsector

The logic deciding which to use was done by R_SetBlendFunc where it picks one and assigns it to colfunc. I.e. "flags & STYLEF_ColorIsFixed" makes it pick R_FillAddClampColumn -> TriBlendMode::Add w/FillSubsector.
dpJudas
Developer
Developer
Posts: 798
Joined: Sat Jul 23, 2016 7:53

Re: Culling the glitches away

Post by dpJudas »

Hmm, thinking about it a bit it might be that the "fill" versions needs to check the span/alpha of the texture for this to work. It doesn't do that now. If you can get them to just fill a box I'll take over and fix the drawer itself. :)
Locked

Return to “QZDoom”