mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
tu: Implement extendedDynamicState3SampleLocationsEnable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18912>
This commit is contained in:
parent
d99e5ffee7
commit
84726da2f4
4 changed files with 53 additions and 25 deletions
|
|
@ -2874,13 +2874,24 @@ tu_CmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer,
|
||||||
const VkSampleLocationsInfoEXT* pSampleLocationsInfo)
|
const VkSampleLocationsInfoEXT* pSampleLocationsInfo)
|
||||||
{
|
{
|
||||||
TU_FROM_HANDLE(tu_cmd_buffer, cmd, commandBuffer);
|
TU_FROM_HANDLE(tu_cmd_buffer, cmd, commandBuffer);
|
||||||
struct tu_cs cs = tu_cmd_dynamic_state(cmd, TU_DYNAMIC_STATE_SAMPLE_LOCATIONS, 9);
|
struct tu_cs cs = tu_cmd_dynamic_state(cmd, TU_DYNAMIC_STATE_SAMPLE_LOCATIONS, 6);
|
||||||
|
|
||||||
assert(pSampleLocationsInfo);
|
assert(pSampleLocationsInfo);
|
||||||
|
|
||||||
tu6_emit_sample_locations(&cs, pSampleLocationsInfo);
|
tu6_emit_sample_locations(&cs, pSampleLocationsInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VKAPI_ATTR void VKAPI_CALL
|
||||||
|
tu_CmdSetSampleLocationsEnableEXT(VkCommandBuffer commandBuffer,
|
||||||
|
VkBool32 sampleLocationsEnable)
|
||||||
|
{
|
||||||
|
TU_FROM_HANDLE(tu_cmd_buffer, cmd, commandBuffer);
|
||||||
|
|
||||||
|
struct tu_cs cs = tu_cmd_dynamic_state(cmd, TU_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE, 6);
|
||||||
|
|
||||||
|
tu6_emit_sample_locations_enable(&cs, sampleLocationsEnable);
|
||||||
|
}
|
||||||
|
|
||||||
VKAPI_ATTR void VKAPI_CALL
|
VKAPI_ATTR void VKAPI_CALL
|
||||||
tu_CmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode)
|
tu_CmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -777,7 +777,7 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
|
||||||
features->extendedDynamicState3LineRasterizationMode = true;
|
features->extendedDynamicState3LineRasterizationMode = true;
|
||||||
features->extendedDynamicState3LineStippleEnable = false;
|
features->extendedDynamicState3LineStippleEnable = false;
|
||||||
features->extendedDynamicState3ProvokingVertexMode = true;
|
features->extendedDynamicState3ProvokingVertexMode = true;
|
||||||
features->extendedDynamicState3SampleLocationsEnable = false;
|
features->extendedDynamicState3SampleLocationsEnable = true;
|
||||||
features->extendedDynamicState3ColorBlendEnable = false;
|
features->extendedDynamicState3ColorBlendEnable = false;
|
||||||
features->extendedDynamicState3ColorBlendEquation = false;
|
features->extendedDynamicState3ColorBlendEquation = false;
|
||||||
features->extendedDynamicState3ColorWriteMask = false;
|
features->extendedDynamicState3ColorWriteMask = false;
|
||||||
|
|
|
||||||
|
|
@ -2139,26 +2139,28 @@ tu6_emit_scissor(struct tu_cs *cs, const VkRect2D *scissors, uint32_t scissor_co
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp_loc)
|
tu6_emit_sample_locations_enable(struct tu_cs *cs, bool enable)
|
||||||
{
|
{
|
||||||
if (!samp_loc) {
|
uint32_t sample_config =
|
||||||
|
COND(enable, A6XX_RB_SAMPLE_CONFIG_LOCATION_ENABLE);
|
||||||
|
|
||||||
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SAMPLE_CONFIG, 1);
|
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SAMPLE_CONFIG, 1);
|
||||||
tu_cs_emit(cs, 0);
|
tu_cs_emit(cs, sample_config);
|
||||||
|
|
||||||
tu_cs_emit_pkt4(cs, REG_A6XX_RB_SAMPLE_CONFIG, 1);
|
tu_cs_emit_pkt4(cs, REG_A6XX_RB_SAMPLE_CONFIG, 1);
|
||||||
tu_cs_emit(cs, 0);
|
tu_cs_emit(cs, sample_config);
|
||||||
|
|
||||||
tu_cs_emit_pkt4(cs, REG_A6XX_SP_TP_SAMPLE_CONFIG, 1);
|
tu_cs_emit_pkt4(cs, REG_A6XX_SP_TP_SAMPLE_CONFIG, 1);
|
||||||
tu_cs_emit(cs, 0);
|
tu_cs_emit(cs, sample_config);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void
|
||||||
|
tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp_loc)
|
||||||
|
{
|
||||||
assert(samp_loc->sampleLocationsPerPixel == samp_loc->sampleLocationsCount);
|
assert(samp_loc->sampleLocationsPerPixel == samp_loc->sampleLocationsCount);
|
||||||
assert(samp_loc->sampleLocationGridSize.width == 1);
|
assert(samp_loc->sampleLocationGridSize.width == 1);
|
||||||
assert(samp_loc->sampleLocationGridSize.height == 1);
|
assert(samp_loc->sampleLocationGridSize.height == 1);
|
||||||
|
|
||||||
uint32_t sample_config =
|
|
||||||
A6XX_RB_SAMPLE_CONFIG_LOCATION_ENABLE;
|
|
||||||
uint32_t sample_locations = 0;
|
uint32_t sample_locations = 0;
|
||||||
for (uint32_t i = 0; i < samp_loc->sampleLocationsCount; i++) {
|
for (uint32_t i = 0; i < samp_loc->sampleLocationsCount; i++) {
|
||||||
/* From VkSampleLocationEXT:
|
/* From VkSampleLocationEXT:
|
||||||
|
|
@ -2178,16 +2180,13 @@ tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp
|
||||||
A6XX_RB_SAMPLE_LOCATION_0_SAMPLE_0_Y(y)) << i*8;
|
A6XX_RB_SAMPLE_LOCATION_0_SAMPLE_0_Y(y)) << i*8;
|
||||||
}
|
}
|
||||||
|
|
||||||
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SAMPLE_CONFIG, 2);
|
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SAMPLE_LOCATION_0, 1);
|
||||||
tu_cs_emit(cs, sample_config);
|
|
||||||
tu_cs_emit(cs, sample_locations);
|
tu_cs_emit(cs, sample_locations);
|
||||||
|
|
||||||
tu_cs_emit_pkt4(cs, REG_A6XX_RB_SAMPLE_CONFIG, 2);
|
tu_cs_emit_pkt4(cs, REG_A6XX_RB_SAMPLE_LOCATION_0, 1);
|
||||||
tu_cs_emit(cs, sample_config);
|
|
||||||
tu_cs_emit(cs, sample_locations);
|
tu_cs_emit(cs, sample_locations);
|
||||||
|
|
||||||
tu_cs_emit_pkt4(cs, REG_A6XX_SP_TP_SAMPLE_CONFIG, 2);
|
tu_cs_emit_pkt4(cs, REG_A6XX_SP_TP_SAMPLE_LOCATION_0, 1);
|
||||||
tu_cs_emit(cs, sample_config);
|
|
||||||
tu_cs_emit(cs, sample_locations);
|
tu_cs_emit(cs, sample_locations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3625,6 +3624,9 @@ tu_pipeline_builder_parse_dynamic(struct tu_pipeline_builder *builder,
|
||||||
case VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT:
|
case VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT:
|
||||||
pipeline->dynamic_state_mask |= BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS);
|
pipeline->dynamic_state_mask |= BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS);
|
||||||
break;
|
break;
|
||||||
|
case VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT:
|
||||||
|
pipeline->dynamic_state_mask |= BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE);
|
||||||
|
break;
|
||||||
case VK_DYNAMIC_STATE_CULL_MODE:
|
case VK_DYNAMIC_STATE_CULL_MODE:
|
||||||
pipeline->rast.gras_su_cntl_mask &=
|
pipeline->rast.gras_su_cntl_mask &=
|
||||||
~(A6XX_GRAS_SU_CNTL_CULL_BACK | A6XX_GRAS_SU_CNTL_CULL_FRONT);
|
~(A6XX_GRAS_SU_CNTL_CULL_BACK | A6XX_GRAS_SU_CNTL_CULL_FRONT);
|
||||||
|
|
@ -3900,6 +3902,7 @@ tu_pipeline_builder_parse_libraries(struct tu_pipeline_builder *builder,
|
||||||
library_dynamic_state |=
|
library_dynamic_state |=
|
||||||
BIT(VK_DYNAMIC_STATE_BLEND_CONSTANTS) |
|
BIT(VK_DYNAMIC_STATE_BLEND_CONSTANTS) |
|
||||||
BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS) |
|
BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS) |
|
||||||
|
BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE) |
|
||||||
BIT(TU_DYNAMIC_STATE_BLEND) |
|
BIT(TU_DYNAMIC_STATE_BLEND) |
|
||||||
BIT(TU_DYNAMIC_STATE_LOGIC_OP) |
|
BIT(TU_DYNAMIC_STATE_LOGIC_OP) |
|
||||||
BIT(TU_DYNAMIC_STATE_LOGIC_OP_ENABLE) |
|
BIT(TU_DYNAMIC_STATE_LOGIC_OP_ENABLE) |
|
||||||
|
|
@ -4608,13 +4611,23 @@ tu_pipeline_builder_parse_multisample_and_color_blend(
|
||||||
vk_find_struct_const(msaa_info->pNext, PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT);
|
vk_find_struct_const(msaa_info->pNext, PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT);
|
||||||
const VkSampleLocationsInfoEXT *samp_loc = NULL;
|
const VkSampleLocationsInfoEXT *samp_loc = NULL;
|
||||||
|
|
||||||
if (sample_locations && sample_locations->sampleLocationsEnable)
|
if (sample_locations)
|
||||||
samp_loc = &sample_locations->sampleLocationsInfo;
|
samp_loc = &sample_locations->sampleLocationsInfo;
|
||||||
|
|
||||||
if (tu_pipeline_static_state(pipeline, &cs, TU_DYNAMIC_STATE_SAMPLE_LOCATIONS,
|
bool samp_loc_enable = sample_locations &&
|
||||||
samp_loc ? 9 : 6)) {
|
sample_locations->sampleLocationsEnable;
|
||||||
|
|
||||||
|
if (samp_loc &&
|
||||||
|
((pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE)) ||
|
||||||
|
samp_loc_enable) &&
|
||||||
|
tu_pipeline_static_state(pipeline, &cs, TU_DYNAMIC_STATE_SAMPLE_LOCATIONS, 6)) {
|
||||||
tu6_emit_sample_locations(&cs, samp_loc);
|
tu6_emit_sample_locations(&cs, samp_loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tu_pipeline_static_state(pipeline, &cs,
|
||||||
|
TU_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE, 6)) {
|
||||||
|
tu6_emit_sample_locations_enable(&cs, samp_loc_enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ enum tu_dynamic_state
|
||||||
{
|
{
|
||||||
/* re-use VK_DYNAMIC_STATE_ enums for non-extended dynamic states */
|
/* re-use VK_DYNAMIC_STATE_ enums for non-extended dynamic states */
|
||||||
TU_DYNAMIC_STATE_SAMPLE_LOCATIONS = VK_DYNAMIC_STATE_STENCIL_REFERENCE + 1,
|
TU_DYNAMIC_STATE_SAMPLE_LOCATIONS = VK_DYNAMIC_STATE_STENCIL_REFERENCE + 1,
|
||||||
|
TU_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE,
|
||||||
TU_DYNAMIC_STATE_RB_DEPTH_CNTL,
|
TU_DYNAMIC_STATE_RB_DEPTH_CNTL,
|
||||||
TU_DYNAMIC_STATE_RB_STENCIL_CNTL,
|
TU_DYNAMIC_STATE_RB_STENCIL_CNTL,
|
||||||
TU_DYNAMIC_STATE_VB_STRIDE,
|
TU_DYNAMIC_STATE_VB_STRIDE,
|
||||||
|
|
@ -295,6 +296,9 @@ tu6_emit_scissor(struct tu_cs *cs, const VkRect2D *scs, uint32_t scissor_count);
|
||||||
void
|
void
|
||||||
tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp_loc);
|
tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp_loc);
|
||||||
|
|
||||||
|
void
|
||||||
|
tu6_emit_sample_locations_enable(struct tu_cs *cs, bool enable);
|
||||||
|
|
||||||
void
|
void
|
||||||
tu6_emit_depth_bias(struct tu_cs *cs,
|
tu6_emit_depth_bias(struct tu_cs *cs,
|
||||||
float constant_factor,
|
float constant_factor,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue