From f609b2ab0342d77a8beca9efb5fbc5b66ff98295 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Thu, 18 Nov 2010 14:29:16 -0500 Subject: r600g: add fetch shader capabilities Use fetch shader instead of having fetch instruction in the vertex shader. Allow to restrict shader update to a smaller part when vertex buffer input layout changes. Signed-off-by: Jerome Glisse --- src/gallium/winsys/r600/drm/evergreen_hw_context.c | 20 ++++++++++++++++++++ src/gallium/winsys/r600/drm/r600_hw_context.c | 13 +++++++++++++ 2 files changed, 33 insertions(+) (limited to 'src/gallium/winsys') diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 7f21b53ace0..b93cc650272 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -577,6 +577,12 @@ int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon) if (r) goto out_err; } + /* FS RESOURCE */ + for (int j = 0, offset = 0x7C00; j < 16; j++, offset += 0x20) { + r = evergreen_state_resource_init(ctx, offset); + if (r) + goto out_err; + } /* PS loop const */ evergreen_loop_const_init(ctx, 0); @@ -686,6 +692,13 @@ void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, stru evergreen_context_pipe_state_set_resource(ctx, state, offset); } +void evergreen_context_pipe_state_set_fs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x7C00 + 0x20 * rid; + + evergreen_context_pipe_state_set_resource(ctx, state, offset); +} + static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { struct r600_range *range; @@ -917,3 +930,10 @@ void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state evergreen_resource_set(ctx, state, offset); } + +void evergreen_fs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_030000_RESOURCE0_WORD0 + 0x7C00 + 0x20 * rid; + + evergreen_resource_set(ctx, state, offset); +} diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 71a531f535f..de228918953 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -706,6 +706,12 @@ int r600_context_init(struct r600_context *ctx, struct radeon *radeon) if (r) goto out_err; } + /* FS RESOURCE */ + for (int j = 0, offset = 0x2300; j < 16; j++, offset += 0x1C) { + r = r600_state_resource_init(ctx, offset); + if (r) + goto out_err; + } /* PS loop const */ r600_loop_const_init(ctx, 0); @@ -893,6 +899,13 @@ void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r6 r600_context_pipe_state_set_resource(ctx, state, offset); } +void r600_context_pipe_state_set_fs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) +{ + unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x2300 + 0x1C * rid; + + r600_context_pipe_state_set_resource(ctx, state, offset); +} + static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) { struct r600_range *range; -- cgit v1.2.3