Lines Matching refs:emit
55 svga_shader_expand(struct svga_shader_emitter *emit) in svga_shader_expand() argument
58 unsigned newsize = emit->size * 2; in svga_shader_expand()
60 if (emit->buf != err_buf) in svga_shader_expand()
61 new_buf = REALLOC(emit->buf, emit->size, newsize); in svga_shader_expand()
66 emit->ptr = err_buf; in svga_shader_expand()
67 emit->buf = err_buf; in svga_shader_expand()
68 emit->size = sizeof(err_buf); in svga_shader_expand()
72 emit->size = newsize; in svga_shader_expand()
73 emit->ptr = new_buf + (emit->ptr - emit->buf); in svga_shader_expand()
74 emit->buf = new_buf; in svga_shader_expand()
80 reserve(struct svga_shader_emitter *emit, unsigned nr_dwords) in reserve() argument
82 if (emit->ptr - emit->buf + nr_dwords * sizeof(unsigned) >= emit->size) { in reserve()
83 if (!svga_shader_expand(emit)) { in reserve()
93 svga_shader_emit_dword(struct svga_shader_emitter * emit, unsigned dword) in svga_shader_emit_dword() argument
95 if (!reserve(emit, 1)) in svga_shader_emit_dword()
98 *(unsigned *) emit->ptr = dword; in svga_shader_emit_dword()
99 emit->ptr += sizeof dword; in svga_shader_emit_dword()
105 svga_shader_emit_dwords(struct svga_shader_emitter * emit, in svga_shader_emit_dwords() argument
108 if (!reserve(emit, nr)) in svga_shader_emit_dwords()
111 memcpy(emit->ptr, dwords, nr * sizeof *dwords); in svga_shader_emit_dwords()
112 emit->ptr += nr * sizeof *dwords; in svga_shader_emit_dwords()
118 svga_shader_emit_opcode(struct svga_shader_emitter * emit, unsigned opcode) in svga_shader_emit_opcode() argument
122 if (!reserve(emit, 1)) in svga_shader_emit_opcode()
125 here = (SVGA3dShaderInstToken *) emit->ptr; in svga_shader_emit_opcode()
128 if (emit->insn_offset) { in svga_shader_emit_opcode()
130 (SVGA3dShaderInstToken *) (emit->buf + emit->insn_offset); in svga_shader_emit_opcode()
134 emit->insn_offset = emit->ptr - emit->buf; in svga_shader_emit_opcode()
135 emit->ptr += sizeof(unsigned); in svga_shader_emit_opcode()
141 svga_shader_emit_header(struct svga_shader_emitter *emit) in svga_shader_emit_header() argument
147 switch (emit->unit) { in svga_shader_emit_header()
156 return svga_shader_emit_dword(emit, header.value); in svga_shader_emit_header()
175 struct svga_shader_emitter emit; in svga_tgsi_vgpu9_translate() local
179 memset(&emit, 0, sizeof(emit)); in svga_tgsi_vgpu9_translate()
181 emit.size = 1024; in svga_tgsi_vgpu9_translate()
182 emit.buf = MALLOC(emit.size); in svga_tgsi_vgpu9_translate()
183 if (emit.buf == NULL) { in svga_tgsi_vgpu9_translate()
187 emit.ptr = emit.buf; in svga_tgsi_vgpu9_translate()
188 emit.unit = unit; in svga_tgsi_vgpu9_translate()
189 emit.key = *key; in svga_tgsi_vgpu9_translate()
191 tgsi_scan_shader(shader->tokens, &emit.info); in svga_tgsi_vgpu9_translate()
193 emit.imm_start = emit.info.file_max[TGSI_FILE_CONSTANT] + 1; in svga_tgsi_vgpu9_translate()
196 emit.imm_start += key->num_unnormalized_coords; in svga_tgsi_vgpu9_translate()
199 emit.imm_start += key->vs.need_prescale ? 2 : 0; in svga_tgsi_vgpu9_translate()
202 emit.nr_hw_float_const = in svga_tgsi_vgpu9_translate()
203 (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1); in svga_tgsi_vgpu9_translate()
205 emit.nr_hw_temp = emit.info.file_max[TGSI_FILE_TEMPORARY] + 1; in svga_tgsi_vgpu9_translate()
207 if (emit.nr_hw_temp >= SVGA3D_TEMPREG_MAX) { in svga_tgsi_vgpu9_translate()
209 emit.nr_hw_temp); in svga_tgsi_vgpu9_translate()
213 if (emit.info.indirect_files & (1 << TGSI_FILE_TEMPORARY)) { in svga_tgsi_vgpu9_translate()
219 emit.in_main_func = TRUE; in svga_tgsi_vgpu9_translate()
221 if (!svga_shader_emit_header(&emit)) { in svga_tgsi_vgpu9_translate()
226 if (!svga_shader_emit_instructions(&emit, shader->tokens)) { in svga_tgsi_vgpu9_translate()
236 variant->tokens = (const unsigned *) emit.buf; in svga_tgsi_vgpu9_translate()
237 variant->nr_tokens = (emit.ptr - emit.buf) / sizeof(unsigned); in svga_tgsi_vgpu9_translate()
244 fs_variant->pstipple_sampler_unit = emit.pstipple_sampler_unit; in svga_tgsi_vgpu9_translate()
251 emit.constant_color_output && emit.num_output_writes == 1; in svga_tgsi_vgpu9_translate()
272 if (emit.buf != err_buf) in svga_tgsi_vgpu9_translate()
273 FREE(emit.buf); in svga_tgsi_vgpu9_translate()