mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
Add support for repeating skies in the TC sky drawer
This commit is contained in:
parent
8788a9e788
commit
111b5c5469
5 changed files with 29 additions and 6 deletions
|
@ -329,6 +329,7 @@ namespace swrenderer
|
|||
args.textureheight1 = dc_wall_sourceheight[1];
|
||||
args.top_color = solid_top;
|
||||
args.bottom_color = solid_bottom;
|
||||
args.flags = fadeSky ? DrawSkyArgs::fade_sky : 0;
|
||||
|
||||
DetectRangeError(args.dest, args.dest_y, args.count);
|
||||
}
|
||||
|
|
|
@ -200,6 +200,11 @@ struct DrawSkyArgs
|
|||
uint32_t textureheight1;
|
||||
uint32_t top_color;
|
||||
uint32_t bottom_color;
|
||||
uint32_t flags;
|
||||
enum Flags
|
||||
{
|
||||
fade_sky = 1
|
||||
};
|
||||
|
||||
FString ToString();
|
||||
};
|
||||
|
|
|
@ -47,12 +47,15 @@ void DrawSkyCodegen::Generate(DrawSkyVariant variant, SSAValue args, SSAValue th
|
|||
maxtextureheight1 = textureheight1 - 1;
|
||||
top_color = SSAVec4i::unpack(args[0][22].load(true));
|
||||
bottom_color = SSAVec4i::unpack(args[0][23].load(true));
|
||||
SSAInt flags = args[0][24].load(true);
|
||||
|
||||
thread.core = thread_data[0][0].load(true);
|
||||
thread.num_cores = thread_data[0][1].load(true);
|
||||
thread.pass_start_y = thread_data[0][2].load(true);
|
||||
thread.pass_end_y = thread_data[0][3].load(true);
|
||||
|
||||
is_fade_sky = (flags & DrawSkyArgs::fade_sky) == SSAInt(DrawSkyArgs::fade_sky);
|
||||
|
||||
count = count_for_thread(dest_y, count, thread);
|
||||
dest = dest_for_thread(dest_y, pitch, dest, thread);
|
||||
|
||||
|
@ -61,10 +64,15 @@ void DrawSkyCodegen::Generate(DrawSkyVariant variant, SSAValue args, SSAValue th
|
|||
stack_frac.store(texturefrac + iscale * skipped_by_thread(dest_y, thread));
|
||||
fracstep = iscale * thread.num_cores;
|
||||
|
||||
Loop(variant);
|
||||
SSAIfBlock branch;
|
||||
branch.if_block(is_fade_sky);
|
||||
Loop(variant, true);
|
||||
branch.else_block();
|
||||
Loop(variant, false);
|
||||
branch.end_block();
|
||||
}
|
||||
|
||||
void DrawSkyCodegen::Loop(DrawSkyVariant variant)
|
||||
void DrawSkyCodegen::Loop(DrawSkyVariant variant, bool fade_sky)
|
||||
{
|
||||
stack_index.store(SSAInt(0));
|
||||
{
|
||||
|
@ -76,8 +84,15 @@ void DrawSkyCodegen::Loop(DrawSkyVariant variant)
|
|||
|
||||
SSAInt offset = index * pitch * 4;
|
||||
|
||||
if (fade_sky)
|
||||
{
|
||||
SSAVec4i color = FadeOut(frac, Sample(frac, variant));
|
||||
dest[offset].store_vec4ub(color);
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[offset].store_vec4ub(Sample(frac, variant));
|
||||
}
|
||||
|
||||
stack_index.store(index.add(SSAInt(1), true, true));
|
||||
stack_frac.store(frac + fracstep);
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
void Generate(DrawSkyVariant variant, SSAValue args, SSAValue thread_data);
|
||||
|
||||
private:
|
||||
void Loop(DrawSkyVariant variant);
|
||||
void Loop(DrawSkyVariant variant, bool fade_sky);
|
||||
SSAVec4i Sample(SSAInt frac, DrawSkyVariant variant);
|
||||
SSAVec4i FadeOut(SSAInt frac, SSAVec4i color);
|
||||
|
||||
|
@ -57,4 +57,6 @@ private:
|
|||
SSAWorkerThread thread;
|
||||
|
||||
SSAInt fracstep;
|
||||
|
||||
SSABool is_fade_sky;
|
||||
};
|
||||
|
|
|
@ -280,7 +280,7 @@ llvm::Type *LLVMDrawers::GetDrawSkyArgsStruct(llvm::LLVMContext &context)
|
|||
elements.push_back(llvm::Type::getInt8PtrTy(context));
|
||||
for (int i = 0; i < 8; i++)
|
||||
elements.push_back(llvm::Type::getInt8PtrTy(context));
|
||||
for (int i = 0; i < 15; i++)
|
||||
for (int i = 0; i < 16; i++)
|
||||
elements.push_back(llvm::Type::getInt32Ty(context));
|
||||
DrawSkyArgsStruct = llvm::StructType::create(context, elements, "DrawSkyArgs", false)->getPointerTo();
|
||||
return DrawSkyArgsStruct;
|
||||
|
|
Loading…
Reference in a new issue