diff options
author | Kenneth Graunke <[email protected]> | 2016-03-15 16:21:36 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-03-16 23:57:11 -0700 |
commit | a7e9b31d5bf98bdaabbb8b5c2459eb2c3a0af579 (patch) | |
tree | 3d92aa7ecb9a4adb0171675c1a986a29d16dbfdc | |
parent | 2b9f0dffe00bdc556436da02c099b8a50ecc4f49 (diff) |
meta: Use the _mesa_meta_compile_and_link_program helper more places.
Less boilerplate.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r-- | src/mesa/drivers/common/meta.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_meta_fast_clear.c | 14 |
2 files changed, 8 insertions, 40 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b05dfc725f5..bdcf316e455 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1537,21 +1537,8 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) if (clear->ShaderProg != 0) return; - vs = _mesa_CreateShader(GL_VERTEX_SHADER); - _mesa_ShaderSource(vs, 1, &vs_source, NULL); - _mesa_CompileShader(vs); - - fs = _mesa_CreateShader(GL_FRAGMENT_SHADER); - _mesa_ShaderSource(fs, 1, &fs_source, NULL); - _mesa_CompileShader(fs); - - clear->ShaderProg = _mesa_CreateProgram(); - _mesa_AttachShader(clear->ShaderProg, fs); - _mesa_DeleteShader(fs); - _mesa_AttachShader(clear->ShaderProg, vs); - _mesa_DeleteShader(vs); - _mesa_ObjectLabel(GL_PROGRAM, clear->ShaderProg, -1, "meta clear"); - _mesa_LinkProgram(clear->ShaderProg); + _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source, "meta clear", + &clear->ShaderProg); has_integer_textures = _mesa_is_gles3(ctx) || (_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130); @@ -1585,26 +1572,15 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) " out_color = color;\n" "}\n"); - vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, - vs_int_source); - fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, - fs_int_source); + _mesa_meta_compile_and_link_program(ctx, vs_int_source, fs_int_source, + "integer clear", + &clear->IntegerShaderProg); ralloc_free(shader_source_mem_ctx); - clear->IntegerShaderProg = _mesa_CreateProgram(); - _mesa_AttachShader(clear->IntegerShaderProg, fs); - _mesa_DeleteShader(fs); - _mesa_AttachShader(clear->IntegerShaderProg, vs); - _mesa_DeleteShader(vs); - /* Note that user-defined out attributes get automatically assigned * locations starting from 0, so we don't need to explicitly * BindFragDataLocation to 0. */ - - _mesa_ObjectLabel(GL_PROGRAM, clear->IntegerShaderProg, -1, - "integer clear"); - _mesa_meta_link_program_with_debug(ctx, clear->IntegerShaderProg); } } diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c index fe61c1654d2..e2882da403d 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c +++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c @@ -127,7 +127,6 @@ brw_bind_rep_write_shader(struct brw_context *brw, float *color) " gl_FragColor = color;\n" "}\n"; - GLuint vs, fs; struct brw_fast_clear_state *clear = brw->fast_clear_state; struct gl_context *ctx = &brw->ctx; @@ -137,16 +136,9 @@ brw_bind_rep_write_shader(struct brw_context *brw, float *color) return; } - vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source); - fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source); - - clear->shader_prog = _mesa_CreateProgram(); - _mesa_AttachShader(clear->shader_prog, fs); - _mesa_DeleteShader(fs); - _mesa_AttachShader(clear->shader_prog, vs); - _mesa_DeleteShader(vs); - _mesa_ObjectLabel(GL_PROGRAM, clear->shader_prog, -1, "meta repclear"); - _mesa_LinkProgram(clear->shader_prog); + _mesa_meta_compile_and_link_program(ctx, vs_source, fs_source, + "meta repclear", + &clear->shader_prog); clear->color_location = _mesa_GetUniformLocation(clear->shader_prog, "color"); |