2016-09-26 07:00:19 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-09-29 00:10:14 +00:00
|
|
|
#include "r_compiler/llvmdrawers.h"
|
2016-09-28 16:49:39 +00:00
|
|
|
#include "r_compiler/ssa/ssa_value.h"
|
2016-09-26 07:00:19 +00:00
|
|
|
#include "r_compiler/ssa/ssa_vec4f.h"
|
|
|
|
#include "r_compiler/ssa/ssa_vec4i.h"
|
|
|
|
#include "r_compiler/ssa/ssa_vec8s.h"
|
|
|
|
#include "r_compiler/ssa/ssa_vec16ub.h"
|
|
|
|
#include "r_compiler/ssa/ssa_int.h"
|
2016-09-28 03:18:16 +00:00
|
|
|
#include "r_compiler/ssa/ssa_int_ptr.h"
|
2016-09-27 20:54:37 +00:00
|
|
|
#include "r_compiler/ssa/ssa_short.h"
|
2016-09-26 07:00:19 +00:00
|
|
|
#include "r_compiler/ssa/ssa_ubyte_ptr.h"
|
|
|
|
#include "r_compiler/ssa/ssa_vec4f_ptr.h"
|
|
|
|
#include "r_compiler/ssa/ssa_vec4i_ptr.h"
|
|
|
|
#include "r_compiler/ssa/ssa_pixels.h"
|
|
|
|
#include "r_compiler/ssa/ssa_stack.h"
|
|
|
|
#include "r_compiler/ssa/ssa_barycentric_weight.h"
|
|
|
|
#include "r_compiler/llvm_include.h"
|
|
|
|
|
2016-09-28 03:18:16 +00:00
|
|
|
class SSAShadeConstants
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SSAVec4i light;
|
|
|
|
SSAVec4i fade;
|
|
|
|
SSAInt desaturate;
|
2016-09-27 20:54:37 +00:00
|
|
|
};
|
|
|
|
|
2016-09-28 16:49:39 +00:00
|
|
|
class DrawerCodegen
|
2016-09-26 07:00:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-09-28 03:18:16 +00:00
|
|
|
// LightBgra
|
|
|
|
SSAInt calc_light_multiplier(SSAInt light);
|
|
|
|
SSAVec4i shade_pal_index_simple(SSAInt index, SSAInt light, SSAUBytePtr basecolors);
|
|
|
|
SSAVec4i shade_pal_index_advanced(SSAInt index, SSAInt light, const SSAShadeConstants &constants, SSAUBytePtr basecolors);
|
|
|
|
SSAVec4i shade_bgra_simple(SSAVec4i color, SSAInt light);
|
|
|
|
SSAVec4i shade_bgra_advanced(SSAVec4i color, SSAInt light, const SSAShadeConstants &constants);
|
|
|
|
|
|
|
|
// BlendBgra
|
|
|
|
SSAVec4i blend_copy(SSAVec4i fg);
|
|
|
|
SSAVec4i blend_add(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha, SSAInt destalpha);
|
|
|
|
SSAVec4i blend_sub(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha, SSAInt destalpha);
|
|
|
|
SSAVec4i blend_revsub(SSAVec4i fg, SSAVec4i bg, SSAInt srcalpha, SSAInt destalpha);
|
|
|
|
SSAVec4i blend_alpha_blend(SSAVec4i fg, SSAVec4i bg);
|
|
|
|
|
|
|
|
// SampleBgra
|
|
|
|
SSAVec4i sample_linear(SSAUBytePtr col0, SSAUBytePtr col1, SSAInt texturefracx, SSAInt texturefracy, SSAInt one, SSAInt height);
|
|
|
|
SSAVec4i sample_linear(SSAUBytePtr texture, SSAInt xfrac, SSAInt yfrac, SSAInt xbits, SSAInt ybits);
|
2016-09-26 07:00:19 +00:00
|
|
|
};
|
|
|
|
|
2016-09-28 16:49:39 +00:00
|
|
|
class DrawSpanCodegen : public DrawerCodegen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Generate(SSAValue args);
|
2016-09-26 07:00:19 +00:00
|
|
|
|
2016-09-28 16:49:39 +00:00
|
|
|
private:
|
|
|
|
void LoopShade(bool isSimpleShade);
|
|
|
|
void LoopFilter(bool isSimpleShade, bool isNearestFilter);
|
|
|
|
SSAInt Loop4x(bool isSimpleShade, bool isNearestFilter, bool is64x64);
|
|
|
|
void Loop(SSAInt start, bool isSimpleShade, bool isNearestFilter, bool is64x64);
|
|
|
|
SSAVec4i Sample(SSAInt xfrac, SSAInt yfrac, bool isNearestFilter, bool is64x64);
|
|
|
|
|
|
|
|
SSAStack<SSAInt> stack_index, stack_xfrac, stack_yfrac;
|
|
|
|
|
|
|
|
SSAUBytePtr destorg;
|
|
|
|
SSAUBytePtr source;
|
|
|
|
SSAInt destpitch;
|
|
|
|
SSAInt xstep;
|
|
|
|
SSAInt ystep;
|
|
|
|
SSAInt x1;
|
|
|
|
SSAInt x2;
|
|
|
|
SSAInt y;
|
|
|
|
SSAInt xbits;
|
|
|
|
SSAInt ybits;
|
|
|
|
SSAInt light;
|
|
|
|
SSAInt srcalpha;
|
|
|
|
SSAInt destalpha;
|
|
|
|
SSAInt count;
|
|
|
|
SSAUBytePtr data;
|
|
|
|
SSAInt yshift;
|
|
|
|
SSAInt xshift;
|
|
|
|
SSAInt xmask;
|
|
|
|
SSABool is_64x64;
|
|
|
|
SSABool is_simple_shade;
|
|
|
|
SSABool is_nearest_filter;
|
|
|
|
SSAShadeConstants shade_constants;
|
|
|
|
};
|