Skip to content

Commit ce642e5

Browse files
committed
[RHI] Unify several descriptor type names
1 parent 33a515f commit ce642e5

File tree

140 files changed

+3205
-3264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+3205
-3264
lines changed

axmol/2d/AtlasNode.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ bool AtlasNode::setProgramState(rhi::ProgramState* programState, bool ownPS /*=
9898
{
9999
if (Node::setProgramState(programState, ownPS))
100100
{
101-
auto& pipelineDescriptor = _quadCommand.getPipelineDescriptor();
102-
pipelineDescriptor.programState = _programState;
101+
auto& pipelineDesc = _quadCommand.getPipelineDesc();
102+
pipelineDesc.programState = _programState;
103103
_mvpMatrixLocation = _programState->getUniformLocation("u_MVPMatrix");
104104

105105
updateProgramStateTexture(_textureAtlas->getTexture());
@@ -134,7 +134,7 @@ void AtlasNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
134134
if (_textureAtlas->getTotalQuads() == 0)
135135
return;
136136

137-
auto programState = _quadCommand.getPipelineDescriptor().programState;
137+
auto programState = _quadCommand.getPipelineDesc().programState;
138138

139139
const auto& projectionMat = _director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
140140
programState->setUniform(_mvpMatrixLocation, projectionMat.m, sizeof(projectionMat.m));

axmol/2d/CameraBackgroundBrush.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ bool CameraBackgroundDepthBrush::init()
129129

130130
_locDepth = _programState->getUniformLocation("dpeth");
131131

132-
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
133-
pipelineDescriptor.programState = _programState;
132+
auto& pipelineDesc = _customCommand.getPipelineDesc();
133+
pipelineDesc.programState = _programState;
134134

135135
_vertices.resize(4);
136136
_vertices[0].position = Vec3(-1, -1, 0);
@@ -174,8 +174,8 @@ void CameraBackgroundDepthBrush::drawBackground(Camera* /*camera*/)
174174
renderer->addCommand(groupCommand);
175175
renderer->pushGroup(groupCommand->getRenderQueueID());
176176

177-
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
178-
auto& blend = pipelineDescriptor.blendDescriptor;
177+
auto& pipelineDesc = _customCommand.getPipelineDesc();
178+
auto& blend = pipelineDesc.blendDesc;
179179
blend.writeMask = _clearColor ? rhi::ColorWriteMask::ALL : rhi::ColorWriteMask::NONE;
180180

181181
// draw
@@ -191,19 +191,19 @@ void CameraBackgroundDepthBrush::onBeforeDraw()
191191
auto* renderer = Director::getInstance()->getRenderer();
192192
_stateBlock.stencilWriteMask = renderer->getStencilWriteMask();
193193
_stateBlock.depthTest = renderer->getDepthTest();
194-
_stateBlock.compareFunc = renderer->getDepthCompareFunction();
194+
_stateBlock.compareFunc = renderer->getDepthCompareFunc();
195195

196196
renderer->setStencilWriteMask(0);
197197
renderer->setDepthTest(true);
198-
renderer->setDepthCompareFunction(rhi::CompareFunction::ALWAYS);
198+
renderer->setDepthCompareFunc(rhi::CompareFunc::ALWAYS);
199199
}
200200

201201
void CameraBackgroundDepthBrush::onAfterDraw()
202202
{
203203
auto* renderer = Director::getInstance()->getRenderer();
204204
renderer->setStencilWriteMask(_stateBlock.stencilWriteMask);
205205
renderer->setDepthTest(_stateBlock.depthTest);
206-
renderer->setDepthCompareFunction(_stateBlock.compareFunc);
206+
renderer->setDepthCompareFunc(_stateBlock.compareFunc);
207207
}
208208

209209
//////////////////////////////////////////////////////////////////////////////////////////
@@ -223,7 +223,7 @@ void CameraBackgroundColorBrush::drawBackground(Camera* camera)
223223
{
224224
BlendFunc op = {BlendFunc::ALPHA_NON_PREMULTIPLIED.src, BlendFunc::ALPHA_NON_PREMULTIPLIED.dst};
225225

226-
auto& blend = _customCommand.getPipelineDescriptor().blendDescriptor;
226+
auto& blend = _customCommand.getPipelineDesc().blendDesc;
227227
blend.sourceRGBBlendFactor = blend.sourceAlphaBlendFactor = op.src;
228228
blend.destinationRGBBlendFactor = blend.destinationAlphaBlendFactor = op.dst;
229229
blend.blendEnabled = true;
@@ -350,8 +350,8 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera)
350350

351351
Mat4 cameraModelMat = camera->getNodeToWorldTransform();
352352

353-
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
354-
pipelineDescriptor.blendDescriptor.blendEnabled = false;
353+
auto& pipelineDesc = _customCommand.getPipelineDesc();
354+
pipelineDesc.blendDesc.blendEnabled = false;
355355

356356
Vec4 color(1.f, 1.f, 1.f, 1.f);
357357
cameraModelMat.m[12] = cameraModelMat.m[13] = cameraModelMat.m[14] = 0;
@@ -383,10 +383,10 @@ bool CameraBackgroundSkyBoxBrush::init()
383383
_uniformCameraRotLoc = _programState->getUniformLocation("u_cameraRot");
384384
_uniformEnvLoc = _programState->getUniformLocation("u_Env");
385385

386-
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
387-
pipelineDescriptor.programState = _programState;
386+
auto& pipelineDesc = _customCommand.getPipelineDesc();
387+
pipelineDesc.programState = _programState;
388388
// disable blend
389-
pipelineDescriptor.blendDescriptor.blendEnabled = false;
389+
pipelineDesc.blendDesc.blendEnabled = false;
390390

391391
initBuffer();
392392

@@ -449,7 +449,7 @@ void CameraBackgroundSkyBoxBrush::onBeforeDraw()
449449
auto* renderer = Director::getInstance()->getRenderer();
450450
_stateBlock.depthTest = renderer->getDepthTest();
451451
_stateBlock.depthWrite = renderer->getDepthWrite();
452-
_stateBlock.depthFunc = renderer->getDepthCompareFunction();
452+
_stateBlock.depthFunc = renderer->getDepthCompareFunc();
453453
_stateBlock.cullMode = renderer->getCullMode();
454454
}
455455

@@ -458,7 +458,7 @@ void CameraBackgroundSkyBoxBrush::onAfterDraw()
458458
auto* renderer = Director::getInstance()->getRenderer();
459459
renderer->setDepthTest(_stateBlock.depthTest);
460460
renderer->setDepthWrite(_stateBlock.depthWrite);
461-
renderer->setDepthCompareFunction(_stateBlock.depthFunc);
461+
renderer->setDepthCompareFunc(_stateBlock.depthFunc);
462462
renderer->setCullMode(_stateBlock.cullMode);
463463
}
464464

axmol/2d/CameraBackgroundBrush.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class AX_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
185185
{
186186
uint32_t stencilWriteMask = 0;
187187
bool depthTest = true;
188-
rhi::CompareFunction compareFunc = rhi::CompareFunction::ALWAYS;
188+
rhi::CompareFunc compareFunc = rhi::CompareFunc::ALWAYS;
189189
} _stateBlock;
190190
};
191191

@@ -317,7 +317,7 @@ class AX_DLL CameraBackgroundSkyBoxBrush : public CameraBackgroundBrush
317317
{
318318
bool depthTest = true;
319319
bool depthWrite = true;
320-
rhi::CompareFunction depthFunc = rhi::CompareFunction::ALWAYS;
320+
rhi::CompareFunc depthFunc = rhi::CompareFunc::ALWAYS;
321321
rhi::CullMode cullMode = rhi::CullMode::BACK;
322322
} _stateBlock;
323323
};

axmol/2d/DrawNode.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void DrawNode::updateShaderInternal(CustomCommand& cmd,
148148
CustomCommand::DrawType drawType,
149149
CustomCommand::PrimitiveType primitiveType)
150150
{
151-
auto& pipelinePS = cmd.getPipelineDescriptor().programState;
151+
auto& pipelinePS = cmd.getPipelineDesc().programState;
152152
AX_SAFE_RELEASE(pipelinePS);
153153

154154
auto program = axpm->getBuiltinProgram(programType);
@@ -160,50 +160,50 @@ void DrawNode::updateShaderInternal(CustomCommand& cmd,
160160

161161
void DrawNode::setVertexLayout(CustomCommand& cmd)
162162
{
163-
auto* programState = cmd.getPipelineDescriptor().programState;
163+
auto* programState = cmd.getPipelineDesc().programState;
164164
programState->validateSharedVertexLayout(rhi::VertexLayoutType::DrawNode);
165165
}
166166

167167
void DrawNode::freeShaderInternal(CustomCommand& cmd)
168168
{
169-
auto& pipelinePS = cmd.getPipelineDescriptor().programState;
169+
auto& pipelinePS = cmd.getPipelineDesc().programState;
170170
AX_SAFE_RELEASE_NULL(pipelinePS);
171171
}
172172

173173
void DrawNode::updateBlendState(CustomCommand& cmd)
174174
{
175-
rhi::BlendDescriptor& blendDescriptor = cmd.getPipelineDescriptor().blendDescriptor;
176-
blendDescriptor.blendEnabled = true;
175+
rhi::BlendDesc& blendDesc = cmd.getPipelineDesc().blendDesc;
176+
blendDesc.blendEnabled = true;
177177
if (_blendFunc == BlendFunc::ALPHA_NON_PREMULTIPLIED)
178178
{
179-
blendDescriptor.sourceRGBBlendFactor = rhi::BlendFactor::SRC_ALPHA;
180-
blendDescriptor.destinationRGBBlendFactor = rhi::BlendFactor::ONE_MINUS_SRC_ALPHA;
181-
blendDescriptor.sourceAlphaBlendFactor = rhi::BlendFactor::SRC_ALPHA;
182-
blendDescriptor.destinationAlphaBlendFactor = rhi::BlendFactor::ONE_MINUS_SRC_ALPHA;
179+
blendDesc.sourceRGBBlendFactor = rhi::BlendFactor::SRC_ALPHA;
180+
blendDesc.destinationRGBBlendFactor = rhi::BlendFactor::ONE_MINUS_SRC_ALPHA;
181+
blendDesc.sourceAlphaBlendFactor = rhi::BlendFactor::SRC_ALPHA;
182+
blendDesc.destinationAlphaBlendFactor = rhi::BlendFactor::ONE_MINUS_SRC_ALPHA;
183183
setOpacityModifyRGB(false);
184184
}
185185
else
186186
{
187-
blendDescriptor.sourceRGBBlendFactor = _blendFunc.src;
188-
blendDescriptor.destinationRGBBlendFactor = _blendFunc.dst;
189-
blendDescriptor.sourceAlphaBlendFactor = _blendFunc.src;
190-
blendDescriptor.destinationAlphaBlendFactor = _blendFunc.dst;
187+
blendDesc.sourceRGBBlendFactor = _blendFunc.src;
188+
blendDesc.destinationRGBBlendFactor = _blendFunc.dst;
189+
blendDesc.sourceAlphaBlendFactor = _blendFunc.src;
190+
blendDesc.destinationAlphaBlendFactor = _blendFunc.dst;
191191
setOpacityModifyRGB(true);
192192
}
193193
}
194194

195195
void DrawNode::updateUniforms(const Mat4& transform, CustomCommand& cmd)
196196
{
197-
auto& pipelineDescriptor = cmd.getPipelineDescriptor();
197+
auto& pipelineDesc = cmd.getPipelineDesc();
198198
const auto& matrixP = _director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
199199
Mat4 matrixMVP = matrixP * transform;
200-
auto mvpLocation = pipelineDescriptor.programState->getUniformLocation("u_MVPMatrix");
201-
pipelineDescriptor.programState->setUniform(mvpLocation, matrixMVP.m, sizeof(matrixMVP.m));
200+
auto mvpLocation = pipelineDesc.programState->getUniformLocation("u_MVPMatrix");
201+
pipelineDesc.programState->setUniform(mvpLocation, matrixMVP.m, sizeof(matrixMVP.m));
202202

203203
// FIXME: consider whether 'u_alpha' is a redundant uniform in shaders?
204204
float alpha = _displayedColor.a / 255.0f;
205-
auto alphaUniformLocation = pipelineDescriptor.programState->getUniformLocation("u_alpha");
206-
pipelineDescriptor.programState->setUniform(alphaUniformLocation, &alpha, sizeof(alpha));
205+
auto alphaUniformLocation = pipelineDesc.programState->getUniformLocation("u_alpha");
206+
pipelineDesc.programState->setUniform(alphaUniformLocation, &alpha, sizeof(alpha));
207207
}
208208

209209
void DrawNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)

axmol/2d/FastTMXLayer.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ FastTMXLayer::~FastTMXLayer()
125125

126126
for (auto&& e : _customCommands)
127127
{
128-
AX_SAFE_RELEASE(e.second->getPipelineDescriptor().programState);
128+
AX_SAFE_RELEASE(e.second->getPipelineDesc().programState);
129129
delete e.second;
130130
}
131131
}
@@ -163,8 +163,8 @@ void FastTMXLayer::draw(Renderer* renderer, const Mat4& transform, uint32_t flag
163163
{
164164
if (e.second->getIndexDrawCount() > 0)
165165
{
166-
auto mvpmatrixLocation = e.second->getPipelineDescriptor().programState->getUniformLocation("u_MVPMatrix");
167-
e.second->getPipelineDescriptor().programState->setUniform(mvpmatrixLocation, finalMat.m,
166+
auto mvpmatrixLocation = e.second->getPipelineDesc().programState->getUniformLocation("u_MVPMatrix");
167+
e.second->getPipelineDesc().programState->setUniform(mvpmatrixLocation, finalMat.m,
168168
sizeof(finalMat.m));
169169
renderer->addCommand(e.second);
170170
}
@@ -446,30 +446,30 @@ void FastTMXLayer::updatePrimitives()
446446

447447
command->setIndexDrawInfo(start * 6, iter.second * 6);
448448

449-
auto& pipelineDescriptor = command->getPipelineDescriptor();
449+
auto& pipelineDesc = command->getPipelineDesc();
450450

451451
if (_useAutomaticVertexZ)
452452
{
453-
AX_SAFE_RELEASE(pipelineDescriptor.programState);
453+
AX_SAFE_RELEASE(pipelineDesc.programState);
454454
auto* program =
455455
axpm->getBuiltinProgram(rhi::ProgramType::POSITION_TEXTURE_COLOR_ALPHA_TEST);
456456
auto programState = new rhi::ProgramState(program);
457-
pipelineDescriptor.programState = programState;
458-
_alphaValueLocation = pipelineDescriptor.programState->getUniformLocation("u_alpha_value");
459-
pipelineDescriptor.programState->setUniform(_alphaValueLocation, &_alphaFuncValue,
457+
pipelineDesc.programState = programState;
458+
_alphaValueLocation = pipelineDesc.programState->getUniformLocation("u_alpha_value");
459+
pipelineDesc.programState->setUniform(_alphaValueLocation, &_alphaFuncValue,
460460
sizeof(_alphaFuncValue));
461461
}
462462
else
463463
{
464-
AX_SAFE_RELEASE(pipelineDescriptor.programState);
464+
AX_SAFE_RELEASE(pipelineDesc.programState);
465465
auto* program = axpm->getBuiltinProgram(rhi::ProgramType::POSITION_TEXTURE_COLOR);
466466
auto programState = new rhi::ProgramState(program);
467-
pipelineDescriptor.programState = programState;
467+
pipelineDesc.programState = programState;
468468
}
469469

470-
_mvpMatrixLocaiton = pipelineDescriptor.programState->getUniformLocation("u_MVPMatrix");
471-
_textureLocation = pipelineDescriptor.programState->getUniformLocation("u_tex0");
472-
pipelineDescriptor.programState->setTexture(_textureLocation, 0, _texture->getBackendTexture());
470+
_mvpMatrixLocaiton = pipelineDesc.programState->getUniformLocation("u_MVPMatrix");
471+
_textureLocation = pipelineDesc.programState->getUniformLocation("u_tex0");
472+
pipelineDesc.programState->setTexture(_textureLocation, 0, _texture->getBackendTexture());
473473
command->init(_globalZOrder, blendfunc);
474474

475475
_customCommands[iter.first] = command;

axmol/2d/Grid.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ bool GridBase::initWithSize(const Vec2& gridSize, const ax::Rect& rect)
5757

5858
Texture2D* texture = new Texture2D();
5959

60-
rhi::TextureDescriptor descriptor;
60+
rhi::TextureDesc descriptor;
6161
descriptor.width = POTWide;
6262
descriptor.height = POTHigh;
6363
descriptor.textureUsage = rhi::TextureUsage::RENDER_TARGET;
6464
descriptor.textureFormat = rhi::PixelFormat::RGBA8;
65-
texture->updateTextureDescriptor(descriptor);
65+
texture->updateTextureDesc(descriptor);
6666

6767
initWithSize(gridSize, texture, false, rect);
6868

@@ -104,13 +104,13 @@ bool GridBase::initWithSize(const Vec2& gridSize, Texture2D* texture, bool flipp
104104
_step.x = _gridRect.size.width / _gridSize.width;
105105
_step.y = _gridRect.size.height / _gridSize.height;
106106

107-
auto& pipelineDescriptor = _drawCommand.getPipelineDescriptor();
107+
auto& pipelineDesc = _drawCommand.getPipelineDesc();
108108
AX_SAFE_RELEASE(_programState);
109109
auto* program = axpm->getBuiltinProgram(rhi::ProgramType::POSITION_TEXTURE);
110110
_programState = new rhi::ProgramState(program);
111-
pipelineDescriptor.programState = _programState;
112-
_mvpMatrixLocation = pipelineDescriptor.programState->getUniformLocation("u_MVPMatrix");
113-
_textureLocation = pipelineDescriptor.programState->getUniformLocation("u_tex0");
111+
pipelineDesc.programState = _programState;
112+
_mvpMatrixLocation = pipelineDesc.programState->getUniformLocation("u_MVPMatrix");
113+
_textureLocation = pipelineDesc.programState->getUniformLocation("u_tex0");
114114

115115
#define VERTEX_POSITION_SIZE 3
116116
#define VERTEX_TEXCOORD_SIZE 2
@@ -383,7 +383,7 @@ void Grid3D::blit()
383383
_drawCommand.init(0, _blendFunc);
384384
Director::getInstance()->getRenderer()->addCommand(&_drawCommand);
385385
ax::Mat4 projectionMat = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
386-
auto programState = _drawCommand.getPipelineDescriptor().programState;
386+
auto programState = _drawCommand.getPipelineDesc().programState;
387387
programState->setUniform(_mvpMatrixLocation, projectionMat.m, sizeof(projectionMat.m));
388388
programState->setTexture(_textureLocation, 0, _texture->getBackendTexture());
389389
}
@@ -633,7 +633,7 @@ void TiledGrid3D::blit()
633633
updateVertexBuffer();
634634
Director::getInstance()->getRenderer()->addCommand(&_drawCommand);
635635
ax::Mat4 projectionMat = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
636-
auto programState = _drawCommand.getPipelineDescriptor().programState;
636+
auto programState = _drawCommand.getPipelineDesc().programState;
637637
programState->setUniform(_mvpMatrixLocation, projectionMat.m, sizeof(projectionMat.m));
638638
programState->setTexture(_textureLocation, 0, _texture->getBackendTexture());
639639
}

0 commit comments

Comments
 (0)