mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 18:24:13 +08:00
anv: move genX(rasterization_mode) to gfx8_cmd_buffer.c
Only used there. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24632>
This commit is contained in:
parent
705840d417
commit
7cc2f23d53
@ -179,13 +179,6 @@ void genX(batch_emit_dummy_post_sync_op)(struct anv_batch *batch,
|
||||
uint32_t primitive_topology,
|
||||
uint32_t vertex_count);
|
||||
|
||||
void
|
||||
genX(rasterization_mode)(VkPolygonMode raster_mode,
|
||||
VkLineRasterizationModeEXT line_mode,
|
||||
float line_width,
|
||||
uint32_t *api_mode,
|
||||
bool *msaa_rasterization_enable);
|
||||
|
||||
VkPolygonMode
|
||||
genX(raster_polygon_mode)(struct anv_graphics_pipeline *pipeline,
|
||||
VkPolygonMode polygon_mode,
|
||||
|
@ -691,55 +691,6 @@ const uint32_t genX(vk_to_intel_front_face)[] = {
|
||||
[VK_FRONT_FACE_CLOCKWISE] = 0
|
||||
};
|
||||
|
||||
void
|
||||
genX(rasterization_mode)(VkPolygonMode raster_mode,
|
||||
VkLineRasterizationModeEXT line_mode,
|
||||
float line_width,
|
||||
uint32_t *api_mode,
|
||||
bool *msaa_rasterization_enable)
|
||||
{
|
||||
if (raster_mode == VK_POLYGON_MODE_LINE) {
|
||||
/* Unfortunately, configuring our line rasterization hardware on gfx8
|
||||
* and later is rather painful. Instead of giving us bits to tell the
|
||||
* hardware what line mode to use like we had on gfx7, we now have an
|
||||
* arcane combination of API Mode and MSAA enable bits which do things
|
||||
* in a table which are expected to magically put the hardware into the
|
||||
* right mode for your API. Sadly, Vulkan isn't any of the APIs the
|
||||
* hardware people thought of so nothing works the way you want it to.
|
||||
*
|
||||
* Look at the table titled "Multisample Rasterization Modes" in Vol 7
|
||||
* of the Skylake PRM for more details.
|
||||
*/
|
||||
switch (line_mode) {
|
||||
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT:
|
||||
*api_mode = DX101;
|
||||
#if GFX_VER <= 9
|
||||
/* Prior to ICL, the algorithm the HW uses to draw wide lines
|
||||
* doesn't quite match what the CTS expects, at least for rectangular
|
||||
* lines, so we set this to false here, making it draw parallelograms
|
||||
* instead, which work well enough.
|
||||
*/
|
||||
*msaa_rasterization_enable = line_width < 1.0078125;
|
||||
#else
|
||||
*msaa_rasterization_enable = true;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT:
|
||||
case VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT:
|
||||
*api_mode = DX9OGL;
|
||||
*msaa_rasterization_enable = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("Unsupported line rasterization mode");
|
||||
}
|
||||
} else {
|
||||
*api_mode = DX101;
|
||||
*msaa_rasterization_enable = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emit_rs_state(struct anv_graphics_pipeline *pipeline,
|
||||
const struct vk_input_assembly_state *ia,
|
||||
|
@ -445,6 +445,55 @@ static const uint32_t genX(vk_to_intel_blend_op)[] = {
|
||||
[VK_BLEND_OP_MAX] = BLENDFUNCTION_MAX,
|
||||
};
|
||||
|
||||
static void
|
||||
genX(rasterization_mode)(VkPolygonMode raster_mode,
|
||||
VkLineRasterizationModeEXT line_mode,
|
||||
float line_width,
|
||||
uint32_t *api_mode,
|
||||
bool *msaa_rasterization_enable)
|
||||
{
|
||||
if (raster_mode == VK_POLYGON_MODE_LINE) {
|
||||
/* Unfortunately, configuring our line rasterization hardware on gfx8
|
||||
* and later is rather painful. Instead of giving us bits to tell the
|
||||
* hardware what line mode to use like we had on gfx7, we now have an
|
||||
* arcane combination of API Mode and MSAA enable bits which do things
|
||||
* in a table which are expected to magically put the hardware into the
|
||||
* right mode for your API. Sadly, Vulkan isn't any of the APIs the
|
||||
* hardware people thought of so nothing works the way you want it to.
|
||||
*
|
||||
* Look at the table titled "Multisample Rasterization Modes" in Vol 7
|
||||
* of the Skylake PRM for more details.
|
||||
*/
|
||||
switch (line_mode) {
|
||||
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT:
|
||||
*api_mode = DX101;
|
||||
#if GFX_VER <= 9
|
||||
/* Prior to ICL, the algorithm the HW uses to draw wide lines
|
||||
* doesn't quite match what the CTS expects, at least for rectangular
|
||||
* lines, so we set this to false here, making it draw parallelograms
|
||||
* instead, which work well enough.
|
||||
*/
|
||||
*msaa_rasterization_enable = line_width < 1.0078125;
|
||||
#else
|
||||
*msaa_rasterization_enable = true;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT:
|
||||
case VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT:
|
||||
*api_mode = DX9OGL;
|
||||
*msaa_rasterization_enable = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
unreachable("Unsupported line rasterization mode");
|
||||
}
|
||||
} else {
|
||||
*api_mode = DX101;
|
||||
*msaa_rasterization_enable = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user