Skip to content

Commit

Permalink
Revert "Log AMD crash path"
Browse files Browse the repository at this point in the history
This reverts commit 318bdc6.
  • Loading branch information
lhog committed Feb 7, 2021
1 parent 10edd39 commit eebb4d7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 28 deletions.
3 changes: 1 addition & 2 deletions rts/Lua/LuaVAO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ int LuaVAO::GetVAO(lua_State* L)

return 0;
}
LOG("LuaVAO::GetVAO 1");

return sol::stack::call_lua(L, 1, []() {
return LuaVAOImpl();
});
LOG("LuaVAO::GetVAO 2");
}
12 changes: 1 addition & 11 deletions rts/Lua/LuaVAOImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,17 @@ void LuaVAOImpl::AttachBufferImpl(const std::shared_ptr<LuaVBOImpl>& luaVBO, std

void LuaVAOImpl::AttachVertexBuffer(const std::shared_ptr<LuaVBOImpl>& luaVBO)
{
LOG("LuaVAOImpl::AttachVertexBuffer 1");
AttachBufferImpl(luaVBO, vertLuaVBO, GL_ARRAY_BUFFER);
LOG("LuaVAOImpl::AttachVertexBuffer 2");
}

void LuaVAOImpl::AttachInstanceBuffer(const std::shared_ptr<LuaVBOImpl>& luaVBO)
{
LOG("LuaVAOImpl::AttachInstanceBuffer 1");
AttachBufferImpl(luaVBO, instLuaVBO, GL_ARRAY_BUFFER);
LOG("LuaVAOImpl::AttachInstanceBuffer 2");
}

void LuaVAOImpl::AttachIndexBuffer(const std::shared_ptr<LuaVBOImpl>& luaVBO)
{
LOG("LuaVAOImpl::AttachIndexBuffer 1");
AttachBufferImpl(luaVBO, indxLuaVBO, GL_ELEMENT_ARRAY_BUFFER);
LOG("LuaVAOImpl::AttachIndexBuffer 2");
}

template<typename ...Args>
Expand Down Expand Up @@ -242,22 +236,18 @@ std::pair<GLsizei, GLsizei> LuaVAOImpl::DrawCheck(const GLenum mode, const sol::

void LuaVAOImpl::DrawArrays(const GLenum mode, const sol::optional<GLsizei> vertCountOpt, const sol::optional<GLint> firstOpt, const sol::optional<int> instanceCountOpt)
{
LOG("LuaVAOImpl::DrawArrays 1");
const auto vertInstCount = DrawCheck(mode, vertCountOpt, instanceCountOpt, false); //pair<vertCount,instCount>

const auto first = std::max(firstOpt.value_or(0), 0);

LOG("LuaVAOImpl::DrawArrays 2");
vao->Bind();
LOG("LuaVAOImpl::DrawArrays 3");

if (vertInstCount.second == 0)
glDrawArrays(mode, first, vertInstCount.first);
else
glDrawArraysInstanced(mode, first, vertInstCount.first, vertInstCount.second);

LOG("LuaVAOImpl::DrawArrays 4");
vao->Unbind();
LOG("LuaVAOImpl::DrawArrays 5");
}

void LuaVAOImpl::DrawElements(const GLenum mode, const sol::optional<GLsizei> indCountOpt, const sol::optional<int> indElemOffsetOpt, const sol::optional<int> instanceCountOpt, const sol::optional<int> baseVertexOpt)
Expand Down
4 changes: 1 addition & 3 deletions rts/Lua/LuaVBO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@ bool LuaVBO::CheckAndReportSupported(lua_State* L, const unsigned int target) {

int LuaVBO::GetVBO(lua_State* L)
{
LOG("LuaVBO::GetVBO 1");
unsigned int target = luaL_optint(L, 1, GL_ARRAY_BUFFER);
if (!LuaVBO::CheckAndReportSupported(L, target))
return 0;
LOG("LuaVBO::GetVBO 2");

return sol::stack::call_lua(L, 1, [](const sol::optional<GLenum> defTargetOpt, const sol::optional<bool> freqUpdatedOpt) {
return std::make_shared<LuaVBOImpl>(defTargetOpt, freqUpdatedOpt);
//return LuaVBOImpl{defTargetOpt, freqUpdatedOpt, L};
});
LOG("LuaVBO::GetVBO 3");
}
16 changes: 4 additions & 12 deletions rts/Lua/LuaVBOImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,10 @@ bool LuaVBOImpl::DefineElementArray(const sol::optional<sol::object> attribDefAr

void LuaVBOImpl::Define(const int elementsCount, const sol::optional<sol::object> attribDefArgOpt)
{
LOG("LuaVBOImpl::Define 1");
if (vbo) {
LuaError("[LuaVBOImpl::%s] Attempt to call %s() multiple times. VBO definition is immutable.", __func__, __func__);
}
LOG("LuaVBOImpl::Define 2");

if (elementsCount <= 0) {
LuaError("[LuaVBOImpl::%s] Elements count cannot be <= 0", __func__);
}
Expand All @@ -398,7 +397,6 @@ void LuaVBOImpl::Define(const int elementsCount, const sol::optional<sol::object
return false;
};

LOG("LuaVBOImpl::Define 3");
bool result;
switch (defTarget) {
case GL_ELEMENT_ARRAY_BUFFER:
Expand All @@ -419,12 +417,8 @@ void LuaVBOImpl::Define(const int elementsCount, const sol::optional<sol::object
LuaError("[LuaVBOImpl::%s] Error in definition. See infolog for possible reasons", __func__);
}

LOG("LuaVBOImpl::Define 4");

CopyAttrMapToVec();
LOG("LuaVBOImpl::Define 5");
AllocGLBuffer(elemSizeInBytes * elementsCount);
LOG("LuaVBOImpl::Define 6");
}

std::tuple<uint32_t, uint32_t, uint32_t> LuaVBOImpl::GetBufferSize()
Expand All @@ -438,16 +432,15 @@ std::tuple<uint32_t, uint32_t, uint32_t> LuaVBOImpl::GetBufferSize()

size_t LuaVBOImpl::Upload(const sol::stack_table& luaTblData, const sol::optional<int> elemOffsetOpt, const sol::optional<int> attribIdxOpt)
{
LOG("LuaVBOImpl::Upload 1");
if (!vbo) {
LuaError("[LuaVBOImpl::%s] Invalid VBO. Did you call :Define() or :ShapeFromUnitDefID/ShapeFromFeatureDefID()?", __func__);
}
LOG("LuaVBOImpl::Upload 2");

const uint32_t elemOffset = static_cast<uint32_t>(std::max(elemOffsetOpt.value_or(0), 0));
if (elemOffset >= elementsCount) {
LuaError("[LuaVBOImpl::%s] Invalid elemOffset [%u] >= elementsCount [%u]", __func__, elemOffset, elementsCount);
}
LOG("LuaVBOImpl::Upload 3");

const int attribIdx = std::max(attribIdxOpt.value_or(-1), -1);
if (attribIdx != -1 && bufferAttribDefs.find(attribIdx) == bufferAttribDefs.cend()) {
LuaError("[LuaVBOImpl::%s] attribIdx is not found in bufferAttribDefs", __func__);
Expand All @@ -458,12 +451,11 @@ size_t LuaVBOImpl::Upload(const sol::stack_table& luaTblData, const sol::optiona
std::vector<lua_Number> dataVec;
dataVec.resize(luaTblDataSize);

LOG("LuaVBOImpl::Upload 4");
constexpr auto defaultValue = static_cast<lua_Number>(0);
for (auto k = 0; k < luaTblDataSize; ++k) {
dataVec[k] = luaTblData.raw_get_or<lua_Number>(k + 1, defaultValue);
}
LOG("LuaVBOImpl::Upload 5");

return UploadImpl<lua_Number>(dataVec, elemOffset, attribIdx);
}

Expand Down

0 comments on commit eebb4d7

Please sign in to comment.