You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO[Przemek]: try to draft up a `CTriangleMesh` Class in it's own header (like CPolyline), simplest form is basically two cpu buffers (1 array of uint index buffer, 1 array of float64_t3 vertexBuffer)
70
+
// TODO[Przemek]: Then have a `drawMesh` function here similar to drawXXX's below, this will fit both vertex and index buffer in the `geometryBuffer`.
71
+
// take a `SIntendedSubmitInfo` like others, but don't use it as I don't want you to handle anything regarding autoSubmit
72
+
// somehow retrieve or calculate the geometry buffer offsets of your vertex and index buffer to be used outside for binding purposes
73
+
69
74
//! this function fills buffers required for drawing a polyline and submits a draw through provided callback when there is not enough memory.
// TODO[Przemek]: Read after reading the fragment shader comments and having a basic understanding of the relationship between "mainObject" and our programmable blending resolve:
202
+
// Use `addMainObject_SubmitIfNeeded` to push your single mainObject you'll be using for the enitre triangle mesh (this will ensure overlaps between triangles of the same mesh is resolved correctly)
203
+
// Delete comment when you understand this
204
+
196
205
// [ADVANCED] Do not use this function unless you know what you're doing (It may cause auto submit)
197
206
// Never call this function multiple times in a row before indexing it in a drawable, because future auto-submits may invalidate mainObjects, so do them one by one, for example:
// TODO[Przemek]: binding the same pipelie, no need to change.
1384
1389
cb->bindGraphicsPipeline(graphicsPipeline.get());
1390
+
1391
+
// TODO[Przemek]: contour settings, height shading settings, base bda pointers will need to be pushed via pushConstants before the draw currently as it's the easiest thing to do.
1392
+
1393
+
// TODO[Przemek]: draw parameters needs to reflect the mesh involved
// TODO[Przemek]: add your own case, you won't call any other drawResourcesFiller function, only drawMesh with your custom made Mesh (for start it can be a single triangle)
1493
+
1482
1494
// we record upload of our objects and if we failed to allocate we submit everything
// TODO[Przemek]: we will need something similar to LineStyles but related to heigh shading settings which is user customizable (like LineStyle stipple patterns) and requires upper_bound to figure out the color based on height value.
265
+
// We'll discuss that later or what it will be looking like and how it's gonna get passed to our shaders.
266
+
263
267
// The color parameter is also used for styling non-curve objects such as text glyphs and hatches with solid color
constbooldifferentMainObject = currentMainObjectIdx != storedMainObjectIdx;// meaning current pixel's main object is different than what is already stored
// load from colorStorage only if we want to resolve color from texture instead of style
375
373
// sampling from colorStorage needs to happen in critical section because another fragment may also want to store into it at the same time + need to happen before store
376
-
if (resolve && !resolveColorFromStyle)
377
-
color = float32_t4(unpackR11G11B10_UNORM(colorStorage[fragCoord]), 1.0f);
378
-
379
-
if (resolve || localQuantizedAlpha > storedQuantizedAlpha)
if (toResolveStyleIdx == InvalidStyleIdx) // if style idx to resolve is invalid, then it means we should resolve from color
378
+
color = float32_t4(unpackR11G11B10_UNORM(colorStorage[fragCoord]), 1.0f);
379
+
}
380
+
381
+
// If current localAlpha is higher than what is already stored in pseudoStencil we will update the value in pseudoStencil or the color in colorStorage, this is equivalent to programmable blending MAX operation.
382
+
// OR If previous pixel has a different ID than current's (i.e. previous either empty/invalid or a differnet mainObject), we should update our alpha and color storages.
383
+
if (differentMainObject || localQuantizedAlpha > storedQuantizedAlpha)
// TODO[Przemek]: But make sure you're still calling this, correctly calculating alpha and texture color.
652
+
// you can add 1 main object and push via DrawResourcesFiller like we already do for other objects (this go in the mainObjects StorageBuffer) and then set the currentMainObjectIdx to 0 here
653
+
// having 1 main object temporarily means that all triangle meshes will be treated as a unified object in blending operations.
color = float32_t4(unpackR11G11B10_UNORM(colorStorage[fragCoord]), 1.0f);
31
+
// load from colorStorage only if we want to resolve color from texture instead of style
32
+
// sampling from colorStorage needs to happen in critical section because another fragment may also want to store into it at the same time + need to happen before store
// TODO[Przemek]: Disable Everything here and do your own thing as we already discussed, but let's have the same PSInput data passed to fragment.
91
+
// your programmable pulling will use the baseVertexBufferAddress BDA address and `vertexID` to RawBufferLoad it's vertex.
92
+
// ~~Later, most likely We will require pulling all 3 vertices of the triangle, that's where you need to know which triangle you're currently on, and instead of objectID = vertexID/4 which we currently do, you will do vertexID/3 and pull all 3 of it's vertices.~~
93
+
// Ok, brainfart, a vertex can belong to multiple triangles, I was thinking of AA but triangles share vertices, nevermind my comment above.
0 commit comments