mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 00:20:11 +01:00
freedreno: add tgsi lowering pass
Currently lowers the following instructions: DST, XPD, SCS, LRP, FRC, POW, LIT, EXP, LOG, DP4, DP3, DPH, DP2 translating these into equivalent simpler TGSI instructions. This probably should be moved to util so other drivers can use it, but just adding under freedreno for now so that I can clear out a lot of the lowering code in a3xx compiler before beginning to add new compiler. Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
parent
7524756199
commit
0f2df4ff90
4 changed files with 1229 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
C_SOURCES := \
|
||||
freedreno_util.c \
|
||||
freedreno_lowering.c \
|
||||
freedreno_query.c \
|
||||
freedreno_fence.c \
|
||||
freedreno_resource.c \
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
#include "tgsi/tgsi_dump.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
||||
#include "freedreno_lowering.h"
|
||||
|
||||
#include "fd3_program.h"
|
||||
#include "fd3_compiler.h"
|
||||
#include "fd3_emit.h"
|
||||
|
|
@ -87,6 +89,7 @@ create_shader(struct pipe_context *pctx, const struct pipe_shader_state *cso,
|
|||
enum shader_t type)
|
||||
{
|
||||
struct fd3_shader_stateobj *so = CALLOC_STRUCT(fd3_shader_stateobj);
|
||||
const struct tgsi_token *tokens = fd_transform_lowering(cso->tokens);
|
||||
int ret;
|
||||
|
||||
if (!so)
|
||||
|
|
@ -96,13 +99,13 @@ create_shader(struct pipe_context *pctx, const struct pipe_shader_state *cso,
|
|||
|
||||
if (fd_mesa_debug & FD_DBG_DISASM) {
|
||||
DBG("dump tgsi: type=%d", so->type);
|
||||
tgsi_dump(cso->tokens, 0);
|
||||
tgsi_dump(tokens, 0);
|
||||
}
|
||||
|
||||
if ((type == SHADER_FRAGMENT) && (fd_mesa_debug & FD_DBG_FRAGHALF))
|
||||
so->half_precision = true;
|
||||
|
||||
ret = fd3_compile_shader(so, cso->tokens);
|
||||
ret = fd3_compile_shader(so, tokens);
|
||||
if (ret) {
|
||||
debug_error("compile failed!");
|
||||
goto fail;
|
||||
|
|
|
|||
1187
src/gallium/drivers/freedreno/freedreno_lowering.c
Normal file
1187
src/gallium/drivers/freedreno/freedreno_lowering.c
Normal file
File diff suppressed because it is too large
Load diff
36
src/gallium/drivers/freedreno/freedreno_lowering.h
Normal file
36
src/gallium/drivers/freedreno/freedreno_lowering.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 Rob Clark <robclark@freedesktop.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Rob Clark <robclark@freedesktop.org>
|
||||
*/
|
||||
|
||||
#ifndef FREEDRENO_LOWERING_H_
|
||||
#define FREEDRENO_LOWERING_H_
|
||||
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
|
||||
const struct tgsi_token * fd_transform_lowering(const struct tgsi_token *tokens);
|
||||
|
||||
#endif /* FREEDRENO_LOWERING_H_ */
|
||||
Loading…
Add table
Reference in a new issue