[PATCH 5/7] [wined3d] implement shader_arb_load_np2fixup_constants
Tobias Jakobi
liquid.acid at gmx.net
Wed Jul 1 11:36:49 CDT 2009
---
dlls/wined3d/arb_program_shader.c | 42 ++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 9a0fe87..f32ec01 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -377,7 +377,47 @@ static void shader_arb_load_np2fixup_constants(
IWineD3DDevice* device,
char usePixelShader,
char useVertexShader) {
- /* not implemented */
+
+ IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl *) device;
+ const struct shader_arb_priv* const priv = (const struct shader_arb_priv *) deviceImpl->shader_priv;
+ IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
+ const WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
+
+ if (!usePixelShader) {
+ /* NP2 texcoord fixup is (currently) only done for pixelshaders. */
+ return;
+ }
+
+ if (priv->compiled_fprog && priv->compiled_fprog->np2fixup_info.super.active) {
+ const struct arb_ps_np2fixup_info* const fixup = &priv->compiled_fprog->np2fixup_info;
+ UINT i;
+ WORD active = fixup->super.active;
+ GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
+
+ for (i = 0; active; active >>= 1, ++i) {
+ const unsigned char idx = fixup->super.idx[i];
+ const IWineD3DTextureImpl* const tex = (const IWineD3DTextureImpl*) stateBlock->textures[i];
+ GLfloat* tex_dim = &np2fixup_constants[(idx >> 1) * 4];
+
+ if (!(active & 1)) continue;
+
+ if (!tex) {
+ FIXME("Nonexistent texture is flagged for NP2 texcoord fixup\n");
+ continue;
+ }
+
+ if (idx % 2) {
+ tex_dim[2] = tex->baseTexture.pow2Matrix[0]; tex_dim[3] = tex->baseTexture.pow2Matrix[5];
+ } else {
+ tex_dim[0] = tex->baseTexture.pow2Matrix[0]; tex_dim[1] = tex->baseTexture.pow2Matrix[5];
+ }
+ }
+
+ for (i = 0; i < fixup->super.num_consts; ++i) {
+ GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
+ fixup->offset + i, &np2fixup_constants[i * 4]));
+ }
+ }
}
/* GL locking is done by the caller. */
--
1.6.3.3
More information about the wine-patches
mailing list