From 706242f9cb39431a67f39490e80a59e81a2513b2 Mon Sep 17 00:00:00 2001 From: Greg Roth Date: Fri, 1 Nov 2024 16:14:21 -0600 Subject: [PATCH] correct typos, refine CheckAccessFullyMapped In response to Damyan's comments Corrected some mistaken syntax in buffer declarations. Revise the description of CheckAccessFullyMapped, giving it its own section that other parts refer to. correct sign of parameters to the subscript operator --- specs/language/resources.tex | 64 +++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/specs/language/resources.tex b/specs/language/resources.tex index 87baaa61..648ea214 100644 --- a/specs/language/resources.tex +++ b/specs/language/resources.tex @@ -36,7 +36,7 @@ void GetDimensions(out uint width) const; // Element access. - T operator[](uint pos) const; + T operator[](int pos) const; T Load(in int pos) const; T Load(in int pos, out uint status) const; }; @@ -50,7 +50,7 @@ RWBuffer operator=(RWBuffer buf); // element access - T &operator[](uint n); + T &operator[](int n); }; } \end{HLSL} @@ -81,8 +81,8 @@ Buffer grobuf; RWBuffer grwbuf; void main() { - Buffer lrobuf = grobuf; - RWBuffer lrwbuf = grwbuf; + Buffer lrobuf = grobuf; + RWBuffer lrwbuf = grwbuf; } \end{HLSL} Buffer operands to the assignment operator must have the same element type. @@ -103,7 +103,7 @@ \begin{HLSL} T Load(in int pos) const; - T operator[](uint pos) const; + T operator[](int pos) const; \end{HLSL} These each return the element at the given position \texttt{pos} of the type specified in the buffer definition. @@ -114,15 +114,15 @@ T Load(in int pos, out uint status) const; \end{HLSL} -The \texttt{status} parameter returns an indication of whether the value retrieved accessed a mapped tile -resource. This parameter is interpretted using the \texttt{CheckAccessFullyMapped} -built-in function. If tiled resources are enabled, it returns true if the value was accessed from a mapped -tile resource and false otherwise. If tiled resourced are not enabled, it will return true. +The \texttt{status} parameter returns an indication of whether all of the retrieved value +came from fully mapped parts of the resource. +This parameter must be passed to the built-in function \texttt{CheckAccessFullyMapped} (\ref{Resources.mapcheck}) +in order to interpret it. Writable buffers have an additional subscript operator that allows assignment to an element of the buffer. It behaves as if it returns a reference to that element. \begin{HLSL} - T &operator[](uint pos); + T &operator[](int pos); \end{HLSL} Partial writes aren't allowed. @@ -311,10 +311,10 @@ T Load(in uint byteOffset, out uint status) const; \end{HLSL} -The \texttt{status} parameter returns an indication of whether the value retrieved accessed a mapped tile -resource. This parameter is interpretted using the \texttt{CheckAccessFullyMapped} -built-in function. If tiled resources are enabled, it returns true if the value was accessed from a mapped -tile resource and false otherwise. If tiled resourced are not enabled, it will return true. +The \texttt{status} parameter returns an indication of whether all of the retrieved value +came from fully mapped parts of the resource. +This parameter must be passed to the built-in function \texttt{CheckAccessFullyMapped} (\ref{Resources.mapcheck}) +in order to interpret it. \Sub{Atomic Operations}{Resources.babufs.atomics} @@ -476,7 +476,7 @@ void GetDimensions(out uint count, out uint stride) const; // Element access. - T operator[](uint pos) const; + T operator[](int pos) const; T Load(in int pos) const; T Load(in int pos, out uint status) const; }; @@ -488,7 +488,7 @@ RWStructuredBuffer operator=(RWStructuredBuffer buf); // Element assignment. - T &operator[](uint pos); + T &operator[](int pos); // Hidden counter increment/decrement. uint IncrementCounter(); @@ -554,10 +554,10 @@ AppendStructuredBuffer gapbuf; ConsumeStructuredBuffer gcobuf; void main() { - StructuredBuffer lrobuf = grobuf; - RWStructuredBuffer lrwbuf = grwbuf; - AppendStructuredBuffer lbuf = gapbuf; - ConsumeStructuredBuffer lcobuf = gcobuf; + StructuredBuffer lrobuf = grobuf; + RWStructuredBuffer lrwbuf = grwbuf; + AppendStructuredBuffer lbuf = gapbuf; + ConsumeStructuredBuffer lcobuf = gcobuf; } \end{HLSL} Structured buffer operands to the assignment operator must have the same element type. @@ -579,7 +579,7 @@ \begin{HLSL} T Load(in int pos) const; - T operator[](uint pos) const; + T operator[](int pos) const; \end{HLSL} These each return the element at the given position \texttt{pos} of the type specified in the buffer definition. @@ -590,15 +590,15 @@ T Load(in int pos, out uint status) const; \end{HLSL} -The \texttt{status} parameter returns an indication of whether the value retrieved accessed a mapped tile -resource. This parameter is interpretted using the \texttt{CheckAccessFullyMapped} -built-in function. If tiled resources are enabled, it returns true if the value was accessed from a mapped -tile resource and false otherwise. If tiled resourced are not enabled, it will return true. +The \texttt{status} parameter returns an indication of whether all of the retrieved value +came from fully mapped parts of the resource. +This parameter must be passed to the built-in function \texttt{CheckAccessFullyMapped} (\ref{Resources.mapcheck}) +in order to interpret it. Writable RWStructuredBuffers have an additional subscript operator that allows assignment to a structure element of the buffer. It behaves as if it returns a reference to that element. \begin{HLSL} - T &operator[](uint pos); + T &operator[](int pos); \end{HLSL} \Sub{Counter Manipulation}{Resources.stbufs.counter} @@ -637,6 +637,18 @@ \Sec{Samplers}{Resources.samp} +\Sec{CheckAccessFullyMapped}{Resources.mapcheck} + +The mapped status value returned by certain texture and buffer methods can be intrepreted by a built-in function: + +\begin{HLSL} + bool CheckAccessFullyMapped(in uint status); +\end{HLSL} + +This function returns true is the value was accessed from a fully committed resource, +or from fully mapped pages of a sparse resource. +If any part of the return value was from unmapped memory, false is returned. + \Sec{Resource Binding}{Resources.binding} Resources are bound to external memory using virtual registers within logical registers spaces.