Comment some (vertex) texture lookup functionality.

Issue=95 TRAC #16568 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@643 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent f494c9ca
#define MAJOR_VERSION 0 #define MAJOR_VERSION 0
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 642 #define BUILD_REVISION 643
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -2017,16 +2017,19 @@ void Context::applyTextures() ...@@ -2017,16 +2017,19 @@ void Context::applyTextures()
} }
} }
// For each Direct3D 9 sampler of either the pixel or vertex stage,
// looks up the corresponding OpenGL texture image unit and texture type,
// and sets the texture and its addressing/filtering state (or NULL when inactive).
void Context::applyTextures(SamplerType type) void Context::applyTextures(SamplerType type)
{ {
IDirect3DDevice9 *device = getDevice(); IDirect3DDevice9 *device = getDevice();
Program *programObject = getCurrentProgram(); Program *programObject = getCurrentProgram();
int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF; int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF; // Range of Direct3D 9 samplers of given sampler type
for (int samplerIndex = 0; samplerIndex < samplerCount; samplerIndex++) for (int samplerIndex = 0; samplerIndex < samplerCount; samplerIndex++)
{ {
int textureUnit = programObject->getSamplerMapping(type, samplerIndex); int textureUnit = programObject->getSamplerMapping(type, samplerIndex); // OpenGL texture image unit index
int d3dSampler = (type == SAMPLER_PIXEL) ? samplerIndex : D3DVERTEXTEXTURESAMPLER0 + samplerIndex; int d3dSampler = (type == SAMPLER_PIXEL) ? samplerIndex : D3DVERTEXTEXTURESAMPLER0 + samplerIndex;
unsigned int *appliedTextureSerial = (type == SAMPLER_PIXEL) ? mAppliedTextureSerialPS : mAppliedTextureSerialVS; unsigned int *appliedTextureSerial = (type == SAMPLER_PIXEL) ? mAppliedTextureSerialPS : mAppliedTextureSerialVS;
......
...@@ -191,8 +191,8 @@ int Program::getSemanticIndex(int attributeIndex) ...@@ -191,8 +191,8 @@ int Program::getSemanticIndex(int attributeIndex)
return mSemanticIndex[attributeIndex]; return mSemanticIndex[attributeIndex];
} }
// Returns the index of the texture unit corresponding to a Direct3D 9 sampler // Returns the index of the texture image unit (0-19) corresponding to a Direct3D 9 sampler
// index referenced in the compiled HLSL shader // index (0-15 for the pixel shader and 0-3 for the vertex shader).
GLint Program::getSamplerMapping(SamplerType type, unsigned int samplerIndex) GLint Program::getSamplerMapping(SamplerType type, unsigned int samplerIndex)
{ {
GLint logicalTextureUnit = -1; GLint logicalTextureUnit = -1;
...@@ -226,6 +226,8 @@ GLint Program::getSamplerMapping(SamplerType type, unsigned int samplerIndex) ...@@ -226,6 +226,8 @@ GLint Program::getSamplerMapping(SamplerType type, unsigned int samplerIndex)
return -1; return -1;
} }
// Returns the texture type for a given Direct3D 9 sampler type and
// index (0-15 for the pixel shader and 0-3 for the vertex shader).
TextureType Program::getSamplerTextureType(SamplerType type, unsigned int samplerIndex) TextureType Program::getSamplerTextureType(SamplerType type, unsigned int samplerIndex)
{ {
switch (type) switch (type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment