Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
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
Testicular Slingshot
Alchemy Viewer
Commits
c25a22f0
Commit
c25a22f0
authored
5 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Add ability to manually select internal storage formats for render targets
parent
5201d38d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llrender/llrendertarget.cpp
+9
-7
9 additions, 7 deletions
indra/llrender/llrendertarget.cpp
indra/llrender/llrendertarget.h
+3
-3
3 additions, 3 deletions
indra/llrender/llrendertarget.h
with
12 additions
and
10 deletions
indra/llrender/llrendertarget.cpp
+
9
−
7
View file @
c25a22f0
...
@@ -84,7 +84,9 @@ void LLRenderTarget::resize(U32 resx, U32 resy)
...
@@ -84,7 +84,9 @@ void LLRenderTarget::resize(U32 resx, U32 resy)
for
(
U32
i
=
0
;
i
<
mTex
.
size
();
++
i
)
for
(
U32
i
=
0
;
i
<
mTex
.
size
();
++
i
)
{
//resize color attachments
{
//resize color attachments
gGL
.
getTexUnit
(
0
)
->
bindManual
(
mUsage
,
mTex
[
i
]);
gGL
.
getTexUnit
(
0
)
->
bindManual
(
mUsage
,
mTex
[
i
]);
LLImageGL
::
setManualImage
(
LLTexUnit
::
getInternalType
(
mUsage
),
0
,
mInternalFormat
[
i
],
mResX
,
mResY
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
nullptr
,
false
);
const
auto
&
internal_format
=
mInternalFormat
[
i
];
LLImageGL
::
setManualImage
(
LLTexUnit
::
getInternalType
(
mUsage
),
0
,
std
::
get
<
0
>
(
internal_format
),
mResX
,
mResY
,
std
::
get
<
1
>
(
internal_format
),
std
::
get
<
2
>
(
internal_format
),
nullptr
,
false
);
sBytesAllocated
+=
pix_diff
*
4
;
sBytesAllocated
+=
pix_diff
*
4
;
}
}
...
@@ -109,7 +111,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy)
...
@@ -109,7 +111,7 @@ void LLRenderTarget::resize(U32 resx, U32 resy)
}
}
bool
LLRenderTarget
::
allocate
(
U32
resx
,
U32
resy
,
U32
color_fmt
,
bool
depth
,
bool
stencil
,
LLTexUnit
::
eTextureType
usage
,
bool
use_fbo
,
S32
samples
)
bool
LLRenderTarget
::
allocate
(
U32
resx
,
U32
resy
,
U32
color_fmt
,
bool
depth
,
bool
stencil
,
LLTexUnit
::
eTextureType
usage
,
bool
use_fbo
,
S32
samples
,
U32
pix_format
,
U32
pix_type
)
{
{
resx
=
llmin
(
resx
,
(
U32
)
gGLManager
.
mGLMaxTextureSize
);
resx
=
llmin
(
resx
,
(
U32
)
gGLManager
.
mGLMaxTextureSize
);
resy
=
llmin
(
resy
,
(
U32
)
gGLManager
.
mGLMaxTextureSize
);
resy
=
llmin
(
resy
,
(
U32
)
gGLManager
.
mGLMaxTextureSize
);
...
@@ -159,10 +161,10 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
...
@@ -159,10 +161,10 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
stop_glerror
();
stop_glerror
();
}
}
return
addColorAttachment
(
color_fmt
);
return
addColorAttachment
(
color_fmt
,
pix_format
,
pix_type
);
}
}
bool
LLRenderTarget
::
addColorAttachment
(
U32
color_fmt
)
bool
LLRenderTarget
::
addColorAttachment
(
U32
color_fmt
,
U32
pix_format
,
U32
pix_type
)
{
{
if
(
color_fmt
==
0
)
if
(
color_fmt
==
0
)
{
{
...
@@ -194,10 +196,10 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
...
@@ -194,10 +196,10 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
{
{
clear_glerror
();
clear_glerror
();
LLImageGL
::
setManualImage
(
LLTexUnit
::
getInternalType
(
mUsage
),
0
,
color_fmt
,
mResX
,
mResY
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
nullptr
,
false
);
LLImageGL
::
setManualImage
(
LLTexUnit
::
getInternalType
(
mUsage
),
0
,
color_fmt
,
mResX
,
mResY
,
pix_format
,
pix_type
,
nullptr
,
false
);
if
(
glGetError
()
!=
GL_NO_ERROR
)
if
(
glGetError
()
!=
GL_NO_ERROR
)
{
{
LL_WARNS
()
<<
"Could not allocate color buffer for render target."
<<
LL_ENDL
;
LL_WARNS
()
<<
"Could not allocate color buffer for render target."
<<
"format:"
<<
color_fmt
<<
" pixformat:"
<<
pix_format
<<
" pixtype:"
<<
pix_type
<<
LL_ENDL
;
return
false
;
return
false
;
}
}
}
}
...
@@ -235,7 +237,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
...
@@ -235,7 +237,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt)
}
}
mTex
.
push_back
(
tex
);
mTex
.
push_back
(
tex
);
mInternalFormat
.
push
_back
(
color_fmt
);
mInternalFormat
.
emplace
_back
(
color_fmt
,
pix_format
,
pix_type
);
#if !LL_DARWIN
#if !LL_DARWIN
if
(
gDebugGL
)
if
(
gDebugGL
)
...
...
This diff is collapsed.
Click to expand it.
indra/llrender/llrendertarget.h
+
3
−
3
View file @
c25a22f0
...
@@ -70,7 +70,7 @@ public:
...
@@ -70,7 +70,7 @@ public:
//allocate resources for rendering
//allocate resources for rendering
//must be called before use
//must be called before use
//multiple calls will release previously allocated resources
//multiple calls will release previously allocated resources
bool
allocate
(
U32
resx
,
U32
resy
,
U32
color_fmt
,
bool
depth
,
bool
stencil
,
LLTexUnit
::
eTextureType
usage
=
LLTexUnit
::
TT_TEXTURE
,
bool
use_fbo
=
false
,
S32
samples
=
0
);
bool
allocate
(
U32
resx
,
U32
resy
,
U32
color_fmt
,
bool
depth
,
bool
stencil
,
LLTexUnit
::
eTextureType
usage
=
LLTexUnit
::
TT_TEXTURE
,
bool
use_fbo
=
false
,
S32
samples
=
0
,
U32
pix_format
=
GL_RGBA
,
U32
pix_type
=
GL_UNSIGNED_BYTE
);
//resize existing attachments to use new resolution and color format
//resize existing attachments to use new resolution and color format
// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined
// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined
...
@@ -80,7 +80,7 @@ public:
...
@@ -80,7 +80,7 @@ public:
//add color buffer attachment
//add color buffer attachment
//limit of 4 color attachments per render target
//limit of 4 color attachments per render target
bool
addColorAttachment
(
U32
color_fmt
);
bool
addColorAttachment
(
U32
color_fmt
,
U32
pix_format
=
GL_RGBA
,
U32
pix_type
=
GL_UNSIGNED_BYTE
);
//allocate a depth texture
//allocate a depth texture
bool
allocateDepth
();
bool
allocateDepth
();
...
@@ -146,7 +146,7 @@ protected:
...
@@ -146,7 +146,7 @@ protected:
U32
mResX
;
U32
mResX
;
U32
mResY
;
U32
mResY
;
std
::
vector
<
U32
>
mTex
;
std
::
vector
<
U32
>
mTex
;
std
::
vector
<
U32
>
mInternalFormat
;
std
::
vector
<
std
::
tuple
<
U32
,
U32
,
U32
>
>
mInternalFormat
;
U32
mFBO
;
U32
mFBO
;
LLRenderTarget
*
mPreviousFBO
;
LLRenderTarget
*
mPreviousFBO
;
...
...
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