Skip to content

Commit

Permalink
Fix descriptor typo (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulocoutinhox authored May 25, 2024
1 parent e49a28f commit 49ba0dd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion core/renderer/backend/RenderPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RenderTarget;
class RenderPipeline : public ax::Object
{
public:
virtual void update(const RenderTarget*, const PipelineDescriptor& pipelineDescirptor) = 0;
virtual void update(const RenderTarget*, const PipelineDescriptor& pipelineDescriptor) = 0;

protected:
virtual ~RenderPipeline() = default;
Expand Down
2 changes: 1 addition & 1 deletion core/renderer/backend/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class TextureBackend : public Object

protected:
/**
* @param descriptor Specifies the texture descirptor.
* @param descriptor Specifies the texture descriptor.
*/
TextureBackend() {}
virtual ~TextureBackend();
Expand Down
22 changes: 11 additions & 11 deletions core/renderer/backend/metal/RenderPipelineMTL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ MTLBlendOperation toMTLBlendOperation(BlendOperation operation)

RenderPipelineMTL::RenderPipelineMTL(id<MTLDevice> mtlDevice) : _mtlDevice(mtlDevice) {}

void RenderPipelineMTL::update(const RenderTarget* renderTarget, const PipelineDescriptor& pipelineDescirptor)
void RenderPipelineMTL::update(const RenderTarget* renderTarget, const PipelineDescriptor& pipelineDescriptor)
{
struct
{
Expand All @@ -183,9 +183,9 @@ MTLBlendOperation toMTLBlendOperation(BlendOperation operation)
} hashMe;

memset(&hashMe, 0, sizeof(hashMe));
const auto& blendDescriptor = pipelineDescirptor.blendDescriptor;
const auto& blendDescriptor = pipelineDescriptor.blendDescriptor;
chooseAttachmentFormat(renderTarget, _colorAttachmentsFormat, _depthAttachmentFormat, _stencilAttachmentFormat);
auto program = static_cast<ProgramMTL*>(pipelineDescirptor.programState->getProgram());
auto program = static_cast<ProgramMTL*>(pipelineDescriptor.programState->getProgram());
hashMe.vertexShaderHash = program->getVertexShader()->getHashValue();
hashMe.fragmentShaderHash = program->getFragmentShader()->getHashValue();
memcpy(&hashMe.colorAttachment, &_colorAttachmentsFormat, sizeof(_colorAttachmentsFormat));
Expand All @@ -200,7 +200,7 @@ MTLBlendOperation toMTLBlendOperation(BlendOperation operation)
hashMe.sourceAlphaBlendFactor = (unsigned int)blendDescriptor.sourceAlphaBlendFactor;
hashMe.destinationAlphaBlendFactor = (unsigned int)blendDescriptor.destinationAlphaBlendFactor;
int index = 0;
auto vertexLayout = pipelineDescirptor.programState->getVertexLayout();
auto vertexLayout = pipelineDescriptor.programState->getVertexLayout();
const auto& attributes = vertexLayout->getAttributes();
for (const auto& it : attributes)
{
Expand All @@ -225,10 +225,10 @@ MTLBlendOperation toMTLBlendOperation(BlendOperation operation)

_mtlRenderPipelineDescriptor = [[MTLRenderPipelineDescriptor alloc] init];

setShaderModules(pipelineDescirptor);
setVertexLayout(_mtlRenderPipelineDescriptor, pipelineDescirptor);
setShaderModules(pipelineDescriptor);
setVertexLayout(_mtlRenderPipelineDescriptor, pipelineDescriptor);

setBlendStateAndFormat(pipelineDescirptor.blendDescriptor);
setBlendStateAndFormat(pipelineDescriptor.blendDescriptor);

NSError* error = nil;
_mtlRenderPipelineState = [_mtlDevice newRenderPipelineStateWithDescriptor:_mtlRenderPipelineDescriptor
Expand Down Expand Up @@ -261,18 +261,18 @@ MTLBlendOperation toMTLBlendOperation(BlendOperation operation)
toMTLVertexStepFunction(vertexLayout->getVertexStepMode());

const auto& attributes = vertexLayout->getAttributes();


for (const auto& it : attributes)
{
auto attribute = it.second;

vertexDesc.attributes[attribute.index].format =
toMTLVertexFormat(attribute.format, attribute.needToBeNormallized);
vertexDesc.attributes[attribute.index].offset = attribute.offset;
// Buffer index will always be 0;
vertexDesc.attributes[attribute.index].bufferIndex = DriverMTL::DEFAULT_ATTRIBS_BINDING_INDEX;

}
}

Expand Down
10 changes: 5 additions & 5 deletions core/renderer/backend/opengl/CommandBufferGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ bool CommandBufferGL::beginFrame()
return true;
}

void CommandBufferGL::beginRenderPass(const RenderTarget* rt, const RenderPassDescriptor& descirptor)
void CommandBufferGL::beginRenderPass(const RenderTarget* rt, const RenderPassDescriptor& descriptor)
{
auto rtGL = static_cast<const RenderTargetGL*>(rt);

rtGL->bindFrameBuffer();
rtGL->update();

auto clearFlags = descirptor.flags.clear;
auto clearFlags = descriptor.flags.clear;

// set clear color, depth and stencil
GLbitfield mask = 0;
if (bitmask::any(clearFlags, TargetBufferFlags::COLOR))
{
mask |= GL_COLOR_BUFFER_BIT;
const auto& clearColor = descirptor.clearColorValue;
const auto& clearColor = descriptor.clearColorValue;
glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
}

Expand All @@ -103,7 +103,7 @@ void CommandBufferGL::beginRenderPass(const RenderTarget* rt, const RenderPassDe
glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);

mask |= GL_DEPTH_BUFFER_BIT;
glClearDepth(descirptor.clearDepthValue);
glClearDepth(descriptor.clearDepthValue);
__gl->enableDepthTest();

__gl->depthMask(GL_TRUE);
Expand All @@ -115,7 +115,7 @@ void CommandBufferGL::beginRenderPass(const RenderTarget* rt, const RenderPassDe
if (bitmask::any(clearFlags, TargetBufferFlags::STENCIL))
{
mask |= GL_STENCIL_BUFFER_BIT;
glClearStencil(descirptor.clearStencilValue);
glClearStencil(descriptor.clearStencilValue);
}

if (mask)
Expand Down
8 changes: 4 additions & 4 deletions core/renderer/backend/opengl/RenderPipelineGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).

NS_AX_BACKEND_BEGIN

void RenderPipelineGL::update(const RenderTarget*, const PipelineDescriptor& pipelineDescirptor)
void RenderPipelineGL::update(const RenderTarget*, const PipelineDescriptor& pipelineDescriptor)
{
if (_programGL != pipelineDescirptor.programState->getProgram())
if (_programGL != pipelineDescriptor.programState->getProgram())
{
AX_SAFE_RELEASE(_programGL);
_programGL = static_cast<ProgramGL*>(pipelineDescirptor.programState->getProgram());
_programGL = static_cast<ProgramGL*>(pipelineDescriptor.programState->getProgram());
AX_SAFE_RETAIN(_programGL);
}

updateBlendState(pipelineDescirptor.blendDescriptor);
updateBlendState(pipelineDescriptor.blendDescriptor);
}

void RenderPipelineGL::updateBlendState(const BlendDescriptor& descriptor)
Expand Down
2 changes: 1 addition & 1 deletion core/renderer/backend/opengl/RenderPipelineGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RenderPipelineGL : public RenderPipeline
RenderPipelineGL() = default;
~RenderPipelineGL();

virtual void update(const RenderTarget*, const PipelineDescriptor& pipelineDescirptor) override;
virtual void update(const RenderTarget*, const PipelineDescriptor& pipelineDescriptor) override;
/**
* Get program instance.
* @return Program instance.
Expand Down
4 changes: 2 additions & 2 deletions core/renderer/backend/opengl/TextureGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Texture2DGL : public backend::Texture2DBackend
{
public:
/**
* @param descirptor Specifies the texture description.
* @param descriptor Specifies the texture description.
*/
Texture2DGL(const TextureDescriptor& descriptor);
~Texture2DGL();
Expand Down Expand Up @@ -216,7 +216,7 @@ class TextureCubeGL : public backend::TextureCubemapBackend
{
public:
/**
* @param descirptor Specifies the texture description.
* @param descriptor Specifies the texture description.
*/
TextureCubeGL(const TextureDescriptor& descriptor);
~TextureCubeGL();
Expand Down

0 comments on commit 49ba0dd

Please sign in to comment.