Skip to main content
GameDev.net gamedev.net
🔒 Locked

Write to texture to specific position

Started by Volgogradetzzz Jun 13, 2013 at 8:55 AM 6 replies 1.1k views
Original Post
Volgogradetzzz
Volgogradetzzz

Hello. I'm wonder - is there're any method for writing some data to specific uv coords in texture? Maybe not to texture, but some shared memory? Actually I need this only in GPU without CPU access.

Tordin
Tordin

Depending on how you are using them there is diffrent methods.

If you want to do stuff in your vertex shader, you could just add a float4 to the inputlay out that you store the data in. this will be stored per vertex, so each vertex will have a set of special data for them there. and from there you can pass it to the pixelshader how ever you want.

You could create a set of extra UV coridnates that correspond to the data you are searching for in the pixelshader.

Thees are two way to do it, i think there is lots more ways to do it, but then you have to do some more research.

"There will be major features. none to be thought of yet"
InvalidPointer
InvalidPointer

Set it up to be a render target, render a quad there?

clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
marcClintDion
marcClintDion

Maybe you could use a screen aligned quad rendered in an FBO then use glFragCoord to get the fragment position. *UPDATE* oops! I forgot to ask what API is being used.rolleyes.gif

Consider it pure joy, my brothers and sisters, whenever you face trials of many kinds, 3 because you know that the testing of your faith produces perseverance. 4 Let perseverance finish its work so that you may be mature and complete, not lacking anything.
Volgogradetzzz
Volgogradetzzz

Sorry, guys, I didn't understand. Can you explain in more details please? And I'll try to explain what I want - I'm rendering my geometry as usual, but in fragment shader I want to remember some value depending on that fragment position. In order to store something I have to use a texture. But I want to store my data in some ordder - to retrieve it lately. For example, my world is divided by cells and when I shade a pixel I know which cell it belongs to. And I want to store some data, assosiated with that cell. How can I do it?

ATEFred
ATEFred

In d3d11 you could use a structured buffer as UAV and store data in there, based on an index you derive from your UVs?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.