From 994c38c0c77d16f7403298a615fa4742dd38500d Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Tue, 28 Nov 2017 20:03:40 +0100 Subject: [PATCH] adapt SSBO example for ComputeDispatch but have strange runtime errors: 0(100) : error C7623: implicit narrowing of type from "vec3" to "float" 0(108) : error C7623: implicit narrowing of type from "vec3" to "float" --- examples/osgSSBO/osgSSBO.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/osgSSBO/osgSSBO.cpp b/examples/osgSSBO/osgSSBO.cpp index 637f466bc..5ce2ec07c 100644 --- a/examples/osgSSBO/osgSSBO.cpp +++ b/examples/osgSSBO/osgSSBO.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -167,6 +167,7 @@ class ComputeNode : public osg::PositionAttitudeTransform public: + osg::ref_ptr _computeDispatch; osg::ref_ptr _computeProgram; osg::ref_ptr _computeShader; //compute and write position data in SSBO @@ -204,6 +205,8 @@ public: _vertexShaderSourcePath = "shaders/osgssboVertexShader.vs"; _geometryShaderSourcePath = "shaders/osgssboGeometryShader.gs"; _fragmentShaderSourcePath = "shaders/osgssboFragmentShader.fs"; + _computeDispatch=new osg::ComputeDispatch(); + addChild(_computeDispatch); } }; @@ -622,7 +625,7 @@ void ComputeNode::initComputingSetup() { _computeProgram = new osg::Program; - _computeProgram->setComputeGroups((NUM_ELEMENTS_X / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_X / WORK_GROUP_SIZE), (NUM_ELEMENTS_Y / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_Y / WORK_GROUP_SIZE), 1); + _computeDispatch->setComputeGroups((NUM_ELEMENTS_X / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_X / WORK_GROUP_SIZE), (NUM_ELEMENTS_Y / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_Y / WORK_GROUP_SIZE), 1); _computeShader = osgDB::readRefShaderFile(osg::Shader::COMPUTE, _computeShaderSourcePath); _computeProgram->addShader(_computeShader.get());