mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 20:58:31 +09:00
[Chore] (...): Format code.
This commit is contained in:
+1
-1
@@ -58,6 +58,6 @@
|
||||
if (!(condition)) { \
|
||||
MGLOG_F("Assertion failed" __VA_OPT__(": ") __VA_ARGS__); \
|
||||
MGLOG_F(" at %s:%d (%s)", __FILE__, __LINE__, __func__); \
|
||||
TRAP; \
|
||||
TRAP; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -71,8 +71,7 @@ namespace MobileGL {
|
||||
.TargetGLVersion = {3, 3, 0}, // Target OpenGL Version
|
||||
.TargetGLSLVersion = {4, 6, 0}, // Target Shading Language Version
|
||||
.Extensions = {V_OpenGL30, V_OpenGL31, V_OpenGL32, // OpenGL Extensions
|
||||
V_OpenGL33,
|
||||
E_GL_ARB_draw_buffers_blend},
|
||||
V_OpenGL33, E_GL_ARB_draw_buffers_blend},
|
||||
.IsCompatibilityProfile = false // Is Compatibility Profile
|
||||
},
|
||||
.BackendCapability = {} // Backend Capability
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
void CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width,
|
||||
GLsizei height, GLint border);
|
||||
void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
void CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
|
||||
GLsizei height);
|
||||
void GenerateMipmap(GLenum target);
|
||||
const GLubyte* GetString(GLenum name);
|
||||
} // namespace MobileGL::MG_Backend::DirectGLES
|
||||
@@ -277,15 +277,13 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
const auto mipmapCount = stateTextureObject->GetMipmapLevelCount();
|
||||
const auto baseSize = stateTextureObject->GetBaseSize();
|
||||
StateTextureBasicInfo currentTextureInfo = {
|
||||
stateTextureObject->GetFormat(), static_cast<SizeT>(baseSize.x()),
|
||||
static_cast<SizeT>(baseSize.y()),
|
||||
static_cast<SizeT>(baseSize.z()), mipmapCount };
|
||||
stateTextureObject->GetFormat(), static_cast<SizeT>(baseSize.x()), static_cast<SizeT>(baseSize.y()),
|
||||
static_cast<SizeT>(baseSize.z()), mipmapCount};
|
||||
|
||||
Bool needsRegeneration = !m_isInitialized || (currentTextureInfo != m_prevTextureInfo);
|
||||
|
||||
MGLOG_D("%s: Got texture info: %dx%dx%d, mips %d, format %s", __func__,
|
||||
baseSize.x(), baseSize.y(), baseSize.z(),
|
||||
mipmapCount,
|
||||
MGLOG_D("%s: Got texture info: %dx%dx%d, mips %d, format %s", __func__, baseSize.x(), baseSize.y(),
|
||||
baseSize.z(), mipmapCount,
|
||||
MG_Util::ConvertTextureInternalFormatToString(stateTextureObject->GetFormat()).c_str());
|
||||
|
||||
if (needsRegeneration) {
|
||||
@@ -298,41 +296,31 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
&glFormat);
|
||||
|
||||
const auto& uploadTargets = stateTextureObject->GetUploadTargets();
|
||||
for (auto uploadTarget: uploadTargets) {
|
||||
for (auto uploadTarget : uploadTargets) {
|
||||
for (SizeT level = 0; level < mipmapCount; ++level) {
|
||||
auto levelTexelSize = stateTextureObject->GetMipmapTexelSize(
|
||||
uploadTarget, level);
|
||||
auto levelByteSize = stateTextureObject->GetMipmapByteSize(
|
||||
uploadTarget, level);
|
||||
bool levelDirty = stateTextureObject->IsStorageDirty(
|
||||
uploadTarget, 0);
|
||||
auto levelTexelSize = stateTextureObject->GetMipmapTexelSize(uploadTarget, level);
|
||||
auto levelByteSize = stateTextureObject->GetMipmapByteSize(uploadTarget, level);
|
||||
bool levelDirty = stateTextureObject->IsStorageDirty(uploadTarget, 0);
|
||||
auto glUploadTarget = MG_Util::ConvertTextureUploadTargetToGLEnum(uploadTarget);
|
||||
auto *pData = (levelDirty && levelByteSize != 0)
|
||||
? stateTextureObject->MapMipmapData(
|
||||
uploadTarget, level) : nullptr;
|
||||
auto* pData = (levelDirty && levelByteSize != 0)
|
||||
? stateTextureObject->MapMipmapData(uploadTarget, level)
|
||||
: nullptr;
|
||||
MGLOG_D("%s: target: %s: syncing mip %d: %dx%dx%d, byteSize = %d, pData = %p", __func__,
|
||||
MG_Util::ConvertTextureUploadTargetToString(uploadTarget).c_str(),
|
||||
level,
|
||||
levelTexelSize.x(), levelTexelSize.y(), levelTexelSize.z(),
|
||||
levelByteSize,
|
||||
pData);
|
||||
MG_Util::ConvertTextureUploadTargetToString(uploadTarget).c_str(), level,
|
||||
levelTexelSize.x(), levelTexelSize.y(), levelTexelSize.z(), levelByteSize, pData);
|
||||
BufferImpl::BackendBufferBindingProtector pixelUnpackProtector =
|
||||
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
||||
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
||||
errorLopper.Clear();
|
||||
MG_External::GLES::glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
MG_External::GLES::glTexImage2D(glUploadTarget, static_cast<GLint>(level),
|
||||
glInternalFormat,
|
||||
MG_External::GLES::glTexImage2D(glUploadTarget, static_cast<GLint>(level), glInternalFormat,
|
||||
static_cast<GLsizei>(levelTexelSize.x()),
|
||||
static_cast<GLsizei>(levelTexelSize.y()), 0,
|
||||
glFormat, glType,
|
||||
static_cast<GLsizei>(levelTexelSize.y()), 0, glFormat, glType,
|
||||
pData);
|
||||
|
||||
// TODO: handle more texture types
|
||||
|
||||
MGLOG_D("Regenerated mipmap level %d for texture with ID: %u", level,
|
||||
m_backendTextureId);
|
||||
stateTextureObject->MarkStorageDirty(uploadTarget, level,
|
||||
false);
|
||||
MGLOG_D("Regenerated mipmap level %d for texture with ID: %u", level, m_backendTextureId);
|
||||
stateTextureObject->MarkStorageDirty(uploadTarget, level, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,29 +336,32 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
MG_External::GLES::glTexParameteri(target, glName, \
|
||||
MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)); \
|
||||
m_cacheSamplerParameters.internalName = samplerParams.internalName; \
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, t = MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)](GLenum err) { \
|
||||
MGLOG_D("%s(%s:%d) ES error %s, GL_TEXTURE_MIN_FILTER = %s", func, file, line, \
|
||||
MG_Util::ConvertGLEnumToString(err).c_str(), MG_Util::ConvertGLEnumToString(t).c_str());\
|
||||
}); \
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, \
|
||||
t = MG_Util::ConvertSampler##type##ToGLEnum(samplerParams.internalName)](GLenum err) { \
|
||||
MGLOG_D("%s(%s:%d) ES error %s, GL_TEXTURE_MIN_FILTER = %s", func, file, line, \
|
||||
MG_Util::ConvertGLEnumToString(err).c_str(), MG_Util::ConvertGLEnumToString(t).c_str()); \
|
||||
}); \
|
||||
}
|
||||
|
||||
if (m_cacheSamplerParameters.minFilter != samplerParams.minFilter) {
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MIN_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
||||
MG_External::GLES::glTexParameteri(
|
||||
target, GL_TEXTURE_MIN_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
||||
m_cacheSamplerParameters.minFilter = samplerParams.minFilter;
|
||||
m_cacheSamplerParameters.mipmapMode = samplerParams.mipmapMode;
|
||||
}
|
||||
if (m_cacheSamplerParameters.magFilter != samplerParams.magFilter) {
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MAG_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
||||
MG_External::GLES::glTexParameteri(
|
||||
target, GL_TEXTURE_MAG_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
||||
m_cacheSamplerParameters.magFilter = samplerParams.magFilter;
|
||||
}
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
});
|
||||
|
||||
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
||||
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
||||
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
||||
// SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
||||
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapS, GL_TEXTURE_WRAP_S, WrapMode)
|
||||
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapT, GL_TEXTURE_WRAP_T, WrapMode)
|
||||
SYNC_TEX_SAMPLER_PARAM_IF_CHANGED(wrapR, GL_TEXTURE_WRAP_R, WrapMode)
|
||||
@@ -385,8 +376,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
m_cacheSamplerParameters.maxLod = samplerParams.maxLod;
|
||||
}
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line,
|
||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
});
|
||||
#undef SYNC_TEX_SAMPLER_PARAM_IF_CHANGED
|
||||
}
|
||||
@@ -397,13 +387,11 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
const auto& levelRange = stateTextureObject->GetLevelRange();
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, static_cast<GLint>(levelRange.x()));
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line,
|
||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
});
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, static_cast<GLint>(levelRange.y()));
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line,
|
||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
MGLOG_D("%s(%s:%d) ES error %s", func, file, line, MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
});
|
||||
GLenum swizzleParams[4] = {MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)),
|
||||
@@ -414,17 +402,19 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Alpha))};
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_R,
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)));
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_G,
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Green)));
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Red)));
|
||||
MG_External::GLES::glTexParameteri(
|
||||
target, GL_TEXTURE_SWIZZLE_G,
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Green)));
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_B,
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Blue)));
|
||||
MG_External::GLES::glTexParameteri(target, GL_TEXTURE_SWIZZLE_A,
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Alpha)));
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Blue)));
|
||||
MG_External::GLES::glTexParameteri(
|
||||
target, GL_TEXTURE_SWIZZLE_A,
|
||||
MG_Util::ConvertTextureSwizzleParamToGLEnum(
|
||||
stateTextureObject->GetSwizzleParam(TextureSwizzleParam::Alpha)));
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__, swizzleParams](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error %s, GL_TEXTURE_SWIZZLE_RGBA: [%s %s %s %s]", func, file, line,
|
||||
MG_Util::ConvertGLEnumToString(err).c_str(),
|
||||
@@ -444,14 +434,13 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
TextureImpl::GenerateTextureFormatInfo(stateTextureObject->GetFormat(), &glInternalFormat, &glType,
|
||||
&glFormat);
|
||||
const auto& uploadTargets = stateTextureObject->GetUploadTargets();
|
||||
for (auto uploadTarget: uploadTargets) {
|
||||
for (auto uploadTarget : uploadTargets) {
|
||||
for (SizeT level = 0; level < mipmapCount; ++level) {
|
||||
if (!stateTextureObject->IsStorageDirty(uploadTarget, level)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto byteSize = stateTextureObject->GetMipmapByteSize(
|
||||
uploadTarget, level);
|
||||
auto byteSize = stateTextureObject->GetMipmapByteSize(uploadTarget, level);
|
||||
if (byteSize == 0) {
|
||||
MGLOG_W("Mipmap level %d has no data, skipping update.", level);
|
||||
continue;
|
||||
@@ -460,20 +449,16 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
auto glUploadTarget = MG_Util::ConvertTextureUploadTargetToGLEnum(uploadTarget);
|
||||
|
||||
BufferImpl::BackendBufferBindingProtector pixelUnpackProtector =
|
||||
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
||||
BufferImpl::BackendBufferBindingProtector(GL_PIXEL_UNPACK_BUFFER);
|
||||
MG_External::GLES::glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
errorLopper.Loop(
|
||||
[file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error: %s", func, file, line,
|
||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
});
|
||||
auto texelSize = stateTextureObject->GetMipmapTexelSize(
|
||||
uploadTarget, level);
|
||||
MG_External::GLES::glTexSubImage2D(glUploadTarget, static_cast<GLint>(level),
|
||||
0, 0,
|
||||
errorLopper.Loop([file = __FILE__, line = __LINE__, func = __func__](GLenum err) {
|
||||
MGLOG_D("%s(%s:%d) ES error: %s", func, file, line,
|
||||
MG_Util::ConvertGLEnumToString(err).c_str());
|
||||
});
|
||||
auto texelSize = stateTextureObject->GetMipmapTexelSize(uploadTarget, level);
|
||||
MG_External::GLES::glTexSubImage2D(glUploadTarget, static_cast<GLint>(level), 0, 0,
|
||||
static_cast<GLsizei>(texelSize.x()),
|
||||
static_cast<GLsizei>(texelSize.y()),
|
||||
glFormat, glType,
|
||||
static_cast<GLsizei>(texelSize.y()), glFormat, glType,
|
||||
stateTextureObject->MapMipmapData(uploadTarget, level));
|
||||
|
||||
stateTextureObject->MarkStorageDirty(uploadTarget, level, false);
|
||||
@@ -551,13 +536,14 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
if (asTarget == FramebufferTarget::Draw) {
|
||||
// Create mappings for draw buffers
|
||||
int nBuffers = 0;
|
||||
std::fill(m_frontendDrawBuffers, m_frontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
||||
std::fill(m_frontendDrawBuffers,
|
||||
m_frontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
||||
FramebufferAttachmentType::None);
|
||||
std::fill(m_compactedFrontendDrawBuffers,
|
||||
m_compactedFrontendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
||||
FramebufferAttachmentType::None);
|
||||
std::fill(m_backendDrawBuffers, m_backendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS,
|
||||
GL_NONE);
|
||||
std::fill(m_backendDrawBuffers,
|
||||
m_backendDrawBuffers + MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS, GL_NONE);
|
||||
auto& stateDrawBuffers = stateFBOObject->GetDrawBuffers();
|
||||
for (GLint i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
||||
if (stateDrawBuffers[i] == FramebufferAttachmentType::None) {
|
||||
@@ -576,22 +562,24 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
MG_External::GLES::glDrawBuffers(nBuffers, m_backendDrawBuffers);
|
||||
|
||||
// Attach textures for compacted draw buffers
|
||||
// for (int i = 0; i < nBuffers; ++i) {
|
||||
// FramebufferAttachmentType frontendAttachmentType =
|
||||
// MG_Util::ConvertGLEnumToFramebufferAttachmentType(m_compactedFrontendBuffers[i]);
|
||||
// GLenum backendAttachment = m_backendBuffers[i];
|
||||
// const auto& attachment = attachments[static_cast<SizeT>(frontendAttachmentType)];
|
||||
// if (!attachment.IsTexture()) continue;
|
||||
// const auto& textureObject = attachment.GetTexture();
|
||||
// const auto& backendTextureIt = TextureImpl::g_backendTextureObjects.find(textureObject);
|
||||
// if (backendTextureIt == TextureImpl::g_backendTextureObjects.end()) continue;
|
||||
// const auto& backendTextureObject = backendTextureIt->second;
|
||||
// auto glTextureTarget = MG_Util::ConvertTextureTargetToGLEnum(textureObject->GetTarget());
|
||||
// backendTextureObject->Bind(glTextureTarget);
|
||||
// MG_External::GLES::glFramebufferTexture2D(glFBOTarget, backendAttachment, glTextureTarget,
|
||||
// backendTextureObject->GetBackendTextureId(),
|
||||
// static_cast<GLint>(attachment.GetTextureLevel()));
|
||||
// }
|
||||
// for (int i = 0; i < nBuffers; ++i) {
|
||||
// FramebufferAttachmentType frontendAttachmentType =
|
||||
// MG_Util::ConvertGLEnumToFramebufferAttachmentType(m_compactedFrontendBuffers[i]);
|
||||
// GLenum backendAttachment = m_backendBuffers[i];
|
||||
// const auto& attachment = attachments[static_cast<SizeT>(frontendAttachmentType)];
|
||||
// if (!attachment.IsTexture()) continue;
|
||||
// const auto& textureObject = attachment.GetTexture();
|
||||
// const auto& backendTextureIt =
|
||||
// TextureImpl::g_backendTextureObjects.find(textureObject); if (backendTextureIt ==
|
||||
// TextureImpl::g_backendTextureObjects.end()) continue; const auto&
|
||||
// backendTextureObject = backendTextureIt->second; auto glTextureTarget =
|
||||
// MG_Util::ConvertTextureTargetToGLEnum(textureObject->GetTarget());
|
||||
// backendTextureObject->Bind(glTextureTarget);
|
||||
// MG_External::GLES::glFramebufferTexture2D(glFBOTarget, backendAttachment,
|
||||
// glTextureTarget,
|
||||
// backendTextureObject->GetBackendTextureId(),
|
||||
// static_cast<GLint>(attachment.GetTextureLevel()));
|
||||
// }
|
||||
|
||||
stateFBOObject->ClearDrawBuffersDirtyState();
|
||||
}
|
||||
@@ -601,15 +589,15 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
GLenum frontendAtt = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(m_frontendReadBuffer);
|
||||
GLenum backendAtt = GL_NONE;
|
||||
// Find corresponding backend attachment in compacted draw buffers
|
||||
// for (SizeT i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
||||
// if (m_compactedFrontendBuffers[i] == frontendAtt) {
|
||||
// backendAtt = m_backendBuffers[i];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (backendAtt != GL_NONE) {
|
||||
// MG_External::GLES::glReadBuffer(backendAtt);
|
||||
// } else {
|
||||
// for (SizeT i = 0; i < MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS; ++i) {
|
||||
// if (m_compactedFrontendBuffers[i] == frontendAtt) {
|
||||
// backendAtt = m_backendBuffers[i];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (backendAtt != GL_NONE) {
|
||||
// MG_External::GLES::glReadBuffer(backendAtt);
|
||||
// } else {
|
||||
const auto& readAttachment = attachments[(SizeT)m_frontendReadBuffer];
|
||||
GLenum glAttachment = MG_Util::ConvertFramebufferAttachmentTypeToGLEnum(m_frontendReadBuffer);
|
||||
if (!readAttachment.IsValid() || readAttachment.IsEmpty()) {
|
||||
@@ -632,7 +620,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// TODO: renderbuffer support
|
||||
}
|
||||
MG_External::GLES::glReadBuffer(glAttachment);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,19 +826,21 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
|
||||
if (m_cacheSamplerParameters.minFilter != samplerParams.minFilter) {
|
||||
MG_External::GLES::glSamplerParameteri(m_backendSamplerId, GL_TEXTURE_MIN_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
||||
MG_External::GLES::glSamplerParameteri(
|
||||
m_backendSamplerId, GL_TEXTURE_MIN_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.minFilter, samplerParams.mipmapMode));
|
||||
m_cacheSamplerParameters.minFilter = samplerParams.minFilter;
|
||||
m_cacheSamplerParameters.mipmapMode = samplerParams.mipmapMode;
|
||||
}
|
||||
if (m_cacheSamplerParameters.magFilter != samplerParams.magFilter) {
|
||||
MG_External::GLES::glSamplerParameteri(m_backendSamplerId, GL_TEXTURE_MAG_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
||||
MG_External::GLES::glSamplerParameteri(
|
||||
m_backendSamplerId, GL_TEXTURE_MAG_FILTER,
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerParams.magFilter, SamplerMipmapMode::None));
|
||||
m_cacheSamplerParameters.magFilter = samplerParams.magFilter;
|
||||
}
|
||||
|
||||
// SYNC_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
||||
// SYNC_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
||||
// SYNC_SAMPLER_PARAM_IF_CHANGED(minFilter, GL_TEXTURE_MIN_FILTER, FilterMode)
|
||||
// SYNC_SAMPLER_PARAM_IF_CHANGED(magFilter, GL_TEXTURE_MAG_FILTER, FilterMode)
|
||||
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapS, GL_TEXTURE_WRAP_S, WrapMode)
|
||||
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapT, GL_TEXTURE_WRAP_T, WrapMode)
|
||||
SYNC_SAMPLER_PARAM_IF_CHANGED(wrapR, GL_TEXTURE_WRAP_R, WrapMode)
|
||||
|
||||
@@ -99,13 +99,16 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
Probably useful to re-link shader output according to this.
|
||||
aka. realizing `glBindFragDataLocation`
|
||||
*/
|
||||
FramebufferAttachmentType m_frontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {FramebufferAttachmentType::None};
|
||||
FramebufferAttachmentType m_frontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {
|
||||
FramebufferAttachmentType::None};
|
||||
/* this will save buffers in its compacted GL form,
|
||||
not consecutive is not allowed
|
||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT5, COLOR_ATTACHMENT4]
|
||||
(no GL_NONE among those)
|
||||
*/
|
||||
FramebufferAttachmentType m_compactedFrontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {FramebufferAttachmentType::None};
|
||||
FramebufferAttachmentType
|
||||
m_compactedFrontendDrawBuffers[MG_State::GLState::FramebufferObject::MAX_DRAW_BUFFERS] = {
|
||||
FramebufferAttachmentType::None};
|
||||
/* this will save buffers in stricter ES rules
|
||||
reversion, absence or not consecutive are not allowed, according to ES spec
|
||||
i.e. it could be like [COLOR_ATTACHMENT0, COLOR_ATTACHMENT1, NONE, NONE, ...]
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
ErrorLopper();
|
||||
~ErrorLopper();
|
||||
};
|
||||
}
|
||||
} // namespace DebugImpl
|
||||
|
||||
namespace BufferImpl {
|
||||
class BackendBufferBindingProtector {
|
||||
@@ -66,6 +66,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
|
||||
static GLuint GetTempFBO(FramebufferTarget target);
|
||||
static void BindTempFBO(FramebufferTarget target);
|
||||
|
||||
private:
|
||||
GLenum m_target;
|
||||
GLint m_previousBinding = 0;
|
||||
|
||||
@@ -434,8 +434,9 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
void BufferData_State(GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
|
||||
MGLOG_D("%s: %s, size = %d, data = %p, usage = %s",
|
||||
__func__, MG_Util::ConvertGLEnumToString(target).c_str(), size, data, MG_Util::ConvertGLEnumToString(usage).c_str());
|
||||
MGLOG_D("%s: %s, size = %d, data = %p, usage = %s", __func__,
|
||||
MG_Util::ConvertGLEnumToString(target).c_str(), size, data,
|
||||
MG_Util::ConvertGLEnumToString(usage).c_str());
|
||||
if (size < 0) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidValue,
|
||||
@@ -479,7 +480,8 @@ namespace MobileGL {
|
||||
|
||||
auto& bindingSlot = MG_State::pGLContext->GetBufferBindingSlot(bufferTarget);
|
||||
bindingSlot.Bind(bufferObject);
|
||||
MGLOG_D("%s: bind buffer object %p -> %s", __func__, bufferObject.get(), MG_Util::ConvertGLEnumToString(target).c_str());
|
||||
MGLOG_D("%s: bind buffer object %p -> %s", __func__, bufferObject.get(),
|
||||
MG_Util::ConvertGLEnumToString(target).c_str());
|
||||
}
|
||||
|
||||
void GenBuffers_State(GLsizei n, GLuint* buffers) {
|
||||
|
||||
@@ -38,10 +38,10 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
String bufferTargetStr = ConvertBufferTargetToString(target);
|
||||
String glTargetStr = ConvertGLEnumToString(ConvertBufferTargetToGLEnum(target));
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidEnum,
|
||||
MakeShared<GenericErrorInfo>(
|
||||
"MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
|
||||
std::format("Target {} ({}) is not valid.", bufferTargetStr, glTargetStr)));
|
||||
ErrorCode::InvalidEnum,
|
||||
MakeShared<GenericErrorInfo>(
|
||||
"MG_Impl/GLImpl/BufferImpl", "ValidateBufferTarget",
|
||||
std::format("Target {} ({}) is not valid.", bufferTargetStr, glTargetStr)));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -55,9 +55,9 @@ namespace MobileGL {
|
||||
if (rendererString.empty()) {
|
||||
const char* backendStr = (const char*)GetString_Backend(GL_RENDERER);
|
||||
const char* backendVersionStr = (const char*)GetString_Backend(GL_VERSION);
|
||||
rendererString =
|
||||
std::format("{} ({}) ({} | {})", MG_Config::RendererInfoPtr->RendererName.c_str(),
|
||||
MG_Config::CoreName.c_str(), backendStr ? backendStr : "<unknown GPU>", backendVersionStr ? backendVersionStr : "<unknown version>");
|
||||
rendererString = std::format("{} ({}) ({} | {})", MG_Config::RendererInfoPtr->RendererName.c_str(),
|
||||
MG_Config::CoreName.c_str(), backendStr ? backendStr : "<unknown GPU>",
|
||||
backendVersionStr ? backendVersionStr : "<unknown version>");
|
||||
}
|
||||
return (const GLubyte*)rendererString.c_str();
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace MobileGL {
|
||||
GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName);
|
||||
void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||
void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
|
||||
void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
|
||||
void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length,
|
||||
GLchar* uniformBlockName);
|
||||
void BindFragDataLocation(GLuint program, GLuint colorNumber, const char* name);
|
||||
GLint GetFragDataLocation(GLuint program, const char* name);
|
||||
void ValidateProgram(GLuint program);
|
||||
|
||||
@@ -76,10 +76,12 @@ namespace MobileGL {
|
||||
*(GLint*)params = MG_Util::ConvertSamplerWrapModeToGLEnum(samplerObj->GetWrapR());
|
||||
break;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
*(GLint*)params = MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMinFilter(), samplerObj->GetMipmapMode());
|
||||
*(GLint*)params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMinFilter(), samplerObj->GetMipmapMode());
|
||||
break;
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
*(GLint*)params = MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMagFilter(), SamplerMipmapMode::None);
|
||||
*(GLint*)params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(samplerObj->GetMagFilter(), SamplerMipmapMode::None);
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
*(GLfloat*)params = samplerObj->GetMinLod();
|
||||
|
||||
@@ -384,8 +384,7 @@ namespace MobileGL {
|
||||
textureObject->SetInternalFormat(textureInternalFormat);
|
||||
|
||||
// if isProxy, no more pixel transfer needed below
|
||||
if (isProxy)
|
||||
return;
|
||||
if (isProxy) return;
|
||||
|
||||
const void* originalPixels = pixels;
|
||||
|
||||
@@ -409,8 +408,8 @@ namespace MobileGL {
|
||||
|
||||
void* processedPixels = nullptr;
|
||||
processedPixels = MG_Util::PixelStoreProcessor::ProcessTexturePixelsDataUnpack(
|
||||
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), bytesPerPixel,
|
||||
{width, height, 1}, false, imageSize);
|
||||
originalPixels, MG_State::pGLContext->GetPixelStoreParameters(true), bytesPerPixel, {width, height, 1},
|
||||
false, imageSize);
|
||||
|
||||
if (processedPixels && imageSize > 0) {
|
||||
if (imageSize != totalBytes) {
|
||||
@@ -420,7 +419,7 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
const SizeT copySize = std::min(imageSize, totalBytes);
|
||||
DataPtr texelInput { processedPixels, copySize };
|
||||
DataPtr texelInput{processedPixels, copySize};
|
||||
textureObject->UpdateMipmapSubData(textureUploadingTarget, level, texelInput);
|
||||
}
|
||||
|
||||
@@ -475,14 +474,15 @@ namespace MobileGL {
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
*params = MG_Util::ConvertSamplerFilterModeToGLEnum(
|
||||
textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(), textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(),
|
||||
textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
@@ -555,14 +555,15 @@ namespace MobileGL {
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
*params = MG_Util::ConvertSamplerFilterModeToGLEnum(
|
||||
textureObject->GetSamplerObject()->GetMagFilter(), SamplerMipmapMode::None);
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
if (params) {
|
||||
*params =
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(), textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
MG_Util::ConvertSamplerFilterModeToGLEnum(textureObject->GetSamplerObject()->GetMinFilter(),
|
||||
textureObject->GetSamplerObject()->GetMipmapMode());
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_MIN_LOD:
|
||||
@@ -880,9 +881,7 @@ namespace MobileGL {
|
||||
auto textureObject = MG_State::pGLContext->GetTextureObject(texture);
|
||||
|
||||
// ===================== Error Checking ==============================
|
||||
if (textureTarget != TextureTarget::TextureCubeMap &&
|
||||
!TextureImpl::ValidateTextureTargetUniformity(textureObject, textureTarget))
|
||||
return;
|
||||
if (!TextureImpl::ValidateTextureTargetUniformity(textureObject, textureTarget)) return;
|
||||
|
||||
// ======================= Processing ================================
|
||||
if (!textureObject) {
|
||||
|
||||
@@ -16,15 +16,15 @@ namespace MobileGL {
|
||||
auto fbo0 = MG_State::pGLContext->CreateFramebufferObject(0);
|
||||
auto colorTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||
colorTex->SetInternalFormat(TextureInternalFormat::RGBA8);
|
||||
colorTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
||||
colorTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||
// colorTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||
auto depthTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||
depthTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
||||
depthTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
||||
depthTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||
// depthTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||
auto stencilTex = MakeShared<MG_State::GLState::TextureObject2D>(0);
|
||||
stencilTex->SetInternalFormat(TextureInternalFormat::Depth32FStencil8);
|
||||
stencilTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, { {512, 512, 1}, 0 });
|
||||
stencilTex->AllocateStorage(TextureUploadTarget::Texture2D, 0, {{512, 512, 1}, 0});
|
||||
// stencilTex->SetMipmapLevel({{512, 512, 1}, 0, false, 0, {nullptr, 0}});
|
||||
fbo0->AttachTexture(FramebufferAttachmentType::Color0, colorTex);
|
||||
fbo0->AttachTexture(FramebufferAttachmentType::Depth, depthTex);
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace MobileGL {
|
||||
BufferTarget::TransformFeedback, BufferTarget::AtomicCounter, BufferTarget::DispatchIndirect,
|
||||
BufferTarget::DrawIndirect, BufferTarget::ShaderStorage);
|
||||
constexpr const auto BufferBindPointTargets =
|
||||
ToArray(BufferTarget::Uniform, BufferTarget::TransformFeedback,
|
||||
BufferTarget::AtomicCounter, BufferTarget::ShaderStorage);
|
||||
ToArray(BufferTarget::Uniform, BufferTarget::TransformFeedback, BufferTarget::AtomicCounter,
|
||||
BufferTarget::ShaderStorage);
|
||||
|
||||
class BufferState {
|
||||
public:
|
||||
@@ -40,7 +40,8 @@ namespace MobileGL {
|
||||
Array<BindingSlot<BufferObject>, GlobalBufferTargets.size()> m_bindingSlots;
|
||||
// TODO: query the count somewhere globally?
|
||||
// For glBindBufferBase / glBindBufferRange
|
||||
Array<Array<BindingSlotRange1D<BufferObject>, 16>, BufferBindPointTargets.size()> m_bufferBindPointTargets;
|
||||
Array<Array<BindingSlotRange1D<BufferObject>, 16>, BufferBindPointTargets.size()>
|
||||
m_bufferBindPointTargets;
|
||||
};
|
||||
} // namespace GLState
|
||||
} // namespace MG_State
|
||||
|
||||
@@ -106,7 +106,8 @@ namespace MobileGL {
|
||||
|
||||
Uint GetExternalIndex() const { return m_externalIndex; }
|
||||
|
||||
// const UnorderedMap<String, Uint>& GetAttribLocationMap() const { return m_attribLocation; }
|
||||
// const UnorderedMap<String, Uint>& GetAttribLocationMap() const { return
|
||||
// m_attribLocation; }
|
||||
|
||||
private:
|
||||
void DoReflection();
|
||||
@@ -126,7 +127,7 @@ namespace MobileGL {
|
||||
Vector<String> m_attribs;
|
||||
Vector<GLenum> m_attribTypes;
|
||||
// For SpvcSession::SetVertexAttribLocation()
|
||||
// UnorderedMap<String, Uint> m_attribLocation;
|
||||
// UnorderedMap<String, Uint> m_attribLocation;
|
||||
|
||||
// FragData (Frag out)
|
||||
UnorderedMap<String, Uint> m_explicitFragDataLocation;
|
||||
|
||||
@@ -36,6 +36,6 @@ namespace MobileGL {
|
||||
Bool SamplerState::ValidateSamplerObject(Uint index) const {
|
||||
return m_samplerObjects.find(index) != m_samplerObjects.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace GLState
|
||||
} // namespace MG_State
|
||||
} // namespace MobileGL
|
||||
|
||||
@@ -725,117 +725,117 @@ TEST_F(ProgramTest, MinecraftBlitScreenLightmap) {
|
||||
ASSERT_GT(programObject->GetUBOSize(), 0);
|
||||
}
|
||||
|
||||
//const char* minecraft_core_tex_color_1216_vs = R"(#version 150
|
||||
// const char* minecraft_core_tex_color_1216_vs = R"(#version 150
|
||||
//
|
||||
//// Can't moj_import in things used during startup, when resource packs don't exist.
|
||||
//// This is a copy of dynamicimports.glsl and projection.glsl
|
||||
//layout(std140) uniform DynamicTransforms {
|
||||
// mat4 ModelViewMat;
|
||||
// vec4 ColorModulator;
|
||||
// vec3 ModelOffset;
|
||||
// mat4 TextureMat;
|
||||
// float LineWidth;
|
||||
//};
|
||||
//layout(std140) uniform Projection {
|
||||
// mat4 ProjMat;
|
||||
//};
|
||||
// layout(std140) uniform DynamicTransforms {
|
||||
// mat4 ModelViewMat;
|
||||
// vec4 ColorModulator;
|
||||
// vec3 ModelOffset;
|
||||
// mat4 TextureMat;
|
||||
// float LineWidth;
|
||||
// };
|
||||
// layout(std140) uniform Projection {
|
||||
// mat4 ProjMat;
|
||||
// };
|
||||
//
|
||||
//in vec3 Position;
|
||||
//in vec2 UV0;
|
||||
//in vec4 Color;
|
||||
// in vec3 Position;
|
||||
// in vec2 UV0;
|
||||
// in vec4 Color;
|
||||
//
|
||||
//out vec2 texCoord0;
|
||||
//out vec4 vertexColor;
|
||||
// out vec2 texCoord0;
|
||||
// out vec4 vertexColor;
|
||||
//
|
||||
//void main() {
|
||||
// gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
||||
// void main() {
|
||||
// gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
|
||||
//
|
||||
// texCoord0 = UV0;
|
||||
// vertexColor = Color;
|
||||
//}
|
||||
// texCoord0 = UV0;
|
||||
// vertexColor = Color;
|
||||
// }
|
||||
//)";
|
||||
//
|
||||
//const char* minecraft_core_tex_color_1216_fs = R"(#version 150
|
||||
// const char* minecraft_core_tex_color_1216_fs = R"(#version 150
|
||||
//
|
||||
//// Can't moj_import in things used during startup, when resource packs don't exist.
|
||||
//// This is a copy of dynamicimports.glsl
|
||||
//layout(std140) uniform DynamicTransforms {
|
||||
// mat4 ModelViewMat;
|
||||
// vec4 ColorModulator;
|
||||
// vec3 ModelOffset;
|
||||
// mat4 TextureMat;
|
||||
// float LineWidth;
|
||||
//};
|
||||
// layout(std140) uniform DynamicTransforms {
|
||||
// mat4 ModelViewMat;
|
||||
// vec4 ColorModulator;
|
||||
// vec3 ModelOffset;
|
||||
// mat4 TextureMat;
|
||||
// float LineWidth;
|
||||
// };
|
||||
//
|
||||
//uniform sampler2D Sampler0;
|
||||
// uniform sampler2D Sampler0;
|
||||
//
|
||||
//in vec2 texCoord0;
|
||||
//in vec4 vertexColor;
|
||||
// in vec2 texCoord0;
|
||||
// in vec4 vertexColor;
|
||||
//
|
||||
//out vec4 fragColor;
|
||||
// out vec4 fragColor;
|
||||
//
|
||||
//void main() {
|
||||
// vec4 color = texture(Sampler0, texCoord0) * vertexColor;
|
||||
// if (color.a == 0.0) {
|
||||
// discard;
|
||||
// }
|
||||
// fragColor = color * ColorModulator;
|
||||
//}
|
||||
// void main() {
|
||||
// vec4 color = texture(Sampler0, texCoord0) * vertexColor;
|
||||
// if (color.a == 0.0) {
|
||||
// discard;
|
||||
// }
|
||||
// fragColor = color * ColorModulator;
|
||||
// }
|
||||
//)";
|
||||
//
|
||||
//TEST_F(ProgramTest, MinecraftTexColor1_21_6) {
|
||||
// char infoLog[1024] = "";
|
||||
// TEST_F(ProgramTest, MinecraftTexColor1_21_6) {
|
||||
// char infoLog[1024] = "";
|
||||
//
|
||||
// GLuint vs = CreateShader(GL_VERTEX_SHADER);
|
||||
// ShaderSource(vs, 1, &minecraft_core_tex_color_1216_vs, NULL);
|
||||
// CompileShader(vs);
|
||||
// GLint vsStatus = GL_FALSE;
|
||||
// GetShaderiv(vs, GL_COMPILE_STATUS, &vsStatus);
|
||||
// GetShaderInfoLog(vs, 1024, nullptr, infoLog);
|
||||
// ASSERT_EQ(vsStatus, GL_TRUE) << infoLog;
|
||||
// GLuint vs = CreateShader(GL_VERTEX_SHADER);
|
||||
// ShaderSource(vs, 1, &minecraft_core_tex_color_1216_vs, NULL);
|
||||
// CompileShader(vs);
|
||||
// GLint vsStatus = GL_FALSE;
|
||||
// GetShaderiv(vs, GL_COMPILE_STATUS, &vsStatus);
|
||||
// GetShaderInfoLog(vs, 1024, nullptr, infoLog);
|
||||
// ASSERT_EQ(vsStatus, GL_TRUE) << infoLog;
|
||||
//
|
||||
// GLuint fs = CreateShader(GL_FRAGMENT_SHADER);
|
||||
// ShaderSource(fs, 1, &minecraft_core_tex_color_1216_fs, NULL);
|
||||
// CompileShader(fs);
|
||||
// GLint fsStatus = GL_FALSE;
|
||||
// GetShaderiv(fs, GL_COMPILE_STATUS, &fsStatus);
|
||||
// GetShaderInfoLog(fs, 1024, nullptr, infoLog);
|
||||
// ASSERT_EQ(fsStatus, GL_TRUE) << infoLog;
|
||||
// GLuint fs = CreateShader(GL_FRAGMENT_SHADER);
|
||||
// ShaderSource(fs, 1, &minecraft_core_tex_color_1216_fs, NULL);
|
||||
// CompileShader(fs);
|
||||
// GLint fsStatus = GL_FALSE;
|
||||
// GetShaderiv(fs, GL_COMPILE_STATUS, &fsStatus);
|
||||
// GetShaderInfoLog(fs, 1024, nullptr, infoLog);
|
||||
// ASSERT_EQ(fsStatus, GL_TRUE) << infoLog;
|
||||
//
|
||||
// GLuint program = CreateProgram();
|
||||
// AttachShader(program, vs);
|
||||
// AttachShader(program, fs);
|
||||
// GLuint program = CreateProgram();
|
||||
// AttachShader(program, vs);
|
||||
// AttachShader(program, fs);
|
||||
//
|
||||
// LinkProgram(program);
|
||||
// LinkProgram(program);
|
||||
//
|
||||
// UseProgram(program);
|
||||
// UseProgram(program);
|
||||
//
|
||||
// int uniformCount = 0;
|
||||
// GetProgramiv(program, GL_ACTIVE_UNIFORMS, &uniformCount);
|
||||
// ASSERT_LT(uniformCount, 4000);
|
||||
// int uniformCount = 0;
|
||||
// GetProgramiv(program, GL_ACTIVE_UNIFORMS, &uniformCount);
|
||||
// ASSERT_LT(uniformCount, 4000);
|
||||
//
|
||||
// auto transformuboIdx = GetUniformBlockIndex(program, "DynamicTransforms");
|
||||
// auto transformuboIdx = GetUniformBlockIndex(program, "DynamicTransforms");
|
||||
//
|
||||
// auto programObject = MG_State::pGLContext->GetCurrentProgram();
|
||||
// ASSERT_EQ(programObject->GetUBOSize(), 0);
|
||||
// auto programObject = MG_State::pGLContext->GetCurrentProgram();
|
||||
// ASSERT_EQ(programObject->GetUBOSize(), 0);
|
||||
//
|
||||
// // auto& spirvs = programObject->GetGeneratedSpirv();
|
||||
// // for (auto spirv: spirvs) {
|
||||
// // MG_Util::ShaderTranspiler::SpvcSession spvcSession(spirv);
|
||||
// // spvc_compiler_options options;
|
||||
// // spvcSession.CreateOptions(&options);
|
||||
// //
|
||||
// // spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 320);
|
||||
// // spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_TRUE);
|
||||
// // // spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS, SPVC_TRUE);
|
||||
// //
|
||||
// // spvcSession.SetOptions(options);
|
||||
// //
|
||||
// // const char* result = nullptr;
|
||||
// // spvcSession.Compile(&result);
|
||||
// // printf("%s\n\n", result);
|
||||
// // }
|
||||
//}
|
||||
// // auto& spirvs = programObject->GetGeneratedSpirv();
|
||||
// // for (auto spirv: spirvs) {
|
||||
// // MG_Util::ShaderTranspiler::SpvcSession spvcSession(spirv);
|
||||
// // spvc_compiler_options options;
|
||||
// // spvcSession.CreateOptions(&options);
|
||||
// //
|
||||
// // spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 320);
|
||||
// // spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_TRUE);
|
||||
// // // spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS, SPVC_TRUE);
|
||||
// //
|
||||
// // spvcSession.SetOptions(options);
|
||||
// //
|
||||
// // const char* result = nullptr;
|
||||
// // spvcSession.Compile(&result);
|
||||
// // printf("%s\n\n", result);
|
||||
// // }
|
||||
// }
|
||||
|
||||
const char* optifine_vs1 = R"(#version 460 core
|
||||
|
||||
@@ -931,10 +931,10 @@ TEST_F(ProgramTest, CompileAndLinkWithExplicitVertexIn) {
|
||||
spvcSession.Compile(&result);
|
||||
printf("%s\n\n", result);
|
||||
const char* ret = strstr(result, needle);
|
||||
if (ret)
|
||||
pSrcVertIn = (char*)ret;
|
||||
if (ret) pSrcVertIn = (char*)ret;
|
||||
// }
|
||||
ASSERT_TRUE(pSrcVertIn != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle << "\")";
|
||||
ASSERT_TRUE(pSrcVertIn != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle
|
||||
<< "\")";
|
||||
}
|
||||
|
||||
TEST_F(ProgramTest, CompileAndLinkWithExplicitFragmentOut) {
|
||||
@@ -978,22 +978,22 @@ TEST_F(ProgramTest, CompileAndLinkWithExplicitFragmentOut) {
|
||||
char* pSrcfragOut = nullptr;
|
||||
const char* needle = "layout(location = 7) out vec4 fragColor;";
|
||||
// for (auto spirv: spirvs) {
|
||||
MG_Util::ShaderTranspiler::SpvcSession spvcSession(fragSpirv);
|
||||
spvc_compiler_options options;
|
||||
spvcSession.CreateOptions(&options);
|
||||
MG_Util::ShaderTranspiler::SpvcSession spvcSession(fragSpirv);
|
||||
spvc_compiler_options options;
|
||||
spvcSession.CreateOptions(&options);
|
||||
|
||||
spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 460);
|
||||
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_FALSE);
|
||||
// spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS, SPVC_FALSE);
|
||||
spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION, 460);
|
||||
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES, SPVC_FALSE);
|
||||
// spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS, SPVC_FALSE);
|
||||
|
||||
spvcSession.SetOptions(options);
|
||||
spvcSession.SetOptions(options);
|
||||
|
||||
const char* result = nullptr;
|
||||
spvcSession.Compile(&result);
|
||||
printf("%s\n\n", result);
|
||||
const char* ret = strstr(result, needle);
|
||||
if (ret)
|
||||
pSrcfragOut = (char*)ret;
|
||||
const char* result = nullptr;
|
||||
spvcSession.Compile(&result);
|
||||
printf("%s\n\n", result);
|
||||
const char* ret = strstr(result, needle);
|
||||
if (ret) pSrcfragOut = (char*)ret;
|
||||
// }
|
||||
ASSERT_TRUE(pSrcfragOut != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle << "\")";
|
||||
ASSERT_TRUE(pSrcfragOut != nullptr) << "Not found expected string in generated shader.\n(Searching for \"" << needle
|
||||
<< "\")";
|
||||
}
|
||||
|
||||
@@ -395,9 +395,8 @@ TEST_F(ProgramUtilTest, CompileAndLinkBlitProgram) {
|
||||
attribLocations["UV0"] = 2;
|
||||
|
||||
ProgramAttrib programAttrib{// .shaderTypes = { GL_VERTEX_SHADER, GL_FRAGMENT_SHADER },
|
||||
.shaders = {vs_res.value(), fs_res.value()},
|
||||
.explicitVertexInLocations = attribLocations
|
||||
};
|
||||
.shaders = {vs_res.value(), fs_res.value()},
|
||||
.explicitVertexInLocations = attribLocations};
|
||||
|
||||
auto program_res = ShaderCompiler::LinkProgram(programAttrib);
|
||||
if (!program_res) {
|
||||
|
||||
@@ -4,28 +4,28 @@ namespace MobileGL {
|
||||
namespace MG_Util {
|
||||
bool IsDepthFormatInternalFormat(TextureInternalFormat internalformat) {
|
||||
switch (internalformat) {
|
||||
case TextureInternalFormat::DepthComponent16:
|
||||
case TextureInternalFormat::DepthComponent24:
|
||||
case TextureInternalFormat::DepthComponent32:
|
||||
case TextureInternalFormat::DepthComponent32F:
|
||||
case TextureInternalFormat::Depth24Stencil8:
|
||||
case TextureInternalFormat::Depth32FStencil8:
|
||||
case TextureInternalFormat::DepthComponent:
|
||||
case TextureInternalFormat::DepthStencil:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case TextureInternalFormat::DepthComponent16:
|
||||
case TextureInternalFormat::DepthComponent24:
|
||||
case TextureInternalFormat::DepthComponent32:
|
||||
case TextureInternalFormat::DepthComponent32F:
|
||||
case TextureInternalFormat::Depth24Stencil8:
|
||||
case TextureInternalFormat::Depth32FStencil8:
|
||||
case TextureInternalFormat::DepthComponent:
|
||||
case TextureInternalFormat::DepthStencil:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsStencilFormatInternalFormat(TextureInternalFormat internalformat) {
|
||||
switch (internalformat) {
|
||||
case TextureInternalFormat::Depth24Stencil8:
|
||||
case TextureInternalFormat::Depth32FStencil8:
|
||||
case TextureInternalFormat::DepthStencil:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case TextureInternalFormat::Depth24Stencil8:
|
||||
case TextureInternalFormat::Depth32FStencil8:
|
||||
case TextureInternalFormat::DepthStencil:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // namespace MG_Util
|
||||
|
||||
@@ -284,7 +284,7 @@ namespace MobileGL {
|
||||
return TextureUploadTarget::Texture2D;
|
||||
case GL_TEXTURE_3D:
|
||||
return TextureUploadTarget::Texture3D;
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
return TextureUploadTarget::ProxyTexture2D;
|
||||
case GL_TEXTURE_1D_ARRAY:
|
||||
return TextureUploadTarget::Texture1DArray;
|
||||
@@ -421,16 +421,16 @@ namespace MobileGL {
|
||||
|
||||
TextureSwizzleParam ConvertGLEnumPnameToTextureSwizzleParam(GLenum v) {
|
||||
switch (v) {
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
return TextureSwizzleParam::Red;
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
return TextureSwizzleParam::Green;
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
return TextureSwizzleParam::Blue;
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
return TextureSwizzleParam::Alpha;
|
||||
default:
|
||||
return TextureSwizzleParam::Unknown;
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
return TextureSwizzleParam::Red;
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
return TextureSwizzleParam::Green;
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
return TextureSwizzleParam::Blue;
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
return TextureSwizzleParam::Alpha;
|
||||
default:
|
||||
return TextureSwizzleParam::Unknown;
|
||||
}
|
||||
}
|
||||
} // namespace MG_Util
|
||||
|
||||
@@ -311,51 +311,51 @@ namespace MobileGL {
|
||||
}
|
||||
}
|
||||
|
||||
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode v) {
|
||||
// switch (v) {
|
||||
// case SamplerFilterMode::Nearest:
|
||||
// return GL_NEAREST;
|
||||
// case SamplerFilterMode::Linear:
|
||||
// return GL_LINEAR;
|
||||
// default:
|
||||
// return GL_UNKNOWN_MGL;
|
||||
// }
|
||||
// }
|
||||
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode v) {
|
||||
// switch (v) {
|
||||
// case SamplerFilterMode::Nearest:
|
||||
// return GL_NEAREST;
|
||||
// case SamplerFilterMode::Linear:
|
||||
// return GL_LINEAR;
|
||||
// default:
|
||||
// return GL_UNKNOWN_MGL;
|
||||
// }
|
||||
// }
|
||||
|
||||
GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode filter, SamplerMipmapMode mipmap) {
|
||||
switch (mipmap) {
|
||||
case SamplerMipmapMode::None: {
|
||||
switch (filter) {
|
||||
case SamplerFilterMode::Nearest:
|
||||
return GL_NEAREST;
|
||||
case SamplerFilterMode::Linear:
|
||||
return GL_LINEAR;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
case SamplerMipmapMode::Nearest: {
|
||||
switch (filter) {
|
||||
case SamplerFilterMode::Nearest:
|
||||
return GL_NEAREST_MIPMAP_NEAREST;
|
||||
case SamplerFilterMode::Linear:
|
||||
return GL_LINEAR_MIPMAP_NEAREST;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
case SamplerMipmapMode::Linear: {
|
||||
switch (filter) {
|
||||
case SamplerFilterMode::Nearest:
|
||||
return GL_NEAREST_MIPMAP_LINEAR;
|
||||
case SamplerFilterMode::Linear:
|
||||
return GL_LINEAR_MIPMAP_LINEAR;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
case SamplerMipmapMode::None: {
|
||||
switch (filter) {
|
||||
case SamplerFilterMode::Nearest:
|
||||
return GL_NEAREST;
|
||||
case SamplerFilterMode::Linear:
|
||||
return GL_LINEAR;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
case SamplerMipmapMode::Nearest: {
|
||||
switch (filter) {
|
||||
case SamplerFilterMode::Nearest:
|
||||
return GL_NEAREST_MIPMAP_NEAREST;
|
||||
case SamplerFilterMode::Linear:
|
||||
return GL_LINEAR_MIPMAP_NEAREST;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
case SamplerMipmapMode::Linear: {
|
||||
switch (filter) {
|
||||
case SamplerFilterMode::Nearest:
|
||||
return GL_NEAREST_MIPMAP_LINEAR;
|
||||
case SamplerFilterMode::Linear:
|
||||
return GL_LINEAR_MIPMAP_LINEAR;
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
default:
|
||||
return GL_UNKNOWN_MGL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace MobileGL {
|
||||
GLenum ConvertTextureInternalFormatToGLEnum(TextureInternalFormat internalformat);
|
||||
GLenum ConvertTexturePixelDataTypeToGLEnum(TexturePixelDataType type);
|
||||
GLenum ConvertTextureUploadTargetToGLEnum(TextureUploadTarget target);
|
||||
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode value);
|
||||
// GLenum ConvertSamplerMipmapModeToGLEnum(SamplerMipmapMode value);
|
||||
// GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode value);
|
||||
// GLenum ConvertSamplerMipmapModeToGLEnum(SamplerMipmapMode value);
|
||||
GLenum ConvertSamplerFilterModeToGLEnum(SamplerFilterMode filter, SamplerMipmapMode mipmap);
|
||||
GLenum ConvertSamplerWrapModeToGLEnum(SamplerWrapMode value);
|
||||
GLenum ConvertSamplerCompareModeToGLEnum(SamplerCompareMode value);
|
||||
|
||||
@@ -174,18 +174,17 @@ namespace MobileGL {
|
||||
return std::unexpected(r);
|
||||
}
|
||||
|
||||
for (auto [name, loc]: attrib.explicitVertexInLocations) {
|
||||
for (auto [name, loc] : attrib.explicitVertexInLocations) {
|
||||
MGLOG_D("%s: got explicitly set - layout(location = %d) %s;", __func__, loc, name.c_str());
|
||||
}
|
||||
|
||||
// UniquePtr<glslang::TIoMapResolver> resolver;
|
||||
UniquePtr<TMglGlslIoResolver> resolver;
|
||||
for (unsigned stage = 0; stage < EShLangCount; stage++) {
|
||||
if (program->getIntermediate((EShLanguage)stage) == nullptr)
|
||||
continue;
|
||||
resolver = MakeUnique<TMglGlslIoResolver>(*program, (EShLanguage)stage,
|
||||
attrib.explicitVertexInLocations,
|
||||
attrib.explicitFragmentOutLocations);
|
||||
if (program->getIntermediate((EShLanguage)stage) == nullptr) continue;
|
||||
resolver =
|
||||
MakeUnique<TMglGlslIoResolver>(*program, (EShLanguage)stage, attrib.explicitVertexInLocations,
|
||||
attrib.explicitFragmentOutLocations);
|
||||
break;
|
||||
}
|
||||
auto ioMapper = UniquePtr<glslang::TIoMapper>(glslang::GetGlslIoMapper());
|
||||
|
||||
@@ -64,9 +64,10 @@ namespace MobileGL {
|
||||
// TODO: We should assert we're really dealing with vertex shader here
|
||||
|
||||
SPVC_CHK_INIT
|
||||
const spvc_reflected_resource *list = nullptr;
|
||||
const spvc_reflected_resource* list = nullptr;
|
||||
size_t count = 0;
|
||||
SPVC_CHK_RESULT(spvc_resources_get_resource_list_for_type(resources, SPVC_RESOURCE_TYPE_STAGE_INPUT, &list, &count));
|
||||
SPVC_CHK_RESULT(spvc_resources_get_resource_list_for_type(resources, SPVC_RESOURCE_TYPE_STAGE_INPUT,
|
||||
&list, &count));
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
auto& resource = list[i];
|
||||
auto it = location.find(resource.name);
|
||||
|
||||
@@ -24,4 +24,4 @@ namespace MobileGL {
|
||||
}
|
||||
TDefaultGlslIoResolver::reserverStorageSlot(ent, infoSink);
|
||||
}
|
||||
}
|
||||
} // namespace MobileGL
|
||||
@@ -14,18 +14,19 @@
|
||||
#include "MG_Util/Types.h"
|
||||
|
||||
namespace MobileGL {
|
||||
class TMglGlslIoResolver: public glslang::TDefaultGlslIoResolver {
|
||||
class TMglGlslIoResolver : public glslang::TDefaultGlslIoResolver {
|
||||
public:
|
||||
using ExplicitVarSlotMap = UnorderedMap<String, Uint>;
|
||||
TMglGlslIoResolver(const glslang::TIntermediate& intermediate, const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts):
|
||||
TDefaultGlslIoResolver(intermediate), m_explicitVertexIns(vertexIns), m_explicitFragOuts(fragOuts) {}
|
||||
TMglGlslIoResolver(const glslang::TProgram& program, const EShLanguage stage, const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts):
|
||||
TMglGlslIoResolver(*program.getIntermediate(stage), vertexIns, fragOuts) {}
|
||||
TMglGlslIoResolver(const glslang::TIntermediate& intermediate, const ExplicitVarSlotMap& vertexIns,
|
||||
const ExplicitVarSlotMap& fragOuts)
|
||||
: TDefaultGlslIoResolver(intermediate), m_explicitVertexIns(vertexIns), m_explicitFragOuts(fragOuts) {}
|
||||
TMglGlslIoResolver(const glslang::TProgram& program, const EShLanguage stage,
|
||||
const ExplicitVarSlotMap& vertexIns, const ExplicitVarSlotMap& fragOuts)
|
||||
: TMglGlslIoResolver(*program.getIntermediate(stage), vertexIns, fragOuts) {}
|
||||
void reserverStorageSlot(glslang::TVarEntryInfo& ent, TInfoSink& infoSink) override;
|
||||
|
||||
protected:
|
||||
const ExplicitVarSlotMap& m_explicitVertexIns;
|
||||
const ExplicitVarSlotMap& m_explicitFragOuts;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
} // namespace MobileGL
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace glslang {
|
||||
struct TVarEntryInfo {
|
||||
long long id;
|
||||
TIntermSymbol *symbol;
|
||||
TIntermSymbol* symbol;
|
||||
bool live;
|
||||
TLayoutPacking upgradedToPushConstantPacking; // ElpNone means it hasn't been upgraded
|
||||
int newBinding;
|
||||
@@ -26,4 +26,4 @@ namespace glslang {
|
||||
|
||||
void clearNewAssignments();
|
||||
};
|
||||
}
|
||||
} // namespace glslang
|
||||
|
||||
Reference in New Issue
Block a user