diff options
author | Jason Ekstrand <[email protected]> | 2018-06-28 19:16:19 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-07-02 12:09:42 -0700 |
commit | c90f221e0a1f89332189dd5ec79dccf6b251ecf5 (patch) | |
tree | b4c2356897c19e02834d0f47d0107492cab6643a /src/compiler/nir/nir_clone.c | |
parent | e8e159e9df40ee76468e05be073d94ec78d4bf32 (diff) |
nir: Add a concept of constant data associated with a shader
This commit adds a concept to NIR of having a blob of constant data
associated with a shader. Instead of being a UBO or uniform that can be
manipulated by the client, this constant data considered part of the
shader and remains constant across all invocations of the given shader
until the end of time. To access this constant data from the shader, we
add a new load_constant intrinsic. The intention is that drivers will
eventually lower load_constant intrinsics to load_ubo, load_uniform, or
something similar. Constant data will be used by the optimization pass
in the next commit but this concept may also be useful for OpenCL.
v2 (Jason Ekstrand):
- Rename num_constants to constant_data_size (anholt)
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_clone.c')
-rw-r--r-- | src/compiler/nir/nir_clone.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_clone.c b/src/compiler/nir/nir_clone.c index 23bb17eeba3..989c5051a54 100644 --- a/src/compiler/nir/nir_clone.c +++ b/src/compiler/nir/nir_clone.c @@ -734,6 +734,12 @@ nir_shader_clone(void *mem_ctx, const nir_shader *s) ns->num_outputs = s->num_outputs; ns->num_shared = s->num_shared; + ns->constant_data_size = s->constant_data_size; + if (s->constant_data_size > 0) { + ns->constant_data = ralloc_size(ns, s->constant_data_size); + memcpy(ns->constant_data, s->constant_data, s->constant_data_size); + } + free_clone_state(&state); return ns; |