nv/codegen: Merge from_common into from_nir
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24791>
This commit is contained in:
@@ -25,8 +25,6 @@ files_libnouveau_codegen = files(
|
||||
'nv50_ir_build_util.h',
|
||||
'nv50_ir_driver.h',
|
||||
'nv50_ir_emit_nv50.cpp',
|
||||
'nv50_ir_from_common.cpp',
|
||||
'nv50_ir_from_common.h',
|
||||
'nv50_ir_from_nir.cpp',
|
||||
'nv50_ir_graph.cpp',
|
||||
'nv50_ir_graph.h',
|
||||
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Christoph Bumiller
|
||||
*
|
||||
* 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 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 "nv50_ir_from_common.h"
|
||||
|
||||
namespace nv50_ir {
|
||||
|
||||
ConverterCommon::ConverterCommon(Program *prog, nv50_ir_prog_info *info,
|
||||
nv50_ir_prog_info_out *info_out)
|
||||
: BuildUtil(prog),
|
||||
info(info),
|
||||
info_out(info_out) {}
|
||||
|
||||
uint8_t
|
||||
ConverterCommon::translateInterpMode(const struct nv50_ir_varying *var, operation& op)
|
||||
{
|
||||
uint8_t mode = NV50_IR_INTERP_PERSPECTIVE;
|
||||
|
||||
if (var->flat)
|
||||
mode = NV50_IR_INTERP_FLAT;
|
||||
else
|
||||
if (var->linear)
|
||||
mode = NV50_IR_INTERP_LINEAR;
|
||||
else
|
||||
if (var->sc)
|
||||
mode = NV50_IR_INTERP_SC;
|
||||
|
||||
op = (mode == NV50_IR_INTERP_PERSPECTIVE || mode == NV50_IR_INTERP_SC)
|
||||
? OP_PINTERP : OP_LINTERP;
|
||||
|
||||
if (var->centroid)
|
||||
mode |= NV50_IR_INTERP_CENTROID;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
} // namespace nv50_ir
|
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011 Christoph Bumiller
|
||||
*
|
||||
* 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 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 "nv50_ir.h"
|
||||
#include "nv50_ir_build_util.h"
|
||||
|
||||
namespace nv50_ir {
|
||||
|
||||
class ConverterCommon : public BuildUtil
|
||||
{
|
||||
public:
|
||||
ConverterCommon(Program *, nv50_ir_prog_info *, nv50_ir_prog_info_out *);
|
||||
protected:
|
||||
uint8_t translateInterpMode(const struct nv50_ir_varying *var, operation& op);
|
||||
|
||||
struct nv50_ir_prog_info *info;
|
||||
struct nv50_ir_prog_info_out *info_out;
|
||||
Value *outBase; // base address of vertex out patch (for TCP)
|
||||
};
|
||||
|
||||
} // namespace nv50_ir
|
@@ -29,7 +29,6 @@
|
||||
#include "util/u_prim.h"
|
||||
|
||||
#include "nv50_ir.h"
|
||||
#include "nv50_ir_from_common.h"
|
||||
#include "nv50_ir_lowering_helper.h"
|
||||
#include "nv50_ir_target.h"
|
||||
#include "nv50_ir_util.h"
|
||||
@@ -94,7 +93,7 @@ nv50_nir_lower_load_user_clip_plane(nir_shader *nir, struct nv50_ir_prog_info *i
|
||||
info);
|
||||
}
|
||||
|
||||
class Converter : public ConverterCommon
|
||||
class Converter : public BuildUtil
|
||||
{
|
||||
public:
|
||||
Converter(Program *, nir_shader *, nv50_ir_prog_info *, nv50_ir_prog_info_out *);
|
||||
@@ -132,6 +131,7 @@ private:
|
||||
|
||||
uint32_t getSlotAddress(nir_intrinsic_instr *, uint8_t idx, uint8_t slot);
|
||||
|
||||
uint8_t translateInterpMode(const struct nv50_ir_varying *var, operation& op);
|
||||
void setInterpolate(nv50_ir_varying *,
|
||||
uint8_t,
|
||||
bool centroid,
|
||||
@@ -191,6 +191,9 @@ private:
|
||||
// tex stuff
|
||||
unsigned int getNIRArgCount(TexInstruction::Target&);
|
||||
|
||||
struct nv50_ir_prog_info *info;
|
||||
struct nv50_ir_prog_info_out *info_out;
|
||||
|
||||
nir_shader *nir;
|
||||
|
||||
NirDefMap ssaDefs;
|
||||
@@ -205,6 +208,7 @@ private:
|
||||
Instruction *immInsertPos;
|
||||
|
||||
int clipVertexOutput;
|
||||
Value *outBase; // base address of vertex out patch (for TCP)
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -215,13 +219,16 @@ private:
|
||||
|
||||
Converter::Converter(Program *prog, nir_shader *nir, nv50_ir_prog_info *info,
|
||||
nv50_ir_prog_info_out *info_out)
|
||||
: ConverterCommon(prog, info, info_out),
|
||||
: BuildUtil(prog),
|
||||
info(info),
|
||||
info_out(info_out),
|
||||
nir(nir),
|
||||
curLoopDepth(0),
|
||||
curIfDepth(0),
|
||||
exit(NULL),
|
||||
immInsertPos(NULL),
|
||||
clipVertexOutput(-1)
|
||||
clipVertexOutput(-1),
|
||||
outBase(nullptr)
|
||||
{
|
||||
zero = mkImm((uint32_t)0);
|
||||
}
|
||||
@@ -832,6 +839,29 @@ vert_attrib_to_tgsi_semantic(gl_vert_attrib slot, unsigned *name, unsigned *inde
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
Converter::translateInterpMode(const struct nv50_ir_varying *var, operation& op)
|
||||
{
|
||||
uint8_t mode = NV50_IR_INTERP_PERSPECTIVE;
|
||||
|
||||
if (var->flat)
|
||||
mode = NV50_IR_INTERP_FLAT;
|
||||
else
|
||||
if (var->linear)
|
||||
mode = NV50_IR_INTERP_LINEAR;
|
||||
else
|
||||
if (var->sc)
|
||||
mode = NV50_IR_INTERP_SC;
|
||||
|
||||
op = (mode == NV50_IR_INTERP_PERSPECTIVE || mode == NV50_IR_INTERP_SC)
|
||||
? OP_PINTERP : OP_LINTERP;
|
||||
|
||||
if (var->centroid)
|
||||
mode |= NV50_IR_INTERP_CENTROID;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
void
|
||||
Converter::setInterpolate(nv50_ir_varying *var,
|
||||
uint8_t mode,
|
||||
|
Reference in New Issue
Block a user