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
93e50deb
Commit
93e50deb
authored
Jul 09, 2013
by
Nicolas Capens
Committed by
Shannon Woods
Jul 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement array sampler support.
TRAC #23472 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Nicolas Capens
parent
67a819f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
9 deletions
+53
-9
BaseTypes.h
src/compiler/BaseTypes.h
+27
-0
OutputHLSL.cpp
src/compiler/OutputHLSL.cpp
+26
-9
No files found.
src/compiler/BaseTypes.h
View file @
93e50deb
...
@@ -206,6 +206,33 @@ inline bool IsSampler3D(TBasicType type)
...
@@ -206,6 +206,33 @@ inline bool IsSampler3D(TBasicType type)
return
false
;
return
false
;
}
}
inline
bool
IsSamplerArray
(
TBasicType
type
)
{
switch
(
type
)
{
case
EbtSampler2DArray
:
case
EbtISampler2DArray
:
case
EbtUSampler2DArray
:
return
true
;
case
EbtSampler2D
:
case
EbtISampler2D
:
case
EbtUSampler2D
:
case
EbtSampler2DRect
:
case
EbtSamplerExternalOES
:
case
EbtSampler3D
:
case
EbtISampler3D
:
case
EbtUSampler3D
:
case
EbtISamplerCube
:
case
EbtUSamplerCube
:
case
EbtSamplerCube
:
return
false
;
default:
assert
(
!
IsSampler
(
type
));
}
return
false
;
}
//
//
// Qualifiers and built-ins. These are mainly used to see what can be read
// Qualifiers and built-ins. These are mainly used to see what can be read
// or written, and by the machine dependent translator to know which registers
// or written, and by the machine dependent translator to know which registers
...
...
src/compiler/OutputHLSL.cpp
View file @
93e50deb
...
@@ -931,15 +931,15 @@ void OutputHLSL::header()
...
@@ -931,15 +931,15 @@ void OutputHLSL::header()
case
EbtSampler2D
:
out
<<
"Texture2D x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtSampler2D
:
out
<<
"Texture2D x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtSampler3D
:
out
<<
"Texture3D x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtSampler3D
:
out
<<
"Texture3D x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtSamplerCube
:
out
<<
"TextureCube x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtSamplerCube
:
out
<<
"TextureCube x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtSampler2DArray
:
out
<<
"Texture2DArray x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtSampler2DArray
:
out
<<
"Texture2DArray x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtISampler2D
:
out
<<
"Texture2D<int4> x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtISampler2D
:
out
<<
"Texture2D<int4> x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtISampler3D
:
out
<<
"Texture3D<int4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtISampler3D
:
out
<<
"Texture3D<int4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtISamplerCube
:
out
<<
"TextureCube<int4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtISamplerCube
:
out
<<
"TextureCube<int4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtISampler2DArray
:
out
<<
"Texture2DArray<int4> x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtISampler2DArray
:
out
<<
"Texture2DArray<int4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtUSampler2D
:
out
<<
"Texture2D<uint4> x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtUSampler2D
:
out
<<
"Texture2D<uint4> x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtUSampler3D
:
out
<<
"Texture3D<uint4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtUSampler3D
:
out
<<
"Texture3D<uint4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtUSamplerCube
:
out
<<
"TextureCube<uint4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtUSamplerCube
:
out
<<
"TextureCube<uint4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
case
EbtUSampler2DArray
:
out
<<
"Texture2DArray<uint4> x, SamplerState s"
;
hlslCoords
=
2
;
break
;
case
EbtUSampler2DArray
:
out
<<
"Texture2DArray<uint4> x, SamplerState s"
;
hlslCoords
=
3
;
break
;
default
:
UNREACHABLE
();
default
:
UNREACHABLE
();
}
}
}
}
...
@@ -985,8 +985,16 @@ void OutputHLSL::header()
...
@@ -985,8 +985,16 @@ void OutputHLSL::header()
{
{
if
(
IsSampler2D
(
textureFunction
->
sampler
))
if
(
IsSampler2D
(
textureFunction
->
sampler
))
{
{
out
<<
" uint width; uint height; uint numberOfLevels;
\n
"
if
(
IsSamplerArray
(
textureFunction
->
sampler
))
" x.GetDimensions(0, width, height, numberOfLevels);
\n
"
;
{
out
<<
" uint width; uint height; uint layers; uint numberOfLevels;
\n
"
" x.GetDimensions(0, width, height, layers, numberOfLevels);
\n
"
;
}
else
{
out
<<
" uint width; uint height; uint numberOfLevels;
\n
"
" x.GetDimensions(0, width, height, numberOfLevels);
\n
"
;
}
}
}
else
if
(
IsSampler3D
(
textureFunction
->
sampler
))
else
if
(
IsSampler3D
(
textureFunction
->
sampler
))
{
{
...
@@ -1052,10 +1060,19 @@ void OutputHLSL::header()
...
@@ -1052,10 +1060,19 @@ void OutputHLSL::header()
default
:
UNREACHABLE
();
default
:
UNREACHABLE
();
}
}
addressx
=
"int(floor(float(width) * frac("
;
addressx
=
"int(floor(float(width) * frac(("
;
addressy
=
"int(floor(float(height) * frac("
;
addressy
=
"int(floor(float(height) * frac(("
;
addressz
=
"int(floor(float(depth) * frac("
;
close
=
")))"
;
if
(
IsSamplerArray
(
textureFunction
->
sampler
))
{
addressz
=
"int(max(0, min(layers - 1, floor(0.5 + "
;
}
else
{
addressz
=
"int(floor(float(depth) * frac(("
;
}
close
=
"))))"
;
}
}
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