That looks very impressive (good progress). I would have to look at the actual GLSL produced by this.
The actual translation points look good.
From: "Jason Green" jave27@gmail.com Date: Thu, 8 Jun 2006 11:54:04 -0400
By the way, here's a comparison screenshot of Civ4 from before my hard drive failed, and this is without having texturing on pixel shaders entirely working. Using GLSL (working completely for vertex shaders 2.0, at least the instructions that Civilization 4 used):
http://cmhousing.net/wine/civ4_glsl.png
compared to:
http://cmhousing.net/wine/civ4_ingame2.png and http://cmhousing.net/wine/civ4_3.png
with current git and using regular ARB shaders.
So, we at least know that this is going to help. :-)
On 6/8/06, Jason Green jave27@gmail.com wrote:
The current cumulative patch is located here:
http://cmhousing.net/wine/glsl_cumul.diff
(This includes the recently submitted "Split constant loading out of drawPrim()" patch, which hasn't been applied to git yet)
Before submitting, I plan to fix the following things:
- Fix relative addressing (it was working correctly, then I lost some
stuff when my hard drive got corrupted, and now it's using R0 instead of A0 as the address register for some reason)
- Switch the shader_reg_maps.constantsF[] to a CHAR array instead of a
BOOL array (maybe even a bitmap(?))
This whole patchset should be a no-op for normal users, unless they have the UseGLSL registry key enabled. Here's a list of the changelogs that this cumulative patch entails, somewhat in the order that I'll be sending them:
[already sent] Move constant loading out of DrawPrimDrawStrided()
- DrawPrim is just too big of a function. This separates the passing
of constants to the shader into new functions.
- Fixes an off-by-one error when loading vertex declaration constants
(should be <, not <=)
- Adds a function for GLSL loading of constants (aka Uniforms)
- Adds a GLSL program variable to the stateblock and sets it to 0 (a
future patch will actually create this program)
Add GLSL helper functions to device.c
- Adds functions to attach & detach shader objects, create and delete
programs, and maintain the list of programs.
- Adds a list of GLSL shader programs to the device which is
initialized on Init3D(), and deleted on Release()
Add the bulk of the GLSL string generation functions
- Add a new file glsl_shader.c which contains almost every GLSL
specific function we'll need
- Move print_glsl_info() into glsl_shader.c
- Move the shader_reg_maps struct info into the private header, and
make it part of SHADER_OPCODE_ARG.
- Create a new shared ps/vs register map for float constants (future
patch will make ARB programs use this, too)
- This is a big patch, but none of the new functions in glsl_shader.c
are being called yet. This just sets them up.
Unified float constant register mapping between ARB pixel and vertex shaders.
- Got rid of the separate constant maps.
- Side effect of this is that the map is a bit larger for pixel
shaders than it needs to be.
- Will make this dynamic in a future patch.
Added more declarations to GLSL in generate_glsl_declarations()
- Declare more variable names for GLSL programs.
- Correct output name for pixel shaders (gl_FragColor instead of
glFragColor)
Map pixel shader instructions to GLSL generating functions.
- Also, delete the GLSL program when the refcount hits 0
Map vertex shader instructions to GLSL generating functions.
- Also, delete the GLSL program when the refcount hits 0
Allow drawPrim to create and use the GLSL program
- Now that we can fully create a GLSL program, this patch lets us
actually use it.
I would have submitted these all separate for review, but I have some janitorial git cleanup to do first to get all of this in the right order.
- Nick