Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
angle
Commits
2b538b85
Commit
2b538b85
authored
Aug 30, 2013
by
Jamie Madill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename some constants in BlockLayoutEncoder for clarity.
TRAC #23748 Signed-off-by: Geoff Lang Signed-off-by: Nicolas Capens
parent
c2141fb3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
BlockLayoutEncoder.cpp
src/compiler/BlockLayoutEncoder.cpp
+11
-11
BlockLayoutEncoder.h
src/compiler/BlockLayoutEncoder.h
+3
-3
HLSLLayoutEncoder.cpp
src/compiler/HLSLLayoutEncoder.cpp
+7
-7
No files found.
src/compiler/BlockLayoutEncoder.cpp
View file @
2b538b85
...
@@ -50,7 +50,7 @@ void BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &fi
...
@@ -50,7 +50,7 @@ void BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &fi
ASSERT
(
field
.
fields
.
empty
());
ASSERT
(
field
.
fields
.
empty
());
getBlockLayoutInfo
(
field
.
type
,
field
.
arraySize
,
field
.
isRowMajorMatrix
,
&
arrayStride
,
&
matrixStride
);
getBlockLayoutInfo
(
field
.
type
,
field
.
arraySize
,
field
.
isRowMajorMatrix
,
&
arrayStride
,
&
matrixStride
);
const
BlockMemberInfo
memberInfo
(
mCurrentOffset
*
ComponentSize
,
arrayStride
*
ComponentSize
,
matrixStride
*
ComponentSize
,
field
.
isRowMajorMatrix
);
const
BlockMemberInfo
memberInfo
(
mCurrentOffset
*
BytesPerComponent
,
arrayStride
*
BytesPerComponent
,
matrixStride
*
BytesPerComponent
,
field
.
isRowMajorMatrix
);
if
(
mBlockInfoOut
)
if
(
mBlockInfoOut
)
{
{
...
@@ -67,7 +67,7 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
...
@@ -67,7 +67,7 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
getBlockLayoutInfo
(
type
,
arraySize
,
isRowMajorMatrix
,
&
arrayStride
,
&
matrixStride
);
getBlockLayoutInfo
(
type
,
arraySize
,
isRowMajorMatrix
,
&
arrayStride
,
&
matrixStride
);
const
BlockMemberInfo
memberInfo
(
mCurrentOffset
*
ComponentSize
,
arrayStride
*
ComponentSize
,
matrixStride
*
ComponentSize
,
isRowMajorMatrix
);
const
BlockMemberInfo
memberInfo
(
mCurrentOffset
*
BytesPerComponent
,
arrayStride
*
BytesPerComponent
,
matrixStride
*
BytesPerComponent
,
isRowMajorMatrix
);
if
(
mBlockInfoOut
)
if
(
mBlockInfoOut
)
{
{
...
@@ -79,7 +79,7 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
...
@@ -79,7 +79,7 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is
void
BlockLayoutEncoder
::
nextRegister
()
void
BlockLayoutEncoder
::
nextRegister
()
{
{
mCurrentOffset
=
rx
::
roundUp
(
mCurrentOffset
,
RegisterSize
);
mCurrentOffset
=
rx
::
roundUp
(
mCurrentOffset
,
ComponentsPerRegister
);
}
}
Std140BlockEncoder
::
Std140BlockEncoder
(
std
::
vector
<
BlockMemberInfo
>
*
blockInfoOut
)
Std140BlockEncoder
::
Std140BlockEncoder
(
std
::
vector
<
BlockMemberInfo
>
*
blockInfoOut
)
...
@@ -100,7 +100,7 @@ void Std140BlockEncoder::exitAggregateType()
...
@@ -100,7 +100,7 @@ void Std140BlockEncoder::exitAggregateType()
void
Std140BlockEncoder
::
getBlockLayoutInfo
(
GLenum
type
,
unsigned
int
arraySize
,
bool
isRowMajorMatrix
,
int
*
arrayStrideOut
,
int
*
matrixStrideOut
)
void
Std140BlockEncoder
::
getBlockLayoutInfo
(
GLenum
type
,
unsigned
int
arraySize
,
bool
isRowMajorMatrix
,
int
*
arrayStrideOut
,
int
*
matrixStrideOut
)
{
{
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
ASSERT
(
gl
::
UniformComponentSize
(
gl
::
UniformComponentType
(
type
))
==
ComponentSize
);
ASSERT
(
gl
::
UniformComponentSize
(
gl
::
UniformComponentType
(
type
))
==
BytesPerComponent
);
int
numComponents
=
gl
::
UniformComponentCount
(
type
);
int
numComponents
=
gl
::
UniformComponentCount
(
type
);
size_t
baseAlignment
=
0
;
size_t
baseAlignment
=
0
;
...
@@ -109,19 +109,19 @@ void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize,
...
@@ -109,19 +109,19 @@ void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize,
if
(
gl
::
IsMatrixType
(
type
))
if
(
gl
::
IsMatrixType
(
type
))
{
{
baseAlignment
=
RegisterSize
;
baseAlignment
=
ComponentsPerRegister
;
matrixStride
=
RegisterSize
;
matrixStride
=
ComponentsPerRegister
;
if
(
arraySize
>
0
)
if
(
arraySize
>
0
)
{
{
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
arrayStride
=
RegisterSize
*
numRegisters
;
arrayStride
=
ComponentsPerRegister
*
numRegisters
;
}
}
}
}
else
if
(
arraySize
>
0
)
else
if
(
arraySize
>
0
)
{
{
baseAlignment
=
RegisterSize
;
baseAlignment
=
ComponentsPerRegister
;
arrayStride
=
RegisterSize
;
arrayStride
=
ComponentsPerRegister
;
}
}
else
else
{
{
...
@@ -143,9 +143,9 @@ void Std140BlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool
...
@@ -143,9 +143,9 @@ void Std140BlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool
}
}
else
if
(
gl
::
IsMatrixType
(
type
))
else
if
(
gl
::
IsMatrixType
(
type
))
{
{
ASSERT
(
matrixStride
==
RegisterSize
);
ASSERT
(
matrixStride
==
ComponentsPerRegister
);
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
mCurrentOffset
+=
RegisterSize
*
numRegisters
;
mCurrentOffset
+=
ComponentsPerRegister
*
numRegisters
;
}
}
else
else
{
{
...
...
src/compiler/BlockLayoutEncoder.h
View file @
2b538b85
...
@@ -27,10 +27,10 @@ class BlockLayoutEncoder
...
@@ -27,10 +27,10 @@ class BlockLayoutEncoder
void
encodeInterfaceBlockFields
(
const
std
::
vector
<
InterfaceBlockField
>
&
fields
);
void
encodeInterfaceBlockFields
(
const
std
::
vector
<
InterfaceBlockField
>
&
fields
);
void
encodeInterfaceBlockField
(
const
InterfaceBlockField
&
field
);
void
encodeInterfaceBlockField
(
const
InterfaceBlockField
&
field
);
void
encodeType
(
GLenum
type
,
unsigned
int
arraySize
,
bool
isRowMajorMatrix
);
void
encodeType
(
GLenum
type
,
unsigned
int
arraySize
,
bool
isRowMajorMatrix
);
size_t
getBlockSize
()
{
return
mCurrentOffset
*
ComponentSize
;
}
size_t
getBlockSize
()
{
return
mCurrentOffset
*
BytesPerComponent
;
}
static
const
size_t
ComponentSize
=
4u
;
static
const
size_t
BytesPerComponent
=
4u
;
static
const
unsigned
int
RegisterSize
=
4u
;
static
const
unsigned
int
ComponentsPerRegister
=
4u
;
protected
:
protected
:
size_t
mCurrentOffset
;
size_t
mCurrentOffset
;
...
...
src/compiler/HLSLLayoutEncoder.cpp
View file @
2b538b85
...
@@ -29,7 +29,7 @@ void HLSLBlockEncoder::exitAggregateType()
...
@@ -29,7 +29,7 @@ void HLSLBlockEncoder::exitAggregateType()
void
HLSLBlockEncoder
::
getBlockLayoutInfo
(
GLenum
type
,
unsigned
int
arraySize
,
bool
isRowMajorMatrix
,
int
*
arrayStrideOut
,
int
*
matrixStrideOut
)
void
HLSLBlockEncoder
::
getBlockLayoutInfo
(
GLenum
type
,
unsigned
int
arraySize
,
bool
isRowMajorMatrix
,
int
*
arrayStrideOut
,
int
*
matrixStrideOut
)
{
{
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
// We assume we are only dealing with 4 byte components (no doubles or half-words currently)
ASSERT
(
gl
::
UniformComponentSize
(
gl
::
UniformComponentType
(
type
))
==
ComponentSize
);
ASSERT
(
gl
::
UniformComponentSize
(
gl
::
UniformComponentType
(
type
))
==
BytesPerComponent
);
int
matrixStride
=
0
;
int
matrixStride
=
0
;
int
arrayStride
=
0
;
int
arrayStride
=
0
;
...
@@ -37,23 +37,23 @@ void HLSLBlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, b
...
@@ -37,23 +37,23 @@ void HLSLBlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, b
if
(
gl
::
IsMatrixType
(
type
))
if
(
gl
::
IsMatrixType
(
type
))
{
{
nextRegister
();
nextRegister
();
matrixStride
=
RegisterSize
;
matrixStride
=
ComponentsPerRegister
;
if
(
arraySize
>
0
)
if
(
arraySize
>
0
)
{
{
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
arrayStride
=
RegisterSize
*
numRegisters
;
arrayStride
=
ComponentsPerRegister
*
numRegisters
;
}
}
}
}
else
if
(
arraySize
>
0
)
else
if
(
arraySize
>
0
)
{
{
nextRegister
();
nextRegister
();
arrayStride
=
RegisterSize
;
arrayStride
=
ComponentsPerRegister
;
}
}
else
else
{
{
int
numComponents
=
gl
::
UniformComponentCount
(
type
);
int
numComponents
=
gl
::
UniformComponentCount
(
type
);
if
((
numComponents
+
(
mCurrentOffset
%
RegisterSize
))
>
RegisterSize
)
if
((
numComponents
+
(
mCurrentOffset
%
ComponentsPerRegister
))
>
ComponentsPerRegister
)
{
{
nextRegister
();
nextRegister
();
}
}
...
@@ -72,10 +72,10 @@ void HLSLBlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool i
...
@@ -72,10 +72,10 @@ void HLSLBlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool i
if
(
gl
::
IsMatrixType
(
type
))
if
(
gl
::
IsMatrixType
(
type
))
{
{
ASSERT
(
matrixStride
==
RegisterSize
);
ASSERT
(
matrixStride
==
ComponentsPerRegister
);
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
const
int
numRegisters
=
gl
::
MatrixRegisterCount
(
type
,
isRowMajorMatrix
);
const
int
numComponents
=
gl
::
MatrixComponentCount
(
type
,
isRowMajorMatrix
);
const
int
numComponents
=
gl
::
MatrixComponentCount
(
type
,
isRowMajorMatrix
);
mCurrentOffset
+=
RegisterSize
*
(
numRegisters
-
1
);
mCurrentOffset
+=
ComponentsPerRegister
*
(
numRegisters
-
1
);
mCurrentOffset
+=
numComponents
;
mCurrentOffset
+=
numComponents
;
}
}
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment