mtypes: move gl_program to shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
This commit is contained in:
@@ -2092,199 +2092,6 @@ struct gl_bindless_image
|
||||
GLvoid *data;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Base class for any kind of program object
|
||||
*/
|
||||
struct gl_program
|
||||
{
|
||||
/** FIXME: This must be first until we split shader_info from nir_shader */
|
||||
struct shader_info info;
|
||||
|
||||
GLuint Id;
|
||||
GLint RefCount;
|
||||
GLubyte *String; /**< Null-terminated program text */
|
||||
|
||||
/** GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */
|
||||
GLenum16 Target;
|
||||
GLenum16 Format; /**< String encoding format */
|
||||
|
||||
GLboolean _Used; /**< Ever used for drawing? Used for debugging */
|
||||
|
||||
struct nir_shader *nir;
|
||||
|
||||
/* Saved and restored with metadata. Freed with ralloc. */
|
||||
void *driver_cache_blob;
|
||||
size_t driver_cache_blob_size;
|
||||
|
||||
/** Is this program written to on disk shader cache */
|
||||
bool program_written_to_cache;
|
||||
|
||||
/** A bitfield indicating which vertex shader inputs consume two slots
|
||||
*
|
||||
* This is used for mapping from single-slot input locations in the GL API
|
||||
* to dual-slot double input locations in the shader. This field is set
|
||||
* once as part of linking and never updated again to ensure the mapping
|
||||
* remains consistent.
|
||||
*
|
||||
* Note: There may be dual-slot variables in the original shader source
|
||||
* which do not appear in this bitfield due to having been eliminated by
|
||||
* the compiler prior to DualSlotInputs being calculated. There may also
|
||||
* be bits set in this bitfield which are set but which the shader never
|
||||
* reads due to compiler optimizations eliminating such variables after
|
||||
* DualSlotInputs is calculated.
|
||||
*/
|
||||
GLbitfield64 DualSlotInputs;
|
||||
/** Subset of OutputsWritten outputs written with non-zero index. */
|
||||
GLbitfield64 SecondaryOutputsWritten;
|
||||
/** TEXTURE_x_BIT bitmask */
|
||||
GLbitfield16 TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
|
||||
/** Bitfield of which samplers are used */
|
||||
GLbitfield SamplersUsed;
|
||||
/** Texture units used for shadow sampling. */
|
||||
GLbitfield ShadowSamplers;
|
||||
/** Texture units used for samplerExternalOES */
|
||||
GLbitfield ExternalSamplersUsed;
|
||||
|
||||
/** Named parameters, constants, etc. from program text */
|
||||
struct gl_program_parameter_list *Parameters;
|
||||
|
||||
/** Map from sampler unit to texture unit (set by glUniform1i()) */
|
||||
GLubyte SamplerUnits[MAX_SAMPLERS];
|
||||
|
||||
union {
|
||||
/** Fields used by GLSL programs */
|
||||
struct {
|
||||
/** Data shared by gl_program and gl_shader_program */
|
||||
struct gl_shader_program_data *data;
|
||||
|
||||
struct gl_active_atomic_buffer **AtomicBuffers;
|
||||
|
||||
/** Post-link transform feedback info. */
|
||||
struct gl_transform_feedback_info *LinkedTransformFeedback;
|
||||
|
||||
/**
|
||||
* Number of types for subroutine uniforms.
|
||||
*/
|
||||
GLuint NumSubroutineUniformTypes;
|
||||
|
||||
/**
|
||||
* Subroutine uniform remap table
|
||||
* based on the program level uniform remap table.
|
||||
*/
|
||||
GLuint NumSubroutineUniforms; /* non-sparse total */
|
||||
GLuint NumSubroutineUniformRemapTable;
|
||||
struct gl_uniform_storage **SubroutineUniformRemapTable;
|
||||
|
||||
/**
|
||||
* Num of subroutine functions for this stage and storage for them.
|
||||
*/
|
||||
GLuint NumSubroutineFunctions;
|
||||
GLuint MaxSubroutineFunctionIndex;
|
||||
struct gl_subroutine_function *SubroutineFunctions;
|
||||
|
||||
/**
|
||||
* Map from image uniform index to image unit (set by glUniform1i())
|
||||
*
|
||||
* An image uniform index is associated with each image uniform by
|
||||
* the linker. The image index associated with each uniform is
|
||||
* stored in the \c gl_uniform_storage::image field.
|
||||
*/
|
||||
GLubyte ImageUnits[MAX_IMAGE_UNIFORMS];
|
||||
|
||||
/**
|
||||
* Access qualifier specified in the shader for each image uniform
|
||||
* index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY, \c
|
||||
* GL_READ_WRITE, or \c GL_NONE to indicate both read-only and
|
||||
* write-only.
|
||||
*
|
||||
* It may be different, though only more strict than the value of
|
||||
* \c gl_image_unit::Access for the corresponding image unit.
|
||||
*/
|
||||
GLenum16 ImageAccess[MAX_IMAGE_UNIFORMS];
|
||||
|
||||
GLuint NumUniformBlocks;
|
||||
struct gl_uniform_block **UniformBlocks;
|
||||
struct gl_uniform_block **ShaderStorageBlocks;
|
||||
|
||||
/**
|
||||
* Bitmask of shader storage blocks not declared as read-only.
|
||||
*/
|
||||
unsigned ShaderStorageBlocksWriteAccess;
|
||||
|
||||
/** Which texture target is being sampled
|
||||
* (TEXTURE_1D/2D/3D/etc_INDEX)
|
||||
*/
|
||||
GLubyte SamplerTargets[MAX_SAMPLERS];
|
||||
|
||||
/**
|
||||
* Number of samplers declared with the bindless_sampler layout
|
||||
* qualifier as specified by ARB_bindless_texture.
|
||||
*/
|
||||
GLuint NumBindlessSamplers;
|
||||
GLboolean HasBoundBindlessSampler;
|
||||
struct gl_bindless_sampler *BindlessSamplers;
|
||||
|
||||
/**
|
||||
* Number of images declared with the bindless_image layout qualifier
|
||||
* as specified by ARB_bindless_texture.
|
||||
*/
|
||||
GLuint NumBindlessImages;
|
||||
GLboolean HasBoundBindlessImage;
|
||||
struct gl_bindless_image *BindlessImages;
|
||||
} sh;
|
||||
|
||||
/** ARB assembly-style program fields */
|
||||
struct {
|
||||
struct prog_instruction *Instructions;
|
||||
|
||||
/**
|
||||
* Local parameters used by the program.
|
||||
*
|
||||
* It's dynamically allocated because it is rarely used (just
|
||||
* assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries
|
||||
* once it's allocated.
|
||||
*/
|
||||
GLfloat (*LocalParams)[4];
|
||||
unsigned MaxLocalParams;
|
||||
|
||||
/** Bitmask of which register files are read/written with indirect
|
||||
* addressing. Mask of (1 << PROGRAM_x) bits.
|
||||
*/
|
||||
GLbitfield IndirectRegisterFiles;
|
||||
|
||||
/** Logical counts */
|
||||
/*@{*/
|
||||
GLuint NumInstructions;
|
||||
GLuint NumTemporaries;
|
||||
GLuint NumParameters;
|
||||
GLuint NumAttributes;
|
||||
GLuint NumAddressRegs;
|
||||
GLuint NumAluInstructions;
|
||||
GLuint NumTexInstructions;
|
||||
GLuint NumTexIndirections;
|
||||
/*@}*/
|
||||
/** Native, actual h/w counts */
|
||||
/*@{*/
|
||||
GLuint NumNativeInstructions;
|
||||
GLuint NumNativeTemporaries;
|
||||
GLuint NumNativeParameters;
|
||||
GLuint NumNativeAttributes;
|
||||
GLuint NumNativeAddressRegs;
|
||||
GLuint NumNativeAluInstructions;
|
||||
GLuint NumNativeTexInstructions;
|
||||
GLuint NumNativeTexIndirections;
|
||||
/*@}*/
|
||||
|
||||
/** Used by ARB assembly-style programs. Can only be true for vertex
|
||||
* programs.
|
||||
*/
|
||||
GLboolean IsPositionInvariant;
|
||||
} arb;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* State common to vertex and fragment programs.
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "main/config.h" /* for MAX_FEEDBACK_BUFFERS */
|
||||
#include "main/glheader.h"
|
||||
#include "util/mesa-sha1.h"
|
||||
#include "compiler/shader_info.h"
|
||||
#include "compiler/glsl/list.h"
|
||||
|
||||
/**
|
||||
@@ -497,5 +498,196 @@ struct gl_shader_program
|
||||
GLboolean ARB_fragment_coord_conventions_enable;
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for any kind of program object
|
||||
*/
|
||||
struct gl_program
|
||||
{
|
||||
/** FIXME: This must be first until we split shader_info from nir_shader */
|
||||
struct shader_info info;
|
||||
|
||||
GLuint Id;
|
||||
GLint RefCount;
|
||||
GLubyte *String; /**< Null-terminated program text */
|
||||
|
||||
/** GL_VERTEX/FRAGMENT_PROGRAM_ARB, GL_GEOMETRY_PROGRAM_NV */
|
||||
GLenum16 Target;
|
||||
GLenum16 Format; /**< String encoding format */
|
||||
|
||||
GLboolean _Used; /**< Ever used for drawing? Used for debugging */
|
||||
|
||||
struct nir_shader *nir;
|
||||
|
||||
/* Saved and restored with metadata. Freed with ralloc. */
|
||||
void *driver_cache_blob;
|
||||
size_t driver_cache_blob_size;
|
||||
|
||||
/** Is this program written to on disk shader cache */
|
||||
bool program_written_to_cache;
|
||||
|
||||
/** A bitfield indicating which vertex shader inputs consume two slots
|
||||
*
|
||||
* This is used for mapping from single-slot input locations in the GL API
|
||||
* to dual-slot double input locations in the shader. This field is set
|
||||
* once as part of linking and never updated again to ensure the mapping
|
||||
* remains consistent.
|
||||
*
|
||||
* Note: There may be dual-slot variables in the original shader source
|
||||
* which do not appear in this bitfield due to having been eliminated by
|
||||
* the compiler prior to DualSlotInputs being calculated. There may also
|
||||
* be bits set in this bitfield which are set but which the shader never
|
||||
* reads due to compiler optimizations eliminating such variables after
|
||||
* DualSlotInputs is calculated.
|
||||
*/
|
||||
GLbitfield64 DualSlotInputs;
|
||||
/** Subset of OutputsWritten outputs written with non-zero index. */
|
||||
GLbitfield64 SecondaryOutputsWritten;
|
||||
/** TEXTURE_x_BIT bitmask */
|
||||
GLbitfield16 TexturesUsed[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
|
||||
/** Bitfield of which samplers are used */
|
||||
GLbitfield SamplersUsed;
|
||||
/** Texture units used for shadow sampling. */
|
||||
GLbitfield ShadowSamplers;
|
||||
/** Texture units used for samplerExternalOES */
|
||||
GLbitfield ExternalSamplersUsed;
|
||||
|
||||
/** Named parameters, constants, etc. from program text */
|
||||
struct gl_program_parameter_list *Parameters;
|
||||
|
||||
/** Map from sampler unit to texture unit (set by glUniform1i()) */
|
||||
GLubyte SamplerUnits[MAX_SAMPLERS];
|
||||
|
||||
union {
|
||||
/** Fields used by GLSL programs */
|
||||
struct {
|
||||
/** Data shared by gl_program and gl_shader_program */
|
||||
struct gl_shader_program_data *data;
|
||||
|
||||
struct gl_active_atomic_buffer **AtomicBuffers;
|
||||
|
||||
/** Post-link transform feedback info. */
|
||||
struct gl_transform_feedback_info *LinkedTransformFeedback;
|
||||
|
||||
/**
|
||||
* Number of types for subroutine uniforms.
|
||||
*/
|
||||
GLuint NumSubroutineUniformTypes;
|
||||
|
||||
/**
|
||||
* Subroutine uniform remap table
|
||||
* based on the program level uniform remap table.
|
||||
*/
|
||||
GLuint NumSubroutineUniforms; /* non-sparse total */
|
||||
GLuint NumSubroutineUniformRemapTable;
|
||||
struct gl_uniform_storage **SubroutineUniformRemapTable;
|
||||
|
||||
/**
|
||||
* Num of subroutine functions for this stage and storage for them.
|
||||
*/
|
||||
GLuint NumSubroutineFunctions;
|
||||
GLuint MaxSubroutineFunctionIndex;
|
||||
struct gl_subroutine_function *SubroutineFunctions;
|
||||
|
||||
/**
|
||||
* Map from image uniform index to image unit (set by glUniform1i())
|
||||
*
|
||||
* An image uniform index is associated with each image uniform by
|
||||
* the linker. The image index associated with each uniform is
|
||||
* stored in the \c gl_uniform_storage::image field.
|
||||
*/
|
||||
GLubyte ImageUnits[MAX_IMAGE_UNIFORMS];
|
||||
|
||||
/**
|
||||
* Access qualifier specified in the shader for each image uniform
|
||||
* index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY, \c
|
||||
* GL_READ_WRITE, or \c GL_NONE to indicate both read-only and
|
||||
* write-only.
|
||||
*
|
||||
* It may be different, though only more strict than the value of
|
||||
* \c gl_image_unit::Access for the corresponding image unit.
|
||||
*/
|
||||
GLenum16 ImageAccess[MAX_IMAGE_UNIFORMS];
|
||||
|
||||
GLuint NumUniformBlocks;
|
||||
struct gl_uniform_block **UniformBlocks;
|
||||
struct gl_uniform_block **ShaderStorageBlocks;
|
||||
|
||||
/**
|
||||
* Bitmask of shader storage blocks not declared as read-only.
|
||||
*/
|
||||
unsigned ShaderStorageBlocksWriteAccess;
|
||||
|
||||
/** Which texture target is being sampled
|
||||
* (TEXTURE_1D/2D/3D/etc_INDEX)
|
||||
*/
|
||||
GLubyte SamplerTargets[MAX_SAMPLERS];
|
||||
|
||||
/**
|
||||
* Number of samplers declared with the bindless_sampler layout
|
||||
* qualifier as specified by ARB_bindless_texture.
|
||||
*/
|
||||
GLuint NumBindlessSamplers;
|
||||
GLboolean HasBoundBindlessSampler;
|
||||
struct gl_bindless_sampler *BindlessSamplers;
|
||||
|
||||
/**
|
||||
* Number of images declared with the bindless_image layout qualifier
|
||||
* as specified by ARB_bindless_texture.
|
||||
*/
|
||||
GLuint NumBindlessImages;
|
||||
GLboolean HasBoundBindlessImage;
|
||||
struct gl_bindless_image *BindlessImages;
|
||||
} sh;
|
||||
|
||||
/** ARB assembly-style program fields */
|
||||
struct {
|
||||
struct prog_instruction *Instructions;
|
||||
|
||||
/**
|
||||
* Local parameters used by the program.
|
||||
*
|
||||
* It's dynamically allocated because it is rarely used (just
|
||||
* assembly-style programs), and MAX_PROGRAM_LOCAL_PARAMS entries
|
||||
* once it's allocated.
|
||||
*/
|
||||
GLfloat (*LocalParams)[4];
|
||||
unsigned MaxLocalParams;
|
||||
|
||||
/** Bitmask of which register files are read/written with indirect
|
||||
* addressing. Mask of (1 << PROGRAM_x) bits.
|
||||
*/
|
||||
GLbitfield IndirectRegisterFiles;
|
||||
|
||||
/** Logical counts */
|
||||
/*@{*/
|
||||
GLuint NumInstructions;
|
||||
GLuint NumTemporaries;
|
||||
GLuint NumParameters;
|
||||
GLuint NumAttributes;
|
||||
GLuint NumAddressRegs;
|
||||
GLuint NumAluInstructions;
|
||||
GLuint NumTexInstructions;
|
||||
GLuint NumTexIndirections;
|
||||
/*@}*/
|
||||
/** Native, actual h/w counts */
|
||||
/*@{*/
|
||||
GLuint NumNativeInstructions;
|
||||
GLuint NumNativeTemporaries;
|
||||
GLuint NumNativeParameters;
|
||||
GLuint NumNativeAttributes;
|
||||
GLuint NumNativeAddressRegs;
|
||||
GLuint NumNativeAluInstructions;
|
||||
GLuint NumNativeTexInstructions;
|
||||
GLuint NumNativeTexIndirections;
|
||||
/*@}*/
|
||||
|
||||
/** Used by ARB assembly-style programs. Can only be true for vertex
|
||||
* programs.
|
||||
*/
|
||||
GLboolean IsPositionInvariant;
|
||||
} arb;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user