Skip to content

Commit

Permalink
Continue 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar committed Nov 25, 2024
1 parent 10233d6 commit db5df7c
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
10 changes: 5 additions & 5 deletions cocos/gfx/webgl/webgl-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ export function WebGLCmdFuncCreateShader (device: WebGLDevice, gpuShader: IWebGL
const block = gpuShader.blocks[i];

const glBlock: IWebGLGPUUniformBlock = {
set$: block.set,
set: block.set,
binding: block.binding,
name: block.name,
size: 0,
Expand Down Expand Up @@ -1259,7 +1259,7 @@ export function WebGLCmdFuncCreateShader (device: WebGLDevice, gpuShader: IWebGL
for (let i = 0; i < gpuShader.samplerTextures.length; ++i) {
const sampler = gpuShader.samplerTextures[i];
gpuShader.glSamplerTextures[i] = {
set$: sampler.set,
set: sampler.set,
binding: sampler.binding,
name: sampler.name,
type: sampler.type,
Expand Down Expand Up @@ -1967,14 +1967,14 @@ export function WebGLCmdFuncBindStates (

for (let j = 0; j < blockLen; j++) {
const glBlock = gpuShader.glBlocks[j];
const gpuDescriptorSet = gpuDescriptorSets[glBlock.set$];
const gpuDescriptorSet = gpuDescriptorSets[glBlock.set];
const descriptorIdx = gpuDescriptorSet && gpuDescriptorSet.descriptorIndices[glBlock.binding];
const gpuDescriptor = descriptorIdx >= 0 && gpuDescriptorSet.gpuDescriptors[descriptorIdx];
let vf32: Float32Array | null = null; let offset = 0;

if (gpuDescriptor && gpuDescriptor.gpuBuffer) {
const { gpuBuffer } = gpuDescriptor;
const dynamicOffsetIndexSet = dynamicOffsetIndices[glBlock.set$];
const dynamicOffsetIndexSet = dynamicOffsetIndices[glBlock.set];
const dynamicOffsetIndex = dynamicOffsetIndexSet && dynamicOffsetIndexSet[glBlock.binding];
if (dynamicOffsetIndex >= 0) { offset = dynamicOffsets[dynamicOffsetIndex]; }

Expand Down Expand Up @@ -2152,7 +2152,7 @@ export function WebGLCmdFuncBindStates (
const samplerLen = gpuShader.glSamplerTextures.length;
for (let i = 0; i < samplerLen; i++) {
const glSampler = gpuShader.glSamplerTextures[i];
const gpuDescriptorSet = gpuDescriptorSets[glSampler.set$];
const gpuDescriptorSet = gpuDescriptorSets[glSampler.set];
let descriptorIndex = gpuDescriptorSet && gpuDescriptorSet.descriptorIndices[glSampler.binding];
let gpuDescriptor = descriptorIndex >= 0 && gpuDescriptorSet.gpuDescriptors[descriptorIndex];

Expand Down
4 changes: 2 additions & 2 deletions cocos/gfx/webgl/webgl-gpu-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export interface IWebGLGPUUniform {
}

export interface IWebGLGPUUniformBlock {
set$: number;
set: number;
binding: number;
name: string;
size: number;
Expand All @@ -228,7 +228,7 @@ export interface IWebGLGPUUniformBlock {
}

export interface IWebGLGPUUniformSamplerTexture {
set$: number;
set: number;
binding: number;
name: string;
type: Type;
Expand Down
8 changes: 4 additions & 4 deletions cocos/gfx/webgl/webgl-input-assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export class WebGLInputAssembler extends InputAssembler {

this._gpuInputAssembler = {
attributes: info.attributes,
gpuVertexBuffers: gpuVertexBuffers,
gpuIndexBuffer: gpuIndexBuffer,
gpuIndirectBuffer: gpuIndirectBuffer,
gpuVertexBuffers,
gpuIndexBuffer,
gpuIndirectBuffer,

glAttribs: [],
glIndexType: glIndexType,
glIndexType,
glVAOs: new Map<WebGLProgram, WebGLVertexArrayObjectOES>(),
};

Expand Down
8 changes: 4 additions & 4 deletions cocos/gfx/webgl/webgl-pipeline-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export class WebGLPipelineLayout extends PipelineLayout {
}

this._gpuPipelineLayout = {
gpuSetLayouts: gpuSetLayouts,
dynamicOffsetIndices: dynamicOffsetIndices,
dynamicOffsetCount: dynamicOffsetCount,
dynamicOffsetOffsets: dynamicOffsetOffsets,
gpuSetLayouts,
dynamicOffsetIndices,
dynamicOffsetCount,
dynamicOffsetOffsets,
};
}

Expand Down
2 changes: 1 addition & 1 deletion cocos/gfx/webgl/webgl-pipeline-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class WebGLPipelineState extends PipelineState {
dss: info.depthStencilState,
bs: info.blendState,
gpuRenderPass: (info.renderPass as WebGLRenderPass).gpuRenderPass,
dynamicStates: dynamicStates,
dynamicStates,
};
}

Expand Down
10 changes: 5 additions & 5 deletions cocos/gfx/webgl2/webgl2-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ export function WebGL2CmdFuncCreateShader (device: WebGL2Device, gpuShader: IWeb
gl.uniformBlockBinding(gpuShader.glProgram, blockIdx, glBinding);

gpuShader.glBlocks[b] = {
set$: block.set,
set: block.set,
binding: block.binding,
idx$: blockIdx,
name: blockName,
Expand All @@ -1628,7 +1628,7 @@ export function WebGL2CmdFuncCreateShader (device: WebGL2Device, gpuShader: IWeb
for (let i = 0; i < gpuShader.samplerTextures.length; ++i) {
const sampler = gpuShader.samplerTextures[i];
gpuShader.glSamplerTextures[i] = {
set$: sampler.set,
set: sampler.set,
binding: sampler.binding,
name: sampler.name,
type: sampler.type,
Expand Down Expand Up @@ -2255,7 +2255,7 @@ export function WebGL2CmdFuncBindStates (

for (let j = 0; j < blockLen; j++) {
const glBlock = gpuShader.glBlocks[j];
const gpuDescriptorSet = gpuDescriptorSets[glBlock.set$];
const gpuDescriptorSet = gpuDescriptorSets[glBlock.set];
const descriptorIndex = gpuDescriptorSet && gpuDescriptorSet.descriptorIndices[glBlock.binding];
const gpuDescriptor = descriptorIndex >= 0 && gpuDescriptorSet.gpuDescriptors[descriptorIndex];

Expand All @@ -2264,7 +2264,7 @@ export function WebGL2CmdFuncBindStates (
continue;
}

const dynamicOffsetIndexSet = dynamicOffsetIndices[glBlock.set$];
const dynamicOffsetIndexSet = dynamicOffsetIndices[glBlock.set];
const dynamicOffsetIndex = dynamicOffsetIndexSet && dynamicOffsetIndexSet[glBlock.binding];
let offset = gpuDescriptor.gpuBuffer.glOffset;
if (dynamicOffsetIndex >= 0) { offset += dynamicOffsets[dynamicOffsetIndex]; }
Expand All @@ -2290,7 +2290,7 @@ export function WebGL2CmdFuncBindStates (
const samplerLen = gpuShader.glSamplerTextures.length;
for (let i = 0; i < samplerLen; i++) {
const glSampler = gpuShader.glSamplerTextures[i];
const gpuDescriptorSet = gpuDescriptorSets[glSampler.set$];
const gpuDescriptorSet = gpuDescriptorSets[glSampler.set];
let descriptorIndex = gpuDescriptorSet && gpuDescriptorSet.descriptorIndices[glSampler.binding];
let gpuDescriptor = descriptorIndex >= 0 && gpuDescriptorSet.gpuDescriptors[descriptorIndex];

Expand Down
4 changes: 2 additions & 2 deletions cocos/gfx/webgl2/webgl2-gpu-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export interface IWebGL2GPUUniform {
}

export interface IWebGL2GPUUniformBlock {
set$: number;
set: number;
binding: number;
idx$: number;
name: string;
Expand All @@ -229,7 +229,7 @@ export interface IWebGL2GPUUniformBlock {
}

export interface IWebGL2GPUUniformSamplerTexture {
set$: number;
set: number;
binding: number;
name: string;
type: Type;
Expand Down
8 changes: 4 additions & 4 deletions cocos/gfx/webgl2/webgl2-input-assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ export class WebGL2InputAssembler extends InputAssembler {

this._gpuInputAssembler = {
attributes: info.attributes,
gpuVertexBuffers: gpuVertexBuffers,
gpuIndexBuffer: gpuIndexBuffer,
gpuIndirectBuffer: gpuIndirectBuffer,
gpuVertexBuffers,
gpuIndexBuffer,
gpuIndirectBuffer,

glAttribs: [],
glIndexType: glIndexType,
glIndexType,
glVAOs: new Map<WebGLProgram, WebGLVertexArrayObject>(),
};

Expand Down
8 changes: 4 additions & 4 deletions cocos/gfx/webgl2/webgl2-pipeline-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export class WebGL2PipelineLayout extends PipelineLayout {
}

this._gpuPipelineLayout = {
gpuSetLayouts: gpuSetLayouts,
dynamicOffsetIndices: dynamicOffsetIndices,
dynamicOffsetCount: dynamicOffsetCount,
dynamicOffsetOffsets: dynamicOffsetOffsets,
gpuSetLayouts,
dynamicOffsetIndices,
dynamicOffsetCount,
dynamicOffsetOffsets,
};
}

Expand Down
2 changes: 1 addition & 1 deletion cocos/gfx/webgl2/webgl2-pipeline-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class WebGL2PipelineState extends PipelineState {
dss: info.depthStencilState,
bs: info.blendState,
gpuRenderPass: (info.renderPass as WebGL2RenderPass).getGpuRenderPass(),
dynamicStates: dynamicStates,
dynamicStates,
};
}

Expand Down

0 comments on commit db5df7c

Please sign in to comment.