MCPcopy Create free account
hub / github.com/dfranx/SHADERed / FetchPixel

Method FetchPixel

src/SHADERed/InterfaceManager.cpp:216–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214 Renderer.Render();
215 }
216 void InterfaceManager::FetchPixel(PixelInformation& pixel)
217 {
218 int vertexGroupID = Renderer.DebugVertexPick(pixel.Pass, pixel.Object, pixel.RelativeCoordinate, -1);
219 int vertexID = Renderer.DebugVertexPick(pixel.Pass, pixel.Object, pixel.RelativeCoordinate, vertexGroupID);
220
221 int instanceGroupID = Renderer.DebugInstancePick(pixel.Pass, pixel.Object, pixel.RelativeCoordinate, -1);
222 int instanceID = Renderer.DebugInstancePick(pixel.Pass, pixel.Object, pixel.RelativeCoordinate, instanceGroupID);
223
224 pixel.InstanceID = instanceID;
225 pixel.VertexID = vertexID;
226 m_fetchVertices(pixel);
227
228 // return old info
229 Renderer.Render(false, pixel.Pass); // render everything up to the pixel.Pass object
230
231 // run vertex shader
232 Debugger.PrepareVertexShader(pixel.Pass, pixel.Object);
233 for (int i = 0; i < pixel.VertexCount; i++) {
234 Debugger.SetVertexShaderInput(pixel, i);
235 pixel.VertexShaderPosition[i] = Debugger.ExecuteVertexShader();
236 Debugger.CopyVertexShaderOutput(pixel, i);
237 }
238
239 memcpy(pixel.FinalPosition, pixel.VertexShaderPosition, sizeof(glm::vec4) * 3);
240
241 // run the tessellation shader if needed
242 if (pixel.TessellationShaderUsed) {
243 Debugger.PrepareTessellationControlShader(pixel.Pass, pixel.Object);
244 Debugger.SetTessellationControlShaderInput(pixel);
245 for (int iid = 0; iid < pixel.VertexCount; iid++)
246 Debugger.ExecuteTessellationControlShader(iid);
247 Debugger.CopyTessellationControlShaderOutput();
248 }
249
250 // run the geometry shader if needed
251 if (pixel.GeometryShaderUsed) {
252 Debugger.PrepareGeometryShader(pixel.Pass, pixel.Object);
253 Debugger.SetGeometryShaderInput(pixel);
254 Debugger.ExecuteGeometryShader();
255 }
256
257 // run pixel shader
258 Debugger.PreparePixelShader(pixel.Pass, pixel.Object);
259 Debugger.SetPixelShaderInput(pixel);
260 pixel.DebuggerColor = Debugger.ExecutePixelShader(pixel.Coordinate.x, pixel.Coordinate.y, pixel.RenderTextureIndex);
261 pixel.Discarded = Debugger.GetVM()->discarded;
262
263 pixel.Fetched = true;
264
265 // compute shader suggestion for instanced objects
266 if (pixel.InstanceBuffer) {
267 BufferObject* buf = (BufferObject*)pixel.InstanceBuffer;
268 ObjectManagerItem* bufOwner = Objects.GetByBufferID(buf->ID);
269
270 for (auto& item : Pipeline.GetList()) {
271 if (Objects.IsUniformBound(bufOwner, item) != -1) {
272 if (item->Type == PipelineItem::ItemType::ComputePass) {
273 DebuggerSuggestion suggestion;

Callers 1

RenderPixelInfoMethod · 0.80

Tested by 1

RenderPixelInfoMethod · 0.64