Merge pull request #4 from open-osrs/fix-alpha
gpu: fix drawalpha "properly"
This commit is contained in:
@@ -13,10 +13,10 @@ plugins {
|
|||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
val oprsver = "1.5.44-SNAPSHOT"
|
val oprsver = "3.1.0"
|
||||||
|
|
||||||
group = "com.openosrs"
|
group = "com.openosrs"
|
||||||
version = "1.0.3.1"
|
version = "1.0.3.2"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -125,13 +125,16 @@ public class RasterizerAlpha extends AbstractInjector
|
|||||||
StackContext alphaPop = isub.getPops().get(0);
|
StackContext alphaPop = isub.getPops().get(0);
|
||||||
InstructionContext alphaPusher = alphaPop.getPushed();
|
InstructionContext alphaPusher = alphaPop.getPushed();
|
||||||
InstructionContext isubResult = isub.getPushes().get(0).getPopped().get(0);
|
InstructionContext isubResult = isub.getPushes().get(0).getPopped().get(0);
|
||||||
|
boolean shouldSubtractLocal = false;
|
||||||
|
|
||||||
if (pushesToSameVar(isubResult, alphaPusher))
|
if (pushesToSameVar(isubResult, alphaPusher))
|
||||||
{
|
{
|
||||||
alphaPusher = resolveFieldThroughInvokes(alphaPop);
|
shouldSubtractLocal = true;
|
||||||
|
alphaPusher = isubResult;
|
||||||
|
/*alphaPusher = resolveFieldThroughInvokes(alphaPop);
|
||||||
|
|
||||||
if (alphaPusher == null)
|
if (alphaPusher == null)
|
||||||
throw new RuntimeException("Alpha var is overwritten and we don't know what pushed it"); // cheeky unchecked
|
throw new RuntimeException("Alpha var is overwritten and we don't know what pushed it"); // cheeky unchecked*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int storeIdx = instrs.getInstructions().indexOf(instruction);
|
int storeIdx = instrs.getInstructions().indexOf(instruction);
|
||||||
@@ -139,13 +142,22 @@ public class RasterizerAlpha extends AbstractInjector
|
|||||||
Instruction alphaPushI = alphaPusher.getInstruction();
|
Instruction alphaPushI = alphaPusher.getInstruction();
|
||||||
if (alphaPushI instanceof GetStatic)
|
if (alphaPushI instanceof GetStatic)
|
||||||
{
|
{
|
||||||
//instrs.addInstruction(storeIdx++, new LDC(instrs, 255));
|
instrs.addInstruction(storeIdx++, new LDC(instrs, 255));
|
||||||
instrs.addInstruction(storeIdx++, new GetStatic(instrs, ((GetStatic) alphaPushI).getField()));
|
instrs.addInstruction(storeIdx++, new GetStatic(instrs, ((GetStatic) alphaPushI).getField()));
|
||||||
//instrs.addInstruction(storeIdx++, new ISub(instrs, InstructionType.ISUB));
|
instrs.addInstruction(storeIdx++, new ISub(instrs, InstructionType.ISUB));
|
||||||
}
|
}
|
||||||
else if (alphaPushI instanceof LVTInstruction)
|
else if (alphaPushI instanceof LVTInstruction)
|
||||||
{
|
{
|
||||||
|
if (shouldSubtractLocal)
|
||||||
|
{
|
||||||
|
instrs.addInstruction(storeIdx++, new LDC(instrs, 255));
|
||||||
instrs.addInstruction(storeIdx++, new ILoad(instrs, ((LVTInstruction) alphaPushI).getVariableIndex()));
|
instrs.addInstruction(storeIdx++, new ILoad(instrs, ((LVTInstruction) alphaPushI).getVariableIndex()));
|
||||||
|
instrs.addInstruction(storeIdx++, new ISub(instrs, InstructionType.ISUB));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
instrs.addInstruction(storeIdx++, new ILoad(instrs, ((LVTInstruction) alphaPushI).getVariableIndex()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instrs.getInstructions().set(storeIdx, new InvokeStatic(instrs, DRAWALPHA));
|
instrs.getInstructions().set(storeIdx, new InvokeStatic(instrs, DRAWALPHA));
|
||||||
|
|||||||
Reference in New Issue
Block a user