Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rasterizer state support #51

Closed
9 tasks done
kvark opened this issue Jul 2, 2014 · 3 comments
Closed
9 tasks done

Add Rasterizer state support #51

kvark opened this issue Jul 2, 2014 · 3 comments

Comments

@kvark
Copy link
Member

kvark commented Jul 2, 2014

Rasterizer state is (in this context) the configuration of fixed-function hardware functions (i.e. fragment shader is not a part of this state) that are responsible for bringing the output geometry to the framebuffer. It can include the following blocks (roughly in the order they are executed by HW):

  • Viewport (optionally - leave that to framebuffer to manage in Implement framebuffer binding and Surface creation #50)
  • Primitive setup (points/lines/triangles, face culling)
  • Polygon offset
  • Multisampling
  • Scissor
  • Stencil (test, mask)
  • Depth (test, mask)
  • Blending (equation)
  • Color mask

We could have them stored in one big descriptor (either passed with every draw call - heavy, immutably defined and represented by a handle), or split into groups:

  1. Rasterization (primitive, culling, offset, multisample)
  2. Mask (Scissor, stencil mask, depth mask, color mask)
  3. Depth-stencil (functions, params)
  4. Blending (equation, params)

The reason why I put masks into a separate group with scissor is because it's a subset of the only states that affect Clear function.

@kvark kvark added this to the Ready to Roll milestone Jul 2, 2014
@brendanzab brendanzab reopened this Jul 3, 2014
@kvark
Copy link
Member Author

kvark commented Jul 16, 2014

For the reference, D3D has the following state groups (listing only relevant ones):

  1. Rasterizer
    • Viewport
    • Scissor test
    • Primitive setup
    • Polygon offset
    • Multisampling
  2. Output Merger
    • Depth test
    • Stencil test & op
    • Blending
    • Color mask

When I thought about the rasterizer state as a whole, I was imagining what parameters transform feedback (aka stream-out in D3D) will not have comparing to a regular draw call. Apparently, we can't ignore the primitive setup when the rasterizer is off, because primitives are still constructed when the tessellation is ON, and this can be done with transform feedback.

Another thing is the clear operation. OpenGL clear still respects the scissor test as well as write masks for color, depth, and stencil, but nothing else. Perhaps, we can pass only the Scissor block to the clears, and only the Primitive block to transform feedbacks?

For the regular draw calls, both OM and Rasterizer are part of the fixed-function pipeline state. Both can not be derived automatically for the general case, hence to be provided. Is there much sense then to split the whole state into Rasterizer + OM? Instead, we can just have all the state blocks be a part of a larger structure.

@kvark kvark removed the ready label Jul 21, 2014
@kvark kvark self-assigned this Jul 27, 2014
@kvark
Copy link
Member Author

kvark commented Jul 27, 2014

Head's up - renaming 'rast' to 'state'

@kvark
Copy link
Member Author

kvark commented Jul 28, 2014

Multisampling is moved to #137, all other missing states are covered by #138.

@kvark kvark closed this as completed Jul 28, 2014
adamnemecek pushed a commit to adamnemecek/gfx that referenced this issue Apr 1, 2021
51: native: basic support for pipeine stages in barriers r=grovesNL a=kvark

It's a naive approach focused on solving the Vulkan validation errors :)

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants