import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * Represents an instruction to execute part of a RenderProgram based on an execution stack
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { ByteEncoder, RenderEvaluationContext, RenderExecutionStack, RenderExecutor } from '../imports.js';
import Vector4 from '../../../dot/js/Vector4.js';
export default abstract class RenderInstruction {
    abstract execute(stack: RenderExecutionStack, context: RenderEvaluationContext, executor: RenderExecutor): void;
    abstract toString(): string;
    abstract equals(other: RenderInstruction, areLocationsEqual: (a: RenderInstructionLocation, b: RenderInstructionLocation) => boolean): boolean;
    abstract writeBinary(encoder: ByteEncoder, getOffset: (location: RenderInstructionLocation) => number): void;
    /**
     * The number of dwords (u32s, 4 bytes) that this instruction takes up in the binary stream.
     */
    abstract getBinaryLength(): number;
    static readonly ExitCode = 0;
    static readonly ReturnCode = 1;
    static readonly StackBlendCode = 2;
    static readonly LinearBlendCode = 3;
    static readonly BlendComposeCode = 4;
    static readonly OpaqueJumpCode = 5;
    static readonly PremultiplyCode = 6;
    static readonly UnpremultiplyCode = 7;
    static readonly SRGBToLinearSRGBCode = 8;
    static readonly LinearSRGBToSRGBCode = 9;
    static readonly LinearDisplayP3ToLinearSRGBCode = 10;
    static readonly LinearSRGBToLinearDisplayP3Code = 11;
    static readonly OklabToLinearSRGBCode = 12;
    static readonly LinearSRGBToOklabCode = 13;
    static readonly NormalizeCode = 14;
    static readonly NormalDebugCode = 15;
    static readonly MultiplyScalarCode: number;
    static readonly PhongCode: number;
    static readonly PushCode: number;
    static readonly ComputeLinearBlendRatioCode: number;
    static readonly BarycentricBlendCode: number;
    static readonly BarycentricPerspectiveBlendCode: number;
    static readonly ComputeRadialBlendRatioCode: number;
    static readonly FilterCode: number;
    static readonly ComputeLinearGradientRatioCode: number;
    static readonly ComputeRadialGradientRatioCode: number;
    static readonly ImageCode = 255;
    static readonly CODE_NAME_CONSTANTS: {
        readonly ExitCode: 0;
        readonly ReturnCode: 1;
        readonly StackBlendCode: 2;
        readonly LinearBlendCode: 3;
        readonly BlendComposeCode: 4;
        readonly OpaqueJumpCode: 5;
        readonly PremultiplyCode: 6;
        readonly UnpremultiplyCode: 7;
        readonly SRGBToLinearSRGBCode: 8;
        readonly LinearSRGBToSRGBCode: 9;
        readonly LinearDisplayP3ToLinearSRGBCode: 10;
        readonly LinearSRGBToLinearDisplayP3Code: 11;
        readonly OklabToLinearSRGBCode: 12;
        readonly LinearSRGBToOklabCode: 13;
        readonly NormalizeCode: 14;
        readonly NormalDebugCode: 15;
        readonly MultiplyScalarCode: number;
        readonly PhongCode: number;
        readonly PushCode: number;
        readonly ComputeLinearBlendRatioCode: number;
        readonly BarycentricBlendCode: number;
        readonly BarycentricPerspectiveBlendCode: number;
        readonly ComputeRadialBlendRatioCode: number;
        readonly FilterCode: number;
        readonly ComputeLinearGradientRatioCode: number;
        readonly ComputeRadialGradientRatioCode: number;
        readonly ImageCode: 255;
    };
    /**
     * Returns the length (in dwords) of the binary form of an instruction, based on the initial u32 value in the
     * instruction stream
     */
    static getInstructionLength(u32: number): number;
    /**
     * Appends the binary form of the list of instructions to the encoder.
     *
     * NOTE: The binary form will always have an exit instruction included at the end, so multiple instruction streams
     * can be written into the same buffer (and noted with offsets).
     */
    static instructionsToBinary(encoder: ByteEncoder, instructions: RenderInstruction[]): void;
    /**
     * Reads the binary from from the encoder (at a specific dword offset), and returns the list of instructions.
     *
     * NOTE: No final "exit" is generated, since our executor for objects won't need it.
     */
    static binaryToInstructions(encoder: ByteEncoder, offset: number): RenderInstruction[];
    /**
     * Extracts a single instruction from the binary format at a given (32bit dword) offset.
     */
    static binaryToInstruction(encoder: ByteEncoder, offset: number, getLocation: (offset: number) => RenderInstructionLocation): RenderInstruction;
    /**
     * Returns whether two instruction lists are equivalent (allowing for equivalent location instructions).
     *
     * It's possible to have one list where there are multiple location instructions in a row, so we'll need to
     * inspect locations for these cases (since they can be equivalent to a single location instruction).
     */
    static instructionsEquals(a: RenderInstruction[], b: RenderInstruction[]): boolean;
}
export declare class RenderInstructionLocation extends RenderInstruction {
    id: number;
    index: number;
    toString(): string;
    equals(other: RenderInstruction, areLocationsEqual: (a: RenderInstructionLocation, b: RenderInstructionLocation) => boolean): boolean;
    execute(stack: RenderExecutionStack, context: RenderEvaluationContext, executor: RenderExecutor): void;
    writeBinary(encoder: ByteEncoder, getOffset: (location: RenderInstructionLocation) => number): void;
    getBinaryLength(): number;
}
export declare class RenderInstructionPush extends RenderInstruction {
    vector: Vector4;
    constructor(vector: Vector4);
    toString(): string;
    equals(other: RenderInstruction, areLocationsEqual: (a: RenderInstructionLocation, b: RenderInstructionLocation) => boolean): boolean;
    execute(stack: RenderExecutionStack, context: RenderEvaluationContext, executor: RenderExecutor): void;
    writeBinary(encoder: ByteEncoder, getOffset: (location: RenderInstructionLocation) => number): void;
    static fromBinary(encoder: ByteEncoder, offset: number, getLocation: (offset: number) => RenderInstructionLocation): RenderInstructionPush;
    getBinaryLength(): number;
}
export declare class RenderInstructionReturn extends RenderInstruction {
    toString(): string;
    equals(other: RenderInstruction, areLocationsEqual: (a: RenderInstructionLocation, b: RenderInstructionLocation) => boolean): boolean;
    execute(stack: RenderExecutionStack, context: RenderEvaluationContext, executor: RenderExecutor): void;
    writeBinary(encoder: ByteEncoder, getOffset: (location: RenderInstructionLocation) => number): void;
    getBinaryLength(): number;
    static readonly INSTANCE: RenderInstructionReturn;
}
export declare class RenderInstructionExit extends RenderInstruction {
    toString(): string;
    equals(other: RenderInstruction, areLocationsEqual: (a: RenderInstructionLocation, b: RenderInstructionLocation) => boolean): boolean;
    execute(stack: RenderExecutionStack, context: RenderEvaluationContext, executor: RenderExecutor): void;
    writeBinary(encoder: ByteEncoder, getOffset: (location: RenderInstructionLocation) => number): void;
    getBinaryLength(): number;
    static readonly INSTANCE: RenderInstructionExit;
}
export declare class RenderInstructionMultiplyScalar extends RenderInstruction {
    factor: number;
    constructor(factor: number);
    toString(): string;
    equals(other: RenderInstruction, areLocationsEqual: (a: RenderInstructionLocation, b: RenderInstructionLocation) => boolean): boolean;
    execute(stack: RenderExecutionStack, context: RenderEvaluationContext, executor: RenderExecutor): void;
    writeBinary(encoder: ByteEncoder, getOffset: (location: RenderInstructionLocation) => number): void;
    static fromBinary(encoder: ByteEncoder, offset: number, getLocation: (offset: number) => RenderInstructionLocation): RenderInstructionMultiplyScalar;
    getBinaryLength(): number;
}
//# sourceMappingURL=RenderInstruction.d.ts.map