summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-09-18 22:54:40 +0200
committerMarek Olšák <[email protected]>2015-07-23 00:59:32 +0200
commit55b6f1caaeef4fa81fcc34d552aee4f0448417bb (patch)
tree87b8de218c63f11ba1612888848cdc4f8fbd30f7 /src
parentd1f43a7e5b889b30106c4db55ec1caac1ed6ca4a (diff)
radeonsi: add support for tessellation shader resources and samplers
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c43
-rw-r--r--src/gallium/drivers/radeonsi/si_state.h2
2 files changed, 37 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index f31cccbba17..2e2a35b2280 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1266,13 +1266,28 @@ static void si_set_user_data_base(struct si_context *sctx,
*/
void si_shader_change_notify(struct si_context *sctx)
{
- /* VS can be bound as VS or ES. */
- if (sctx->gs_shader)
+ /* VS can be bound as VS, ES, or LS. */
+ if (sctx->tes_shader)
+ si_set_user_data_base(sctx, PIPE_SHADER_VERTEX,
+ R_00B530_SPI_SHADER_USER_DATA_LS_0);
+ else if (sctx->gs_shader)
si_set_user_data_base(sctx, PIPE_SHADER_VERTEX,
R_00B330_SPI_SHADER_USER_DATA_ES_0);
else
si_set_user_data_base(sctx, PIPE_SHADER_VERTEX,
R_00B130_SPI_SHADER_USER_DATA_VS_0);
+
+ /* TES can be bound as ES, VS, or not bound. */
+ if (sctx->tes_shader) {
+ if (sctx->gs_shader)
+ si_set_user_data_base(sctx, PIPE_SHADER_TESS_EVAL,
+ R_00B330_SPI_SHADER_USER_DATA_ES_0);
+ else
+ si_set_user_data_base(sctx, PIPE_SHADER_TESS_EVAL,
+ R_00B130_SPI_SHADER_USER_DATA_VS_0);
+ } else {
+ si_set_user_data_base(sctx, PIPE_SHADER_TESS_EVAL, 0);
+ }
}
static void si_emit_shader_pointer(struct si_context *sctx,
@@ -1303,20 +1318,33 @@ static void si_emit_shader_userdata(struct si_context *sctx,
unsigned i;
uint32_t *sh_base = sctx->shader_userdata.sh_base;
- /* The VS copy shader needs these for clipping, streamout, and rings. */
if (sctx->gs_shader) {
- unsigned base = R_00B130_SPI_SHADER_USER_DATA_VS_0;
+ /* The VS copy shader needs these for clipping, streamout, and rings. */
+ unsigned vs_base = R_00B130_SPI_SHADER_USER_DATA_VS_0;
unsigned i = PIPE_SHADER_VERTEX;
- si_emit_shader_pointer(sctx, &sctx->const_buffers[i].desc, base, true);
- si_emit_shader_pointer(sctx, &sctx->rw_buffers[i].desc, base, true);
+ si_emit_shader_pointer(sctx, &sctx->const_buffers[i].desc, vs_base, true);
+ si_emit_shader_pointer(sctx, &sctx->rw_buffers[i].desc, vs_base, true);
+
+ /* The TESSEVAL shader needs this for the ESGS ring buffer. */
+ si_emit_shader_pointer(sctx, &sctx->rw_buffers[i].desc,
+ R_00B330_SPI_SHADER_USER_DATA_ES_0, true);
+ } else if (sctx->tes_shader) {
+ /* The TESSEVAL shader needs this for streamout. */
+ si_emit_shader_pointer(sctx, &sctx->rw_buffers[PIPE_SHADER_VERTEX].desc,
+ R_00B130_SPI_SHADER_USER_DATA_VS_0, true);
}
for (i = 0; i < SI_NUM_SHADERS; i++) {
unsigned base = sh_base[i];
+ if (!base)
+ continue;
+
+ if (i != PIPE_SHADER_TESS_EVAL)
+ si_emit_shader_pointer(sctx, &sctx->rw_buffers[i].desc, base, false);
+
si_emit_shader_pointer(sctx, &sctx->const_buffers[i].desc, base, false);
- si_emit_shader_pointer(sctx, &sctx->rw_buffers[i].desc, base, false);
si_emit_shader_pointer(sctx, &sctx->samplers[i].views.desc, base, false);
si_emit_shader_pointer(sctx, &sctx->samplers[i].states.desc, base, false);
}
@@ -1368,6 +1396,7 @@ void si_init_all_descriptors(struct si_context *sctx)
/* Set default and immutable mappings. */
si_set_user_data_base(sctx, PIPE_SHADER_VERTEX, R_00B130_SPI_SHADER_USER_DATA_VS_0);
+ si_set_user_data_base(sctx, PIPE_SHADER_TESS_CTRL, R_00B430_SPI_SHADER_USER_DATA_HS_0);
si_set_user_data_base(sctx, PIPE_SHADER_GEOMETRY, R_00B230_SPI_SHADER_USER_DATA_GS_0);
si_set_user_data_base(sctx, PIPE_SHADER_FRAGMENT, R_00B030_SPI_SHADER_USER_DATA_PS_0);
}
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 1510c2284d6..edee6d41328 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -30,7 +30,7 @@
#include "si_pm4.h"
#include "radeon/r600_pipe_common.h"
-#define SI_NUM_SHADERS (PIPE_SHADER_GEOMETRY+1)
+#define SI_NUM_SHADERS (PIPE_SHADER_TESS_EVAL+1)
struct si_screen;
struct si_shader;