Create LLVMDrawers class as the external interface to the drawers
This commit is contained in:
parent
3aea3a0bee
commit
bfa291b02f
8 changed files with 302 additions and 226 deletions
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "r_compiler/llvmdrawers.h"
|
||||
#include "r_compiler/ssa/ssa_value.h"
|
||||
#include "r_compiler/ssa/ssa_vec4f.h"
|
||||
#include "r_compiler/ssa/ssa_vec4i.h"
|
||||
|
|
@ -17,66 +18,6 @@
|
|||
#include "r_compiler/ssa/ssa_barycentric_weight.h"
|
||||
#include "r_compiler/llvm_include.h"
|
||||
|
||||
class RenderProgram
|
||||
{
|
||||
public:
|
||||
RenderProgram();
|
||||
~RenderProgram();
|
||||
|
||||
template<typename Func>
|
||||
Func *GetProcAddress(const char *name) { return reinterpret_cast<Func*>(PointerToFunction(name)); }
|
||||
|
||||
llvm::LLVMContext &context() { return *mContext; }
|
||||
llvm::Module *module() { return mModule; }
|
||||
llvm::ExecutionEngine *engine() { return mEngine.get(); }
|
||||
llvm::legacy::PassManager *modulePassManager() { return mModulePassManager.get(); }
|
||||
llvm::legacy::FunctionPassManager *functionPassManager() { return mFunctionPassManager.get(); }
|
||||
|
||||
private:
|
||||
void *PointerToFunction(const char *name);
|
||||
|
||||
std::unique_ptr<llvm::LLVMContext> mContext;
|
||||
llvm::Module *mModule;
|
||||
std::unique_ptr<llvm::ExecutionEngine> mEngine;
|
||||
std::unique_ptr<llvm::legacy::PassManager> mModulePassManager;
|
||||
std::unique_ptr<llvm::legacy::FunctionPassManager> mFunctionPassManager;
|
||||
};
|
||||
|
||||
struct RenderArgs
|
||||
{
|
||||
uint32_t *destorg;
|
||||
const uint32_t *source;
|
||||
int32_t destpitch;
|
||||
int32_t xfrac;
|
||||
int32_t yfrac;
|
||||
int32_t xstep;
|
||||
int32_t ystep;
|
||||
int32_t x1;
|
||||
int32_t x2;
|
||||
int32_t y;
|
||||
int32_t xbits;
|
||||
int32_t ybits;
|
||||
uint32_t light;
|
||||
uint32_t srcalpha;
|
||||
uint32_t destalpha;
|
||||
|
||||
uint16_t light_alpha;
|
||||
uint16_t light_red;
|
||||
uint16_t light_green;
|
||||
uint16_t light_blue;
|
||||
uint16_t fade_alpha;
|
||||
uint16_t fade_red;
|
||||
uint16_t fade_green;
|
||||
uint16_t fade_blue;
|
||||
uint16_t desaturate;
|
||||
uint32_t flags;
|
||||
enum Flags
|
||||
{
|
||||
simple_shade = 1,
|
||||
nearest_filter = 2
|
||||
};
|
||||
};
|
||||
|
||||
class SSAShadeConstants
|
||||
{
|
||||
public:
|
||||
|
|
@ -144,18 +85,3 @@ private:
|
|||
SSABool is_nearest_filter;
|
||||
SSAShadeConstants shade_constants;
|
||||
};
|
||||
|
||||
class FixedFunction
|
||||
{
|
||||
public:
|
||||
FixedFunction();
|
||||
|
||||
void(*DrawSpan)(const RenderArgs *) = nullptr;
|
||||
|
||||
private:
|
||||
void CodegenDrawSpan();
|
||||
|
||||
static llvm::Type *GetRenderArgsStruct(llvm::LLVMContext &context);
|
||||
|
||||
RenderProgram mProgram;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue