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
9edebd68
Commit
9edebd68
authored
Aug 06, 2013
by
Nicolas Capens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement mipmapping for integer samplers.
TRAC #23655 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Nicolas Capens
parent
0fe1949d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
7 deletions
+82
-7
OutputHLSL.cpp
src/compiler/OutputHLSL.cpp
+82
-7
No files found.
src/compiler/OutputHLSL.cpp
View file @
9edebd68
...
@@ -1043,19 +1043,94 @@ void OutputHLSL::header()
...
@@ -1043,19 +1043,94 @@ void OutputHLSL::header()
{
{
if
(
IsSamplerArray
(
textureFunction
->
sampler
))
if
(
IsSamplerArray
(
textureFunction
->
sampler
))
{
{
out
<<
" float width; float height; float layers;
\n
"
out
<<
" float width; float height; float layers; float levels;
\n
"
;
" x.GetDimensions(width, height, layers);
\n
"
;
if
(
textureFunction
->
method
==
TextureFunction
::
LOD0
)
{
out
<<
" uint mip = 0;
\n
"
;
}
else
{
if
(
textureFunction
->
method
==
TextureFunction
::
IMPLICIT
||
textureFunction
->
method
==
TextureFunction
::
BIAS
)
{
out
<<
" x.GetDimensions(0, width, height, layers, levels);
\n
"
" float2 tSized = float2(t.x * width, t.y * height);
\n
"
" float dx = length(ddx(tSized));
\n
"
" float dy = length(ddy(tSized));
\n
"
" float lod = log2(max(sqrt(dx), sqrt(dy)));
\n
"
;
if
(
textureFunction
->
method
==
TextureFunction
::
BIAS
)
{
out
<<
" lod += bias;
\n
"
;
}
}
out
<<
" uint mip = uint(min(max(round(lod), 0), levels - 1));
\n
"
;
}
out
<<
" x.GetDimensions(mip, width, height, layers, levels);
\n
"
;
}
}
else
else
{
{
out
<<
" float width; float height;
\n
"
out
<<
" float width; float height; float levels;
\n
"
;
" x.GetDimensions(width, height);
\n
"
;
if
(
textureFunction
->
method
==
TextureFunction
::
LOD0
)
{
out
<<
" uint mip = 0;
\n
"
;
}
else
{
if
(
textureFunction
->
method
==
TextureFunction
::
IMPLICIT
||
textureFunction
->
method
==
TextureFunction
::
BIAS
)
{
out
<<
" x.GetDimensions(0, width, height, levels);
\n
"
" float2 tSized = float2(t.x * width, t.y * height);
\n
"
" float dx = length(ddx(tSized));
\n
"
" float dy = length(ddy(tSized));
\n
"
" float lod = log2(max(sqrt(dx), sqrt(dy)));
\n
"
;
if
(
textureFunction
->
method
==
TextureFunction
::
BIAS
)
{
out
<<
" lod += bias;
\n
"
;
}
}
out
<<
" uint mip = uint(min(max(round(lod), 0), levels - 1));
\n
"
;
}
out
<<
" x.GetDimensions(mip, width, height, levels);
\n
"
;
}
}
}
}
else
if
(
IsSampler3D
(
textureFunction
->
sampler
))
else
if
(
IsSampler3D
(
textureFunction
->
sampler
))
{
{
out
<<
" float width; float height; float depth;
\n
"
out
<<
" float width; float height; float depth; float levels;
\n
"
;
" x.GetDimensions(width, height, depth);
\n
"
;
if
(
textureFunction
->
method
==
TextureFunction
::
LOD0
)
{
out
<<
" uint mip = 0;
\n
"
;
}
else
{
if
(
textureFunction
->
method
==
TextureFunction
::
IMPLICIT
||
textureFunction
->
method
==
TextureFunction
::
BIAS
)
{
out
<<
" x.GetDimensions(0, width, height, depth, levels);
\n
"
" float3 tSized = float3(t.x * width, t.y * height, t.z * depth);
\n
"
" float dx = length(ddx(tSized));
\n
"
" float dy = length(ddy(tSized));
\n
"
" float lod = log2(max(sqrt(dx), sqrt(dy)));
\n
"
;
if
(
textureFunction
->
method
==
TextureFunction
::
BIAS
)
{
out
<<
" lod += bias;
\n
"
;
}
}
out
<<
" uint mip = uint(min(max(round(lod), 0), levels - 1));
\n
"
;
}
out
<<
" x.GetDimensions(mip, width, height, depth, levels);
\n
"
;
}
}
else
UNREACHABLE
();
else
UNREACHABLE
();
}
}
...
@@ -1195,7 +1270,7 @@ void OutputHLSL::header()
...
@@ -1195,7 +1270,7 @@ void OutputHLSL::header()
if
(
IsIntegerSampler
(
textureFunction
->
sampler
))
if
(
IsIntegerSampler
(
textureFunction
->
sampler
))
{
{
out
<<
",
0));"
;
// Sample from the top level
out
<<
",
mip));"
;
}
}
else
if
(
IsShadowSampler
(
textureFunction
->
sampler
))
else
if
(
IsShadowSampler
(
textureFunction
->
sampler
))
{
{
...
...
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