summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2015-06-12 14:47:02 +0800
committerChia-I Wu <[email protected]>2015-06-15 01:07:10 +0800
commit30fcb31c9b095451ce5ac5a10c3c6b177dc03e20 (patch)
tree9e34d182e3848674f1ac85d9f97b3b3fe23a4b13 /src/gallium/drivers
parentda6e45fcbc4570df0ec4b8c8885f33a206da3552 (diff)
ilo: add ilo_state_{vs,hs,ds,gs} to ilo_shader_cso
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/ilo/Makefile.sources1
-rw-r--r--src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h34
-rw-r--r--src/gallium/drivers/ilo/core/ilo_builder_3d_top.h278
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d.h25
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c38
-rw-r--r--src/gallium/drivers/ilo/core/ilo_state_3d_top.c251
-rw-r--r--src/gallium/drivers/ilo/ilo_blitter.h6
-rw-r--r--src/gallium/drivers/ilo/ilo_blitter_rectlist.c4
-rw-r--r--src/gallium/drivers/ilo/ilo_render_gen6.c48
-rw-r--r--src/gallium/drivers/ilo/ilo_render_gen7.c59
-rw-r--r--src/gallium/drivers/ilo/ilo_shader.c104
-rw-r--r--src/gallium/drivers/ilo/ilo_shader.h3
-rw-r--r--src/gallium/drivers/ilo/ilo_state.c4
-rw-r--r--src/gallium/drivers/ilo/ilo_state.h5
-rw-r--r--src/gallium/drivers/ilo/shader/ilo_shader_internal.h2
15 files changed, 363 insertions, 499 deletions
diff --git a/src/gallium/drivers/ilo/Makefile.sources b/src/gallium/drivers/ilo/Makefile.sources
index 3b38277af19..e5a8ed4a97b 100644
--- a/src/gallium/drivers/ilo/Makefile.sources
+++ b/src/gallium/drivers/ilo/Makefile.sources
@@ -22,7 +22,6 @@ C_SOURCES := \
core/ilo_image.h \
core/ilo_state_3d.h \
core/ilo_state_3d_bottom.c \
- core/ilo_state_3d_top.c \
core/ilo_state_cc.c \
core/ilo_state_cc.h \
core/ilo_state_raster.c \
diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
index fc63c80c2ce..68461fff09d 100644
--- a/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
+++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_bottom.h
@@ -217,14 +217,14 @@ gen6_3DSTATE_WM(struct ilo_builder *builder,
dw6 = rs->raster[2];
if (fs) {
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
cso = ilo_shader_get_kernel_cso(fs);
/* see fs_init_cso_gen6() */
- dw2 |= cso->payload[0];
- dw4 |= cso->payload[1];
- dw5 |= cso->payload[2];
- dw6 |= cso->payload[3];
+ dw2 |= cso->ps_payload[0];
+ dw4 |= cso->ps_payload[1];
+ dw5 |= cso->ps_payload[2];
+ dw6 |= cso->ps_payload[3];
} else {
const int max_threads = (builder->dev->gt == 2) ? 80 : 40;
@@ -271,11 +271,11 @@ gen7_3DSTATE_WM(struct ilo_builder *builder,
dw1 = rs->wm[0];
if (fs) {
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
cso = ilo_shader_get_kernel_cso(fs);
/* see fs_init_cso_gen7() */
- dw1 |= cso->payload[3];
+ dw1 |= cso->ps_payload[3];
}
if (cc_may_kill)
@@ -383,16 +383,16 @@ gen7_3DSTATE_PS(struct ilo_builder *builder,
bool dual_blend)
{
const uint8_t cmd_len = 8;
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
uint32_t dw2, dw4, dw5, *dw;
ILO_DEV_ASSERT(builder->dev, 7, 7.5);
/* see fs_init_cso_gen7() */
cso = ilo_shader_get_kernel_cso(fs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
+ dw2 = cso->ps_payload[0];
+ dw4 = cso->ps_payload[1];
+ dw5 = cso->ps_payload[2];
if (dual_blend)
dw4 |= GEN7_PS_DW4_DUAL_SOURCE_BLEND;
@@ -452,16 +452,16 @@ gen8_3DSTATE_PS(struct ilo_builder *builder,
const struct ilo_shader_state *fs)
{
const uint8_t cmd_len = 12;
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
uint32_t dw3, dw6, dw7, *dw;
ILO_DEV_ASSERT(builder->dev, 8, 8);
/* see fs_init_cso_gen8() */
cso = ilo_shader_get_kernel_cso(fs);
- dw3 = cso->payload[0];
- dw6 = cso->payload[1];
- dw7 = cso->payload[2];
+ dw3 = cso->ps_payload[0];
+ dw6 = cso->ps_payload[1];
+ dw7 = cso->ps_payload[2];
ilo_builder_batch_pointer(builder, cmd_len, &dw);
@@ -485,14 +485,14 @@ gen8_3DSTATE_PS_EXTRA(struct ilo_builder *builder,
bool cc_may_kill, bool per_sample)
{
const uint8_t cmd_len = 2;
- const struct ilo_shader_cso *cso;
+ const union ilo_shader_cso *cso;
uint32_t dw1, *dw;
ILO_DEV_ASSERT(builder->dev, 8, 8);
/* see fs_init_cso_gen8() */
cso = ilo_shader_get_kernel_cso(fs);
- dw1 = cso->payload[3];
+ dw1 = cso->ps_payload[3];
if (cc_may_kill)
dw1 |= GEN8_PSX_DW1_VALID | GEN8_PSX_DW1_KILL_PIXEL;
diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h
index a47c2973480..85b0da7406d 100644
--- a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h
+++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h
@@ -30,13 +30,13 @@
#include "genhw/genhw.h"
#include "../ilo_resource.h"
-#include "../ilo_shader.h"
#include "intel_winsys.h"
#include "ilo_core.h"
#include "ilo_dev.h"
#include "ilo_state_3d.h"
#include "ilo_state_sampler.h"
+#include "ilo_state_shader.h"
#include "ilo_state_sol.h"
#include "ilo_state_urb.h"
#include "ilo_state_vf.h"
@@ -546,102 +546,98 @@ gen8_3DSTATE_INDEX_BUFFER(struct ilo_builder *builder,
static inline void
gen6_3DSTATE_VS(struct ilo_builder *builder,
- const struct ilo_shader_state *vs)
+ const struct ilo_state_vs *vs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 6;
- const struct ilo_shader_cso *cso;
- uint32_t dw2, dw4, dw5, *dw;
+ uint32_t *dw;
ILO_DEV_ASSERT(builder->dev, 6, 7.5);
- cso = ilo_shader_get_kernel_cso(vs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
-
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_VS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(vs);
- dw[2] = dw2;
- dw[3] = 0; /* scratch */
- dw[4] = dw4;
- dw[5] = dw5;
+ dw[1] = kernel_offset;
+ /* see vs_set_gen6_3DSTATE_VS() */
+ dw[2] = vs->vs[0];
+ dw[3] = vs->vs[1];
+ dw[4] = vs->vs[2];
+ dw[5] = vs->vs[3];
}
static inline void
gen8_3DSTATE_VS(struct ilo_builder *builder,
- const struct ilo_shader_state *vs,
- uint32_t clip_plane_enable)
+ const struct ilo_state_vs *vs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 9;
- const struct ilo_shader_cso *cso;
- uint32_t dw3, dw6, dw7, dw8, *dw;
+ uint32_t *dw;
ILO_DEV_ASSERT(builder->dev, 8, 8);
- cso = ilo_shader_get_kernel_cso(vs);
- dw3 = cso->payload[0];
- dw6 = cso->payload[1];
- dw7 = cso->payload[2];
- dw8 = clip_plane_enable << GEN8_VS_DW8_UCP_CLIP_ENABLES__SHIFT;
-
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_VS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(vs);
+ dw[1] = kernel_offset;
dw[2] = 0;
- dw[3] = dw3;
- dw[4] = 0; /* scratch */
+ /* see vs_set_gen6_3DSTATE_VS() */
+ dw[3] = vs->vs[0];
+ dw[4] = vs->vs[1];
dw[5] = 0;
- dw[6] = dw6;
- dw[7] = dw7;
- dw[8] = dw8;
+ dw[6] = vs->vs[2];
+ dw[7] = vs->vs[3];
+ dw[8] = vs->vs[4];
}
static inline void
-gen6_disable_3DSTATE_VS(struct ilo_builder *builder)
+gen7_3DSTATE_HS(struct ilo_builder *builder,
+ const struct ilo_state_hs *hs,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = 6;
+ const uint8_t cmd_len = 7;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 6, 7.5);
+ ILO_DEV_ASSERT(builder->dev, 7, 7.5);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
- dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_VS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
- dw[4] = 0;
- dw[5] = 0;
+ dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_HS) | (cmd_len - 2);
+ /* see hs_set_gen7_3DSTATE_HS() */
+ dw[1] = hs->hs[0];
+ dw[2] = hs->hs[1];
+ dw[3] = kernel_offset;
+ dw[4] = hs->hs[2];
+ dw[5] = hs->hs[3];
+ dw[6] = 0;
}
static inline void
-gen7_disable_3DSTATE_HS(struct ilo_builder *builder)
+gen8_3DSTATE_HS(struct ilo_builder *builder,
+ const struct ilo_state_hs *hs,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) ? 9 : 7;
+ const uint8_t cmd_len = 9;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 7, 8);
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_HS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
+ /* see hs_set_gen7_3DSTATE_HS() */
+ dw[1] = hs->hs[0];
+ dw[2] = hs->hs[1];
+ dw[3] = kernel_offset;
dw[4] = 0;
- dw[5] = 0;
+ dw[5] = hs->hs[2];
dw[6] = 0;
- if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) {
- dw[7] = 0;
- dw[8] = 0;
- }
+ dw[7] = hs->hs[3];
+ dw[8] = 0;
}
static inline void
-gen7_3DSTATE_TE(struct ilo_builder *builder)
+gen7_3DSTATE_TE(struct ilo_builder *builder,
+ const struct ilo_state_ds *ds)
{
const uint8_t cmd_len = 4;
uint32_t *dw;
@@ -651,108 +647,61 @@ gen7_3DSTATE_TE(struct ilo_builder *builder)
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_TE) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
+ /* see ds_set_gen7_3DSTATE_TE() */
+ dw[1] = ds->te[0];
+ dw[2] = ds->te[1];
+ dw[3] = ds->te[2];
}
static inline void
-gen7_disable_3DSTATE_DS(struct ilo_builder *builder)
+gen7_3DSTATE_DS(struct ilo_builder *builder,
+ const struct ilo_state_ds *ds,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) ? 9 : 6;
+ const uint8_t cmd_len = 6;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 7, 8);
+ ILO_DEV_ASSERT(builder->dev, 7, 7.5);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_DS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
- dw[4] = 0;
- dw[5] = 0;
- if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) {
- dw[6] = 0;
- dw[7] = 0;
- dw[8] = 0;
- }
+ /* see ds_set_gen7_3DSTATE_DS() */
+ dw[1] = kernel_offset;
+ dw[2] = ds->ds[0];
+ dw[3] = ds->ds[1];
+ dw[4] = ds->ds[2];
+ dw[5] = ds->ds[3];
}
static inline void
-gen6_3DSTATE_GS(struct ilo_builder *builder,
- const struct ilo_shader_state *gs)
+gen8_3DSTATE_DS(struct ilo_builder *builder,
+ const struct ilo_state_ds *ds,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = 7;
- const struct ilo_shader_cso *cso;
- uint32_t dw2, dw4, dw5, dw6, *dw;
-
- ILO_DEV_ASSERT(builder->dev, 6, 6);
-
- cso = ilo_shader_get_kernel_cso(gs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
- dw6 = cso->payload[3];
-
- ilo_builder_batch_pointer(builder, cmd_len, &dw);
-
- dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(gs);
- dw[2] = dw2;
- dw[3] = 0; /* scratch */
- dw[4] = dw4;
- dw[5] = dw5;
- dw[6] = dw6;
-}
-
-static inline void
-gen6_so_3DSTATE_GS(struct ilo_builder *builder,
- const struct ilo_shader_state *vs,
- int verts_per_prim)
-{
- const uint8_t cmd_len = 7;
- struct ilo_shader_cso cso;
- enum ilo_kernel_param param;
- uint32_t dw2, dw4, dw5, dw6, *dw;
-
- ILO_DEV_ASSERT(builder->dev, 6, 6);
-
- assert(ilo_shader_get_kernel_param(vs, ILO_KERNEL_VS_GEN6_SO));
-
- switch (verts_per_prim) {
- case 1:
- param = ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET;
- break;
- case 2:
- param = ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET;
- break;
- default:
- param = ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET;
- break;
- }
+ const uint8_t cmd_len = 9;
+ uint32_t *dw;
- /* cannot use VS's CSO */
- ilo_gpe_init_gs_cso(builder->dev, vs, &cso);
- dw2 = cso.payload[0];
- dw4 = cso.payload[1];
- dw5 = cso.payload[2];
- dw6 = cso.payload[3];
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
- dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(vs) +
- ilo_shader_get_kernel_param(vs, param);
- dw[2] = dw2;
- dw[3] = 0;
- dw[4] = dw4;
- dw[5] = dw5;
- dw[6] = dw6;
+ dw[0] = GEN7_RENDER_CMD(3D, 3DSTATE_DS) | (cmd_len - 2);
+ /* see ds_set_gen7_3DSTATE_DS() */
+ dw[1] = kernel_offset;
+ dw[2] = 0;
+ dw[3] = ds->ds[0];
+ dw[4] = ds->ds[1];
+ dw[5] = 0;
+ dw[6] = ds->ds[2];
+ dw[7] = ds->ds[3];
+ dw[8] = ds->ds[4];
}
static inline void
-gen6_disable_3DSTATE_GS(struct ilo_builder *builder)
+gen6_3DSTATE_GS(struct ilo_builder *builder,
+ const struct ilo_state_gs *gs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 7;
uint32_t *dw;
@@ -762,13 +711,13 @@ gen6_disable_3DSTATE_GS(struct ilo_builder *builder)
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = 0;
- dw[2] = 0;
- dw[3] = 0;
- /* honor the valid range of URB read length */
- dw[4] = 1 << GEN6_GS_DW4_URB_READ_LEN__SHIFT;
- dw[5] = GEN6_GS_DW5_STATISTICS;
- dw[6] = 0;
+ dw[1] = kernel_offset;
+ /* see gs_set_gen6_3DSTATE_GS() */
+ dw[2] = gs->gs[0];
+ dw[3] = gs->gs[1];
+ dw[4] = gs->gs[2];
+ dw[5] = gs->gs[3];
+ dw[6] = gs->gs[4];
}
static inline void
@@ -797,54 +746,49 @@ gen6_3DSTATE_GS_SVB_INDEX(struct ilo_builder *builder,
static inline void
gen7_3DSTATE_GS(struct ilo_builder *builder,
- const struct ilo_shader_state *gs)
+ const struct ilo_state_gs *gs,
+ uint32_t kernel_offset)
{
const uint8_t cmd_len = 7;
- const struct ilo_shader_cso *cso;
- uint32_t dw2, dw4, dw5, *dw;
+ uint32_t *dw;
ILO_DEV_ASSERT(builder->dev, 7, 7.5);
- cso = ilo_shader_get_kernel_cso(gs);
- dw2 = cso->payload[0];
- dw4 = cso->payload[1];
- dw5 = cso->payload[2];
-
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = ilo_shader_get_kernel_offset(gs);
- dw[2] = dw2;
- dw[3] = 0; /* scratch */
- dw[4] = dw4;
- dw[5] = dw5;
+ dw[1] = kernel_offset;
+ /* see gs_set_gen7_3DSTATE_GS() */
+ dw[2] = gs->gs[0];
+ dw[3] = gs->gs[1];
+ dw[4] = gs->gs[2];
+ dw[5] = gs->gs[3];
dw[6] = 0;
}
static inline void
-gen7_disable_3DSTATE_GS(struct ilo_builder *builder)
+gen8_3DSTATE_GS(struct ilo_builder *builder,
+ const struct ilo_state_gs *gs,
+ uint32_t kernel_offset)
{
- const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) ? 10 : 7;
+ const uint8_t cmd_len = 10;
uint32_t *dw;
- ILO_DEV_ASSERT(builder->dev, 7, 8);
+ ILO_DEV_ASSERT(builder->dev, 8, 8);
ilo_builder_batch_pointer(builder, cmd_len, &dw);
dw[0] = GEN6_RENDER_CMD(3D, 3DSTATE_GS) | (cmd_len - 2);
- dw[1] = 0;
+ dw[1] = kernel_offset;
dw[2] = 0;
- dw[3] = 0;
- dw[4] = 0;
-
- if (ilo_dev_gen(builder->dev) >= ILO_GEN(8)) {
- dw[7] = GEN8_GS_DW7_STATISTICS;
- dw[8] = 0;
- dw[9] = 0;
- } else {
- dw[5] = GEN7_GS_DW5_STATISTICS;
- dw[6] = 0;
- }
+ /* see gs_set_gen7_3DSTATE_GS() */
+ dw[3] = gs->gs[0];
+ dw[4] = gs->gs[1];
+ dw[5] = 0;
+ dw[6] = gs->gs[2];
+ dw[7] = gs->gs[3];
+ dw[8] = 0;
+ dw[9] = gs->gs[4];
}
static inline void
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d.h b/src/gallium/drivers/ilo/core/ilo_state_3d.h
index 16db93c6603..b2087df3470 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d.h
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d.h
@@ -33,6 +33,7 @@
#include "ilo_core.h"
#include "ilo_dev.h"
+#include "ilo_state_shader.h"
#include "ilo_state_surface.h"
#include "ilo_state_zs.h"
@@ -113,24 +114,24 @@ struct ilo_fb_state {
enum gen_depth_format depth_offset_format;
};
-struct ilo_shader_cso {
- uint32_t payload[5];
-};
+union ilo_shader_cso {
+ struct ilo_state_vs vs;
+ struct ilo_state_hs hs;
+ struct ilo_state_ds ds;
+ struct ilo_state_gs gs;
-void
-ilo_gpe_init_vs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *vs,
- struct ilo_shader_cso *cso);
+ uint32_t ps_payload[5];
-void
-ilo_gpe_init_gs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso);
+ struct {
+ struct ilo_state_vs vs;
+ struct ilo_state_gs sol;
+ } vs_sol;
+};
void
ilo_gpe_init_fs_cso(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso);
+ union ilo_shader_cso *cso);
void
ilo_gpe_set_fb(const struct ilo_dev *dev,
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
index 932b80dd0aa..004904fcd08 100644
--- a/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
+++ b/src/gallium/drivers/ilo/core/ilo_state_3d_bottom.c
@@ -37,7 +37,7 @@
static void
fs_init_cso_gen6(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
int start_grf, input_count, sampler_count, max_threads;
uint32_t dw2, dw4, dw5, dw6;
@@ -121,11 +121,11 @@ fs_init_cso_gen6(const struct ilo_dev *dev,
dw6 = input_count << GEN6_WM_DW6_SF_ATTR_COUNT__SHIFT |
GEN6_POSOFFSET_NONE << GEN6_WM_DW6_PS_POSOFFSET__SHIFT;
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
- cso->payload[3] = dw6;
+ STATIC_ASSERT(Elements(cso->ps_payload) >= 4);
+ cso->ps_payload[0] = dw2;
+ cso->ps_payload[1] = dw4;
+ cso->ps_payload[2] = dw5;
+ cso->ps_payload[3] = dw6;
}
static uint32_t
@@ -191,7 +191,7 @@ fs_get_wm_gen7(const struct ilo_dev *dev,
static void
fs_init_cso_gen7(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
int start_grf, sampler_count, max_threads;
uint32_t dw2, dw4, dw5;
@@ -233,11 +233,11 @@ fs_init_cso_gen7(const struct ilo_dev *dev,
0 << GEN7_PS_DW5_URB_GRF_START1__SHIFT |
0 << GEN7_PS_DW5_URB_GRF_START2__SHIFT;
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
- cso->payload[3] = fs_get_wm_gen7(dev, fs);
+ STATIC_ASSERT(Elements(cso->ps_payload) >= 4);
+ cso->ps_payload[0] = dw2;
+ cso->ps_payload[1] = dw4;
+ cso->ps_payload[2] = dw5;
+ cso->ps_payload[3] = fs_get_wm_gen7(dev, fs);
}
static uint32_t
@@ -267,7 +267,7 @@ fs_get_psx_gen8(const struct ilo_dev *dev,
static void
fs_init_cso_gen8(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
int start_grf, sampler_count;
uint32_t dw3, dw6, dw7;
@@ -293,17 +293,17 @@ fs_init_cso_gen8(const struct ilo_dev *dev,
0 << GEN8_PS_DW7_URB_GRF_START1__SHIFT |
0 << GEN8_PS_DW7_URB_GRF_START2__SHIFT;
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw3;
- cso->payload[1] = dw6;
- cso->payload[2] = dw7;
- cso->payload[3] = fs_get_psx_gen8(dev, fs);
+ STATIC_ASSERT(Elements(cso->ps_payload) >= 4);
+ cso->ps_payload[0] = dw3;
+ cso->ps_payload[1] = dw6;
+ cso->ps_payload[2] = dw7;
+ cso->ps_payload[3] = fs_get_psx_gen8(dev, fs);
}
void
ilo_gpe_init_fs_cso(const struct ilo_dev *dev,
const struct ilo_shader_state *fs,
- struct ilo_shader_cso *cso)
+ union ilo_shader_cso *cso)
{
if (ilo_dev_gen(dev) >= ILO_GEN(8))
fs_init_cso_gen8(dev, fs, cso);
diff --git a/src/gallium/drivers/ilo/core/ilo_state_3d_top.c b/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
deleted file mode 100644
index feac579f2de..00000000000
--- a/src/gallium/drivers/ilo/core/ilo_state_3d_top.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2012-2014 LunarG, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Chia-I Wu <[email protected]>
- */
-
-#include "genhw/genhw.h"
-#include "util/u_dual_blend.h"
-#include "util/u_framebuffer.h"
-#include "util/u_half.h"
-#include "util/u_resource.h"
-
-#include "ilo_buffer.h"
-#include "ilo_format.h"
-#include "ilo_image.h"
-#include "ilo_state_3d.h"
-#include "../ilo_shader.h"
-
-void
-ilo_gpe_init_vs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *vs,
- struct ilo_shader_cso *cso)
-{
- int start_grf, vue_read_len, sampler_count, max_threads;
- uint32_t dw2, dw4, dw5;
-
- ILO_DEV_ASSERT(dev, 6, 8);
-
- start_grf = ilo_shader_get_kernel_param(vs, ILO_KERNEL_URB_DATA_START_REG);
- vue_read_len = ilo_shader_get_kernel_param(vs, ILO_KERNEL_INPUT_COUNT);
- sampler_count = ilo_shader_get_kernel_param(vs, ILO_KERNEL_SAMPLER_COUNT);
-
- /*
- * From the Sandy Bridge PRM, volume 2 part 1, page 135:
- *
- * "(Vertex URB Entry Read Length) Specifies the number of pairs of
- * 128-bit vertex elements to be passed into the payload for each
- * vertex."
- *
- * "It is UNDEFINED to set this field to 0 indicating no Vertex URB
- * data to be read and passed to the thread."
- */
- vue_read_len = (vue_read_len + 1) / 2;
- if (!vue_read_len)
- vue_read_len = 1;
-
- max_threads = dev->thread_count;
- if (ilo_dev_gen(dev) == ILO_GEN(7.5) && dev->gt == 2)
- max_threads *= 2;
-
- dw2 = (true) ? 0 : GEN6_THREADDISP_FP_MODE_ALT;
- dw2 |= ((sampler_count + 3) / 4) << GEN6_THREADDISP_SAMPLER_COUNT__SHIFT;
-
- dw4 = start_grf << GEN6_VS_DW4_URB_GRF_START__SHIFT |
- vue_read_len << GEN6_VS_DW4_URB_READ_LEN__SHIFT |
- 0 << GEN6_VS_DW4_URB_READ_OFFSET__SHIFT;
-
- dw5 = GEN6_VS_DW5_STATISTICS |
- GEN6_VS_DW5_VS_ENABLE;
-
- if (ilo_dev_gen(dev) >= ILO_GEN(7.5))
- dw5 |= (max_threads - 1) << GEN75_VS_DW5_MAX_THREADS__SHIFT;
- else
- dw5 |= (max_threads - 1) << GEN6_VS_DW5_MAX_THREADS__SHIFT;
-
- STATIC_ASSERT(Elements(cso->payload) >= 3);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
-}
-
-static void
-gs_init_cso_gen6(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso)
-{
- int start_grf, vue_read_len, max_threads;
- uint32_t dw2, dw4, dw5, dw6;
-
- ILO_DEV_ASSERT(dev, 6, 6);
-
- if (ilo_shader_get_type(gs) == PIPE_SHADER_GEOMETRY) {
- start_grf = ilo_shader_get_kernel_param(gs,
- ILO_KERNEL_URB_DATA_START_REG);
-
- vue_read_len = ilo_shader_get_kernel_param(gs, ILO_KERNEL_INPUT_COUNT);
- }
- else {
- start_grf = ilo_shader_get_kernel_param(gs,
- ILO_KERNEL_VS_GEN6_SO_START_REG);
-
- vue_read_len = ilo_shader_get_kernel_param(gs, ILO_KERNEL_OUTPUT_COUNT);
- }
-
- /*
- * From the Sandy Bridge PRM, volume 2 part 1, page 153:
- *
- * "Specifies the amount of URB data read and passed in the thread
- * payload for each Vertex URB entry, in 256-bit register increments.
- *
- * It is UNDEFINED to set this field (Vertex URB Entry Read Length) to
- * 0 indicating no Vertex URB data to be read and passed to the
- * thread."
- */
- vue_read_len = (vue_read_len + 1) / 2;
- if (!vue_read_len)
- vue_read_len = 1;
-
- /*
- * From the Sandy Bridge PRM, volume 2 part 1, page 154:
- *
- * "Maximum Number of Threads valid range is [0,27] when Rendering
- * Enabled bit is set."
- *
- * From the Sandy Bridge PRM, volume 2 part 1, page 173:
- *
- * "Programming Note: If the GS stage is enabled, software must always
- * allocate at least one GS URB Entry. This is true even if the GS
- * thread never needs to output vertices to the pipeline, e.g., when
- * only performing stream output. This is an artifact of the need to
- * pass the GS thread an initial destination URB handle."
- *
- * As such, we always enable rendering, and limit the number of threads.
- */
- if (dev->gt == 2) {
- /* maximum is 60, but limited to 28 */
- max_threads = 28;
- }
- else {
- /* maximum is 24, but limited to 21 (see brwCreateContext()) */
- max_threads = 21;
- }
-
- dw2 = GEN6_THREADDISP_SPF;
-
- dw4 = vue_read_len << GEN6_GS_DW4_URB_READ_LEN__SHIFT |
- 0 << GEN6_GS_DW4_URB_READ_OFFSET__SHIFT |
- start_grf << GEN6_GS_DW4_URB_GRF_START__SHIFT;
-
- dw5 = (max_threads - 1) << GEN6_GS_DW5_MAX_THREADS__SHIFT |
- GEN6_GS_DW5_STATISTICS |
- GEN6_GS_DW5_SO_STATISTICS |
- GEN6_GS_DW5_RENDER_ENABLE;
-
- /*
- * we cannot make use of GEN6_GS_REORDER because it will reorder
- * triangle strips according to D3D rules (triangle 2N+1 uses vertices
- * (2N+1, 2N+3, 2N+2)), instead of GL rules (triangle 2N+1 uses vertices
- * (2N+2, 2N+1, 2N+3)).
- */
- dw6 = GEN6_GS_DW6_GS_ENABLE;
-
- if (ilo_shader_get_kernel_param(gs, ILO_KERNEL_GS_DISCARD_ADJACENCY))
- dw6 |= GEN6_GS_DW6_DISCARD_ADJACENCY;
-
- if (ilo_shader_get_kernel_param(gs, ILO_KERNEL_VS_GEN6_SO)) {
- const uint32_t svbi_post_inc =
- ilo_shader_get_kernel_param(gs, ILO_KERNEL_GS_GEN6_SVBI_POST_INC);
-
- dw6 |= GEN6_GS_DW6_SVBI_PAYLOAD_ENABLE;
- if (svbi_post_inc) {
- dw6 |= GEN6_GS_DW6_SVBI_POST_INC_ENABLE |
- svbi_post_inc << GEN6_GS_DW6_SVBI_POST_INC_VAL__SHIFT;
- }
- }
-
- STATIC_ASSERT(Elements(cso->payload) >= 4);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
- cso->payload[3] = dw6;
-}
-
-static void
-gs_init_cso_gen7(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso)
-{
- int start_grf, vue_read_len, sampler_count, max_threads;
- uint32_t dw2, dw4, dw5;
-
- ILO_DEV_ASSERT(dev, 7, 7.5);
-
- start_grf = ilo_shader_get_kernel_param(gs, ILO_KERNEL_URB_DATA_START_REG);
- vue_read_len = ilo_shader_get_kernel_param(gs, ILO_KERNEL_INPUT_COUNT);
- sampler_count = ilo_shader_get_kernel_param(gs, ILO_KERNEL_SAMPLER_COUNT);
-
- /* in pairs */
- vue_read_len = (vue_read_len + 1) / 2;
-
- switch (ilo_dev_gen(dev)) {
- case ILO_GEN(7.5):
- max_threads = (dev->gt >= 2) ? 256 : 70;
- break;
- case ILO_GEN(7):
- max_threads = (dev->gt == 2) ? 128 : 36;
- break;
- default:
- max_threads = 1;
- break;
- }
-
- dw2 = (true) ? 0 : GEN6_THREADDISP_FP_MODE_ALT;
- dw2 |= ((sampler_count + 3) / 4) << GEN6_THREADDISP_SAMPLER_COUNT__SHIFT;
-
- dw4 = vue_read_len << GEN7_GS_DW4_URB_READ_LEN__SHIFT |
- GEN7_GS_DW4_INCLUDE_VERTEX_HANDLES |
- 0 << GEN7_GS_DW4_URB_READ_OFFSET__SHIFT |
- start_grf << GEN7_GS_DW4_URB_GRF_START__SHIFT;
-
- dw5 = (max_threads - 1) << GEN7_GS_DW5_MAX_THREADS__SHIFT |
- GEN7_GS_DW5_STATISTICS |
- GEN7_GS_DW5_GS_ENABLE;
-
- STATIC_ASSERT(Elements(cso->payload) >= 3);
- cso->payload[0] = dw2;
- cso->payload[1] = dw4;
- cso->payload[2] = dw5;
-}
-
-void
-ilo_gpe_init_gs_cso(const struct ilo_dev *dev,
- const struct ilo_shader_state *gs,
- struct ilo_shader_cso *cso)
-{
- if (ilo_dev_gen(dev) >= ILO_GEN(7))
- gs_init_cso_gen7(dev, gs, cso);
- else
- gs_init_cso_gen6(dev, gs, cso);
-}
diff --git a/src/gallium/drivers/ilo/ilo_blitter.h b/src/gallium/drivers/ilo/ilo_blitter.h
index 550e465a329..392f784a503 100644
--- a/src/gallium/drivers/ilo/ilo_blitter.h
+++ b/src/gallium/drivers/ilo/ilo_blitter.h
@@ -62,6 +62,12 @@ struct ilo_blitter {
uint32_t vf_data[2];
struct ilo_state_vf vf;
+
+ struct ilo_state_vs vs;
+ struct ilo_state_hs hs;
+ struct ilo_state_ds ds;
+ struct ilo_state_gs gs;
+
struct ilo_state_sol sol;
struct ilo_state_viewport vp;
diff --git a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
index 873f3e4c3e8..9cc57f86f68 100644
--- a/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
+++ b/src/gallium/drivers/ilo/ilo_blitter_rectlist.c
@@ -59,6 +59,10 @@ ilo_blitter_set_invariants(struct ilo_blitter *blitter)
ilo_state_vf_init_for_rectlist(&blitter->vf, blitter->ilo->dev,
blitter->vf_data, sizeof(blitter->vf_data), &elem, 1);
+ ilo_state_vs_init_disabled(&blitter->vs, blitter->ilo->dev);
+ ilo_state_hs_init_disabled(&blitter->hs, blitter->ilo->dev);
+ ilo_state_ds_init_disabled(&blitter->ds, blitter->ilo->dev);
+ ilo_state_gs_init_disabled(&blitter->gs, blitter->ilo->dev);
ilo_state_sol_init_disabled(&blitter->sol, blitter->ilo->dev, false);
/**
diff --git a/src/gallium/drivers/ilo/ilo_render_gen6.c b/src/gallium/drivers/ilo/ilo_render_gen6.c
index d659ab588ac..2f6743c8b28 100644
--- a/src/gallium/drivers/ilo/ilo_render_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_render_gen6.c
@@ -472,10 +472,17 @@ gen6_draw_vs(struct ilo_render *r,
/* 3DSTATE_VS */
if (DIRTY(VS) || r->instruction_bo_changed) {
+ const union ilo_shader_cso *cso = ilo_shader_get_kernel_cso(vec->vs);
+ const uint32_t kernel_offset = ilo_shader_get_kernel_offset(vec->vs);
+
if (ilo_dev_gen(r->dev) == ILO_GEN(6))
gen6_wa_pre_3dstate_vs_toggle(r);
- gen6_3DSTATE_VS(r->builder, vec->vs);
+ if (ilo_dev_gen(r->dev) == ILO_GEN(6) &&
+ ilo_shader_get_kernel_param(vec->vs, ILO_KERNEL_VS_GEN6_SO))
+ gen6_3DSTATE_VS(r->builder, &cso->vs_sol.vs, kernel_offset);
+ else
+ gen6_3DSTATE_VS(r->builder, &cso->vs, kernel_offset);
}
}
@@ -491,14 +498,39 @@ gen6_draw_gs(struct ilo_render *r,
/* 3DSTATE_GS */
if (DIRTY(GS) || DIRTY(VS) ||
session->prim_changed || r->instruction_bo_changed) {
+ const union ilo_shader_cso *cso;
+ uint32_t kernel_offset;
+
if (vec->gs) {
- gen6_3DSTATE_GS(r->builder, vec->gs);
- } else if (vec->vs &&
+ cso = ilo_shader_get_kernel_cso(vec->gs);
+ kernel_offset = ilo_shader_get_kernel_offset(vec->gs);
+
+ gen6_3DSTATE_GS(r->builder, &cso->gs, kernel_offset);
+ } else if (ilo_dev_gen(r->dev) == ILO_GEN(6) &&
ilo_shader_get_kernel_param(vec->vs, ILO_KERNEL_VS_GEN6_SO)) {
- const int verts_per_prim = u_vertices_per_prim(session->reduced_prim);
- gen6_so_3DSTATE_GS(r->builder, vec->vs, verts_per_prim);
+ const int verts_per_prim =
+ u_vertices_per_prim(session->reduced_prim);
+ enum ilo_kernel_param param;
+
+ switch (verts_per_prim) {
+ case 1:
+ param = ILO_KERNEL_VS_GEN6_SO_POINT_OFFSET;
+ break;
+ case 2:
+ param = ILO_KERNEL_VS_GEN6_SO_LINE_OFFSET;
+ break;
+ default:
+ param = ILO_KERNEL_VS_GEN6_SO_TRI_OFFSET;
+ break;
+ }
+
+ cso = ilo_shader_get_kernel_cso(vec->vs);
+ kernel_offset = ilo_shader_get_kernel_offset(vec->vs) +
+ ilo_shader_get_kernel_param(vec->vs, param);
+
+ gen6_3DSTATE_GS(r->builder, &cso->vs_sol.sol, kernel_offset);
} else {
- gen6_disable_3DSTATE_GS(r->builder);
+ gen6_3DSTATE_GS(r->builder, &vec->disabled_gs, 0);
}
}
}
@@ -792,10 +824,10 @@ gen6_rectlist_vs_to_sf(struct ilo_render *r,
gen6_wa_post_3dstate_constant_vs(r);
gen6_wa_pre_3dstate_vs_toggle(r);
- gen6_disable_3DSTATE_VS(r->builder);
+ gen6_3DSTATE_VS(r->builder, &blitter->vs, 0);
gen6_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0);
- gen6_disable_3DSTATE_GS(r->builder);
+ gen6_3DSTATE_GS(r->builder, &blitter->gs, 0);
gen6_3DSTATE_CLIP(r->builder, &blitter->fb.rs);
gen6_3DSTATE_SF(r->builder, &blitter->fb.rs, &blitter->sbe);
diff --git a/src/gallium/drivers/ilo/ilo_render_gen7.c b/src/gallium/drivers/ilo/ilo_render_gen7.c
index 3c080a52a89..04da1c41261 100644
--- a/src/gallium/drivers/ilo/ilo_render_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_render_gen7.c
@@ -313,14 +313,14 @@ gen7_draw_vs(struct ilo_render *r,
}
/* 3DSTATE_VS */
- if (ilo_dev_gen(r->dev) >= ILO_GEN(8)) {
- if (emit_3dstate_vs || DIRTY(RASTERIZER)) {
- gen8_3DSTATE_VS(r->builder, vec->vs,
- vec->rasterizer->state.clip_plane_enable);
- }
- } else {
- if (emit_3dstate_vs)
- gen6_3DSTATE_VS(r->builder, vec->vs);
+ if (emit_3dstate_vs) {
+ const union ilo_shader_cso *cso = ilo_shader_get_kernel_cso(vec->vs);
+ const uint32_t kernel_offset = ilo_shader_get_kernel_offset(vec->vs);
+
+ if (ilo_dev_gen(r->dev) >= ILO_GEN(8))
+ gen8_3DSTATE_VS(r->builder, &cso->vs, kernel_offset);
+ else
+ gen6_3DSTATE_VS(r->builder, &cso->vs, kernel_offset);
}
}
@@ -331,8 +331,15 @@ gen7_draw_hs(struct ilo_render *r,
{
/* 3DSTATE_CONSTANT_HS and 3DSTATE_HS */
if (r->hw_ctx_changed) {
+ const struct ilo_state_hs *hs = &vec->disabled_hs;
+ const uint32_t kernel_offset = 0;
+
gen7_3DSTATE_CONSTANT_HS(r->builder, 0, 0, 0);
- gen7_disable_3DSTATE_HS(r->builder);
+
+ if (ilo_dev_gen(r->dev) >= ILO_GEN(8))
+ gen8_3DSTATE_HS(r->builder, hs, kernel_offset);
+ else
+ gen7_3DSTATE_HS(r->builder, hs, kernel_offset);
}
/* 3DSTATE_BINDING_TABLE_POINTERS_HS */
@@ -346,8 +353,10 @@ gen7_draw_te(struct ilo_render *r,
struct ilo_render_draw_session *session)
{
/* 3DSTATE_TE */
- if (r->hw_ctx_changed)
- gen7_3DSTATE_TE(r->builder);
+ if (r->hw_ctx_changed) {
+ const struct ilo_state_ds *ds = &vec->disabled_ds;
+ gen7_3DSTATE_TE(r->builder, ds);
+ }
}
void
@@ -357,8 +366,15 @@ gen7_draw_ds(struct ilo_render *r,
{
/* 3DSTATE_CONSTANT_DS and 3DSTATE_DS */
if (r->hw_ctx_changed) {
+ const struct ilo_state_ds *ds = &vec->disabled_ds;
+ const uint32_t kernel_offset = 0;
+
gen7_3DSTATE_CONSTANT_DS(r->builder, 0, 0, 0);
- gen7_disable_3DSTATE_DS(r->builder);
+
+ if (ilo_dev_gen(r->dev) >= ILO_GEN(8))
+ gen8_3DSTATE_DS(r->builder, ds, kernel_offset);
+ else
+ gen7_3DSTATE_DS(r->builder, ds, kernel_offset);
}
/* 3DSTATE_BINDING_TABLE_POINTERS_DS */
@@ -374,8 +390,15 @@ gen7_draw_gs(struct ilo_render *r,
{
/* 3DSTATE_CONSTANT_GS and 3DSTATE_GS */
if (r->hw_ctx_changed) {
+ const struct ilo_state_gs *gs = &vec->disabled_gs;
+ const uint32_t kernel_offset = 0;
+
gen7_3DSTATE_CONSTANT_GS(r->builder, 0, 0, 0);
- gen7_disable_3DSTATE_GS(r->builder);
+
+ if (ilo_dev_gen(r->dev) >= ILO_GEN(8))
+ gen8_3DSTATE_GS(r->builder, gs, kernel_offset);
+ else
+ gen7_3DSTATE_GS(r->builder, gs, kernel_offset);
}
/* 3DSTATE_BINDING_TABLE_POINTERS_GS */
@@ -663,18 +686,18 @@ gen7_rectlist_vs_to_sf(struct ilo_render *r,
const struct ilo_blitter *blitter)
{
gen7_3DSTATE_CONSTANT_VS(r->builder, NULL, NULL, 0);
- gen6_disable_3DSTATE_VS(r->builder);
+ gen6_3DSTATE_VS(r->builder, &blitter->vs, 0);
gen7_3DSTATE_CONSTANT_HS(r->builder, NULL, NULL, 0);
- gen7_disable_3DSTATE_HS(r->builder);
+ gen7_3DSTATE_HS(r->builder, &blitter->hs, 0);
- gen7_3DSTATE_TE(r->builder);
+ gen7_3DSTATE_TE(r->builder, &blitter->ds);
gen7_3DSTATE_CONSTANT_DS(r->builder, NULL, NULL, 0);
- gen7_disable_3DSTATE_DS(r->builder);
+ gen7_3DSTATE_DS(r->builder, &blitter->ds, 0);
gen7_3DSTATE_CONSTANT_GS(r->builder, NULL, NULL, 0);
- gen7_disable_3DSTATE_GS(r->builder);
+ gen7_3DSTATE_GS(r->builder, &blitter->gs, 0);
gen7_3DSTATE_STREAMOUT(r->builder, &blitter->sol);
diff --git a/src/gallium/drivers/ilo/ilo_shader.c b/src/gallium/drivers/ilo/ilo_shader.c
index 46f39c19b15..29c2bf5f8f4 100644
--- a/src/gallium/drivers/ilo/ilo_shader.c
+++ b/src/gallium/drivers/ilo/ilo_shader.c
@@ -557,6 +557,104 @@ ilo_shader_state_search_variant(struct ilo_shader_state *state,
}
static void
+init_shader_urb(const struct ilo_shader *kernel,
+ const struct ilo_shader_state *state,
+ struct ilo_state_shader_urb_info *urb)
+{
+ urb->cv_input_attr_count = kernel->in.count;
+ urb->read_base = 0;
+ urb->read_count = kernel->in.count;
+
+ urb->output_attr_count = kernel->out.count;
+ urb->user_cull_enables = 0x0;
+ urb->user_clip_enables = 0x0;
+}
+
+static void
+init_shader_kernel(const struct ilo_shader *kernel,
+ const struct ilo_shader_state *state,
+ struct ilo_state_shader_kernel_info *kern)
+{
+ kern->offset = 0;
+ kern->grf_start = kernel->in.start_grf;
+ kern->pcb_attr_count =
+ (kernel->pcb.cbuf0_size + kernel->pcb.clip_state_size + 15) / 16;
+ kern->scratch_size = 0;
+}
+
+static void
+init_shader_resource(const struct ilo_shader *kernel,
+ const struct ilo_shader_state *state,
+ struct ilo_state_shader_resource_info *resource)
+{
+ resource->sampler_count = state->info.num_samplers;
+ resource->surface_count = 0;
+ resource->has_uav = false;
+}
+
+static void
+init_vs(struct ilo_shader *kernel,
+ const struct ilo_shader_state *state)
+{
+ struct ilo_state_vs_info info;
+
+ memset(&info, 0, sizeof(info));
+
+ init_shader_urb(kernel, state, &info.urb);
+ init_shader_kernel(kernel, state, &info.kernel);
+ init_shader_resource(kernel, state, &info.resource);
+ info.dispatch_enable = true;
+ info.stats_enable = true;
+
+ if (ilo_dev_gen(state->info.dev) == ILO_GEN(6) && kernel->stream_output) {
+ struct ilo_state_gs_info gs_info;
+
+ memset(&gs_info, 0, sizeof(gs_info));
+
+ gs_info.urb.cv_input_attr_count = kernel->out.count;
+ gs_info.urb.read_count = kernel->out.count;
+ gs_info.kernel.grf_start = kernel->gs_start_grf;
+ gs_info.sol.sol_enable = true;
+ gs_info.sol.stats_enable = true;
+ gs_info.sol.render_disable = kernel->variant.u.vs.rasterizer_discard;
+ gs_info.sol.svbi_post_inc = kernel->svbi_post_inc;
+ gs_info.sol.tristrip_reorder = GEN7_REORDER_LEADING;
+ gs_info.dispatch_enable = true;
+ gs_info.stats_enable = true;
+
+ ilo_state_vs_init(&kernel->cso.vs_sol.vs, state->info.dev, &info);
+ ilo_state_gs_init(&kernel->cso.vs_sol.sol, state->info.dev, &gs_info);
+ } else {
+ ilo_state_vs_init(&kernel->cso.vs, state->info.dev, &info);
+ }
+}
+
+static void
+init_gs(struct ilo_shader *kernel,
+ const struct ilo_shader_state *state)
+{
+ const struct pipe_stream_output_info *so_info = &state->info.stream_output;
+ struct ilo_state_gs_info info;
+
+ memset(&info, 0, sizeof(info));
+
+ init_shader_urb(kernel, state, &info.urb);
+ init_shader_kernel(kernel, state, &info.kernel);
+ init_shader_resource(kernel, state, &info.resource);
+ info.dispatch_enable = true;
+ info.stats_enable = true;
+
+ if (so_info->num_outputs > 0) {
+ info.sol.sol_enable = true;
+ info.sol.stats_enable = true;
+ info.sol.render_disable = kernel->variant.u.gs.rasterizer_discard;
+ info.sol.tristrip_reorder = GEN7_REORDER_LEADING;
+ }
+
+ ilo_state_gs_init(&kernel->cso.gs, state->info.dev, &info);
+}
+
+static void
init_sol(struct ilo_shader *kernel,
const struct ilo_dev *dev,
const struct pipe_stream_output_info *so_info,
@@ -733,10 +831,10 @@ ilo_shader_state_use_variant(struct ilo_shader_state *state,
if (construct_cso) {
switch (state->info.type) {
case PIPE_SHADER_VERTEX:
- ilo_gpe_init_vs_cso(state->info.dev, state, &sh->cso);
+ init_vs(sh, state);
break;
case PIPE_SHADER_GEOMETRY:
- ilo_gpe_init_gs_cso(state->info.dev, state, &sh->cso);
+ init_gs(sh, state);
break;
case PIPE_SHADER_FRAGMENT:
ilo_gpe_init_fs_cso(state->info.dev, state, &sh->cso);
@@ -1225,7 +1323,7 @@ ilo_shader_get_kernel_param(const struct ilo_shader_state *shader,
/**
* Return the CSO of the selected kernel.
*/
-const struct ilo_shader_cso *
+const union ilo_shader_cso *
ilo_shader_get_kernel_cso(const struct ilo_shader_state *shader)
{
const struct ilo_shader *kernel = shader->shader;
diff --git a/src/gallium/drivers/ilo/ilo_shader.h b/src/gallium/drivers/ilo/ilo_shader.h
index 457f847bb0c..0f20877f83d 100644
--- a/src/gallium/drivers/ilo/ilo_shader.h
+++ b/src/gallium/drivers/ilo/ilo_shader.h
@@ -86,7 +86,6 @@ struct ilo_builder;
struct ilo_rasterizer_state;
struct ilo_shader_cache;
struct ilo_shader_state;
-struct ilo_shader_cso;
struct ilo_state_sbe;
struct ilo_state_sol;
struct ilo_state_vector;
@@ -155,7 +154,7 @@ int
ilo_shader_get_kernel_param(const struct ilo_shader_state *shader,
enum ilo_kernel_param param);
-const struct ilo_shader_cso *
+const union ilo_shader_cso *
ilo_shader_get_kernel_cso(const struct ilo_shader_state *shader);
const struct pipe_stream_output_info *
diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index 82fd0e7df19..902b6d3d1de 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -2146,6 +2146,10 @@ ilo_state_vector_init(const struct ilo_dev *dev,
vec->viewport.params.matrices = vec->viewport.matrices;
vec->viewport.params.scissors = vec->viewport.scissors;
+ ilo_state_hs_init_disabled(&vec->disabled_hs, dev);
+ ilo_state_ds_init_disabled(&vec->disabled_ds, dev);
+ ilo_state_gs_init_disabled(&vec->disabled_gs, dev);
+
ilo_state_surface_init_for_null(&vec->fb.null_rt, dev);
ilo_state_zs_init_for_null(&vec->fb.null_zs, dev);
diff --git a/src/gallium/drivers/ilo/ilo_state.h b/src/gallium/drivers/ilo/ilo_state.h
index 3ee471e84f1..e4c6f281a5c 100644
--- a/src/gallium/drivers/ilo/ilo_state.h
+++ b/src/gallium/drivers/ilo/ilo_state.h
@@ -33,6 +33,7 @@
#include "core/ilo_state_raster.h"
#include "core/ilo_state_sampler.h"
#include "core/ilo_state_sbe.h"
+#include "core/ilo_state_shader.h"
#include "core/ilo_state_sol.h"
#include "core/ilo_state_surface.h"
#include "core/ilo_state_urb.h"
@@ -269,6 +270,10 @@ struct ilo_state_vector {
struct ilo_shader_state *vs;
struct ilo_shader_state *gs;
+ struct ilo_state_hs disabled_hs;
+ struct ilo_state_ds disabled_ds;
+ struct ilo_state_gs disabled_gs;
+
struct ilo_so_state so;
struct pipe_clip_state clip;
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_internal.h b/src/gallium/drivers/ilo/shader/ilo_shader_internal.h
index 31f731f29cd..9c17ec0e58d 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_internal.h
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_internal.h
@@ -94,7 +94,7 @@ struct ilo_kernel_routing {
struct ilo_shader {
struct ilo_shader_variant variant;
- struct ilo_shader_cso cso;
+ union ilo_shader_cso cso;
struct {
int semantic_names[PIPE_MAX_SHADER_INPUTS];