mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 14:20:11 +01:00
i965: Move brw_fs_precompile() to brw_wm.c
All other precompile functions live in the brw_<stage>.c files, make fs follow the convention. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
This commit is contained in:
parent
dc70c86b9b
commit
84f2ed2cfd
2 changed files with 59 additions and 58 deletions
|
|
@ -5240,64 +5240,6 @@ brw_wm_fs_emit(struct brw_context *brw,
|
|||
return g.get_assembly(final_assembly_size);
|
||||
}
|
||||
|
||||
extern "C" bool
|
||||
brw_fs_precompile(struct gl_context *ctx,
|
||||
struct gl_shader_program *shader_prog,
|
||||
struct gl_program *prog)
|
||||
{
|
||||
struct brw_context *brw = brw_context(ctx);
|
||||
struct brw_wm_prog_key key;
|
||||
|
||||
struct gl_fragment_program *fp = (struct gl_fragment_program *) prog;
|
||||
struct brw_fragment_program *bfp = brw_fragment_program(fp);
|
||||
bool program_uses_dfdy = fp->UsesDFdy;
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
if (brw->gen < 6) {
|
||||
if (fp->UsesKill)
|
||||
key.iz_lookup |= IZ_PS_KILL_ALPHATEST_BIT;
|
||||
|
||||
if (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
|
||||
key.iz_lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
|
||||
|
||||
/* Just assume depth testing. */
|
||||
key.iz_lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
|
||||
key.iz_lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
|
||||
}
|
||||
|
||||
if (brw->gen < 6 || _mesa_bitcount_64(fp->Base.InputsRead &
|
||||
BRW_FS_VARYING_INPUT_MASK) > 16)
|
||||
key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;
|
||||
|
||||
brw_setup_tex_for_precompile(brw, &key.tex, &fp->Base);
|
||||
|
||||
if (fp->Base.InputsRead & VARYING_BIT_POS) {
|
||||
key.drawable_height = ctx->DrawBuffer->Height;
|
||||
}
|
||||
|
||||
key.nr_color_regions = _mesa_bitcount_64(fp->Base.OutputsWritten &
|
||||
~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
|
||||
BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)));
|
||||
|
||||
if ((fp->Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
|
||||
key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer) ||
|
||||
key.nr_color_regions > 1;
|
||||
}
|
||||
|
||||
key.program_string_id = bfp->id;
|
||||
|
||||
uint32_t old_prog_offset = brw->wm.base.prog_offset;
|
||||
struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data;
|
||||
|
||||
bool success = brw_codegen_wm_prog(brw, shader_prog, bfp, &key);
|
||||
|
||||
brw->wm.base.prog_offset = old_prog_offset;
|
||||
brw->wm.prog_data = old_prog_data;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
fs_reg *
|
||||
fs_visitor::emit_cs_local_invocation_id_setup()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "brw_context.h"
|
||||
#include "brw_wm.h"
|
||||
#include "brw_state.h"
|
||||
#include "brw_shader.h"
|
||||
#include "main/enums.h"
|
||||
#include "main/formats.h"
|
||||
#include "main/fbobject.h"
|
||||
|
|
@ -642,3 +643,61 @@ brw_upload_wm_prog(struct brw_context *brw)
|
|||
}
|
||||
brw->wm.base.prog_data = &brw->wm.prog_data->base;
|
||||
}
|
||||
|
||||
bool
|
||||
brw_fs_precompile(struct gl_context *ctx,
|
||||
struct gl_shader_program *shader_prog,
|
||||
struct gl_program *prog)
|
||||
{
|
||||
struct brw_context *brw = brw_context(ctx);
|
||||
struct brw_wm_prog_key key;
|
||||
|
||||
struct gl_fragment_program *fp = (struct gl_fragment_program *) prog;
|
||||
struct brw_fragment_program *bfp = brw_fragment_program(fp);
|
||||
bool program_uses_dfdy = fp->UsesDFdy;
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
|
||||
if (brw->gen < 6) {
|
||||
if (fp->UsesKill)
|
||||
key.iz_lookup |= IZ_PS_KILL_ALPHATEST_BIT;
|
||||
|
||||
if (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
|
||||
key.iz_lookup |= IZ_PS_COMPUTES_DEPTH_BIT;
|
||||
|
||||
/* Just assume depth testing. */
|
||||
key.iz_lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
|
||||
key.iz_lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
|
||||
}
|
||||
|
||||
if (brw->gen < 6 || _mesa_bitcount_64(fp->Base.InputsRead &
|
||||
BRW_FS_VARYING_INPUT_MASK) > 16)
|
||||
key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;
|
||||
|
||||
brw_setup_tex_for_precompile(brw, &key.tex, &fp->Base);
|
||||
|
||||
if (fp->Base.InputsRead & VARYING_BIT_POS) {
|
||||
key.drawable_height = ctx->DrawBuffer->Height;
|
||||
}
|
||||
|
||||
key.nr_color_regions = _mesa_bitcount_64(fp->Base.OutputsWritten &
|
||||
~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
|
||||
BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)));
|
||||
|
||||
if ((fp->Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
|
||||
key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer) ||
|
||||
key.nr_color_regions > 1;
|
||||
}
|
||||
|
||||
key.program_string_id = bfp->id;
|
||||
|
||||
uint32_t old_prog_offset = brw->wm.base.prog_offset;
|
||||
struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data;
|
||||
|
||||
bool success = brw_codegen_wm_prog(brw, shader_prog, bfp, &key);
|
||||
|
||||
brw->wm.base.prog_offset = old_prog_offset;
|
||||
brw->wm.prog_data = old_prog_data;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue