소스 검색

gallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.

This will be used by the VC4 driver for doing device-independent
optimization, and hopefully eventually replacing its whole IR.  It also
may be useful to other drivers for the same reason.

v2: Add all of the instructions I was relying on tgsi_lowering to remove,
    and more.
v3: Rebase on SSA rework of the builder.
v4: Use the NIR ineg operation instead of doing a src modifier.
v5: Don't use ineg for fnegs.  (infer_src_type on MOV doesn't do what I
    expect, again).
v6: Fix handling of multi-channel KILL_IF sources.
v7: Make ttn_get_f() return a swizzle of a scalar load_const, rather than
    a vector load_const.  CSE doesn't recognize that srcs out of those
    channels are actually all the same.
v8: Rebase on nir_builder auto-sizing, make the scalar arguments to
    non-ALU instructions actually be scalars.
v9: Add support for if/loop instructions, additional texture targets, and
    untested support for indirect addressing on temps.
v10: Rebase on master, drop bad comment about control flow and just choose
     the X channel, use int comparison opcodes in LIT for now, drop unused
     pipe_context argument..
v11: Fix translation of LRP (previously missed because I mis-translated
     back out), use nir_builder init helpers.
v12: Rebase on master, adding explicit include of mtypes.h to get
     INTERP_QUALIFIER_*
v13: Rebase on variables being in lists instead of hash tables, drop use
     of mtypes.h in favor of util/pipeline.h.  Use Ken's nir_builder
     swizzle and fmov/imov_alu helpers, drop "struct" in front of
     nir_builder, use nir_builder directly as the function arg in a lot of
     cases, drop redundant members of ttn_compile that are also in
     nir_builder, drop some half-baked malloc failure handling.
v14: The indirect uniform src0 should be scalar, not vector (noticed as
     odd by robclark, confirmed by cwabbott).  Apply Ken's review to
     initialize s->num_uniforms and friends, skip ttn_channel for dot
     products, and use the simpler discard_if intrinsic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v13)
Acked-by: Rob Clark <robclark@freedesktop.org>
tags/10.6-branchpoint
Eric Anholt 10 년 전
부모
커밋
783ad697d2
3개의 변경된 파일1454개의 추가작업 그리고 0개의 파일을 삭제
  1. 1
    0
      src/gallium/auxiliary/Makefile.sources
  2. 1423
    0
      src/gallium/auxiliary/nir/tgsi_to_nir.c
  3. 30
    0
      src/gallium/auxiliary/nir/tgsi_to_nir.h

+ 1
- 0
src/gallium/auxiliary/Makefile.sources 파일 보기

@@ -69,6 +69,7 @@ C_SOURCES := \
indices/u_indices_priv.h \
indices/u_primconvert.c \
indices/u_primconvert.h \
nir/tgsi_to_nir.c \
os/os_memory_aligned.h \
os/os_memory_debug.h \
os/os_memory_stdc.h \

+ 1423
- 0
src/gallium/auxiliary/nir/tgsi_to_nir.c
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 30
- 0
src/gallium/auxiliary/nir/tgsi_to_nir.h 파일 보기

@@ -0,0 +1,30 @@
/*
* Copyright © 2014 Broadcom
*
* 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.
*/

#include "glsl/nir/nir.h"

struct nir_shader_compiler_options *options;

struct nir_shader *
tgsi_to_nir(const void *tgsi_tokens,
const struct nir_shader_compiler_options *options);

Loading…
취소
저장