compute-shader

DirectX 11 - Compute shader: Writing to an output resource

守給你的承諾、 提交于 2019-12-03 01:32:52
I've just started using the Compute shader stage in DirectX 11 and encountered some unwanted behaviour when writing to an output resource in the Compute shader. I seem to get only zeroes as output which, to my understanding, means that out-of-bound reads has been performed in the Compute shader. (Out-of-bound writes results in no-ops) Creating the Compute shader components Input resources First I create an ID3D11Buffer* for input data. This is passed as a resource when creating the SRV used for input to the Compute shader stage. If the input data never changes then we could release the

D3D12 Use backbuffer surface as unordered access view (UAV)

雨燕双飞 提交于 2019-12-02 05:41:20
Im making a simple raytracer for a schoolproject were a compute shader is supposed to be used to shade a triangle or some other primitive. For this I'd like to write to a backbuffer-surface directly in the compute shader, to then present the results imideatly. I know for certain that this is possible in DX11 though i can't seem to get it to work in DX12. I couldn't gather that much information about this, but i found this gamedev thread discussing the exact same problem I try to figure out and they seem to come to the conclusion which was my go to workaround: writing to an intermediate texture

Only first Compute Shader array element appears updated

余生颓废 提交于 2019-11-30 09:51:38
问题 Trying to send an array of integer to a compute shader, sets an arbitrary value to each integer and then reads back on CPU/HOST. The problem is that only the first element of my array gets updated. My array is initialized with all elements = 5 in the CPU, then I try to sets all the values to 2 in the Compute Shader: C++ Code: this->numOfElements = std::vector<int> numOfElements; //num of elements for each voxel //Set the reset grid program as current program glUseProgram(this-

Only first Compute Shader array element appears updated

你。 提交于 2019-11-29 17:15:03
Trying to send an array of integer to a compute shader, sets an arbitrary value to each integer and then reads back on CPU/HOST. The problem is that only the first element of my array gets updated. My array is initialized with all elements = 5 in the CPU, then I try to sets all the values to 2 in the Compute Shader: C++ Code: this->numOfElements = std::vector<int> numOfElements; //num of elements for each voxel //Set the reset grid program as current program glUseProgram(this->resetGridProgHandle); //Binds and fill the buffer glBindBuffer(GL_SHADER_STORAGE_BUFFER, this->counterBufferHandle);

SSBO as bigger UBO?

吃可爱长大的小学妹 提交于 2019-11-29 07:03:50
i am currently doing so rendering in OpenGL 4.3 using UBOs to store all my constant data on the GPU. (Stuff like material descriptions, matrices, ...). It works however the small size of UBO (64kB on my implementation) forces me to switch buffers numerous times slowing rendering, i am looking for similar a way to store a few MB. After a little research i saw that SSBO allow exactly that but also have unwanted 'features' : they can be written from the shader and might be slower to read. Is there a better solution than SSBO for supplying big chunks of data to shaders ? I feel like i am missing