[WINED3D 1/5] Added shader_is_glsl_error() function to baseshader.
Jason Green
jave27 at gmail.com
Thu May 18 23:46:43 CDT 2006
The following patchset should be applied after my WINED3D 1-3 patches.
So, you can think of these as 4-8. Also, the next patch conflicts
with Phil Costin's TRACE patch, so I've included the adjusted version
of his patch as my #3 / 5.
- Prints out the error log of the compiled shader (if any), and
returns TRUE if there's an error
---
dlls/wined3d/baseshader.c | 33 ++++++++++++++++++++++++++++++++-
dlls/wined3d/wined3d_private.h | 9 +++++++++
2 files changed, 41 insertions(+), 1 deletions(-)
b188feb8753b6d3dbffd46d26509f8169623ffa2
diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c
index 6629d58..38968e3 100644
--- a/dlls/wined3d/baseshader.c
+++ b/dlls/wined3d/baseshader.c
@@ -29,6 +29,7 @@ #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
#define GLNAME_REQUIRE_GLSL ((const char *)1)
+#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl
*)This->wineD3DDevice)->wineD3D))->gl_info
inline static BOOL shader_is_version_token(DWORD token) {
return shader_is_pshader_version(token) ||
@@ -534,8 +535,12 @@ void generate_arb_declarations(IWineD3DB
output target */
void generate_glsl_declarations(IWineD3DBaseShader *iface,
SHADER_BUFFER* buffer) {
+ IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
+
FIXME("GLSL not fully implemented yet.\n");
-
+
+ /* Delare the uniforms (constants) that we need */
+ shader_addline(buffer, "uniform vec4 C[%u];\n",
This->baseShader.limits.constant_float);
}
/** Shared code in order to generate the bulk of the shader string.
@@ -662,6 +667,32 @@ void generate_base_shader(
}
}
+/** Checks the given GLSL shader program and object for errors. */
+BOOL shader_is_glsl_error(IWineD3DBaseShader *iface, GLhandleARB
shader, GLenum status_type)
+{
+ IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
+ BOOL retVal = FALSE;
+ int gl_error_flag;
+
+ /* Check for errors. (gl_error_flag will be 1 if everything is OK) */
+ GL_EXTCALL(glGetObjectParameterivARB(shader, status_type, &gl_error_flag));
+ if (gl_error_flag == 0) {
+ /* There was an error in either compiling or linking - get
the info log. */
+ int log_len;
+ unsigned max_buf_size = 4096; /* Should be big enough -
change if needed */
+ char buf[max_buf_size];
+
+ GL_EXTCALL(glGetObjectParameterivARB(shader,
GL_OBJECT_INFO_LOG_LENGTH_ARB, &log_len));
+ GL_EXTCALL(glGetInfoLogARB(shader, max_buf_size, &log_len, buf));
+ checkGLcall("glGetInfoLogARB");
+
+ FIXME("GLSL vertex shader failed\n");
+ TRACE("Shader compile/link error log:\n%s\n", buf);
+
+ retVal = TRUE;
+ }
+ return retVal;
+}
void shader_dump_ins_modifiers(const DWORD output) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 6754877..af5db01 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1353,6 +1353,10 @@ typedef struct IWineD3DBaseShaderImpl {
/* IWineD3DBaseShader */
IWineD3DBaseShaderClass baseShader;
+
+ IUnknown *parent;
+ IWineD3DDeviceImpl *wineD3DDevice;
+
} IWineD3DBaseShaderImpl;
extern void shader_get_registers_used(
@@ -1368,6 +1372,11 @@ extern void generate_base_shader(
SHADER_BUFFER* buffer,
CONST DWORD* pFunction);
+extern BOOL shader_is_glsl_error(
+ IWineD3DBaseShader *iface,
+ GLhandleARB shader,
+ GLenum status_type);
+
extern void shader_dump_ins_modifiers(
const DWORD output);
--
1.3.3
More information about the wine-patches
mailing list