mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
GFXInputState GFXPipelineStateInfo use jsb binded class (#7473)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
"moduleOverrides": {
|
||||
"cocos/core/pipeline/index.ts": "cocos/core/pipeline/index.jsb.ts",
|
||||
"cocos/core/renderer/core/native-pools.ts": "cocos/core/renderer/core/native-pools.jsb.ts",
|
||||
"cocos/core/gfx/pipeline-state.ts": "cocos/core/gfx/pipeline-state.jsb.ts",
|
||||
"cocos/core/gfx/index.ts": "cocos/core/gfx/index.jsb.ts"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/**
|
||||
* @category gfx
|
||||
*/
|
||||
declare const gfx: any;
|
||||
|
||||
import { GFXBuffer } from './buffer';
|
||||
import { GFXCommandBuffer } from './command-buffer';
|
||||
@@ -30,8 +28,14 @@ export * from './render-pass';
|
||||
export * from './sampler';
|
||||
export * from './shader';
|
||||
export * from './texture';
|
||||
export * from './pipeline-state.jsb';
|
||||
|
||||
export const GFXRasterizerState = gfx.RasterizerState;
|
||||
export const GFXDepthStencilState = gfx.DepthStencilState;
|
||||
export const GFXBlendTarget = gfx.BlendTarget;
|
||||
export const GFXBlendState = gfx.BlendState;
|
||||
export const GFXPipelineState = gfx.PipelineState;
|
||||
export const GFXPipelineStateInfo = gfx.PipelineStateInfo;
|
||||
export const GFXInputState = gfx.InputState;
|
||||
|
||||
legacyCC.GFXDevice = GFXDevice;
|
||||
legacyCC.GFXBuffer = GFXBuffer;
|
||||
@@ -41,7 +45,7 @@ legacyCC.GFXShader = GFXShader;
|
||||
legacyCC.GFXInputAssembler = GFXInputAssembler;
|
||||
legacyCC.GFXRenderPass = GFXRenderPass;
|
||||
legacyCC.GFXFramebuffer = GFXFramebuffer;
|
||||
legacyCC.GFXPipelineState = gfx.PipelineState;
|
||||
legacyCC.GFXPipelineState = GFXPipelineState;
|
||||
legacyCC.GFXCommandBuffer = GFXCommandBuffer;
|
||||
legacyCC.GFXQueue = GFXQueue;
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export const GFXRasterizerState = gfx.RasterizerState;
|
||||
export const GFXDepthStencilState = gfx.DepthStencilState;
|
||||
export const GFXBlendTarget = gfx.BlendTarget;
|
||||
export const GFXBlendState = gfx.BlendState;
|
||||
export const GFXPipelineState = gfx.PipelineState;
|
||||
@@ -19,8 +19,7 @@ export class PipelineStateManager {
|
||||
let pso = this._PSOHashMap.get(newHash);
|
||||
if (!pso) {
|
||||
const pipelineLayout = PipelineLayoutPool.get(PassPool.get(hPass, PassView.PIPELINE_LAYOUT));
|
||||
const inputState = new GFXInputState();
|
||||
inputState.attributes = ia.attributes;
|
||||
const inputState = new GFXInputState(ia.attributes);
|
||||
const psoInfo = new GFXPipelineStateInfo(
|
||||
shader, pipelineLayout, renderPass, inputState,
|
||||
RasterizerStatePool.get(PassPool.get(hPass, PassView.RASTERIZER_STATE)),
|
||||
|
||||
@@ -251,52 +251,6 @@ let _converters = {
|
||||
PushConstantRange: function (range) {
|
||||
return new gfx.PushConstantRange(range.shaderType, range.offset, range.count);
|
||||
},
|
||||
InputState: function (info) {
|
||||
let attrs = info.attributes;
|
||||
let jsbAttrs;
|
||||
if (attrs) {
|
||||
jsbAttrs = [];
|
||||
for (let i = 0; i < attrs.length; ++i) {
|
||||
jsbAttrs.push(_converters.Attribute(attrs[i]));
|
||||
}
|
||||
}
|
||||
return new gfx.InputState(jsbAttrs);
|
||||
},
|
||||
RasterizerState: function (info) {
|
||||
return new gfx.RasterizerState(info);
|
||||
},
|
||||
DepthStencilState: function (info) {
|
||||
return new gfx.DepthStencilState(info);
|
||||
},
|
||||
BlendTarget: function (info) {
|
||||
return new gfx.BlendTarget(info);
|
||||
},
|
||||
BlendState: function (state) {
|
||||
let targets = state.targets;
|
||||
let jsbTargets;
|
||||
if (targets) {
|
||||
jsbTargets = [];
|
||||
for (let i = 0; i < targets.length; ++i) {
|
||||
jsbTargets.push(_converters.BlendTarget(targets[i]));
|
||||
}
|
||||
}
|
||||
let color = _converters.Color(state.blendColor);
|
||||
return new gfx.BlendState(state.isA2c, state.isIndepend, color, jsbTargets);
|
||||
},
|
||||
PipelineStateInfo: function (info) {
|
||||
let jsbInfo = {
|
||||
primitive: info.primitive,
|
||||
shader: info.shader,
|
||||
inputState: _converters.InputState(info.inputState),
|
||||
rasterizerState: _converters.RasterizerState(info.rasterizerState),
|
||||
depthStencilState: _converters.DepthStencilState(info.depthStencilState),
|
||||
blendState: _converters.BlendState(info.blendState),
|
||||
dynamicStates: info.dynamicStates,
|
||||
renderPass: info.renderPass,
|
||||
pipelineLayout: info.pipelineLayout,
|
||||
}
|
||||
return new gfx.PipelineStateInfo(jsbInfo);
|
||||
},
|
||||
CommandBufferInfo: function (info) {
|
||||
return new gfx.CommandBufferInfo(info);
|
||||
},
|
||||
@@ -388,7 +342,6 @@ deviceProtos.forEach(function(item, index) {
|
||||
createDescriptorSet: replaceFunction('_createDescriptorSet', _converters.DescriptorSetInfo),
|
||||
createDescriptorSetLayout: replaceFunction('_createDescriptorSetLayout', _converters.DescriptorSetLayoutInfo),
|
||||
createPipelineLayout: replaceFunction('_createPipelineLayout', _converters.PipelineLayoutInfo),
|
||||
createPipelineState: replaceFunction('_createPipelineState', _converters.PipelineStateInfo),
|
||||
copyBuffersToTexture: replaceFunction('_copyBuffersToTexture', _converters.origin, _converters.origin, _converters.BufferTextureCopyList),
|
||||
copyTexImagesToTexture: replaceFunction('_copyTexImagesToTexture', _converters.texImagesToBuffers, _converters.origin, _converters.BufferTextureCopyList),
|
||||
});
|
||||
@@ -453,11 +406,6 @@ replace(pipelineLayoutProto, {
|
||||
initialize: replaceFunction('_initialize', _converters.PipelineLayoutInfo),
|
||||
});
|
||||
|
||||
let pipelineStateProto = gfx.PipelineState.prototype;
|
||||
replace(pipelineStateProto, {
|
||||
initialize: replaceFunction('_initialize', _converters.PipelineStateInfo),
|
||||
});
|
||||
|
||||
let queueProto = gfx.Queue.prototype;
|
||||
replace(queueProto, {
|
||||
initialize: replaceFunction('_initialize', _converters.QueueInfo),
|
||||
|
||||
Reference in New Issue
Block a user