Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
7c1e4a1d
Commit
7c1e4a1d
authored
5 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
VBO opt
parent
31227922
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcommon/llstrider.h
+29
-2
29 additions, 2 deletions
indra/llcommon/llstrider.h
indra/llrender/llvertexbuffer.cpp
+31
-24
31 additions, 24 deletions
indra/llrender/llvertexbuffer.cpp
with
60 additions
and
26 deletions
indra/llcommon/llstrider.h
+
29
−
2
View file @
7c1e4a1d
...
...
@@ -26,7 +26,19 @@
#ifndef LL_LLSTRIDER_H
#define LL_LLSTRIDER_H
#include
"stdtypes.h"
#include
"llmath.h"
#include
"llvector4a.h"
template
<
typename
T
>
inline
void
copyArray
(
T
*
dst
,
const
T
*
src
,
const
U32
bytes
)
{
memcpy
(
dst
,
src
,
bytes
);
}
template
<
>
inline
void
copyArray
<>
(
LLVector4a
*
dst
,
const
LLVector4a
*
src
,
const
U32
bytes
)
{
LLVector4a
::
memcpyNonAliased16
(
dst
->
getF32ptr
(),
src
->
getF32ptr
(),
bytes
);
}
template
<
class
Object
>
class
LLStrider
{
...
...
@@ -39,7 +51,7 @@ template <class Object> class LLStrider
public
:
LLStrider
()
{
mObjectp
=
NULL
;
mSkip
=
sizeof
(
Object
);
}
~
LLStrider
()
{
}
~
LLStrider
()
=
default
;
const
LLStrider
<
Object
>&
operator
=
(
Object
*
first
)
{
mObjectp
=
first
;
return
*
this
;}
void
setStride
(
S32
skipBytes
)
{
mSkip
=
(
skipBytes
?
skipBytes
:
sizeof
(
Object
));}
...
...
@@ -62,6 +74,21 @@ template <class Object> class LLStrider
Object
*
operator
+=
(
int
i
)
{
mBytep
+=
mSkip
*
i
;
return
mObjectp
;
}
Object
&
operator
[](
U32
index
)
{
return
*
(
Object
*
)(
mBytep
+
(
mSkip
*
index
));
}
void
copyArray
(
const
U32
offset
,
const
Object
*
src
,
const
U32
length
)
{
if
(
mSkip
==
sizeof
(
Object
))
{
::
copyArray
(
mObjectp
+
offset
,
src
,
length
*
sizeof
(
Object
));
}
else
{
for
(
U32
i
=
0
;
i
<
length
;
i
++
)
{
(
*
this
)[
offset
+
i
]
=
src
[
i
];
}
}
}
};
#endif // LL_LLSTRIDER_H
This diff is collapsed.
Click to expand it.
indra/llrender/llvertexbuffer.cpp
+
31
−
24
View file @
7c1e4a1d
...
...
@@ -2097,34 +2097,21 @@ void LLVertexBuffer::unmapBuffer()
//----------------------------------------------------------------------------
template
<
class
T
,
S32
type
>
struct
VertexBufferStrider
template
<
class
T
,
S32
type
>
struct
VertexBufferStrider
{
typedef
LLStrider
<
T
>
strider_t
;
static
bool
get
(
LLVertexBuffer
&
vbo
,
strider_t
&
strider
,
S32
index
,
S32
count
,
bool
map_range
)
static
bool
get
(
LLVertexBuffer
&
vbo
,
strider_t
&
strider
,
S32
index
,
S32
count
,
bool
map_range
)
{
if
(
type
==
LLVertexBuffer
::
TYPE_INDEX
)
{
volatile
U8
*
ptr
=
vbo
.
mapIndexBuffer
(
index
,
count
,
map_range
);
if
(
ptr
==
NULL
)
{
LL_WARNS
()
<<
"mapIndexBuffer failed!"
<<
LL_ENDL
;
return
false
;
}
strider
=
(
T
*
)
ptr
;
strider
.
setStride
(
0
);
return
true
;
}
else
if
(
vbo
.
hasDataType
(
type
))
if
(
vbo
.
hasDataType
(
type
))
{
S32
stride
=
LLVertexBuffer
::
sTypeSize
[
type
];
volatile
U8
*
ptr
=
vbo
.
mapVertexBuffer
(
type
,
index
,
count
,
map_range
);
if
(
ptr
==
NULL
)
if
(
ptr
==
nullptr
)
{
LL_WARNS
()
<<
"mapVertexBuffer failed!"
<<
LL_ENDL
;
return
false
;
...
...
@@ -2142,6 +2129,28 @@ template <class T,S32 type> struct VertexBufferStrider
}
};
template
<
class
T
>
struct
VertexBufferStrider
<
T
,
LLVertexBuffer
::
TYPE_INDEX
>
{
typedef
LLStrider
<
T
>
strider_t
;
static
bool
get
(
LLVertexBuffer
&
vbo
,
strider_t
&
strider
,
S32
index
,
S32
count
,
bool
map_range
)
{
volatile
U8
*
ptr
=
vbo
.
mapIndexBuffer
(
index
,
count
,
map_range
);
if
(
ptr
==
nullptr
)
{
LL_WARNS
()
<<
"mapIndexBuffer failed!"
<<
LL_ENDL
;
return
false
;
}
strider
=
(
T
*
)
ptr
;
strider
.
setStride
(
0
);
return
true
;
}
};
bool
LLVertexBuffer
::
getVertexStrider
(
LLStrider
<
LLVector3
>&
strider
,
S32
index
,
S32
count
,
bool
map_range
)
{
return
VertexBufferStrider
<
LLVector3
,
TYPE_VERTEX
>::
get
(
*
this
,
strider
,
index
,
count
,
map_range
);
...
...
@@ -2326,9 +2335,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
{
U32
unsatisfied_mask
=
(
required_mask
&
~
data_mask
);
U32
i
=
0
;
while
(
i
<
TYPE_MAX
)
for
(
U32
i
=
0
;
i
<
TYPE_MAX
;
i
++
)
// <alchemy/>
{
U32
unsatisfied_flag
=
unsatisfied_mask
&
(
1
<<
i
);
switch
(
unsatisfied_flag
)
...
...
@@ -2355,7 +2362,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
LL_INFOS
()
<<
"Missing indices"
<<
LL_ENDL
;
}
LL_
ERR
S
()
<<
"Shader consumption mismatches data provision."
<<
LL_ENDL
;
LL_
WARN
S
()
<<
"Shader consumption mismatches data provision."
<<
LL_ENDL
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment