Is it possible to get the width and height of the current “fragment” in a pixel shader?
I’m writing a pixel shader that can draw rounded rectangles. My problem is I need the size of the rectangles in the shader in order to calculate the roundness of the corners properly.
I could of course create a global variable in the shader that I update with the size information for every rectangle I want to draw but that would mean I can’t combine the vertices of multiple rectangles and draw them all in one batch, right?
…or am I misunderstanding something? My understanding of the graphics pipeline is limited.
The original title of this thread was 'Getting the size of the current fragment?" now updated to reflect what I’m actually trying to achieve.