mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
structure
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXBuffer } from './gfx-buffer';
|
||||
import { GFXTextureView } from './gfx-texture-view';
|
||||
import { GFXSampler } from './gfx-sampler';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXBuffer } from './buffer';
|
||||
import { GFXTextureView } from './texture-view';
|
||||
import { GFXSampler } from './sampler';
|
||||
|
||||
export enum GFXBindingType {
|
||||
UNKNOWN,
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { BufferView } from './gfx-define';
|
||||
import { GFXDevice } from './device';
|
||||
import { BufferView } from './define';
|
||||
|
||||
export enum GFXBufferUsageBit {
|
||||
NONE = 0,
|
||||
@@ -1,10 +1,10 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXDevice } from './device';
|
||||
|
||||
export interface GFXCommandAllocatorInfo {
|
||||
};
|
||||
|
||||
export abstract class GFXCommandAllocator {
|
||||
|
||||
|
||||
constructor(device : GFXDevice) {
|
||||
this._device = device;
|
||||
}
|
||||
@@ -13,4 +13,4 @@ export abstract class GFXCommandAllocator {
|
||||
public abstract destroy();
|
||||
|
||||
protected _device : GFXDevice;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXCommandAllocator } from './gfx-command-allocator';
|
||||
import { GFXBuffer } from './gfx-buffer';
|
||||
import { GFXInputAssembler } from './gfx-input-assembler';
|
||||
import { GFXPipelineState } from './gfx-pipeline-state';
|
||||
import { GFXBindingLayout } from './gfx-binding-layout';
|
||||
import { GFXTextureLayout } from './gfx-render-pass';
|
||||
import { GFXTexture } from './gfx-texture';
|
||||
import { GFXFramebuffer } from './gfx-framebuffer';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXCommandAllocator } from './command-allocator';
|
||||
import { GFXBuffer } from './buffer';
|
||||
import { GFXInputAssembler } from './input-assembler';
|
||||
import { GFXPipelineState } from './pipeline-state';
|
||||
import { GFXBindingLayout } from './binding-layout';
|
||||
import { GFXTextureLayout } from './render-pass';
|
||||
import { GFXTexture } from './texture';
|
||||
import { GFXFramebuffer } from './framebuffer';
|
||||
|
||||
export class GFXTextureSubres
|
||||
{
|
||||
@@ -1,18 +1,18 @@
|
||||
import { GFXBuffer, GFXBufferInfo } from './gfx-buffer';
|
||||
import { GFXQueue, GFXQueueInfo } from './gfx-queue';
|
||||
import { GFXTexture, GFXTextureInfo } from './gfx-texture';
|
||||
import { GFXTextureViewInfo, GFXTextureView } from './gfx-texture-view';
|
||||
import { GFXFramebufferInfo, GFXFramebuffer } from './gfx-framebuffer';
|
||||
import { GFXRenderPassInfo, GFXRenderPass } from './gfx-render-pass';
|
||||
import { GFXPipelineStateInfo, GFXPipelineState } from './gfx-pipeline-state';
|
||||
import { GFXPipelineLayoutInfo, GFXPipelineLayout } from './gfx-pipeline-layout';
|
||||
import { GFXSamplerInfo, GFXSampler } from './gfx-sampler';
|
||||
import { GFXShaderInfo, GFXShader } from './gfx-shader';
|
||||
import { GFXInputAssemblerInfo, GFXInputAssembler } from './gfx-input-assembler';
|
||||
import { GFXCommandBufferInfo, GFXCommandBuffer } from './gfx-command-buffer';
|
||||
import { GFXCommandAllocatorInfo, GFXCommandAllocator } from './gfx-command-allocator';
|
||||
import { GFXWindowInfo, GFXWindow } from './gfx-window';
|
||||
import { GFXBindingLayoutInfo, GFXBindingLayout } from './gfx-binding-layout';
|
||||
import { GFXBuffer, GFXBufferInfo } from './buffer';
|
||||
import { GFXQueue, GFXQueueInfo } from './queue';
|
||||
import { GFXTexture, GFXTextureInfo } from './texture';
|
||||
import { GFXTextureViewInfo, GFXTextureView } from './texture-view';
|
||||
import { GFXFramebufferInfo, GFXFramebuffer } from './framebuffer';
|
||||
import { GFXRenderPassInfo, GFXRenderPass } from './render-pass';
|
||||
import { GFXPipelineStateInfo, GFXPipelineState } from './pipeline-state';
|
||||
import { GFXPipelineLayoutInfo, GFXPipelineLayout } from './pipeline-layout';
|
||||
import { GFXSamplerInfo, GFXSampler } from './sampler';
|
||||
import { GFXShaderInfo, GFXShader } from './shader';
|
||||
import { GFXInputAssemblerInfo, GFXInputAssembler } from './input-assembler';
|
||||
import { GFXCommandBufferInfo, GFXCommandBuffer } from './command-buffer';
|
||||
import { GFXCommandAllocatorInfo, GFXCommandAllocator } from './command-allocator';
|
||||
import { GFXWindowInfo, GFXWindow } from './window';
|
||||
import { GFXBindingLayoutInfo, GFXBindingLayout } from './binding-layout';
|
||||
|
||||
export enum GFXFeature {
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXTextureView } from './gfx-texture-view';
|
||||
import { GFXRenderPass } from './gfx-render-pass';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXTextureView } from './texture-view';
|
||||
import { GFXRenderPass } from './render-pass';
|
||||
|
||||
export interface GFXFramebufferInfo {
|
||||
renderPass: GFXRenderPass;
|
||||
@@ -0,0 +1,29 @@
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXBuffer } from './buffer';
|
||||
import { GFXTexture } from './texture';
|
||||
import { GFXTextureView } from './texture-view';
|
||||
import { GFXSampler } from './sampler';
|
||||
import { GFXShader } from './shader';
|
||||
import { GFXInputAssembler } from './input-assembler';
|
||||
import { GFXRenderPass } from './render-pass';
|
||||
import { GFXFramebuffer } from './framebuffer';
|
||||
import { GFXPipelineLayout } from './pipeline-layout';
|
||||
import { GFXPipelineState } from './pipeline-state';
|
||||
import { GFXCommandBuffer } from './command-buffer';
|
||||
import { GFXQueue } from './queue';
|
||||
import { WebGLGFXDevice } from './webgl/webgl-device';
|
||||
|
||||
cc.GFXDevice = GFXDevice;
|
||||
cc.GFXBuffer = GFXBuffer;
|
||||
cc.GFXTexture = GFXTexture;
|
||||
cc.GFXTextureView = GFXTextureView;
|
||||
cc.GFXSampler = GFXSampler;
|
||||
cc.GFXShader = GFXShader;
|
||||
cc.GFXInputAssembler = GFXInputAssembler;
|
||||
cc.GFXRenderPass = GFXRenderPass;
|
||||
cc.GFXFramebuffer = GFXFramebuffer;
|
||||
cc.GFXPipelineLayout = GFXPipelineLayout;
|
||||
cc.GFXPipelineState = GFXPipelineState;
|
||||
cc.GFXCommandBuffer = GFXCommandBuffer;
|
||||
cc.GFXQueue = GFXQueue;
|
||||
cc.WebGLGFXDevice = WebGLGFXDevice;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXFormat } from './gfx-define';
|
||||
import { GFXBuffer } from './gfx-buffer';
|
||||
import { GFXShader } from './gfx-shader';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXFormat } from './define';
|
||||
import { GFXBuffer } from './buffer';
|
||||
import { GFXShader } from './shader';
|
||||
|
||||
export interface GFXInputAttribute {
|
||||
name: string;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXBindingLayout } from './gfx-binding-layout';
|
||||
import { GFXShaderType } from './gfx-shader';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXBindingLayout } from './binding-layout';
|
||||
import { GFXShaderType } from './shader';
|
||||
|
||||
export class GFXPushConstantRange {
|
||||
shaderType : GFXShaderType = GFXShaderType.VERTEX;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXShader } from './gfx-shader';
|
||||
import { GFXRenderPass } from './gfx-render-pass';
|
||||
import { GFXPipelineLayout } from './gfx-pipeline-layout';
|
||||
import { GFXInputAttribute } from './gfx-input-assembler';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXShader } from './shader';
|
||||
import { GFXRenderPass } from './render-pass';
|
||||
import { GFXPipelineLayout } from './pipeline-layout';
|
||||
import { GFXInputAttribute } from './input-assembler';
|
||||
|
||||
export enum GFXPrimitiveMode {
|
||||
POINT_LIST,
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXDevice } from './device';
|
||||
|
||||
export enum GFXQueueType {
|
||||
GRAPHICS,
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GFXFormat, GFXFormatInfo } from './gfx-define';
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXFormat, GFXFormatInfo } from './define';
|
||||
import { GFXDevice } from './device';
|
||||
|
||||
// Enumeration all possible values of operations to be performed on initially Loading a Framebuffer Object.
|
||||
export enum GFXLoadOp
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXComparisonFunc } from './gfx-pipeline-state';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXComparisonFunc } from './pipeline-state';
|
||||
|
||||
export enum GFXFilter {
|
||||
NONE,
|
||||
@@ -31,17 +31,17 @@ export class GFXSamplerInfo {
|
||||
mipLODBias : number = 0.0;
|
||||
|
||||
public compare(state : GFXSamplerInfo) : boolean {
|
||||
return (this.minFilter === state.minFilter) &&
|
||||
(this.magFilter === state.magFilter) &&
|
||||
(this.mipFilter === state.mipFilter) &&
|
||||
(this.addressU === state.addressU) &&
|
||||
(this.addressV === state.addressV) &&
|
||||
(this.addressW === state.addressW) &&
|
||||
(this.maxAnisotropy === state.maxAnisotropy) &&
|
||||
(this.cmpFunc === state.cmpFunc) &&
|
||||
(this.borderColor === state.borderColor) &&
|
||||
(this.minLOD === state.minLOD) &&
|
||||
(this.maxLOD === state.maxLOD) &&
|
||||
return (this.minFilter === state.minFilter) &&
|
||||
(this.magFilter === state.magFilter) &&
|
||||
(this.mipFilter === state.mipFilter) &&
|
||||
(this.addressU === state.addressU) &&
|
||||
(this.addressV === state.addressV) &&
|
||||
(this.addressW === state.addressW) &&
|
||||
(this.maxAnisotropy === state.maxAnisotropy) &&
|
||||
(this.cmpFunc === state.cmpFunc) &&
|
||||
(this.borderColor === state.borderColor) &&
|
||||
(this.minLOD === state.minLOD) &&
|
||||
(this.maxLOD === state.maxLOD) &&
|
||||
(this.mipLODBias === state.mipLODBias);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXBinding } from './gfx-binding-layout';
|
||||
import { GFXType } from './gfx-define';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXBinding } from './binding-layout';
|
||||
import { GFXType } from './define';
|
||||
|
||||
export enum GFXShaderType {
|
||||
VERTEX,
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GFXFormat, GFXFormatInfo } from './gfx-define';
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXTexture } from './gfx-texture';
|
||||
import { GFXFormat, GFXFormatInfo } from './define';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXTexture } from './texture';
|
||||
|
||||
export enum GFXTextureViewType {
|
||||
TV1D,
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GFXFormat, GFXFormatInfo } from './gfx-define';
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXFormat, GFXFormatInfo } from './define';
|
||||
import { GFXDevice } from './device';
|
||||
|
||||
export enum GFXTextureType {
|
||||
TEX1D,
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { WebGLGPUBindingLayout } from './webgl-gpu-objects';
|
||||
import { GFXBindingLayout, GFXBindingLayoutInfo, GFXBindingUnit } from '../gfx-binding-layout';
|
||||
import { GFXBindingLayout, GFXBindingLayoutInfo, GFXBindingUnit } from '../binding-layout';
|
||||
|
||||
export class WebGLGFXBindingLayout extends GFXBindingLayout {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GFXBufferInfo, GFXBuffer, GFXMemoryUsageBit, GFXBufferAccess, GFXBufferAccessBit, GFXBufferUsageBit } from '../gfx-buffer';
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXBufferInfo, GFXBuffer, GFXMemoryUsageBit, GFXBufferAccess, GFXBufferAccessBit, GFXBufferUsageBit } from '../buffer';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGPUBuffer } from './webgl-gpu-objects';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { BufferView } from '../gfx-define';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { BufferView } from '../define';
|
||||
|
||||
export class WebGLGFXBuffer extends GFXBuffer {
|
||||
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXCommandAllocator, GFXCommandAllocatorInfo } from '../gfx-command-allocator';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXCommandAllocator, GFXCommandAllocatorInfo } from '../command-allocator';
|
||||
import { WebGLCmdUpdateBuffer, WebGLCmdBeginRenderPass, WebGLCmdBindInputAssembler, WebGLCmdDraw, WebGLCmdBindPipelineState, WebGLCmdBindBindingLayout, WebGLCmdCopyBufferToTexture } from './webgl-commands';
|
||||
|
||||
export class WebGLGFXCommandPool<T> {
|
||||
|
||||
|
||||
constructor(count: number, increase : number) {
|
||||
this._frees = new Array(count);
|
||||
this._freeIdx = count - 1;
|
||||
@@ -11,7 +11,7 @@ export class WebGLGFXCommandPool<T> {
|
||||
}
|
||||
|
||||
alloc(clazz: new() => T) : T | null {
|
||||
|
||||
|
||||
if (this._freeIdx <= 0) {
|
||||
let size = this._frees.length + this._increase;
|
||||
let temp = this._frees;
|
||||
+19
-19
@@ -1,21 +1,21 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXCommandBuffer, GFXCommandBufferInfo, GFXBufferTextureCopy } from '../gfx-command-buffer';
|
||||
import { GFXBuffer } from '../gfx-buffer';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXCommandBuffer, GFXCommandBufferInfo, GFXBufferTextureCopy } from '../command-buffer';
|
||||
import { GFXBuffer } from '../buffer';
|
||||
import { WebGLCmdUpdateBuffer, WebGLCmd, WebGLCmdBeginRenderPass, WebGLCmdPackage, WebGLCmdBindInputAssembler, WebGLCmdBindPipelineState, WebGLCmdDraw, WebGLCmdBindBindingLayout, WebGLCmdCopyBufferToTexture } from './webgl-commands';
|
||||
import { WebGLGFXCommandAllocator } from './webgl-gfx-command-allocator';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { WebGLGFXBuffer } from './webgl-gfx-buffer';
|
||||
import { GFXFramebuffer } from '../gfx-framebuffer';
|
||||
import { WebGLGFXFramebuffer } from './webgl-gfx-framebuffer';
|
||||
import { GFXInputAssembler } from '../gfx-input-assembler';
|
||||
import { WebGLGFXInputAssembler } from './webgl-gfx-input-assembler';
|
||||
import { GFXPipelineState } from '../gfx-pipeline-state';
|
||||
import { WebGLGFXPipelineState } from './webgl-gfx-pipeline-state';
|
||||
import { GFXBindingLayout } from '../gfx-binding-layout';
|
||||
import { WebGLGFXBindingLayout } from './webgl-gfx-binding-layout';
|
||||
import { GFXTexture } from '../gfx-texture';
|
||||
import { GFXTextureLayout } from '../gfx-render-pass';
|
||||
import { WebGLGFXTexture } from './webgl-gfx-texture';
|
||||
import { WebGLGFXCommandAllocator } from './webgl-command-allocator';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { WebGLGFXBuffer } from './webgl-buffer';
|
||||
import { GFXFramebuffer } from '../framebuffer';
|
||||
import { WebGLGFXFramebuffer } from './webgl-framebuffer';
|
||||
import { GFXInputAssembler } from '../input-assembler';
|
||||
import { WebGLGFXInputAssembler } from './webgl-input-assembler';
|
||||
import { GFXPipelineState } from '../pipeline-state';
|
||||
import { WebGLGFXPipelineState } from './webgl-pipeline-state';
|
||||
import { GFXBindingLayout } from '../binding-layout';
|
||||
import { WebGLGFXBindingLayout } from './webgl-binding-layout';
|
||||
import { GFXTexture } from '../texture';
|
||||
import { GFXTextureLayout } from '../render-pass';
|
||||
import { WebGLGFXTexture } from './webgl-texture';
|
||||
|
||||
export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
|
||||
|
||||
@@ -116,7 +116,7 @@ export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
|
||||
this.cmdPackage.cmds.push(WebGLCmd.DRAW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public updateBuffer(buffer : GFXBuffer, data : Buffer, offset : number) {
|
||||
let gpuBuffer = (<WebGLGFXBuffer>buffer).gpuBuffer;
|
||||
if(gpuBuffer) {
|
||||
@@ -126,7 +126,7 @@ export class WebGLGFXCommandBuffer extends GFXCommandBuffer {
|
||||
cmd.buffer = data.slice(0);
|
||||
cmd.offset = offset;
|
||||
this.cmdPackage.updateBufferCmds.push(cmd);
|
||||
|
||||
|
||||
this.cmdPackage.cmds.push(WebGLCmd.UPDATE_BUFFER);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
import { WebGLGPUBuffer, WebGLGPUTexture, WebGLGPUInputAssembler, WebGLGPUFramebuffer, WebGLGPUShader, WebGLGPUInput, WebGLAttrib, WebGLGPUPipelineState, WebGLGPUUniformBlock, WebGLGPUBindingLayout, WebGLGPUUniform, WebGLGPUUniformSampler } from "./webgl-gpu-objects";
|
||||
import { WebGLGFXDevice } from "./webgl-gfx-device";
|
||||
import { GFXBufferUsageBit, GFXMemoryUsageBit } from "../gfx-buffer";
|
||||
import { GFXTextureViewType } from "../gfx-texture-view";
|
||||
import { GFXFormatInfos, GFXFormat, WebGLEXT, GFXType, GFX_MAX_VERTEX_ATTRIBUTES, GFXFormatSize, BufferView } from "../gfx-define";
|
||||
import { GFXShaderType } from "../gfx-shader";
|
||||
import { GFXLoadOp, GFXTextureLayout } from "../gfx-render-pass";
|
||||
import { GFXColorMask, GFXCullMode } from "../gfx-pipeline-state";
|
||||
import { WebGLGFXCommandAllocator } from "./webgl-gfx-command-allocator";
|
||||
import { GFXBindingType } from "../gfx-binding-layout";
|
||||
import { WebGLGFXDevice } from "./webgl-device";
|
||||
import { GFXBufferUsageBit, GFXMemoryUsageBit } from "../buffer";
|
||||
import { GFXTextureViewType } from "../texture-view";
|
||||
import { GFXFormatInfos, GFXFormat, WebGLEXT, GFXType, GFX_MAX_VERTEX_ATTRIBUTES, GFXFormatSize, BufferView } from "../define";
|
||||
import { GFXShaderType } from "../shader";
|
||||
import { GFXLoadOp, GFXTextureLayout } from "../render-pass";
|
||||
import { GFXColorMask, GFXCullMode } from "../pipeline-state";
|
||||
import { WebGLGFXCommandAllocator } from "./webgl-command-allocator";
|
||||
import { GFXBindingType } from "../binding-layout";
|
||||
import { WebGLTexUnit } from "./webgl-state-cache";
|
||||
import { GFXBufferTextureCopy } from "../gfx-command-buffer";
|
||||
import { GFXTextureFlagBit } from "../gfx-texture";
|
||||
import { GFXBufferTextureCopy } from "../command-buffer";
|
||||
import { GFXTextureFlagBit } from "../texture";
|
||||
|
||||
function GFXFormatToWebGLType(format: GFXFormat, device : WebGLGFXDevice): GLenum {
|
||||
switch (format) {
|
||||
@@ -1,38 +1,38 @@
|
||||
import { GFXDeviceInfo, GFXDevice } from '../gfx-device';
|
||||
import { GFXBuffer, GFXBufferInfo, GFXBufferUsageBit } from '../gfx-buffer';
|
||||
import { WebGLGFXBuffer } from './webgl-gfx-buffer';
|
||||
import { WebGLGFXQueue } from './webgl-gfx-queue';
|
||||
import { GFXDeviceInfo, GFXDevice } from '../device';
|
||||
import { GFXBuffer, GFXBufferInfo, GFXBufferUsageBit } from '../buffer';
|
||||
import { WebGLGFXBuffer } from './webgl-buffer';
|
||||
import { WebGLGFXQueue } from './webgl-queue';
|
||||
import { WebGLStateCache } from './webgl-state-cache';
|
||||
import { WebGLGPUBuffer, WebGLGPUObjectType, WebGLGPUTexture, WebGLGPURenderPass, WebGLGPUFramebuffer, WebGLGPUTextureView, WebGLGPUShader, WebGLGPUShaderStage, WebGLGPUSampler, WebGLGPUInputAssembler, WebGLGPUPipelineState, WebGLGPUPipelineLayout, WebGLGPUBindingLayout as WebGLGPUBindingLayout, WebGLGPUBinding } from './webgl-gpu-objects';
|
||||
import { WebGLCmdFuncUpdateBuffer, WebGLCmdFuncDestroyBuffer, WebGLCmdFuncCreateBuffer, WebGLCmdFuncDestroyTexture, WebGLCmdFuncCreateTexture, WebGLCmdFuncCreateFramebuffer, WebGLCmdFuncDestroyFramebuffer, WebGLCmdFuncCreateShader, WebGLCmdFuncDestroyShader, WebGLCmdFuncCreateInputAssember } from './webgl-commands';
|
||||
import { GFXTextureInfo, GFXTextureType, GFXTextureFlagBit, GFXTexture } from '../gfx-texture';
|
||||
import { GFXTextureViewType, GFXTextureViewInfo, GFXTextureView } from '../gfx-texture-view';
|
||||
import { GFXRenderPassInfo, GFXRenderPass } from '../gfx-render-pass';
|
||||
import { GFXFramebufferInfo, GFXFramebuffer } from '../gfx-framebuffer';
|
||||
import { WebGLGFXRenderPass } from './webgl-gfx-render-pass';
|
||||
import { WebGLGFXTextureView } from './webgl-gfx-texture-view';
|
||||
import { WebGLGFXTexture } from './webgl-gfx-texture';
|
||||
import { GFXShaderInfo, GFXShader } from '../gfx-shader';
|
||||
import { GFXSamplerInfo, GFXFilter, GFXSampler, GFXAddress } from '../gfx-sampler';
|
||||
import { WebGLGFXCommandAllocator } from './webgl-gfx-command-allocator';
|
||||
import { GFXInputAssemblerInfo, GFXInputAssembler } from '../gfx-input-assembler';
|
||||
import { WebGLGFXShader } from './webgl-gfx-shader';
|
||||
import { GFXCommandAllocator, GFXCommandAllocatorInfo } from '../gfx-command-allocator';
|
||||
import { GFXPipelineStateInfo, GFXPipelineState } from '../gfx-pipeline-state';
|
||||
import { WebGLGFXPipelineLayout } from './webgl-gfx-pipeline-layout';
|
||||
import { GFXBindingLayoutInfo, GFXBindingUnit, GFXBindingType, GFXBindingLayout } from '../gfx-binding-layout';
|
||||
import { WebGLGFXSampler } from './webgl-gfx-sampler';
|
||||
import { GFXCommandBufferInfo, GFXCommandBuffer } from '../gfx-command-buffer';
|
||||
import { GFXQueueInfo, GFXQueue } from '../gfx-queue';
|
||||
import { WebGLGFXCommandBuffer } from './webgl-gfx-command-buffer';
|
||||
import { WebGLGFXPipelineState } from './webgl-gfx-pipeline-state';
|
||||
import { GFXPipelineLayoutInfo, GFXPipelineLayout } from '../gfx-pipeline-layout';
|
||||
import { WebGLGFXFramebuffer } from './webgl-gfx-framebuffer';
|
||||
import { WebGLGFXInputAssembler } from './webgl-gfx-input-assembler';
|
||||
import { GFXWindowInfo, GFXWindow } from '../gfx-window';
|
||||
import { WebGLGFXWindow } from './webgl-gfx-window';
|
||||
import { BufferView } from '../gfx-define';
|
||||
import { WebGLGFXBindingLayout } from './webgl-gfx-binding-layout';
|
||||
import { GFXTextureInfo, GFXTextureType, GFXTextureFlagBit, GFXTexture } from '../texture';
|
||||
import { GFXTextureViewType, GFXTextureViewInfo, GFXTextureView } from '../texture-view';
|
||||
import { GFXRenderPassInfo, GFXRenderPass } from '../render-pass';
|
||||
import { GFXFramebufferInfo, GFXFramebuffer } from '../framebuffer';
|
||||
import { WebGLGFXRenderPass } from './webgl-render-pass';
|
||||
import { WebGLGFXTextureView } from './webgl-texture-view';
|
||||
import { WebGLGFXTexture } from './webgl-texture';
|
||||
import { GFXShaderInfo, GFXShader } from '../shader';
|
||||
import { GFXSamplerInfo, GFXFilter, GFXSampler, GFXAddress } from '../sampler';
|
||||
import { WebGLGFXCommandAllocator } from './webgl-command-allocator';
|
||||
import { GFXInputAssemblerInfo, GFXInputAssembler } from '../input-assembler';
|
||||
import { WebGLGFXShader } from './webgl-shader';
|
||||
import { GFXCommandAllocator, GFXCommandAllocatorInfo } from '../command-allocator';
|
||||
import { GFXPipelineStateInfo, GFXPipelineState } from '../pipeline-state';
|
||||
import { WebGLGFXPipelineLayout } from './webgl-pipeline-layout';
|
||||
import { GFXBindingLayoutInfo, GFXBindingUnit, GFXBindingType, GFXBindingLayout } from '../binding-layout';
|
||||
import { WebGLGFXSampler } from './webgl-sampler';
|
||||
import { GFXCommandBufferInfo, GFXCommandBuffer } from '../command-buffer';
|
||||
import { GFXQueueInfo, GFXQueue } from '../queue';
|
||||
import { WebGLGFXCommandBuffer } from './webgl-command-buffer';
|
||||
import { WebGLGFXPipelineState } from './webgl-pipeline-state';
|
||||
import { GFXPipelineLayoutInfo, GFXPipelineLayout } from '../pipeline-layout';
|
||||
import { WebGLGFXFramebuffer } from './webgl-framebuffer';
|
||||
import { WebGLGFXInputAssembler } from './webgl-input-assembler';
|
||||
import { GFXWindowInfo, GFXWindow } from '../window';
|
||||
import { WebGLGFXWindow } from './webgl-window';
|
||||
import { BufferView } from '../define';
|
||||
import { WebGLGFXBindingLayout } from './webgl-binding-layout';
|
||||
|
||||
const WebGLPrimitives: GLenum[] = [
|
||||
WebGLRenderingContext.POINTS,
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXFramebuffer, GFXFramebufferInfo } from '../gfx-framebuffer';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { GFXFramebuffer, GFXFramebufferInfo } from '../framebuffer';
|
||||
import { WebGLGPUFramebuffer } from './webgl-gpu-objects';
|
||||
|
||||
export class WebGLGFXFramebuffer extends GFXFramebuffer {
|
||||
@@ -14,7 +14,7 @@ export class WebGLGFXFramebuffer extends GFXFramebuffer {
|
||||
if(info.colorViews) {
|
||||
this._colorViews = info.colorViews;
|
||||
}
|
||||
|
||||
|
||||
this._depthStencilView = info.depthStencilView? info.depthStencilView : null;
|
||||
this._isOffscreen = info.isOffscreen? info.isOffscreen : true;
|
||||
|
||||
+10
-10
@@ -1,12 +1,12 @@
|
||||
import { GFXBufferUsage, GFXBufferUsageBit, GFXMemoryUsage, GFXMemoryUsageBit } from "../gfx-buffer";
|
||||
import { GFXTextureType, GFXTextureUsage, GFXTextureUsageBit, GFXTextureFlags, GFXTextureFlagBit } from "../gfx-texture";
|
||||
import { GFXTextureViewType } from "../gfx-texture-view";
|
||||
import { GFXFormat, GFXType, BufferView } from "../gfx-define";
|
||||
import { GFXColorAttachment, GFXDepthStencilAttachment } from "../gfx-render-pass";
|
||||
import { GFXShaderType, GFXShaderMacro, GFXUniformBlock, GFXUniformSampler } from "../gfx-shader";
|
||||
import { GFXBindingType } from "../gfx-binding-layout";
|
||||
import { GFXRasterizerState, GFXDepthStencilState, GFXBlendState } from "../gfx-pipeline-state";
|
||||
import { GFXInputAttribute } from "../gfx-input-assembler";
|
||||
import { GFXBufferUsage, GFXBufferUsageBit, GFXMemoryUsage, GFXMemoryUsageBit } from "../buffer";
|
||||
import { GFXTextureType, GFXTextureUsage, GFXTextureUsageBit, GFXTextureFlags, GFXTextureFlagBit } from "../texture";
|
||||
import { GFXTextureViewType } from "../texture-view";
|
||||
import { GFXFormat, GFXType, BufferView } from "../define";
|
||||
import { GFXColorAttachment, GFXDepthStencilAttachment } from "../render-pass";
|
||||
import { GFXShaderType, GFXShaderMacro, GFXUniformBlock, GFXUniformSampler } from "../shader";
|
||||
import { GFXBindingType } from "../binding-layout";
|
||||
import { GFXRasterizerState, GFXDepthStencilState, GFXBlendState } from "../pipeline-state";
|
||||
import { GFXInputAttribute } from "../input-assembler";
|
||||
|
||||
export enum WebGLGPUObjectType {
|
||||
UNKNOWN,
|
||||
@@ -155,7 +155,7 @@ export class WebGLGPUUniformBlock {
|
||||
size: number = 0;
|
||||
glUniforms: WebGLGPUUniform[] = [];
|
||||
|
||||
isUniformPackage: boolean = false; // Is a single uniform package?
|
||||
isUniformPackage: boolean = false; // Is a single uniform package?
|
||||
buffer: ArrayBuffer | null = null; // for cache
|
||||
bufferView: DataView | null = null;
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXInputAssembler, GFXInputAssemblerInfo } from '../gfx-input-assembler';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXInputAssembler, GFXInputAssemblerInfo } from '../input-assembler';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { WebGLGPUInputAssembler } from './webgl-gpu-objects';
|
||||
|
||||
export class WebGLGFXInputAssembler extends GFXInputAssembler {
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXPipelineLayout, GFXPipelineLayoutInfo } from '../gfx-pipeline-layout';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXPipelineLayout, GFXPipelineLayoutInfo } from '../pipeline-layout';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { WebGLGPUPipelineLayout } from './webgl-gpu-objects';
|
||||
|
||||
export class WebGLGFXPipelineLayout extends GFXPipelineLayout {
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXPipelineState, GFXPipelineStateInfo } from '../gfx-pipeline-state';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXPipelineState, GFXPipelineStateInfo } from '../pipeline-state';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { WebGLGPUPipelineState } from './webgl-gpu-objects';
|
||||
|
||||
export class WebGLGFXPipelineState extends GFXPipelineState {
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXQueueInfo, GFXQueue } from '../gfx-queue';
|
||||
import { GFXCommandBuffer } from '../gfx-command-buffer';
|
||||
import { WebGLGFXCommandBuffer } from './webgl-gfx-command-buffer';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXQueueInfo, GFXQueue } from '../queue';
|
||||
import { GFXCommandBuffer } from '../command-buffer';
|
||||
import { WebGLGFXCommandBuffer } from './webgl-command-buffer';
|
||||
import { WebGLCmdFuncExecuteCmds } from './webgl-commands';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
|
||||
export class WebGLGFXQueue extends GFXQueue {
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGPUTexture, WebGLGPURenderPass } from './webgl-gpu-objects';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXTexture, GFXTextureInfo, GFXTextureFlagBit } from '../gfx-texture';
|
||||
import { GFXFormatSurfaceSize } from '../gfx-define';
|
||||
import { GFXRenderPass, GFXRenderPassInfo } from '../gfx-render-pass';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { GFXTexture, GFXTextureInfo, GFXTextureFlagBit } from '../texture';
|
||||
import { GFXFormatSurfaceSize } from '../define';
|
||||
import { GFXRenderPass, GFXRenderPassInfo } from '../render-pass';
|
||||
|
||||
export class WebGLGFXRenderPass extends GFXRenderPass {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXSampler, GFXSamplerInfo } from '../gfx-sampler';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXSampler, GFXSamplerInfo } from '../sampler';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { WebGLGPUSampler } from './webgl-gpu-objects';
|
||||
|
||||
export class WebGLGFXSampler extends GFXSampler {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXShader, GFXShaderInfo } from '../gfx-shader';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { GFXShader, GFXShaderInfo } from '../shader';
|
||||
import { WebGLGPUShader } from './webgl-gpu-objects';
|
||||
|
||||
export class WebGLGFXShader extends GFXShader {
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
import { GFX_MAX_TEXTURE_UNITS, GFX_MAX_VERTEX_ATTRIBUTES } from "../gfx-define";
|
||||
import { GFXRasterizerState, GFXDepthStencilState, GFXBlendState } from "../gfx-pipeline-state";
|
||||
import { GFX_MAX_TEXTURE_UNITS, GFX_MAX_VERTEX_ATTRIBUTES } from "../define";
|
||||
import { GFXRasterizerState, GFXDepthStencilState, GFXBlendState } from "../pipeline-state";
|
||||
|
||||
export interface WebGLTexUnit
|
||||
{
|
||||
@@ -16,7 +16,7 @@ export interface WebGLTexUnit
|
||||
export class WebGLStateCache {
|
||||
glArrayBuffer : WebGLBuffer = 0;
|
||||
glElementArrayBuffer : WebGLBuffer = 0;
|
||||
texUnit : number = 0;
|
||||
texUnit : number = 0;
|
||||
glTex2DUnits : WebGLTexUnit[];
|
||||
glTexCubeUnits : WebGLTexUnit[];
|
||||
glFramebuffer : WebGLFramebuffer = 0;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXTextureView, GFXTextureViewInfo } from '../gfx-texture-view';
|
||||
import { GFXDevice } from '../device';
|
||||
import { GFXTextureView, GFXTextureViewInfo } from '../texture-view';
|
||||
import { WebGLGPUTextureView } from './webgl-gpu-objects';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
|
||||
export class WebGLGFXTextureView extends GFXTextureView {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGPUTexture } from './webgl-gpu-objects';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXTexture, GFXTextureInfo, GFXTextureFlagBit } from '../gfx-texture';
|
||||
import { GFXFormatSurfaceSize } from '../gfx-define';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { GFXTexture, GFXTextureInfo, GFXTextureFlagBit } from '../texture';
|
||||
import { GFXFormatSurfaceSize } from '../define';
|
||||
|
||||
export class WebGLGFXTexture extends GFXTexture {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { GFXDevice } from '../gfx-device';
|
||||
import { WebGLGFXDevice } from './webgl-gfx-device';
|
||||
import { GFXWindow, GFXWindowInfo } from '../gfx-window';
|
||||
import { GFXFramebufferInfo } from '../gfx-framebuffer';
|
||||
import { GFXRenderPassInfo, GFXColorAttachment, GFXLoadOp, GFXStoreOp, GFXTextureLayout, GFXPipelineBindPoint, GFXDepthStencilAttachment } from '../gfx-render-pass';
|
||||
import { GFXTextureType, GFXTextureUsageBit, GFXTextureFlagBit } from '../gfx-texture';
|
||||
import { GFXTextureViewType } from '../gfx-texture-view';
|
||||
import { GFXFormat } from '../gfx-define';
|
||||
import { GFXDevice } from '../device';
|
||||
import { WebGLGFXDevice } from './webgl-device';
|
||||
import { GFXWindow, GFXWindowInfo } from '../window';
|
||||
import { GFXFramebufferInfo } from '../framebuffer';
|
||||
import { GFXRenderPassInfo, GFXColorAttachment, GFXLoadOp, GFXStoreOp, GFXTextureLayout, GFXPipelineBindPoint, GFXDepthStencilAttachment } from '../render-pass';
|
||||
import { GFXTextureType, GFXTextureUsageBit, GFXTextureFlagBit } from '../texture';
|
||||
import { GFXTextureViewType } from '../texture-view';
|
||||
import { GFXFormat } from '../define';
|
||||
|
||||
export class WebGLGFXWindow extends GFXWindow {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXFramebuffer } from './gfx-framebuffer';
|
||||
import { GFXTexture } from './gfx-texture';
|
||||
import { GFXTextureView } from './gfx-texture-view';
|
||||
import { GFXFormat } from './gfx-define';
|
||||
import { GFXRenderPass } from './gfx-render-pass';
|
||||
import { GFXDevice } from './device';
|
||||
import { GFXFramebuffer } from './framebuffer';
|
||||
import { GFXTexture } from './texture';
|
||||
import { GFXTextureView } from './texture-view';
|
||||
import { GFXFormat } from './define';
|
||||
import { GFXRenderPass } from './render-pass';
|
||||
|
||||
export interface GFXWindowInfo {
|
||||
title?: string;
|
||||
@@ -1,13 +0,0 @@
|
||||
let RenderQueue = {
|
||||
OPAQUE: 0,
|
||||
TRANSPARENT: 1,
|
||||
OVERLAY: 2
|
||||
};
|
||||
|
||||
let PassStage = {
|
||||
DEFAULT: 1,
|
||||
FORWARD: 2,
|
||||
SHADOWCAST: 4
|
||||
};
|
||||
|
||||
export { RenderQueue, PassStage };
|
||||
@@ -0,0 +1,11 @@
|
||||
export enum RenderQueue {
|
||||
OPAQUE = 0,
|
||||
TRANSPARENT = 1,
|
||||
OVERLAY = 2
|
||||
};
|
||||
|
||||
export enum PassStage {
|
||||
DEFAULT = 1,
|
||||
FORWARD = 2,
|
||||
SHADOWCAST = 4
|
||||
};
|
||||
@@ -1,126 +0,0 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
import gfx from '../gfx';
|
||||
import { PassStage } from './constants';
|
||||
|
||||
export default class Pass {
|
||||
constructor(name) {
|
||||
this._programName = name;
|
||||
this._stage = PassStage.DEFAULT;
|
||||
|
||||
// cullmode
|
||||
this._cullMode = gfx.CULL_BACK;
|
||||
|
||||
// blending
|
||||
this._blend = false;
|
||||
this._blendEq = gfx.BLEND_FUNC_ADD;
|
||||
this._blendAlphaEq = gfx.BLEND_FUNC_ADD;
|
||||
this._blendSrc = gfx.BLEND_SRC_ALPHA;
|
||||
this._blendDst = gfx.BLEND_ONE_MINUS_SRC_ALPHA;
|
||||
this._blendSrcAlpha = gfx.BLEND_ONE;
|
||||
this._blendDstAlpha = gfx.BLEND_ZERO;
|
||||
this._blendColor = 0xffffffff;
|
||||
|
||||
// depth
|
||||
this._depthTest = false;
|
||||
this._depthWrite = false;
|
||||
this._depthFunc = gfx.DS_FUNC_LESS,
|
||||
|
||||
// stencil
|
||||
this._stencilTest = false;
|
||||
// front
|
||||
this._stencilFuncFront = gfx.DS_FUNC_ALWAYS;
|
||||
this._stencilRefFront = 0;
|
||||
this._stencilMaskFront = 0xff;
|
||||
this._stencilFailOpFront = gfx.STENCIL_OP_KEEP;
|
||||
this._stencilZFailOpFront = gfx.STENCIL_OP_KEEP;
|
||||
this._stencilZPassOpFront = gfx.STENCIL_OP_KEEP;
|
||||
this._stencilWriteMaskFront = 0xff;
|
||||
// back
|
||||
this._stencilFuncBack = gfx.DS_FUNC_ALWAYS;
|
||||
this._stencilRefBack = 0;
|
||||
this._stencilMaskBack = 0xff;
|
||||
this._stencilFailOpBack = gfx.STENCIL_OP_KEEP;
|
||||
this._stencilZFailOpBack = gfx.STENCIL_OP_KEEP;
|
||||
this._stencilZPassOpBack = gfx.STENCIL_OP_KEEP;
|
||||
this._stencilWriteMaskBack = 0xff;
|
||||
}
|
||||
|
||||
setStage(stage = PassStage.DEFAULT) {
|
||||
this._stage = stage;
|
||||
}
|
||||
|
||||
setCullMode(cullMode = gfx.CULL_BACK) {
|
||||
this._cullMode = cullMode;
|
||||
}
|
||||
|
||||
setBlend(
|
||||
enabled = false,
|
||||
blendEq = gfx.BLEND_FUNC_ADD,
|
||||
blendSrc = gfx.BLEND_SRC_ALPHA,
|
||||
blendDst = gfx.BLEND_ONE_MINUS_SRC_ALPHA,
|
||||
blendAlphaEq = gfx.BLEND_FUNC_ADD,
|
||||
blendSrcAlpha = gfx.BLEND_SRC_ALPHA,
|
||||
blendDstAlpha = gfx.BLEND_ONE_MINUS_SRC_ALPHA,
|
||||
blendColor = 0xffffffff
|
||||
) {
|
||||
this._blend = enabled;
|
||||
this._blendEq = blendEq;
|
||||
this._blendSrc = blendSrc;
|
||||
this._blendDst = blendDst;
|
||||
this._blendAlphaEq = blendAlphaEq;
|
||||
this._blendSrcAlpha = blendSrcAlpha;
|
||||
this._blendDstAlpha = blendDstAlpha;
|
||||
this._blendColor = blendColor;
|
||||
}
|
||||
|
||||
setDepth(
|
||||
depthTest = false,
|
||||
depthWrite = false,
|
||||
depthFunc = gfx.DS_FUNC_LESS
|
||||
) {
|
||||
this._depthTest = depthTest;
|
||||
this._depthWrite = depthWrite;
|
||||
this._depthFunc = depthFunc;
|
||||
}
|
||||
|
||||
setStencilFront(
|
||||
enabled = false,
|
||||
stencilFunc = gfx.DS_FUNC_ALWAYS,
|
||||
stencilRef = 0,
|
||||
stencilMask = 0xff,
|
||||
stencilFailOp = gfx.STENCIL_OP_KEEP,
|
||||
stencilZFailOp = gfx.STENCIL_OP_KEEP,
|
||||
stencilZPassOp = gfx.STENCIL_OP_KEEP,
|
||||
stencilWriteMask = 0xff
|
||||
) {
|
||||
this._stencilTest = enabled;
|
||||
this._stencilFuncFront = stencilFunc;
|
||||
this._stencilRefFront = stencilRef;
|
||||
this._stencilMaskFront = stencilMask;
|
||||
this._stencilFailOpFront = stencilFailOp;
|
||||
this._stencilZFailOpFront = stencilZFailOp;
|
||||
this._stencilZPassOpFront = stencilZPassOp;
|
||||
this._stencilWriteMaskFront = stencilWriteMask;
|
||||
}
|
||||
|
||||
setStencilBack(
|
||||
enabled = false,
|
||||
stencilFunc = gfx.DS_FUNC_ALWAYS,
|
||||
stencilRef = 0,
|
||||
stencilMask = 0xff,
|
||||
stencilFailOp = gfx.STENCIL_OP_KEEP,
|
||||
stencilZFailOp = gfx.STENCIL_OP_KEEP,
|
||||
stencilZPassOp = gfx.STENCIL_OP_KEEP,
|
||||
stencilWriteMask = 0xff
|
||||
) {
|
||||
this._stencilTest = enabled;
|
||||
this._stencilFuncBack = stencilFunc;
|
||||
this._stencilRefBack = stencilRef;
|
||||
this._stencilMaskBack = stencilMask;
|
||||
this._stencilFailOpBack = stencilFailOp;
|
||||
this._stencilZFailOpBack = stencilZFailOp;
|
||||
this._stencilZPassOpBack = stencilZPassOp;
|
||||
this._stencilWriteMaskBack = stencilWriteMask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
import { PassStage } from './constants';
|
||||
import { GFXBuffer } from '../../gfx/buffer';
|
||||
import { GFXSampler } from '../../gfx/sampler';
|
||||
import { GFXDevice } from '../../gfx/device';
|
||||
import { GFXDepthStencilAttachment, GFXColorAttachment } from '../../gfx/render-pass';
|
||||
import { GFXPipelineState, GFXPrimitiveMode, GFXRasterizerState, GFXDepthStencilState, GFXBlendState, GFXInputState } from '../../gfx/pipeline-state';
|
||||
import { GFXBindingLayoutInfo } from '../../gfx/binding-layout';
|
||||
|
||||
interface PassInfo {
|
||||
programName?: string;
|
||||
primitive?: GFXPrimitiveMode;
|
||||
stage?: PassStage;
|
||||
inputState?: GFXInputState;
|
||||
rasterizerState?: GFXRasterizerState;
|
||||
depthStencilState?: GFXDepthStencilState;
|
||||
blendState?: GFXBlendState;
|
||||
bindingLayoutInfo?: GFXBindingLayoutInfo;
|
||||
}
|
||||
|
||||
export default class Pass {
|
||||
static create(info: PassInfo) {
|
||||
let pass = new Pass();
|
||||
let device = pass._device = cc.game._renderContext;
|
||||
pass._programName = info.programName || '';
|
||||
pass._stage = info.stage || PassStage.DEFAULT;
|
||||
// pipeline state
|
||||
pass._pipelineState = device.createPipelineState({
|
||||
primitive: info.primitive || GFXPrimitiveMode.TRIANGLE_LIST,
|
||||
shader: null,
|
||||
is: Object.assign(new GFXInputState, info.inputState),
|
||||
rs: Object.assign(new GFXRasterizerState, info.rasterizerState),
|
||||
dss: Object.assign(new GFXDepthStencilState, info.depthStencilState),
|
||||
bs: Object.assign(new GFXBlendState, info.blendState),
|
||||
layout: device.createPipelineLayout({
|
||||
layouts: [device.createBindingLayout(info.bindingLayoutInfo || { bindings: [] })]
|
||||
}),
|
||||
renderPass: device.createRenderPass({
|
||||
colorAttachments: [new GFXColorAttachment],
|
||||
depthStencilAttachment: new GFXDepthStencilAttachment
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
protected _device: GFXDevice | null = null;
|
||||
protected _programName: string = '';
|
||||
protected _stage: PassStage = PassStage.DEFAULT;
|
||||
protected _pipelineState: GFXPipelineState | null = null;
|
||||
protected _buffers: GFXBuffer[] = [];
|
||||
protected _samplers: GFXSampler[] = [];
|
||||
}
|
||||
@@ -16,21 +16,6 @@ import RenderBuffer from './render-buffer';
|
||||
import FrameBuffer from './frame-buffer';
|
||||
import Device from './device';
|
||||
|
||||
import { GFXDevice } from './gfx-device';
|
||||
import { GFXBuffer } from './gfx-buffer';
|
||||
import { GFXTexture } from './gfx-texture';
|
||||
import { GFXTextureView } from './gfx-texture-view';
|
||||
import { GFXSampler } from './gfx-sampler';
|
||||
import { GFXShader } from './gfx-shader';
|
||||
import { GFXInputAssembler } from './gfx-input-assembler';
|
||||
import { GFXRenderPass } from './gfx-render-pass';
|
||||
import { GFXFramebuffer } from './gfx-framebuffer';
|
||||
import { GFXPipelineLayout } from './gfx-pipeline-layout';
|
||||
import { GFXPipelineState } from './gfx-pipeline-state';
|
||||
import { GFXCommandBuffer } from './gfx-command-buffer';
|
||||
import { GFXQueue } from './gfx-queue';
|
||||
import { WebGLGFXDevice } from './webgl/webgl-gfx-device';
|
||||
|
||||
let gfx = {
|
||||
// classes
|
||||
VertexFormat,
|
||||
@@ -53,18 +38,3 @@ Object.assign(gfx, enums);
|
||||
|
||||
export default gfx;
|
||||
cc.gfx = gfx;
|
||||
|
||||
cc.GFXDevice = GFXDevice;
|
||||
cc.GFXBuffer = GFXBuffer;
|
||||
cc.GFXTexture = GFXTexture;
|
||||
cc.GFXTextureView = GFXTextureView;
|
||||
cc.GFXSampler = GFXSampler;
|
||||
cc.GFXShader = GFXShader;
|
||||
cc.GFXInputAssembler = GFXInputAssembler;
|
||||
cc.GFXRenderPass = GFXRenderPass;
|
||||
cc.GFXFramebuffer = GFXFramebuffer;
|
||||
cc.GFXPipelineLayout = GFXPipelineLayout;
|
||||
cc.GFXPipelineState = GFXPipelineState;
|
||||
cc.GFXCommandBuffer = GFXCommandBuffer;
|
||||
cc.GFXQueue = GFXQueue;
|
||||
cc.WebGLGFXDevice = WebGLGFXDevice;
|
||||
|
||||
Reference in New Issue
Block a user