Remove render backend setLineWidth [skip ci]

Due to not all of GL and Metal support it, so remove it unify behavior
developers shouldn't relay on it
This commit is contained in:
halx99 2023-08-25 16:49:08 +08:00
parent 1a12e5439a
commit 55cd8253f6
9 changed files with 10 additions and 49 deletions

View File

@ -244,7 +244,6 @@ void DrawNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
{
updateBlendState(_customCommandLine);
updateUniforms(transform, _customCommandLine);
_customCommandLine.setLineWidth(_lineWidth);
_customCommandLine.init(_globalZOrder);
renderer->addCommand(&_customCommandLine);
}

View File

@ -210,11 +210,6 @@ void NavMeshDebugDraw::draw(Renderer* renderer)
initCustomCommand(command);
command.setBeforeCallback(AX_CALLBACK_0(NavMeshDebugDraw::onBeforeEachCommand, this, iter->depthMask));
if (iter->type == backend::PrimitiveType::LINE)
{
command.setLineWidth(iter->size);
}
command.setVertexBuffer(_vertexBuffer);
command.setPrimitiveType(iter->type);
command.setVertexDrawInfo(iter->start, iter->end - iter->start);

View File

@ -206,9 +206,6 @@ TODO: should remove it.
inline std::size_t getIndexDrawOffset() const { return _indexDrawOffset; }
inline std::size_t getIndexDrawCount() const { return _indexDrawCount; }
inline void setLineWidth(float lineWidth) { _lineWidth = lineWidth; }
inline float getLineWidth() const { return _lineWidth; }
inline IndexFormat getIndexFormat() const { return _indexFormat; }
inline void setIndexFormat(IndexFormat format) { _indexFormat = format; }

View File

@ -745,7 +745,6 @@ void Renderer::drawCustomCommand(RenderCommand* command)
_commandBuffer->setProgramState(cmd->getPipelineDescriptor().programState);
auto drawType = cmd->getDrawType();
_commandBuffer->setLineWidth(cmd->getLineWidth());
if (CustomCommand::DrawType::ELEMENT == drawType)
{
_commandBuffer->setIndexBuffer(cmd->getIndexBuffer());

View File

@ -206,12 +206,6 @@ public:
*/
virtual void endFrame() = 0;
/**
* Fixed-function state
* @param lineWidth Specifies the width of rasterized lines.
*/
virtual void setLineWidth(float lineWidth) = 0;
/**
* Fixed-function state
* @param x, y Specifies the lower left corner of the scissor box

View File

@ -58,9 +58,9 @@ public:
/// get built-in program
Program* getBuiltinProgram(uint32_t type);
/*
/**
* register a custom program
* @returns
* @return
* the id of custom program, 0: fail, the id can use by loadProgram
*/
uint64_t registerCustomProgram(std::string_view vsName,
@ -68,7 +68,7 @@ public:
VertexLayoutType vlt = VertexLayoutType::Unspec,
bool force = false);
/*
/**
* load a builtin/or custom program:
* @param id: the id of program to load, the id value returned by registerCustomProgram
* or builtin programType, whe the id < ProgramType:BUILTIN_COUNT, this function
@ -76,14 +76,13 @@ public:
*/
Program* loadProgram(uint64_t progId);
/*
* load a program with vsName, fsName as CUSTOM immediately without register
* @params
* @param vsName: the vertex shader name: custom/xxx_vs
* @param fsName: the fragment shader name: custom/xxx_vs
* @param vlt: the builtin vertex layout type used for loading program
* @returns Program* (nullable)
* @remark: the returend program type always ProgramType::CUSTOM_PROGRAM
/**
* @brief Load a program with vsName, fsName as CUSTOM immediately without register
* @param vsName the vertex shader name: custom/xxx_vs
* @param fsName the fragment shader name: custom/xxx_vs
* @param vlt the builtin vertex layout type used for loading program
* @return Program* (nullable)
* @remark the returend program type always ProgramType::CUSTOM_PROGRAM
*/
Program* loadProgram(std::string_view vsName,
std::string_view fsName,

View File

@ -186,14 +186,6 @@ public:
void endEncoding();
/**
* Fixed-function state
* @param lineWidth Specifies the width of rasterized lines.
* @todo Currently metal do not support setting line with. A Corresponding issue had create
* here:https://github.com/cocos2d/cocos2d-x/issues/19772
*/
virtual void setLineWidth(float lineWidth) override;
/**
* Fixed-function state
* @param x, y Specifies the lower left corner of the scissor box

View File

@ -426,14 +426,6 @@ void CommandBufferGL::cleanResources()
AX_SAFE_RELEASE_NULL(_programState);
}
void CommandBufferGL::setLineWidth(float lineWidth)
{
if (lineWidth > 0.0f)
__gl->lineWidth(lineWidth);
else
__gl->lineWidth(1.0f);
}
void CommandBufferGL::setScissorRect(bool isEnabled, float x, float y, float width, float height)
{
if (isEnabled)

View File

@ -190,12 +190,6 @@ public:
*/
virtual void endFrame() override;
/**
* Fixed-function state
* @param lineWidth Specifies the width of rasterized lines.
*/
virtual void setLineWidth(float lineWidth) override;
/**
* Fixed-function state
* @param x, y Specifies the lower left corner of the scissor box