指向Compute Shader的输入结构的指针(Pointer into input struct of Compute Shader)
我的计算着色器再次出现问题...我想将包含指针的结构传递给计算着色器。 这是我的结构示例:
struct couleurStruct { float r; float g; float b; float a; float *x; };
这是我的SSBO初始化:
couleurStruct *coul; coul = (couleurStruct *)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, 1 * sizeof(couleurStruct), bufMask); //coul->x = (float *)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, 1 * sizeof(float), bufMask); coul->r = 0.0; coul->g = 1.0; coul->b = 0.0; coul->a = 1.0; coul->x[0] = 0.5; glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, structBuffer);
我尝试了很多不同的初始化但没有成功......
那么,有没有办法分配所需的所有内存(因为我知道我的指针所指向的每个数组中需要的内存)并将其传递给计算着色器? 或者是否真的不可能将指针传递给计算着色器?
感谢您的帮助!
Once more I have a problem with my compute shader... I would like to pass a structure containing a pointer into a compute shader. This is my structure example:
struct couleurStruct { float r; float g; float b; float a; float *x; };
Here is my SSBO initialization :
couleurStruct *coul; coul = (couleurStruct *)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, 1 * sizeof(couleurStruct), bufMask); //coul->x = (float *)glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, 1 * sizeof(float), bufMask); coul->r = 0.0; coul->g = 1.0; coul->b = 0.0; coul->a = 1.0; coul->x[0] = 0.5; glUnmapBuffer(GL_SHADER_STORAGE_BUFFER); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, structBuffer);
I tried a lot of different initializations but without success...
So, is there a way to allocate all the memory needed (because I know the memory I will need inside each of the arrays pointed by my pointers) and pass it to the compute shader? Or is it really impossible to pass a pointer to a compute shader?
Thank you for your help!
原文:https://stackoverflow.com/questions/42396805
最满意答案
您需要重新编译库。
- 删除构建它的目录。
- 创建一个目录来构建库。
切换到该目录并发出:
../configure --enable-unicode --enable-debug
问题
- 编译你的项目。
顺便说一下,你有没有理由尝试过时的wx版本? 你应该得到最新的3.1版本。
You need to recompile the library.
- Remove the directory where you build it.
- Create a directory to build the library.
Change to that directory and issue:
../configure --enable-unicode --enable-debug
Issue make
- Compile you project.
BTW, is there a reason you are trying an outdated version of wx? You should get the latest 3.1 release.
相关问答
更多-
Linux Red Hat下安装CodeBlocks提示错误,怎么解决?[2023-07-12]
缺少 libwx 安装包 -
如何更改libwx_gtk2ud_richtext-2.8的名称(How can I change the name of libwx_gtk2ud_richtext-2.8)[2023-04-16]
您需要重新编译库。 删除构建它的目录。 创建一个目录来构建库。 切换到该目录并发出: ../configure --enable-unicode --enable-debug 问题 编译你的项目。 顺便说一下,你有没有理由尝试过时的wx版本? 你应该得到最新的3.1版本。 You need to recompile the library. Remove the directory where you build it. Create a directory to build the library. Ch ... -
gtk3更改按钮bg颜色(gtk3 change button bg color)[2022-11-28]
您需要向Button添加自定义CSS: GdkDisplay *display; GdkScreen *screen; display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); GtkCssProvider *provider; provider = gtk_css_provider_new (); gtk_style_context_add_provider_for_screen ... -
您可以尝试更改标签的颜色而不是按钮的颜色。 按钮实际上只是可点击的垃圾箱。 带文本的按钮只是一个有用的构造函数,可以自动添加标签。 #histoToolGreen label { color: green; } #histoToolBlue label { color: blue; } You might try changing the color of the label rather than that of the button. Buttons are really just clic ...
-
您可能需要检查您的标头是否都没有以这种方式或那种方式声明DEBUG宏。 我遇到过这个问题一次。 除此之外,最好还是执行静态链接。 You may need to check if none of your headers declares DEBUG macro this or that way. I ran into this problem once. Apart from that, it may be better to perform static linking instead.
-
Gtk.Widget类具有Gtk.Widget类型的Accessible属性。 您可以获得但不设置此属性。 您也无法在子类中覆盖它。 但是,似乎Atk.Object具有多个可写属性,写入它们会更改AT返回的信息。 例如: var widget = new Gtk.Label("Hello World"); widget.Accessible.Role = Atk.Role.PushButton; 这会创建一个普通的标签小部件,但会导致AT认为它实际上是一个按钮小部件。 我还没有确定如何更改窗口小部件的明显 ...
-
如果你想改变你的应用程序的总体字体,我会把这个工作留给gtkrc(然后成为一个谷歌问题,“gtkrc字体”查询将我们带到这个Ubuntu论坛链接 ,其中有以下代码片段gtkrc文件): style "font" { font_name = "Corbel 8" } widget_class "*" style "font" gtk-font-name = "Corbel 8" (用您/用户需要的字体替换字体) 然后,用户将获得一致的体验,并且能够轻松更改设置,而无需篡改代码,也无需处理维护个人配置相关代码 ...
-
你只需要用新的库版本重新编译它。 从收到的错误消息来看,您没有这样做,或者编译失败。 另外,请确保您阅读有关升级到3.0的文档,因为它几乎是您将会遇到错误的保证。 You just need to re-compile it with the new library version. Judging from the error message you received you didn't do it or the compilation was unsuccessful. Also, make sure ...
-
我已经找到了问题(它只花了我一个月的最佳时间:)) - 你需要在你的机器上安装g++ 。 您可以使用sudo yum install gcc-c++安装它。 I have figured out the issue (and it only took me the best part of a month :))--you need to have g++ installed on your machine. You can install it with sudo yum install gcc-c++. ...
-
于是我在网上搜索,发现了“patchelf”命令。 由于我的二进制文件(使用cx_Freeze生成)与我的可执行文件位于同一目录中,因此我创建了该脚本: for i in *so* do patchelf --set-rpath '.' $i done 因为,我的独立应用程序可以在“空的”openSuse系统上启动...... 注意: 该解决方案适用于cx_Freeze 4.3.x,但不适用于5.x版本 我成功地在各种其他Linux平台(Debian,Mint,Ubuntu,Mageia,Fed ...