diff options
author | Jason Ekstrand <[email protected]> | 2019-03-03 10:00:14 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-03-06 17:24:57 +0000 |
commit | 82d9a37a59c94ba3678b33acb9f2749cbbd7bfcc (patch) | |
tree | dea010697e00ab3e9db880e325ea6f5a3ed9a5a8 /src/mesa/drivers/dri/i965/brw_program.c | |
parent | 8993e0973f7d0cfb211e0c39de82ef2497584df3 (diff) |
glsl/nir: Add a shared helper for building float64 shaders
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_program.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program.c | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 5b7c1afe55a..f40d2c33549 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -43,7 +43,6 @@ #include "compiler/glsl/program.h" #include "compiler/glsl/gl_nir.h" #include "compiler/glsl/glsl_to_nir.h" -#include "glsl/float64_glsl.h" #include "brw_program.h" #include "brw_context.h" @@ -76,51 +75,6 @@ brw_nir_lower_uniforms(nir_shader *nir, bool is_scalar) static struct gl_program *brwNewProgram(struct gl_context *ctx, GLenum target, GLuint id, bool is_arb_asm); -static nir_shader * -compile_fp64_funcs(struct gl_context *ctx, - const nir_shader_compiler_options *options, - void *mem_ctx, - gl_shader_stage stage) -{ - const GLuint name = ~0; - struct gl_shader *sh; - - sh = _mesa_new_shader(name, stage); - - sh->Source = float64_source; - sh->CompileStatus = COMPILE_FAILURE; - _mesa_glsl_compile_shader(ctx, sh, false, false, true); - - if (!sh->CompileStatus) { - if (sh->InfoLog) { - _mesa_problem(ctx, - "fp64 software impl compile failed:\n%s\nsource:\n%s\n", - sh->InfoLog, float64_source); - } - } - - struct gl_shader_program *sh_prog; - sh_prog = _mesa_new_shader_program(name); - sh_prog->Label = NULL; - sh_prog->NumShaders = 1; - sh_prog->Shaders = malloc(sizeof(struct gl_shader *)); - sh_prog->Shaders[0] = sh; - - struct gl_linked_shader *linked = rzalloc(NULL, struct gl_linked_shader); - linked->Stage = stage; - linked->Program = - brwNewProgram(ctx, - _mesa_shader_stage_to_program(stage), - name, false); - - linked->ir = sh->ir; - sh_prog->_LinkedShaders[stage] = linked; - - nir_shader *nir = glsl_to_nir(sh_prog, stage, options); - - return nir_shader_clone(mem_ctx, nir); -} - nir_shader * brw_create_nir(struct brw_context *brw, const struct gl_shader_program *shader_prog, @@ -160,9 +114,8 @@ brw_create_nir(struct brw_context *brw, if ((options->lower_doubles_options & nir_lower_fp64_full_software) && nir->info.uses_64bit) { - nir_shader *fp64 = compile_fp64_funcs(ctx, options, ralloc_parent(nir), stage); - - nir_validate_shader(fp64, "fp64"); + nir_shader *fp64 = glsl_float64_funcs_to_nir(ctx, options); + ralloc_steal(ralloc_parent(nir), fp64); exec_list_append(&nir->functions, &fp64->functions); } |