/* a bit annoying that compute-shader and normal shader state objects
* aren't a bit more aligned.
*/
-static struct ir3_shader_state *
-ir3_shader_create_compute(struct ir3_compiler *compiler,
- const struct pipe_compute_state *cso,
- struct pipe_debug_callback *debug,
- struct pipe_screen *screen)
+void *
+ir3_shader_compute_state_create(struct pipe_context *pctx,
+ const struct pipe_compute_state *cso)
{
+ struct fd_context *ctx = fd_context(pctx);
+
+ /* req_input_mem will only be non-zero for cl kernels (ie. clover).
+ * This isn't a perfect test because I guess it is possible (but
+ * uncommon) for none for the kernel parameters to be a global,
+ * but ctx->set_global_bindings() can't fail, so this is the next
+ * best place to fail if we need a newer version of kernel driver:
+ */
+ if ((cso->req_input_mem > 0) &&
+ fd_device_version(ctx->dev) < FD_VERSION_BO_IOVA) {
+ return NULL;
+ }
+
+ struct ir3_compiler *compiler = ctx->screen->compiler;
nir_shader *nir;
+
if (cso->ir_type == PIPE_SHADER_IR_NIR) {
/* we take ownership of the reference: */
nir = (nir_shader *)cso->prog;
if (ir3_shader_debug & IR3_DBG_DISASM) {
tgsi_dump(cso->prog, 0);
}
- nir = tgsi_to_nir(cso->prog, screen, false);
+ nir = tgsi_to_nir(cso->prog, pctx->screen, false);
}
struct ir3_shader *shader = ir3_shader_from_nir(compiler, nir, 0, NULL);
* is also how we get data from shader-db's ./run)
*/
static struct ir3_shader_key key; /* static is implicitly zeroed */
- ir3_shader_variant(shader, key, false, debug);
+ ir3_shader_variant(shader, key, false, &ctx->debug);
shader->initial_variants_done = true;
}
void *
-ir3_shader_compute_state_create(struct pipe_context *pctx,
- const struct pipe_compute_state *cso)
-{
- struct fd_context *ctx = fd_context(pctx);
-
- /* req_input_mem will only be non-zero for cl kernels (ie. clover).
- * This isn't a perfect test because I guess it is possible (but
- * uncommon) for none for the kernel parameters to be a global,
- * but ctx->set_global_bindings() can't fail, so this is the next
- * best place to fail if we need a newer version of kernel driver:
- */
- if ((cso->req_input_mem > 0) &&
- fd_device_version(ctx->dev) < FD_VERSION_BO_IOVA) {
- return NULL;
- }
-
- struct ir3_compiler *compiler = ctx->screen->compiler;
- return ir3_shader_create_compute(compiler, cso, &ctx->debug, pctx->screen);
-}
-
-void *
ir3_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_state *cso)
{
struct fd_context *ctx = fd_context(pctx);