summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_draw.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/swr/swr_draw.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_draw.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp
index c4d5e5c4495..4bdd3bbaa3e 100644
--- a/src/gallium/drivers/swr/swr_draw.cpp
+++ b/src/gallium/drivers/swr/swr_draw.cpp
@@ -141,19 +141,22 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
}
struct swr_vertex_element_state *velems = ctx->velems;
- if (!velems->fsFunc
- || (velems->fsState.cutIndex != info->restart_index)
- || (velems->fsState.bEnableCutIndex != info->primitive_restart)) {
-
- velems->fsState.cutIndex = info->restart_index;
- velems->fsState.bEnableCutIndex = info->primitive_restart;
-
- /* Create Fetch Shader */
+ velems->fsState.cutIndex = info->restart_index;
+ velems->fsState.bEnableCutIndex = info->primitive_restart;
+
+ swr_jit_fetch_key key;
+ swr_generate_fetch_key(key, velems);
+ auto search = velems->map.find(key);
+ if (search != velems->map.end()) {
+ velems->fsFunc = search->second;
+ } else {
HANDLE hJitMgr = swr_screen(ctx->pipe.screen)->hJitMgr;
velems->fsFunc = JitCompileFetch(hJitMgr, velems->fsState);
debug_printf("fetch shader %p\n", velems->fsFunc);
assert(velems->fsFunc && "Error: FetchShader = NULL");
+
+ velems->map.insert(std::make_pair(key, velems->fsFunc));
}
SwrSetFetchFunc(ctx->swrContext, velems->fsFunc);