isl: Add a null surface fill function.

ISL already offers functions to fill out most kinds of SURFACE_STATE,
so why not handle null surfaces too?

Null surfaces are simple, so we can just take the dimensions, rather
than an entirte fill structure.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Kenneth Graunke 2017-08-17 00:17:05 -07:00
parent 288621b1b7
commit 5db9757bd7
4 changed files with 40 additions and 0 deletions

View File

@ -1811,6 +1811,13 @@ isl_buffer_fill_state_s(const struct isl_device *dev, void *state,
isl_genX_call(dev, buffer_fill_state_s, state, info);
}
void
isl_null_fill_state(const struct isl_device *dev, void *state,
struct isl_extent3d size)
{
isl_genX_call(dev, null_fill_state, state, size);
}
void
isl_emit_depth_stencil_hiz_s(const struct isl_device *dev, void *batch,
const struct isl_depth_stencil_hiz_emit_info *restrict info)

View File

@ -1691,6 +1691,10 @@ void
isl_buffer_fill_state_s(const struct isl_device *dev, void *state,
const struct isl_buffer_fill_state_info *restrict info);
void
isl_null_fill_state(const struct isl_device *dev, void *state,
struct isl_extent3d size);
#define isl_emit_depth_stencil_hiz(dev, batch, ...) \
isl_emit_depth_stencil_hiz_s((dev), (batch), \
&(struct isl_depth_stencil_hiz_emit_info) { __VA_ARGS__ })

View File

@ -43,3 +43,6 @@ isl_genX(buffer_fill_state_s)(void *state,
void
isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
const struct isl_depth_stencil_hiz_emit_info *restrict info);
void
isl_genX(null_fill_state)(void *state, struct isl_extent3d size);

View File

@ -753,3 +753,29 @@ isl_genX(buffer_fill_state_s)(void *state,
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
}
void
isl_genX(null_fill_state)(void *state, struct isl_extent3d size)
{
struct GENX(RENDER_SURFACE_STATE) s = {
.SurfaceType = SURFTYPE_NULL,
.SurfaceFormat = ISL_FORMAT_B8G8R8A8_UNORM,
#if GEN_GEN >= 7
.SurfaceArray = size.depth > 0,
#endif
#if GEN_GEN >= 8
.TileMode = YMAJOR,
#else
.TiledSurface = true,
.TileWalk = TILEWALK_YMAJOR,
#endif
.Width = size.width - 1,
.Height = size.height - 1,
.Depth = size.depth - 1,
.RenderTargetViewExtent = size.depth - 1,
#if GEN_GEN <= 5
.ColorBufferComponentWriteDisables = 0xf,
#endif
};
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
}