glsl/mesa: split gl_shader in two
There are two distinctly different uses of this struct. The first is to store GL shader objects. The second is to store information about a shader stage thats been linked. The two uses actually share few fields and there is clearly confusion about their use. For example the linked shaders map one to one with a program so can simply be destroyed along with the program. However previously we were calling reference counting on the linked shaders. We were also creating linked shaders with a name even though it is always 0 and called the driver version of the _mesa_new_shader() function unnecessarily for GL shader objects. Acked-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
@@ -272,7 +272,7 @@ public:
|
||||
*/
|
||||
class replace_varyings_visitor : public ir_rvalue_visitor {
|
||||
public:
|
||||
replace_varyings_visitor(struct gl_shader *sha,
|
||||
replace_varyings_visitor(struct gl_linked_shader *sha,
|
||||
const varying_info_visitor *info,
|
||||
unsigned external_texcoord_usage,
|
||||
unsigned external_color_usage,
|
||||
@@ -499,7 +499,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
struct gl_shader *shader;
|
||||
struct gl_linked_shader *shader;
|
||||
const varying_info_visitor *info;
|
||||
ir_variable *new_fragdata[MAX_DRAW_BUFFERS];
|
||||
ir_variable *new_texcoord[MAX_TEXTURE_COORD_UNITS];
|
||||
@@ -511,7 +511,7 @@ private:
|
||||
} /* anonymous namespace */
|
||||
|
||||
static void
|
||||
lower_texcoord_array(struct gl_shader *shader, const varying_info_visitor *info)
|
||||
lower_texcoord_array(struct gl_linked_shader *shader, const varying_info_visitor *info)
|
||||
{
|
||||
replace_varyings_visitor(shader, info,
|
||||
(1 << MAX_TEXTURE_COORD_UNITS) - 1,
|
||||
@@ -519,7 +519,7 @@ lower_texcoord_array(struct gl_shader *shader, const varying_info_visitor *info)
|
||||
}
|
||||
|
||||
static void
|
||||
lower_fragdata_array(struct gl_shader *shader)
|
||||
lower_fragdata_array(struct gl_linked_shader *shader)
|
||||
{
|
||||
varying_info_visitor info(ir_var_shader_out, true);
|
||||
info.get(shader->ir, 0, NULL);
|
||||
@@ -530,7 +530,8 @@ lower_fragdata_array(struct gl_shader *shader)
|
||||
|
||||
void
|
||||
do_dead_builtin_varyings(struct gl_context *ctx,
|
||||
gl_shader *producer, gl_shader *consumer,
|
||||
gl_linked_shader *producer,
|
||||
gl_linked_shader *consumer,
|
||||
unsigned num_tfeedback_decls,
|
||||
tfeedback_decl *tfeedback_decls)
|
||||
{
|
||||
|
Reference in New Issue
Block a user