Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephan Seitz
pystencils
Commits
2e85d1d1
Commit
2e85d1d1
authored
Jan 14, 2020
by
Stephan Seitz
Browse files
Remove TextureAccess
parent
479cc5ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
pystencils/interpolation_astnodes.py
View file @
2e85d1d1
...
...
@@ -230,10 +230,10 @@ class InterpolatorAccess(TypedSymbol):
field
=
self
.
field
default_int_type
=
create_type
(
'int64'
)
use_textures
=
isinstance
(
self
,
TextureAccess
)
use_textures
=
isinstance
(
self
.
interpolator
,
TextureCachedField
)
if
use_textures
:
def
absolute_access
(
x
,
_
):
return
self
.
texture
.
at
((
o
for
o
in
x
))
return
self
.
symbol
.
interpolator
.
at
((
o
for
o
in
x
))
else
:
absolute_access
=
field
.
absolute_access
...
...
@@ -407,12 +407,6 @@ class TextureCachedField:
obj
=
cls
(
interpolator
.
field
,
interpolator
.
address_mode
,
interpolation_mode
=
interpolator
.
interpolation_mode
)
return
obj
def
at
(
self
,
offset
):
return
TextureAccess
(
self
.
symbol
,
*
offset
)
def
__getitem__
(
self
,
offset
):
return
TextureAccess
(
self
.
symbol
,
*
offset
)
def
__str__
(
self
):
return
'%s_texture_%s'
%
(
self
.
field
.
name
,
self
.
reproducible_hash
)
...
...
@@ -436,30 +430,6 @@ class TextureCachedField:
return
_hash
(
str
(
self
.
_hashable_contents
).
encode
()).
hexdigest
()
class
TextureAccess
(
InterpolatorAccess
):
def
__new__
(
cls
,
texture_symbol
,
*
offsets
,
**
kwargs
):
obj
=
TextureAccess
.
__xnew_cached_
(
cls
,
texture_symbol
,
*
offsets
,
**
kwargs
)
return
obj
def
__new_stage2__
(
self
,
symbol
,
*
offsets
):
obj
=
super
().
__xnew__
(
self
,
symbol
,
*
offsets
)
obj
.
required_global_declarations
=
symbol
.
interpolator
.
required_global_declarations
obj
.
required_global_declarations
[
0
].
_symbols_defined
.
add
(
obj
)
return
obj
def
__str__
(
self
):
return
'%s_texture(%s)'
%
(
self
.
interpolator
.
field
.
name
,
', '
.
join
(
str
(
o
)
for
o
in
self
.
offsets
))
@
property
def
texture
(
self
):
return
self
.
interpolator
# noinspection SpellCheckingInspection
__xnew__
=
staticmethod
(
__new_stage2__
)
# noinspection SpellCheckingInspection
__xnew_cached_
=
staticmethod
(
cacheit
(
__new_stage2__
))
class
TextureDeclaration
(
Node
):
"""
A global declaration of a texture. Visible both for device and host code.
...
...
@@ -534,4 +504,3 @@ def dtype_supports_textures(dtype):
return
dtype
().
itemsize
<=
4
return
dtype
.
itemsize
<=
4
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment