got a scaling window going, yay
-
took a bit of doing but now i have a single header library where i can customize my triangle fill routine for different vertex attributes. in debug mode it uses a single triFill function with function pointers so there's no weirdness going on, and when optimized it includes the triFill function multiple times with different names and calls the helper functions directly by name so they get inlined*
*i checked the assembly to make sure
this is what the implementation for a vertex format looks like
InitGrads converts from the data to float (it's already float here),
GetPixel is the fragment shader
the TRI_STEP_COLOR_GRADS functions are there so i can use a compile time constant for the gradient loops so they get unrolled
and the rest is just injecting the triFill routine (if necessary) and creating a wrapper that calls it or the generic triFill with function pointers
not the prettiest but its C so it could be a lot worse
-
debug rendering tiles that are skipped because they're known to be blank
@eniko amogus
-
this is what the implementation for a vertex format looks like
InitGrads converts from the data to float (it's already float here),
GetPixel is the fragment shader
the TRI_STEP_COLOR_GRADS functions are there so i can use a compile time constant for the gradient loops so they get unrolled
and the rest is just injecting the triFill routine (if necessary) and creating a wrapper that calls it or the generic triFill with function pointers
not the prettiest but its C so it could be a lot worse
tfw the nested 8 count loops unroll perfectly 😌
-
tfw the nested 8 count loops unroll perfectly 😌
@eniko I can see the clean code take on this now. ZOMG, that should be a function call!