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
a734f27c
Commit
a734f27c
authored
Oct 31, 2012
by
daniel@transgaming.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move SetTexture calls to the renderer class
Trac #21727 git-svn-id:
https://angleproject.googlecode.com/svn/branches/dx11proto@1337
736b8ea6-26fd-11df-bfd4-992fa37f6226
parent
ba0570ef
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
17 deletions
+27
-17
Context.cpp
src/libGLESv2/Context.cpp
+5
-9
Texture.cpp
src/libGLESv2/Texture.cpp
+2
-6
Texture.h
src/libGLESv2/Texture.h
+1
-1
Renderer.cpp
src/libGLESv2/renderer/Renderer.cpp
+18
-0
Renderer.h
src/libGLESv2/renderer/Renderer.h
+1
-1
No files found.
src/libGLESv2/Context.cpp
View file @
a734f27c
...
@@ -2415,13 +2415,11 @@ void Context::applyTextures(SamplerType type)
...
@@ -2415,13 +2415,11 @@ void Context::applyTextures(SamplerType type)
int
samplerCount
=
(
type
==
SAMPLER_PIXEL
)
?
MAX_TEXTURE_IMAGE_UNITS
:
MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF
;
// Range of Direct3D 9 samplers of given sampler type
int
samplerCount
=
(
type
==
SAMPLER_PIXEL
)
?
MAX_TEXTURE_IMAGE_UNITS
:
MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF
;
// Range of Direct3D 9 samplers of given sampler type
unsigned
int
*
appliedTextureSerial
=
(
type
==
SAMPLER_PIXEL
)
?
mAppliedTextureSerialPS
:
mAppliedTextureSerialVS
;
unsigned
int
*
appliedTextureSerial
=
(
type
==
SAMPLER_PIXEL
)
?
mAppliedTextureSerialPS
:
mAppliedTextureSerialVS
;
int
d3dSamplerOffset
=
(
type
==
SAMPLER_PIXEL
)
?
0
:
D3DVERTEXTEXTURESAMPLER0
;
int
samplerRange
=
programBinary
->
getUsedSamplerRange
(
type
);
int
samplerRange
=
programBinary
->
getUsedSamplerRange
(
type
);
for
(
int
samplerIndex
=
0
;
samplerIndex
<
samplerRange
;
samplerIndex
++
)
for
(
int
samplerIndex
=
0
;
samplerIndex
<
samplerRange
;
samplerIndex
++
)
{
{
int
textureUnit
=
programBinary
->
getSamplerMapping
(
type
,
samplerIndex
);
// OpenGL texture image unit index
int
textureUnit
=
programBinary
->
getSamplerMapping
(
type
,
samplerIndex
);
// OpenGL texture image unit index
int
d3dSampler
=
samplerIndex
+
d3dSamplerOffset
;
if
(
textureUnit
!=
-
1
)
if
(
textureUnit
!=
-
1
)
{
{
...
@@ -2432,9 +2430,7 @@ void Context::applyTextures(SamplerType type)
...
@@ -2432,9 +2430,7 @@ void Context::applyTextures(SamplerType type)
if
(
appliedTextureSerial
[
samplerIndex
]
!=
texSerial
||
texture
->
hasDirtyParameters
()
||
texture
->
hasDirtyImages
())
if
(
appliedTextureSerial
[
samplerIndex
]
!=
texSerial
||
texture
->
hasDirtyParameters
()
||
texture
->
hasDirtyImages
())
{
{
IDirect3DBaseTexture9
*
d3dTexture
=
texture
->
getTexture
();
if
(
texture
->
isSamplerComplete
())
if
(
d3dTexture
)
{
{
if
(
appliedTextureSerial
[
samplerIndex
]
!=
texSerial
||
texture
->
hasDirtyParameters
())
if
(
appliedTextureSerial
[
samplerIndex
]
!=
texSerial
||
texture
->
hasDirtyParameters
())
{
{
...
@@ -2446,12 +2442,12 @@ void Context::applyTextures(SamplerType type)
...
@@ -2446,12 +2442,12 @@ void Context::applyTextures(SamplerType type)
if
(
appliedTextureSerial
[
samplerIndex
]
!=
texSerial
||
texture
->
hasDirtyImages
())
if
(
appliedTextureSerial
[
samplerIndex
]
!=
texSerial
||
texture
->
hasDirtyImages
())
{
{
m
Device
->
SetTexture
(
d3dSampler
,
d3dT
exture
);
m
Renderer
->
setTexture
(
type
,
samplerIndex
,
t
exture
);
}
}
}
}
else
else
{
{
m
Device
->
SetTexture
(
d3dSampler
,
getIncompleteTexture
(
textureType
)
->
getTexture
(
));
m
Renderer
->
setTexture
(
type
,
samplerIndex
,
getIncompleteTexture
(
textureType
));
}
}
appliedTextureSerial
[
samplerIndex
]
=
texSerial
;
appliedTextureSerial
[
samplerIndex
]
=
texSerial
;
...
@@ -2462,7 +2458,7 @@ void Context::applyTextures(SamplerType type)
...
@@ -2462,7 +2458,7 @@ void Context::applyTextures(SamplerType type)
{
{
if
(
appliedTextureSerial
[
samplerIndex
]
!=
0
)
if
(
appliedTextureSerial
[
samplerIndex
]
!=
0
)
{
{
m
Device
->
SetTexture
(
d3dSampler
,
NULL
);
m
Renderer
->
setTexture
(
type
,
samplerIndex
,
NULL
);
appliedTextureSerial
[
samplerIndex
]
=
0
;
appliedTextureSerial
[
samplerIndex
]
=
0
;
}
}
}
}
...
@@ -2472,7 +2468,7 @@ void Context::applyTextures(SamplerType type)
...
@@ -2472,7 +2468,7 @@ void Context::applyTextures(SamplerType type)
{
{
if
(
appliedTextureSerial
[
samplerIndex
]
!=
0
)
if
(
appliedTextureSerial
[
samplerIndex
]
!=
0
)
{
{
m
Device
->
SetTexture
(
samplerIndex
+
d3dSamplerOffset
,
NULL
);
m
Renderer
->
setTexture
(
type
,
samplerIndex
,
NULL
);
appliedTextureSerial
[
samplerIndex
]
=
0
;
appliedTextureSerial
[
samplerIndex
]
=
0
;
}
}
}
}
...
...
src/libGLESv2/Texture.cpp
View file @
a734f27c
...
@@ -1550,13 +1550,9 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
...
@@ -1550,13 +1550,9 @@ bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLsizei width, GL
return
true
;
return
true
;
}
}
IDirect3DBaseTexture9
*
Texture
::
getTexture
()
// D3D9_REPLACE
IDirect3DBaseTexture9
*
Texture
::
getD3DTexture
()
{
{
if
(
!
isSamplerComplete
())
{
return
NULL
;
}
// ensure the underlying texture is created
// ensure the underlying texture is created
if
(
getStorage
(
false
)
==
NULL
)
if
(
getStorage
(
false
)
==
NULL
)
{
{
...
...
src/libGLESv2/Texture.h
View file @
a734f27c
...
@@ -206,7 +206,7 @@ class Texture : public RefCountObject
...
@@ -206,7 +206,7 @@ class Texture : public RefCountObject
virtual
bool
isSamplerComplete
()
const
=
0
;
virtual
bool
isSamplerComplete
()
const
=
0
;
IDirect3DBaseTexture9
*
get
Texture
();
IDirect3DBaseTexture9
*
get
D3DTexture
();
// D3D9_REPLACE
virtual
Renderbuffer
*
getRenderbuffer
(
GLenum
target
)
=
0
;
virtual
Renderbuffer
*
getRenderbuffer
(
GLenum
target
)
=
0
;
virtual
void
generateMipmaps
()
=
0
;
virtual
void
generateMipmaps
()
=
0
;
...
...
src/libGLESv2/renderer/Renderer.cpp
View file @
a734f27c
...
@@ -381,6 +381,24 @@ void Renderer::setSamplerState(gl::SamplerType type, int index, const gl::Sample
...
@@ -381,6 +381,24 @@ void Renderer::setSamplerState(gl::SamplerType type, int index, const gl::Sample
}
}
}
}
void
Renderer
::
setTexture
(
gl
::
SamplerType
type
,
int
index
,
gl
::
Texture
*
texture
)
{
int
d3dSamplerOffset
=
(
type
==
gl
::
SAMPLER_PIXEL
)
?
0
:
D3DVERTEXTEXTURESAMPLER0
;
int
d3dSampler
=
index
+
d3dSamplerOffset
;
IDirect3DBaseTexture9
*
d3dTexture
=
NULL
;
if
(
texture
)
{
d3dTexture
=
texture
->
getD3DTexture
();
// If we get NULL back from getTexture here, something went wrong
// in the texture class and we're unexpectedly missing the d3d texture
ASSERT
(
d3dTexture
!=
NULL
);
}
mDevice
->
SetTexture
(
d3dSampler
,
d3dTexture
);
}
void
Renderer
::
releaseDeviceResources
()
void
Renderer
::
releaseDeviceResources
()
{
{
while
(
!
mEventQueryPool
.
empty
())
while
(
!
mEventQueryPool
.
empty
())
...
...
src/libGLESv2/renderer/Renderer.h
View file @
a734f27c
...
@@ -74,13 +74,13 @@ class Renderer
...
@@ -74,13 +74,13 @@ class Renderer
virtual void *createVertexbuffer();
virtual void *createVertexbuffer();
// state setup
// state setup
virtual void applyTexture();
virtual void applyShaders();
virtual void applyShaders();
virtual void applyConstants();
virtual void applyConstants();
virtual void applyRenderTargets();
virtual void applyRenderTargets();
virtual void applyState();
virtual void applyState();
#endif
#endif
virtual
void
setSamplerState
(
gl
::
SamplerType
type
,
int
index
,
const
gl
::
SamplerState
&
sampler
);
virtual
void
setSamplerState
(
gl
::
SamplerType
type
,
int
index
,
const
gl
::
SamplerState
&
sampler
);
virtual
void
setTexture
(
gl
::
SamplerType
type
,
int
index
,
gl
::
Texture
*
texture
);
// lost device
// lost device
virtual
void
markDeviceLost
();
virtual
void
markDeviceLost
();
...
...
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