Skip to content

Commit

Permalink
Merge pull request #284 from ivanpopelyshev/feat-base-instance
Browse files Browse the repository at this point in the history
BaseVertexBaseInstance without multidraw
  • Loading branch information
sebavan committed Sep 6, 2023
2 parents 638284f + 893a875 commit 9a10161
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/backend/commands/drawArraysInstancedBaseInstanceWEBGL.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { BaseCommand } from "./baseCommand";
import { WebGlConstants } from "../types/webglConstants";

export class DrawArraysInstancedBaseInstanceWEBGL extends BaseCommand {
public static readonly commandName = "drawArraysInstancedBaseInstanceWEBGL";

protected get spiedCommandName(): string {
return DrawArraysInstancedBaseInstanceWEBGL.commandName;
}

protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawArraysInstanced"));
stringified.push(args[1]);
stringified.push(args[2]);
stringified.push(args[3]);
stringified.push(`baseInstance = ${args[4]}`);

return stringified;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { BaseCommand } from "./baseCommand";
import { WebGlConstants } from "../types/webglConstants";

export class DrawElementsInstancedBaseVertexBaseInstanceWEBGL extends BaseCommand {
public static readonly commandName = "drawElementsInstancedBaseVertexBaseInstanceWEBGL";

protected get spiedCommandName(): string {
return DrawElementsInstancedBaseVertexBaseInstanceWEBGL .commandName;
}

protected stringifyArgs(args: IArguments): string[] {
const stringified = [];
stringified.push(WebGlConstants.stringifyWebGlConstant(args[0], "drawElementsInstanced"));
stringified.push(args[1]);
stringified.push(WebGlConstants.stringifyWebGlConstant(args[2], "drawElementsInstanced"));
stringified.push(args[3]);
stringified.push(args[4]);

stringified.push(`baseVertex = ${args[5]}`);
stringified.push(`baseInstance = ${args[6]}`);

return stringified;
}
}
4 changes: 4 additions & 0 deletions src/backend/spies/commandSpy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { MultiDrawArraysWEBGL } from "../commands/MultiDrawArraysWEBGL";
import { MultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL } from "../commands/MultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL";
import { MultiDrawElementsInstancedWEBGL } from "../commands/MultiDrawElementsInstancedWEBGL";
import { MultiDrawElementsWEBGL } from "../commands/MultiDrawElementsWEBGL";
import { DrawArraysInstancedBaseInstanceWEBGL } from "../commands/drawArraysInstancedBaseInstanceWEBGL";
import { DrawElementsInstancedBaseVertexBaseInstanceWEBGL } from "../commands/drawElementsInstancedBaseVertexBaseInstanceWEBGL";

import { Scissor } from "../commands/scissor";
import { StencilMask } from "../commands/stencilMask";
Expand Down Expand Up @@ -161,6 +163,8 @@ export class CommandSpy {
[MultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL.commandName]: (options: IContextInformation) => new MultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(options),
[MultiDrawElementsInstancedWEBGL.commandName]: (options: IContextInformation) => new MultiDrawElementsInstancedWEBGL(options),
[MultiDrawElementsWEBGL.commandName]: (options: IContextInformation) => new MultiDrawElementsWEBGL(options),
[DrawArraysInstancedBaseInstanceWEBGL.commandName]: (options: IContextInformation) => new DrawArraysInstancedBaseInstanceWEBGL(options),
[DrawElementsInstancedBaseVertexBaseInstanceWEBGL.commandName]: (options: IContextInformation) => new DrawElementsInstancedBaseVertexBaseInstanceWEBGL(options),
[Scissor.commandName]: (options: IContextInformation) => new Scissor(options),
[StencilMask.commandName]: (options: IContextInformation) => new StencilMask(options),
[StencilMaskSeparate.commandName]: (options: IContextInformation) => new StencilMaskSeparate(options),
Expand Down
1 change: 1 addition & 0 deletions src/backend/states/information/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class Extensions extends BaseState {
// { name: "WEBGL_debug_shaders", description: "" },
{ name: "WEBGL_multi_draw", description: ""},
{ name: "WEBGL_multi_draw_instanced_base_vertex_base_instance", description: ""},
{ name: "WEBGL_draw_instanced_base_vertex_base_instance", description: ""},
],
];

Expand Down
2 changes: 2 additions & 0 deletions src/backend/utils/drawCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ export const drawCommands = [
"multiDrawElementsInstancedWEBGL",
"multiDrawArraysInstancedBaseInstanceWEBGL",
"multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL",
"drawArraysInstancedBaseInstanceWEBGL",
"drawElementsInstancedBaseVertexBaseInstanceWEBGL"
];

0 comments on commit 9a10161

Please sign in to comment.