Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #3209

Merged
merged 4 commits into from
Sep 3, 2024
Merged

Devel #3209

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OgreMain/include/OgreImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace Ogre {
@see
Image::load( const String& filename )
*/
Image & load(const DataStreamPtr& stream, const String& type = BLANKSTRING );
Image & load(const DataStreamPtr& stream, String type = BLANKSTRING );

/** Utility method to combine 2 separate images into this one, with the first
image source supplying the RGB channels, and the second image supplying the
Expand Down
10 changes: 9 additions & 1 deletion OgreMain/src/OgreImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,18 @@ namespace Ogre {
return Codec::getCodec(formatextension)->encode(this);
}
//-----------------------------------------------------------------------------
Image & Image::load(const DataStreamPtr& stream, const String& type )
Image & Image::load(const DataStreamPtr& stream, String type )
{
freeMemory();

if (type.empty())
{
String base, ext;
StringUtil::splitBaseFilename(stream->getName(), base, ext);
if (!ext.empty())
type = ext;
}

Codec * pCodec = 0;
if (!type.empty())
{
Expand Down
3 changes: 3 additions & 0 deletions PlugIns/GLSLang/src/OgreGLSLang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ void GLSLangProgram::prepareImpl()
auto uboName = String(program.getUniformBlockName(blockIdx));
if(uboName != "OgreUniforms")
{
if(mType == GPT_MESH_PROGRAM || mType == GPT_TASK_PROGRAM)
continue; // SSBOs in mesh shaders are used for vertex buffers

GpuProgramManager::getSingleton().getSharedParameters(uboName);
// TODO: there is no public API to set the binding point and create the correct buffer yet
}
Expand Down
1 change: 1 addition & 0 deletions RenderSystems/Vulkan/src/OgreVulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ namespace Ogre
extensions.push_back( VK_KHR_SWAPCHAIN_EXTENSION_NAME );

VkPhysicalDeviceFeatures2 features2 = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};
features2.features = mDeviceFeatures;

#ifdef VK_EXT_mesh_shader
VkPhysicalDeviceMeshShaderFeaturesEXT meshShaderFeatures = {VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT};
Expand Down
10 changes: 7 additions & 3 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ namespace Ogre
deviceExtensions.push_back( VK_EXT_MESH_SHADER_EXTENSION_NAME );
deviceExtensions.push_back( VK_KHR_SPIRV_1_4_EXTENSION_NAME );
mRealCapabilities->setCapability(RSC_MESH_PROGRAM);

mDescriptorSetBindings[0].stageFlags |= VK_SHADER_STAGE_MESH_BIT_NV;
}
#endif
}
Expand Down Expand Up @@ -1102,12 +1104,14 @@ namespace Ogre
{
mActiveParameters[gptype] = params;

int dstUBO = gptype % GPT_PIPELINE_COUNT;

auto sizeBytes = params->getConstantList().size();
if(sizeBytes && gptype <= GPT_FRAGMENT_PROGRAM)
if(sizeBytes && dstUBO < 2)
{
auto step =
alignToNextMultiple(sizeBytes, mDevice->mDeviceProperties.limits.minUniformBufferOffsetAlignment);
mUBOInfo[gptype].range = sizeBytes;
mUBOInfo[dstUBO].range = sizeBytes;

if (std::accumulate(mAutoParamsBufferUsage.begin(), mAutoParamsBufferUsage.end(), 0) + step >=
mAutoParamsBuffer->getSizeInBytes())
Expand All @@ -1119,7 +1123,7 @@ namespace Ogre
if((mAutoParamsBufferPos + sizeBytes) >= mAutoParamsBuffer->getSizeInBytes())
mAutoParamsBufferPos = 0;

mUBODynOffsets[gptype] = mAutoParamsBufferPos;
mUBODynOffsets[dstUBO] = mAutoParamsBufferPos;

mAutoParamsBuffer->writeData(mAutoParamsBufferPos, sizeBytes, params->getConstantList().data());
mAutoParamsBufferPos += step;
Expand Down