On Wed, May 28, 2014 at 5:36 AM, Topi Pohjolainen <topi.pohjolai...@intel.com> wrote: > Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> > --- > src/mesa/drivers/dri/i965/Makefile.sources | 1 + > src/mesa/drivers/dri/i965/brw_fs.cpp | 44 ----------- > src/mesa/drivers/dri/i965/brw_fs.h | 19 +---- > src/mesa/drivers/dri/i965/brw_fs_emit.h | 33 ++++++++ > src/mesa/drivers/dri/i965/brw_fs_emitter.cpp | 108 > +++++++++++++++++++++++++++ > src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 31 +------- > 6 files changed, 145 insertions(+), 91 deletions(-) > create mode 100644 src/mesa/drivers/dri/i965/brw_fs_emitter.cpp > > diff --git a/src/mesa/drivers/dri/i965/Makefile.sources > b/src/mesa/drivers/dri/i965/Makefile.sources > index 2570059..d43fc8e 100644 > --- a/src/mesa/drivers/dri/i965/Makefile.sources > +++ b/src/mesa/drivers/dri/i965/Makefile.sources > @@ -69,6 +69,7 @@ i965_FILES = \ > brw_fs_sel_peephole.cpp \ > brw_fs_vector_splitting.cpp \ > brw_fs_visitor.cpp \ > + brw_fs_emitter.cpp \
Alphabetize. > brw_gs.c \ > brw_gs_emit.c \ > brw_gs_state.c \ > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index c971480..f3d8dcf 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -661,50 +661,6 @@ fs_visitor::no16(const char *format, ...) > va_end(va); > } > > -fs_inst * > -fs_visitor::emit(enum opcode opcode) > -{ > - return emit(new(mem_ctx) fs_inst(opcode)); > -} > - > -fs_inst * > -fs_visitor::emit(enum opcode opcode, fs_reg dst) > -{ > - return emit(new(mem_ctx) fs_inst(opcode, dst)); > -} > - > -fs_inst * > -fs_visitor::emit(enum opcode opcode, fs_reg dst, fs_reg src0) > -{ > - return emit(new(mem_ctx) fs_inst(opcode, dst, src0)); > -} > - > -fs_inst * > -fs_visitor::emit(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1) > -{ > - return emit(new(mem_ctx) fs_inst(opcode, dst, src0, src1)); > -} > - > -fs_inst * > -fs_visitor::emit(enum opcode opcode, fs_reg dst, > - fs_reg src0, fs_reg src1, fs_reg src2) > -{ > - return emit(new(mem_ctx) fs_inst(opcode, dst, src0, src1, src2)); > -} > - > -void > -fs_visitor::push_force_uncompressed() > -{ > - force_uncompressed_stack++; > -} > - > -void > -fs_visitor::pop_force_uncompressed() > -{ > - force_uncompressed_stack--; > - assert(force_uncompressed_stack >= 0); > -} > - > /** > * Returns true if the instruction has a flag that means it won't > * update an entire destination register. > diff --git a/src/mesa/drivers/dri/i965/brw_fs.h > b/src/mesa/drivers/dri/i965/brw_fs.h > index 6c39368..82af5cd 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.h > +++ b/src/mesa/drivers/dri/i965/brw_fs.h > @@ -69,7 +69,7 @@ namespace brw { > * > * Translates either GLSL IR or Mesa IR (for ARB_fragment_program) into FS > IR. > */ > -class fs_visitor : public backend_visitor, public backend_emitter > +class fs_visitor : public backend_visitor, public fs_emitter > { > public: > > @@ -109,16 +109,6 @@ public: > > bool can_do_source_mods(fs_inst *inst); > > - fs_inst *emit(fs_inst *inst); > - void emit(exec_list list); > - > - fs_inst *emit(enum opcode opcode); > - fs_inst *emit(enum opcode opcode, fs_reg dst); > - fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0); > - fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1); > - fs_inst *emit(enum opcode opcode, fs_reg dst, > - fs_reg src0, fs_reg src1, fs_reg src2); > - > fs_inst *MOV(fs_reg dst, fs_reg src); > fs_inst *NOT(fs_reg dst, fs_reg src); > fs_inst *RNDD(fs_reg dst, fs_reg src); > @@ -207,9 +197,6 @@ public: > void no16(const char *msg, ...); > void lower_uniform_pull_constant_loads(); > > - void push_force_uncompressed(); > - void pop_force_uncompressed(); > - > void emit_dummy_fs(); > fs_reg *emit_fragcoord_interpolation(ir_variable *ir); > fs_inst *emit_linterp(const fs_reg &attr, const fs_reg &interp, > @@ -381,10 +368,6 @@ public: > > int grf_used; > bool spilled_any_registers; > - > - const unsigned dispatch_width; /**< 8 or 16 */ > - > - int force_uncompressed_stack; > }; > > /** > diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.h > b/src/mesa/drivers/dri/i965/brw_fs_emit.h > index 1b1e584..d24e137 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_emit.h > +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.h > @@ -31,6 +31,7 @@ > extern "C" { > #include <sys/types.h> > #include "brw_shader.h" > +#include "brw_context.h" > } > > #include "glsl/glsl_types.h" > @@ -217,4 +218,36 @@ public: > bool force_writemask_all:1; > }; > > +class fs_emitter : public backend_emitter > +{ > +protected: > + fs_emitter(struct brw_context *brw, void *mem_ctx, > + unsigned dispatch_width); > + > +public: > + const unsigned dispatch_width; /**< 8 or 16 */ > + > + fs_inst *emit(enum opcode opcode); > + fs_inst *emit(enum opcode opcode, fs_reg dst); > + fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0); > + fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1); > + fs_inst *emit(enum opcode opcode, fs_reg dst, > + fs_reg src0, fs_reg src1, fs_reg src2); > + > + fs_inst *emit(fs_inst *inst); > + > +protected: > + void emit(exec_list list); > + > + void push_force_uncompressed(); > + void pop_force_uncompressed(); > + > + /** @{ debug annotation info */ > + const char *current_annotation; > + const void *base_ir; > + /** @} */ > + > + int force_uncompressed_stack; > +}; > + > #endif /* BRW_FS_EMIT_H */ > diff --git a/src/mesa/drivers/dri/i965/brw_fs_emitter.cpp > b/src/mesa/drivers/dri/i965/brw_fs_emitter.cpp > new file mode 100644 > index 0000000..4feef55 > --- /dev/null > +++ b/src/mesa/drivers/dri/i965/brw_fs_emitter.cpp > @@ -0,0 +1,108 @@ > +/* > + * Copyright © 2014 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > DEALINGS > + * IN THE SOFTWARE. > + */ > + > +/** @file brw_fs_emitter.cpp > + * > + * This file supports generating the FS LIR. The LIR makes it easier to do > + * backend-specific optimizations than doing so in the GLSL IR or in the > + * native code. This description should be updated. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev