anv: Share scratch_space helper between gen7 and gen8+

The gen7 pipeline has a useful helper function for this, let's use it in
gen8_pipeline.c too.  The gen7 function has an off-by-one bug though: we
have to compute log2(size / 1024) - 1, but we divide by 2048 instead so
as to avoid the case where size is less than 1024 and we'd return -1.
This commit is contained in:
Kristian Høgsberg Kristensen
2016-02-05 12:47:02 -08:00
parent d1617dbec3
commit 381d85545a
3 changed files with 9 additions and 9 deletions

View File

@@ -176,12 +176,6 @@ gen7_emit_cb_state(struct anv_pipeline *pipeline,
.BlendStatePointer = pipeline->blend_state.offset);
}
static inline uint32_t
scratch_space(const struct brw_stage_prog_data *prog_data)
{
return ffs(prog_data->total_scratch / 1024);
}
GENX_FUNC(GEN7, GEN75) VkResult
genX(graphics_pipeline_create)(
VkDevice _device,

View File

@@ -406,7 +406,7 @@ genX(graphics_pipeline_create)(
.ExpectedVertexCount = pipeline->gs_vertex_count,
.ScratchSpaceBasePointer = pipeline->scratch_start[MESA_SHADER_GEOMETRY],
.PerThreadScratchSpace = ffs(gs_prog_data->base.base.total_scratch / 2048),
.PerThreadScratchSpace = scratch_space(&gs_prog_data->base.base),
.OutputVertexSize = gs_prog_data->output_vertex_size_hwords * 2 - 1,
.OutputTopology = gs_prog_data->output_topology,
@@ -468,7 +468,7 @@ genX(graphics_pipeline_create)(
.SoftwareExceptionEnable = false,
.ScratchSpaceBasePointer = pipeline->scratch_start[MESA_SHADER_VERTEX],
.PerThreadScratchSpace = ffs(vue_prog_data->base.total_scratch / 2048),
.PerThreadScratchSpace = scratch_space(&vue_prog_data->base),
.DispatchGRFStartRegisterForURBData =
vue_prog_data->base.dispatch_grf_start_reg,
@@ -601,7 +601,7 @@ genX(graphics_pipeline_create)(
.SamplerCount = 1,
.ScratchSpaceBasePointer = pipeline->scratch_start[MESA_SHADER_FRAGMENT],
.PerThreadScratchSpace = ffs(wm_prog_data->base.total_scratch / 2048),
.PerThreadScratchSpace = scratch_space(&wm_prog_data->base),
.MaximumNumberofThreadsPerPSD = 64 - num_thread_bias,
.PositionXYOffsetSelect = wm_prog_data->uses_pos_offset ?

View File

@@ -230,6 +230,12 @@ emit_urb_setup(struct anv_pipeline *pipeline)
.DSNumberofURBEntries = 0);
}
static inline uint32_t
scratch_space(const struct brw_stage_prog_data *prog_data)
{
return ffs(prog_data->total_scratch / 2048);
}
static const uint32_t vk_to_gen_cullmode[] = {
[VK_CULL_MODE_NONE] = CULLMODE_NONE,
[VK_CULL_MODE_FRONT_BIT] = CULLMODE_FRONT,