From 5c3161d1bece06c2d789eae8bd29833987da668c Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 11 Apr 2024 12:38:12 -0500 Subject: [PATCH 01/11] [Language] Begin Basic.types This begins drafting the Basic.types section which specifies the foundations of HLSL's data types. This includes some basic information about representations as well as the classifications of types and the basic behaviors of some types. --- specs/language/basic.tex | 92 +++++++++++++++++++++++++++++++++ specs/language/glossary.tex | 12 +++++ specs/language/placeholders.tex | 1 + 3 files changed, 105 insertions(+) diff --git a/specs/language/basic.tex b/specs/language/basic.tex index f34f80e2..d6cca97a 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -1,5 +1,97 @@ \Ch{Basic Concepts}{Basic} +\Sec{Types}{Basic.types} + +\p The \textit{object representation} of an object of type \texttt{T} is the +sequence of \textit{N} bytes taken up by the object of type \texttt{T}, where +\textit{N} equals \texttt{sizeof(T)}\footnote{\texttt{sizeof(T)}, returns the +size of an object of type \texttt{T} in bytes as stored in device memory. +The size may be different in other memory spaces and no operator exists to query +it.}. The \textit{object representation} of an object may be different based on +the \textit{memory space} it is stored in (\ref{Intro.Memory.Spaces}). + +\p The \textit{value representation} of an object is the set of bits that hold +the value of type \texttt{T}. + +\p An \textit{object type} \texttt{T} is an \textit{incomplete type} if the +compiler lacks sufficient information to determine the size of an object of type +\texttt{T}, and a \textit{complete type} if the compiler has sufficient +information to determine the size of an object of type \texttt{T}. An object may +not be defined to have an \textit{incomplete} type. + +\p A \textit{class type} is a data type declared with either the \texttt{class} +or \texttt{struct} keywords (\ref{Classes}). A class type \texttt{T} may be +declared as incomplete at one point in a translation unit via a \textit{forward +declaration}, and complete later with a full definition. The type \texttt{T} is +the same type throughout the translation unit. + +\p An \textit{object type} is a type that is not a function type, not a +reference type, and not a void type. + +\p Arithmetic types (\ref{Basic.types.arithmetic}), enumeration types, and +\textit{cv-qualified} versions of these types are collectively called +\textit{scalar types}. + +\p Vectors of scalar types declared with the built-in \texttt{vector} +template are \textit{vector types}. + +\p \textit{POD types}\footnote{POD is an initialism for Plain-Old-Data which is +referenced in the C++ specification but never expanded.} are POD class types, +scalar types, vector types, and arrays of such types. \textit{POD class types} +are class types that only contain members POD types. + +\Sub{Arithmetic Types}{Basic.types.arithmetic} + +\p There are three \textit{standard signed integer types}: \texttt{int16\_t}, +\texttt{int32\_t}, and \texttt{int64\_t}. Each of the signed integer types is +explicitly named for the size in bits of the type's object representation. There +is also the type alias \texttt{int} which is an alias of \texttt{int32\_t}. The +standard signed integer types are collectively called \textit{signed integer +types}. + +\p There are three \textit{standard unsigned integer types}: \texttt{uint16\_t}, +\texttt{uint32\_t}, and \texttt{uint64\_t}. Each of the unsigned integer types is +explicitly named for the size in bits of the type's object representation. There +is also the type alias \texttt{uint} which is an alias of \texttt{uint32\_t}. The +standard unsigned integer types are collectively called \textit{unsigned integer +types}\footnote{HLSL does not inherit C's default type rule, nor does it +inherit the \texttt{unsigned} keyword.}. + +\p The signed integer types and unsigned integer types are collectively called +\textit{integer types}. Integer types inherit the object representation of +integers defined in \glsdesc{isoC23}\footnote{C23 adopts two's compliment as the +object representation for integer types.}. Integer types shall satisfy the +constraints defined in \glsdesc{isoCPP}, section \textbf{basic.fundamental}. + +\p There are three \textit{floating point types}: \texttt{half}, \texttt{float}, +and \texttt{double}. The \texttt{float} type is a 32-bit floating point type. +The \texttt{double} type is a 64-bit floating point type. Both the +\texttt{float} and \texttt{double} types have object representations as defined +in \gls{IEEE754}. The \texttt{half} type may be either 16-bit or 32-bit as +controlled by implementation defined compiler settings. If \texttt{half} is +32-bit it will have an object representation as defined in \gls{IEEE754}, +otherwise it will have an object representation matching the \textbf{binary16} +format defined in \gls{IEEE754}\footnote{IEEE-754 only defines a binary encoding +for 16-bit floating point values, it does not fully specify the behavior of such +types.}. + +\p Integer and floating point types are collectively called \textit{arithmetic +types}. + +\p The \texttt{void} type is inherited from \gls{isoCPP}, which defines it as +having an empty set of values and being an incomplete type that can never be +completed. The \texttt{void} type is used to signify the return type of a +function that returns no value. Any expression can be explicitly converted to +\texttt{void}. + +\Sub{Special Classes}{Basic.types.special} + +\p A class type may be an \textit{ordinary class} or a \textit{special class}. +An ordinary class is a class type that contains no members of special class, +array of special class, or cv-qualified versions of these types. Special class +objects can only exist in thread memory: they cannot be stored to any other +memory space (\ref{Intro.Memory.Spaces}). + \Sec{Lvalues and rvalues}{Basic.lval} \p Expressions are classified by the type(s) of values they produce. The valid diff --git a/specs/language/glossary.tex b/specs/language/glossary.tex index f350b6ad..d999b0aa 100644 --- a/specs/language/glossary.tex +++ b/specs/language/glossary.tex @@ -30,12 +30,24 @@ description={ISO C standard} } +\newglossaryentry{isoC23} +{ + name={ISO/IEC 9899:2023}, + description={ISO C23 standard} +} + \newglossaryentry{isoCPP} { name={ISO/IEC 14882:2020}, description={ISO C++ standard} } +\newglossaryentry{IEEE754} +{ + name={IEEE Standard 754}, + description={IEEE Standard For Floating Point Arithmetic} +} + \newglossaryentry{sm} { name={Shader Model}, description={Versioned hardware description included as part of the DirectX specification, which is used for code generation to a diff --git a/specs/language/placeholders.tex b/specs/language/placeholders.tex index 3b8e2721..330a825f 100644 --- a/specs/language/placeholders.tex +++ b/specs/language/placeholders.tex @@ -2,5 +2,6 @@ \Sec{Function Definitions}{Decl.Function} \Sec{Attributes}{Decl.Attr} \Sub{Entry Attributes}{Decl.Attr.Entry} +\Ch{Classes}{Classes} \Ch{Overloading}{Overload} \Ch{Runtime}{Runtime} From 3a50ed747fa73cc0b5a40cd16d2066ae56c0ae6e Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Tue, 16 Apr 2024 21:51:03 -0500 Subject: [PATCH 02/11] Rework the POD and "special" types I'm coining a new term "intangible classes" which is vaguely similar to abstract classes except with less restrictions since you can create instances of them, you just can't store them. The later chapters will definitely need more work, but I think this gets the bare bones across. --- specs/language/basic.tex | 29 +++++++---------------- specs/language/classes.tex | 41 +++++++++++++++++++++++++++++++++ specs/language/expressions.tex | 3 ++- specs/language/hlsl.tex | 9 ++++---- specs/language/placeholders.tex | 6 ++++- 5 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 specs/language/classes.tex diff --git a/specs/language/basic.tex b/specs/language/basic.tex index d6cca97a..70b59cc6 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -4,14 +4,15 @@ \p The \textit{object representation} of an object of type \texttt{T} is the sequence of \textit{N} bytes taken up by the object of type \texttt{T}, where -\textit{N} equals \texttt{sizeof(T)}\footnote{\texttt{sizeof(T)}, returns the -size of an object of type \texttt{T} in bytes as stored in device memory. -The size may be different in other memory spaces and no operator exists to query -it.}. The \textit{object representation} of an object may be different based on -the \textit{memory space} it is stored in (\ref{Intro.Memory.Spaces}). +\textit{N} equals \texttt{sizeof(T)}\footnote{\texttt{sizeof(T)}eturns the size +of the struct as-if it's stored in device memory, and determining the size if +it's stored in another memory space is not possible.}. The \textit{object +representation} of an object may be different based on the \textit{memory space} +it is stored in (\ref{Intro.Memory.Spaces}). \p The \textit{value representation} of an object is the set of bits that hold -the value of type \texttt{T}. +the value of type \texttt{T}. Bits in the object representation that are not +part of the value representation are \textit{padding bits}. \p An \textit{object type} \texttt{T} is an \textit{incomplete type} if the compiler lacks sufficient information to determine the size of an object of type @@ -35,11 +36,6 @@ \p Vectors of scalar types declared with the built-in \texttt{vector} template are \textit{vector types}. -\p \textit{POD types}\footnote{POD is an initialism for Plain-Old-Data which is -referenced in the C++ specification but never expanded.} are POD class types, -scalar types, vector types, and arrays of such types. \textit{POD class types} -are class types that only contain members POD types. - \Sub{Arithmetic Types}{Basic.types.arithmetic} \p There are three \textit{standard signed integer types}: \texttt{int16\_t}, @@ -54,8 +50,7 @@ explicitly named for the size in bits of the type's object representation. There is also the type alias \texttt{uint} which is an alias of \texttt{uint32\_t}. The standard unsigned integer types are collectively called \textit{unsigned integer -types}\footnote{HLSL does not inherit C's default type rule, nor does it -inherit the \texttt{unsigned} keyword.}. +types}. \p The signed integer types and unsigned integer types are collectively called \textit{integer types}. Integer types inherit the object representation of @@ -84,14 +79,6 @@ function that returns no value. Any expression can be explicitly converted to \texttt{void}. -\Sub{Special Classes}{Basic.types.special} - -\p A class type may be an \textit{ordinary class} or a \textit{special class}. -An ordinary class is a class type that contains no members of special class, -array of special class, or cv-qualified versions of these types. Special class -objects can only exist in thread memory: they cannot be stored to any other -memory space (\ref{Intro.Memory.Spaces}). - \Sec{Lvalues and rvalues}{Basic.lval} \p Expressions are classified by the type(s) of values they produce. The valid diff --git a/specs/language/classes.tex b/specs/language/classes.tex new file mode 100644 index 00000000..bd31fbd1 --- /dev/null +++ b/specs/language/classes.tex @@ -0,0 +1,41 @@ +\Ch{Classes}{Classes} + +\begin{grammar} + \define{class-name}\br + identifier\br + simple-template-id\br + + \define{class-head}\br + class-key class-name-specifier \opt{base-clause}\br + class-key \opt{base-clause}\br + + \define{class-name-specifier}\br + \opt{nested-name-specifier} class-name\br + + \define{base-clause}\br + \terminal{:} class-name-specifier\br + + \define{class-key}\br + \terminal{class}\br + \terminal{struct} +\end{grammar} + +\Sec{Properties of classes}{Classes.properties} + +\p A \textit{simple-layout class} is a class that: +\begin{itemize} + \item has no non-static data members of type non-simple-layout class or array + of such types, and + \item has no non-simple-layout base classes. +\end{itemize} + +\Sec{Intangible classes}{Classes.Intangible} + +\p \textit{Intangible classes} allow for defining concepts and interfaces +without full concrete details. Intangible classes cannot be defined in user code +they are reserved for implementation-defined functionality. Intangible classes +have a wide variety of special behaviors, but they all share the common feature +that they cannot be stored outside thread memory (\ref{Intro.Memory.Spaces}). + +\p Intangible classes are not simple-layout classes, and transitively any class +containing an intangible class is not a simple-layout class. diff --git a/specs/language/expressions.tex b/specs/language/expressions.tex index 015464e9..f632d773 100644 --- a/specs/language/expressions.tex +++ b/specs/language/expressions.tex @@ -86,7 +86,7 @@ \href{https://github.com/microsoft/hlsl-specs/blob/main/proposals/0007-const-instance-methods.md} {HLSL Specs Proposal 0007} proposes adopting C++-like syntax and semantics for \textit{cv-qualified} \keyword{this} references.} - + \p A \keyword{this} expression shall not appear outside the declaration of a non-static member function. @@ -125,6 +125,7 @@ \begin{grammar} \define{qualified-id}\br nested-name-specifier \opt{\keyword{template}} unqualified-id\br + \define{nested-name-specifier}\br \terminal{::}\br type-name \terminal{::}\br diff --git a/specs/language/hlsl.tex b/specs/language/hlsl.tex index dcf0ba5f..aac0e70e 100644 --- a/specs/language/hlsl.tex +++ b/specs/language/hlsl.tex @@ -35,11 +35,11 @@ \newenvironment{note} {\begin{center} \begin{tabular}{|p{0.9\textwidth}|} - \hline\\ + \hline\\ } - { + { \\\\\hline - \end{tabular} + \end{tabular} \end{center} } @@ -77,7 +77,7 @@ \newcommand{\Par}[2]{\paragraph[#1]{#1\hfill[#2]\\}\label{#2}\p} \begin{document} -\input{macros} +\input{macros} \maketitle @@ -88,6 +88,7 @@ \input{basic} \input{conversions} \input{expressions} +\input{classes} \input{placeholders} % Declare placeholder references diff --git a/specs/language/placeholders.tex b/specs/language/placeholders.tex index 330a825f..6c19553f 100644 --- a/specs/language/placeholders.tex +++ b/specs/language/placeholders.tex @@ -1,7 +1,11 @@ \Ch{Declarations}{Decl} +\Sec{Specifiers}{Decl.Specifier} +\Sec{Type Specifiers}{Decl.Specifier.Type} +\Sec{Elaborated Type Specifiers}{Decl.Specifier.Type.Elab} \Sec{Function Definitions}{Decl.Function} \Sec{Attributes}{Decl.Attr} \Sub{Entry Attributes}{Decl.Attr.Entry} -\Ch{Classes}{Classes} +%\Ch{Classes}{Classes} - leaving this as a comment to instruct where Decl fits +%in the ordering of chapters. \Ch{Overloading}{Overload} \Ch{Runtime}{Runtime} From 12252f5c91f4d9b7495572cbc70f25182f23da9d Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 09:52:38 -0500 Subject: [PATCH 03/11] Trying this a different way. I think describing intangible types as the foundational bits (handles, min-precision values, etc) and walking up from there makes more sense. Then Resource types inherit being intangible. --- specs/language/basic.tex | 73 +++++++++++++++++++++++---------- specs/language/classes.tex | 41 ------------------ specs/language/hlsl.tex | 1 - specs/language/placeholders.tex | 6 +-- 4 files changed, 52 insertions(+), 69 deletions(-) delete mode 100644 specs/language/classes.tex diff --git a/specs/language/basic.tex b/specs/language/basic.tex index 70b59cc6..be283171 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -14,11 +14,8 @@ the value of type \texttt{T}. Bits in the object representation that are not part of the value representation are \textit{padding bits}. -\p An \textit{object type} \texttt{T} is an \textit{incomplete type} if the -compiler lacks sufficient information to determine the size of an object of type -\texttt{T}, and a \textit{complete type} if the compiler has sufficient -information to determine the size of an object of type \texttt{T}. An object may -not be defined to have an \textit{incomplete} type. +\p An \textit{object type} is a type that is not a function type, not a +reference type, and not a void type. \p A \textit{class type} is a data type declared with either the \texttt{class} or \texttt{struct} keywords (\ref{Classes}). A class type \texttt{T} may be @@ -26,8 +23,24 @@ declaration}, and complete later with a full definition. The type \texttt{T} is the same type throughout the translation unit. -\p An \textit{object type} is a type that is not a function type, not a -reference type, and not a void type. +\p There are two special implementation-defined types: \textit{handle types}, +and \textit{minimum precision types}. These types are collectively called +\textit{standard intangible types}. Intangible types are types that have no +defined object representation or value representation, as such the size is +unknown at compile time. +% Note: The above definition is likely incomplete, and it is unclear if minimum +% precision types should be intangible. + +\p A class type \texttt{T} is an \textit{intangible class type} if it contains +an base classes or members of intangible class type, standard intangible type, +or arrays of such types. Standard intangible types and intangible class types +are collectively called \textit{intangible types}. + +\p An object type is an \textit{incomplete type} if the +compiler lacks sufficient information to determine the size of an object of type +\texttt{T}, and a \textit{complete type} if the compiler has sufficient +information to determine the size of an object of type \texttt{T}. An object may +not be defined to have an \textit{incomplete} type. \p Arithmetic types (\ref{Basic.types.arithmetic}), enumeration types, and \textit{cv-qualified} versions of these types are collectively called @@ -41,16 +54,26 @@ \p There are three \textit{standard signed integer types}: \texttt{int16\_t}, \texttt{int32\_t}, and \texttt{int64\_t}. Each of the signed integer types is explicitly named for the size in bits of the type's object representation. There -is also the type alias \texttt{int} which is an alias of \texttt{int32\_t}. The -standard signed integer types are collectively called \textit{signed integer -types}. +is also the type alias \texttt{int} which is an alias of \texttt{int32\_t}. +There are three \textit{minimum precision signed integer types}: +\texttt{min10int}, \texttt{min12int}, and \texttt{min16int}. Each of the minimum +precision signed integer types are intangible types named for the required +minimum type size in bits. The object and value representations are +implementation defined, but shall not exceed the size of \texttt{int}. The +standard signed integer types and minimum precision signed integer types are +collectively called \textit{signed integer types}. \p There are three \textit{standard unsigned integer types}: \texttt{uint16\_t}, -\texttt{uint32\_t}, and \texttt{uint64\_t}. Each of the unsigned integer types is -explicitly named for the size in bits of the type's object representation. There -is also the type alias \texttt{uint} which is an alias of \texttt{uint32\_t}. The -standard unsigned integer types are collectively called \textit{unsigned integer -types}. +\texttt{uint32\_t}, and \texttt{uint64\_t}. Each of the unsigned integer types +is explicitly named for the size in bits of the type's object representation. +There is also the type alias \texttt{uint} which is an alias of +\texttt{uint32\_t}. There are three \textit{minimum precision unsigned integer +types}: \texttt{min10uint}, \texttt{min12uint}, and \texttt{min16uint}. Each of +the minimum precision unsigned integer types are intangible types named for the +required minimum type size in bits. The object and value representations are +implementation defined, but shall not exceed the size of \texttt{uint}. The +standard unsigned integer types and minimum precision unsigned integer types are +collectively called \textit{unsigned integer types}. \p The signed integer types and unsigned integer types are collectively called \textit{integer types}. Integer types inherit the object representation of @@ -58,17 +81,23 @@ object representation for integer types.}. Integer types shall satisfy the constraints defined in \glsdesc{isoCPP}, section \textbf{basic.fundamental}. -\p There are three \textit{floating point types}: \texttt{half}, \texttt{float}, -and \texttt{double}. The \texttt{float} type is a 32-bit floating point type. -The \texttt{double} type is a 64-bit floating point type. Both the -\texttt{float} and \texttt{double} types have object representations as defined -in \gls{IEEE754}. The \texttt{half} type may be either 16-bit or 32-bit as -controlled by implementation defined compiler settings. If \texttt{half} is +\p There are three \textit{standard floating point types}: \texttt{half}, +\texttt{float}, and \texttt{double}. The \texttt{float} type is a 32-bit +floating point type. The \texttt{double} type is a 64-bit floating point type. +Both the \texttt{float} and \texttt{double} types have object representations as +defined in \gls{IEEE754}. The \texttt{half} type may be either 16-bit or 32-bit +as controlled by implementation defined compiler settings. If \texttt{half} is 32-bit it will have an object representation as defined in \gls{IEEE754}, otherwise it will have an object representation matching the \textbf{binary16} format defined in \gls{IEEE754}\footnote{IEEE-754 only defines a binary encoding for 16-bit floating point values, it does not fully specify the behavior of such -types.}. +types.}. There are three \textit{minimum precision floating point types}: +\texttt{min10float}, \texttt{min12float}, and \texttt{min16float}. Each of the +minimum precision floating point types are intangible types named for the +required minimum size in bits. The object and value representations are +implementation defined, but shall not exceed the size of \texttt{float}. The +standard floating point types and minimum precision floating point types are +collectively called \textit{floating point types}. \p Integer and floating point types are collectively called \textit{arithmetic types}. diff --git a/specs/language/classes.tex b/specs/language/classes.tex deleted file mode 100644 index bd31fbd1..00000000 --- a/specs/language/classes.tex +++ /dev/null @@ -1,41 +0,0 @@ -\Ch{Classes}{Classes} - -\begin{grammar} - \define{class-name}\br - identifier\br - simple-template-id\br - - \define{class-head}\br - class-key class-name-specifier \opt{base-clause}\br - class-key \opt{base-clause}\br - - \define{class-name-specifier}\br - \opt{nested-name-specifier} class-name\br - - \define{base-clause}\br - \terminal{:} class-name-specifier\br - - \define{class-key}\br - \terminal{class}\br - \terminal{struct} -\end{grammar} - -\Sec{Properties of classes}{Classes.properties} - -\p A \textit{simple-layout class} is a class that: -\begin{itemize} - \item has no non-static data members of type non-simple-layout class or array - of such types, and - \item has no non-simple-layout base classes. -\end{itemize} - -\Sec{Intangible classes}{Classes.Intangible} - -\p \textit{Intangible classes} allow for defining concepts and interfaces -without full concrete details. Intangible classes cannot be defined in user code -they are reserved for implementation-defined functionality. Intangible classes -have a wide variety of special behaviors, but they all share the common feature -that they cannot be stored outside thread memory (\ref{Intro.Memory.Spaces}). - -\p Intangible classes are not simple-layout classes, and transitively any class -containing an intangible class is not a simple-layout class. diff --git a/specs/language/hlsl.tex b/specs/language/hlsl.tex index aac0e70e..31a5e7fa 100644 --- a/specs/language/hlsl.tex +++ b/specs/language/hlsl.tex @@ -88,7 +88,6 @@ \input{basic} \input{conversions} \input{expressions} -\input{classes} \input{placeholders} % Declare placeholder references diff --git a/specs/language/placeholders.tex b/specs/language/placeholders.tex index 6c19553f..330a825f 100644 --- a/specs/language/placeholders.tex +++ b/specs/language/placeholders.tex @@ -1,11 +1,7 @@ \Ch{Declarations}{Decl} -\Sec{Specifiers}{Decl.Specifier} -\Sec{Type Specifiers}{Decl.Specifier.Type} -\Sec{Elaborated Type Specifiers}{Decl.Specifier.Type.Elab} \Sec{Function Definitions}{Decl.Function} \Sec{Attributes}{Decl.Attr} \Sub{Entry Attributes}{Decl.Attr.Entry} -%\Ch{Classes}{Classes} - leaving this as a comment to instruct where Decl fits -%in the ordering of chapters. +\Ch{Classes}{Classes} \Ch{Overloading}{Overload} \Ch{Runtime}{Runtime} From 69f2a345c1028804cb6e5cafbf5e0e8f9be620ab Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 09:55:02 -0500 Subject: [PATCH 04/11] Revert whitespace only change (this actually fixes formatting, but I'll put it in separately). --- specs/language/expressions.tex | 1 - 1 file changed, 1 deletion(-) diff --git a/specs/language/expressions.tex b/specs/language/expressions.tex index f632d773..487f9cad 100644 --- a/specs/language/expressions.tex +++ b/specs/language/expressions.tex @@ -125,7 +125,6 @@ \begin{grammar} \define{qualified-id}\br nested-name-specifier \opt{\keyword{template}} unqualified-id\br - \define{nested-name-specifier}\br \terminal{::}\br type-name \terminal{::}\br From 31f1754efdc7703d3543bcca6941539e6f75b202 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 09:58:24 -0500 Subject: [PATCH 05/11] Fully revert whitespace change --- specs/language/expressions.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/language/expressions.tex b/specs/language/expressions.tex index 487f9cad..015464e9 100644 --- a/specs/language/expressions.tex +++ b/specs/language/expressions.tex @@ -86,7 +86,7 @@ \href{https://github.com/microsoft/hlsl-specs/blob/main/proposals/0007-const-instance-methods.md} {HLSL Specs Proposal 0007} proposes adopting C++-like syntax and semantics for \textit{cv-qualified} \keyword{this} references.} - + \p A \keyword{this} expression shall not appear outside the declaration of a non-static member function. From e9c1eed9b66af87635f8e93de5eff0e80abde02c Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 09:59:02 -0500 Subject: [PATCH 06/11] More whitespace to revert --- specs/language/hlsl.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/specs/language/hlsl.tex b/specs/language/hlsl.tex index 31a5e7fa..dcf0ba5f 100644 --- a/specs/language/hlsl.tex +++ b/specs/language/hlsl.tex @@ -35,11 +35,11 @@ \newenvironment{note} {\begin{center} \begin{tabular}{|p{0.9\textwidth}|} - \hline\\ + \hline\\ } - { + { \\\\\hline - \end{tabular} + \end{tabular} \end{center} } @@ -77,7 +77,7 @@ \newcommand{\Par}[2]{\paragraph[#1]{#1\hfill[#2]\\}\label{#2}\p} \begin{document} -\input{macros} +\input{macros} \maketitle From 2259544ac882627839c62a1399325c3d0e95972f Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 12:10:13 -0500 Subject: [PATCH 07/11] Updating language for min precision type representations --- specs/language/basic.tex | 49 ++++++++++++++++----------------- specs/language/classes.tex | 30 ++++++++++++++++++++ specs/language/placeholders.tex | 1 + 3 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 specs/language/classes.tex diff --git a/specs/language/basic.tex b/specs/language/basic.tex index be283171..d46837e1 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -23,24 +23,23 @@ declaration}, and complete later with a full definition. The type \texttt{T} is the same type throughout the translation unit. -\p There are two special implementation-defined types: \textit{handle types}, -and \textit{minimum precision types}. These types are collectively called -\textit{standard intangible types}. Intangible types are types that have no -defined object representation or value representation, as such the size is -unknown at compile time. +\p There are special implementation-defined types such as \textit{handle types}, +which fall into a category of \textit{standard intangible types}. Intangible +types are types that have no defined object representation or value +representation, as such the size is unknown at compile time. % Note: The above definition is likely incomplete, and it is unclear if minimum % precision types should be intangible. \p A class type \texttt{T} is an \textit{intangible class type} if it contains an base classes or members of intangible class type, standard intangible type, or arrays of such types. Standard intangible types and intangible class types -are collectively called \textit{intangible types}. +are collectively called \textit{intangible types}(\ref{Intangible}). -\p An object type is an \textit{incomplete type} if the -compiler lacks sufficient information to determine the size of an object of type -\texttt{T}, and a \textit{complete type} if the compiler has sufficient -information to determine the size of an object of type \texttt{T}. An object may -not be defined to have an \textit{incomplete} type. +\p An object type is an \textit{incomplete type} if the compiler lacks +sufficient information to determine the size of an object of type \texttt{T}, +and a \textit{complete type} if the compiler has sufficient information to +determine the size of an object of type \texttt{T}. An object may not be defined +to have an \textit{incomplete} type. \p Arithmetic types (\ref{Basic.types.arithmetic}), enumeration types, and \textit{cv-qualified} versions of these types are collectively called @@ -57,11 +56,10 @@ is also the type alias \texttt{int} which is an alias of \texttt{int32\_t}. There are three \textit{minimum precision signed integer types}: \texttt{min10int}, \texttt{min12int}, and \texttt{min16int}. Each of the minimum -precision signed integer types are intangible types named for the required -minimum type size in bits. The object and value representations are -implementation defined, but shall not exceed the size of \texttt{int}. The -standard signed integer types and minimum precision signed integer types are -collectively called \textit{signed integer types}. +precision signed integer types are named for the required minimum value +representation size in bits. The object representation of all minimum precision +types is \texttt{int}. The standard signed integer types and minimum precision +signed integer types are collectively called \textit{signed integer types}. \p There are three \textit{standard unsigned integer types}: \texttt{uint16\_t}, \texttt{uint32\_t}, and \texttt{uint64\_t}. Each of the unsigned integer types @@ -69,11 +67,11 @@ There is also the type alias \texttt{uint} which is an alias of \texttt{uint32\_t}. There are three \textit{minimum precision unsigned integer types}: \texttt{min10uint}, \texttt{min12uint}, and \texttt{min16uint}. Each of -the minimum precision unsigned integer types are intangible types named for the -required minimum type size in bits. The object and value representations are -implementation defined, but shall not exceed the size of \texttt{uint}. The -standard unsigned integer types and minimum precision unsigned integer types are -collectively called \textit{unsigned integer types}. +the minimum precision unsigned integer types are named for the required minimum +value representation size in bits. The object representation of all minimum +precision types is \texttt{uint}. The standard unsigned integer types and +minimum precision unsigned integer types are collectively called +\textit{unsigned integer types}. \p The signed integer types and unsigned integer types are collectively called \textit{integer types}. Integer types inherit the object representation of @@ -93,10 +91,11 @@ for 16-bit floating point values, it does not fully specify the behavior of such types.}. There are three \textit{minimum precision floating point types}: \texttt{min10float}, \texttt{min12float}, and \texttt{min16float}. Each of the -minimum precision floating point types are intangible types named for the -required minimum size in bits. The object and value representations are -implementation defined, but shall not exceed the size of \texttt{float}. The -standard floating point types and minimum precision floating point types are +minimum precision floating point types are named for the required minimum value +representation size in bits. The object representation of all minimum precision +types is \texttt{float}\footnote{This means when stored to memory minimum +precision types are stored as \textbf{binary32} as defined in \gls{IEEE754}.}. +The standard floating point types and minimum precision floating point types are collectively called \textit{floating point types}. \p Integer and floating point types are collectively called \textit{arithmetic diff --git a/specs/language/classes.tex b/specs/language/classes.tex new file mode 100644 index 00000000..de199a82 --- /dev/null +++ b/specs/language/classes.tex @@ -0,0 +1,30 @@ +\Ch{Classes}{Classes} + +\begin{grammar} + \define{class-name}\br + identifier\br + simple-template-id\br + + \define{class-head}\br + class-key class-name-specifier \opt{base-clause}\br + class-key \opt{base-clause}\br + + \define{class-name-specifier}\br + \opt{nested-name-specifier} class-name\br + + \define{base-clause}\br + \terminal{:} class-name-specifier\br + + \define{class-key}\br + \terminal{class}\br + \terminal{struct} +\end{grammar} + +\Sec{Properties of classes}{Classes.properties} + +\p A \textit{simple-layout class} is a class that: +\begin{itemize} + \item has no non-static data members of type non-simple-layout class or array + of such types, and + \item has no non-simple-layout base classes. +\end{itemize} diff --git a/specs/language/placeholders.tex b/specs/language/placeholders.tex index 330a825f..19423415 100644 --- a/specs/language/placeholders.tex +++ b/specs/language/placeholders.tex @@ -4,4 +4,5 @@ \Sub{Entry Attributes}{Decl.Attr.Entry} \Ch{Classes}{Classes} \Ch{Overloading}{Overload} +\Ch{Intangible Types}{Intangible} \Ch{Runtime}{Runtime} From 036d2605a43c5fcb491ed0d3a406f38fa0dc9875 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 12:22:17 -0500 Subject: [PATCH 08/11] Fixing a bit around complete, incomplete and intangible types --- specs/language/basic.tex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/specs/language/basic.tex b/specs/language/basic.tex index d46837e1..2132cf46 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -37,9 +37,10 @@ \p An object type is an \textit{incomplete type} if the compiler lacks sufficient information to determine the size of an object of type \texttt{T}, -and a \textit{complete type} if the compiler has sufficient information to -determine the size of an object of type \texttt{T}. An object may not be defined -to have an \textit{incomplete} type. +and it is not an intangible type. It is a \textit{complete type} if the compiler +has sufficient information to determine the size of an object of type +\texttt{T}, or if the type is known to be an intangible type. An object may not +be defined to have an \textit{incomplete} type. \p Arithmetic types (\ref{Basic.types.arithmetic}), enumeration types, and \textit{cv-qualified} versions of these types are collectively called From 4d360e3d3238fabba620dfb65cfdba6fdcb2625c Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 12:23:22 -0500 Subject: [PATCH 09/11] Fixing spelling typo (Thanks @coopp) --- specs/language/basic.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specs/language/basic.tex b/specs/language/basic.tex index 2132cf46..d673936e 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -4,9 +4,9 @@ \p The \textit{object representation} of an object of type \texttt{T} is the sequence of \textit{N} bytes taken up by the object of type \texttt{T}, where -\textit{N} equals \texttt{sizeof(T)}\footnote{\texttt{sizeof(T)}eturns the size -of the struct as-if it's stored in device memory, and determining the size if -it's stored in another memory space is not possible.}. The \textit{object +\textit{N} equals \texttt{sizeof(T)}\footnote{\texttt{sizeof(T)} returns the +size of the object as-if it's stored in device memory, and determining the size +if it's stored in another memory space is not possible.}. The \textit{object representation} of an object may be different based on the \textit{memory space} it is stored in (\ref{Intro.Memory.Spaces}). From a8390306e27cf33e3fed79e65da78b81dc88ce9a Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 16:47:46 -0500 Subject: [PATCH 10/11] Remove classes.tex (again) --- specs/language/classes.tex | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 specs/language/classes.tex diff --git a/specs/language/classes.tex b/specs/language/classes.tex deleted file mode 100644 index de199a82..00000000 --- a/specs/language/classes.tex +++ /dev/null @@ -1,30 +0,0 @@ -\Ch{Classes}{Classes} - -\begin{grammar} - \define{class-name}\br - identifier\br - simple-template-id\br - - \define{class-head}\br - class-key class-name-specifier \opt{base-clause}\br - class-key \opt{base-clause}\br - - \define{class-name-specifier}\br - \opt{nested-name-specifier} class-name\br - - \define{base-clause}\br - \terminal{:} class-name-specifier\br - - \define{class-key}\br - \terminal{class}\br - \terminal{struct} -\end{grammar} - -\Sec{Properties of classes}{Classes.properties} - -\p A \textit{simple-layout class} is a class that: -\begin{itemize} - \item has no non-static data members of type non-simple-layout class or array - of such types, and - \item has no non-simple-layout base classes. -\end{itemize} From 6db247723972bd062683d7857fe965488ffc7189 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 17 Apr 2024 16:56:42 -0500 Subject: [PATCH 11/11] Add vector size limitation to spec --- specs/language/basic.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/language/basic.tex b/specs/language/basic.tex index d673936e..565243c0 100644 --- a/specs/language/basic.tex +++ b/specs/language/basic.tex @@ -47,7 +47,8 @@ \textit{scalar types}. \p Vectors of scalar types declared with the built-in \texttt{vector} -template are \textit{vector types}. +template are \textit{vector types}. Vector lengths must be between 1 and 4 (i.e. +\( 1 \leq N \leq 4 \) ). \Sub{Arithmetic Types}{Basic.types.arithmetic}